kpilot Library API Documentation

kpilotConfig.h

00001 #ifndef _KPILOT_KPILOTCONFIG_H
00002 #define _KPILOT_KPILOTCONFIG_H
00003 /* kpilotConfig.h           KPilot
00004 **
00005 ** Copyright (C) 1998-2001 by Dan Pilone
00006 **
00007 ** This class concentrates all the configuration
00008 ** information for the various parts of KPilot.
00009 */
00010 
00011 /*
00012 ** This program is free software; you can redistribute it and/or modify
00013 ** it under the terms of the GNU General Public License as published by
00014 ** the Free Software Foundation; either version 2 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 General Public License for more details.
00021 **
00022 ** You should have received a copy of the GNU General Public License
00023 ** along with this program in a file called COPYING; if not, write to
00024 ** the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
00025 ** MA 02111-1307, USA.
00026 */
00027 
00028 /*
00029 ** Bug reports and questions can be sent to kde-pim@kde.org
00030 */
00031 
00032 
00033 #include <ksimpleconfig.h>
00034 
00035 class KCmdLineArgs;
00036 class QLineEdit;
00037 class QComboBox;
00038 class QCheckBox;
00039 
00040 class KPilotConfigSettings : public KSimpleConfig
00041 {
00042 public:
00043     KPilotConfigSettings(const QString &filename,bool readonly=false);
00044     virtual ~KPilotConfigSettings();
00045 
00046     // All the functions in this class follow one of the patterns
00047     //
00048     // getXXX() read the config file and return the value.
00049     //        If there are parameters, set the value of those parameters
00050     //        to the value read.
00051     // setXXX() write the value to the config file. The value might
00052     //        be taken from a variety of widgets of data types.
00053     //
00054     // For example, the following would be typical of a string that
00055     // can be entered in a line edit:
00056     //
00057     // QString getPilotDevice(QLineEdit *p=0L);
00058     // void setPilotDevice(QLineEdit *);
00059     // void setPilotDevice(const QString &);
00060     //
00061     // Since the boilerplate is straightfoward, I use macros to
00062     // define String, Bool and Int properties.
00063     //
00064     //
00065 
00066 #define IntProperty(a) \
00067     int get##a() const; \
00068     void set##a(int); \
00069 
00070 #define BoolProperty(a) \
00071     bool get##a() const; \
00072     void set##a(bool);
00073 
00074 #define StringProperty(a) \
00075     QString get##a() const; \
00076     void set##a(const QString &);
00077 
00078     IntProperty(Version)
00079     IntProperty(Debug)
00080 
00081     /* General tab in the config dialog */
00082     StringProperty(PilotDevice)
00083     IntProperty(PilotSpeed)
00084     StringProperty(Encoding)
00085     StringProperty(User)
00086     BoolProperty(StartDaemonAtLogin)
00087     BoolProperty(DockDaemon)
00088     BoolProperty(KillDaemonOnExit)
00089     BoolProperty(QuitAfterSync)
00090 
00091     /* Sync tab */
00092     IntProperty(SyncType)
00093     BoolProperty(FullSyncOnPCChange)
00094     IntProperty(ConflictResolution)
00095     // BoolProperty(SyncFiles)
00096     // BoolProperty(SyncWithKMail)
00097 
00098     /* Viewers tab */
00099     BoolProperty(InternalEditors)
00100     BoolProperty(ShowSecrets)
00101 
00102     // Address widget stuff goes in a different group
00103     KPilotConfigSettings &setAddressGroup();
00104     IntProperty(AddressDisplayMode)
00105     BoolProperty(UseKeyField)
00106 
00107     /* Backup tab */
00108     StringProperty(BackupOnly)
00109     StringProperty(Skip)
00110 
00111 
00112 
00113 
00114 #undef StringProperty
00115 #undef BoolProperty
00116 #undef IntProperty
00117 
00118     // Conduit configuration information
00119     //
00120     //
00121     KPilotConfigSettings &setConduitGroup();
00122 
00123     QStringList getInstalledConduits();
00124     void setInstalledConduits(const QStringList &);
00125 
00126     QStringList getDirtyDatabases();
00127     void setDirtyDatabases(const QStringList &);
00128     void addDirtyDatabase(QString db);
00129     
00130     QStringList getNoBackupDatabases();
00131 
00132     QStringList getAppBlockChangedDatabases();
00133     void setAppBlockChangedDatabases(const QStringList &);
00134     void addAppBlockChangedDatabase(QString db);
00135 
00136     QStringList getFlagsChangedDatabases();
00137     void setFlagsChangedDatabases(const QStringList &);
00138     void addFlagsChangedDatabase(QString db);
00139 
00140     KPilotConfigSettings &setDatabaseGroup();
00141     void setDatabaseConduit(const QString &database,const QString &conduit);
00142 
00143 public:
00144     // Re-export some useful functions from KConfig
00145     //
00146     //
00147     void sync() { KSimpleConfig::sync(); } ;
00148     KPilotConfigSettings & resetGroup()
00149         { setGroup(QString::null); return *this; } ;
00150 
00151 } ;
00152 
00153 class KPilotConfig
00154 {
00155 public:
00167     static KPilotConfigSettings& getConfig();
00168 
00173         static QString getDefaultDBPath();
00174 
00175 
00182     static const int ConfigurationVersion;
00183 
00188     static int getConfigVersion(KConfig *);
00189     static int getConfigVersion(KConfig&);
00190 
00196     static void updateConfigVersion();
00197 
00204     static QString versionDetails(int fileversion, bool run);
00205     static void sorryVersionOutdated(int fileversion);
00206     static void interactiveUpdate();
00207 
00212     static int getDebugLevel(KCmdLineArgs *p);
00213 
00218     static const QFont& fixed() ;
00219 } ;
00220 
00221 
00222 
00223 #endif
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 Sat May 1 11:36:47 2004 by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2003