-rw-r--r-- | noncore/apps/checkbook/cfg.cpp | 3 | ||||
-rw-r--r-- | noncore/apps/checkbook/cfg.h | 45 | ||||
-rw-r--r-- | noncore/apps/checkbook/checkbook.cpp | 5 | ||||
-rw-r--r-- | noncore/apps/checkbook/configuration.cpp | 6 | ||||
-rw-r--r-- | noncore/apps/checkbook/configuration.h | 1 |
5 files changed, 38 insertions, 22 deletions
diff --git a/noncore/apps/checkbook/cfg.cpp b/noncore/apps/checkbook/cfg.cpp index 24fa4cb..4f70593 100644 --- a/noncore/apps/checkbook/cfg.cpp +++ b/noncore/apps/checkbook/cfg.cpp | |||
@@ -16,88 +16,90 @@ | |||
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 | #include <stdio.h> | 29 | #include <stdio.h> |
30 | 30 | ||
31 | #include <qwidget.h> | 31 | #include <qwidget.h> |
32 | #include <qpe/config.h> | 32 | #include <qpe/config.h> |
33 | 33 | ||
34 | #include "cfg.h" | 34 | #include "cfg.h" |
35 | 35 | ||
36 | // --- Cfg -------------------------------------------------------------------- | 36 | // --- Cfg -------------------------------------------------------------------- |
37 | Cfg::Cfg() | 37 | Cfg::Cfg() |
38 | { | 38 | { |
39 | _currencySymbol="$"; | 39 | _currencySymbol="$"; |
40 | _useSmallFont=TRUE; | ||
40 | _showLocks=FALSE; | 41 | _showLocks=FALSE; |
41 | _showBalances=FALSE; | 42 | _showBalances=FALSE; |
42 | _pCategories=new CategoryList(); | 43 | _pCategories=new CategoryList(); |
43 | _bDirty=false; | 44 | _bDirty=false; |
44 | } | 45 | } |
45 | 46 | ||
46 | // --- readStringList --------------------------------------------------------- | 47 | // --- readStringList --------------------------------------------------------- |
47 | // Reads the entries for the control from a configuration file and returns | 48 | // Reads the entries for the control from a configuration file and returns |
48 | // them in a StringList. Later this list can be used to create the control. It | 49 | // them in a StringList. Later this list can be used to create the control. It |
49 | // is assumed, that the group is already set. Key is used to enumerate the | 50 | // is assumed, that the group is already set. Key is used to enumerate the |
50 | // entries. | 51 | // entries. |
51 | void Cfg::readStringList(Config &cfg, const char *sKey, QStringList &lst) | 52 | void Cfg::readStringList(Config &cfg, const char *sKey, QStringList &lst) |
52 | { | 53 | { |
53 | QString sEntry; | 54 | QString sEntry; |
54 | int iCount; | 55 | int iCount; |
55 | 56 | ||
56 | // read count of elements | 57 | // read count of elements |
57 | sEntry.sprintf("%s_Count", sKey); | 58 | sEntry.sprintf("%s_Count", sKey); |
58 | iCount=cfg.readNumEntry(sEntry, 0); | 59 | iCount=cfg.readNumEntry(sEntry, 0); |
59 | 60 | ||
60 | // read entries | 61 | // read entries |
61 | for(int i=1; i<=iCount; i++) { | 62 | for(int i=1; i<=iCount; i++) { |
62 | sEntry.sprintf("%s%d", sKey, i); | 63 | sEntry.sprintf("%s%d", sKey, i); |
63 | QString sType=cfg.readEntry(sEntry); | 64 | QString sType=cfg.readEntry(sEntry); |
64 | if( sType!=NULL ) | 65 | if( sType!=NULL ) |
65 | lst.append(sType); | 66 | lst.append(sType); |
66 | } | 67 | } |
67 | } | 68 | } |
68 | 69 | ||
69 | 70 | ||
70 | // --- readConfig ------------------------------------------------------------- | 71 | // --- readConfig ------------------------------------------------------------- |
71 | // Reads the member data from the given config file. It will also set the group | 72 | // Reads the member data from the given config file. It will also set the group |
72 | // "Config" | 73 | // "Config" |
73 | void Cfg::readConfig(Config &config) | 74 | void Cfg::readConfig(Config &config) |
74 | { | 75 | { |
75 | // set group | 76 | // set group |
76 | config.setGroup( "Config" ); | 77 | config.setGroup( "Config" ); |
77 | 78 | ||
78 | // read scalars | 79 | // read scalars |
79 | _currencySymbol = config.readEntry( "CurrencySymbol", "$" ); | 80 | _currencySymbol = config.readEntry( "CurrencySymbol", "$" ); |
81 | _useSmallFont = config.readBoolEntry( "UseSmallFont", TRUE ); | ||
80 | _showLocks = config.readBoolEntry( "ShowLocks", FALSE ); | 82 | _showLocks = config.readBoolEntry( "ShowLocks", FALSE ); |
81 | _showBalances = config.readBoolEntry( "ShowBalances", FALSE ); | 83 | _showBalances = config.readBoolEntry( "ShowBalances", FALSE ); |
82 | _openLastBook = config.readBoolEntry( "OpenLastBook", FALSE ); | 84 | _openLastBook = config.readBoolEntry( "OpenLastBook", FALSE ); |
83 | _sLastBook = config.readEntry("LastBook", ""); | 85 | _sLastBook = config.readEntry("LastBook", ""); |
84 | _showLastTab = config.readBoolEntry( "ShowLastTab", FALSE ); | 86 | _showLastTab = config.readBoolEntry( "ShowLastTab", FALSE ); |
85 | _bSavePayees = config.readBoolEntry( "SavePayees", FALSE ); | 87 | _bSavePayees = config.readBoolEntry( "SavePayees", FALSE ); |
86 | 88 | ||
87 | // Account types | 89 | // Account types |
88 | readStringList(config, "AccType", _AccountTypes); | 90 | readStringList(config, "AccType", _AccountTypes); |
89 | if( _AccountTypes.isEmpty() ) { | 91 | if( _AccountTypes.isEmpty() ) { |
90 | _AccountTypes+= (const char *)QWidget::tr("Savings"); | 92 | _AccountTypes+= (const char *)QWidget::tr("Savings"); |
91 | _AccountTypes+= (const char *)QWidget::tr("Checking"); | 93 | _AccountTypes+= (const char *)QWidget::tr("Checking"); |
92 | _AccountTypes+= (const char *)QWidget::tr("CD"); | 94 | _AccountTypes+= (const char *)QWidget::tr("CD"); |
93 | _AccountTypes+= (const char *)QWidget::tr("Money market"); | 95 | _AccountTypes+= (const char *)QWidget::tr("Money market"); |
94 | _AccountTypes+= (const char *)QWidget::tr("Mutual fund"); | 96 | _AccountTypes+= (const char *)QWidget::tr("Mutual fund"); |
95 | _AccountTypes+= (const char *)QWidget::tr("Other"); | 97 | _AccountTypes+= (const char *)QWidget::tr("Other"); |
96 | writeStringList(config, "AccType", _AccountTypes); | 98 | writeStringList(config, "AccType", _AccountTypes); |
97 | config.write(); | 99 | config.write(); |
98 | } | 100 | } |
99 | 101 | ||
100 | // Payees | 102 | // Payees |
101 | readStringList(config, "Payee", _Payees); | 103 | readStringList(config, "Payee", _Payees); |
102 | 104 | ||
103 | // Read Categories | 105 | // Read Categories |
@@ -143,48 +145,49 @@ void Cfg::readConfig(Config &config) | |||
143 | void Cfg::writeStringList(Config &cfg, const char *sKey, QStringList &lst) | 145 | void Cfg::writeStringList(Config &cfg, const char *sKey, QStringList &lst) |
144 | { | 146 | { |
145 | QString sEntry; | 147 | QString sEntry; |
146 | int iCount=0; | 148 | int iCount=0; |
147 | QStringList::Iterator itr; | 149 | QStringList::Iterator itr; |
148 | for(itr=lst.begin(); itr!=lst.end(); itr++) { | 150 | for(itr=lst.begin(); itr!=lst.end(); itr++) { |
149 | sEntry.sprintf("%s%d", sKey, ++iCount); | 151 | sEntry.sprintf("%s%d", sKey, ++iCount); |
150 | cfg.writeEntry(sEntry, *itr ); | 152 | cfg.writeEntry(sEntry, *itr ); |
151 | } | 153 | } |
152 | sEntry.sprintf("%s_Count", sKey); | 154 | sEntry.sprintf("%s_Count", sKey); |
153 | cfg.writeEntry(sEntry, iCount); | 155 | cfg.writeEntry(sEntry, iCount); |
154 | } | 156 | } |
155 | 157 | ||
156 | 158 | ||
157 | // --- writeConfig ----------------------------------------------------------- | 159 | // --- writeConfig ----------------------------------------------------------- |
158 | // Writes all config data back to the config file. The group will be set to | 160 | // Writes all config data back to the config file. The group will be set to |
159 | // "Config" and the write be commited | 161 | // "Config" and the write be commited |
160 | void Cfg::writeConfig(Config &config) | 162 | void Cfg::writeConfig(Config &config) |
161 | { | 163 | { |
162 | // set the group | 164 | // set the group |
163 | config.setGroup( "Config" ); | 165 | config.setGroup( "Config" ); |
164 | 166 | ||
165 | // write scalars | 167 | // write scalars |
166 | config.writeEntry( "CurrencySymbol", _currencySymbol ); | 168 | config.writeEntry( "CurrencySymbol", _currencySymbol ); |
169 | config.writeEntry( "UseSmallFont", _useSmallFont ); | ||
167 | config.writeEntry( "ShowLocks", _showLocks ); | 170 | config.writeEntry( "ShowLocks", _showLocks ); |
168 | config.writeEntry( "ShowBalances", _showBalances ); | 171 | config.writeEntry( "ShowBalances", _showBalances ); |
169 | config.writeEntry( "OpenLastBook", _openLastBook ); | 172 | config.writeEntry( "OpenLastBook", _openLastBook ); |
170 | config.writeEntry( "LastBook", _sLastBook ); | 173 | config.writeEntry( "LastBook", _sLastBook ); |
171 | config.writeEntry( "ShowLastTab", _showLastTab ); | 174 | config.writeEntry( "ShowLastTab", _showLastTab ); |
172 | config.writeEntry( "SavePayees", _bSavePayees ); | 175 | config.writeEntry( "SavePayees", _bSavePayees ); |
173 | 176 | ||
174 | // write account types | 177 | // write account types |
175 | writeStringList(config, "AccType", _AccountTypes); | 178 | writeStringList(config, "AccType", _AccountTypes); |
176 | 179 | ||
177 | // write payees | 180 | // write payees |
178 | writeStringList(config, "Payee", _Payees); | 181 | writeStringList(config, "Payee", _Payees); |
179 | 182 | ||
180 | // write categories | 183 | // write categories |
181 | QStringList lst=getCategories(); | 184 | QStringList lst=getCategories(); |
182 | writeStringList(config, "Category", lst ); | 185 | writeStringList(config, "Category", lst ); |
183 | 186 | ||
184 | // commit write | 187 | // commit write |
185 | config.write(); | 188 | config.write(); |
186 | _bDirty=false; | 189 | _bDirty=false; |
187 | } | 190 | } |
188 | 191 | ||
189 | 192 | ||
190 | // --- getCategories ---------------------------------------------------------- | 193 | // --- getCategories ---------------------------------------------------------- |
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 |
diff --git a/noncore/apps/checkbook/checkbook.cpp b/noncore/apps/checkbook/checkbook.cpp index b325f45..1231f42 100644 --- a/noncore/apps/checkbook/checkbook.cpp +++ b/noncore/apps/checkbook/checkbook.cpp | |||
@@ -200,49 +200,52 @@ QWidget *Checkbook::initInfo() | |||
200 | 200 | ||
201 | // --- initTransactions ------------------------------------------------------- | 201 | // --- initTransactions ------------------------------------------------------- |
202 | QWidget *Checkbook::initTransactions() | 202 | QWidget *Checkbook::initTransactions() |
203 | { | 203 | { |
204 | QWidget *control = new QWidget( mainWidget, tr("Transactions") ); | 204 | QWidget *control = new QWidget( mainWidget, tr("Transactions") ); |
205 | 205 | ||
206 | QGridLayout *layout = new QGridLayout( control ); | 206 | QGridLayout *layout = new QGridLayout( control ); |
207 | layout->setSpacing( 2 ); | 207 | layout->setSpacing( 2 ); |
208 | layout->setMargin( 4 ); | 208 | layout->setMargin( 4 ); |
209 | 209 | ||
210 | // Sort selector | 210 | // Sort selector |
211 | QLabel *label = new QLabel( tr( "Sort by:" ), control ); | 211 | QLabel *label = new QLabel( tr( "Sort by:" ), control ); |
212 | QWhatsThis::add( label, tr( "Select checkbook sorting here." ) ); | 212 | QWhatsThis::add( label, tr( "Select checkbook sorting here." ) ); |
213 | layout->addMultiCellWidget( label, 0, 0, 0, 1 ); | 213 | layout->addMultiCellWidget( label, 0, 0, 0, 1 ); |
214 | _cbSortType=new QComboBox( control ); | 214 | _cbSortType=new QComboBox( control ); |
215 | _cbSortType->insertItem( tr("Entry Order") ); | 215 | _cbSortType->insertItem( tr("Entry Order") ); |
216 | _cbSortType->insertItem( tr("Date") ); | 216 | _cbSortType->insertItem( tr("Date") ); |
217 | _cbSortType->insertItem( tr("Number") ); | 217 | _cbSortType->insertItem( tr("Number") ); |
218 | layout->addMultiCellWidget( _cbSortType, 0, 0, 1, 2 ); | 218 | layout->addMultiCellWidget( _cbSortType, 0, 0, 1, 2 ); |
219 | connect( _cbSortType, SIGNAL( activated(const QString&) ), this, SLOT( slotSortChanged(const QString&) ) ); | 219 | connect( _cbSortType, SIGNAL( activated(const QString&) ), this, SLOT( slotSortChanged(const QString&) ) ); |
220 | 220 | ||
221 | // Table | 221 | // Table |
222 | tranTable = new QListView( control ); | 222 | tranTable = new QListView( control ); |
223 | QFont fnt(QPEApplication::font()); | 223 | QFont fnt(QPEApplication::font()); |
224 | fnt.setPointSize( fnt.pointSize()-1 ); | 224 | if( _pCfg->getUseSmallFont() ) |
225 | { | ||
226 | fnt.setPointSize( fnt.pointSize()-1 ); | ||
227 | } | ||
225 | tranTable->setFont( fnt ); | 228 | tranTable->setFont( fnt ); |
226 | QWhatsThis::add( tranTable, tr( "This is a listing of all transactions entered for this checkbook.\n\nTo sort entries by a specific field, click on the column name." ) ); | 229 | QWhatsThis::add( tranTable, tr( "This is a listing of all transactions entered for this checkbook.\n\nTo sort entries by a specific field, click on the column name." ) ); |
227 | tranTable->addColumn( tr( "Id" ) ); | 230 | tranTable->addColumn( tr( "Id" ) ); |
228 | tranTable->setColumnWidthMode( COL_ID, QListView::Manual ); | 231 | tranTable->setColumnWidthMode( COL_ID, QListView::Manual ); |
229 | tranTable->setColumnWidth( COL_ID, 0); | 232 | tranTable->setColumnWidth( COL_ID, 0); |
230 | tranTable->addColumn( tr( "SortDate" ) ); | 233 | tranTable->addColumn( tr( "SortDate" ) ); |
231 | tranTable->setColumnWidthMode( COL_SORTDATE, QListView::Manual ); | 234 | tranTable->setColumnWidthMode( COL_SORTDATE, QListView::Manual ); |
232 | tranTable->setColumnWidth( COL_SORTDATE, 0); | 235 | tranTable->setColumnWidth( COL_SORTDATE, 0); |
233 | tranTable->addColumn( tr( "Num" ) ); | 236 | tranTable->addColumn( tr( "Num" ) ); |
234 | tranTable->addColumn( tr( "Date" ) ); | 237 | tranTable->addColumn( tr( "Date" ) ); |
235 | //tranTable->addColumn( tr( "Cleared" ) ); | 238 | //tranTable->addColumn( tr( "Cleared" ) ); |
236 | tranTable->addColumn( tr( "Description" ) ); | 239 | tranTable->addColumn( tr( "Description" ) ); |
237 | int column = tranTable->addColumn( tr( "Amount" ) ); | 240 | int column = tranTable->addColumn( tr( "Amount" ) ); |
238 | tranTable->setColumnAlignment( column, Qt::AlignRight ); | 241 | tranTable->setColumnAlignment( column, Qt::AlignRight ); |
239 | column=tranTable->addColumn( tr("Balance") ); | 242 | column=tranTable->addColumn( tr("Balance") ); |
240 | tranTable->setColumnAlignment( column, Qt::AlignRight ); | 243 | tranTable->setColumnAlignment( column, Qt::AlignRight ); |
241 | tranTable->setAllColumnsShowFocus( TRUE ); | 244 | tranTable->setAllColumnsShowFocus( TRUE ); |
242 | tranTable->setSorting( -1 ); | 245 | tranTable->setSorting( -1 ); |
243 | layout->addMultiCellWidget( tranTable, 1, 1, 0, 2 ); | 246 | layout->addMultiCellWidget( tranTable, 1, 1, 0, 2 ); |
244 | QPEApplication::setStylusOperation( tranTable->viewport(), QPEApplication::RightOnHold ); | 247 | QPEApplication::setStylusOperation( tranTable->viewport(), QPEApplication::RightOnHold ); |
245 | connect( tranTable, SIGNAL( rightButtonPressed(QListViewItem*,const QPoint&,int) ), | 248 | connect( tranTable, SIGNAL( rightButtonPressed(QListViewItem*,const QPoint&,int) ), |
246 | this, SLOT( slotMenuTran(QListViewItem*,const QPoint&) ) ); | 249 | this, SLOT( slotMenuTran(QListViewItem*,const QPoint&) ) ); |
247 | connect( tranTable, SIGNAL( doubleClicked(QListViewItem*) ), | 250 | connect( tranTable, SIGNAL( doubleClicked(QListViewItem*) ), |
248 | this, SLOT( slotEditTran() ) ); | 251 | this, SLOT( slotEditTran() ) ); |
diff --git a/noncore/apps/checkbook/configuration.cpp b/noncore/apps/checkbook/configuration.cpp index 872d9b2..929c7c0 100644 --- a/noncore/apps/checkbook/configuration.cpp +++ b/noncore/apps/checkbook/configuration.cpp | |||
@@ -125,49 +125,55 @@ QWidget *Configuration::initSettings(Cfg &cfg) | |||
125 | balCB = new QCheckBox( tr( "Show checkbook balances" ), container ); | 125 | balCB = new QCheckBox( tr( "Show checkbook balances" ), container ); |
126 | QWhatsThis::add( balCB, tr( "Click here to select whether or not the main window will display the current balance for each checkbook." ) ); | 126 | QWhatsThis::add( balCB, tr( "Click here to select whether or not the main window will display the current balance for each checkbook." ) ); |
127 | balCB->setMaximumHeight( fh + 5 ); | 127 | balCB->setMaximumHeight( fh + 5 ); |
128 | balCB->setChecked( cfg.getShowBalances() ); | 128 | balCB->setChecked( cfg.getShowBalances() ); |
129 | layout->addMultiCellWidget( balCB, 2, 2, 0, 1 ); | 129 | layout->addMultiCellWidget( balCB, 2, 2, 0, 1 ); |
130 | 130 | ||
131 | openLastBookCB = new QCheckBox( tr("Open last checkbook" ), container ); | 131 | openLastBookCB = new QCheckBox( tr("Open last checkbook" ), container ); |
132 | QWhatsThis::add( openLastBookCB, tr("Click here to select whether the last open checkbook will be opened at startup.") ); | 132 | QWhatsThis::add( openLastBookCB, tr("Click here to select whether the last open checkbook will be opened at startup.") ); |
133 | openLastBookCB->setMaximumHeight(fh+5); | 133 | openLastBookCB->setMaximumHeight(fh+5); |
134 | openLastBookCB->setChecked( cfg.isOpenLastBook() ); | 134 | openLastBookCB->setChecked( cfg.isOpenLastBook() ); |
135 | layout->addMultiCellWidget( openLastBookCB, 3, 3, 0, 1 ); | 135 | layout->addMultiCellWidget( openLastBookCB, 3, 3, 0, 1 ); |
136 | 136 | ||
137 | lastTabCB = new QCheckBox( tr("Show last checkbook tab" ), container ); | 137 | lastTabCB = new QCheckBox( tr("Show last checkbook tab" ), container ); |
138 | QWhatsThis::add( lastTabCB, tr("Click here to select whether the last tab in a checkbook should be displayed.") ); | 138 | QWhatsThis::add( lastTabCB, tr("Click here to select whether the last tab in a checkbook should be displayed.") ); |
139 | lastTabCB->setMaximumHeight(fh+5); | 139 | lastTabCB->setMaximumHeight(fh+5); |
140 | lastTabCB->setChecked( cfg.isShowLastTab() ); | 140 | lastTabCB->setChecked( cfg.isShowLastTab() ); |
141 | layout->addMultiCellWidget( lastTabCB, 4, 4, 0, 1 ); | 141 | layout->addMultiCellWidget( lastTabCB, 4, 4, 0, 1 ); |
142 | 142 | ||
143 | savePayees = new QCheckBox( tr("Save new description as payee"), container ); | 143 | savePayees = new QCheckBox( tr("Save new description as payee"), container ); |
144 | QWhatsThis::add( savePayees, tr("Click here to save new descriptions in the list of payess.") ); | 144 | QWhatsThis::add( savePayees, tr("Click here to save new descriptions in the list of payess.") ); |
145 | savePayees->setMaximumHeight(fh+5); | 145 | savePayees->setMaximumHeight(fh+5); |
146 | savePayees->setChecked( cfg.getSavePayees() ); | 146 | savePayees->setChecked( cfg.getSavePayees() ); |
147 | layout->addMultiCellWidget( savePayees, 5, 5, 0, 1 ); | 147 | layout->addMultiCellWidget( savePayees, 5, 5, 0, 1 ); |
148 | 148 | ||
149 | smallFontCB = new QCheckBox( tr( "Use smaller font for list" ), container ); | ||
150 | QWhatsThis::add( smallFontCB, tr( "Click here to select smaller font for transactions." ) ); | ||
151 | smallFontCB->setChecked( cfg.getUseSmallFont() ); | ||
152 | layout->addMultiCellWidget( smallFontCB, 6, 6, 0, 1 ); | ||
153 | |||
149 | return(control); | 154 | return(control); |
150 | } | 155 | } |
151 | 156 | ||
152 | // --- saveConfig ------------------------------------------------------------- | 157 | // --- saveConfig ------------------------------------------------------------- |
153 | void Configuration::saveConfig(Cfg &cfg) | 158 | void Configuration::saveConfig(Cfg &cfg) |
154 | { | 159 | { |
155 | // Settings | 160 | // Settings |
156 | cfg.setCurrencySymbol( symbolEdit->text() ); | 161 | cfg.setCurrencySymbol( symbolEdit->text() ); |
162 | cfg.setUseSmallFont( smallFontCB->isChecked() ); | ||
157 | cfg.setShowLocks( lockCB->isChecked() ); | 163 | cfg.setShowLocks( lockCB->isChecked() ); |
158 | cfg.setShowBalances( balCB->isChecked() ); | 164 | cfg.setShowBalances( balCB->isChecked() ); |
159 | cfg.setOpenLastBook( openLastBookCB->isChecked() ); | 165 | cfg.setOpenLastBook( openLastBookCB->isChecked() ); |
160 | cfg.setShowLastTab( lastTabCB->isChecked() ); | 166 | cfg.setShowLastTab( lastTabCB->isChecked() ); |
161 | cfg.setSavePayees( savePayees->isChecked() ); | 167 | cfg.setSavePayees( savePayees->isChecked() ); |
162 | 168 | ||
163 | // Typelist | 169 | // Typelist |
164 | _listEditTypes->storeInList( cfg.getAccountTypes() ); | 170 | _listEditTypes->storeInList( cfg.getAccountTypes() ); |
165 | 171 | ||
166 | // Category list | 172 | // Category list |
167 | QStringList lst; | 173 | QStringList lst; |
168 | _listEditCategories->storeInList( lst ); | 174 | _listEditCategories->storeInList( lst ); |
169 | cfg.setCategories( lst ); | 175 | cfg.setCategories( lst ); |
170 | 176 | ||
171 | // Payees | 177 | // Payees |
172 | _listEditPayees->storeInList( cfg.getPayees() ); | 178 | _listEditPayees->storeInList( cfg.getPayees() ); |
173 | } | 179 | } |
diff --git a/noncore/apps/checkbook/configuration.h b/noncore/apps/checkbook/configuration.h index 663514d..44c9717 100644 --- a/noncore/apps/checkbook/configuration.h +++ b/noncore/apps/checkbook/configuration.h | |||
@@ -27,43 +27,44 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #ifndef CONFIGURATION_H | 29 | #ifndef CONFIGURATION_H |
30 | #define CONFIGURATION_H | 30 | #define CONFIGURATION_H |
31 | 31 | ||
32 | #include <qdialog.h> | 32 | #include <qdialog.h> |
33 | #include "cfg.h" | 33 | #include "cfg.h" |
34 | 34 | ||
35 | class QCheckBox; | 35 | class QCheckBox; |
36 | class QLineEdit; | 36 | class QLineEdit; |
37 | class QString; | 37 | class QString; |
38 | class QTabWidget; | 38 | class QTabWidget; |
39 | class ListEdit; | 39 | class ListEdit; |
40 | 40 | ||
41 | class Configuration : public QDialog | 41 | class Configuration : public QDialog |
42 | { | 42 | { |
43 | Q_OBJECT | 43 | Q_OBJECT |
44 | 44 | ||
45 | public: | 45 | public: |
46 | // Constructor | 46 | // Constructor |
47 | Configuration( QWidget *, Cfg &cfg); | 47 | Configuration( QWidget *, Cfg &cfg); |
48 | ~Configuration(); | 48 | ~Configuration(); |
49 | 49 | ||
50 | QLineEdit *symbolEdit; | 50 | QLineEdit *symbolEdit; |
51 | QCheckBox *smallFontCB; | ||
51 | QCheckBox *lockCB; | 52 | QCheckBox *lockCB; |
52 | QCheckBox *balCB; | 53 | QCheckBox *balCB; |
53 | QCheckBox *openLastBookCB; | 54 | QCheckBox *openLastBookCB; |
54 | QCheckBox *lastTabCB; | 55 | QCheckBox *lastTabCB; |
55 | QCheckBox *savePayees; | 56 | QCheckBox *savePayees; |
56 | QTabWidget *_mainWidget; | 57 | QTabWidget *_mainWidget; |
57 | ListEdit *_listEditTypes; | 58 | ListEdit *_listEditTypes; |
58 | ListEdit *_listEditCategories; | 59 | ListEdit *_listEditCategories; |
59 | ListEdit *_listEditPayees; | 60 | ListEdit *_listEditPayees; |
60 | 61 | ||
61 | // saves settings in config struct | 62 | // saves settings in config struct |
62 | void saveConfig(Cfg &cfg); | 63 | void saveConfig(Cfg &cfg); |
63 | 64 | ||
64 | protected: | 65 | protected: |
65 | // creates settings tap from configuration | 66 | // creates settings tap from configuration |
66 | QWidget *initSettings(Cfg &cfg); | 67 | QWidget *initSettings(Cfg &cfg); |
67 | }; | 68 | }; |
68 | 69 | ||
69 | #endif | 70 | #endif |