kpilot/lib

plugin.h

00001 #ifndef _KPILOT_PLUGIN_H
00002 #define _KPILOT_PLUGIN_H
00003 /* plugin.h                             KPilot
00004 **
00005 ** Copyright (C) 2001 by Dan Pilone
00006 ** Copyright (C) 2002-2004 by Adriaan de Groot
00007 ** Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
00008 **
00009 ** This file defines the base class of all KPilot conduit plugins configuration
00010 ** dialogs. This is necessary so that we have a fixed API to talk to from
00011 ** inside KPilot.
00012 **
00013 ** The factories used by KPilot plugins are also documented here.
00014 */
00015 
00016 /*
00017 ** This program is free software; you can redistribute it and/or modify
00018 ** it under the terms of the GNU Lesser General Public License as published by
00019 ** the Free Software Foundation; either version 2.1 of the License, or
00020 ** (at your option) any later version.
00021 **
00022 ** This program is distributed in the hope that it will be useful,
00023 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00024 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00025 ** GNU Lesser General Public License for more details.
00026 **
00027 ** You should have received a copy of the GNU Lesser General Public License
00028 ** along with this program in a file called COPYING; if not, write to
00029 ** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
00030 ** MA 02110-1301, USA.
00031 */
00032 
00033 /*
00034 ** Bug reports and questions can be sent to kde-pim@kde.org
00035 */
00036 
00037 #include <qstringlist.h>
00038 
00039 #include "syncAction.h"
00040 
00041 class PilotDatabase;
00042 class KLibrary;
00043 
00044 #define KPILOT_PLUGIN_API   (20050401)
00045 
00063 class KDE_EXPORT ConduitConfigBase : public QObject
00064 {
00065 Q_OBJECT
00066 public:
00067     ConduitConfigBase(QWidget *parent=0L, const char *n=0L);
00068     virtual ~ConduitConfigBase();
00069 
00076     virtual bool isModified() const { return fModified; } ;
00077     QWidget *widget() const { return fWidget; } ;
00078 
00079 public:
00086     virtual void commit() = 0;
00087     virtual void load() = 0;
00097     virtual bool maybeSave();
00098 protected:
00103     virtual QString maybeSaveText() const;
00104 
00105 public:
00106     QString conduitName() const { return fConduitName; } ;
00107 
00108 protected slots:
00109     void modified();
00110 signals:
00111     void changed(bool);
00112 
00113 protected:
00114     bool fModified;
00115     QWidget *fWidget;
00116     QString fConduitName;
00117 
00118     void unmodified() { fModified=false; } ;
00119 } ;
00120 
00121 
00122 
00123 
00134 class KDE_EXPORT ConduitAction : public SyncAction
00135 {
00136 Q_OBJECT
00137 public:
00138     ConduitAction(KPilotDeviceLink *,
00139         const char *name=0L,
00140         const QStringList &args = QStringList());
00141     virtual ~ConduitAction();
00142 
00143     QString conduitName() const { return fConduitName; } ;
00144 
00145 protected:
00147     const SyncMode &syncMode() const { return fSyncDirection; };
00149     ConflictResolution getConflictResolution() const
00150         { return fConflictResolution; };
00151 
00156     bool changeSync(SyncMode::Mode m);
00157 
00158     // Set the conflict resolution, except if the resolution
00159     // form is UseGlobalSetting, in which case nothing changes
00160     // (assumes then that the resolution form is already set
00161     // according to that global setting).
00162     //
00163     void setConflictResolution(ConflictResolution res)
00164     {
00165         if (SyncAction::eUseGlobalSetting != res)
00166             fConflictResolution=res;
00167     }
00168 
00174     bool isFullSync() const
00175     {
00176         return fFirstSync || fSyncDirection.isFullSync() ;
00177     }
00178 
00186     bool isFirstSync() const {
00187         return fFirstSync || fSyncDirection.isFirstSync() ;
00188     } ;
00189     void setFirstSync(bool first) { fFirstSync=first; } ;
00190 
00191     PilotDatabase *fDatabase,*fLocalDatabase;
00192 
00202     bool openDatabases(const QString &dbName, bool*retrieved=0L);
00203 
00204 private:
00205     SyncMode fSyncDirection;
00206     ConflictResolution fConflictResolution;
00207 
00208     // Make these only protected so the conduit can change the variable
00209 protected:
00210     QString fConduitName;
00211 private:
00212     bool fFirstSync;
00213 
00214 private:
00223     bool openDatabases_(const QString &dbName, bool*retrieved=0L);
00224 
00234     bool openDatabases_(const QString &dbName,const QString &localPath);
00235 } ;
00236 
00238 class KDE_EXPORT PluginUtility
00239 {
00240 public:
00242     static int findHandle(const QStringList &);
00244     static bool isModal(const QStringList &a);
00245 
00254     static bool isRunning(const QCString &appName);
00255 
00260     static long pluginVersion(const KLibrary *);
00261     static QString pluginVersionString(const KLibrary *);
00262 } ;
00263 
00328 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys