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

List:       kde-commits
Subject:    kdepim
From:       Bo Thorsen <bo () sonofthor ! dk>
Date:       2004-08-17 13:19:47
Message-ID: 20040817131947.BEB109A8E () office ! kde ! org
[Download RAW message or body]

CVS commit by thorsen: 

When accepting an event, the attendee status was not updated in the saved event. Fixed here


  M +14 -2     korganizer/kogroupware.cpp   1.34
  M +12 -5     plugins/kmail/bodypartformatter/text_calendar.cpp   1.21


--- kdepim/korganizer/kogroupware.cpp  #1.33:1.34
@@ -44,4 +44,5 @@
 #include "kocore.h"
 
+#include <libkdepim/email.h>
 #include <ktnef/ktnefparser.h>
 #include <ktnef/ktnefmessage.h>
@@ -155,4 +156,5 @@ void KOGroupware::incomingDirChanged( co
   QTextStream t(&f);
   t.setEncoding( QTextStream::UnicodeUTF8 );
+  QString receiver = KPIM::getEmailAddr( t.readLine() );
   QString iCal = t.read();
 
@@ -175,7 +177,17 @@ void KOGroupware::incomingDirChanged( co
     dynamic_cast<KCal::Incidence*>( message->event() );
   KCal::MailScheduler scheduler( mCalendar );
-  if ( action.startsWith( "accepted" ) )
+  if ( action.startsWith( "accepted" ) ) {
+    // Find myself and set to answered and accepted
+    KCal::Attendee::List attendees = incidence->attendees();
+    KCal::Attendee::List::ConstIterator it;
+    for ( it = attendees.begin(); it != attendees.end(); ++it ) {
+      if( (*it)->email() == receiver ) {
+        (*it)->setStatus( KCal::Attendee::Accepted );
+        (*it)->setRSVP(false);
+        break;
+      }
+    }
     scheduler.acceptTransaction( incidence, method, status );
-  else if ( action.startsWith( "cancel" ) )
+  } else if ( action.startsWith( "cancel" ) )
     // @TODO: Could this be done like the others?
     mCalendar->deleteIncidence( incidence );

--- kdepim/plugins/kmail/bodypartformatter/text_calendar.cpp  #1.20:1.21
@@ -531,5 +531,6 @@ class UrlHandler : public KMail::Interfa
     }
 
-    bool saveFile( const QString& iCal, const QString& type ) const
+    bool saveFile( const QString& receiver, const QString& iCal,
+                   const QString& type ) const
     {
       QString location = locateLocal( "data", "korganizer/income." + type,
@@ -547,5 +548,6 @@ class UrlHandler : public KMail::Interfa
         return false;
       } else {
-        QByteArray msgArray = iCal.utf8();
+        const QString message = receiver + '\n' + iCal;
+        QByteArray msgArray = message.utf8();
         f.writeBlock( msgArray, msgArray.size() );
         f.close();
@@ -556,6 +558,11 @@ class UrlHandler : public KMail::Interfa
     bool handleAccept( const QString& iCal, KMail::Callback& callback ) const
     {
+      const QString receiver = callback.receiver();
+      if ( receiver.isEmpty() )
+        // Must be some error. Still return true though, since we did handle it
+        return true;
+
       // First, save it for KOrganizer to handle
-      saveFile( iCal, "accepted" );
+      saveFile( receiver, iCal, "accepted" );
 
       // Now produce the return message
@@ -563,5 +570,5 @@ class UrlHandler : public KMail::Interfa
       Incidence* incidence = icalToString( iCal, format );
       if( !incidence ) return false;
-      setStatusOnMyself( incidence, Attendee::Accepted, callback.receiver() );
+      setStatusOnMyself( incidence, Attendee::Accepted, receiver );
       return mail( incidence, callback );
     }
@@ -588,5 +595,5 @@ class UrlHandler : public KMail::Interfa
       if ( path == "reply" || path == "cancel" )
         // These should just be saved with their type as the dir
-        return saveFile( iCal, path );
+        return saveFile( "Reciever Not Searched", iCal, path );
 
       return false;


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

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