/* This file is part of the OPIE Project =. .=l. Copyright (c) 2002 Dan Williams .>+-= _;:, .> :=|. This file is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -`: PARTICULAR PURPOSE. See the GNU General ..}^=.= = ; Public License for more details. ++= -. .` .: : = ...= . :.=- You should have received a copy of the GNU -. .:....=;==+<; General Public License along with this file; -_. . . )=. = see the file COPYING. If not, write to the -- :-=` Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef CFG_H #define CFG_H #include #include #include class Config; // --- Category --------------------------------------------------------------- class Category { public: // --- Constructor: Category(QString &sName, bool bIncome=false) { _sName=sName; _bIncome=bIncome; } // members QString &getName() { return(_sName); } bool isIncome() { return(_bIncome); } void setName(QString &sName) { _sName=sName; } void setIncome(bool bIncome) { _bIncome=bIncome; } private: QString _sName; bool _bIncome; }; class CategoryList : public QList { public: // --- Constructor CategoryList(); }; // --- Cfg -------------------------------------------------------------------- class Cfg { public: // --- Constructor Cfg(); // --- members bool getUseSmallFont() { return(_useSmallFont); } void setUseSmallFont(bool n) { _useSmallFont=n; } bool getShowLocks() { return(_showLocks); } void setShowLocks(bool n) { _showLocks=n; } bool getShowBalances() { return(_showBalances); } void setShowBalances(bool n) { _showBalances=n; } QString &getCurrencySymbol() { return(_currencySymbol); } void setCurrencySymbol(QString n) {_currencySymbol= n; } void setCurrencySymbol(const char *n) { _currencySymbol=n; } QStringList &getAccountTypes() { return(_AccountTypes); } // --- Payees QStringList &getPayees() { return(_Payees); } bool getSavePayees() { return(_bSavePayees); } void setSavePayees(bool bSave) { _bSavePayees=bSave; } // --- Categories QStringList getCategories(); void setCategories(QStringList &lst); CategoryList *getCategoryList() { return(_pCategories); } // --- last book void setOpenLastBook(bool openLastBook) { _openLastBook=openLastBook; } bool isOpenLastBook() { return(_openLastBook); } void setLastBook(const QString &lastBook) { _sLastBook=lastBook; } QString &getLastBook() { return(_sLastBook); } // --- last tab void setShowLastTab(bool showLastTab) { _showLastTab=showLastTab; } bool isShowLastTab() { return(_showLastTab); } // --- reads data from config file void readConfig(Config &cfg); // --- writes data to config file void writeConfig(Config &cfg); // --- dirty flag bool isDirty() { return(_bDirty); } void setDirty(bool bDirty) { _bDirty=bDirty; } protected: // --- reads list from config file static void readStringList(Config &cfg, const char *sKey, QStringList &lst); // --- writes list in configuration file static void writeStringList(Config &cfg, const char *sKey, QStringList &lst); private: QString _currencySymbol; bool _useSmallFont; bool _showLocks; bool _showBalances; bool _openLastBook; bool _showLastTab; bool _bDirty; bool _bSavePayees; QString _sLastBook; QStringList _AccountTypes; CategoryList *_pCategories; QStringList _Payees; }; #endif