Split EditWidgetIcons::save() into state() and reset().

This commit is contained in:
Felix Geyer 2016-07-31 23:53:26 +02:00 committed by Jonathan White
parent 61ce733c6f
commit 8f87b5cfd4
4 changed files with 12 additions and 8 deletions

View File

@ -61,11 +61,8 @@ EditWidgetIcons::~EditWidgetIcons()
{
}
IconStruct EditWidgetIcons::save()
IconStruct EditWidgetIcons::state() const
{
Q_ASSERT(m_database);
Q_ASSERT(!m_currentUuid.isNull());
IconStruct iconStruct;
if (m_ui->defaultIconsRadio->isChecked()) {
QModelIndex index = m_ui->defaultIconsView->currentIndex();
@ -86,9 +83,13 @@ IconStruct EditWidgetIcons::save()
}
}
return iconStruct;
}
void EditWidgetIcons::reset()
{
m_database = nullptr;
m_currentUuid = Uuid();
return iconStruct;
}
void EditWidgetIcons::load(Uuid currentUuid, Database* database, IconStruct iconStruct)

View File

@ -46,7 +46,8 @@ public:
explicit EditWidgetIcons(QWidget* parent = nullptr);
~EditWidgetIcons();
IconStruct save();
IconStruct state() const;
void reset();
void load(Uuid currentUuid, Database* database, IconStruct iconStruct);
private Q_SLOTS:

View File

@ -430,7 +430,7 @@ void EditEntryWidget::saveEntry()
m_entry->attributes()->copyCustomKeysFrom(m_entryAttributes);
m_entry->attachments()->copyDataFrom(m_entryAttachments);
IconStruct iconStruct = m_iconsWidget->save();
IconStruct iconStruct = m_iconsWidget->state();
if (iconStruct.number < 0) {
m_entry->setIcon(Entry::DefaultIconNumber);
@ -489,6 +489,7 @@ void EditEntryWidget::clear()
m_entryAttachments->clear();
m_autoTypeAssoc->clear();
m_historyModel->clear();
m_iconsWidget->reset();
}
void EditEntryWidget::togglePasswordGeneratorButton(bool checked)

View File

@ -113,7 +113,7 @@ void EditGroupWidget::save()
m_group->setDefaultAutoTypeSequence(m_mainUi->autoTypeSequenceCustomEdit->text());
}
IconStruct iconStruct = m_editGroupWidgetIcons->save();
IconStruct iconStruct = m_editGroupWidgetIcons->state();
if (iconStruct.number < 0) {
m_group->setIcon(Group::DefaultIconNumber);
@ -144,6 +144,7 @@ void EditGroupWidget::clear()
{
m_group = nullptr;
m_database = nullptr;
m_editGroupWidgetIcons->reset();
}
void EditGroupWidget::addTriStateItems(QComboBox* comboBox, bool inheritDefault)