mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Only emit signals from clear() when the internal data is non-empty.
Also make sure that m_attributes always contains the default attributes.
This commit is contained in:
parent
8f79e914f4
commit
51854a7a45
@ -112,6 +112,10 @@ void EntryAttachments::copyFrom(const EntryAttachments* other)
|
||||
|
||||
void EntryAttachments::clear()
|
||||
{
|
||||
if (m_attachments.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Q_EMIT aboutToBeReset();
|
||||
|
||||
m_attachments.clear();
|
||||
|
@ -22,9 +22,7 @@ const QStringList EntryAttributes::m_defaultAttibutes(QStringList() << "Title" <
|
||||
EntryAttributes::EntryAttributes(QObject* parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
Q_FOREACH (const QString& key, m_defaultAttibutes) {
|
||||
set(key, "");
|
||||
}
|
||||
clear();
|
||||
}
|
||||
|
||||
QList<QString> EntryAttributes::keys() const
|
||||
@ -123,11 +121,19 @@ void EntryAttributes::copyFrom(const EntryAttributes* other)
|
||||
|
||||
void EntryAttributes::clear()
|
||||
{
|
||||
if (m_attributes.keys().size() == m_defaultAttibutes.size() && m_protectedAttributes.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Q_EMIT aboutToBeReset();
|
||||
|
||||
m_attributes.clear();
|
||||
m_protectedAttributes.clear();
|
||||
|
||||
Q_FOREACH (const QString& key, m_defaultAttibutes) {
|
||||
m_attributes.insert(key, "");
|
||||
}
|
||||
|
||||
Q_EMIT reset();
|
||||
Q_EMIT modified();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user