Browse Source

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>
pull/40/head
Michele Calgaro 5 months ago
parent
commit
d1a4daaee6
No known key found for this signature in database GPG Key ID: 2A75B7CA8ADED5CF
2 changed files with 23 additions and 5 deletions
  1. +22
    -4
      knotes/knote.cpp
  2. +1
    -1
      kontact/plugins/knotes/knotes_part_p.h

+ 22
- 4
knotes/knote.cpp View File

@@ -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();


+ 1
- 1
kontact/plugins/knotes/knotes_part_p.h View File

@@ -71,7 +71,7 @@ class KNotesIconViewItem : public TDEIconViewItem
TQPixmap icon = TDEGlobal::iconLoader()->loadIcon( "knotes", TDEIcon::Desktop );
icon = effect.apply( icon, TDEIconEffect::Colorize, 1, color, false );
setPixmap( icon );
setText( journal->summary() );
TDEIconViewItem::setText( journal->summary() );
}

KCal::Journal *journal()


Loading…
Cancel
Save