diff --git a/src/core/Entry.cpp b/src/core/Entry.cpp index c98cc2a1..eae874ea 100644 --- a/src/core/Entry.cpp +++ b/src/core/Entry.cpp @@ -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; } diff --git a/src/core/EntryAttachments.cpp b/src/core/EntryAttachments.cpp index dc89576e..e39bf418 100644 --- a/src/core/EntryAttachments.cpp +++ b/src/core/EntryAttachments.cpp @@ -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; -} diff --git a/src/core/EntryAttachments.h b/src/core/EntryAttachments.h index a62f8b08..31b0c4ce 100644 --- a/src/core/EntryAttachments.h +++ b/src/core/EntryAttachments.h @@ -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(); diff --git a/src/core/EntryAttributes.cpp b/src/core/EntryAttributes.cpp index ffd6451e..f213a5da 100644 --- a/src/core/EntryAttributes.cpp +++ b/src/core/EntryAttributes.cpp @@ -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 diff --git a/src/core/EntryAttributes.h b/src/core/EntryAttributes.h index 67ab7907..49282d55 100644 --- a/src/core/EntryAttributes.h +++ b/src/core/EntryAttributes.h @@ -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; diff --git a/src/gui/entry/EditEntryWidget.cpp b/src/gui/entry/EditEntryWidget.cpp index 669395ae..37ef018d 100644 --- a/src/gui/entry/EditEntryWidget.cpp +++ b/src/gui/entry/EditEntryWidget.cpp @@ -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();