7 #include <QtXml/QDomDocument>
\r
10 #define APPLICATION_NAME "ConfManager"
\r
11 #define CONFIG_DIR "/home/user/"
\r
14 //#define CONFIG_DIR "./"
\r
16 #define CONFIG_FILE CONFIG_DIR "cfConfig.xml"
\r
17 #define BACKUP_CONFIG_FILE CONFIG_DIR "cfConfig.bak"
\r
19 #define DEFAULT_XML "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Profiles NoOfProfiles=\"0\">\r\n</Profiles>"
\r
21 class Config : public QObject
\r
25 explicit Config(QObject *parent = 0);
\r
27 // Close the config file
\r
28 ~Config() { closeConfig(); }
\r
30 // Return 0 if everything okay else a negative integer
\r
31 int addProfile(const Profile &p);
\r
32 int removeProfile(const Profile &p);
\r
34 // Write back all the changes to the disk
\r
37 // Read all the profiles from config file
\r
38 bool readAllProfiles();
\r
39 // Writes all the profiles from the list to the config file
\r
40 // Similar to flushConfig(), flushConfig will internally call
\r
41 // writeAllProfiles()
\r
42 bool writeAllProfiles();
\r
43 // Similar to deletion of config file. Never to be used!
\r
44 bool removeAllProfiles();
\r
46 // get-set for noOfProfiles
\r
47 void setNoOfProfiles(const int &no) { noOfProfiles = no; }
\r
48 int getNoOfProfiles() { return noOfProfiles; }
\r
50 QList<Profile> profileList;
\r
54 // Called by flush and
\r
59 void updateNoOfProfiles();
\r
62 QDomDocument domDoc;
\r