diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2020-03-02 16:37:32 +0900 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2020-03-05 11:18:10 +0900 |
commit | cb3ca8962d4572928ee2b6a5ceb33aca2c3b01b3 (patch) | |
tree | 90f8b45542e36c7d7589028c43ca396791b299c0 /knotes | |
parent | 61bec1acc6b601bc57a3b73bcc736c344a9e4c18 (diff) | |
download | tdepim-cb3ca8962d4572928ee2b6a5ceb33aca2c3b01b3.tar.gz tdepim-cb3ca8962d4572928ee2b6a5ceb33aca2c3b01b3.zip |
Fixed incorrect update of KNote "last modified" field caused by the lauch of KNotes. This resolves issue #38.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
(cherry picked from commit d1a4daaee61fc8dda57f11da1856e5fbe1725fca)
Diffstat (limited to 'knotes')
-rw-r--r-- | knotes/knote.cpp | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/knotes/knote.cpp b/knotes/knote.cpp index 4f70848bb..37894ee11 100644 --- a/knotes/knote.cpp +++ b/knotes/knote.cpp @@ -510,13 +510,31 @@ TQColor KNote::bgColor() const void KNote::setColor( const TQColor& fg, const TQColor& bg ) { - m_journal->setCustomProperty( "KNotes", "FgColor", fg.name() ); - m_journal->setCustomProperty( "KNotes", "BgColor", bg.name() ); + bool updateJournal = false; + TQString journalFg = m_journal->customProperty( "KNotes", "FgColor" ); + if ( journalFg.isEmpty() || journalFg != fg.name() ) + { + m_journal->setCustomProperty( "KNotes", "FgColor", fg.name() ); + updateJournal = true; + } + TQString journalbg = m_journal->customProperty( "KNotes", "BgColor" ); + if ( journalbg.isEmpty() || journalbg != bg.name() ) + { + m_journal->setCustomProperty( "KNotes", "BgColor", bg.name() ); + updateJournal = true; + } + m_config->setFgColor( fg ); m_config->setBgColor( bg ); - m_journal->updated(); // because setCustomProperty() doesn't call it!! - emit sigDataChanged(noteId()); + if (updateJournal) + { + // Only update the journal if new configuration was really used. + // This is necessary because setColor() is called also when loading a note from an .ics + // file and we do not want to inadvertantly update the last modified field each time. + m_journal->updated(); // because setCustomProperty() doesn't call it!! + emit sigDataChanged(noteId()); + } m_config->writeConfig(); TQPalette newpalette = palette(); |