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
00030
00031
00032
00033
00034
#include "options.h"
00035
00036
00037
00038
00039
00040
static const char *null_conduit_id=
00041
"$Id: null-conduit.cc,v 1.36 2003/07/04 15:31:00 adridg Exp $";
00042
00043
00044
00045
00046
00047
00048
#include <time.h>
00049
00050
#include <kconfig.h>
00051
#include <kdebug.h>
00052
00053
#include "pilotSerialDatabase.h"
00054
#include "null-factory.h"
00055
#include "null-conduit.h"
00056
00057
00058
00059
00060
00061
00062 NullConduit::NullConduit(KPilotDeviceLink *d,
00063
const char *n,
00064
const QStringList &l) :
00065
ConduitAction(d,n,l),
00066 fDatabase(0L)
00067 {
00068 FUNCTIONSETUP;
00069
#ifdef DEBUG
00070
DEBUGCONDUIT<<null_conduit_id<<endl;
00071
#endif
00072
fConduitName=i18n(
"Null");
00073 }
00074
00075 NullConduit::~NullConduit()
00076 {
00077 FUNCTIONSETUP;
00078 KPILOT_DELETE(fDatabase);
00079 }
00080
00081
bool NullConduit::exec()
00082 {
00083 FUNCTIONSETUP;
00084 DEBUGCONDUIT<<null_conduit_id<<endl;
00085
00086
if (!fConfig)
00087 {
00088 kdWarning() << k_funcinfo
00089 <<
": No configuration set for NULL conduit."
00090 << endl;
00091
return false;
00092 }
00093
00094 fConfig->setGroup(NullConduitFactory::group);
00095
00096
bool r = fConfig->readBoolEntry(NullConduitFactory::failImmediately);
00097
if (r)
00098 {
00099
#ifdef DEBUG
00100
DEBUGCONDUIT << fname <<
": Config says to fail now." << endl;
00101
#endif
00102
emit logError(i18n(
"NULL conduit is programmed to fail."));
00103
return false;
00104 }
00105
00106 QString m=fConfig->readEntry(NullConduitFactory::message);
00107
if (!m.isEmpty())
00108 {
00109 addSyncLogEntry(m);
00110 }
00111
00112
#ifdef DEBUG
00113
DEBUGCONDUIT << fname
00114 <<
": Message from null-conduit: "
00115 << m
00116 << endl;
00117
#endif
00118
00119 emit syncDone(
this);
00120
return true;
00121 }