[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kdepim] ce168cc: When writting the editor content into a KCalCore::
From:       Sergio Martins <iamsergio () gmail ! com>
Date:       2011-01-03 9:36:18
Message-ID: 20110103093618.41325A6092 () git ! kde ! org
[Download RAW message or body]

commit ce168ccedbbc4eea96c24006a9d0fc4578426e85
branch master
Author: Sergio Martins <iamsergio@gmail.com>
Date:   Mon Jan 3 02:31:18 2011 +0000

    When writting the editor content into a KCalCore::Incidence, create the Incidence \
with originalIncidence.clone()  and not with new. Otherwise, properties that can't be \
edited through the UI ( DTSTAMP,SEQUENCE,RELATED-TO... ) are lost when editing \
existing incidences.

diff --git a/incidenceeditor-ng/eventortododialog.cpp \
b/incidenceeditor-ng/eventortododialog.cpp index 3c7708b..40fad4c 100644
--- a/incidenceeditor-ng/eventortododialog.cpp
+++ b/incidenceeditor-ng/eventortododialog.cpp
@@ -476,19 +476,9 @@ Akonadi::Item EventOrTodoDialogPrivate::save( const \
Akonadi::Item &item )  Q_ASSERT( mEditor->incidence<KCalCore::Incidence>() );
 
   KCalCore::Incidence::Ptr incidenceInEditor = \
                mEditor->incidence<KCalCore::Incidence>();
-  KCalCore::Incidence::Ptr newIncidence;
+  KCalCore::Incidence::Ptr newIncidence( incidenceInEditor->clone() );
 
   Akonadi::Item result = item;
-  if ( incidenceInEditor->type() == KCalCore::Incidence::TypeEvent ) {
-    newIncidence = KCalCore::Event::Ptr( new KCalCore::Event );
-  } else if ( incidenceInEditor->type() == KCalCore::Incidence::TypeTodo ) {
-    newIncidence = KCalCore::Todo::Ptr( new KCalCore::Todo );
-  } else if ( incidenceInEditor->type() == KCalCore::Incidence::TypeJournal ) {
-    newIncidence = KCalCore::Journal::Ptr( new KCalCore::Journal );
-  } else {
-    Q_ASSERT_X( false, "save", "Invalid Incidence type" );
-  }
-
   result.setMimeType( newIncidence->mimeType() );
 
   // There's no editor that has the relatedTo property. We must set it here, by \
                hand.
diff --git a/incidenceeditor-ng/incidencedatetime.cpp \
b/incidenceeditor-ng/incidencedatetime.cpp index 441ecaf..cffba6c 100644
--- a/incidenceeditor-ng/incidencedatetime.cpp
+++ b/incidenceeditor-ng/incidencedatetime.cpp
@@ -708,32 +708,20 @@ void IncidenceDateTime::save( const KCalCore::Event::Ptr &event \
)  
 void IncidenceDateTime::save( const KCalCore::Todo::Ptr &todo )
 {
-  if ( mUi->mWholeDayCheck->isChecked() ) { // All day todo
-    todo->setAllDay( true );
+  todo->setAllDay( mUi->mWholeDayCheck->isChecked() );
 
-    if ( mUi->mStartCheck->isChecked() ) {
-      KDateTime todoDT = currentStartDateTime();
-      todoDT.setDateOnly( true );
-      todo->setDtStart( todoDT );
-    }
-
-    if ( mUi->mEndCheck->isChecked() ) {
-      KDateTime todoDT = currentEndDateTime();
-      todoDT.setDateOnly( true );
-      todo->setDtDue( todoDT );
-    }
-  } else { // Timed todo
-    todo->setAllDay( false );
-
-    if ( mUi->mStartCheck->isChecked() ) {
-      KDateTime todoDT = currentStartDateTime();
-      todo->setDtStart( todoDT );
-    }
+  if ( mUi->mStartCheck->isChecked() ) {
+    KDateTime todoDT = currentStartDateTime();
+    todo->setDtStart( todoDT );
+  } else {
+    todo->setHasStartDate( false );
+  }
 
-    if ( mUi->mEndCheck->isChecked() ) {
-      KDateTime todoDT = currentEndDateTime();
-      todo->setDtDue( todoDT );
-    }
+  if ( mUi->mEndCheck->isChecked() ) {
+    KDateTime todoDT = currentEndDateTime();
+    todo->setDtDue( todoDT );
+  } else {
+    todo->setHasDueDate( false );
   }
 }
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic