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

List:       kde-commits
Subject:    branches/work/akonadi-ports/kdepim/korganizer
From:       Kevin Ottens <ervin () kde ! org>
Date:       2010-01-06 14:32:26
Message-ID: 1262788346.685578.3954.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1070703 by ervin:

Make the MailScheduler independent of IncidenceChanger.


 M  +2 -2      akonadicalendaradaptor.h  
 M  +3 -3      calendarview.cpp  
 M  +2 -2      incidencechanger.cpp  
 M  +4 -4      kogroupware.cpp  
 M  +16 -9     mailscheduler.cpp  
 M  +3 -5      mailscheduler.h  


--- branches/work/akonadi-ports/kdepim/korganizer/akonadicalendaradaptor.h \
#1070702:1070703 @@ -290,7 +290,7 @@
         }
 
         if ( !KOGroupware::instance()->doNotNotify() && notifyOrganizer ) {
-          MailScheduler scheduler( static_cast<AkonadiCalendar*>(mCalendar), 0 );
+          MailScheduler scheduler( static_cast<AkonadiCalendar*>(mCalendar) );
           scheduler.performTransaction( tmp.get(), KCal::iTIPReply );
         }
         //reset the doNotNotify flag
@@ -333,7 +333,7 @@
       inc->clearAttendees();
 
       // Send the mail
-      MailScheduler scheduler( mCalendar, 0 );
+      MailScheduler scheduler( mCalendar );
       if ( scheduler.performTransaction( incidence.get(), method ) ) {
         KMessageBox::information( 0,
                                   i18n( "The groupware message for item '%1' "
--- branches/work/akonadi-ports/kdepim/korganizer/calendarview.cpp #1070702:1070703
@@ -1439,7 +1439,7 @@
     inc->clearAttendees();
 
     // Send the mail
-    MailScheduler scheduler( mCalendar, mChanger );
+    MailScheduler scheduler( mCalendar );
     if ( scheduler.publish( incidence.get(), publishdlg->addresses() ) ) {
       KMessageBox::information( this, i18n( "The item information was successfully \
                sent." ),
                                 i18n( "Publishing" ), "IncidencePublishSuccess" );
@@ -1546,7 +1546,7 @@
   QPointer<PublishDialog> publishdlg = new PublishDialog();
   if ( publishdlg->exec() == QDialog::Accepted ) {
     // Send the mail
-    MailScheduler scheduler( mCalendar, mChanger );
+    MailScheduler scheduler( mCalendar );
     if ( scheduler.publish( freebusy, publishdlg->addresses() ) ) {
       KMessageBox::information(
         this,
@@ -1589,7 +1589,7 @@
   inc->clearAttendees();
 
   // Send the mail
-  MailScheduler scheduler( mCalendar, mChanger );
+  MailScheduler scheduler( mCalendar );
   if ( scheduler.performTransaction( incidence.get(), method ) ) {
     KMessageBox::information( this,
                               i18n( "The groupware message for item '%1' "
--- branches/work/akonadi-ports/kdepim/korganizer/incidencechanger.cpp \
#1070702:1070703 @@ -122,7 +122,7 @@
       // manually.
       // FIXME: Groupware scheduling should be factored out to it's own class
       //        anyway
-      MailScheduler scheduler( static_cast<AkonadiCalendar*>(mCalendar), this );
+      MailScheduler scheduler( static_cast<AkonadiCalendar*>(mCalendar) );
       scheduler.performTransaction( incidence.get(), iTIPCancel );
     }
   }
@@ -257,7 +257,7 @@
     }
 
     if ( !KOGroupware::instance()->doNotNotify() && notifyOrganizer ) {
-      MailScheduler scheduler( static_cast<AkonadiCalendar*>(mCalendar), this );
+      MailScheduler scheduler( static_cast<AkonadiCalendar*>(mCalendar) );
       scheduler.performTransaction( tmp.get(), KCal::iTIPReply );
     }
     //reset the doNotNotify flag
--- branches/work/akonadi-ports/kdepim/korganizer/kogroupware.cpp #1070702:1070703
@@ -184,7 +184,7 @@
     delete message;
     return;
   }
-  MailScheduler scheduler( mCalendar, mView->incidenceChanger() );
+  MailScheduler scheduler( mCalendar );
   if ( action.startsWith( QLatin1String( "accepted" ) ) ||
        action.startsWith( QLatin1String( "tentative" ) ) ||
        action.startsWith( QLatin1String( "delegated" ) ) ||
@@ -397,7 +397,7 @@
       incidence->setSummary( i18n( "<placeholder>No summary given</placeholder>" ) \
);  }
     // Send the mail
-    MailScheduler scheduler( mCalendar, mView->incidenceChanger() );
+    MailScheduler scheduler( mCalendar );
     if( scheduler.performTransaction( incidence, method ) )
       return true;
     rc = KMessageBox::questionYesNo(
@@ -424,11 +424,11 @@
     tmp->addComment( i18n( "Proposed new meeting time: %1 - %2",
                            IncidenceFormatter::dateToString( newEvent->dtStart() ),
                            IncidenceFormatter::dateToString( newEvent->dtEnd() ) ) \
                );
-    MailScheduler scheduler( mCalendar, mView->incidenceChanger() );
+    MailScheduler scheduler( mCalendar );
     scheduler.performTransaction( tmp, KCal::iTIPReply );
     delete tmp;
   } else {
-    MailScheduler scheduler( mCalendar, mView->incidenceChanger() );
+    MailScheduler scheduler( mCalendar );
     scheduler.performTransaction( newEvent, iTIPCounter );
   }
 }
--- branches/work/akonadi-ports/kdepim/korganizer/mailscheduler.cpp #1070702:1070703
@@ -23,13 +23,15 @@
 */
 
 #include "mailscheduler.h"
-#include "incidencechanger.h"
 #include "kocore.h"
 #include "komailclient.h"
 #include "koprefs.h"
 #include "akonadicalendar.h"
 #include "akonadicalendaradaptor.h"
 
+#include <Akonadi/ItemCreateJob>
+#include <Akonadi/ItemModifyJob>
+
 #include <KCal/Calendar>
 #include <KCal/ICalFormat>
 //#include <KCal/Scheduler>
@@ -44,9 +46,9 @@
 
 using namespace KOrg;
 
-MailScheduler::MailScheduler( KOrg::AkonadiCalendar *calendar, \
KOrg::IncidenceChangerBase *changer ) +MailScheduler::MailScheduler( \
KOrg::AkonadiCalendar *calendar )  //: Scheduler( calendar )
-  : mCalendar( calendar ), mChanger( changer ), mFormat( new ICalFormat() )
+  : mCalendar( calendar ), mFormat( new ICalFormat() )
 {
   mFormat->setTimeSpec( calendar->timeSpec() );
 }
@@ -238,18 +240,23 @@
     incidence->setSchedulingID( exIncPtr->schedulingID() );
     incidence->setUid( exIncPtr->uid() );
 
-    mChanger->beginChange( exInc );
-
     Q_ASSERT( exIncPtr.get() && incidence );
     KCal::AssignmentVisitor v;
     v.assign( exIncPtr.get(), incidence );
 
     exIncPtr->updated();
-    mChanger->endChange( exInc );
+    new Akonadi::ItemModifyJob( exInc );
+    //FIXME: Add error handling
   } else {
-#ifdef AKONADI_PORT_DISABLED
-    mChanger->addIncidence( Incidence::Ptr(incidence->clone()) );
-#endif
+    Akonadi::Collection collection = Akonadi::selectCollection( 0 );
+
+    Akonadi::Item item;
+    item.setPayload( Incidence::Ptr( incidence->clone() ) );
+    //the sub-mimetype of text/calendar as defined at \
kdepim/akonadi/kcal/kcalmimetypevisitor.cpp +    item.setMimeType( \
QString::fromLatin1("application/x-vnd.akonadi.calendar.%1").arg(QLatin1String(incidence->type().toLower())) \
); //PENDING(AKONADI_PORT) shouldn't be hardcoded? +
+    new Akonadi::ItemCreateJob( item, collection );
+    //FIXME: Add error handling
   }
 
   return true;
--- branches/work/akonadi-ports/kdepim/korganizer/mailscheduler.h #1070702:1070703
@@ -38,7 +38,6 @@
 
 namespace KOrg {
   class AkonadiCalendar;
-  class IncidenceChangerBase;
 
   /*
     This class implements the iTIP interface using the email interface specified
@@ -47,7 +46,7 @@
   class KORGANIZER_CORE_EXPORT MailScheduler //: public Scheduler
   {
     public:
-      explicit MailScheduler( KOrg::AkonadiCalendar *calendar, \
KOrg::IncidenceChangerBase* changer ); +      explicit MailScheduler( \
KOrg::AkonadiCalendar *calendar );  virtual ~MailScheduler();
 
       bool publish ( KCal::IncidenceBase *incidence, const QString &recipients );
@@ -56,9 +55,9 @@
       bool performTransaction( KCal::IncidenceBase *incidence, KCal::iTIPMethod \
method, const QString &recipients );  
       QList<KCal::ScheduleMessage*> retrieveTransactions();
-      
+
       bool deleteTransaction( KCal::IncidenceBase *incidence );
-      
+
       /** Returns the directory where the free-busy information is stored */
       virtual QString freeBusyDir();
 
@@ -81,7 +80,6 @@
 
     private:
       KOrg::AkonadiCalendar *mCalendar;
-      KOrg::IncidenceChangerBase *mChanger;
       KCal::ICalFormat *mFormat;
       QMap<KCal::IncidenceBase *, QString> mEventMap;
   };


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

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