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

List:       kde-commits
Subject:    kdepim/kpilot
From:       Adriaan de Groot <groot () kde ! org>
Date:       2005-04-20 19:56:15
Message-ID: 20050420195615.C5C79655 () office ! kde ! org
[Download RAW message or body]

CVS commit by adridg: 

Do a little test code


  M +7 -0      ChangeLog   1.257
  M +42 -28    conduits/knotes/knotes-action.cc   1.49
  M +11 -1     conduits/knotes/knotes-action.h   1.15


--- kdepim/kpilot/ChangeLog  #1.256:1.257
@@ -8,4 +8,11 @@
 TODO: provide template-based, interpreted databases much like the
   AppInfo classes now have.
+TODO: give the knotes conduit a decent test mode
+
+2005-04-20  Adriaan de Groot
+* Finally added a general test() function to sync actions to mirror the
+  exec() call. By default, this calls exec() and logs a warning. Removed it
+  again because it won't work -- SyncAction doesn't _have_ a SyncMode set.
+* Started doing a little bit of test code in the KNotes conduit.
 
 2005-04-18  Adriaan de Groot

--- kdepim/kpilot/conduits/knotes/knotes-action.cc  #1.48:1.49
@@ -213,5 +213,45 @@ KNotesAction::KNotesAction(KPilotDeviceL
         FUNCTIONSETUP;
 
+        if (syncMode().isTest())
+        {
+                test();
+                delayDone();
+                return true;
+        }
+
         QString e;
+        if (!retrieveKNotesInfo()) return false;
+
+        // Database names seem to be latin1
+        if (!openDatabases(CSL1("MemoDB")))
+        {
+#ifdef DEBUG
+                DEBUGCONDUIT << fname
+                        << "Can not open databases." << endl;
+#endif
+                emit logError(i18n("Could not open MemoDB on the Handheld."));
+                return false;
+        }
+
+        fP->fTimer = new QTimer(this);
+        fActionStatus = Init;
+        resetIndexes();
+
+        connect(fP->fTimer,SIGNAL(timeout()),SLOT(process()));
+        fP->fTimer->start(0,false);
+
+        return true;
+}
+
+void KNotesAction::test()
+{
+        if (!retrieveKNotesInfo()) return;
+        listNotes();
+}
+
+bool KNotesAction::retrieveKNotesInfo()
+{
+        FUNCTIONSETUP;
+
         if (!fP || !fP->fDCOP)
         {
@@ -258,30 +297,4 @@ KNotesAction::KNotesAction(KPilotDeviceL
 
         }
-
-        // Database names seem to be latin1
-        if (!openDatabases(CSL1("MemoDB")))
-        {
-#ifdef DEBUG
-                DEBUGCONDUIT << fname
-                        << "Can not open databases." << endl;
-#endif
-                emit logError(i18n("Could not open MemoDB on the Handheld."));
-                return false;
-        }
-
-        if (syncMode().isTest())
-        {
-                listNotes();
-                return delayDone();
-        }
-
-        fP->fTimer = new QTimer(this);
-        fActionStatus = Init;
-        resetIndexes();
-
-        connect(fP->fTimer,SIGNAL(timeout()),SLOT(process()));
-        fP->fTimer->start(0,false);
-
-        return true;
 }
 

--- kdepim/kpilot/conduits/knotes/knotes-action.h  #1.14:1.15
@@ -63,4 +63,14 @@ protected:
         void listNotes();
 
+        /** Run a test on the conduit. */
+        void test();
+
+        /**
+        * Contact KNotes by DCOP and retrieve the list of notes it
+        * has. @return false if the DCOP connection could not be made.
+        * Modifies fP to store the notes in.
+        */
+        bool retrieveKNotesInfo();
+
         /**
         * For actual processing. These are called by process


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

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