mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Replace EntryAttachments and EntryAttributes operator=() with copyDataFrom().
QObjects are not supposed to have assignment operators.
This commit is contained in:
parent
c7107de2a7
commit
a50d2709e7
@ -494,8 +494,8 @@ Entry* Entry::clone() const
|
||||
entry->setUpdateTimeinfo(false);
|
||||
entry->m_uuid = m_uuid;
|
||||
entry->m_data = m_data;
|
||||
*entry->m_attributes = *m_attributes;
|
||||
*entry->m_attachments = *m_attachments;
|
||||
entry->m_attributes->copyDataFrom(m_attributes);
|
||||
entry->m_attachments->copyDataFrom(m_attachments);
|
||||
entry->m_autoTypeAssociations->copyDataFrom(this->m_autoTypeAssociations);
|
||||
entry->setUpdateTimeinfo(true);
|
||||
|
||||
@ -510,8 +510,8 @@ void Entry::beginUpdate()
|
||||
m_tmpHistoryItem->setUpdateTimeinfo(false);
|
||||
m_tmpHistoryItem->m_uuid = m_uuid;
|
||||
m_tmpHistoryItem->m_data = m_data;
|
||||
*m_tmpHistoryItem->m_attributes = *m_attributes;
|
||||
*m_tmpHistoryItem->m_attachments = *m_attachments;
|
||||
m_tmpHistoryItem->m_attributes->copyDataFrom(m_attributes);
|
||||
m_tmpHistoryItem->m_attachments->copyDataFrom(m_attachments);
|
||||
|
||||
m_modifiedSinceBegin = false;
|
||||
}
|
||||
|
@ -92,6 +92,18 @@ void EntryAttachments::clear()
|
||||
Q_EMIT modified();
|
||||
}
|
||||
|
||||
void EntryAttachments::copyDataFrom(const EntryAttachments* other)
|
||||
{
|
||||
if (*this != *other) {
|
||||
Q_EMIT aboutToBeReset();
|
||||
|
||||
m_attachments = other->m_attachments;
|
||||
|
||||
Q_EMIT reset();
|
||||
Q_EMIT modified();
|
||||
}
|
||||
}
|
||||
|
||||
bool EntryAttachments::operator==(const EntryAttachments& other) const
|
||||
{
|
||||
return m_attachments == other.m_attachments;
|
||||
@ -101,17 +113,3 @@ bool EntryAttachments::operator!=(const EntryAttachments& other) const
|
||||
{
|
||||
return m_attachments != other.m_attachments;
|
||||
}
|
||||
|
||||
EntryAttachments& EntryAttachments::operator=(const EntryAttachments& other)
|
||||
{
|
||||
if (*this != other) {
|
||||
Q_EMIT aboutToBeReset();
|
||||
|
||||
m_attachments = other.m_attachments;
|
||||
|
||||
Q_EMIT reset();
|
||||
Q_EMIT modified();
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
@ -35,9 +35,9 @@ public:
|
||||
void set(const QString& key, const QByteArray& value);
|
||||
void remove(const QString& key);
|
||||
void clear();
|
||||
void copyDataFrom(const EntryAttachments* other);
|
||||
bool operator==(const EntryAttachments& other) const;
|
||||
bool operator!=(const EntryAttachments& other) const;
|
||||
EntryAttachments& operator=(const EntryAttachments& other);
|
||||
|
||||
Q_SIGNALS:
|
||||
void modified();
|
||||
|
@ -181,19 +181,17 @@ bool EntryAttributes::areCustomKeysDifferent(const EntryAttributes* other)
|
||||
return false;
|
||||
}
|
||||
|
||||
EntryAttributes& EntryAttributes::operator=(const EntryAttributes& other)
|
||||
void EntryAttributes::copyDataFrom(const EntryAttributes* other)
|
||||
{
|
||||
if (*this != other) {
|
||||
if (*this != *other) {
|
||||
Q_EMIT aboutToBeReset();
|
||||
|
||||
m_attributes = other.m_attributes;
|
||||
m_protectedAttributes = other.m_protectedAttributes;
|
||||
m_attributes = other->m_attributes;
|
||||
m_protectedAttributes = other->m_protectedAttributes;
|
||||
|
||||
Q_EMIT reset();
|
||||
Q_EMIT modified();
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool EntryAttributes::operator==(const EntryAttributes& other) const
|
||||
|
@ -41,7 +41,7 @@ public:
|
||||
bool areCustomKeysDifferent(const EntryAttributes* other);
|
||||
void clear();
|
||||
int attributesSize();
|
||||
EntryAttributes& operator=(const EntryAttributes& other);
|
||||
void copyDataFrom(const EntryAttributes* other);
|
||||
bool operator==(const EntryAttributes& other) const;
|
||||
bool operator!=(const EntryAttributes& other) const;
|
||||
|
||||
|
@ -263,7 +263,7 @@ void EditEntryWidget::setForms(const Entry* entry, bool restore)
|
||||
|
||||
m_notesUi->notesEdit->setPlainText(entry->notes());
|
||||
|
||||
*m_entryAttachments = *entry->attachments();
|
||||
m_entryAttachments->copyDataFrom(entry->attachments());
|
||||
m_entryAttributes->copyCustomKeysFrom(entry->attributes());
|
||||
|
||||
if (m_attributesModel->rowCount() != 0) {
|
||||
@ -355,7 +355,7 @@ void EditEntryWidget::saveEntry()
|
||||
m_entry->setNotes(m_notesUi->notesEdit->toPlainText());
|
||||
|
||||
m_entry->attributes()->copyCustomKeysFrom(m_entryAttributes);
|
||||
*m_entry->attachments() = *m_entryAttachments;
|
||||
m_entry->attachments()->copyDataFrom(m_entryAttachments);
|
||||
|
||||
IconStruct iconStruct = m_iconsWidget->save();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user