Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

cfg.h

Go to the documentation of this file.
00001 /*
00002                      This file is part of the OPIE Project
00003                =.
00004       .=l.            Copyright (c)  2002 Dan Williams <drw@handhelds.org>
00005      .>+-=
00006 _;:,   .>  :=|.         This file is free software; you can
00007 .> <`_,  > .  <=          redistribute it and/or modify it under
00008 :`=1 )Y*s>-.--  :           the terms of the GNU General Public
00009 .="- .-=="i,   .._         License as published by the Free Software
00010 - .  .-<_>   .<>         Foundation; either version 2 of the License,
00011   ._= =}    :          or (at your option) any later version.
00012   .%`+i>    _;_.
00013   .i_,=:_.   -<s.       This file is distributed in the hope that
00014   + . -:.    =       it will be useful, but WITHOUT ANY WARRANTY;
00015   : ..  .:,   . . .    without even the implied warranty of
00016   =_    +   =;=|`    MERCHANTABILITY or FITNESS FOR A
00017  _.=:.    :  :=>`:     PARTICULAR PURPOSE. See the GNU General
00018 ..}^=.=    =    ;      Public License for more details.
00019 ++=  -.   .`   .:
00020 :   = ...= . :.=-        You should have received a copy of the GNU
00021 -.  .:....=;==+<;          General Public License along with this file;
00022  -_. . .  )=. =           see the file COPYING. If not, write to the
00023   --    :-=`           Free Software Foundation, Inc.,
00024                              59 Temple Place - Suite 330,
00025                              Boston, MA 02111-1307, USA.
00026 
00027 */
00028 
00029 #ifndef CFG_H
00030 #define CFG_H
00031 
00032 #include <qstring.h>
00033 #include <qlist.h>
00034 #include <qstringlist.h>
00035 class Config;
00036 
00037 // --- Category ---------------------------------------------------------------
00038 class Category
00039 {
00040     public:
00041         // --- Constructor:
00042         Category(QString &sName, bool bIncome=false) { _sName=sName; _bIncome=bIncome; }
00043 
00044         // members
00045         QString &getName() { return(_sName); }
00046         bool isIncome() { return(_bIncome); }
00047         void setName(QString &sName) { _sName=sName; }
00048         void setIncome(bool bIncome) { _bIncome=bIncome; }
00049 
00050     private:
00051         QString _sName;
00052         bool _bIncome;
00053 };
00054 
00055 class CategoryList : public QList<Category>
00056 {
00057     public:
00058         // --- Constructor
00059         CategoryList();
00060 };
00061 
00062 
00063 // --- Cfg --------------------------------------------------------------------
00064 class Cfg
00065 {
00066     public:
00067         // --- Constructor
00068         Cfg();
00069 
00070         // --- members
00071         bool getUseSmallFont() { return(_useSmallFont); }
00072         void setUseSmallFont(bool n) { _useSmallFont=n; }
00073         bool getShowLocks() { return(_showLocks); }
00074         void setShowLocks(bool n) { _showLocks=n; }
00075         bool getShowBalances() { return(_showBalances); }
00076         void setShowBalances(bool n) { _showBalances=n; }
00077         QString &getCurrencySymbol() { return(_currencySymbol); }
00078         void setCurrencySymbol(QString n) {_currencySymbol= n; }
00079         void setCurrencySymbol(const char *n) { _currencySymbol=n; }
00080         QStringList &getAccountTypes() { return(_AccountTypes); }
00081 
00082         // --- Payees
00083         QStringList &getPayees() { return(_Payees); }
00084         bool getSavePayees() { return(_bSavePayees); }
00085         void setSavePayees(bool bSave) { _bSavePayees=bSave; }
00086 
00087         // --- Categories
00088         QStringList getCategories();
00089         void setCategories(QStringList &lst);
00090         CategoryList *getCategoryList() { return(_pCategories); }
00091 
00092         // --- last book
00093         void setOpenLastBook(bool openLastBook) { _openLastBook=openLastBook; }
00094         bool isOpenLastBook() { return(_openLastBook); }
00095         void setLastBook(const QString &lastBook) { _sLastBook=lastBook; }
00096         QString &getLastBook() { return(_sLastBook); }
00097 
00098         // --- last tab
00099         void setShowLastTab(bool showLastTab) { _showLastTab=showLastTab; }
00100         bool isShowLastTab() { return(_showLastTab); }
00101 
00102         // --- reads data from config file
00103         void readConfig(Config &cfg);
00104 
00105         // --- writes data to config file
00106         void writeConfig(Config &cfg);
00107 
00108         // --- dirty flag
00109         bool isDirty() { return(_bDirty); }
00110         void setDirty(bool bDirty) { _bDirty=bDirty; }
00111 
00112     protected:
00113         // --- reads list from config file
00114         static void readStringList(Config &cfg, const char *sKey, QStringList &lst);
00115 
00116         // --- writes list in configuration file
00117         static void writeStringList(Config &cfg, const char *sKey, QStringList &lst);
00118 
00119     private:
00120         QString  _currencySymbol;
00121                 bool _useSmallFont;
00122                 bool _showLocks;
00123                 bool _showBalances;
00124         bool _openLastBook;
00125         bool _showLastTab;
00126         bool _bDirty;
00127         bool _bSavePayees;
00128         QString _sLastBook;
00129         QStringList _AccountTypes;
00130         CategoryList *_pCategories;
00131         QStringList _Payees;
00132 
00133 };
00134 
00135 #endif

Generated on Sat Nov 5 16:16:47 2005 for OPIE by  doxygen 1.4.2