diff --git a/src/gui/DatabaseWidget.cpp b/src/gui/DatabaseWidget.cpp index 1251dc2c2..5c35375f1 100644 --- a/src/gui/DatabaseWidget.cpp +++ b/src/gui/DatabaseWidget.cpp @@ -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() diff --git a/src/gui/DatabaseWidget.h b/src/gui/DatabaseWidget.h index 240fe28fd..b535a9b8f 100644 --- a/src/gui/DatabaseWidget.h +++ b/src/gui/DatabaseWidget.h @@ -129,6 +129,7 @@ private Q_SLOTS: private: void setClipboardTextAndMinimize(const QString& text); + void setIconFromParent(); Database* m_db; const QScopedPointer m_searchUi;