kpilot Library API Documentation

null-conduit.cc

00001 /* null-conduit.cc KPilot 00002 ** 00003 ** Copyright (C) 2000-2001 by Adriaan de Groot 00004 ** 00005 ** This file is part of the NULL conduit, a conduit for KPilot that 00006 ** does nothing except add a log message to the Pilot's HotSync log. 00007 ** It is also intended as a programming example. 00008 ** 00009 ** This file does the actual conduit work. 00010 */ 00011 00012 /* 00013 ** This program is free software; you can redistribute it and/or modify 00014 ** it under the terms of the GNU Lesser General Public License as published by 00015 ** the Free Software Foundation; either version 2.1 of the License, or 00016 ** (at your option) any later version. 00017 ** 00018 ** This program is distributed in the hope that it will be useful, 00019 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 00020 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00021 ** GNU Lesser General Public License for more details. 00022 ** 00023 ** You should have received a copy of the GNU Lesser General Public License 00024 ** along with this program in a file called COPYING; if not, write to 00025 ** the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, 00026 ** MA 02111-1307, USA. 00027 */ 00028 00029 /* 00030 ** Bug reports and questions can be sent to kde-pim@kde.org 00031 */ 00032 00033 00034 #include "options.h" 00035 00036 // Something to allow us to check what revision 00037 // the modules are that make up a binary distribution. 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 // Only include what we really need: 00044 // First UNIX system stuff, then std C++, 00045 // then Qt, then KDE, then local includes. 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 // A conduit that does nothing has a very 00059 // simple constructor and destructor. 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 /* virtual */ 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 }
KDE Logo
This file is part of the documentation for kpilot Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Jul 28 23:57:49 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003