kpilot/lib
actions.cc00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #include "options.h"
00030
00031 #include <tqapplication.h>
00032 #include <tqdir.h>
00033 #include <tqfile.h>
00034
00035 #include <ksavefile.h>
00036
00037 #include "pilot.h"
00038 #include "pilotUser.h"
00039
00040 #include "actions.h"
00041
00042
00043
00044 WelcomeAction::WelcomeAction(KPilotLink *p) :
00045 SyncAction(p,"welcomeAction")
00046 {
00047 FUNCTIONSETUP;
00048 }
00049
00050 bool WelcomeAction::exec()
00051 {
00052 FUNCTIONSETUP;
00053
00054 addSyncLogEntry(i18n("KPilot %1 HotSync starting...\n")
00055 .arg(TQString::fromLatin1(KPILOT_VERSION)));
00056 emit logMessage( i18n("Using encoding %1 on the handheld.").arg(Pilot::codecName()) );
00057 emit syncDone(this);
00058 return true;
00059 }
00060
00061 SorryAction::SorryAction(KPilotLink *p, const TQString &s) :
00062 SyncAction(p,"sorryAction"),
00063 fMessage(s)
00064 {
00065 if (fMessage.isEmpty())
00066 {
00067 fMessage = i18n("KPilot is busy and cannot process the "
00068 "HotSync right now.");
00069 }
00070 }
00071
00072 bool SorryAction::exec()
00073 {
00074 FUNCTIONSETUP;
00075
00076 addSyncLogEntry(fMessage);
00077 return delayDone();
00078 }
00079
00080 CleanupAction::CleanupAction(KPilotLink *p) : SyncAction(p,"cleanupAction")
00081 {
00082 FUNCTIONSETUP;
00083 }
00084
00085 bool CleanupAction::exec()
00086 {
00087 FUNCTIONSETUP;
00088
00089 if (deviceLink())
00090 {
00091 deviceLink()->endSync( KPilotLink::UpdateUserInfo );
00092 }
00093 emit syncDone(this);
00094 return true;
00095 }
00096
00097
00098 TestLink::TestLink(KPilotLink * p) :
00099 SyncAction(p, "testLink")
00100 {
00101 FUNCTIONSETUP;
00102
00103 }
00104
00105 bool TestLink::exec()
00106 {
00107 FUNCTIONSETUP;
00108
00109 int i;
00110 int dbindex = 0;
00111 int count = 0;
00112 struct DBInfo db;
00113
00114 addSyncLogEntry(i18n("Testing.\n"));
00115
00116 while ((i = deviceLink()->getNextDatabase(dbindex,&db)) > 0)
00117 {
00118 count++;
00119 dbindex = db.index + 1;
00120
00121 DEBUGKPILOT << fname
00122 << ": Read database " << db.name
00123 << " with index " << db.index
00124 << endl;
00125
00126
00127 openConduit();
00128
00129
00130 emit logMessage(i18n("Syncing database %1...")
00131 .arg(Pilot::fromPilot(db.name)));
00132 }
00133
00134 emit logMessage(i18n("HotSync finished."));
00135 emit syncDone(this);
00136 return true;
00137 }
|