From cc29364f06178f8f6b457384f2ec37a042bd9d43 Mon Sep 17 00:00:00 2001 From: tpearson Date: Wed, 1 Sep 2010 00:37:02 +0000 Subject: * Massive set of changes to bring in all fixes and enhancements from the Enterprise PIM branch * Ensured that the Trinity changes were applied on top of those enhancements, and any redundancy removed * Added journal read support to the CalDAV resource * Fixed CalDAV resource to use events URL for tasks and journals when separate URL checkbox unchecked git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1170461 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kresources/kolab/knotes/note.cpp | 41 +++++++++++++++++++++++++++++----------- 1 file changed, 30 insertions(+), 11 deletions(-) (limited to 'kresources/kolab/knotes/note.cpp') diff --git a/kresources/kolab/knotes/note.cpp b/kresources/kolab/knotes/note.cpp index 66556aaf..168dae56 100644 --- a/kresources/kolab/knotes/note.cpp +++ b/kresources/kolab/knotes/note.cpp @@ -108,7 +108,6 @@ bool Note::richText() const bool Note::loadAttribute( TQDomElement& element ) { TQString tagName = element.tagName(); - if ( tagName == "summary" ) setSummary( element.text() ); else if ( tagName == "foreground-color" ) @@ -136,8 +135,10 @@ bool Note::saveAttributes( TQDomElement& element ) const #endif writeString( element, "summary", summary() ); - writeString( element, "foreground-color", colorToString( foregroundColor() ) ); - writeString( element, "background-color", colorToString( backgroundColor() ) ); + if ( foregroundColor().isValid() ) + writeString( element, "foreground-color", colorToString( foregroundColor() ) ); + if ( backgroundColor().isValid() ) + writeString( element, "background-color", colorToString( backgroundColor() ) ); writeString( element, "knotes-richtext", mRichText ? "true" : "false" ); return true; @@ -183,11 +184,27 @@ void Note::setFields( const KCal::Journal* journal ) { KolabBase::setFields( journal ); - // TODO: background and foreground setSummary( journal->summary() ); - setBackgroundColor( journal->customProperty( "KNotes", "BgColor" ) ); - setForegroundColor( journal->customProperty( "KNotes", "FgColor" ) ); - setRichText( journal->customProperty( "KNotes", "RichText" ) == "true" ); + + TQString property = journal->customProperty( "KNotes", "BgColor" ); + if ( !property.isNull() ) { + setBackgroundColor( property ); + } else { + setBackgroundColor( "yellow" ); + } + property = journal->customProperty( "KNotes", "FgColor" ); + if ( !property.isNull() ) { + setForegroundColor( property ); + } else { + setForegroundColor( "black" ); + } + + property = journal->customProperty( "KNotes", "RichText" ); + if ( !property.isNull() ) { + setRichText( property == "true" ? true : false ); + } else { + setRichText( "false" ); + } } void Note::saveTo( KCal::Journal* journal ) @@ -196,10 +213,12 @@ void Note::saveTo( KCal::Journal* journal ) // TODO: background and foreground journal->setSummary( summary() ); - journal->setCustomProperty( "KNotes", "FgColor", - colorToString( foregroundColor() ) ); - journal->setCustomProperty( "KNotes", "BgColor", - colorToString( backgroundColor() ) ); + if ( foregroundColor().isValid() ) + journal->setCustomProperty( "KNotes", "FgColor", + colorToString( foregroundColor() ) ); + if ( backgroundColor().isValid() ) + journal->setCustomProperty( "KNotes", "BgColor", + colorToString( backgroundColor() ) ); journal->setCustomProperty( "KNotes", "RichText", richText() ? "true" : "false" ); } -- cgit v1.2.3