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(QComboBox *p=0L) const; \
00068         void set##a(QComboBox *); \
00069         void set##a(int); \
00070 
00071 #define BoolProperty(a) \
00072         bool get##a(QCheckBox *p=0L) const; \
00073         void set##a(QCheckBox *); \
00074         void set##a(bool);
00075 
00076 #define StringProperty(a) \
00077         QString get##a(QLineEdit *p=0L) const; \
00078         void set##a(QLineEdit *); \
00079         void set##a(const QString &);
00080 
00081         IntProperty(Version)
00082         IntProperty(Debug)
00083 
00084 
00085         IntProperty(PilotType)
00086         IntProperty(PilotSpeed)
00087         StringProperty(PilotDevice)
00088         StringProperty(User)
00089         // There's no GUI to access this one.
00090         StringProperty(Encoding)
00091         IntProperty(EncodingDD)
00092 
00093 
00094         BoolProperty(StartDaemonAtLogin)
00095         BoolProperty(KillDaemonOnExit)
00096         BoolProperty(DockDaemon)
00097 
00098         BoolProperty(ShowSecrets)
00099         BoolProperty(SyncFiles)
00100         BoolProperty(SyncWithKMail)
00101         StringProperty(BackupOnly)
00102         StringProperty(Skip)
00103 
00104         // Address widget stuff goes in a different group
00105         //
00106         //
00107         KPilotConfigSettings &setAddressGroup();
00108 
00109         BoolProperty(UseKeyField)
00110         IntProperty(AddressDisplayMode)
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         KPilotConfigSettings &setDatabaseGroup();
00127         void setDatabaseConduit(const QString &database,const QString &conduit);
00128 
00129 public:
00130         // Re-export some useful functions from KConfig
00131         //
00132         //
00133         void sync() { KSimpleConfig::sync(); } ;
00134         KPilotConfigSettings & resetGroup() 
00135                 { setGroup(QString::null); return *this; } ;
00136 } ;
00137 
00138 class KPilotConfig
00139 {
00140 public:
00152         static KPilotConfigSettings& getConfig();
00153 
00158         static QString getDefaultDBPath();
00159 
00160   
00167         static const int ConfigurationVersion;
00168 
00173         static int getConfigVersion(KConfig *);
00174         static int getConfigVersion(KConfig&);
00175 
00181         static void updateConfigVersion();
00182 
00194         static int getDebugLevel(bool useDebugId=true);
00195 
00196 
00201         static const QFont& fixed() ;
00202 
00203 protected:
00204         static int getDebugLevel(KPilotConfigSettings &);
00205 } ;
00206 
00207 
00208 
00209 #endif
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Sun Feb 15 11:40:43 2004 by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2001