kpilot/lib

kpilotlink.h

Go to the documentation of this file.
00001 #ifndef _KPILOT_KPILOTLINK_H
00002 #define _KPILOT_KPILOTLINK_H
00003 /* kpilotlink.h         KPilot
00004 **
00005 ** Copyright (C) 1998-2001 by Dan Pilone
00006 ** Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
00007 ** Copyright (C) 2006 Adriaan de Groot <groot@kde.org>
00008 **
00009 */
00010 
00011 /*
00012 ** This program is free software; you can redistribute it and/or modify
00013 ** it under the terms of the GNU Lesser General Public License as published by
00014 ** the Free Software Foundation; either version 2.1 of the License, or
00015 ** (at your option) any later version.
00016 **
00017 ** This program is distributed in the hope that it will be useful,
00018 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00019 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00020 ** GNU Lesser General Public License for more details.
00021 **
00022 ** You should have received a copy of the GNU Lesser General Public License
00023 ** along with this program in a file called COPYING; if not, write to
00024 ** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
00025 ** MA 02110-1301, USA.
00026 */
00027 
00028 /*
00029 ** Bug reports and questions can be sent to kde-pim@kde.org
00030 */
00031 
00032 #include <time.h>
00033 #include <pi-dlp.h>
00034 
00035 #include <qobject.h>
00036 #include <qvaluelist.h>
00037 
00038 class QTimer;
00039 class QDateTime;
00040 class QSocketNotifier;
00041 class QThread;
00042 class KPilotUser;
00043 class KPilotSysInfo;
00044 class KPilotCard;
00045 class PilotDatabase;
00046 struct DBInfo;
00047 
00048 
00049 
00144 typedef QValueList<struct DBInfo> DBInfoList;
00145 
00151 class KDE_EXPORT KPilotLink : public QObject
00152 {
00153 Q_OBJECT
00154 friend class SyncAction;
00155 public:
00157     KPilotLink( QObject *parent = 0, const char *name = 0 );
00159     virtual ~KPilotLink();
00160 
00161 
00163     virtual QString statusString() const = 0;
00164 
00169     virtual bool isConnected() const = 0;
00170 
00171 
00180     QString pilotPath() const { return fPilotPath; } ;
00181 
00190     virtual void reset(const QString &pilotPath) = 0;
00191 
00193     virtual bool event(QEvent *e);
00194 
00201     unsigned int installFiles(const QStringList &l, const bool deleteFiles);
00202 
00210     void addSyncLogEntry(const QString &entry,bool log=true);
00211 
00218     virtual int findDatabase(const char *name, struct DBInfo*,
00219         int index=0, unsigned long type=0, unsigned long creator=0) = 0;
00220 
00228     virtual bool retrieveDatabase(const QString &path, struct DBInfo *db) = 0;
00229 
00235     virtual int getNextDatabase(int index,struct DBInfo *db) = 0;
00236 
00248     virtual DBInfoList getDBList(int cardno=0, int flags=dlpDBListRAM) = 0;
00249 
00258     virtual PilotDatabase *database( const QString &name ) = 0;
00259 
00268     KPilotUser &getPilotUser() { return *fPilotUser; }
00269 
00277     const KPilotSysInfo &getSysInfo() { return *fPilotSysInfo; }
00278 
00290     virtual const KPilotCard *getCardInfo(int card=0) = 0;
00291 
00293     virtual void endOfSync() = 0;
00297     virtual void finishSync() = 0;
00298 
00299 signals:
00307     void timeout();
00308 
00310     void logMessage(const QString &);
00312     void logError(const QString &);
00317     void logProgress(const QString &s, int p);
00318 
00323     void deviceReady( KPilotLink* );
00324 
00325 
00326 public slots:
00331     virtual void close() = 0;
00332 
00338     virtual void reset() = 0;
00339 
00341     virtual bool tickle() = 0;
00342 
00343 protected:
00349     QString fPilotPath;
00350 
00358     void startTickle(unsigned int timeout=0);
00359 
00364     void stopTickle();
00365 
00372     virtual bool installFile( const QString &f, const bool deleteFile ) = 0;
00373 
00382     virtual int openConduit();
00383 
00389     virtual int pilotSocket() const;
00390 
00394     virtual void addSyncLogEntryImpl( const QString &s ) = 0;
00395 
00399     KPilotUser  *fPilotUser;
00400 
00404     KPilotSysInfo *fPilotSysInfo;
00405 
00406 
00407 private:
00408     bool fTickleDone;
00409     QThread *fTickleThread;
00410 
00411 } ;
00412 
00413 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys