Add check if parent group has custom icon.

Refs #174
This commit is contained in:
Florian Geyer 2014-04-14 23:20:24 +02:00
parent 6c663a19bf
commit 967a9f0195
2 changed files with 15 additions and 2 deletions

View File

@ -214,10 +214,22 @@ void DatabaseWidget::createEntry()
m_newEntry->setUuid(Uuid::random());
m_newEntry->setUsername(m_db->metadata()->defaultUserName());
m_newParent = m_groupView->currentGroup();
if (m_newParent->iconNumber() != Group::DefaultIconNumber) {
setIconFromParent();
switchToEntryEdit(m_newEntry, true);
}
void DatabaseWidget::setIconFromParent()
{
if (m_newParent->iconNumber() == Group::DefaultIconNumber && m_newParent->iconUuid().isNull()) {
return;
}
if (m_newParent->iconUuid().isNull()) {
m_newEntry->setIcon(m_newParent->iconNumber());
}
switchToEntryEdit(m_newEntry, true);
else {
m_newEntry->setIcon(m_newParent->iconUuid());
}
}
void DatabaseWidget::cloneEntry()

View File

@ -129,6 +129,7 @@ private Q_SLOTS:
private:
void setClipboardTextAndMinimize(const QString& text);
void setIconFromParent();
Database* m_db;
const QScopedPointer<Ui::SearchWidget> m_searchUi;