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