summaryrefslogtreecommitdiffstats
path: root/knotes
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2020-03-02 16:37:32 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2020-03-02 16:37:32 +0900
commitd1a4daaee61fc8dda57f11da1856e5fbe1725fca (patch)
tree4dea115a8a3286f4daa35a3c570b16422e0619d9 /knotes
parent094f8d9a878ff83db4e3bdd5ca2bcb273f96c7ea (diff)
downloadtdepim-d1a4daaee61fc8dda57f11da1856e5fbe1725fca.tar.gz
tdepim-d1a4daaee61fc8dda57f11da1856e5fbe1725fca.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>
Diffstat (limited to 'knotes')
-rw-r--r--knotes/knote.cpp26
1 files changed, 22 insertions, 4 deletions
diff --git a/knotes/knote.cpp b/knotes/knote.cpp
index e20b52ef8..2a78d7189 100644
--- a/knotes/knote.cpp
+++ b/knotes/knote.cpp
@@ -515,13 +515,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();