[kmobiletools] KDE/kdepim/kmobiletools/kmobiletools

Matthias Lechner matthias at lmme.de
Sat Jun 16 14:17:21 CEST 2007


SVN commit 676251 by lechner:

more API cleaning (moving calendar signal to EngineData and add appropriate setters and getters)


 M  +1 -1      engines/at_engine/at_engine.cpp  
 M  +1 -1      engines/at_engine/calendar_jobs.cpp  
 M  +0 -7      libkmobiletools/engine.h  
 M  +6 -1      libkmobiletools/enginedata.cpp  
 M  +15 -4     libkmobiletools/enginedata.h  
 M  +1 -1      mainpart/devicehome.cpp  


--- trunk/KDE/kdepim/kmobiletools/kmobiletools/engines/at_engine/at_engine.cpp #676250:676251
@@ -216,7 +216,7 @@
         case KMobileTools::Job::fetchKCal:
 #ifdef HAVE_KCAL
             suspendStatusJobs(false);
-            emit calendarParsed();
+            engineData()->setCalendar( p_calendar );
             p_calendar->dump();
 #endif
             break;
--- trunk/KDE/kdepim/kmobiletools/kmobiletools/engines/at_engine/calendar_jobs.cpp #676250:676251
@@ -30,7 +30,7 @@
 FetchCalendar::FetchCalendar(KMobileTools::Job *pjob, KMobileTools::SerialManager *device, kmobiletoolsAT_engine* parent)
     : kmobiletoolsATJob(pjob, device, parent)
 {
-    p_calendar=engine->calendar();
+    p_calendar=engine->engineData()->calendar();
     p_calendar->clear();
 }
 
--- trunk/KDE/kdepim/kmobiletools/kmobiletools/libkmobiletools/engine.h #676250:676251
@@ -322,13 +322,6 @@
          * @TODO should be handled by errorOccured
          */
         void fullPhonebook();
-
-        /**
-         * This signal is emitted when calendar is parsed.
-         * 
-         * @TODO what to do with this one here? move to EngineData?
-         */
-        void calendarParsed();
 };
 }
 #endif
--- trunk/KDE/kdepim/kmobiletools/kmobiletools/libkmobiletools/enginedata.cpp #676250:676251
@@ -125,7 +125,12 @@
     return d->s_revision;
 }
 
-KCal::Event::List *EngineData::calendar() {
+void EngineData::setCalendar( KCal::Event::List* calendar ) {
+    d->p_calendar = calendar;
+    emit calendarChanged();
+}
+
+const KCal::Event::List *EngineData::calendar() {
     return d->p_calendar;
 }
 
--- trunk/KDE/kdepim/kmobiletools/kmobiletools/libkmobiletools/enginedata.h #676250:676251
@@ -255,13 +255,18 @@
             const SMSList* smsList() const;
 
             /**
-             * Retrieves the phone calendar.
+             * Sets the phone calendar
              *
+             * @param calendar the phone calendar
+             */
+            void setCalendar( KCal::Event::List *calendar );
+
+            /**
+             * Returns the phone's calendar
+             *
              * @return the phone calendar
-             *
-             * @TODO make this method return a const reference
              */
-            KCal::Event::List *calendar();
+            const KCal::Event::List *calendar();
 
         Q_SIGNALS:
             /**
@@ -335,6 +340,12 @@
             */
             void phoneBookChanged();
 
+            /**
+            * This signal is emitted when calendar is modified.
+            *
+            */
+            void calendarChanged();
+
         private:
             EngineDataPrivate *const d;
     };
--- trunk/KDE/kdepim/kmobiletools/kmobiletools/mainpart/devicehome.cpp #676250:676251
@@ -977,7 +977,7 @@
 
     korgpart->closeUrl();
     kDebug() << "DeviceHome::slotCalendarFetched()\n";
-    Calendar *engineCal=engine->calendar();
+    Calendar *engineCal=constEngineData->calendar();
     p_calendar->deleteAllEvents ();
     for(Calendar::Iterator it=engineCal->begin(); it!=engineCal->end(); ++it)
         p_calendar->addEvent(*it);


More information about the kmobiletools mailing list