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 years ago
parent 094f8d9a87
commit d1a4daaee6
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -515,13 +515,31 @@ TQColor KNote::bgColor() const
void KNote::setColor( const TQColor& fg, const TQColor& bg ) void KNote::setColor( const TQColor& fg, const TQColor& bg )
{ {
bool updateJournal = false;
TQString journalFg = m_journal->customProperty( "KNotes", "FgColor" );
if ( journalFg.isEmpty() || journalFg != fg.name() )
{
m_journal->setCustomProperty( "KNotes", "FgColor", 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() ); m_journal->setCustomProperty( "KNotes", "BgColor", bg.name() );
updateJournal = true;
}
m_config->setFgColor( fg ); m_config->setFgColor( fg );
m_config->setBgColor( bg ); m_config->setBgColor( bg );
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!! m_journal->updated(); // because setCustomProperty() doesn't call it!!
emit sigDataChanged(noteId()); emit sigDataChanged(noteId());
}
m_config->writeConfig(); m_config->writeConfig();
TQPalette newpalette = palette(); TQPalette newpalette = palette();

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

Loading…
Cancel
Save