-rw-r--r-- | noncore/apps/checkbook/cfg.h | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/noncore/apps/checkbook/cfg.h b/noncore/apps/checkbook/cfg.h index 20692b4..418bd93 100644 --- a/noncore/apps/checkbook/cfg.h +++ b/noncore/apps/checkbook/cfg.h | |||
@@ -1,132 +1,135 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the OPIE Project | 2 | This file is part of the OPIE Project |
3 | =. | 3 | =. |
4 | .=l. Copyright (c) 2002 Dan Williams <drw@handhelds.org> | 4 | .=l. Copyright (c) 2002 Dan Williams <drw@handhelds.org> |
5 | .>+-= | 5 | .>+-= |
6 | _;:, .> :=|. This file is free software; you can | 6 | _;:, .> :=|. This file is free software; you can |
7 | .> <`_, > . <= redistribute it and/or modify it under | 7 | .> <`_, > . <= redistribute it and/or modify it under |
8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
9 | .="- .-=="i, .._ License as published by the Free Software | 9 | .="- .-=="i, .._ License as published by the Free Software |
10 | - . .-<_> .<> Foundation; either version 2 of the License, | 10 | - . .-<_> .<> Foundation; either version 2 of the License, |
11 | ._= =} : or (at your option) any later version. | 11 | ._= =} : or (at your option) any later version. |
12 | .%`+i> _;_. | 12 | .%`+i> _;_. |
13 | .i_,=:_. -<s. This file is distributed in the hope that | 13 | .i_,=:_. -<s. This file is distributed in the hope that |
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
15 | : .. .:, . . . without even the implied warranty of | 15 | : .. .:, . . . without even the implied warranty of |
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
18 | ..}^=.= = ; Public License for more details. | 18 | ..}^=.= = ; Public License for more details. |
19 | ++= -. .` .: | 19 | ++= -. .` .: |
20 | : = ...= . :.=- You should have received a copy of the GNU | 20 | : = ...= . :.=- You should have received a copy of the GNU |
21 | -. .:....=;==+<; General Public License along with this file; | 21 | -. .:....=;==+<; General Public License along with this file; |
22 | -_. . . )=. = see the file COPYING. If not, write to the | 22 | -_. . . )=. = see the file COPYING. If not, write to the |
23 | -- :-=` Free Software Foundation, Inc., | 23 | -- :-=` Free Software Foundation, Inc., |
24 | 59 Temple Place - Suite 330, | 24 | 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #ifndef CFG_H | 29 | #ifndef CFG_H |
30 | #define CFG_H | 30 | #define CFG_H |
31 | 31 | ||
32 | #include <qstring.h> | 32 | #include <qstring.h> |
33 | #include <qlist.h> | 33 | #include <qlist.h> |
34 | #include <qstringlist.h> | 34 | #include <qstringlist.h> |
35 | class Config; | 35 | class Config; |
36 | 36 | ||
37 | // --- Category --------------------------------------------------------------- | 37 | // --- Category --------------------------------------------------------------- |
38 | class Category | 38 | class Category |
39 | { | 39 | { |
40 | public: | 40 | public: |
41 | // --- Constructor: | 41 | // --- Constructor: |
42 | Category(QString &sName, bool bIncome=false) { _sName=sName; _bIncome=bIncome; } | 42 | Category(QString &sName, bool bIncome=false) { _sName=sName; _bIncome=bIncome; } |
43 | 43 | ||
44 | // members | 44 | // members |
45 | QString &getName() { return(_sName); } | 45 | QString &getName() { return(_sName); } |
46 | bool isIncome() { return(_bIncome); } | 46 | bool isIncome() { return(_bIncome); } |
47 | void setName(QString &sName) { _sName=sName; } | 47 | void setName(QString &sName) { _sName=sName; } |
48 | void setIncome(bool bIncome) { _bIncome=bIncome; } | 48 | void setIncome(bool bIncome) { _bIncome=bIncome; } |
49 | 49 | ||
50 | private: | 50 | private: |
51 | QString _sName; | 51 | QString _sName; |
52 | bool _bIncome; | 52 | bool _bIncome; |
53 | }; | 53 | }; |
54 | 54 | ||
55 | class CategoryList : public QList<Category> | 55 | class CategoryList : public QList<Category> |
56 | { | 56 | { |
57 | public: | 57 | public: |
58 | // --- Constructor | 58 | // --- Constructor |
59 | CategoryList(); | 59 | CategoryList(); |
60 | }; | 60 | }; |
61 | 61 | ||
62 | 62 | ||
63 | // --- Cfg -------------------------------------------------------------------- | 63 | // --- Cfg -------------------------------------------------------------------- |
64 | class Cfg | 64 | class Cfg |
65 | { | 65 | { |
66 | public: | 66 | public: |
67 | // --- Constructor | 67 | // --- Constructor |
68 | Cfg(); | 68 | Cfg(); |
69 | 69 | ||
70 | // --- members | 70 | // --- members |
71 | bool getUseSmallFont() { return(_useSmallFont); } | ||
72 | void setUseSmallFont(bool n) { _useSmallFont=n; } | ||
71 | bool getShowLocks() { return(_showLocks); } | 73 | bool getShowLocks() { return(_showLocks); } |
72 | void setShowLocks(bool n) { _showLocks=n; } | 74 | void setShowLocks(bool n) { _showLocks=n; } |
73 | bool getShowBalances() { return(_showBalances); } | 75 | bool getShowBalances() { return(_showBalances); } |
74 | void setShowBalances(bool n) { _showBalances=n; } | 76 | void setShowBalances(bool n) { _showBalances=n; } |
75 | QString &getCurrencySymbol() { return(_currencySymbol); } | 77 | QString &getCurrencySymbol() { return(_currencySymbol); } |
76 | void setCurrencySymbol(QString n) {_currencySymbol= n; } | 78 | void setCurrencySymbol(QString n) {_currencySymbol= n; } |
77 | void setCurrencySymbol(const char *n) { _currencySymbol=n; } | 79 | void setCurrencySymbol(const char *n) { _currencySymbol=n; } |
78 | QStringList &getAccountTypes() { return(_AccountTypes); } | 80 | QStringList &getAccountTypes() { return(_AccountTypes); } |
79 | 81 | ||
80 | // --- Payees | 82 | // --- Payees |
81 | QStringList &getPayees() { return(_Payees); } | 83 | QStringList &getPayees() { return(_Payees); } |
82 | bool getSavePayees() { return(_bSavePayees); } | 84 | bool getSavePayees() { return(_bSavePayees); } |
83 | void setSavePayees(bool bSave) { _bSavePayees=bSave; } | 85 | void setSavePayees(bool bSave) { _bSavePayees=bSave; } |
84 | 86 | ||
85 | // --- Categories | 87 | // --- Categories |
86 | QStringList getCategories(); | 88 | QStringList getCategories(); |
87 | void setCategories(QStringList &lst); | 89 | void setCategories(QStringList &lst); |
88 | CategoryList *getCategoryList() { return(_pCategories); } | 90 | CategoryList *getCategoryList() { return(_pCategories); } |
89 | 91 | ||
90 | // --- last book | 92 | // --- last book |
91 | void setOpenLastBook(bool openLastBook) { _openLastBook=openLastBook; } | 93 | void setOpenLastBook(bool openLastBook) { _openLastBook=openLastBook; } |
92 | bool isOpenLastBook() { return(_openLastBook); } | 94 | bool isOpenLastBook() { return(_openLastBook); } |
93 | void setLastBook(const QString &lastBook) { _sLastBook=lastBook; } | 95 | void setLastBook(const QString &lastBook) { _sLastBook=lastBook; } |
94 | QString &getLastBook() { return(_sLastBook); } | 96 | QString &getLastBook() { return(_sLastBook); } |
95 | 97 | ||
96 | // --- last tab | 98 | // --- last tab |
97 | void setShowLastTab(bool showLastTab) { _showLastTab=showLastTab; } | 99 | void setShowLastTab(bool showLastTab) { _showLastTab=showLastTab; } |
98 | bool isShowLastTab() { return(_showLastTab); } | 100 | bool isShowLastTab() { return(_showLastTab); } |
99 | 101 | ||
100 | // --- reads data from config file | 102 | // --- reads data from config file |
101 | void readConfig(Config &cfg); | 103 | void readConfig(Config &cfg); |
102 | 104 | ||
103 | // --- writes data to config file | 105 | // --- writes data to config file |
104 | void writeConfig(Config &cfg); | 106 | void writeConfig(Config &cfg); |
105 | 107 | ||
106 | // --- dirty flag | 108 | // --- dirty flag |
107 | bool isDirty() { return(_bDirty); } | 109 | bool isDirty() { return(_bDirty); } |
108 | void setDirty(bool bDirty) { _bDirty=bDirty; } | 110 | void setDirty(bool bDirty) { _bDirty=bDirty; } |
109 | 111 | ||
110 | protected: | 112 | protected: |
111 | // --- reads list from config file | 113 | // --- reads list from config file |
112 | static void readStringList(Config &cfg, const char *sKey, QStringList &lst); | 114 | static void readStringList(Config &cfg, const char *sKey, QStringList &lst); |
113 | 115 | ||
114 | // --- writes list in configuration file | 116 | // --- writes list in configuration file |
115 | static void writeStringList(Config &cfg, const char *sKey, QStringList &lst); | 117 | static void writeStringList(Config &cfg, const char *sKey, QStringList &lst); |
116 | 118 | ||
117 | private: | 119 | private: |
118 | QString _currencySymbol; | 120 | QString _currencySymbol; |
121 | bool _useSmallFont; | ||
119 | bool _showLocks; | 122 | bool _showLocks; |
120 | bool _showBalances; | 123 | bool _showBalances; |
121 | bool _openLastBook; | 124 | bool _openLastBook; |
122 | bool _showLastTab; | 125 | bool _showLastTab; |
123 | bool _bDirty; | 126 | bool _bDirty; |
124 | bool _bSavePayees; | 127 | bool _bSavePayees; |
125 | QString _sLastBook; | 128 | QString _sLastBook; |
126 | QStringList _AccountTypes; | 129 | QStringList _AccountTypes; |
127 | CategoryList *_pCategories; | 130 | CategoryList *_pCategories; |
128 | QStringList _Payees; | 131 | QStringList _Payees; |
129 | 132 | ||
130 | }; | 133 | }; |
131 | 134 | ||
132 | #endif | 135 | #endif |