kpilot
actions.cc
Go to the documentation of this file.00001
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 "actions.h"
00030
00031 #include <QtCore/QDir>
00032 #include <QtCore/QFile>
00033 #include <QtGui/QApplication>
00034
00035 #include <ksavefile.h>
00036
00037 #include "options.h"
00038 #include "pilot.h"
00039 #include "pilotUser.h"
00040
00041 WelcomeAction::WelcomeAction(KPilotLink *p) :
00042 SyncAction(p, "welcomeAction")
00043 {
00044 FUNCTIONSETUP;
00045 }
00046
00047 bool WelcomeAction::exec()
00048 {
00049 FUNCTIONSETUP;
00050
00051 addSyncLogEntry(i18n("KPilot %1 HotSync starting...\n",
00052 QString::fromLatin1(KPILOT_VERSION)));
00053 emit logMessage( i18n("Using encoding %1 on the handheld.",Pilot::codecName()) );
00054 return delayDone();
00055 }
00056
00057 SorryAction::SorryAction(KPilotLink *p, const QString &s) :
00058 SyncAction(p, "sorryAction"),
00059 fMessage(s)
00060 {
00061 if (fMessage.isEmpty())
00062 {
00063 fMessage = i18n("KPilot is busy and cannot process the "
00064 "HotSync right now.");
00065 }
00066 }
00067
00068 bool SorryAction::exec()
00069 {
00070 FUNCTIONSETUP;
00071
00072 addSyncLogEntry(fMessage);
00073 return delayDone();
00074 }
00075
00076 CleanupAction::CleanupAction(KPilotLink *p) : SyncAction(p, "cleanupAction")
00077 {
00078 FUNCTIONSETUP;
00079 }
00080
00081 bool CleanupAction::exec()
00082 {
00083 FUNCTIONSETUP;
00084
00085 if (deviceLink())
00086 {
00087 deviceLink()->endSync( KPilotLink::UpdateUserInfo );
00088 }
00089 return delayDone();
00090 }
00091
00092
00093 TestLink::TestLink(KPilotLink * p) :
00094 SyncAction(p, "testLink")
00095 {
00096 FUNCTIONSETUP;
00097
00098 }
00099
00100 bool TestLink::exec()
00101 {
00102 FUNCTIONSETUP;
00103
00104 int i;
00105 int dbindex = 0;
00106 int count = 0;
00107 struct DBInfo db;
00108
00109 addSyncLogEntry(i18n("Testing.\n"));
00110
00111 while ((i = deviceLink()->getNextDatabase(dbindex,&db)) > 0)
00112 {
00113 count++;
00114 dbindex = db.index + 1;
00115
00116 DEBUGKPILOT << ": Read database " << db.name
00117 << " with index " << db.index;
00118
00119
00120 openConduit();
00121
00122
00123 emit logMessage(i18n("Syncing database %1...",Pilot::fromPilot(db.name)));
00124 }
00125
00126 emit logMessage(i18n("HotSync finished."));
00127 return delayDone();
00128 }