55 files changed, 1510 insertions, 428 deletions
diff --git a/noncore/apps/checkbook/cbinfo.cpp b/noncore/apps/checkbook/cbinfo.cpp index 9fdc6b2..36dde04 100644 --- a/noncore/apps/checkbook/cbinfo.cpp +++ b/noncore/apps/checkbook/cbinfo.cpp | |||
@@ -33,6 +33,7 @@ | |||
33 | 33 | ||
34 | #include <qfile.h> | 34 | #include <qfile.h> |
35 | 35 | ||
36 | // --- CBInfo ----------------------------------------------------------------- | ||
36 | CBInfo::CBInfo() | 37 | CBInfo::CBInfo() |
37 | { | 38 | { |
38 | n = ""; | 39 | n = ""; |
@@ -44,10 +45,15 @@ CBInfo::CBInfo() | |||
44 | p = ""; | 45 | p = ""; |
45 | nt = ""; | 46 | nt = ""; |
46 | sb = 0.0; | 47 | sb = 0.0; |
48 | _sLastTab=""; | ||
49 | _first=-1; | ||
50 | _last=-1; | ||
47 | 51 | ||
48 | tl = new TranInfoList(); | 52 | tl = new TranInfoList(); |
49 | } | 53 | } |
50 | 54 | ||
55 | |||
56 | // --- CBInfo ----------------------------------------------------------------- | ||
51 | CBInfo::CBInfo( const QString &name, const QString &filename ) | 57 | CBInfo::CBInfo( const QString &name, const QString &filename ) |
52 | { | 58 | { |
53 | Config config( filename, Config::File ); | 59 | Config config( filename, Config::File ); |
@@ -62,6 +68,9 @@ CBInfo::CBInfo( const QString &name, const QString &filename ) | |||
62 | a = config.readEntryCrypt( "Number", "" ); | 68 | a = config.readEntryCrypt( "Number", "" ); |
63 | p = config.readEntryCrypt( "PINNumber", "" ); | 69 | p = config.readEntryCrypt( "PINNumber", "" ); |
64 | nt = config.readEntry( "Notes", "" ); | 70 | nt = config.readEntry( "Notes", "" ); |
71 | _sLastTab = config.readEntry("LastTab", ""); | ||
72 | _first=config.readNumEntry("First", -1); | ||
73 | _sSortOrder = config.readEntry( "SortOrder", QWidget::tr("Date") ); | ||
65 | 74 | ||
66 | bool ok; | 75 | bool ok; |
67 | sb = config.readEntry( "Balance", "0.0" ).toFloat( &ok ); | 76 | sb = config.readEntry( "Balance", "0.0" ).toFloat( &ok ); |
@@ -69,23 +78,40 @@ CBInfo::CBInfo( const QString &name, const QString &filename ) | |||
69 | loadTransactions(); | 78 | loadTransactions(); |
70 | } | 79 | } |
71 | 80 | ||
81 | // --- balance ---------------------------------------------------------------- | ||
72 | float CBInfo::balance() | 82 | float CBInfo::balance() |
73 | { | 83 | { |
74 | calcBalance(); | 84 | calcBalance(); |
75 | return b; | 85 | return b; |
76 | } | 86 | } |
77 | 87 | ||
88 | // --- write ------------------------------------------------------------------ | ||
78 | void CBInfo::write() | 89 | void CBInfo::write() |
79 | { | 90 | { |
80 | QFile f( fn ); | 91 | QFile f( fn ); |
81 | if ( f.exists() ) | 92 | if ( f.exists() ) |
82 | { | ||
83 | f.remove(); | 93 | f.remove(); |
84 | } | ||
85 | 94 | ||
86 | Config *config = new Config(fn, Config::File); | 95 | Config *config = new Config(fn, Config::File); |
87 | 96 | ||
97 | |||
98 | // fix transaction numbers | ||
99 | _first=-1; | ||
100 | TranInfo *prev=NULL; | ||
101 | for ( TranInfo *tran = tl->first(); tran; tran = tl->next() ) { | ||
102 | if( _first<0 ) _first=tran->id(); | ||
103 | if( prev ) prev->setNext( tran->id() ); | ||
104 | tran->setNext(-1); | ||
105 | prev=tran; | ||
106 | } | ||
107 | |||
108 | // Save transactions | ||
109 | for ( TranInfo *tran = tl->first(); tran; tran = tl->next() ) { | ||
110 | tran->write(config); | ||
111 | } | ||
112 | |||
88 | // Save info | 113 | // Save info |
114 | if( _first<0 && _last>=0 ) _first=_last; | ||
89 | config->setGroup( "Account" ); | 115 | config->setGroup( "Account" ); |
90 | config->writeEntryCrypt( "Password", pw ); | 116 | config->writeEntryCrypt( "Password", pw ); |
91 | config->writeEntry( "Type", t ); | 117 | config->writeEntry( "Type", t ); |
@@ -93,49 +119,49 @@ void CBInfo::write() | |||
93 | config->writeEntryCrypt( "Number", a ); | 119 | config->writeEntryCrypt( "Number", a ); |
94 | config->writeEntryCrypt( "PINNumber", p ); | 120 | config->writeEntryCrypt( "PINNumber", p ); |
95 | config->writeEntry( "Notes", nt ); | 121 | config->writeEntry( "Notes", nt ); |
122 | config->writeEntry( "LastTab", _sLastTab ); | ||
96 | QString balstr; | 123 | QString balstr; |
97 | balstr.setNum( sb, 'f', 2 ); | 124 | balstr.setNum( sb, 'f', 2 ); |
98 | config->writeEntry( "Balance", balstr ); | 125 | config->writeEntry( "Balance", balstr ); |
126 | config->writeEntry( "First", _first ); | ||
127 | config->writeEntry( "SortOrder", _sSortOrder ); | ||
99 | 128 | ||
100 | // Save transactions | ||
101 | int i = 1; | ||
102 | for ( TranInfo *tran = tl->first(); tran; tran = tl->next() ) | ||
103 | { | ||
104 | tran->write( config, i ); | ||
105 | i++; | ||
106 | } | ||
107 | config->write(); | 129 | config->write(); |
108 | |||
109 | delete config; | 130 | delete config; |
110 | } | 131 | } |
111 | 132 | ||
112 | TranInfo *CBInfo::findTransaction( const QString &checknum, const QString &date, | 133 | |
113 | const QString &desc ) | 134 | // --- findTransaction -------------------------------------------------------- |
114 | { | 135 | TranInfo *CBInfo::findTransaction( const QString &sId ) |
115 | TranInfo *traninfo = tl->first(); | ||
116 | while ( traninfo ) | ||
117 | { | 136 | { |
118 | if ( traninfo->number() == checknum && traninfo->datestr() == date && | 137 | bool bOk; |
119 | traninfo->desc() == desc ) | 138 | int id=sId.toInt( &bOk ); |
139 | if( !bOk ) | ||
140 | return(false); | ||
141 | TranInfo *traninfo; | ||
142 | for(traninfo=tl->first(); traninfo; traninfo=tl->next()) { | ||
143 | if( traninfo->id() == id ) | ||
120 | break; | 144 | break; |
121 | traninfo = tl->next(); | ||
122 | } | 145 | } |
123 | return( traninfo ); | 146 | return( traninfo ); |
124 | } | 147 | } |
125 | 148 | ||
126 | void CBInfo::addTransaction( TranInfo *tran ) | 149 | void CBInfo::addTransaction( TranInfo *tran ) |
127 | { | 150 | { |
128 | tl->inSort( tran ); | 151 | tl->append( tran ); |
129 | calcBalance(); | 152 | calcBalance(); |
130 | } | 153 | } |
131 | 154 | ||
132 | void CBInfo::removeTransaction( TranInfo *tran ) | 155 | void CBInfo::removeTransaction( TranInfo *tran ) |
133 | { | 156 | { |
134 | tl->remove( tran ); | 157 | tl->removeRef( tran ); |
135 | delete tran; | 158 | delete tran; |
136 | calcBalance(); | 159 | calcBalance(); |
137 | } | 160 | } |
138 | 161 | ||
162 | |||
163 | // --- loadTransactions ------------------------------------------------------- | ||
164 | // Reads the transactions. Either the old way 1-n or as linked list. | ||
139 | void CBInfo::loadTransactions() | 165 | void CBInfo::loadTransactions() |
140 | { | 166 | { |
141 | TranInfo *tran; | 167 | TranInfo *tran; |
@@ -144,24 +170,29 @@ void CBInfo::loadTransactions() | |||
144 | tl = new TranInfoList(); | 170 | tl = new TranInfoList(); |
145 | 171 | ||
146 | Config config( fn, Config::File ); | 172 | Config config( fn, Config::File ); |
147 | 173 | int i=_first; | |
148 | for ( int i = 1; trandesc != QString::null; i++ ) | 174 | bool bOld=false; |
149 | { | 175 | if( i==-1 ) { |
176 | i=1; | ||
177 | bOld=true; | ||
178 | } | ||
179 | while( i>=0 ) { | ||
180 | _last=i; | ||
150 | tran = new TranInfo( config, i ); | 181 | tran = new TranInfo( config, i ); |
151 | trandesc = tran->desc(); | 182 | trandesc = tran->desc(); |
152 | if ( trandesc != QString::null ) | 183 | if( trandesc==QString::null ) { |
153 | { | ||
154 | tl->inSort( tran ); | ||
155 | } | ||
156 | else | ||
157 | { | ||
158 | delete tran; | 184 | delete tran; |
185 | break; | ||
159 | } | 186 | } |
187 | tl->append(tran); | ||
188 | i= bOld ? i+1 : tran->getNext(); | ||
160 | } | 189 | } |
161 | 190 | ||
162 | calcBalance(); | 191 | calcBalance(); |
163 | } | 192 | } |
164 | 193 | ||
194 | |||
195 | // --- calcBalance ------------------------------------------------------------ | ||
165 | void CBInfo::calcBalance() | 196 | void CBInfo::calcBalance() |
166 | { | 197 | { |
167 | float amount; | 198 | float amount; |
@@ -180,6 +211,7 @@ void CBInfo::calcBalance() | |||
180 | } | 211 | } |
181 | } | 212 | } |
182 | 213 | ||
214 | |||
183 | int CBInfoList::compareItems( QCollection::Item item1, QCollection::Item item2 ) | 215 | int CBInfoList::compareItems( QCollection::Item item1, QCollection::Item item2 ) |
184 | { | 216 | { |
185 | QString n1 = ((CBInfo *)item1)->name(); | 217 | QString n1 = ((CBInfo *)item1)->name(); |
diff --git a/noncore/apps/checkbook/cbinfo.h b/noncore/apps/checkbook/cbinfo.h index 5e65db2..0b5b818 100644 --- a/noncore/apps/checkbook/cbinfo.h +++ b/noncore/apps/checkbook/cbinfo.h | |||
@@ -29,6 +29,7 @@ | |||
29 | #ifndef CBINFO_H | 29 | #ifndef CBINFO_H |
30 | #define CBINFO_H | 30 | #define CBINFO_H |
31 | 31 | ||
32 | #include <qwidget.h> | ||
32 | #include <qlist.h> | 33 | #include <qlist.h> |
33 | #include <qstring.h> | 34 | #include <qstring.h> |
34 | 35 | ||
@@ -63,13 +64,26 @@ class CBInfo | |||
63 | void setNotes( const QString ¬es ) { nt = notes; } | 64 | void setNotes( const QString ¬es ) { nt = notes; } |
64 | void setStartingBalance( float startbal ) { sb = startbal; } | 65 | void setStartingBalance( float startbal ) { sb = startbal; } |
65 | 66 | ||
67 | // write | ||
66 | void write(); | 68 | void write(); |
67 | 69 | ||
70 | // transactions | ||
68 | TranInfoList *transactions() const { return tl; } | 71 | TranInfoList *transactions() const { return tl; } |
69 | TranInfo *findTransaction( const QString &, const QString &, const QString & ); | 72 | TranInfo *findTransaction( const QString & ); |
70 | void addTransaction( TranInfo * ); | 73 | void addTransaction( TranInfo * ); |
71 | void removeTransaction( TranInfo * ); | 74 | void removeTransaction( TranInfo * ); |
72 | 75 | ||
76 | // lastTab | ||
77 | void setLastTab(const QString &sLastTab) { _sLastTab=sLastTab; } | ||
78 | QString &getLastTab() { return(_sLastTab); } | ||
79 | |||
80 | // getNextNumber | ||
81 | int getNextNumber() { return( ++_last ); } | ||
82 | |||
83 | // sortOrder | ||
84 | void setSortOrder(const QString &sSortOrder) { _sSortOrder=sSortOrder; } | ||
85 | QString &getSortOrder() { return(_sSortOrder); } | ||
86 | |||
73 | private: | 87 | private: |
74 | QString n; | 88 | QString n; |
75 | QString fn; | 89 | QString fn; |
@@ -81,6 +95,10 @@ class CBInfo | |||
81 | QString nt; | 95 | QString nt; |
82 | float sb; | 96 | float sb; |
83 | float b; | 97 | float b; |
98 | QString _sLastTab; | ||
99 | int _first; | ||
100 | int _last; | ||
101 | QString _sSortOrder; | ||
84 | 102 | ||
85 | TranInfoList *tl; | 103 | TranInfoList *tl; |
86 | 104 | ||
diff --git a/noncore/apps/checkbook/cfg.cpp b/noncore/apps/checkbook/cfg.cpp new file mode 100644 index 0000000..1e0ec5c --- a/dev/null +++ b/noncore/apps/checkbook/cfg.cpp | |||
@@ -0,0 +1,213 @@ | |||
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 | #include <stdio.h> | ||
30 | |||
31 | #include <qstring.h> | ||
32 | #include <qstringlist.h> | ||
33 | #include <qwidget.h> | ||
34 | #include <qpe/resource.h> | ||
35 | #include <qpe/config.h> | ||
36 | |||
37 | #include "cfg.h" | ||
38 | |||
39 | // --- Cfg -------------------------------------------------------------------- | ||
40 | Cfg::Cfg() | ||
41 | { | ||
42 | _currencySymbol="$"; | ||
43 | _showLocks=FALSE; | ||
44 | _showBalances=FALSE; | ||
45 | _pCategories=new CategoryList(); | ||
46 | } | ||
47 | |||
48 | // --- readStringList --------------------------------------------------------- | ||
49 | // Reads the entries for the control from a configuration file and returns | ||
50 | // them in a StringList. Later this list can be used to create the control. It | ||
51 | // is assumed, that the group is already set. Key is used to enumerate the | ||
52 | // entries. | ||
53 | void Cfg::readStringList(Config &cfg, const char *sKey, QStringList &lst) | ||
54 | { | ||
55 | qDebug( "%s", sKey ); | ||
56 | |||
57 | QString sEntry; | ||
58 | int iCount; | ||
59 | |||
60 | // read count of elements | ||
61 | sEntry.sprintf("%s_Count", sKey); | ||
62 | iCount=cfg.readNumEntry(sEntry, 0); | ||
63 | |||
64 | // read entries | ||
65 | for(int i=1; i<=iCount; i++) { | ||
66 | sEntry.sprintf("%s%d", sKey, i); | ||
67 | QString sType=cfg.readEntry(sEntry); | ||
68 | if( sType!=NULL ) | ||
69 | lst.append(sType); | ||
70 | } | ||
71 | } | ||
72 | |||
73 | |||
74 | // --- readConfig ------------------------------------------------------------- | ||
75 | // Reads the member data from the given config file. It will also set the group | ||
76 | // "Config" | ||
77 | void Cfg::readConfig(Config &config) | ||
78 | { | ||
79 | // set group | ||
80 | config.setGroup( "Config" ); | ||
81 | |||
82 | // read scalars | ||
83 | _currencySymbol = config.readEntry( "CurrencySymbol", "$" ); | ||
84 | _showLocks = config.readBoolEntry( "ShowLocks", FALSE ); | ||
85 | _showBalances = config.readBoolEntry( "ShowBalances", FALSE ); | ||
86 | _openLastBook = config.readBoolEntry( "OpenLastBook", FALSE ); | ||
87 | _sLastBook = config.readEntry("LastBook", ""); | ||
88 | _showLastTab = config.readBoolEntry( "ShowLastTab", FALSE ); | ||
89 | |||
90 | // Account types | ||
91 | readStringList(config, "AccType", _AccountTypes); | ||
92 | if( _AccountTypes.isEmpty() ) { | ||
93 | _AccountTypes+= (const char *)QWidget::tr("Savings"); | ||
94 | _AccountTypes+= (const char *)QWidget::tr("Checking"); | ||
95 | _AccountTypes+= (const char *)QWidget::tr("CD"); | ||
96 | _AccountTypes+= (const char *)QWidget::tr("Money market"); | ||
97 | _AccountTypes+= (const char *)QWidget::tr("Mutual fund"); | ||
98 | _AccountTypes+= (const char *)QWidget::tr("Other"); | ||
99 | writeStringList(config, "AccType", _AccountTypes); | ||
100 | config.write(); | ||
101 | } | ||
102 | |||
103 | // Read Categories | ||
104 | QStringList lst; | ||
105 | readStringList(config, "Category", lst); | ||
106 | if( lst.isEmpty() ) { | ||
107 | QString type=QWidget::tr("Expense"); | ||
108 | lst += QWidget::tr( "Automobile" )+";"+type; | ||
109 | lst += QWidget::tr( "Bills" )+";"+type; | ||
110 | lst += QWidget::tr( "CDs" )+";"+type; | ||
111 | lst += QWidget::tr( "Clothing" )+";"+type; | ||
112 | lst += QWidget::tr( "Computer" )+";"+type; | ||
113 | lst += QWidget::tr( "DVDs" )+";"+type; | ||
114 | lst += QWidget::tr( "Electronics" )+";"+type; | ||
115 | lst += QWidget::tr( "Entertainment" )+";"+type; | ||
116 | lst += QWidget::tr( "Food" )+";"+type; | ||
117 | lst += QWidget::tr( "Gasoline" )+";"+type; | ||
118 | lst += QWidget::tr( "Misc" )+";"+type; | ||
119 | lst += QWidget::tr( "Movies" )+";"+type; | ||
120 | lst += QWidget::tr( "Rent" )+";"+type; | ||
121 | lst += QWidget::tr( "Travel" )+";"+type; | ||
122 | |||
123 | type=QWidget::tr( "Income" ); | ||
124 | lst += QWidget::tr( "Work" )+";"+type; | ||
125 | lst += QWidget::tr( "Family Member" )+";"+type; | ||
126 | lst += QWidget::tr( "Misc. Credit" )+";"+type; | ||
127 | |||
128 | setCategories(lst); | ||
129 | writeStringList(config, "Category", lst); | ||
130 | config.write(); | ||
131 | } else { | ||
132 | setCategories(lst); | ||
133 | } | ||
134 | } | ||
135 | |||
136 | |||
137 | // --- writeStringList -------------------------------------------------------- | ||
138 | // Writes the entries in the control in a configuration file. It is assumed, | ||
139 | // that the group is already set. Key is used to enumerate the entries | ||
140 | void Cfg::writeStringList(Config &cfg, const char *sKey, QStringList &lst) | ||
141 | { | ||
142 | QString sEntry; | ||
143 | int iCount=0; | ||
144 | QStringList::Iterator itr; | ||
145 | for(itr=lst.begin(); itr!=lst.end(); itr++) { | ||
146 | sEntry.sprintf("%s%d", sKey, ++iCount); | ||
147 | cfg.writeEntry(sEntry, *itr ); | ||
148 | } | ||
149 | sEntry.sprintf("%s_Count", sKey); | ||
150 | cfg.writeEntry(sEntry, iCount); | ||
151 | } | ||
152 | |||
153 | |||
154 | // --- writeConfig ----------------------------------------------------------- | ||
155 | // Writes all config data back to the config file. The group will be set to | ||
156 | // "Config" and the write be commited | ||
157 | void Cfg::writeConfig(Config &config) | ||
158 | { | ||
159 | // set the group | ||
160 | config.setGroup( "Config" ); | ||
161 | |||
162 | // write scalars | ||
163 | config.writeEntry( "CurrencySymbol", _currencySymbol ); | ||
164 | config.writeEntry( "ShowLocks", _showLocks ); | ||
165 | config.writeEntry( "ShowBalances", _showBalances ); | ||
166 | config.writeEntry( "OpenLastBook", _openLastBook ); | ||
167 | config.writeEntry( "LastBook", _sLastBook ); | ||
168 | config.writeEntry( "ShowLastTab", _showLastTab ); | ||
169 | |||
170 | // write account types | ||
171 | writeStringList(config, "AccType", _AccountTypes); | ||
172 | |||
173 | // write categories | ||
174 | QStringList lst=getCategories(); | ||
175 | writeStringList(config, "Category", lst ); | ||
176 | |||
177 | // commit write | ||
178 | config.write(); | ||
179 | } | ||
180 | |||
181 | |||
182 | // --- getCategories ---------------------------------------------------------- | ||
183 | QStringList Cfg::getCategories() | ||
184 | { | ||
185 | QStringList ret; | ||
186 | for(Category *itr=_pCategories->first(); itr; itr=_pCategories->next() ) { | ||
187 | QString sEntry; | ||
188 | sEntry.sprintf("%s;%s", (const char *)itr->getName(), (const char *)(itr->isIncome() ? QWidget::tr("Income") : QWidget::tr("Expense")) ); | ||
189 | ret.append(sEntry); | ||
190 | } | ||
191 | return(ret); | ||
192 | } | ||
193 | |||
194 | |||
195 | // --- setCategories ---------------------------------------------------------- | ||
196 | void Cfg::setCategories(QStringList &lst) | ||
197 | { | ||
198 | _pCategories->clear(); | ||
199 | QStringList::Iterator itr; | ||
200 | for(itr=lst.begin(); itr!=lst.end(); itr++) { | ||
201 | QStringList split=QStringList::split(";", *itr, true); | ||
202 | if( split.count()<2 ) continue; | ||
203 | bool bIncome= (split[1]==QWidget::tr("Income")); | ||
204 | _pCategories->append( new Category(split[0], bIncome) ); | ||
205 | } | ||
206 | } | ||
207 | |||
208 | |||
209 | // --- CategoryList ------------------------------------------------------------ | ||
210 | CategoryList::CategoryList() : QList<Category>() | ||
211 | { | ||
212 | setAutoDelete(true); | ||
213 | } | ||
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> | ||
35 | class Config; | ||
36 | |||
37 | // --- Category --------------------------------------------------------------- | ||
38 | class 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 | |||
55 | class CategoryList : public QList<Category> | ||
56 | { | ||
57 | public: | ||
58 | // --- Constructor | ||
59 | CategoryList(); | ||
60 | }; | ||
61 | |||
62 | |||
63 | // --- Cfg -------------------------------------------------------------------- | ||
64 | class 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 | ||
diff --git a/noncore/apps/checkbook/checkbook.cpp b/noncore/apps/checkbook/checkbook.cpp index 653ee4a..c53e889 100644 --- a/noncore/apps/checkbook/checkbook.cpp +++ b/noncore/apps/checkbook/checkbook.cpp | |||
@@ -33,6 +33,8 @@ | |||
33 | #include "graph.h" | 33 | #include "graph.h" |
34 | #include "graphinfo.h" | 34 | #include "graphinfo.h" |
35 | #include "password.h" | 35 | #include "password.h" |
36 | #include "mainwindow.h" | ||
37 | #include "cfg.h" | ||
36 | 38 | ||
37 | #include <opie/otabwidget.h> | 39 | #include <opie/otabwidget.h> |
38 | #include <qpe/qpeapplication.h> | 40 | #include <qpe/qpeapplication.h> |
@@ -48,12 +50,21 @@ | |||
48 | #include <qpushbutton.h> | 50 | #include <qpushbutton.h> |
49 | #include <qwhatsthis.h> | 51 | #include <qwhatsthis.h> |
50 | 52 | ||
51 | Checkbook::Checkbook( QWidget *parent, CBInfo *i, const QString &symbol ) | 53 | #define COL_ID 0 |
54 | #define COL_NUM 1 | ||
55 | #define COL_DATE 2 | ||
56 | #define COL_DESC 3 | ||
57 | #define COL_AMOUNT 4 | ||
58 | #define COL_BAL 5 | ||
59 | |||
60 | // --- Checkbook -------------------------------------------------------------- | ||
61 | Checkbook::Checkbook( QWidget *parent, CBInfo *i, Cfg *cfg ) | ||
52 | : QDialog( parent, 0, TRUE, WStyle_ContextHelp ) | 62 | : QDialog( parent, 0, TRUE, WStyle_ContextHelp ) |
53 | { | 63 | { |
54 | info = i; | 64 | info = i; |
55 | currencySymbol = symbol; | 65 | _pCfg=cfg; |
56 | 66 | ||
67 | // Title bar | ||
57 | if ( info->name() != "" ) | 68 | if ( info->name() != "" ) |
58 | { | 69 | { |
59 | QString tempstr = info->name(); | 70 | QString tempstr = info->name(); |
@@ -66,6 +77,7 @@ Checkbook::Checkbook( QWidget *parent, CBInfo *i, const QString &symbol ) | |||
66 | setCaption( tr( "New checkbook" ) ); | 77 | setCaption( tr( "New checkbook" ) ); |
67 | } | 78 | } |
68 | 79 | ||
80 | |||
69 | // Setup layout to make everything pretty | 81 | // Setup layout to make everything pretty |
70 | QVBoxLayout *layout = new QVBoxLayout( this ); | 82 | QVBoxLayout *layout = new QVBoxLayout( this ); |
71 | layout->setMargin( 2 ); | 83 | layout->setMargin( 2 ); |
@@ -74,11 +86,14 @@ Checkbook::Checkbook( QWidget *parent, CBInfo *i, const QString &symbol ) | |||
74 | // Setup tabs for all info | 86 | // Setup tabs for all info |
75 | mainWidget = new OTabWidget( this ); | 87 | mainWidget = new OTabWidget( this ); |
76 | layout->addWidget( mainWidget ); | 88 | layout->addWidget( mainWidget ); |
77 | |||
78 | mainWidget->addTab( initInfo(), "checkbook/infotab", tr( "Info" ) ); | 89 | mainWidget->addTab( initInfo(), "checkbook/infotab", tr( "Info" ) ); |
79 | mainWidget->addTab( initTransactions(), "checkbook/trantab", tr( "Transactions" ) ); | 90 | mainWidget->addTab( initTransactions(), "checkbook/trantab", tr( "Transactions" ) ); |
80 | mainWidget->addTab( initCharts(), "checkbook/charttab", tr( "Charts" ) ); | 91 | mainWidget->addTab( initCharts(), "checkbook/charttab", tr( "Charts" ) ); |
92 | if( _pCfg->isShowLastTab() ) | ||
93 | mainWidget->setCurrentTab( info->getLastTab() ); | ||
94 | else | ||
81 | mainWidget->setCurrentTab( tr( "Info" ) ); | 95 | mainWidget->setCurrentTab( tr( "Info" ) ); |
96 | connect( mainWidget, SIGNAL( currentChanged(QWidget *) ), this, SLOT( slotTab(QWidget *) ) ); | ||
82 | 97 | ||
83 | // Load checkbook information | 98 | // Load checkbook information |
84 | loadCheckbook(); | 99 | loadCheckbook(); |
@@ -88,9 +103,10 @@ Checkbook::~Checkbook() | |||
88 | { | 103 | { |
89 | } | 104 | } |
90 | 105 | ||
106 | // --- initInfo --------------------------------------------------------------- | ||
91 | QWidget *Checkbook::initInfo() | 107 | QWidget *Checkbook::initInfo() |
92 | { | 108 | { |
93 | QWidget *control = new QWidget( mainWidget ); | 109 | QWidget *control = new QWidget( mainWidget, tr("Info") ); |
94 | 110 | ||
95 | QVBoxLayout *vb = new QVBoxLayout( control ); | 111 | QVBoxLayout *vb = new QVBoxLayout( control ); |
96 | 112 | ||
@@ -128,12 +144,7 @@ QWidget *Checkbook::initInfo() | |||
128 | layout->addWidget( label, 2, 0 ); | 144 | layout->addWidget( label, 2, 0 ); |
129 | typeList = new QComboBox( container ); | 145 | typeList = new QComboBox( container ); |
130 | QWhatsThis::add( typeList, tr( "Select type of checkbook here." ) ); | 146 | QWhatsThis::add( typeList, tr( "Select type of checkbook here." ) ); |
131 | typeList->insertItem( tr( "Savings" ) ); // 0 | 147 | typeList->insertStringList( _pCfg->getAccountTypes() ); |
132 | typeList->insertItem( tr( "Checking" ) ); // 1 | ||
133 | typeList->insertItem( tr( "CD" ) ); // 2 | ||
134 | typeList->insertItem( tr( "Money market" ) );// 3 | ||
135 | typeList->insertItem( tr( "Mutual fund" ) );// 4 | ||
136 | typeList->insertItem( tr( "Other" ) ); // 5 | ||
137 | layout->addWidget( typeList, 2, 1 ); | 148 | layout->addWidget( typeList, 2, 1 ); |
138 | 149 | ||
139 | // Bank/institution name | 150 | // Bank/institution name |
@@ -183,34 +194,53 @@ QWidget *Checkbook::initInfo() | |||
183 | return control; | 194 | return control; |
184 | } | 195 | } |
185 | 196 | ||
197 | |||
198 | // --- initTransactions ------------------------------------------------------- | ||
186 | QWidget *Checkbook::initTransactions() | 199 | QWidget *Checkbook::initTransactions() |
187 | { | 200 | { |
188 | QWidget *control = new QWidget( mainWidget ); | 201 | QWidget *control = new QWidget( mainWidget, tr("Transactions") ); |
189 | 202 | ||
190 | QGridLayout *layout = new QGridLayout( control ); | 203 | QGridLayout *layout = new QGridLayout( control ); |
191 | layout->setSpacing( 2 ); | 204 | layout->setSpacing( 2 ); |
192 | layout->setMargin( 4 ); | 205 | layout->setMargin( 4 ); |
193 | 206 | ||
194 | balanceLabel = new QLabel( tr( "Current balance: %10.00" ).arg( currencySymbol ), | 207 | // Sort selector |
195 | control ); | 208 | QLabel *label = new QLabel( tr( "Sort by:" ), control ); |
196 | QWhatsThis::add( balanceLabel, tr( "This area shows the current balance in this checkbook." ) ); | 209 | QWhatsThis::add( label, tr( "Select checkbook sorting here." ) ); |
197 | layout->addMultiCellWidget( balanceLabel, 0, 0, 0, 2 ); | 210 | layout->addMultiCellWidget( label, 0, 0, 0, 1 ); |
198 | 211 | _cbSortType=new QComboBox( control ); | |
212 | _cbSortType->insertItem( tr("Entry Order") ); | ||
213 | _cbSortType->insertItem( tr("Date") ); | ||
214 | _cbSortType->insertItem( tr("Number") ); | ||
215 | layout->addMultiCellWidget( _cbSortType, 0, 0, 1, 2 ); | ||
216 | connect( _cbSortType, SIGNAL( activated(const QString &) ), this, SLOT( slotSortChanged( const QString & ) ) ); | ||
217 | |||
218 | // Table | ||
199 | tranTable = new QListView( control ); | 219 | tranTable = new QListView( control ); |
220 | QFont fnt(QPEApplication::font()); | ||
221 | fnt.setPointSize( fnt.pointSize()-1 ); | ||
222 | tranTable->setFont( fnt ); | ||
200 | 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." ) ); | 223 | 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." ) ); |
224 | tranTable->addColumn( tr( "Id" ) ); | ||
225 | tranTable->setColumnWidthMode( COL_ID, QListView::Manual ); | ||
226 | tranTable->setColumnWidth( COL_ID, 0); | ||
201 | tranTable->addColumn( tr( "Num" ) ); | 227 | tranTable->addColumn( tr( "Num" ) ); |
202 | tranTable->addColumn( tr( "Date" ) ); | 228 | tranTable->addColumn( tr( "Date" ) ); |
203 | //tranTable->addColumn( tr( "Cleared" ) ); | 229 | //tranTable->addColumn( tr( "Cleared" ) ); |
204 | tranTable->addColumn( tr( "Description" ) ); | 230 | tranTable->addColumn( tr( "Description" ) ); |
205 | int colnum = tranTable->addColumn( tr( "Amount" ) ); | 231 | int column = tranTable->addColumn( tr( "Amount" ) ); |
206 | tranTable->setColumnAlignment( colnum, Qt::AlignRight ); | 232 | tranTable->setColumnAlignment( column, Qt::AlignRight ); |
233 | column=tranTable->addColumn( tr("Balance") ); | ||
234 | tranTable->setColumnAlignment( column, Qt::AlignRight ); | ||
207 | tranTable->setAllColumnsShowFocus( TRUE ); | 235 | tranTable->setAllColumnsShowFocus( TRUE ); |
208 | tranTable->setSorting( 1 ); | 236 | tranTable->setSorting( -1 ); |
209 | layout->addMultiCellWidget( tranTable, 1, 1, 0, 2 ); | 237 | layout->addMultiCellWidget( tranTable, 1, 1, 0, 2 ); |
210 | QPEApplication::setStylusOperation( tranTable->viewport(), QPEApplication::RightOnHold ); | 238 | QPEApplication::setStylusOperation( tranTable->viewport(), QPEApplication::RightOnHold ); |
211 | connect( tranTable, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint &, int ) ), | 239 | connect( tranTable, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint &, int ) ), |
212 | this, SLOT( slotEditTran() ) ); | 240 | this, SLOT( slotEditTran() ) ); |
241 | _sortCol=COL_ID; | ||
213 | 242 | ||
243 | // Buttons | ||
214 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), control ); | 244 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), control ); |
215 | QWhatsThis::add( btn, tr( "Click here to add a new transaction." ) ); | 245 | QWhatsThis::add( btn, tr( "Click here to add a new transaction." ) ); |
216 | connect( btn, SIGNAL( clicked() ), this, SLOT( slotNewTran() ) ); | 246 | connect( btn, SIGNAL( clicked() ), this, SLOT( slotNewTran() ) ); |
@@ -229,11 +259,13 @@ QWidget *Checkbook::initTransactions() | |||
229 | return( control ); | 259 | return( control ); |
230 | } | 260 | } |
231 | 261 | ||
262 | |||
263 | // --- initCharts ------------------------------------------------------------- | ||
232 | QWidget *Checkbook::initCharts() | 264 | QWidget *Checkbook::initCharts() |
233 | { | 265 | { |
234 | graphInfo = 0x0; | 266 | graphInfo = 0x0; |
235 | 267 | ||
236 | QWidget *control = new QWidget( mainWidget ); | 268 | QWidget *control = new QWidget( mainWidget, tr("Charts") ); |
237 | 269 | ||
238 | QGridLayout *layout = new QGridLayout( control ); | 270 | QGridLayout *layout = new QGridLayout( control ); |
239 | layout->setSpacing( 2 ); | 271 | layout->setSpacing( 2 ); |
@@ -259,6 +291,7 @@ QWidget *Checkbook::initCharts() | |||
259 | return control; | 291 | return control; |
260 | } | 292 | } |
261 | 293 | ||
294 | // --- loadCheckbook ---------------------------------------------------------- | ||
262 | void Checkbook::loadCheckbook() | 295 | void Checkbook::loadCheckbook() |
263 | { | 296 | { |
264 | if ( !info ) | 297 | if ( !info ) |
@@ -281,6 +314,10 @@ void Checkbook::loadCheckbook() | |||
281 | break; | 314 | break; |
282 | } | 315 | } |
283 | } | 316 | } |
317 | if( i<=0 ) { | ||
318 | typeList->insertItem( temptext, 0 ); | ||
319 | typeList->setCurrentItem(0); | ||
320 | } | ||
284 | bankEdit->setText( info->bank() ); | 321 | bankEdit->setText( info->bank() ); |
285 | acctNumEdit->setText( info->account() ); | 322 | acctNumEdit->setText( info->account() ); |
286 | pinNumEdit->setText( info->pin() ); | 323 | pinNumEdit->setText( info->pin() ); |
@@ -291,7 +328,6 @@ void Checkbook::loadCheckbook() | |||
291 | // Load transactions | 328 | // Load transactions |
292 | float amount; | 329 | float amount; |
293 | QString stramount; | 330 | QString stramount; |
294 | |||
295 | for ( TranInfo *tran = tranList->first(); tran; tran = tranList->next() ) | 331 | for ( TranInfo *tran = tranList->first(); tran; tran = tranList->next() ) |
296 | { | 332 | { |
297 | amount = tran->amount(); | 333 | amount = tran->amount(); |
@@ -299,33 +335,53 @@ void Checkbook::loadCheckbook() | |||
299 | { | 335 | { |
300 | amount *= -1; | 336 | amount *= -1; |
301 | } | 337 | } |
302 | stramount.sprintf( "%s%.2f", currencySymbol.latin1(), amount ); | 338 | stramount.sprintf( "%s%.2f", _pCfg->getCurrencySymbol().latin1(), amount ); |
303 | ( void ) new CBListItem( tranTable, tran->number(), tran->datestr(), tran->desc(), stramount ); | 339 | ( void ) new CBListItem( tran, tranTable, tran->getIdStr(), tran->number(), tran->datestr(), tran->desc(), stramount ); |
304 | } | 340 | } |
305 | 341 | ||
306 | balanceLabel->setText( tr( "Current balance: %1%2" ).arg( currencySymbol ).arg( info->balance(), 0, 'f', 2 ) ); | 342 | // set sort order |
343 | bool bOk=false; | ||
344 | for(int i=0; i<_cbSortType->count(); i++) { | ||
345 | if( _cbSortType->text(i)==info->getSortOrder() ) { | ||
346 | _cbSortType->setCurrentItem(i); | ||
347 | slotSortChanged( info->getSortOrder() ); | ||
348 | bOk=true; | ||
349 | break; | ||
350 | } | ||
351 | } | ||
352 | if( !bOk ) { | ||
353 | _cbSortType->setCurrentItem(0); | ||
354 | slotSortChanged( _cbSortType->currentText() ); | ||
355 | } | ||
307 | 356 | ||
308 | highTranNum = tranList->count(); | 357 | // calc running balance |
358 | adjustBalance(); | ||
309 | } | 359 | } |
310 | 360 | ||
361 | // --- adjustBalance ---------------------------------------------------------- | ||
311 | void Checkbook::adjustBalance() | 362 | void Checkbook::adjustBalance() |
312 | { | 363 | { |
313 | balanceLabel->setText( tr( "Current balance: %1%2" ).arg( currencySymbol ).arg( info->balance(), 0, 'f', 2 ) ); | 364 | // update running balance in register |
365 | QString sRunning; | ||
366 | float bal=info->startingBalance(); | ||
367 | for(CBListItem *item=(CBListItem *)tranTable->firstChild(); item; item=(CBListItem *)item->nextSibling() ) { | ||
368 | TranInfo *tran=item->getTranInfo(); | ||
369 | bal=bal + (tran->withdrawal() ? -1 : 1)*tran->amount() - tran->fee(); | ||
370 | sRunning.sprintf( "%s%.2f", _pCfg->getCurrencySymbol().latin1(), bal ); | ||
371 | item->setText( COL_BAL, sRunning); | ||
372 | } | ||
314 | } | 373 | } |
315 | 374 | ||
316 | TranInfo *Checkbook::findTran( const QString &checknum, const QString &date, const QString &desc ) | 375 | // --- resort ----------------------------------------------------------------- |
317 | { | 376 | void Checkbook::resort() |
318 | TranInfo *traninfo = tranList->first(); | ||
319 | while ( traninfo ) | ||
320 | { | 377 | { |
321 | if ( traninfo->number() == checknum && traninfo->datestr() == date && | 378 | tranTable->setSorting(_sortCol); |
322 | traninfo->desc() == desc ) | 379 | tranTable->sort(); |
323 | break; | 380 | tranTable->setSorting(-1); |
324 | traninfo = tranList->next(); | ||
325 | } | ||
326 | return( traninfo ); | ||
327 | } | 381 | } |
328 | 382 | ||
383 | |||
384 | // --- accept ----------------------------------------------------------------- | ||
329 | void Checkbook::accept() | 385 | void Checkbook::accept() |
330 | { | 386 | { |
331 | info->setName( nameEdit->text() ); | 387 | info->setName( nameEdit->text() ); |
@@ -398,6 +454,8 @@ void Checkbook::slotNameChanged( const QString &newname ) | |||
398 | setCaption( namestr ); | 454 | setCaption( namestr ); |
399 | } | 455 | } |
400 | 456 | ||
457 | |||
458 | // ---slotStartingBalanceChanged ---------------------------------------------- | ||
401 | void Checkbook::slotStartingBalanceChanged( const QString &newbalance ) | 459 | void Checkbook::slotStartingBalanceChanged( const QString &newbalance ) |
402 | { | 460 | { |
403 | bool ok; | 461 | bool ok; |
@@ -405,14 +463,16 @@ void Checkbook::slotStartingBalanceChanged( const QString &newbalance ) | |||
405 | adjustBalance(); | 463 | adjustBalance(); |
406 | } | 464 | } |
407 | 465 | ||
466 | |||
408 | void Checkbook::slotNewTran() | 467 | void Checkbook::slotNewTran() |
409 | { | 468 | { |
410 | highTranNum++; | 469 | TranInfo *traninfo = new TranInfo( info->getNextNumber() ); |
411 | TranInfo *traninfo = new TranInfo( highTranNum ); | 470 | if( !_dLastNew.isNull() ) |
471 | traninfo->setDate(_dLastNew); | ||
412 | 472 | ||
413 | Transaction *currtran = new Transaction( this, info->name(), | 473 | Transaction *currtran = new Transaction( this, info->name(), |
414 | traninfo, | 474 | traninfo, |
415 | currencySymbol ); | 475 | _pCfg ); |
416 | currtran->showMaximized(); | 476 | currtran->showMaximized(); |
417 | if ( currtran->exec() == QDialog::Accepted ) | 477 | if ( currtran->exec() == QDialog::Accepted ) |
418 | { | 478 | { |
@@ -422,22 +482,19 @@ void Checkbook::slotNewTran() | |||
422 | // Add to transaction table | 482 | // Add to transaction table |
423 | float amount; | 483 | float amount; |
424 | QString stramount; | 484 | QString stramount; |
425 | 485 | amount = (traninfo->withdrawal() ? -1 : 1)*traninfo->amount(); | |
426 | amount = traninfo->amount(); | 486 | stramount.sprintf( "%s%.2f", _pCfg->getCurrencySymbol().latin1(), amount ); |
427 | if ( traninfo->withdrawal() ) | 487 | ( void ) new CBListItem( traninfo, tranTable, traninfo->getIdStr(), |
428 | { | 488 | traninfo->number(), traninfo->datestr(), traninfo->desc(), |
429 | amount *= -1; | ||
430 | } | ||
431 | stramount.sprintf( "%s%.2f", currencySymbol.latin1(), amount ); | ||
432 | |||
433 | ( void ) new CBListItem( tranTable, traninfo->number(), traninfo->datestr(), traninfo->desc(), | ||
434 | stramount ); | 489 | stramount ); |
435 | 490 | resort(); | |
436 | adjustBalance(); | 491 | adjustBalance(); |
492 | |||
493 | // save last date | ||
494 | _dLastNew = traninfo->date(); | ||
437 | } | 495 | } |
438 | else | 496 | else |
439 | { | 497 | { |
440 | highTranNum--; | ||
441 | delete traninfo; | 498 | delete traninfo; |
442 | } | 499 | } |
443 | } | 500 | } |
@@ -446,22 +503,19 @@ void Checkbook::slotEditTran() | |||
446 | { | 503 | { |
447 | QListViewItem *curritem = tranTable->currentItem(); | 504 | QListViewItem *curritem = tranTable->currentItem(); |
448 | if ( !curritem ) | 505 | if ( !curritem ) |
449 | { | ||
450 | return; | 506 | return; |
451 | } | ||
452 | 507 | ||
453 | TranInfo *traninfo = info->findTransaction( curritem->text( 0 ), curritem->text( 1 ), | 508 | TranInfo *traninfo=info->findTransaction( curritem->text(COL_ID) ); |
454 | curritem->text( 2 ) ); | ||
455 | 509 | ||
456 | Transaction *currtran = new Transaction( this, info->name(), | 510 | Transaction *currtran = new Transaction( this, info->name(), |
457 | traninfo, | 511 | traninfo, |
458 | currencySymbol ); | 512 | _pCfg ); |
459 | currtran->showMaximized(); | 513 | currtran->showMaximized(); |
460 | if ( currtran->exec() == QDialog::Accepted ) | 514 | if ( currtran->exec() == QDialog::Accepted ) |
461 | { | 515 | { |
462 | curritem->setText( 0, traninfo->number() ); | 516 | curritem->setText( COL_NUM, traninfo->number() ); |
463 | curritem->setText( 1, traninfo->datestr() ); | 517 | curritem->setText( COL_DATE, traninfo->datestr() ); |
464 | curritem->setText( 2, traninfo->desc() ); | 518 | curritem->setText( COL_DESC, traninfo->desc() ); |
465 | 519 | ||
466 | float amount = traninfo->amount(); | 520 | float amount = traninfo->amount(); |
467 | if ( traninfo->withdrawal() ) | 521 | if ( traninfo->withdrawal() ) |
@@ -469,9 +523,9 @@ void Checkbook::slotEditTran() | |||
469 | amount *= -1; | 523 | amount *= -1; |
470 | } | 524 | } |
471 | QString stramount; | 525 | QString stramount; |
472 | stramount.sprintf( "%s%.2f", currencySymbol.latin1(), amount ); | 526 | stramount.sprintf( "%s%.2f", _pCfg->getCurrencySymbol().latin1(), amount ); |
473 | curritem->setText( 3, stramount ); | 527 | curritem->setText( COL_AMOUNT, stramount ); |
474 | 528 | resort(); | |
475 | adjustBalance(); | 529 | adjustBalance(); |
476 | } | 530 | } |
477 | 531 | ||
@@ -482,11 +536,9 @@ void Checkbook::slotDeleteTran() | |||
482 | { | 536 | { |
483 | QListViewItem *curritem = tranTable->currentItem(); | 537 | QListViewItem *curritem = tranTable->currentItem(); |
484 | if ( !curritem ) | 538 | if ( !curritem ) |
485 | { | ||
486 | return; | 539 | return; |
487 | } | ||
488 | 540 | ||
489 | TranInfo *traninfo = findTran( curritem->text( 0 ), curritem->text( 1 ), curritem->text( 2 ) ); | 541 | TranInfo *traninfo = info->findTransaction( curritem->text(COL_ID) ); |
490 | 542 | ||
491 | if ( QPEMessageBox::confirmDelete ( this, tr( "Delete transaction" ), traninfo->desc() ) ) | 543 | if ( QPEMessageBox::confirmDelete ( this, tr( "Delete transaction" ), traninfo->desc() ) ) |
492 | { | 544 | { |
@@ -589,11 +641,12 @@ void Checkbook::drawCategoryChart( bool withdrawals ) | |||
589 | graphInfo = new GraphInfo( GraphInfo::PieChart, list ); | 641 | graphInfo = new GraphInfo( GraphInfo::PieChart, list ); |
590 | } | 642 | } |
591 | 643 | ||
592 | CBListItem::CBListItem( QListView *parent, QString label1, QString label2, | 644 | CBListItem::CBListItem( TranInfo *pTran, QListView *parent, QString label1, QString label2, |
593 | QString label3, QString label4, QString label5, QString label6, QString label7, | 645 | QString label3, QString label4, QString label5, QString label6, QString label7, |
594 | QString label8 ) | 646 | QString label8 ) |
595 | : QListViewItem( parent, label1, label2, label3, label4, label5, label6, label7, label8 ) | 647 | : QListViewItem( parent, label1, label2, label3, label4, label5, label6, label7, label8 ) |
596 | { | 648 | { |
649 | _pTran=pTran; | ||
597 | m_known = FALSE; | 650 | m_known = FALSE; |
598 | owner = parent; | 651 | owner = parent; |
599 | } | 652 | } |
@@ -652,3 +705,26 @@ bool CBListItem::isAltBackground() | |||
652 | } | 705 | } |
653 | return false; | 706 | return false; |
654 | } | 707 | } |
708 | |||
709 | |||
710 | // --- slotTab ---------------------------------------------------------------- | ||
711 | void Checkbook::slotTab(QWidget *tab) | ||
712 | { | ||
713 | if( !tab || !info ) return; | ||
714 | info->setLastTab( tab->name() ); | ||
715 | } | ||
716 | |||
717 | |||
718 | // --- slotSortChanged --------------------------------------------------------- | ||
719 | void Checkbook::slotSortChanged( const QString &selc ) | ||
720 | { | ||
721 | if( selc==tr("Entry Order") ) { | ||
722 | _sortCol=COL_ID; | ||
723 | } else if( selc==tr("Number") ) { | ||
724 | _sortCol=COL_NUM; | ||
725 | } else if( selc==tr("Date") ) { | ||
726 | _sortCol=COL_DATE; | ||
727 | } | ||
728 | info->setSortOrder( selc ); | ||
729 | resort(); | ||
730 | } | ||
diff --git a/noncore/apps/checkbook/checkbook.h b/noncore/apps/checkbook/checkbook.h index 4a5011b..1b6a2d3 100644 --- a/noncore/apps/checkbook/checkbook.h +++ b/noncore/apps/checkbook/checkbook.h | |||
@@ -29,6 +29,7 @@ | |||
29 | #ifndef CHECKBOOK_H | 29 | #ifndef CHECKBOOK_H |
30 | #define CHECKBOOK_H | 30 | #define CHECKBOOK_H |
31 | 31 | ||
32 | #include <qdatetime.h> | ||
32 | #include <qdialog.h> | 33 | #include <qdialog.h> |
33 | #include <qlistview.h> | 34 | #include <qlistview.h> |
34 | 35 | ||
@@ -46,25 +47,29 @@ class QMultiLineEdit; | |||
46 | class QString; | 47 | class QString; |
47 | class TranInfo; | 48 | class TranInfo; |
48 | class TranInfoList; | 49 | class TranInfoList; |
50 | class Cfg; | ||
49 | 51 | ||
52 | |||
53 | // --- Checkbook -------------------------------------------------------------- | ||
50 | class Checkbook : public QDialog | 54 | class Checkbook : public QDialog |
51 | { | 55 | { |
52 | Q_OBJECT | 56 | Q_OBJECT |
53 | 57 | ||
54 | public: | 58 | public: |
55 | Checkbook( QWidget * = 0x0, CBInfo * = 0x0, const QString & = "$" ); | 59 | Checkbook( QWidget *, CBInfo *, Cfg *cfg ); |
56 | ~Checkbook(); | 60 | ~Checkbook(); |
57 | 61 | ||
62 | // resort | ||
63 | void resort(); | ||
64 | |||
58 | private: | 65 | private: |
59 | CBInfo *info; | 66 | CBInfo *info; |
60 | TranInfoList *tranList; | 67 | TranInfoList *tranList; |
61 | QString currencySymbol; | 68 | Cfg *_pCfg; |
62 | int highTranNum; | ||
63 | 69 | ||
64 | OTabWidget *mainWidget; | 70 | OTabWidget *mainWidget; |
65 | void loadCheckbook(); | 71 | void loadCheckbook(); |
66 | void adjustBalance(); | 72 | void adjustBalance(); |
67 | TranInfo *findTran( const QString &, const QString &, const QString & ); | ||
68 | 73 | ||
69 | // Info tab | 74 | // Info tab |
70 | QWidget *initInfo(); | 75 | QWidget *initInfo(); |
@@ -76,11 +81,13 @@ class Checkbook : public QDialog | |||
76 | QLineEdit *pinNumEdit; | 81 | QLineEdit *pinNumEdit; |
77 | QLineEdit *balanceEdit; | 82 | QLineEdit *balanceEdit; |
78 | QMultiLineEdit *notesEdit; | 83 | QMultiLineEdit *notesEdit; |
84 | int _sortCol; | ||
79 | 85 | ||
80 | // Transactions tab | 86 | // Transactions tab |
81 | QWidget *initTransactions(); | 87 | QWidget *initTransactions(); |
82 | QListView *tranTable; | 88 | QListView *tranTable; |
83 | QLabel *balanceLabel; | 89 | QComboBox *_cbSortType; |
90 | QDate _dLastNew; | ||
84 | 91 | ||
85 | // Charts tab | 92 | // Charts tab |
86 | QWidget *initCharts(); | 93 | QWidget *initCharts(); |
@@ -91,8 +98,10 @@ class Checkbook : public QDialog | |||
91 | void drawBalanceChart(); | 98 | void drawBalanceChart(); |
92 | void drawCategoryChart( bool = TRUE ); | 99 | void drawCategoryChart( bool = TRUE ); |
93 | 100 | ||
101 | |||
94 | protected slots: | 102 | protected slots: |
95 | void accept(); | 103 | void accept(); |
104 | void slotTab(QWidget *tab); | ||
96 | 105 | ||
97 | private slots: | 106 | private slots: |
98 | void slotPasswordClicked(); | 107 | void slotPasswordClicked(); |
@@ -102,20 +111,26 @@ class Checkbook : public QDialog | |||
102 | void slotEditTran(); | 111 | void slotEditTran(); |
103 | void slotDeleteTran(); | 112 | void slotDeleteTran(); |
104 | void slotDrawGraph(); | 113 | void slotDrawGraph(); |
114 | void slotSortChanged( const QString & ); | ||
105 | }; | 115 | }; |
106 | 116 | ||
117 | // --- CBListItem ------------------------------------------------------------- | ||
107 | class CBListItem : public QListViewItem | 118 | class CBListItem : public QListViewItem |
108 | { | 119 | { |
109 | //Q_OBJECT | 120 | //Q_OBJECT |
110 | 121 | ||
111 | public: | 122 | public: |
112 | CBListItem( QListView *, QString = QString::null, QString = QString::null, | 123 | CBListItem( TranInfo *, QListView *, QString = QString::null, QString = QString::null, |
113 | QString = QString::null, QString = QString::null, QString = QString::null, | 124 | QString = QString::null, QString = QString::null, QString = QString::null, |
114 | QString = QString::null, QString = QString::null, QString = QString::null ); | 125 | QString = QString::null, QString = QString::null, QString = QString::null ); |
115 | 126 | ||
116 | void paintCell( QPainter *, const QColorGroup &, int, int, int ); | 127 | void paintCell( QPainter *, const QColorGroup &, int, int, int ); |
117 | 128 | ||
129 | // --- members | ||
130 | TranInfo *getTranInfo() { return(_pTran); } | ||
131 | |||
118 | private: | 132 | private: |
133 | TranInfo *_pTran; | ||
119 | QListView *owner; | 134 | QListView *owner; |
120 | bool m_known; | 135 | bool m_known; |
121 | bool m_odd; | 136 | bool m_odd; |
@@ -123,4 +138,5 @@ class CBListItem : public QListViewItem | |||
123 | bool isAltBackground(); | 138 | bool isAltBackground(); |
124 | }; | 139 | }; |
125 | 140 | ||
141 | |||
126 | #endif | 142 | #endif |
diff --git a/noncore/apps/checkbook/checkbook.pro b/noncore/apps/checkbook/checkbook.pro index 9a16a56..c574aff 100644 --- a/noncore/apps/checkbook/checkbook.pro +++ b/noncore/apps/checkbook/checkbook.pro | |||
@@ -1,5 +1,4 @@ | |||
1 | TEMPLATE = app | 1 | CONFIG = qt warn_on release quick-app |
2 | CONFIG = qt warn_on release | ||
3 | HEADERS = mainwindow.h \ | 2 | HEADERS = mainwindow.h \ |
4 | cbinfo.h \ | 3 | cbinfo.h \ |
5 | traninfo.h \ | 4 | traninfo.h \ |
@@ -8,6 +7,9 @@ HEADERS = mainwindow.h \ | |||
8 | password.h \ | 7 | password.h \ |
9 | checkbook.h \ | 8 | checkbook.h \ |
10 | transaction.h \ | 9 | transaction.h \ |
10 | tabledef.h \ | ||
11 | listedit.h \ | ||
12 | cfg.h \ | ||
11 | graph.h | 13 | graph.h |
12 | SOURCES = main.cpp \ | 14 | SOURCES = main.cpp \ |
13 | mainwindow.cpp \ | 15 | mainwindow.cpp \ |
@@ -18,12 +20,14 @@ SOURCES = main.cpp \ | |||
18 | password.cpp \ | 20 | password.cpp \ |
19 | checkbook.cpp \ | 21 | checkbook.cpp \ |
20 | transaction.cpp \ | 22 | transaction.cpp \ |
23 | tabledef.cpp \ | ||
24 | listedit.cpp \ | ||
25 | cfg.cpp \ | ||
21 | graph.cpp | 26 | graph.cpp |
22 | INCLUDEPATH += $(OPIEDIR)/include | 27 | INCLUDEPATH += $(OPIEDIR)/include |
23 | DEPENDPATH += $(OPIEDIR)/include | 28 | DEPENDPATH += $(OPIEDIR)/include |
24 | LIBS += -lqpe -lopie | 29 | LIBS += -lqpe -lopie |
25 | TARGET = checkbook | 30 | TARGET = checkbook |
26 | DESTDIR = $(OPIEDIR)/bin | ||
27 | 31 | ||
28 | TRANSLATIONS = ../../../i18n/de/checkbook.ts \ | 32 | TRANSLATIONS = ../../../i18n/de/checkbook.ts \ |
29 | ../../../i18n/nl/checkbook.ts \ | 33 | ../../../i18n/nl/checkbook.ts \ |
diff --git a/noncore/apps/checkbook/configuration.cpp b/noncore/apps/checkbook/configuration.cpp index 7731cf3..3f5662d 100644 --- a/noncore/apps/checkbook/configuration.cpp +++ b/noncore/apps/checkbook/configuration.cpp | |||
@@ -27,48 +27,135 @@ | |||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include "configuration.h" | 29 | #include "configuration.h" |
30 | #include "mainwindow.h" | ||
31 | #include "listedit.h" | ||
32 | #include "tabledef.h" | ||
30 | 33 | ||
31 | #include <qcheckbox.h> | 34 | #include <qcheckbox.h> |
32 | #include <qlabel.h> | 35 | #include <qlabel.h> |
33 | #include <qlayout.h> | 36 | #include <qlayout.h> |
34 | #include <qlineedit.h> | 37 | #include <qlineedit.h> |
35 | #include <qwhatsthis.h> | 38 | #include <qwhatsthis.h> |
39 | #include <qlistview.h> | ||
40 | #include <qpushbutton.h> | ||
41 | #include <qtabwidget.h> | ||
42 | #include <qpe/resource.h> | ||
36 | 43 | ||
37 | Configuration::Configuration( QWidget *parent, const QString &cs, bool sl, bool sb ) | 44 | Configuration::Configuration( QWidget *parent, Cfg &cfg ) |
38 | : QDialog( parent, 0, TRUE, WStyle_ContextHelp ) | 45 | : QDialog( parent, 0, TRUE, WStyle_ContextHelp ) |
39 | { | 46 | { |
40 | setCaption( tr( "Configure Checkbook" ) ); | 47 | setCaption( tr( "Configure Checkbook" ) ); |
41 | 48 | ||
49 | // Setup layout to make everything pretty | ||
50 | QVBoxLayout *layout = new QVBoxLayout( this ); | ||
51 | layout->setMargin( 2 ); | ||
52 | layout->setSpacing( 4 ); | ||
53 | |||
54 | // Setup tabs for all info | ||
55 | _mainWidget = new QTabWidget( this ); | ||
56 | layout->addWidget( _mainWidget ); | ||
57 | |||
58 | // Settings tab | ||
59 | _mainWidget->addTab( initSettings(cfg), tr( "&Settings" ) ); | ||
60 | |||
61 | // Account Types tab | ||
62 | ColumnDef *d; | ||
63 | _listEditTypes=new ListEdit(_mainWidget, "TYPES" ); | ||
64 | d=new ColumnDef( tr("Type"), (ColumnDef::ColumnType)(ColumnDef::typeString | ColumnDef::typeUnique), tr("New Account Type")); | ||
65 | _listEditTypes->addColumnDef( d ); | ||
66 | _listEditTypes->addData( cfg.getAccountTypes() ); | ||
67 | _mainWidget->addTab( _listEditTypes, tr( "&Account Types" ) ); | ||
68 | |||
69 | // Categories tab | ||
70 | _listEditCategories=new ListEdit(_mainWidget, "CATEGORIES" ); | ||
71 | _listEditCategories->addColumnDef( new ColumnDef( tr("Category"), (ColumnDef::ColumnType)(ColumnDef::typeString | ColumnDef::typeUnique), tr("New Category")) ); | ||
72 | d=new ColumnDef( tr("Type"), ColumnDef::typeList, tr("Expense") ); | ||
73 | d->addColumnValue( tr("Expense") ); | ||
74 | d->addColumnValue( tr("Income") ); | ||
75 | _listEditCategories->addColumnDef( d ); | ||
76 | QStringList lst=cfg.getCategories(); | ||
77 | _listEditCategories->addData( lst ); | ||
78 | _mainWidget->addTab( _listEditCategories, tr( "&Categories" ) ); | ||
79 | } | ||
80 | |||
81 | Configuration::~Configuration() | ||
82 | { | ||
83 | } | ||
84 | |||
85 | // ---- initSettings ---------------------------------------------------------- | ||
86 | QWidget *Configuration::initSettings(Cfg &cfg) | ||
87 | { | ||
88 | QWidget *control = new QWidget( _mainWidget ); | ||
89 | |||
42 | QFontMetrics fm = fontMetrics(); | 90 | QFontMetrics fm = fontMetrics(); |
43 | int fh = fm.height(); | 91 | int fh = fm.height(); |
44 | 92 | ||
45 | QGridLayout *layout = new QGridLayout( this ); | 93 | QVBoxLayout *vb = new QVBoxLayout( control ); |
94 | |||
95 | QScrollView *sv = new QScrollView( control ); | ||
96 | vb->addWidget( sv, 0, 0 ); | ||
97 | sv->setResizePolicy( QScrollView::AutoOneFit ); | ||
98 | sv->setFrameStyle( QFrame::NoFrame ); | ||
99 | |||
100 | QWidget *container = new QWidget( sv->viewport() ); | ||
101 | sv->addChild( container ); | ||
102 | |||
103 | QGridLayout *layout = new QGridLayout( container ); | ||
46 | layout->setSpacing( 4 ); | 104 | layout->setSpacing( 4 ); |
47 | layout->setMargin( 4 ); | 105 | layout->setMargin( 4 ); |
48 | 106 | ||
49 | QLabel *label = new QLabel( tr( "Enter currency symbol:" ), this ); | 107 | QLabel *label = new QLabel( tr( "Enter currency symbol:" ), container ); |
50 | QWhatsThis::add( label, tr( "Enter your local currency symbol here." ) ); | 108 | QWhatsThis::add( label, tr( "Enter your local currency symbol here." ) ); |
51 | label->setMaximumHeight( fh + 3 ); | 109 | label->setMaximumHeight( fh + 3 ); |
52 | layout->addWidget( label, 0, 0 ); | 110 | layout->addWidget( label, 0, 0 ); |
53 | 111 | ||
54 | symbolEdit = new QLineEdit( cs, this ); | 112 | symbolEdit = new QLineEdit( cfg.getCurrencySymbol(), container ); |
55 | QWhatsThis::add( symbolEdit, tr( "Enter your local currency symbol here." ) ); | 113 | QWhatsThis::add( symbolEdit, tr( "Enter your local currency symbol here." ) ); |
56 | symbolEdit->setMaximumHeight( fh + 5 ); | 114 | symbolEdit->setMaximumHeight( fh + 5 ); |
57 | symbolEdit->setFocus(); | 115 | symbolEdit->setFocus(); |
58 | layout->addWidget( symbolEdit, 0, 1 ); | 116 | layout->addWidget( symbolEdit, 0, 1 ); |
59 | 117 | ||
60 | lockCB = new QCheckBox( tr( "Show whether checkbook is password\nprotected" ), this ); | 118 | lockCB = new QCheckBox( tr( "Show whether checkbook is password\nprotected" ), container ); |
61 | QWhatsThis::add( lockCB, tr( "Click here to select whether or not the main window will display that the checkbook is protected with a password." ) ); | 119 | QWhatsThis::add( lockCB, tr( "Click here to select whether or not the main window will display that the checkbook is protected with a password." ) ); |
62 | lockCB->setChecked( sl ); | 120 | lockCB->setChecked( cfg.getShowLocks() ); |
63 | layout->addMultiCellWidget( lockCB, 1, 1, 0, 1 ); | 121 | layout->addMultiCellWidget( lockCB, 1, 1, 0, 1 ); |
64 | 122 | ||
65 | balCB = new QCheckBox( tr( "Show checkbook balances" ), this ); | 123 | balCB = new QCheckBox( tr( "Show checkbook balances" ), container ); |
66 | QWhatsThis::add( balCB, tr( "Click here to select whether or not the main window will display the current balance for each checkbook." ) ); | 124 | QWhatsThis::add( balCB, tr( "Click here to select whether or not the main window will display the current balance for each checkbook." ) ); |
67 | balCB->setMaximumHeight( fh + 5 ); | 125 | balCB->setMaximumHeight( fh + 5 ); |
68 | balCB->setChecked( sb ); | 126 | balCB->setChecked( cfg.getShowBalances() ); |
69 | layout->addMultiCellWidget( balCB, 2, 2, 0, 1 ); | 127 | layout->addMultiCellWidget( balCB, 2, 2, 0, 1 ); |
128 | |||
129 | openLastBookCB = new QCheckBox( tr("Open last checkbook" ), container ); | ||
130 | QWhatsThis::add( openLastBookCB, tr("Click here to select whether the last open checkbook will be opened at startup.") ); | ||
131 | openLastBookCB->setMaximumHeight(fh+5); | ||
132 | openLastBookCB->setChecked( cfg.isOpenLastBook() ); | ||
133 | layout->addMultiCellWidget( openLastBookCB, 3, 3, 0, 1 ); | ||
134 | |||
135 | lastTabCB = new QCheckBox( tr("Show last checkbook tab" ), container ); | ||
136 | QWhatsThis::add( lastTabCB, tr("Click here to select whether the last tab in a checkbook should be displayed.") ); | ||
137 | lastTabCB->setMaximumHeight(fh+5); | ||
138 | lastTabCB->setChecked( cfg.isShowLastTab() ); | ||
139 | layout->addMultiCellWidget( lastTabCB, 4, 4, 0, 1 ); | ||
140 | |||
141 | return(control); | ||
70 | } | 142 | } |
71 | 143 | ||
72 | Configuration::~Configuration() | 144 | // --- saveConfig ------------------------------------------------------------- |
145 | void Configuration::saveConfig(Cfg &cfg) | ||
73 | { | 146 | { |
147 | // Settings | ||
148 | cfg.setCurrencySymbol( symbolEdit->text() ); | ||
149 | cfg.setShowLocks( lockCB->isChecked() ); | ||
150 | cfg.setShowBalances( balCB->isChecked() ); | ||
151 | cfg.setOpenLastBook( openLastBookCB->isChecked() ); | ||
152 | cfg.setShowLastTab( lastTabCB->isChecked() ); | ||
153 | |||
154 | // Typelist | ||
155 | _listEditTypes->storeInList( cfg.getAccountTypes() ); | ||
156 | |||
157 | // Category list | ||
158 | QStringList lst; | ||
159 | _listEditCategories->storeInList( lst ); | ||
160 | cfg.setCategories( lst ); | ||
74 | } | 161 | } |
diff --git a/noncore/apps/checkbook/configuration.h b/noncore/apps/checkbook/configuration.h index 9a8de02..5893502 100644 --- a/noncore/apps/checkbook/configuration.h +++ b/noncore/apps/checkbook/configuration.h | |||
@@ -30,22 +30,38 @@ | |||
30 | #define CONFIGURATION_H | 30 | #define CONFIGURATION_H |
31 | 31 | ||
32 | #include <qdialog.h> | 32 | #include <qdialog.h> |
33 | #include "cfg.h" | ||
33 | 34 | ||
34 | class QCheckBox; | 35 | class QCheckBox; |
35 | class QLineEdit; | 36 | class QLineEdit; |
36 | class QString; | 37 | class QString; |
38 | class QTabWidget; | ||
39 | class ListEdit; | ||
37 | 40 | ||
38 | class Configuration : public QDialog | 41 | class Configuration : public QDialog |
39 | { | 42 | { |
40 | Q_OBJECT | 43 | Q_OBJECT |
41 | 44 | ||
42 | public: | 45 | public: |
43 | Configuration( QWidget * = 0x0, const QString & = "$", bool = FALSE, bool = FALSE ); | 46 | // Constructor |
47 | Configuration( QWidget *, Cfg &cfg); | ||
44 | ~Configuration(); | 48 | ~Configuration(); |
45 | 49 | ||
46 | QLineEdit *symbolEdit; | 50 | QLineEdit *symbolEdit; |
47 | QCheckBox *lockCB; | 51 | QCheckBox *lockCB; |
48 | QCheckBox *balCB; | 52 | QCheckBox *balCB; |
53 | QCheckBox *openLastBookCB; | ||
54 | QCheckBox *lastTabCB; | ||
55 | QTabWidget *_mainWidget; | ||
56 | ListEdit *_listEditTypes; | ||
57 | ListEdit *_listEditCategories; | ||
58 | |||
59 | // saves settings in config struct | ||
60 | void saveConfig(Cfg &cfg); | ||
61 | |||
62 | protected: | ||
63 | // creates settings tap from configuration | ||
64 | QWidget *initSettings(Cfg &cfg); | ||
49 | }; | 65 | }; |
50 | 66 | ||
51 | #endif | 67 | #endif |
diff --git a/noncore/apps/checkbook/listedit.cpp b/noncore/apps/checkbook/listedit.cpp new file mode 100644 index 0000000..99a6531 --- a/dev/null +++ b/noncore/apps/checkbook/listedit.cpp | |||
@@ -0,0 +1,340 @@ | |||
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 | #include "listedit.h" | ||
30 | #include <qlayout.h> | ||
31 | #include <qlineedit.h> | ||
32 | #include <qlistview.h> | ||
33 | #include <qwidgetstack.h> | ||
34 | #include <qcombobox.h> | ||
35 | #include <qpushbutton.h> | ||
36 | #include <qpe/resource.h> | ||
37 | |||
38 | |||
39 | // --- ListEdit --------------------------------------------------------------- | ||
40 | ListEdit::ListEdit( QWidget *parent, const char *sName ) | ||
41 | : QWidget(parent, sName), TableDef(sName) | ||
42 | { | ||
43 | // get font height | ||
44 | int fh = fontMetrics().height(); | ||
45 | |||
46 | // create layout | ||
47 | QGridLayout *layout=new QGridLayout(this); | ||
48 | layout->setSpacing( 2 ); | ||
49 | layout->setMargin( 4 ); | ||
50 | |||
51 | // type table | ||
52 | _typeTable = new QListView( this ); | ||
53 | ColumnDef *def=first(); | ||
54 | while( def ) { | ||
55 | _typeTable->addColumn( def->getName() ); | ||
56 | def=next(); | ||
57 | } | ||
58 | connect( _typeTable, SIGNAL( clicked(QListViewItem *, const QPoint &, int) ), this, SLOT( slotClick(QListViewItem *, const QPoint &, int ) ) ); | ||
59 | layout->addMultiCellWidget(_typeTable, 0,4,0,4); | ||
60 | _currentItem=NULL; | ||
61 | |||
62 | // edit field | ||
63 | _stack=new QWidgetStack( this ); | ||
64 | _stack->setMaximumHeight(fh+5); | ||
65 | layout->addMultiCellWidget(_stack, 5,5,0,2); | ||
66 | _typeEdit = new QLineEdit( _stack ); | ||
67 | _stack->raiseWidget(_typeEdit ); | ||
68 | connect( _typeEdit, SIGNAL( textChanged(const QString &) ), this, SLOT( slotEditChanged(const QString &) ) ); | ||
69 | |||
70 | // combo box | ||
71 | _box=new QComboBox( _stack ); | ||
72 | connect( _box, SIGNAL( activated(const QString &) ), this, SLOT( slotActivated(const QString &) ) ); | ||
73 | |||
74 | |||
75 | // add button | ||
76 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "checkbook/add" ), tr( "Add" ), this ); | ||
77 | connect( btn, SIGNAL( clicked() ), this, SLOT( slotAdd() ) ); | ||
78 | layout->addWidget( btn, 5, 3 ); | ||
79 | |||
80 | // delete button | ||
81 | btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), this ); | ||
82 | connect( btn, SIGNAL( clicked() ), this, SLOT( slotDel() ) ); | ||
83 | layout->addWidget( btn, 5, 4 ); | ||
84 | } | ||
85 | |||
86 | // --- ~ListEdit -------------------------------------------------------------- | ||
87 | ListEdit::~ListEdit() | ||
88 | { | ||
89 | } | ||
90 | |||
91 | |||
92 | // --- slotEditTypeChanged ---------------------------------------------------- | ||
93 | void ListEdit::slotEditChanged(const QString &str) | ||
94 | { | ||
95 | if( !_currentItem || _currentColumn<0 ) return; | ||
96 | _currentItem->setText(_currentColumn, str); | ||
97 | } | ||
98 | |||
99 | // --- slotAddType ------------------------------------------------------------ | ||
100 | void ListEdit::slotAdd() | ||
101 | { | ||
102 | // construct new row | ||
103 | QString args[8]; | ||
104 | ColumnDef *pCol=this->first(); | ||
105 | int i=0; | ||
106 | while( pCol && i<8 ) { | ||
107 | args[i++]=pCol->getNewValue(); | ||
108 | pCol=this->next(); | ||
109 | } | ||
110 | _currentItem=new QListViewItem(_typeTable, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7] ); | ||
111 | |||
112 | // fix uniques | ||
113 | fixTypes(); | ||
114 | |||
115 | // display col 0 of new value | ||
116 | QPoint pnt; | ||
117 | slotClick(_currentItem, pnt, 0); | ||
118 | _typeTable->setSelected( _currentItem, true ); | ||
119 | } | ||
120 | |||
121 | // --- slotDel ------------------------------------------------------------- | ||
122 | void ListEdit::slotDel() | ||
123 | { | ||
124 | if( !_currentItem ) return; | ||
125 | delete _currentItem; | ||
126 | _currentItem=NULL; | ||
127 | _typeEdit->setText(""); | ||
128 | _stack->raiseWidget(_typeEdit); | ||
129 | } | ||
130 | |||
131 | |||
132 | // --- fixTypes ---------------------------------------------------------------- | ||
133 | // Makes sure all entries have a unique name and empty entries are replaced | ||
134 | // by a generic string. The first version performs the operation on a particular | ||
135 | // column, whereas the 2nd does it for all unique columns. | ||
136 | class ColMap { | ||
137 | public: | ||
138 | ColMap(QString sValue, QListViewItem *pEntry) { | ||
139 | _sValue=sValue; | ||
140 | _pEntry=pEntry; | ||
141 | } | ||
142 | QString &getValue() { return(_sValue); } | ||
143 | QListViewItem *getItem() { return(_pEntry); } | ||
144 | |||
145 | protected: | ||
146 | QString _sValue; | ||
147 | QListViewItem *_pEntry; | ||
148 | }; | ||
149 | |||
150 | class ColList : public QList<QString> | ||
151 | { | ||
152 | public: | ||
153 | ColList() : QList<QString>() { } | ||
154 | |||
155 | protected: | ||
156 | int compareItems(QCollection::Item, QCollection::Item); | ||
157 | }; | ||
158 | |||
159 | int ColList::compareItems(QCollection::Item i1, QCollection::Item i2) { | ||
160 | return( ((QString *)i1)->compare(*(QString *)i2) ); | ||
161 | } | ||
162 | |||
163 | void ListEdit::fixTypes(int iColumn) | ||
164 | { | ||
165 | // get column def | ||
166 | ColumnDef *pDef=this->at(iColumn); | ||
167 | |||
168 | // create map of entries | ||
169 | if( !_typeTable->childCount() ) return; | ||
170 | ColMap **colMap=new (ColMap *)[_typeTable->childCount()]; | ||
171 | QListViewItem *cur=_typeTable->firstChild(); | ||
172 | ColList lst; | ||
173 | for(int i=0; i<_typeTable->childCount(); i++) { | ||
174 | colMap[i]=new ColMap(cur->text(iColumn), cur); | ||
175 | lst.append( &(colMap[i]->getValue()) ); | ||
176 | cur=cur->nextSibling(); | ||
177 | } | ||
178 | |||
179 | // fix empty entries | ||
180 | int i=0; | ||
181 | for(QString *ptr=lst.first(); ptr; ptr=lst.next()) { | ||
182 | *ptr=ptr->stripWhiteSpace(); | ||
183 | if( ptr->isEmpty() ) { | ||
184 | i++; | ||
185 | if( i==1 ) *ptr=pDef->getNewValue(); | ||
186 | else ptr->sprintf("%s %d", (const char *)pDef->getNewValue(), i); | ||
187 | } | ||
188 | } | ||
189 | |||
190 | // fix dups | ||
191 | lst.sort(); | ||
192 | QString repl; | ||
193 | for(uint iCur=0; iCur<lst.count()-1; iCur++) { | ||
194 | QString *current=lst.at(iCur); | ||
195 | for(uint iNext=iCur+1; iNext<lst.count(); iNext++ ) { | ||
196 | if( *current!=*lst.at(iNext) ) continue; | ||
197 | for(int i=2; ; i++) { | ||
198 | repl.sprintf("%s %d", (const char *)*current, i); | ||
199 | bool bDup=false; | ||
200 | uint iChk=iNext+1; | ||
201 | while( iChk<lst.count() ) { | ||
202 | QString *chk=lst.at(iChk); | ||
203 | if( !chk->startsWith(*current) ) break; | ||
204 | if( *chk==repl ) { | ||
205 | bDup=true; | ||
206 | break; | ||
207 | } | ||
208 | iChk++; | ||
209 | } | ||
210 | if( !bDup ) { | ||
211 | *lst.at(iNext)=repl; | ||
212 | break; | ||
213 | } | ||
214 | } | ||
215 | } | ||
216 | } | ||
217 | lst.sort(); | ||
218 | |||
219 | // copy back clean up col map | ||
220 | for(int i=0; i<_typeTable->childCount(); i++) { | ||
221 | colMap[i]->getItem()->setText(iColumn, colMap[i]->getValue()); | ||
222 | delete colMap[i]; | ||
223 | } | ||
224 | delete colMap; | ||
225 | } | ||
226 | |||
227 | void ListEdit::fixTypes() | ||
228 | { | ||
229 | int i; | ||
230 | ColumnDef *pDef; | ||
231 | for(pDef=this->first(), i=0; pDef; pDef=this->next(), i++) { | ||
232 | if( pDef->hasFlag(ColumnDef::typeUnique) ) | ||
233 | fixTypes(i); | ||
234 | } | ||
235 | _typeTable->sort(); | ||
236 | } | ||
237 | |||
238 | |||
239 | // --- storeInList ------------------------------------------------------------ | ||
240 | void ListEdit::storeInList(QStringList &lst) | ||
241 | { | ||
242 | // delete old content | ||
243 | lst.clear(); | ||
244 | |||
245 | // add new one | ||
246 | fixTypes(); | ||
247 | QListViewItem *itm=_typeTable->firstChild(); | ||
248 | while( itm ) { | ||
249 | int i=0; | ||
250 | QString sAdd; | ||
251 | ColumnDef *pDef; | ||
252 | for(pDef=this->first(), i=0; pDef; pDef=this->next(), i++) { | ||
253 | if( i>=1 ) sAdd+=";"; | ||
254 | sAdd += itm->text(i); | ||
255 | } | ||
256 | lst.append( sAdd ); | ||
257 | itm=itm->nextSibling(); | ||
258 | } | ||
259 | } | ||
260 | |||
261 | |||
262 | // --- slotClicked ------------------------------------------------------------ | ||
263 | void ListEdit::slotClick(QListViewItem *itm, const QPoint &pnt, int col) | ||
264 | { | ||
265 | (void)pnt; // get rid of unused warning; | ||
266 | |||
267 | // save values | ||
268 | _currentItem=itm; | ||
269 | _currentColumn=col; | ||
270 | if( itm==NULL ) { | ||
271 | _typeEdit->setText(""); | ||
272 | _stack->raiseWidget(_typeEdit); | ||
273 | return; | ||
274 | } | ||
275 | |||
276 | // display value | ||
277 | if( _currentColumn<0 ) _currentColumn=0; | ||
278 | ColumnDef *pDef=this->at(_currentColumn); | ||
279 | if( pDef->isType(ColumnDef::typeString) ) { | ||
280 | _typeEdit->setText( _currentItem->text(_currentColumn) ); | ||
281 | _stack->raiseWidget(_typeEdit); | ||
282 | } else if( pDef->isType(ColumnDef::typeList) ){ | ||
283 | _box->clear(); | ||
284 | _box->insertStringList( pDef->getValueList() ); | ||
285 | QStringList::Iterator itr; | ||
286 | int i=0; | ||
287 | for(itr=pDef->getValueList().begin(); itr!=pDef->getValueList().end(); itr++) { | ||
288 | if( (*itr)==_currentItem->text(_currentColumn) ) { | ||
289 | _box->setCurrentItem(i); | ||
290 | i=-1; | ||
291 | break; | ||
292 | } | ||
293 | i++; | ||
294 | } | ||
295 | if( i>=0 ) { | ||
296 | _box->insertItem( _currentItem->text(_currentColumn) ); | ||
297 | _box->setCurrentItem(i); | ||
298 | } | ||
299 | _stack->raiseWidget(_box); | ||
300 | } else { | ||
301 | qDebug( "Unsupported column type for column %s", (const char *)pDef->getName() ); | ||
302 | _typeEdit->setText(""); | ||
303 | _stack->raiseWidget(_typeEdit); | ||
304 | } | ||
305 | } | ||
306 | |||
307 | |||
308 | // --- addColumnDef ----------------------------------------------------------- | ||
309 | void ListEdit::addColumnDef(ColumnDef *pDef) | ||
310 | { | ||
311 | _typeTable->addColumn( pDef->getName() ); | ||
312 | _vColumns.append(pDef); | ||
313 | } | ||
314 | |||
315 | // --- addData ---------------------------------------------------------------- | ||
316 | void ListEdit::addData(QStringList &lst) | ||
317 | { | ||
318 | // run through list | ||
319 | QStringList::Iterator itr; | ||
320 | for(itr=lst.begin(); itr!=lst.end(); itr++) { | ||
321 | QStringList split=QStringList::split(";", *itr, true); | ||
322 | QStringList::Iterator entry; | ||
323 | QString args[8]; | ||
324 | int i=0; | ||
325 | for(entry=split.begin(); entry!=split.end() && i<8; entry++, i++) { | ||
326 | args[i]= (*entry); | ||
327 | } | ||
328 | while(i<8) { | ||
329 | args[i++]=""; | ||
330 | } | ||
331 | new QListViewItem(_typeTable, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]); | ||
332 | } | ||
333 | } | ||
334 | |||
335 | // --- slotActivated ---------------------------------------------------------- | ||
336 | void ListEdit::slotActivated(const QString &str) | ||
337 | { | ||
338 | if( _currentItem==NULL || _currentColumn<0 ) return; | ||
339 | _currentItem->setText(_currentColumn, str); | ||
340 | } | ||
diff --git a/noncore/apps/checkbook/listedit.h b/noncore/apps/checkbook/listedit.h new file mode 100644 index 0000000..d2135ea --- a/dev/null +++ b/noncore/apps/checkbook/listedit.h | |||
@@ -0,0 +1,78 @@ | |||
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 LISTEDIT_H | ||
30 | #define LISTEDIT_H | ||
31 | |||
32 | #include <qwidget.h> | ||
33 | #include "tabledef.h" | ||
34 | class QListView; | ||
35 | class QLineEdit; | ||
36 | class QListViewItem; | ||
37 | class QPoint; | ||
38 | class QWidgetStack; | ||
39 | class QComboBox; | ||
40 | |||
41 | class ListEdit : public QWidget, public TableDef | ||
42 | { | ||
43 | Q_OBJECT | ||
44 | |||
45 | public: | ||
46 | ListEdit( QWidget *, const char *sName); | ||
47 | virtual ~ListEdit(); | ||
48 | |||
49 | QListView *_typeTable; | ||
50 | QLineEdit *_typeEdit; | ||
51 | QWidgetStack *_stack; | ||
52 | QComboBox *_box; | ||
53 | QListViewItem *_currentItem; | ||
54 | int _currentColumn; | ||
55 | |||
56 | // resolves dups and empty entries | ||
57 | void fixTypes(); | ||
58 | void fixTypes(int iColumn); | ||
59 | |||
60 | // stores content in string list | ||
61 | void storeInList(QStringList &lst); | ||
62 | |||
63 | // adds a column definition | ||
64 | virtual void addColumnDef(ColumnDef *pDef); | ||
65 | |||
66 | // adds data to table | ||
67 | void addData(QStringList &lst); | ||
68 | |||
69 | |||
70 | public slots: | ||
71 | void slotClick(QListViewItem *, const QPoint &pnt, int col); | ||
72 | void slotEditChanged(const QString &); | ||
73 | void slotAdd(); | ||
74 | void slotDel(); | ||
75 | void slotActivated(const QString &); | ||
76 | }; | ||
77 | |||
78 | #endif | ||
diff --git a/noncore/apps/checkbook/main.cpp b/noncore/apps/checkbook/main.cpp index abfa633..dcaab4a 100644 --- a/noncore/apps/checkbook/main.cpp +++ b/noncore/apps/checkbook/main.cpp | |||
@@ -26,17 +26,9 @@ | |||
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include "mainwindow.h" | ||
30 | |||
31 | #include <qpe/qpeapplication.h> | 29 | #include <qpe/qpeapplication.h> |
30 | #include <opie/oapplicationfactory.h> | ||
32 | 31 | ||
33 | int main(int argc, char **argv) | 32 | #include "mainwindow.h" |
34 | { | ||
35 | QPEApplication app(argc, argv); | ||
36 | |||
37 | MainWindow *cb = new MainWindow(); | ||
38 | app.setMainWidget(cb); | ||
39 | cb->showMaximized(); | ||
40 | 33 | ||
41 | return app.exec(); | 34 | OPIE_EXPORT_APP( OApplicationFactory<MainWindow> ) |
42 | } | ||
diff --git a/noncore/apps/checkbook/mainwindow.cpp b/noncore/apps/checkbook/mainwindow.cpp index 6d1d7b9..8d64cad 100644 --- a/noncore/apps/checkbook/mainwindow.cpp +++ b/noncore/apps/checkbook/mainwindow.cpp | |||
@@ -31,6 +31,7 @@ | |||
31 | #include "configuration.h" | 31 | #include "configuration.h" |
32 | #include "password.h" | 32 | #include "password.h" |
33 | #include "checkbook.h" | 33 | #include "checkbook.h" |
34 | #include "listedit.h" | ||
34 | 35 | ||
35 | #include <qpe/config.h> | 36 | #include <qpe/config.h> |
36 | #include <qpe/global.h> | 37 | #include <qpe/global.h> |
@@ -46,8 +47,9 @@ | |||
46 | #include <qlineedit.h> | 47 | #include <qlineedit.h> |
47 | #include <qwhatsthis.h> | 48 | #include <qwhatsthis.h> |
48 | 49 | ||
49 | MainWindow::MainWindow() | 50 | |
50 | : QMainWindow( 0x0, 0x0, WStyle_ContextHelp ) | 51 | MainWindow::MainWindow( QWidget* parent, const char* name, WFlags fl ) |
52 | : QMainWindow( parent, name, fl || WStyle_ContextHelp ) | ||
51 | { | 53 | { |
52 | setCaption( tr( "Checkbook" ) ); | 54 | setCaption( tr( "Checkbook" ) ); |
53 | 55 | ||
@@ -56,10 +58,9 @@ MainWindow::MainWindow() | |||
56 | 58 | ||
57 | // Load configuration options | 59 | // Load configuration options |
58 | Config config( "checkbook" ); | 60 | Config config( "checkbook" ); |
59 | config.setGroup( "Config" ); | 61 | qDebug( "Reading config" ); |
60 | currencySymbol = config.readEntry( "CurrencySymbol", "$" ); | 62 | _cfg.readConfig( config ); |
61 | showLocks = config.readBoolEntry( "ShowLocks", FALSE ); | 63 | |
62 | showBalances = config.readBoolEntry( "ShowBalances", FALSE ); | ||
63 | 64 | ||
64 | // Build menu and tool bars | 65 | // Build menu and tool bars |
65 | setToolBarsMovable( FALSE ); | 66 | setToolBarsMovable( FALSE ); |
@@ -125,24 +126,40 @@ MainWindow::MainWindow() | |||
125 | // Build Checkbook selection list control | 126 | // Build Checkbook selection list control |
126 | cbList = 0x0; | 127 | cbList = 0x0; |
127 | buildList(); | 128 | buildList(); |
129 | |||
130 | // open last book? | ||
131 | if( _cfg.isOpenLastBook() ) { | ||
132 | this->show(); | ||
133 | this->showMaximized(); | ||
134 | QListViewItem *itm=cbList->firstChild(); | ||
135 | while( itm ) { | ||
136 | if( itm->text(posName)==_cfg.getLastBook() ) { | ||
137 | openBook( itm ); | ||
138 | break; | ||
128 | } | 139 | } |
140 | itm=itm->nextSibling(); | ||
141 | } | ||
142 | } | ||
143 | } | ||
144 | |||
129 | 145 | ||
146 | // --- ~MainWindow ------------------------------------------------------------ | ||
130 | MainWindow::~MainWindow() | 147 | MainWindow::~MainWindow() |
131 | { | 148 | { |
132 | //config.write(); | 149 | writeConfig(); |
133 | } | 150 | } |
134 | 151 | ||
152 | |||
153 | // --- buildList -------------------------------------------------------------- | ||
135 | void MainWindow::buildList() | 154 | void MainWindow::buildList() |
136 | { | 155 | { |
137 | if ( cbList ) | 156 | if ( cbList ) |
138 | { | ||
139 | delete cbList; | 157 | delete cbList; |
140 | } | ||
141 | 158 | ||
142 | cbList = new QListView( this ); | 159 | cbList = new QListView( this ); |
143 | QWhatsThis::add( cbList, tr( "This is a listing of all checkbooks currently available." ) ); | 160 | QWhatsThis::add( cbList, tr( "This is a listing of all checkbooks currently available." ) ); |
144 | 161 | ||
145 | if ( showLocks ) | 162 | if ( _cfg.getShowLocks() ) |
146 | { | 163 | { |
147 | cbList->addColumn( Resource::loadIconSet( "locked" ), "", 24 ); | 164 | cbList->addColumn( Resource::loadIconSet( "locked" ), "", 24 ); |
148 | posName = 1; | 165 | posName = 1; |
@@ -152,7 +169,7 @@ void MainWindow::buildList() | |||
152 | posName = 0; | 169 | posName = 0; |
153 | } | 170 | } |
154 | cbList->addColumn( tr( "Checkbook Name" ) ); | 171 | cbList->addColumn( tr( "Checkbook Name" ) ); |
155 | if ( showBalances ) | 172 | if ( _cfg.getShowBalances() ) |
156 | { | 173 | { |
157 | int colnum = cbList->addColumn( tr( "Balance" ) ); | 174 | int colnum = cbList->addColumn( tr( "Balance" ) ); |
158 | cbList->setColumnAlignment( colnum, Qt::AlignRight ); | 175 | cbList->setColumnAlignment( colnum, Qt::AlignRight ); |
@@ -173,15 +190,15 @@ void MainWindow::buildList() | |||
173 | void MainWindow::addCheckbook( CBInfo *cb ) | 190 | void MainWindow::addCheckbook( CBInfo *cb ) |
174 | { | 191 | { |
175 | QListViewItem *lvi = new QListViewItem( cbList ); | 192 | QListViewItem *lvi = new QListViewItem( cbList ); |
176 | if ( showLocks && !cb->password().isNull() ) | 193 | if ( _cfg.getShowLocks() && !cb->password().isNull() ) |
177 | { | 194 | { |
178 | lvi->setPixmap( 0, lockIcon ); | 195 | lvi->setPixmap( 0, lockIcon ); |
179 | } | 196 | } |
180 | lvi->setText( posName, cb->name() ); | 197 | lvi->setText( posName, cb->name() ); |
181 | if ( showBalances ) | 198 | if ( _cfg.getShowBalances() ) |
182 | { | 199 | { |
183 | QString balance; | 200 | QString balance; |
184 | balance.sprintf( "%s%.2f", currencySymbol.latin1(), cb->balance() ); | 201 | balance.sprintf( "%s%.2f", _cfg.getCurrencySymbol().latin1(), cb->balance() ); |
185 | lvi->setText( posName + 1, balance ); | 202 | lvi->setText( posName + 1, balance ); |
186 | } | 203 | } |
187 | } | 204 | } |
@@ -197,12 +214,13 @@ void MainWindow::slotNew() | |||
197 | { | 214 | { |
198 | CBInfo *cb = new CBInfo(); | 215 | CBInfo *cb = new CBInfo(); |
199 | 216 | ||
200 | Checkbook *currcb = new Checkbook( this, cb, currencySymbol ); | 217 | Checkbook *currcb = new Checkbook( this, cb, &_cfg ); |
201 | currcb->showMaximized(); | 218 | currcb->showMaximized(); |
202 | if ( currcb->exec() == QDialog::Accepted ) | 219 | if ( currcb->exec() == QDialog::Accepted ) |
203 | { | 220 | { |
204 | // Save new checkbook | 221 | // Save new checkbook |
205 | buildFilename( cb->name() ); | 222 | buildFilename( cb->name() ); |
223 | _cfg.setLastBook( cb->name() ); | ||
206 | cb->setFilename( tempFilename ); | 224 | cb->setFilename( tempFilename ); |
207 | cb->write(); | 225 | cb->write(); |
208 | 226 | ||
@@ -213,28 +231,31 @@ void MainWindow::slotNew() | |||
213 | delete currcb; | 231 | delete currcb; |
214 | } | 232 | } |
215 | 233 | ||
234 | // --- slotEdit --------------------------------------------------------------- | ||
216 | void MainWindow::slotEdit() | 235 | void MainWindow::slotEdit() |
217 | { | 236 | { |
218 | 237 | // get name and open it | |
219 | QListViewItem *curritem = cbList->currentItem(); | 238 | QListViewItem *curritem = cbList->currentItem(); |
220 | if ( !curritem ) | 239 | if ( !curritem ) |
221 | { | ||
222 | return; | 240 | return; |
241 | openBook( curritem ); | ||
223 | } | 242 | } |
224 | QString currname = curritem->text( posName ); | ||
225 | 243 | ||
226 | CBInfo *cb = checkbooks->first(); | 244 | |
227 | while ( cb ) | 245 | // --- openBook --------------------------------------------------------------- |
246 | void MainWindow::openBook(QListViewItem *curritem) | ||
228 | { | 247 | { |
248 | // find book in List | ||
249 | QString currname=curritem->text(posName); | ||
250 | CBInfo *cb = checkbooks->first(); | ||
251 | while ( cb ) { | ||
229 | if ( cb->name() == currname ) | 252 | if ( cb->name() == currname ) |
230 | break; | 253 | break; |
231 | cb = checkbooks->next(); | 254 | cb = checkbooks->next(); |
232 | } | 255 | } |
233 | if ( !cb ) | 256 | if ( !cb ) return; |
234 | { | ||
235 | return; | ||
236 | } | ||
237 | 257 | ||
258 | // | ||
238 | buildFilename( currname ); | 259 | buildFilename( currname ); |
239 | float currbalance = cb->balance(); | 260 | float currbalance = cb->balance(); |
240 | bool currlock = !cb->password().isNull(); | 261 | bool currlock = !cb->password().isNull(); |
@@ -250,7 +271,8 @@ void MainWindow::slotEdit() | |||
250 | delete pw; | 271 | delete pw; |
251 | } | 272 | } |
252 | 273 | ||
253 | Checkbook *currcb = new Checkbook( this, cb, currencySymbol ); | 274 | _cfg.setLastBook( currname ); |
275 | Checkbook *currcb = new Checkbook( this, cb, &_cfg ); | ||
254 | currcb->showMaximized(); | 276 | currcb->showMaximized(); |
255 | if ( currcb->exec() == QDialog::Accepted ) | 277 | if ( currcb->exec() == QDialog::Accepted ) |
256 | { | 278 | { |
@@ -258,15 +280,16 @@ void MainWindow::slotEdit() | |||
258 | if ( currname != newname ) | 280 | if ( currname != newname ) |
259 | { | 281 | { |
260 | // Update name if changed | 282 | // Update name if changed |
283 | if( curritem ) { | ||
261 | curritem->setText( posName, newname ); | 284 | curritem->setText( posName, newname ); |
262 | cbList->sort(); | 285 | cbList->sort(); |
286 | } | ||
287 | _cfg.setLastBook( newname ); | ||
263 | 288 | ||
264 | // Remove old file | 289 | // Remove old file |
265 | QFile f( tempFilename ); | 290 | QFile f( tempFilename ); |
266 | if ( f.exists() ) | 291 | if ( f.exists() ) |
267 | { | ||
268 | f.remove(); | 292 | f.remove(); |
269 | } | ||
270 | 293 | ||
271 | // Get new filename | 294 | // Get new filename |
272 | buildFilename( newname ); | 295 | buildFilename( newname ); |
@@ -276,7 +299,7 @@ void MainWindow::slotEdit() | |||
276 | cb->write(); | 299 | cb->write(); |
277 | 300 | ||
278 | // Update lock if changed | 301 | // Update lock if changed |
279 | if ( showLocks && !cb->password().isNull() != currlock ) | 302 | if ( _cfg.getShowLocks() && !cb->password().isNull() != currlock ) |
280 | { | 303 | { |
281 | if ( !cb->password().isNull() ) | 304 | if ( !cb->password().isNull() ) |
282 | curritem->setPixmap( 0, lockIcon ); | 305 | curritem->setPixmap( 0, lockIcon ); |
@@ -285,16 +308,17 @@ void MainWindow::slotEdit() | |||
285 | } | 308 | } |
286 | 309 | ||
287 | // Update balance if changed | 310 | // Update balance if changed |
288 | if ( showBalances && cb->balance() != currbalance ) | 311 | if ( _cfg.getShowBalances() && cb->balance() != currbalance ) |
289 | { | 312 | { |
290 | QString tempstr; | 313 | QString tempstr; |
291 | tempstr.sprintf( "%s%.2f", currencySymbol.latin1(), cb->balance() ); | 314 | tempstr.sprintf( "%s%.2f", _cfg.getCurrencySymbol().latin1(), cb->balance() ); |
292 | curritem->setText( posName + 1, tempstr ); | 315 | curritem->setText( posName + 1, tempstr ); |
293 | } | 316 | } |
294 | } | 317 | } |
295 | delete currcb; | 318 | delete currcb; |
296 | } | 319 | } |
297 | 320 | ||
321 | // --- slotDelete ------------------------------------------------------------- | ||
298 | void MainWindow::slotDelete() | 322 | void MainWindow::slotDelete() |
299 | { | 323 | { |
300 | QString currname = cbList->currentItem()->text( posName ); | 324 | QString currname = cbList->currentItem()->text( posName ); |
@@ -312,24 +336,25 @@ void MainWindow::slotDelete() | |||
312 | } | 336 | } |
313 | } | 337 | } |
314 | 338 | ||
339 | // --- slotConfigure ---------------------------------------------------------- | ||
315 | void MainWindow::slotConfigure() | 340 | void MainWindow::slotConfigure() |
316 | { | 341 | { |
317 | Configuration *cfgdlg = new Configuration( this, currencySymbol, showLocks, showBalances ); | 342 | Configuration *cfgdlg = new Configuration( this, _cfg ); |
318 | cfgdlg->showMaximized(); | 343 | cfgdlg->showMaximized(); |
319 | if ( cfgdlg->exec() == QDialog::Accepted ) | 344 | if ( cfgdlg->exec() == QDialog::Accepted ) |
320 | { | 345 | { |
321 | currencySymbol = cfgdlg->symbolEdit->text(); | 346 | // read data from config dialog & save it |
322 | showLocks = cfgdlg->lockCB->isChecked(); | 347 | cfgdlg->saveConfig( _cfg ); |
323 | showBalances = cfgdlg->balCB->isChecked(); | 348 | writeConfig(); |
324 | |||
325 | Config config( "checkbook" ); | ||
326 | config.setGroup( "Config" ); | ||
327 | config.writeEntry( "CurrencySymbol", currencySymbol ); | ||
328 | config.writeEntry( "ShowLocks", showLocks ); | ||
329 | config.writeEntry( "ShowBalances", showBalances ); | ||
330 | config.write(); | ||
331 | |||
332 | buildList(); | 349 | buildList(); |
333 | } | 350 | } |
334 | delete cfgdlg; | 351 | delete cfgdlg; |
335 | } | 352 | } |
353 | |||
354 | |||
355 | // --- writeConfig -------------------------------------------------------------- | ||
356 | void MainWindow::writeConfig() | ||
357 | { | ||
358 | Config config("checkbook"); | ||
359 | _cfg.writeConfig( config ); | ||
360 | } | ||
diff --git a/noncore/apps/checkbook/mainwindow.h b/noncore/apps/checkbook/mainwindow.h index 2bc70b3..6275f94 100644 --- a/noncore/apps/checkbook/mainwindow.h +++ b/noncore/apps/checkbook/mainwindow.h | |||
@@ -31,20 +31,29 @@ | |||
31 | 31 | ||
32 | #include <qmainwindow.h> | 32 | #include <qmainwindow.h> |
33 | #include <qpixmap.h> | 33 | #include <qpixmap.h> |
34 | #include "cfg.h" | ||
34 | 35 | ||
35 | class CBInfo; | 36 | class CBInfo; |
36 | class CBInfoList; | 37 | class CBInfoList; |
37 | class QAction; | 38 | class QAction; |
38 | class QListView; | 39 | class QListView; |
39 | class QString; | 40 | class QString; |
41 | class QListViewItem; | ||
40 | 42 | ||
41 | class MainWindow : public QMainWindow | 43 | class MainWindow : public QMainWindow |
42 | { | 44 | { |
43 | Q_OBJECT | 45 | Q_OBJECT |
44 | 46 | ||
45 | public: | 47 | public: |
46 | MainWindow(); | 48 | MainWindow(QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); |
47 | ~MainWindow(); | 49 | ~MainWindow(); |
50 | static QString appName() { return QString::fromLatin1("checkbook"); }; | ||
51 | |||
52 | // safe config | ||
53 | void writeConfig(); | ||
54 | |||
55 | // open a check book | ||
56 | void openBook(QListViewItem *curr); | ||
48 | 57 | ||
49 | private: | 58 | private: |
50 | QListView *cbList; | 59 | QListView *cbList; |
@@ -52,9 +61,7 @@ class MainWindow : public QMainWindow | |||
52 | QAction *actionOpen; | 61 | QAction *actionOpen; |
53 | QAction *actionDelete; | 62 | QAction *actionDelete; |
54 | 63 | ||
55 | QString currencySymbol; | 64 | Cfg _cfg; |
56 | bool showLocks; | ||
57 | bool showBalances; | ||
58 | int posName; | 65 | int posName; |
59 | 66 | ||
60 | CBInfoList *checkbooks; | 67 | CBInfoList *checkbooks; |
diff --git a/noncore/apps/checkbook/tabledef.cpp b/noncore/apps/checkbook/tabledef.cpp new file mode 100644 index 0000000..13edded --- a/dev/null +++ b/noncore/apps/checkbook/tabledef.cpp | |||
@@ -0,0 +1,76 @@ | |||
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 | #include "tabledef.h" | ||
30 | |||
31 | #include <qstring.h> | ||
32 | #include <qpe/resource.h> | ||
33 | |||
34 | // --- ColumnDef -------------------------------------------------------------- | ||
35 | ColumnDef::ColumnDef(const char *sName, ColumnType type, const char *sNewValue) | ||
36 | { | ||
37 | _sName=sName; | ||
38 | _type=type; | ||
39 | _sNewValue=sNewValue; | ||
40 | } | ||
41 | |||
42 | |||
43 | // --- addColumnValue --------------------------------------------------------- | ||
44 | void ColumnDef::addColumnValue(const QString &sValue) | ||
45 | { | ||
46 | if( (_type & 0x00ffffff) !=typeList ) | ||
47 | qDebug("Column %s is not a list", (const char *)_sName); | ||
48 | else | ||
49 | _valueList.append(sValue); | ||
50 | } | ||
51 | void ColumnDef::addColumnValue(const char *sValue) | ||
52 | { | ||
53 | if( (_type & 0x00ffffff)!=typeList ) | ||
54 | qDebug("Column %s is not a list", (const char *)_sName); | ||
55 | else | ||
56 | _valueList.append(sValue); | ||
57 | } | ||
58 | |||
59 | // --- TableDef --------------------------------------------------------------- | ||
60 | TableDef::TableDef(const char *sName) | ||
61 | { | ||
62 | _sName=sName; | ||
63 | _vColumns.setAutoDelete(TRUE); | ||
64 | } | ||
65 | |||
66 | |||
67 | // --- ~TableDef -------------------------------------------------------------- | ||
68 | TableDef::~TableDef() | ||
69 | { | ||
70 | } | ||
71 | |||
72 | // --- addColumnDef ----------------------------------------------------------- | ||
73 | void TableDef::addColumnDef(ColumnDef *pDef) | ||
74 | { | ||
75 | _vColumns.append(pDef); | ||
76 | } | ||
diff --git a/noncore/apps/checkbook/tabledef.h b/noncore/apps/checkbook/tabledef.h new file mode 100644 index 0000000..5891ad7 --- a/dev/null +++ b/noncore/apps/checkbook/tabledef.h | |||
@@ -0,0 +1,99 @@ | |||
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 TABLEDEF_H | ||
30 | #define TABLEDEF_H | ||
31 | |||
32 | #include <qstring.h> | ||
33 | #include <qstringlist.h> | ||
34 | #include <qlist.h> | ||
35 | |||
36 | |||
37 | |||
38 | // --- ColumnDef ------------------------------------------------------------- | ||
39 | class ColumnDef | ||
40 | { | ||
41 | public: | ||
42 | enum ColumnType { | ||
43 | typeString=0x1, | ||
44 | typeList=0x2, | ||
45 | typeUnique=0x80000000 | ||
46 | }; | ||
47 | |||
48 | // Constructor | ||
49 | ColumnDef(const char *sName, ColumnType type, const char *sNewValue); | ||
50 | |||
51 | // add column value | ||
52 | void addColumnValue(const QString &Value); | ||
53 | void addColumnValue(const char *sValue); | ||
54 | |||
55 | // member functions | ||
56 | const QString getName() { return(_sName); } | ||
57 | const QString getNewValue() { return(_sNewValue); } | ||
58 | |||
59 | // test for type | ||
60 | int isType(ColumnType x) { return( (_type & 0x00ffffff)==x ); } | ||
61 | int hasFlag(ColumnType x) { return( (_type & x) ); } | ||
62 | |||
63 | // get value list | ||
64 | QStringList &getValueList() { return(_valueList); } | ||
65 | |||
66 | private: | ||
67 | QString _sName; | ||
68 | QString _sNewValue; | ||
69 | enum ColumnType _type; | ||
70 | QStringList _valueList; | ||
71 | }; | ||
72 | |||
73 | typedef QList<ColumnDef> ColumnDefList; | ||
74 | |||
75 | |||
76 | // --- TableDef --------------------------------------------------------------- | ||
77 | class TableDef | ||
78 | { | ||
79 | public: | ||
80 | // Constructor & Destructor | ||
81 | TableDef(const char *sName); | ||
82 | virtual ~TableDef(); | ||
83 | |||
84 | // adds a column definition | ||
85 | virtual void addColumnDef(ColumnDef *pDef); | ||
86 | |||
87 | // movement operators | ||
88 | ColumnDef *first() { return(_vColumns.first() ); } | ||
89 | ColumnDef *last() { return(_vColumns.last() ); } | ||
90 | ColumnDef *next() { return(_vColumns.next() ); } | ||
91 | ColumnDef *prev() { return(_vColumns.prev() ); } | ||
92 | ColumnDef *at(int i) { return(_vColumns.at(i)); } | ||
93 | |||
94 | protected: | ||
95 | QString _sName; | ||
96 | ColumnDefList _vColumns; | ||
97 | }; | ||
98 | |||
99 | #endif | ||
diff --git a/noncore/apps/checkbook/traninfo.cpp b/noncore/apps/checkbook/traninfo.cpp index 65c190c..d880bb4 100644 --- a/noncore/apps/checkbook/traninfo.cpp +++ b/noncore/apps/checkbook/traninfo.cpp | |||
@@ -34,7 +34,7 @@ QString tempstr; | |||
34 | 34 | ||
35 | TranInfo::TranInfo( int id, const QString &desc, const QDate &date, bool withdrawal, | 35 | TranInfo::TranInfo( int id, const QString &desc, const QDate &date, bool withdrawal, |
36 | const QString &type, const QString &category, float amount, | 36 | const QString &type, const QString &category, float amount, |
37 | float fee, const QString &number, const QString ¬es ) | 37 | float fee, const QString &number, const QString ¬es, int next ) |
38 | { | 38 | { |
39 | i = id; | 39 | i = id; |
40 | d = desc; | 40 | d = desc; |
@@ -46,6 +46,7 @@ TranInfo::TranInfo( int id, const QString &desc, const QDate &date, bool withdra | |||
46 | f = fee; | 46 | f = fee; |
47 | cn = number; | 47 | cn = number; |
48 | n = notes; | 48 | n = notes; |
49 | _next=next; | ||
49 | } | 50 | } |
50 | 51 | ||
51 | TranInfo::TranInfo( Config config, int entry ) | 52 | TranInfo::TranInfo( Config config, int entry ) |
@@ -116,27 +117,32 @@ TranInfo::TranInfo( Config config, int entry ) | |||
116 | 117 | ||
117 | // Notes | 118 | // Notes |
118 | n = config.readEntry( "Comments", "" ); | 119 | n = config.readEntry( "Comments", "" ); |
120 | |||
121 | // next | ||
122 | _next = config.readNumEntry("Next", -1); | ||
119 | } | 123 | } |
120 | } | 124 | } |
121 | 125 | ||
126 | // --- datestr ---------------------------------------------------------------- | ||
122 | const QString &TranInfo::datestr() | 127 | const QString &TranInfo::datestr() |
123 | { | 128 | { |
124 | tempstr = QString::number( td.year() ); | 129 | int y=td.year(); |
125 | tempstr.append( '/' ); | 130 | y= y>=2000 && y<=2099 ? y-2000 : y; |
126 | int tempfield = td.month(); | 131 | tempstr.sprintf( "%02d/%02d/%02d", y ,td.month(), td.day() ); |
127 | if ( tempfield < 10 ) tempstr.append( '0' ); | 132 | return( tempstr ); |
128 | tempstr.append( QString::number( tempfield ) ); | 133 | } |
129 | tempstr.append( '/' ); | ||
130 | tempfield = td.day(); | ||
131 | if ( tempfield < 10 ) tempstr.append( '0' ); | ||
132 | tempstr.append( QString::number( tempfield ) ); | ||
133 | 134 | ||
135 | // --- getIdStr --------------------------------------------------------------- | ||
136 | const QString &TranInfo::getIdStr() | ||
137 | { | ||
138 | tempstr.sprintf("%04d", i); | ||
134 | return( tempstr ); | 139 | return( tempstr ); |
135 | } | 140 | } |
136 | 141 | ||
137 | void TranInfo::write( Config *config, int entry ) | 142 | // --- write ------------------------------------------------------------------ |
143 | void TranInfo::write( Config *config ) | ||
138 | { | 144 | { |
139 | config->setGroup( QString::number( entry ) ); | 145 | config->setGroup( QString::number( id() ) ); |
140 | 146 | ||
141 | config->writeEntry( "Description", d ); | 147 | config->writeEntry( "Description", d ); |
142 | 148 | ||
@@ -170,10 +176,11 @@ void TranInfo::write( Config *config, int entry ) | |||
170 | config->writeEntry( "TransactionFee", tempstr ); | 176 | config->writeEntry( "TransactionFee", tempstr ); |
171 | 177 | ||
172 | config->writeEntry( "CheckNumber", cn ); | 178 | config->writeEntry( "CheckNumber", cn ); |
173 | |||
174 | config->writeEntry( "Comments", n ); | 179 | config->writeEntry( "Comments", n ); |
180 | config->writeEntry( "Next", _next ); | ||
175 | } | 181 | } |
176 | 182 | ||
183 | |||
177 | int TranInfoList::compareItems( QCollection::Item item1, QCollection::Item item2 ) | 184 | int TranInfoList::compareItems( QCollection::Item item1, QCollection::Item item2 ) |
178 | { | 185 | { |
179 | QDate d1 = ((TranInfo *)item1)->date(); | 186 | QDate d1 = ((TranInfo *)item1)->date(); |
@@ -188,3 +195,18 @@ int TranInfoList::compareItems( QCollection::Item item1, QCollection::Item item2 | |||
188 | r = 1; | 195 | r = 1; |
189 | return( r ); | 196 | return( r ); |
190 | } | 197 | } |
198 | |||
199 | // --- toString --------------------------------------------------------------- | ||
200 | QString TranInfo::toString() | ||
201 | { | ||
202 | QString ret; | ||
203 | ret.sprintf("(%4d) %10s %4s %-10s %5.2f %5.2f", | ||
204 | id(), | ||
205 | (const char *)datestr(), | ||
206 | (const char *)number(), | ||
207 | (const char *)desc(), | ||
208 | (withdrawal() ? -1 : 1) * amount(), | ||
209 | fee() | ||
210 | ); | ||
211 | return(ret); | ||
212 | } | ||
diff --git a/noncore/apps/checkbook/traninfo.h b/noncore/apps/checkbook/traninfo.h index f6c5cae..0abdc61 100644 --- a/noncore/apps/checkbook/traninfo.h +++ b/noncore/apps/checkbook/traninfo.h | |||
@@ -40,10 +40,13 @@ class TranInfo | |||
40 | TranInfo( int = 0, const QString & = 0x0, const QDate & = QDate::currentDate(), | 40 | TranInfo( int = 0, const QString & = 0x0, const QDate & = QDate::currentDate(), |
41 | bool = TRUE, const QString & = 0x0, const QString & = 0x0, | 41 | bool = TRUE, const QString & = 0x0, const QString & = 0x0, |
42 | float = 0.0, float = 0.0, | 42 | float = 0.0, float = 0.0, |
43 | const QString & = 0x0, const QString & = 0x0 ); | 43 | const QString & = 0x0, const QString & = 0x0, int =-1 ); |
44 | TranInfo( Config, int ); | 44 | TranInfo( Config, int ); |
45 | 45 | ||
46 | // getters | ||
46 | int id() const { return i; } | 47 | int id() const { return i; } |
48 | const QString &getIdStr(); | ||
49 | |||
47 | const QString &desc() const { return d; } | 50 | const QString &desc() const { return d; } |
48 | const QDate &date() const { return td; } | 51 | const QDate &date() const { return td; } |
49 | const QString &datestr(); | 52 | const QString &datestr(); |
@@ -54,7 +57,9 @@ class TranInfo | |||
54 | float fee() const { return f; } | 57 | float fee() const { return f; } |
55 | const QString &number()const { return cn; } | 58 | const QString &number()const { return cn; } |
56 | const QString ¬es() const { return n; } | 59 | const QString ¬es() const { return n; } |
60 | int getNext() { return(_next); } | ||
57 | 61 | ||
62 | // setters | ||
58 | void setDesc( const QString &desc ) { d = desc; } | 63 | void setDesc( const QString &desc ) { d = desc; } |
59 | void setDate( const QDate &date ) { td = date; } | 64 | void setDate( const QDate &date ) { td = date; } |
60 | void setWithdrawal( bool withdrawal ) { w = withdrawal; } | 65 | void setWithdrawal( bool withdrawal ) { w = withdrawal; } |
@@ -64,8 +69,13 @@ class TranInfo | |||
64 | void setFee( float fee ) { f = fee; } | 69 | void setFee( float fee ) { f = fee; } |
65 | void setNumber( const QString &num ) { cn = num; } | 70 | void setNumber( const QString &num ) { cn = num; } |
66 | void setNotes( const QString ¬es ) { n = notes; } | 71 | void setNotes( const QString ¬es ) { n = notes; } |
72 | void setNext(int next) { _next=next; } | ||
73 | |||
74 | // write | ||
75 | void write( Config * ); | ||
67 | 76 | ||
68 | void write( Config *, int ); | 77 | // toString |
78 | QString toString(); | ||
69 | 79 | ||
70 | private: | 80 | private: |
71 | int i; | 81 | int i; |
@@ -78,6 +88,7 @@ class TranInfo | |||
78 | float f; | 88 | float f; |
79 | QString cn; | 89 | QString cn; |
80 | QString n; | 90 | QString n; |
91 | int _next; | ||
81 | }; | 92 | }; |
82 | 93 | ||
83 | class TranInfoList : public QList<TranInfo> | 94 | class TranInfoList : public QList<TranInfo> |
diff --git a/noncore/apps/checkbook/transaction.cpp b/noncore/apps/checkbook/transaction.cpp index c94b989..138d0e6 100644 --- a/noncore/apps/checkbook/transaction.cpp +++ b/noncore/apps/checkbook/transaction.cpp | |||
@@ -28,6 +28,7 @@ | |||
28 | 28 | ||
29 | #include "transaction.h" | 29 | #include "transaction.h" |
30 | #include "traninfo.h" | 30 | #include "traninfo.h" |
31 | #include "cfg.h" | ||
31 | 32 | ||
32 | #include <qpe/datebookmonth.h> | 33 | #include <qpe/datebookmonth.h> |
33 | 34 | ||
@@ -41,7 +42,7 @@ | |||
41 | #include <qwhatsthis.h> | 42 | #include <qwhatsthis.h> |
42 | 43 | ||
43 | Transaction::Transaction( QWidget *parent, const QString &acctname, TranInfo *info, | 44 | Transaction::Transaction( QWidget *parent, const QString &acctname, TranInfo *info, |
44 | const QString &symbol ) | 45 | Cfg *pCfg ) |
45 | : QDialog( parent, 0, TRUE, WStyle_ContextHelp ) | 46 | : QDialog( parent, 0, TRUE, WStyle_ContextHelp ) |
46 | { | 47 | { |
47 | QString tempstr = tr( "Transaction for " ); | 48 | QString tempstr = tr( "Transaction for " ); |
@@ -49,7 +50,7 @@ Transaction::Transaction( QWidget *parent, const QString &acctname, TranInfo *in | |||
49 | setCaption( tempstr ); | 50 | setCaption( tempstr ); |
50 | 51 | ||
51 | tran = info; | 52 | tran = info; |
52 | currencySymbol = symbol; | 53 | _pCfg=pCfg; |
53 | 54 | ||
54 | QVBoxLayout *vb = new QVBoxLayout( this ); | 55 | QVBoxLayout *vb = new QVBoxLayout( this ); |
55 | 56 | ||
@@ -230,21 +231,13 @@ void Transaction::accept() | |||
230 | void Transaction::slotWithdrawalClicked() | 231 | void Transaction::slotWithdrawalClicked() |
231 | { | 232 | { |
232 | catList->clear(); | 233 | catList->clear(); |
233 | catList->insertItem( tr( "Automobile" ) ); | 234 | CategoryList *pCatList=_pCfg->getCategoryList(); |
234 | catList->insertItem( tr( "Bills" ) ); | 235 | for(Category *pCat=pCatList->first(); pCat; pCat=pCatList->next()) { |
235 | catList->insertItem( tr( "CDs" ) ); | 236 | if( !pCat->isIncome() ) |
236 | catList->insertItem( tr( "Clothing" ) ); | 237 | catList->insertItem( pCat->getName() ); |
237 | catList->insertItem( tr( "Computer" ) ); | 238 | } |
238 | catList->insertItem( tr( "DVDs" ) ); | ||
239 | catList->insertItem( tr( "Electronics" ) ); | ||
240 | catList->insertItem( tr( "Entertainment" ) ); | ||
241 | catList->insertItem( tr( "Food" ) ); | ||
242 | catList->insertItem( tr( "Gasoline" ) ); | ||
243 | catList->insertItem( tr( "Misc" ) ); | ||
244 | catList->insertItem( tr( "Movies" ) ); | ||
245 | catList->insertItem( tr( "Rent" ) ); | ||
246 | catList->insertItem( tr( "Travel" ) ); | ||
247 | catList->setCurrentItem( 0 ); | 239 | catList->setCurrentItem( 0 ); |
240 | |||
248 | typeList->clear(); | 241 | typeList->clear(); |
249 | typeList->insertItem( tr( "Debit Charge" ) ); | 242 | typeList->insertItem( tr( "Debit Charge" ) ); |
250 | typeList->insertItem( tr( "Written Check" ) ); | 243 | typeList->insertItem( tr( "Written Check" ) ); |
@@ -255,10 +248,13 @@ void Transaction::slotWithdrawalClicked() | |||
255 | void Transaction::slotDepositClicked() | 248 | void Transaction::slotDepositClicked() |
256 | { | 249 | { |
257 | catList->clear(); | 250 | catList->clear(); |
258 | catList->insertItem( tr( "Work" ) ); | 251 | CategoryList *pCatList=_pCfg->getCategoryList(); |
259 | catList->insertItem( tr( "Family Member" ) ); | 252 | for(Category *pCat=pCatList->first(); pCat; pCat=pCatList->next()) { |
260 | catList->insertItem( tr( "Misc. Credit" ) ); | 253 | if( pCat->isIncome() ) |
254 | catList->insertItem( pCat->getName() ); | ||
255 | } | ||
261 | catList->setCurrentItem( 0 ); | 256 | catList->setCurrentItem( 0 ); |
257 | |||
262 | typeList->clear(); | 258 | typeList->clear(); |
263 | typeList->insertItem( tr( "Written Check" ) ); | 259 | typeList->insertItem( tr( "Written Check" ) ); |
264 | typeList->insertItem( tr( "Automatic Payment" ) ); | 260 | typeList->insertItem( tr( "Automatic Payment" ) ); |
diff --git a/noncore/apps/checkbook/transaction.h b/noncore/apps/checkbook/transaction.h index 000aee7..fbe9cd3 100644 --- a/noncore/apps/checkbook/transaction.h +++ b/noncore/apps/checkbook/transaction.h | |||
@@ -40,20 +40,20 @@ class QRadioButton; | |||
40 | class QString; | 40 | class QString; |
41 | class QWidget; | 41 | class QWidget; |
42 | class TranInfo; | 42 | class TranInfo; |
43 | class Cfg; | ||
43 | 44 | ||
44 | class Transaction : public QDialog | 45 | class Transaction : public QDialog |
45 | { | 46 | { |
46 | Q_OBJECT | 47 | Q_OBJECT |
47 | 48 | ||
48 | public: | 49 | public: |
49 | Transaction( QWidget * = 0x0, const QString & = 0x0, TranInfo * = 0x0, | 50 | Transaction( QWidget *, const QString &, TranInfo *, Cfg *); |
50 | const QString & = "$" ); | ||
51 | ~Transaction(); | 51 | ~Transaction(); |
52 | 52 | ||
53 | private: | 53 | private: |
54 | TranInfo *tran; | 54 | TranInfo *tran; |
55 | 55 | ||
56 | QString currencySymbol; | 56 | Cfg *_pCfg; |
57 | 57 | ||
58 | QRadioButton *withBtn; | 58 | QRadioButton *withBtn; |
59 | QRadioButton *depBtn; | 59 | QRadioButton *depBtn; |
diff --git a/noncore/apps/odict/main.cpp b/noncore/apps/odict/main.cpp index c68253f..0642022 100644 --- a/noncore/apps/odict/main.cpp +++ b/noncore/apps/odict/main.cpp | |||
@@ -17,13 +17,8 @@ | |||
17 | 17 | ||
18 | 18 | ||
19 | #include <qpe/qpeapplication.h> | 19 | #include <qpe/qpeapplication.h> |
20 | #include <opie/oapplicationfactory.h> | ||
20 | #include "odict.h" | 21 | #include "odict.h" |
21 | 22 | ||
22 | int main(int argc, char **argv) | 23 | |
23 | { | 24 | OPIE_EXPORT_APP( OApplicationFactory<ODict> ) |
24 | QPEApplication app(argc, argv); | ||
25 | ODict *odict= new ODict(); | ||
26 | app.setMainWidget(odict); | ||
27 | odict->showMaximized(); | ||
28 | return app.exec(); | ||
29 | } | ||
diff --git a/noncore/apps/odict/odict.cpp b/noncore/apps/odict/odict.cpp index 010545e..9718c5c 100644 --- a/noncore/apps/odict/odict.cpp +++ b/noncore/apps/odict/odict.cpp | |||
@@ -36,7 +36,7 @@ | |||
36 | #include <qpe/resource.h> | 36 | #include <qpe/resource.h> |
37 | #include <qpe/config.h> | 37 | #include <qpe/config.h> |
38 | 38 | ||
39 | ODict::ODict() : QMainWindow() | 39 | ODict::ODict(QWidget* parent, const char* name, WFlags fl ) : QMainWindow(parent, name, fl ) |
40 | { | 40 | { |
41 | activated_name = QString::null; | 41 | activated_name = QString::null; |
42 | 42 | ||
diff --git a/noncore/apps/odict/odict.h b/noncore/apps/odict/odict.h index be2a532..68a8f95 100644 --- a/noncore/apps/odict/odict.h +++ b/noncore/apps/odict/odict.h | |||
@@ -29,12 +29,12 @@ class ODict : public QMainWindow | |||
29 | Q_OBJECT | 29 | Q_OBJECT |
30 | 30 | ||
31 | public: | 31 | public: |
32 | ODict(); | 32 | ODict(QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); |
33 | QVBox *vbox; | 33 | QVBox *vbox; |
34 | QTextBrowser *browser_top, | 34 | QTextBrowser *browser_top, |
35 | *browser_bottom; | 35 | *browser_bottom; |
36 | DingWidget *ding; | 36 | DingWidget *ding; |
37 | 37 | static QString appName() { return QString::fromLatin1("odict"); } | |
38 | private: | 38 | private: |
39 | QPopupMenu *help, *settings, *parameter; | 39 | QPopupMenu *help, *settings, *parameter; |
40 | QMenuBar *menu; | 40 | QMenuBar *menu; |
diff --git a/noncore/apps/odict/odict.pro b/noncore/apps/odict/odict.pro index 82f6a41..4ad287b 100644 --- a/noncore/apps/odict/odict.pro +++ b/noncore/apps/odict/odict.pro | |||
@@ -1,6 +1,4 @@ | |||
1 | TEMPLATE= app | 1 | CONFIG = qt warn_on release quick-app |
2 | CONFIG = qt warn_on debug | ||
3 | #CONFIG = qt warn_on release | ||
4 | HEADERS = odict.h \ | 2 | HEADERS = odict.h \ |
5 | searchmethoddlg.h \ | 3 | searchmethoddlg.h \ |
6 | configdlg.h \ | 4 | configdlg.h \ |
@@ -15,7 +13,6 @@ INCLUDEPATH += $(OPIEDIR)/include | |||
15 | DEPENDPATH += $(OPIEDIR)/include | 13 | DEPENDPATH += $(OPIEDIR)/include |
16 | LIBS += -lqpe -lstdc++ -lopie | 14 | LIBS += -lqpe -lstdc++ -lopie |
17 | TARGET = odict | 15 | TARGET = odict |
18 | DESTDIR = $(OPIEDIR)/bin | ||
19 | 16 | ||
20 | TRANSLATIONS = ../../../i18n/de/odict.ts \ | 17 | TRANSLATIONS = ../../../i18n/de/odict.ts \ |
21 | ../../../i18n/nl/odict.ts \ | 18 | ../../../i18n/nl/odict.ts \ |
diff --git a/noncore/apps/opie-console/opie-console.control b/noncore/apps/opie-console/opie-console.control index 3934fa1..504de85 100644 --- a/noncore/apps/opie-console/opie-console.control +++ b/noncore/apps/opie-console/opie-console.control | |||
@@ -1,5 +1,5 @@ | |||
1 | Package: opie-console | 1 | Package: opie-console |
2 | Files: plugins/application/libopie-console.so* bin/opie-console apps/Applications/opie-console.desktop pics/console/* | 2 | Files: bin/opie-console apps/Applications/opie-console.desktop pics/console/* |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/applications | 4 | Section: opie/applications |
5 | Maintainer: Opie team <opie@handhelds.org> | 5 | Maintainer: Opie team <opie@handhelds.org> |
diff --git a/noncore/apps/opie-reader/opie-reader.pro b/noncore/apps/opie-reader/opie-reader.pro index 62113c3..686f083 100644 --- a/noncore/apps/opie-reader/opie-reader.pro +++ b/noncore/apps/opie-reader/opie-reader.pro | |||
@@ -1,4 +1,3 @@ | |||
1 | TEMPLATE= app | ||
2 | CONFIG = qt warn_on release | 1 | CONFIG = qt warn_on release |
3 | HEADERS = Aportis.h \ | 2 | HEADERS = Aportis.h \ |
4 | Bkmks.h \ | 3 | Bkmks.h \ |
@@ -81,11 +80,11 @@ SOURCES = Aportis.cpp \ | |||
81 | version.cpp \ | 80 | version.cpp \ |
82 | ztxt.cpp | 81 | ztxt.cpp |
83 | 82 | ||
84 | INTERFACES= | ||
85 | DESTDIR = $(OPIEDIR)/bin | 83 | DESTDIR = $(OPIEDIR)/bin |
84 | TARGET = reader | ||
85 | |||
86 | INCLUDEPATH+= $(OPIEDIR)/include | 86 | INCLUDEPATH+= $(OPIEDIR)/include |
87 | DEPENDPATH+= $(OPIEDIR)/include | 87 | DEPENDPATH+= $(OPIEDIR)/include |
88 | TARGET = reader | ||
89 | LIBS += -lqpe | 88 | LIBS += -lqpe |
90 | 89 | ||
91 | include ( $(OPIEDIR)/include.pro ) | 90 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/noncore/apps/opie-sheet/main.cpp b/noncore/apps/opie-sheet/main.cpp index e42b4a5..d0a2995 100644 --- a/noncore/apps/opie-sheet/main.cpp +++ b/noncore/apps/opie-sheet/main.cpp | |||
@@ -16,13 +16,7 @@ | |||
16 | 16 | ||
17 | #include "mainwindow.h" | 17 | #include "mainwindow.h" |
18 | 18 | ||
19 | int main(int argc, char **argv) | 19 | #include <opie/oapplicationfactory.h> |
20 | { | ||
21 | QPEApplication application(argc, argv); | ||
22 | 20 | ||
23 | MainWindow windowMain; | 21 | OPIE_EXPORT_APP( OApplicationFactory<MainWindow> ) |
24 | windowMain.setHelpFile(application.qpeDir()+"/help/html/"+QString(argv[0])+".html"); | ||
25 | application.showMainDocumentWidget(&windowMain); | ||
26 | 22 | ||
27 | return application.exec(); | ||
28 | } | ||
diff --git a/noncore/apps/opie-sheet/mainwindow.cpp b/noncore/apps/opie-sheet/mainwindow.cpp index 43e5131..3915e52 100644 --- a/noncore/apps/opie-sheet/mainwindow.cpp +++ b/noncore/apps/opie-sheet/mainwindow.cpp | |||
@@ -43,8 +43,8 @@ | |||
43 | #define DEFAULT_NUM_COLS (26*3) | 43 | #define DEFAULT_NUM_COLS (26*3) |
44 | #define DEFAULT_NUM_SHEETS 3 | 44 | #define DEFAULT_NUM_SHEETS 3 |
45 | 45 | ||
46 | MainWindow::MainWindow() | 46 | MainWindow::MainWindow(QWidget *parent, const char* n, WFlags fl) |
47 | :QMainWindow() | 47 | :QMainWindow(parent, n, fl) |
48 | { | 48 | { |
49 | // initialize variables | 49 | // initialize variables |
50 | documentModified=FALSE; | 50 | documentModified=FALSE; |
diff --git a/noncore/apps/opie-sheet/mainwindow.h b/noncore/apps/opie-sheet/mainwindow.h index 10d6650..370d82e 100644 --- a/noncore/apps/opie-sheet/mainwindow.h +++ b/noncore/apps/opie-sheet/mainwindow.h | |||
@@ -120,7 +120,8 @@ class MainWindow: public QMainWindow | |||
120 | void selectorFileOpen(const DocLnk &lnkDoc); | 120 | void selectorFileOpen(const DocLnk &lnkDoc); |
121 | 121 | ||
122 | public: | 122 | public: |
123 | MainWindow(); | 123 | static QString appName() { return QString::fromLatin1("sheetqt"); } |
124 | MainWindow(QWidget *p, const char*, WFlags); | ||
124 | ~MainWindow(); | 125 | ~MainWindow(); |
125 | 126 | ||
126 | void setHelpFile(const QString &help_filename) { helpFile=help_filename; } | 127 | void setHelpFile(const QString &help_filename) { helpFile=help_filename; } |
diff --git a/noncore/apps/opie-sheet/opie-sheet.pro b/noncore/apps/opie-sheet/opie-sheet.pro index 1435af6..acd5fa0 100644 --- a/noncore/apps/opie-sheet/opie-sheet.pro +++ b/noncore/apps/opie-sheet/opie-sheet.pro | |||
@@ -1,6 +1,4 @@ | |||
1 | TEMPLATE= app | 1 | CONFIG = qt warn_on release quick-app |
2 | CONFIG = qt warn_on release | ||
3 | DESTDIR = $(OPIEDIR)/bin | ||
4 | HEADERS = mainwindow.h sheet.h cellformat.h finddlg.h numberdlg.h sortdlg.h textdlg.h | 2 | HEADERS = mainwindow.h sheet.h cellformat.h finddlg.h numberdlg.h sortdlg.h textdlg.h |
5 | SOURCES = main.cpp mainwindow.cpp sheet.cpp cellformat.cpp finddlg.cpp numberdlg.cpp sortdlg.cpp textdlg.cpp | 3 | SOURCES = main.cpp mainwindow.cpp sheet.cpp cellformat.cpp finddlg.cpp numberdlg.cpp sortdlg.cpp textdlg.cpp |
6 | INCLUDEPATH+= $(OPIEDIR)/include | 4 | INCLUDEPATH+= $(OPIEDIR)/include |
diff --git a/noncore/apps/opie-write/main.cpp b/noncore/apps/opie-write/main.cpp index 027af38..2cdfa55 100644 --- a/noncore/apps/opie-write/main.cpp +++ b/noncore/apps/opie-write/main.cpp | |||
@@ -20,18 +20,9 @@ | |||
20 | **********************************************************************/ | 20 | **********************************************************************/ |
21 | 21 | ||
22 | #include <qpe/qpeapplication.h> | 22 | #include <qpe/qpeapplication.h> |
23 | #include <qpe/fileselector.h> | 23 | #include <opie/oapplicationfactory.h> |
24 | #include "mainwindow.h" | 24 | #include "mainwindow.h" |
25 | 25 | ||
26 | int main( int argc, char ** argv ) | 26 | OPIE_EXPORT_APP( OApplicationFactory<MainWindow> ) |
27 | { | ||
28 | QPEApplication a( argc, argv ); | ||
29 | 27 | ||
30 | MainWindow e; | ||
31 | a.showMainDocumentWidget(&e); | ||
32 | 28 | ||
33 | QObject::connect( &a, SIGNAL( lastWindowClosed() ), | ||
34 | &a, SLOT( quit() ) ); | ||
35 | |||
36 | a.exec(); | ||
37 | } | ||
diff --git a/noncore/apps/opie-write/mainwindow.cpp b/noncore/apps/opie-write/mainwindow.cpp index 4a49abf..6bb524f 100644 --- a/noncore/apps/opie-write/mainwindow.cpp +++ b/noncore/apps/opie-write/mainwindow.cpp | |||
@@ -100,8 +100,8 @@ private: | |||
100 | 100 | ||
101 | //=========================================================================== | 101 | //=========================================================================== |
102 | 102 | ||
103 | MainWindow::MainWindow( QWidget *parent, const char *name ) | 103 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags fl ) |
104 | : QMainWindow( parent, name ), | 104 | : QMainWindow( parent, name, fl ), |
105 | doc( 0 ) | 105 | doc( 0 ) |
106 | { | 106 | { |
107 | setRightJustification(TRUE); | 107 | setRightJustification(TRUE); |
diff --git a/noncore/apps/opie-write/mainwindow.h b/noncore/apps/opie-write/mainwindow.h index 565ad05..17713d8 100644 --- a/noncore/apps/opie-write/mainwindow.h +++ b/noncore/apps/opie-write/mainwindow.h | |||
@@ -45,9 +45,11 @@ class MainWindow : public QMainWindow | |||
45 | Q_OBJECT | 45 | Q_OBJECT |
46 | 46 | ||
47 | public: | 47 | public: |
48 | MainWindow( QWidget *parent = 0, const char *name = 0 ); | 48 | MainWindow( QWidget *parent = 0, const char *name = 0 , WFlags fl = 0); |
49 | ~MainWindow(); | 49 | ~MainWindow(); |
50 | 50 | ||
51 | static QString appName() { return QString::fromLatin1("opie-write"); } | ||
52 | |||
51 | protected: | 53 | protected: |
52 | void closeEvent( QCloseEvent *e ); | 54 | void closeEvent( QCloseEvent *e ); |
53 | 55 | ||
diff --git a/noncore/apps/opie-write/opie-write.pro b/noncore/apps/opie-write/opie-write.pro index 21a3c3a..bbaacd3 100644 --- a/noncore/apps/opie-write/opie-write.pro +++ b/noncore/apps/opie-write/opie-write.pro | |||
@@ -1,7 +1,6 @@ | |||
1 | TEMPLATE= app | ||
2 | CONFIG += qt warn_on release | ||
3 | 1 | ||
4 | DESTDIR = $(OPIEDIR)/bin | 2 | CONFIG += qt warn on release quick-app |
3 | |||
5 | 4 | ||
6 | HEADERS =qcleanuphandler.h \ | 5 | HEADERS =qcleanuphandler.h \ |
7 | qcomplextext_p.h \ | 6 | qcomplextext_p.h \ |
@@ -24,23 +23,5 @@ LIBS += -lqpe | |||
24 | 23 | ||
25 | TARGET = opie-write | 24 | TARGET = opie-write |
26 | 25 | ||
27 | TRANSLATIONS = ../../../i18n/de/opie-write.ts \ | ||
28 | ../../../i18n/nl/opie-write.ts \ | ||
29 | ../../../i18n/da/opie-write.ts \ | ||
30 | ../../../i18n/xx/opie-write.ts \ | ||
31 | ../../../i18n/en/opie-write.ts \ | ||
32 | ../../../i18n/es/opie-write.ts \ | ||
33 | ../../../i18n/fr/opie-write.ts \ | ||
34 | ../../../i18n/hu/opie-write.ts \ | ||
35 | ../../../i18n/ja/opie-write.ts \ | ||
36 | ../../../i18n/ko/opie-write.ts \ | ||
37 | ../../../i18n/no/opie-write.ts \ | ||
38 | ../../../i18n/pl/opie-write.ts \ | ||
39 | ../../../i18n/pt/opie-write.ts \ | ||
40 | ../../../i18n/pt_BR/opie-write.ts \ | ||
41 | ../../../i18n/sl/opie-write.ts \ | ||
42 | ../../../i18n/zh_CN/opie-write.ts \ | ||
43 | ../../../i18n/zh_TW/opie-write.ts | ||
44 | |||
45 | 26 | ||
46 | include ( $(OPIEDIR)/include.pro ) | 27 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/noncore/apps/oxygen/main.cpp b/noncore/apps/oxygen/main.cpp index c8fcdb4..ac992aa 100644 --- a/noncore/apps/oxygen/main.cpp +++ b/noncore/apps/oxygen/main.cpp | |||
@@ -17,13 +17,8 @@ | |||
17 | 17 | ||
18 | 18 | ||
19 | #include <qpe/qpeapplication.h> | 19 | #include <qpe/qpeapplication.h> |
20 | #include <opie/oapplicationfactory.h> | ||
20 | #include "oxygen.h" | 21 | #include "oxygen.h" |
21 | 22 | ||
22 | int main(int argc, char **argv) | 23 | |
23 | { | 24 | OPIE_EXPORT_APP( OApplicationFactory<Oxygen> ) |
24 | QPEApplication app(argc, argv); | ||
25 | Oxygen *oxi = new Oxygen(); | ||
26 | app.setMainWidget(oxi); | ||
27 | oxi->showMaximized(); | ||
28 | return app.exec(); | ||
29 | } | ||
diff --git a/noncore/apps/oxygen/oxygen.cpp b/noncore/apps/oxygen/oxygen.cpp index 5999cb0..5bdc2aa 100644 --- a/noncore/apps/oxygen/oxygen.cpp +++ b/noncore/apps/oxygen/oxygen.cpp | |||
@@ -25,7 +25,7 @@ | |||
25 | #include "psewidget.h" | 25 | #include "psewidget.h" |
26 | 26 | ||
27 | 27 | ||
28 | Oxygen::Oxygen() : QMainWindow() | 28 | Oxygen::Oxygen( QWidget *parent, const char *name, WFlags f) : QMainWindow( parent, name, f ) |
29 | { | 29 | { |
30 | loadNames(); | 30 | loadNames(); |
31 | calcDlgUI *CalcDlgUI = new calcDlgUI(); | 31 | calcDlgUI *CalcDlgUI = new calcDlgUI(); |
diff --git a/noncore/apps/oxygen/oxygen.h b/noncore/apps/oxygen/oxygen.h index 57fe9fe..c59662d 100644 --- a/noncore/apps/oxygen/oxygen.h +++ b/noncore/apps/oxygen/oxygen.h | |||
@@ -16,7 +16,8 @@ class Oxygen : public QMainWindow | |||
16 | Q_OBJECT | 16 | Q_OBJECT |
17 | 17 | ||
18 | public: | 18 | public: |
19 | Oxygen(); | 19 | Oxygen(QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); |
20 | static QString appName() { return QString::fromLatin1("oxygen"); } | ||
20 | 21 | ||
21 | private: | 22 | private: |
22 | void loadNames(); | 23 | void loadNames(); |
diff --git a/noncore/apps/oxygen/oxygen.pro b/noncore/apps/oxygen/oxygen.pro index a41bf7b..71d4dac 100644 --- a/noncore/apps/oxygen/oxygen.pro +++ b/noncore/apps/oxygen/oxygen.pro | |||
@@ -1,5 +1,4 @@ | |||
1 | TEMPLATE= app | 1 | CONFIG = qt warn_on release quick-app |
2 | CONFIG = qt warn_on release | ||
3 | HEADERS = oxygen.h \ | 2 | HEADERS = oxygen.h \ |
4 | kmolcalc.h \ | 3 | kmolcalc.h \ |
5 | kmolelements.h \ | 4 | kmolelements.h \ |
@@ -20,30 +19,9 @@ SOURCES = main.cpp \ | |||
20 | datawidgetui.cpp | 19 | datawidgetui.cpp |
21 | INCLUDEPATH += $(OPIEDIR)/include | 20 | INCLUDEPATH += $(OPIEDIR)/include |
22 | DEPENDPATH += $(OPIEDIR)/include | 21 | DEPENDPATH += $(OPIEDIR)/include |
23 | LIBS += -lqpe -lstdc++ | 22 | LIBS += -lqpe |
24 | INTERFACES= calcdlg.ui | 23 | INTERFACES= calcdlg.ui |
25 | TARGET = oxygen | ||
26 | DESTDIR = $(OPIEDIR)/bin | ||
27 | |||
28 | TRANSLATIONS = ../../../i18n/de/oxygen.ts \ | ||
29 | ../../../i18n/nl/oxygen.ts \ | ||
30 | ../../../i18n/xx/oxygen.ts \ | ||
31 | ../../../i18n/en/oxygen.ts \ | ||
32 | ../../../i18n/es/oxygen.ts \ | ||
33 | ../../../i18n/fr/oxygen.ts \ | ||
34 | ../../../i18n/hu/oxygen.ts \ | ||
35 | ../../../i18n/ja/oxygen.ts \ | ||
36 | ../../../i18n/ko/oxygen.ts \ | ||
37 | ../../../i18n/no/oxygen.ts \ | ||
38 | ../../../i18n/pl/oxygen.ts \ | ||
39 | ../../../i18n/pt/oxygen.ts \ | ||
40 | ../../../i18n/pt_BR/oxygen.ts \ | ||
41 | ../../../i18n/sl/oxygen.ts \ | ||
42 | ../../../i18n/zh_CN/oxygen.ts \ | ||
43 | ../../../i18n/zh_TW/oxygen.ts \ | ||
44 | ../../../i18n/it/oxygen.ts \ | ||
45 | ../../../i18n/da/oxygen.ts | ||
46 | |||
47 | 24 | ||
25 | TARGET= oxygen | ||
48 | 26 | ||
49 | include ( $(OPIEDIR)/include.pro ) | 27 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/noncore/apps/tableviewer/main.cpp b/noncore/apps/tableviewer/main.cpp index d17ee65..ce39c84 100644 --- a/noncore/apps/tableviewer/main.cpp +++ b/noncore/apps/tableviewer/main.cpp | |||
@@ -19,14 +19,7 @@ | |||
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include "tableviewer.h" | 20 | #include "tableviewer.h" |
21 | #include <qpe/qpeapplication.h> | 21 | #include <qpe/qpeapplication.h> |
22 | #include <opie/oapplicationfactory.h> | ||
22 | 23 | ||
23 | int main( int argc, char ** argv ) | 24 | OPIE_EXPORT_APP( OApplicationFactory<TableViewerWindow> ) |
24 | { | ||
25 | QPEApplication a( argc, argv ); | ||
26 | 25 | ||
27 | TableViewerWindow mw; | ||
28 | mw.setCaption( TableViewerWindow::tr("Table Viewer") ); | ||
29 | a.showMainWidget(&mw); | ||
30 | |||
31 | return a.exec(); | ||
32 | } | ||
diff --git a/noncore/apps/tableviewer/tableviewer.h b/noncore/apps/tableviewer/tableviewer.h index 817db21..f56a460 100644 --- a/noncore/apps/tableviewer/tableviewer.h +++ b/noncore/apps/tableviewer/tableviewer.h | |||
@@ -40,6 +40,7 @@ class TableViewerWindow: public QMainWindow | |||
40 | { | 40 | { |
41 | Q_OBJECT | 41 | Q_OBJECT |
42 | public: | 42 | public: |
43 | static QString appName() { return QString::fromLatin1("tableviewer"); } | ||
43 | TableViewerWindow( QWidget *parent = 0, | 44 | TableViewerWindow( QWidget *parent = 0, |
44 | const char *name = 0, WFlags f = 0 ); | 45 | const char *name = 0, WFlags f = 0 ); |
45 | ~TableViewerWindow(); | 46 | ~TableViewerWindow(); |
diff --git a/noncore/apps/tableviewer/tableviewer.pro b/noncore/apps/tableviewer/tableviewer.pro index f047e0b..c6d9e68 100644 --- a/noncore/apps/tableviewer/tableviewer.pro +++ b/noncore/apps/tableviewer/tableviewer.pro | |||
@@ -1,6 +1,4 @@ | |||
1 | TEMPLATE= app | 1 | CONFIG = qt warn_on debug quick-app |
2 | CONFIG = qt warn_on debug | ||
3 | DESTDIR = $(OPIEDIR)/bin | ||
4 | SUBDIRS = db ui | 2 | SUBDIRS = db ui |
5 | HEADERS = tableviewer.h \ | 3 | HEADERS = tableviewer.h \ |
6 | xmlencodeattr.h \ | 4 | xmlencodeattr.h \ |
diff --git a/noncore/apps/tinykate/main.cpp b/noncore/apps/tinykate/main.cpp index e06668a..e21c040 100644 --- a/noncore/apps/tinykate/main.cpp +++ b/noncore/apps/tinykate/main.cpp | |||
@@ -13,16 +13,10 @@ | |||
13 | * ONLY VERSION 2 OF THE LICENSE IS APPLICABLE * | 13 | * ONLY VERSION 2 OF THE LICENSE IS APPLICABLE * |
14 | * * | 14 | * * |
15 | ***************************************************************************/ | 15 | ***************************************************************************/ |
16 | #include <qpe/qpeapplication.h> | ||
17 | #include <qmainwindow.h> | 16 | #include <qmainwindow.h> |
18 | #include "tinykate.h" | 17 | #include "tinykate.h" |
19 | 18 | ||
19 | #include <opie/oapplicationfactory.h> | ||
20 | 20 | ||
21 | int main( int argc, char ** argv ) | 21 | OPIE_EXPORT_APP( OApplicationFactory<TinyKate> ) |
22 | { | ||
23 | QPEApplication a( argc, argv ); | ||
24 | 22 | ||
25 | TinyKate m; | ||
26 | a.showMainWidget(&m ); | ||
27 | return a.exec(); | ||
28 | } | ||
diff --git a/noncore/apps/tinykate/opie-tinykate.control b/noncore/apps/tinykate/opie-tinykate.control index 1fde467..9bc0130 100644 --- a/noncore/apps/tinykate/opie-tinykate.control +++ b/noncore/apps/tinykate/opie-tinykate.control | |||
@@ -1,5 +1,5 @@ | |||
1 | Package: opie-tinykate | 1 | Package: opie-tinykate |
2 | Files: plugins/application/libtinykate.so* bin/tinykate apps/Applications/tinykate.desktop pics/tinykate $OPIEDIR/lib/libtinykate.so.1.0.0 $OPIEDIR/lib/libtinykate.so.1.0 $OPIEDIR/lib/libtinykate.so.1 | 2 | Files: plugins/application/libkate.so* bin/kate apps/Applications/tinykate.desktop pics/tinykate $OPIEDIR/lib/libtinykate.so.1.0.0 $OPIEDIR/lib/libtinykate.so.1.0 $OPIEDIR/lib/libtinykate.so.1 |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/applications | 4 | Section: opie/applications |
5 | Maintainer: Opie Team <opie@handhelds.org> | 5 | Maintainer: Opie Team <opie@handhelds.org> |
diff --git a/noncore/apps/tinykate/tinykate.h b/noncore/apps/tinykate/tinykate.h index 2bf4de6..a5ee9b9 100644 --- a/noncore/apps/tinykate/tinykate.h +++ b/noncore/apps/tinykate/tinykate.h | |||
@@ -33,6 +33,8 @@ Q_OBJECT | |||
33 | public: | 33 | public: |
34 | TinyKate( QWidget *parent=0, const char *name=0, WFlags f = 0); | 34 | TinyKate( QWidget *parent=0, const char *name=0, WFlags f = 0); |
35 | ~TinyKate( ); | 35 | ~TinyKate( ); |
36 | static QString appName() { return QString::fromLatin1( "kate" ); }; | ||
37 | |||
36 | 38 | ||
37 | public slots: | 39 | public slots: |
38 | void slotNew(); | 40 | void slotNew(); |
diff --git a/noncore/apps/tinykate/tinykate.pro b/noncore/apps/tinykate/tinykate.pro index 632bd49..91d4230 100644 --- a/noncore/apps/tinykate/tinykate.pro +++ b/noncore/apps/tinykate/tinykate.pro | |||
@@ -1,5 +1,5 @@ | |||
1 | TEMPLATE= app | 1 | TEMPLATE= app |
2 | CONFIG = qt warn_on release | 2 | CONFIG = qt warn_on release quick-app |
3 | DESTDIR = $(OPIEDIR)/bin | 3 | DESTDIR = $(OPIEDIR)/bin |
4 | HEADERS = tinykate.h | 4 | HEADERS = tinykate.h |
5 | SOURCES = tinykate.cpp main.cpp | 5 | SOURCES = tinykate.cpp main.cpp |
@@ -15,7 +15,7 @@ INCLUDEPATH += $(OPIEDIR)/include \ | |||
15 | 15 | ||
16 | DEPENDPATH+= $(OPIEDIR)/include | 16 | DEPENDPATH+= $(OPIEDIR)/include |
17 | LIBS += -lqpe -ltinykate -lopie | 17 | LIBS += -lqpe -ltinykate -lopie |
18 | TARGET = tinykate | 18 | TARGET = kate |
19 | 19 | ||
20 | 20 | ||
21 | 21 | ||
diff --git a/noncore/apps/zsafe/.cvsignore b/noncore/apps/zsafe/.cvsignore new file mode 100644 index 0000000..2f8556e --- a/dev/null +++ b/noncore/apps/zsafe/.cvsignore | |||
@@ -0,0 +1,3 @@ | |||
1 | Makefile | ||
2 | Makefile.in | ||
3 | moc* | ||
diff --git a/noncore/settings/aqpkg/.cvsignore b/noncore/settings/aqpkg/.cvsignore index 2888d4a..4183697 100644 --- a/noncore/settings/aqpkg/.cvsignore +++ b/noncore/settings/aqpkg/.cvsignore | |||
@@ -1,2 +1,3 @@ | |||
1 | Makefile* | 1 | Makefile* |
2 | moc* | 2 | moc* |
3 | .moc* | ||
diff --git a/noncore/settings/aqpkg/aqpkg.pro b/noncore/settings/aqpkg/aqpkg.pro index d241d1b..882cfd4 100644 --- a/noncore/settings/aqpkg/aqpkg.pro +++ b/noncore/settings/aqpkg/aqpkg.pro | |||
@@ -1,5 +1,4 @@ | |||
1 | TEMPLATE= app | 1 | CONFIG = qt warn_on release quick-app |
2 | CONFIG = qt warn_on release | ||
3 | HEADERS = global.h \ | 2 | HEADERS = global.h \ |
4 | mainwin.h \ | 3 | mainwin.h \ |
5 | datamgr.h \ | 4 | datamgr.h \ |
@@ -32,31 +31,10 @@ SOURCES = mainwin.cpp \ | |||
32 | inputdlg.cpp \ | 31 | inputdlg.cpp \ |
33 | version.cpp \ | 32 | version.cpp \ |
34 | categoryfilterimpl.cpp | 33 | categoryfilterimpl.cpp |
35 | INTERFACES= | ||
36 | TARGET = aqpkg | 34 | TARGET = aqpkg |
37 | INCLUDEPATH += $(OPIEDIR)/include | 35 | INCLUDEPATH += $(OPIEDIR)/include |
38 | DEPENDPATH += $(OPIEDIR)/include | 36 | DEPENDPATH += $(OPIEDIR)/include |
39 | LIBS += -lqpe -lopie -lstdc++ | 37 | LIBS += -lqpe -lopie -lstdc++ |
40 | DESTDIR = $(OPIEDIR)/bin | ||
41 | |||
42 | TRANSLATIONS = ../../../i18n/de/aqpkg.ts \ | ||
43 | ../../../i18n/nl/aqpkg.ts \ | ||
44 | ../../../i18n/xx/aqpkg.ts \ | ||
45 | ../../../i18n/en/aqpkg.ts \ | ||
46 | ../../../i18n/es/aqpkg.ts \ | ||
47 | ../../../i18n/fr/aqpkg.ts \ | ||
48 | ../../../i18n/hu/aqpkg.ts \ | ||
49 | ../../../i18n/ja/aqpkg.ts \ | ||
50 | ../../../i18n/ko/aqpkg.ts \ | ||
51 | ../../../i18n/no/aqpkg.ts \ | ||
52 | ../../../i18n/pl/aqpkg.ts \ | ||
53 | ../../../i18n/pt/aqpkg.ts \ | ||
54 | ../../../i18n/pt_BR/aqpkg.ts \ | ||
55 | ../../../i18n/sl/aqpkg.ts \ | ||
56 | ../../../i18n/zh_CN/aqpkg.ts \ | ||
57 | ../../../i18n/zh_TW/aqpkg.ts \ | ||
58 | ../../../i18n/it/aqpkg.ts \ | ||
59 | ../../../i18n/da/aqpkg.ts | ||
60 | |||
61 | 38 | ||
62 | include ( $(OPIEDIR)/include.pro ) | 39 | include ( $(OPIEDIR)/include.pro ) |
40 | |||
diff --git a/noncore/settings/aqpkg/main.cpp b/noncore/settings/aqpkg/main.cpp index b7f8b7b..179f8b7 100644 --- a/noncore/settings/aqpkg/main.cpp +++ b/noncore/settings/aqpkg/main.cpp | |||
@@ -27,52 +27,12 @@ | |||
27 | 27 | ||
28 | */ | 28 | */ |
29 | 29 | ||
30 | #ifdef QWS | ||
31 | #include <qpe/qpeapplication.h> | ||
32 | #include <qpe/qcopenvelope_qws.h> | ||
33 | #else | ||
34 | #include <qapplication.h> | ||
35 | #endif | ||
36 | |||
37 | #include <qobjectdefs.h> | ||
38 | |||
39 | #include "mainwin.h" | 30 | #include "mainwin.h" |
40 | #include "server.h" | ||
41 | |||
42 | #include "global.h" | ||
43 | 31 | ||
32 | #include <opie/oapplicationfactory.h> | ||
44 | 33 | ||
45 | /* be less intrusive for translation -zecke */ | 34 | /* be less intrusive for translation -zecke */ |
46 | extern QString LOCAL_SERVER; | 35 | extern QString LOCAL_SERVER; |
47 | extern QString LOCAL_IPKGS; | 36 | extern QString LOCAL_IPKGS; |
48 | 37 | ||
49 | int main(int argc, char *argv[]) | 38 | OPIE_EXPORT_APP( OApplicationFactory<MainWindow> ) |
50 | { | ||
51 | #ifdef QWS | ||
52 | QPEApplication a( argc, argv ); | ||
53 | #else | ||
54 | QApplication a( argc, argv ); | ||
55 | #endif | ||
56 | |||
57 | #ifdef QWS | ||
58 | // Disable suspend mode | ||
59 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::DisableSuspend; | ||
60 | #endif | ||
61 | |||
62 | LOCAL_SERVER = QObject::tr( "Installed packages" ); | ||
63 | LOCAL_IPKGS = QObject::tr( "Local packages" ); | ||
64 | |||
65 | MainWindow *win = new MainWindow(); | ||
66 | a.setMainWidget(win); | ||
67 | win->showMaximized(); | ||
68 | |||
69 | a.exec(); | ||
70 | |||
71 | #ifdef QWS | ||
72 | // Reenable suspend mode | ||
73 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; | ||
74 | #endif | ||
75 | #ifdef _DEBUG | ||
76 | DumpUnfreed(); | ||
77 | #endif | ||
78 | } | ||
diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp index 42093cf..dbe694e 100644 --- a/noncore/settings/aqpkg/mainwin.cpp +++ b/noncore/settings/aqpkg/mainwin.cpp | |||
@@ -66,9 +66,15 @@ | |||
66 | 66 | ||
67 | extern int compareVersions( const char *v1, const char *v2 ); | 67 | extern int compareVersions( const char *v1, const char *v2 ); |
68 | 68 | ||
69 | MainWindow :: MainWindow() | 69 | MainWindow :: MainWindow( QWidget* parent, const char* name, WFlags fl ) |
70 | :QMainWindow( 0x0, 0x0, WStyle_ContextHelp ) | 70 | :QMainWindow( parent, name, fl || WStyle_ContextHelp ) |
71 | { | 71 | { |
72 | // Disable suspend mode | ||
73 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::DisableSuspend; | ||
74 | |||
75 | LOCAL_SERVER = QObject::tr( "Installed packages" ); | ||
76 | LOCAL_IPKGS = QObject::tr( "Local packages" ); | ||
77 | |||
72 | setCaption( tr( "AQPkg - Package Manager" ) ); | 78 | setCaption( tr( "AQPkg - Package Manager" ) ); |
73 | 79 | ||
74 | // Create UI widgets | 80 | // Create UI widgets |
@@ -234,6 +240,9 @@ MainWindow :: MainWindow() | |||
234 | MainWindow :: ~MainWindow() | 240 | MainWindow :: ~MainWindow() |
235 | { | 241 | { |
236 | delete mgr; | 242 | delete mgr; |
243 | |||
244 | // Reenable suspend mode | ||
245 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; | ||
237 | } | 246 | } |
238 | 247 | ||
239 | void MainWindow :: initMainWidget() | 248 | void MainWindow :: initMainWidget() |
@@ -1012,7 +1021,6 @@ InstallData *MainWindow :: dealWithItem( QCheckListItem *item ) | |||
1012 | { | 1021 | { |
1013 | InstallData *newitem = new InstallData(); | 1022 | InstallData *newitem = new InstallData(); |
1014 | newitem->option = "D"; | 1023 | newitem->option = "D"; |
1015 | |||
1016 | // If local file, remove using package name, not filename | 1024 | // If local file, remove using package name, not filename |
1017 | if ( p->isPackageStoredLocally() ) | 1025 | if ( p->isPackageStoredLocally() ) |
1018 | name = item->text(); | 1026 | name = item->text(); |
@@ -1046,7 +1054,6 @@ InstallData *MainWindow :: dealWithItem( QCheckListItem *item ) | |||
1046 | { | 1054 | { |
1047 | // Version available is older - remove only | 1055 | // Version available is older - remove only |
1048 | newitem->option = "D"; | 1056 | newitem->option = "D"; |
1049 | |||
1050 | // If local file, remove using package name, not filename | 1057 | // If local file, remove using package name, not filename |
1051 | if ( p->isPackageStoredLocally() ) | 1058 | if ( p->isPackageStoredLocally() ) |
1052 | name = item->text(); | 1059 | name = item->text(); |
diff --git a/noncore/settings/aqpkg/mainwin.h b/noncore/settings/aqpkg/mainwin.h index 615ff8b..b8e1c98 100644 --- a/noncore/settings/aqpkg/mainwin.h +++ b/noncore/settings/aqpkg/mainwin.h | |||
@@ -54,8 +54,9 @@ class MainWindow :public QMainWindow | |||
54 | Q_OBJECT | 54 | Q_OBJECT |
55 | public: | 55 | public: |
56 | 56 | ||
57 | MainWindow(); | 57 | MainWindow( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); |
58 | ~MainWindow(); | 58 | ~MainWindow(); |
59 | static QString appName() { return QString::fromLatin1( "aqpkg" ); }; | ||
59 | 60 | ||
60 | protected: | 61 | protected: |
61 | void closeEvent( QCloseEvent* e ); | 62 | void closeEvent( QCloseEvent* e ); |
diff --git a/noncore/settings/sysinfo/main.cpp b/noncore/settings/sysinfo/main.cpp index 6e889db..02b1098 100644 --- a/noncore/settings/sysinfo/main.cpp +++ b/noncore/settings/sysinfo/main.cpp | |||
@@ -21,14 +21,7 @@ | |||
21 | #include "sysinfo.h" | 21 | #include "sysinfo.h" |
22 | 22 | ||
23 | #include <qpe/qpeapplication.h> | 23 | #include <qpe/qpeapplication.h> |
24 | #include <opie/oapplicationfactory.h> | ||
24 | 25 | ||
25 | int main( int argc, char *argv[] ) | ||
26 | { | ||
27 | QPEApplication a( argc, argv ); | ||
28 | |||
29 | SystemInfo *si = new SystemInfo(); | ||
30 | a.showMainWidget( si ); | ||
31 | |||
32 | return a.exec(); | ||
33 | } | ||
34 | 26 | ||
27 | OPIE_EXPORT_APP( OApplicationFactory<SystemInfo> ) | ||
diff --git a/noncore/settings/sysinfo/storage.cpp b/noncore/settings/sysinfo/storage.cpp index c4474d5..4ef7122 100644 --- a/noncore/settings/sysinfo/storage.cpp +++ b/noncore/settings/sysinfo/storage.cpp | |||
@@ -58,6 +58,7 @@ FileSysInfo::FileSysInfo( QWidget *parent, const char *name ) | |||
58 | startTimer( 5000 ); | 58 | startTimer( 5000 ); |
59 | } | 59 | } |
60 | 60 | ||
61 | |||
61 | void FileSysInfo::timerEvent(QTimerEvent*) | 62 | void FileSysInfo::timerEvent(QTimerEvent*) |
62 | { | 63 | { |
63 | updateMounts(); | 64 | updateMounts(); |
@@ -69,15 +70,6 @@ void FileSysInfo::updateMounts() | |||
69 | 70 | ||
70 | if ( rebuildDisks ) | 71 | if ( rebuildDisks ) |
71 | { | 72 | { |
72 | // Cannot auto delete QDict<MountInfo> disks because it seems to delete | ||
73 | // the filesystem object as well causing a segfault | ||
74 | MountInfo *mi; | ||
75 | for ( QDictIterator<MountInfo> delit(disks); delit.current(); ++delit ) | ||
76 | { | ||
77 | mi = delit.current(); | ||
78 | mi->fs = 0x0; | ||
79 | delete mi; | ||
80 | } | ||
81 | disks.clear(); | 73 | disks.clear(); |
82 | lines.clear(); | 74 | lines.clear(); |
83 | 75 | ||
@@ -163,7 +155,6 @@ MountInfo::MountInfo( FileSystem *filesys, QWidget *parent, const char *name ) | |||
163 | MountInfo::~MountInfo() | 155 | MountInfo::~MountInfo() |
164 | { | 156 | { |
165 | delete data; | 157 | delete data; |
166 | delete fs; | ||
167 | } | 158 | } |
168 | 159 | ||
169 | void MountInfo::updateData() | 160 | void MountInfo::updateData() |
diff --git a/noncore/settings/sysinfo/sysinfo.h b/noncore/settings/sysinfo/sysinfo.h index d69346a..94c3876 100644 --- a/noncore/settings/sysinfo/sysinfo.h +++ b/noncore/settings/sysinfo/sysinfo.h | |||
@@ -29,5 +29,6 @@ class SystemInfo : public QWidget | |||
29 | Q_OBJECT | 29 | Q_OBJECT |
30 | public: | 30 | public: |
31 | SystemInfo( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); | 31 | SystemInfo( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); |
32 | static QString appName() { return QString::fromLatin1("sysinfo"); } | ||
32 | }; | 33 | }; |
33 | 34 | ||
diff --git a/noncore/settings/sysinfo/sysinfo.pro b/noncore/settings/sysinfo/sysinfo.pro index 2582ea2..2322989 100644 --- a/noncore/settings/sysinfo/sysinfo.pro +++ b/noncore/settings/sysinfo/sysinfo.pro | |||
@@ -1,6 +1,4 @@ | |||
1 | TEMPLATE = app | 1 | CONFIG = qt warn_on release quick-app |
2 | CONFIG = qt warn_on release | ||
3 | DESTDIR = $(OPIEDIR)/bin | ||
4 | HEADERS = memory.h \ | 2 | HEADERS = memory.h \ |
5 | graph.h \ | 3 | graph.h \ |
6 | load.h \ | 4 | load.h \ |
@@ -20,10 +18,11 @@ SOURCES = main.cpp \ | |||
20 | detail.cpp \ | 18 | detail.cpp \ |
21 | versioninfo.cpp \ | 19 | versioninfo.cpp \ |
22 | sysinfo.cpp | 20 | sysinfo.cpp |
23 | INTERFACES = | 21 | |
24 | INCLUDEPATH += $(OPIEDIR)/include | 22 | INCLUDEPATH += $(OPIEDIR)/include |
25 | DEPENDPATH += $(OPIEDIR)/include | 23 | DEPENDPATH += $(OPIEDIR)/include |
26 | LIBS += -lqpe -lopie | 24 | LIBS += -lqpe -lopie |
25 | |||
27 | TARGET = sysinfo | 26 | TARGET = sysinfo |
28 | 27 | ||
29 | TRANSLATIONS = ../../../i18n/de/sysinfo.ts \ | 28 | TRANSLATIONS = ../../../i18n/de/sysinfo.ts \ |