46 files changed, 1485 insertions, 334 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 | |||
@@ -24,171 +24,203 @@ | |||
24 | 59 Temple Place - Suite 330, | 24 | 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include "cbinfo.h" | 29 | #include "cbinfo.h" |
30 | #include "traninfo.h" | 30 | #include "traninfo.h" |
31 | 31 | ||
32 | #include <qpe/config.h> | 32 | #include <qpe/config.h> |
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 = ""; |
39 | fn = ""; | 40 | fn = ""; |
40 | pw = QString::null; | 41 | pw = QString::null; |
41 | t = ""; | 42 | t = ""; |
42 | bn = ""; | 43 | bn = ""; |
43 | a = ""; | 44 | a = ""; |
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 ); |
54 | config.setGroup( "Account" ); | 60 | config.setGroup( "Account" ); |
55 | 61 | ||
56 | n = name; | 62 | n = name; |
57 | fn = filename; | 63 | fn = filename; |
58 | pw = config.readEntryCrypt( "Password", QString::null ); | 64 | pw = config.readEntryCrypt( "Password", QString::null ); |
59 | 65 | ||
60 | t = config.readEntry( "Type" ); | 66 | t = config.readEntry( "Type" ); |
61 | bn = config.readEntry( "Bank", "" ); | 67 | bn = config.readEntry( "Bank", "" ); |
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 ); |
68 | 77 | ||
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 ); |
92 | config->writeEntry( "Bank", bn ); | 118 | config->writeEntry( "Bank", bn ); |
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; |
142 | QString trandesc = ""; | 168 | QString trandesc = ""; |
143 | 169 | ||
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; |
168 | 199 | ||
169 | b = sb; | 200 | b = sb; |
170 | 201 | ||
171 | for ( TranInfo *tran = tl->first(); tran; tran = tl->next() ) | 202 | for ( TranInfo *tran = tl->first(); tran; tran = tl->next() ) |
172 | { | 203 | { |
173 | b -= tran->fee(); | 204 | b -= tran->fee(); |
174 | amount = tran->amount(); | 205 | amount = tran->amount(); |
175 | if ( tran->withdrawal() ) | 206 | if ( tran->withdrawal() ) |
176 | { | 207 | { |
177 | amount *= -1; | 208 | amount *= -1; |
178 | } | 209 | } |
179 | b += amount; | 210 | b += amount; |
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(); |
186 | QString n2 = ((CBInfo *)item2)->name(); | 218 | QString n2 = ((CBInfo *)item2)->name(); |
187 | int r = -1; | 219 | int r = -1; |
188 | 220 | ||
189 | if ( n1 < n2 ) | 221 | if ( n1 < n2 ) |
190 | r = -1; | 222 | r = -1; |
191 | else if ( n1 == n2 ) | 223 | else if ( n1 == n2 ) |
192 | r = 0; | 224 | r = 0; |
193 | else if ( n1 > n2 ) | 225 | else if ( n1 > n2 ) |
194 | r = 1; | 226 | r = 1; |
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 | |||
@@ -20,24 +20,25 @@ | |||
20 | : = ...= . :.=- You should have received a copy of the GNU | 20 | : = ...= . :.=- You should have received a copy of the GNU |
21 | -. .:....=;==+<; General Public License along with this file; | 21 | -. .:....=;==+<; General Public License along with this file; |
22 | -_. . . )=. = see the file COPYING. If not, write to the | 22 | -_. . . )=. = see the file COPYING. If not, write to the |
23 | -- :-=` Free Software Foundation, Inc., | 23 | -- :-=` Free Software Foundation, Inc., |
24 | 59 Temple Place - Suite 330, | 24 | 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #ifndef 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 | ||
35 | class Config; | 36 | class Config; |
36 | class TranInfo; | 37 | class TranInfo; |
37 | class TranInfoList; | 38 | class TranInfoList; |
38 | 39 | ||
39 | class CBInfo | 40 | class CBInfo |
40 | { | 41 | { |
41 | public: | 42 | public: |
42 | CBInfo(); | 43 | CBInfo(); |
43 | CBInfo( const QString &, const QString & ); | 44 | CBInfo( const QString &, const QString & ); |
@@ -54,42 +55,59 @@ class CBInfo | |||
54 | float balance(); | 55 | float balance(); |
55 | 56 | ||
56 | void setName( const QString &name ) { n = name; } | 57 | void setName( const QString &name ) { n = name; } |
57 | void setFilename( const QString &filename ){ fn = filename; } | 58 | void setFilename( const QString &filename ){ fn = filename; } |
58 | void setPassword( const QString &password ){ pw = password; } | 59 | void setPassword( const QString &password ){ pw = password; } |
59 | void setType( const QString &type ) { t = type; } | 60 | void setType( const QString &type ) { t = type; } |
60 | void setBank( const QString &bank ) { bn = bank; } | 61 | void setBank( const QString &bank ) { bn = bank; } |
61 | void setAccount( const QString &account ) { a = account; } | 62 | void setAccount( const QString &account ) { a = account; } |
62 | void setPin( const QString &pin ) { p = pin; } | 63 | void setPin( const QString &pin ) { p = pin; } |
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; |
76 | QString pw; | 90 | QString pw; |
77 | QString t; | 91 | QString t; |
78 | QString bn; | 92 | QString bn; |
79 | QString a; | 93 | QString a; |
80 | QString p; | 94 | QString p; |
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 | ||
87 | void loadTransactions(); | 105 | void loadTransactions(); |
88 | void calcBalance(); | 106 | void calcBalance(); |
89 | }; | 107 | }; |
90 | 108 | ||
91 | class CBInfoList : public QList<CBInfo> | 109 | class CBInfoList : public QList<CBInfo> |
92 | { | 110 | { |
93 | protected: | 111 | protected: |
94 | int compareItems( QCollection::Item, QCollection::Item ); | 112 | int compareItems( QCollection::Item, QCollection::Item ); |
95 | }; | 113 | }; |
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 | |||
@@ -24,82 +24,98 @@ | |||
24 | 59 Temple Place - Suite 330, | 24 | 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include "checkbook.h" | 29 | #include "checkbook.h" |
30 | #include "cbinfo.h" | 30 | #include "cbinfo.h" |
31 | #include "transaction.h" | 31 | #include "transaction.h" |
32 | #include "traninfo.h" | 32 | #include "traninfo.h" |
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> |
39 | #include <qpe/qpemessagebox.h> | 41 | #include <qpe/qpemessagebox.h> |
40 | #include <qpe/resource.h> | 42 | #include <qpe/resource.h> |
41 | 43 | ||
42 | #include <qcheckbox.h> | 44 | #include <qcheckbox.h> |
43 | #include <qcombobox.h> | 45 | #include <qcombobox.h> |
44 | #include <qlabel.h> | 46 | #include <qlabel.h> |
45 | #include <qlayout.h> | 47 | #include <qlayout.h> |
46 | #include <qlineedit.h> | 48 | #include <qlineedit.h> |
47 | #include <qmultilineedit.h> | 49 | #include <qmultilineedit.h> |
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(); |
60 | tempstr.append( " - " ); | 71 | tempstr.append( " - " ); |
61 | tempstr.append( tr( "Checkbook" ) ); | 72 | tempstr.append( tr( "Checkbook" ) ); |
62 | setCaption( tempstr ); | 73 | setCaption( tempstr ); |
63 | } | 74 | } |
64 | else | 75 | else |
65 | { | 76 | { |
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 ); |
72 | layout->setSpacing( 4 ); | 84 | layout->setSpacing( 4 ); |
73 | 85 | ||
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(); |
85 | } | 100 | } |
86 | 101 | ||
87 | Checkbook::~Checkbook() | 102 | 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 | ||
97 | QScrollView *sv = new QScrollView( control ); | 113 | QScrollView *sv = new QScrollView( control ); |
98 | vb->addWidget( sv, 0, 0 ); | 114 | vb->addWidget( sv, 0, 0 ); |
99 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 115 | sv->setResizePolicy( QScrollView::AutoOneFit ); |
100 | sv->setFrameStyle( QFrame::NoFrame ); | 116 | sv->setFrameStyle( QFrame::NoFrame ); |
101 | 117 | ||
102 | QWidget *container = new QWidget( sv->viewport() ); | 118 | QWidget *container = new QWidget( sv->viewport() ); |
103 | sv->addChild( container ); | 119 | sv->addChild( container ); |
104 | 120 | ||
105 | QGridLayout *layout = new QGridLayout( container ); | 121 | QGridLayout *layout = new QGridLayout( container ); |
@@ -119,30 +135,25 @@ QWidget *Checkbook::initInfo() | |||
119 | nameEdit = new QLineEdit( container ); | 135 | nameEdit = new QLineEdit( container ); |
120 | QWhatsThis::add( nameEdit, tr( "Enter name of checkbook here." ) ); | 136 | QWhatsThis::add( nameEdit, tr( "Enter name of checkbook here." ) ); |
121 | connect( nameEdit, SIGNAL( textChanged( const QString & ) ), | 137 | connect( nameEdit, SIGNAL( textChanged( const QString & ) ), |
122 | this, SLOT( slotNameChanged( const QString & ) ) ); | 138 | this, SLOT( slotNameChanged( const QString & ) ) ); |
123 | layout->addWidget( nameEdit, 1, 1 ); | 139 | layout->addWidget( nameEdit, 1, 1 ); |
124 | 140 | ||
125 | // Type of account | 141 | // Type of account |
126 | label = new QLabel( tr( "Type:" ), container ); | 142 | label = new QLabel( tr( "Type:" ), container ); |
127 | QWhatsThis::add( label, tr( "Select type of checkbook here." ) ); | 143 | QWhatsThis::add( label, tr( "Select type of checkbook here." ) ); |
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 |
140 | label = new QLabel( tr( "Bank:" ), container ); | 151 | label = new QLabel( tr( "Bank:" ), container ); |
141 | QWhatsThis::add( label, tr( "Enter name of the bank for this checkbook here." ) ); | 152 | QWhatsThis::add( label, tr( "Enter name of the bank for this checkbook here." ) ); |
142 | layout->addWidget( label, 3, 0 ); | 153 | layout->addWidget( label, 3, 0 ); |
143 | bankEdit = new QLineEdit( container ); | 154 | bankEdit = new QLineEdit( container ); |
144 | QWhatsThis::add( bankEdit, tr( "Enter name of the bank for this checkbook here." ) ); | 155 | QWhatsThis::add( bankEdit, tr( "Enter name of the bank for this checkbook here." ) ); |
145 | layout->addWidget( bankEdit, 3, 1 ); | 156 | layout->addWidget( bankEdit, 3, 1 ); |
146 | 157 | ||
147 | // Account number | 158 | // Account number |
148 | label = new QLabel( tr( "Account number:" ), container ); | 159 | label = new QLabel( tr( "Account number:" ), container ); |
@@ -174,75 +185,96 @@ QWidget *Checkbook::initInfo() | |||
174 | label = new QLabel( tr( "Notes:" ), container ); | 185 | label = new QLabel( tr( "Notes:" ), container ); |
175 | QWhatsThis::add( label, tr( "Enter any additional information for this checkbook here." ) ); | 186 | QWhatsThis::add( label, tr( "Enter any additional information for this checkbook here." ) ); |
176 | layout->addWidget( label, 7, 0 ); | 187 | layout->addWidget( label, 7, 0 ); |
177 | notesEdit = new QMultiLineEdit( container ); | 188 | notesEdit = new QMultiLineEdit( container ); |
178 | QWhatsThis::add( notesEdit, tr( "Enter any additional information for this checkbook here." ) ); | 189 | QWhatsThis::add( notesEdit, tr( "Enter any additional information for this checkbook here." ) ); |
179 | notesEdit->setMinimumHeight( 25 ); | 190 | notesEdit->setMinimumHeight( 25 ); |
180 | notesEdit->setMaximumHeight( 65 ); | 191 | notesEdit->setMaximumHeight( 65 ); |
181 | layout->addMultiCellWidget( notesEdit, 8, 8, 0, 1 ); | 192 | layout->addMultiCellWidget( notesEdit, 8, 8, 0, 1 ); |
182 | 193 | ||
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() ) ); |
217 | layout->addWidget( btn, 2, 0 ); | 247 | layout->addWidget( btn, 2, 0 ); |
218 | 248 | ||
219 | btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Edit" ), control ); | 249 | btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Edit" ), control ); |
220 | QWhatsThis::add( btn, tr( "Select a transaction and then click here to edit it." ) ); | 250 | QWhatsThis::add( btn, tr( "Select a transaction and then click here to edit it." ) ); |
221 | connect( btn, SIGNAL( clicked() ), this, SLOT( slotEditTran() ) ); | 251 | connect( btn, SIGNAL( clicked() ), this, SLOT( slotEditTran() ) ); |
222 | layout->addWidget( btn, 2, 1 ); | 252 | layout->addWidget( btn, 2, 1 ); |
223 | 253 | ||
224 | btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), control ); | 254 | btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), control ); |
225 | QWhatsThis::add( btn, tr( "Select a checkbook and then click here to delete it." ) ); | 255 | QWhatsThis::add( btn, tr( "Select a checkbook and then click here to delete it." ) ); |
226 | connect( btn, SIGNAL( clicked() ), this, SLOT( slotDeleteTran() ) ); | 256 | connect( btn, SIGNAL( clicked() ), this, SLOT( slotDeleteTran() ) ); |
227 | layout->addWidget( btn, 2, 2 ); | 257 | layout->addWidget( btn, 2, 2 ); |
228 | 258 | ||
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 ); |
240 | layout->setMargin( 4 ); | 272 | layout->setMargin( 4 ); |
241 | 273 | ||
242 | graphWidget = new Graph( control ); | 274 | graphWidget = new Graph( control ); |
243 | QWhatsThis::add( graphWidget, tr( "Select the desired chart below and then click on the Draw button." ) ); | 275 | QWhatsThis::add( graphWidget, tr( "Select the desired chart below and then click on the Draw button." ) ); |
244 | layout->addMultiCellWidget( graphWidget, 0, 0, 0, 2 ); | 276 | layout->addMultiCellWidget( graphWidget, 0, 0, 0, 2 ); |
245 | 277 | ||
246 | graphList = new QComboBox( control ); | 278 | graphList = new QComboBox( control ); |
247 | QWhatsThis::add( graphList, tr( "Click here to select the desired chart type." ) ); | 279 | QWhatsThis::add( graphList, tr( "Click here to select the desired chart type." ) ); |
248 | graphList->insertItem( tr( "Account balance" ) ); | 280 | graphList->insertItem( tr( "Account balance" ) ); |
@@ -250,91 +282,115 @@ QWidget *Checkbook::initCharts() | |||
250 | graphList->insertItem( tr( "Deposits by category" ) ); | 282 | graphList->insertItem( tr( "Deposits by category" ) ); |
251 | 283 | ||
252 | layout->addMultiCellWidget( graphList, 1, 1, 0, 1 ); | 284 | layout->addMultiCellWidget( graphList, 1, 1, 0, 1 ); |
253 | 285 | ||
254 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "checkbook/drawbtn" ), tr( "Draw" ), control ); | 286 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "checkbook/drawbtn" ), tr( "Draw" ), control ); |
255 | QWhatsThis::add( btn, tr( "Click here to draw the selected chart." ) ); | 287 | QWhatsThis::add( btn, tr( "Click here to draw the selected chart." ) ); |
256 | connect( btn, SIGNAL( clicked() ), this, SLOT( slotDrawGraph() ) ); | 288 | connect( btn, SIGNAL( clicked() ), this, SLOT( slotDrawGraph() ) ); |
257 | layout->addWidget( btn, 1, 2 ); | 289 | layout->addWidget( btn, 1, 2 ); |
258 | 290 | ||
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 ) |
265 | { | 298 | { |
266 | return; | 299 | return; |
267 | } | 300 | } |
268 | 301 | ||
269 | tranList = info->transactions(); | 302 | tranList = info->transactions(); |
270 | 303 | ||
271 | passwordCB->setChecked( !info->password().isNull() ); | 304 | passwordCB->setChecked( !info->password().isNull() ); |
272 | nameEdit->setText( info->name() ); | 305 | nameEdit->setText( info->name() ); |
273 | QString temptext = info->type(); | 306 | QString temptext = info->type(); |
274 | int i = typeList->count(); | 307 | int i = typeList->count(); |
275 | while ( i > 0 ) | 308 | while ( i > 0 ) |
276 | { | 309 | { |
277 | i--; | 310 | i--; |
278 | typeList->setCurrentItem( i ); | 311 | typeList->setCurrentItem( i ); |
279 | if ( typeList->currentText() == temptext ) | 312 | if ( typeList->currentText() == temptext ) |
280 | { | 313 | { |
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() ); |
287 | temptext.setNum( info->startingBalance(), 'f', 2 ); | 324 | temptext.setNum( info->startingBalance(), 'f', 2 ); |
288 | balanceEdit->setText( temptext ); | 325 | balanceEdit->setText( temptext ); |
289 | notesEdit->setText( info->notes() ); | 326 | notesEdit->setText( info->notes() ); |
290 | 327 | ||
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(); |
298 | if ( tran->withdrawal() ) | 334 | if ( tran->withdrawal() ) |
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() ); |
332 | info->setType( typeList->currentText() ); | 388 | info->setType( typeList->currentText() ); |
333 | info->setBank( bankEdit->text() ); | 389 | info->setBank( bankEdit->text() ); |
334 | info->setAccount( acctNumEdit->text() ); | 390 | info->setAccount( acctNumEdit->text() ); |
335 | info->setPin( pinNumEdit->text() ); | 391 | info->setPin( pinNumEdit->text() ); |
336 | bool ok; | 392 | bool ok; |
337 | info->setStartingBalance( balanceEdit->text().toFloat( &ok ) ); | 393 | info->setStartingBalance( balanceEdit->text().toFloat( &ok ) ); |
338 | info->setNotes( notesEdit->text() ); | 394 | info->setNotes( notesEdit->text() ); |
339 | 395 | ||
340 | QDialog::accept(); | 396 | QDialog::accept(); |
@@ -389,113 +445,109 @@ void Checkbook::slotNameChanged( const QString &newname ) | |||
389 | // TODO - need filedir | 445 | // TODO - need filedir |
390 | //QString namestr = filedir; | 446 | //QString namestr = filedir; |
391 | //namestr.append( newname ); | 447 | //namestr.append( newname ); |
392 | //namestr.append( ".qcb" ); | 448 | //namestr.append( ".qcb" ); |
393 | //info->setFilename( namestr ); | 449 | //info->setFilename( namestr ); |
394 | 450 | ||
395 | QString namestr = newname; | 451 | QString namestr = newname; |
396 | namestr.append( " - " ); | 452 | namestr.append( " - " ); |
397 | namestr.append( tr( "Checkbook" ) ); | 453 | namestr.append( tr( "Checkbook" ) ); |
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; |
404 | info->setStartingBalance( newbalance.toFloat( &ok ) ); | 462 | info->setStartingBalance( newbalance.toFloat( &ok ) ); |
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 | { |
419 | // Add to transaction list | 479 | // Add to transaction list |
420 | info->addTransaction( traninfo ); | 480 | info->addTransaction( traninfo ); |
421 | 481 | ||
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 | } |
444 | 501 | ||
445 | void Checkbook::slotEditTran() | 502 | 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() ) |
468 | { | 522 | { |
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 | ||
478 | delete currtran; | 532 | delete currtran; |
479 | } | 533 | } |
480 | 534 | ||
481 | void Checkbook::slotDeleteTran() | 535 | 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 | { |
493 | info->removeTransaction( traninfo ); | 545 | info->removeTransaction( traninfo ); |
494 | delete curritem; | 546 | delete curritem; |
495 | adjustBalance(); | 547 | adjustBalance(); |
496 | } | 548 | } |
497 | } | 549 | } |
498 | 550 | ||
499 | void Checkbook::slotDrawGraph() | 551 | void Checkbook::slotDrawGraph() |
500 | { | 552 | { |
501 | if ( graphInfo ) | 553 | if ( graphInfo ) |
@@ -580,29 +632,30 @@ void Checkbook::drawCategoryChart( bool withdrawals ) | |||
580 | cat->addToValue( tran->amount() ); | 632 | cat->addToValue( tran->amount() ); |
581 | } | 633 | } |
582 | else | 634 | else |
583 | { // Didn't find category, add category to list | 635 | { // Didn't find category, add category to list |
584 | list->append( new DataPointInfo( tran->category(), tran->amount() ) ); | 636 | list->append( new DataPointInfo( tran->category(), tran->amount() ) ); |
585 | } | 637 | } |
586 | } | 638 | } |
587 | } | 639 | } |
588 | 640 | ||
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 | } |
600 | 653 | ||
601 | void CBListItem::paintCell( QPainter *p, const QColorGroup &cg, int column, int width, int align ) | 654 | void CBListItem::paintCell( QPainter *p, const QColorGroup &cg, int column, int width, int align ) |
602 | { | 655 | { |
603 | QColorGroup _cg = cg; | 656 | QColorGroup _cg = cg; |
604 | const QPixmap *pm = listView()->viewport()->backgroundPixmap(); | 657 | const QPixmap *pm = listView()->viewport()->backgroundPixmap(); |
605 | if ( pm && !pm->isNull() ) | 658 | if ( pm && !pm->isNull() ) |
606 | { | 659 | { |
607 | _cg.setBrush( QColorGroup::Base, QBrush( cg.base(), *pm ) ); | 660 | _cg.setBrush( QColorGroup::Base, QBrush( cg.base(), *pm ) ); |
608 | p->setBrushOrigin( -listView()->contentsX(), -listView()->contentsY() ); | 661 | p->setBrushOrigin( -listView()->contentsX(), -listView()->contentsY() ); |
@@ -643,12 +696,35 @@ bool CBListItem::isAltBackground() | |||
643 | 696 | ||
644 | while(item) | 697 | while(item) |
645 | { | 698 | { |
646 | item->m_odd = previous = !previous; | 699 | item->m_odd = previous = !previous; |
647 | item->m_known = true; | 700 | item->m_known = true; |
648 | item = (CBListItem *)( item->nextSibling() ); | 701 | item = (CBListItem *)( item->nextSibling() ); |
649 | } | 702 | } |
650 | } | 703 | } |
651 | return m_odd; | 704 | return m_odd; |
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 | |||
@@ -20,107 +20,123 @@ | |||
20 | : = ...= . :.=- You should have received a copy of the GNU | 20 | : = ...= . :.=- You should have received a copy of the GNU |
21 | -. .:....=;==+<; General Public License along with this file; | 21 | -. .:....=;==+<; General Public License along with this file; |
22 | -_. . . )=. = see the file COPYING. If not, write to the | 22 | -_. . . )=. = see the file COPYING. If not, write to the |
23 | -- :-=` Free Software Foundation, Inc., | 23 | -- :-=` Free Software Foundation, Inc., |
24 | 59 Temple Place - Suite 330, | 24 | 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #ifndef 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 | ||
35 | class OTabWidget; | 36 | class OTabWidget; |
36 | 37 | ||
37 | class CBInfo; | 38 | class CBInfo; |
38 | class Graph; | 39 | class Graph; |
39 | class GraphInfo; | 40 | class GraphInfo; |
40 | class QCheckBox; | 41 | class QCheckBox; |
41 | class QComboBox; | 42 | class QComboBox; |
42 | class QLabel; | 43 | class QLabel; |
43 | class QLineEdit; | 44 | class QLineEdit; |
44 | class QListView; | 45 | class QListView; |
45 | class QMultiLineEdit; | 46 | 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(); |
71 | QCheckBox *passwordCB; | 76 | QCheckBox *passwordCB; |
72 | QLineEdit *nameEdit; | 77 | QLineEdit *nameEdit; |
73 | QComboBox *typeList; | 78 | QComboBox *typeList; |
74 | QLineEdit *bankEdit; | 79 | QLineEdit *bankEdit; |
75 | QLineEdit *acctNumEdit; | 80 | QLineEdit *acctNumEdit; |
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(); |
87 | GraphInfo *graphInfo; | 94 | GraphInfo *graphInfo; |
88 | QComboBox *graphList; | 95 | QComboBox *graphList; |
89 | Graph *graphWidget; | 96 | Graph *graphWidget; |
90 | 97 | ||
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(); |
99 | void slotNameChanged( const QString & ); | 108 | void slotNameChanged( const QString & ); |
100 | void slotStartingBalanceChanged( const QString & ); | 109 | void slotStartingBalanceChanged( const QString & ); |
101 | void slotNewTran(); | 110 | void slotNewTran(); |
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; |
122 | 137 | ||
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,38 +1,42 @@ | |||
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 \ |
6 | graphinfo.h \ | 5 | graphinfo.h \ |
7 | configuration.h \ | 6 | configuration.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 \ |
14 | cbinfo.cpp \ | 16 | cbinfo.cpp \ |
15 | traninfo.cpp \ | 17 | traninfo.cpp \ |
16 | graphinfo.cpp \ | 18 | graphinfo.cpp \ |
17 | configuration.cpp \ | 19 | configuration.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 \ |
30 | ../../../i18n/da/checkbook.ts \ | 34 | ../../../i18n/da/checkbook.ts \ |
31 | ../../../i18n/xx/checkbook.ts \ | 35 | ../../../i18n/xx/checkbook.ts \ |
32 | ../../../i18n/en/checkbook.ts \ | 36 | ../../../i18n/en/checkbook.ts \ |
33 | ../../../i18n/es/checkbook.ts \ | 37 | ../../../i18n/es/checkbook.ts \ |
34 | ../../../i18n/fr/checkbook.ts \ | 38 | ../../../i18n/fr/checkbook.ts \ |
35 | ../../../i18n/hu/checkbook.ts \ | 39 | ../../../i18n/hu/checkbook.ts \ |
36 | ../../../i18n/ja/checkbook.ts \ | 40 | ../../../i18n/ja/checkbook.ts \ |
37 | ../../../i18n/ko/checkbook.ts \ | 41 | ../../../i18n/ko/checkbook.ts \ |
38 | ../../../i18n/no/checkbook.ts \ | 42 | ../../../i18n/no/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 | |||
@@ -18,57 +18,144 @@ | |||
18 | ..}^=.= = ; Public License for more details. | 18 | ..}^=.= = ; Public License for more details. |
19 | ++= -. .` .: | 19 | ++= -. .` .: |
20 | : = ...= . :.=- You should have received a copy of the GNU | 20 | : = ...= . :.=- You should have received a copy of the GNU |
21 | -. .:....=;==+<; General Public License along with this file; | 21 | -. .:....=;==+<; General Public License along with this file; |
22 | -_. . . )=. = see the file COPYING. If not, write to the | 22 | -_. . . )=. = see the file COPYING. If not, write to the |
23 | -- :-=` Free Software Foundation, Inc., | 23 | -- :-=` Free Software Foundation, Inc., |
24 | 59 Temple Place - Suite 330, | 24 | 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include "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 | |||
@@ -21,31 +21,47 @@ | |||
21 | -. .:....=;==+<; General Public License along with this file; | 21 | -. .:....=;==+<; General Public License along with this file; |
22 | -_. . . )=. = see the file COPYING. If not, write to the | 22 | -_. . . )=. = see the file COPYING. If not, write to the |
23 | -- :-=` Free Software Foundation, Inc., | 23 | -- :-=` Free Software Foundation, Inc., |
24 | 59 Temple Place - Suite 330, | 24 | 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #ifndef CONFIGURATION_H | 29 | #ifndef CONFIGURATION_H |
30 | #define CONFIGURATION_H | 30 | #define CONFIGURATION_H |
31 | 31 | ||
32 | #include <qdialog.h> | 32 | #include <qdialog.h> |
33 | #include "cfg.h" | ||
33 | 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 | |||
@@ -17,26 +17,18 @@ | |||
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
18 | ..}^=.= = ; Public License for more details. | 18 | ..}^=.= = ; Public License for more details. |
19 | ++= -. .` .: | 19 | ++= -. .` .: |
20 | : = ...= . :.=- You should have received a copy of the GNU | 20 | : = ...= . :.=- You should have received a copy of the GNU |
21 | -. .:....=;==+<; General Public License along with this file; | 21 | -. .:....=;==+<; General Public License along with this file; |
22 | -_. . . )=. = see the file COPYING. If not, write to the | 22 | -_. . . )=. = see the file COPYING. If not, write to the |
23 | -- :-=` Free Software Foundation, Inc., | 23 | -- :-=` Free Software Foundation, Inc., |
24 | 59 Temple Place - Suite 330, | 24 | 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include "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 | |||
@@ -22,53 +22,54 @@ | |||
22 | -_. . . )=. = see the file COPYING. If not, write to the | 22 | -_. . . )=. = see the file COPYING. If not, write to the |
23 | -- :-=` Free Software Foundation, Inc., | 23 | -- :-=` Free Software Foundation, Inc., |
24 | 59 Temple Place - Suite 330, | 24 | 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include "mainwindow.h" | 29 | #include "mainwindow.h" |
30 | #include "cbinfo.h" | 30 | #include "cbinfo.h" |
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> |
37 | #include <qpe/qpeapplication.h> | 38 | #include <qpe/qpeapplication.h> |
38 | #include <qpe/qpemenubar.h> | 39 | #include <qpe/qpemenubar.h> |
39 | #include <qpe/qpemessagebox.h> | 40 | #include <qpe/qpemessagebox.h> |
40 | #include <qpe/qpetoolbar.h> | 41 | #include <qpe/qpetoolbar.h> |
41 | #include <qpe/resource.h> | 42 | #include <qpe/resource.h> |
42 | 43 | ||
43 | #include <qaction.h> | 44 | #include <qaction.h> |
44 | #include <qcheckbox.h> | 45 | #include <qcheckbox.h> |
45 | #include <qdir.h> | 46 | #include <qdir.h> |
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 | ||
54 | cbDir = Global::applicationFileName( "checkbook", "" ); | 56 | cbDir = Global::applicationFileName( "checkbook", "" ); |
55 | lockIcon = Resource::loadPixmap( "locked" ); | 57 | lockIcon = Resource::loadPixmap( "locked" ); |
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 ); |
66 | 67 | ||
67 | QPEToolBar *bar = new QPEToolBar( this ); | 68 | QPEToolBar *bar = new QPEToolBar( this ); |
68 | bar->setHorizontalStretchable( TRUE ); | 69 | bar->setHorizontalStretchable( TRUE ); |
69 | QPEMenuBar *mb = new QPEMenuBar( bar ); | 70 | QPEMenuBar *mb = new QPEMenuBar( bar ); |
70 | mb->setMargin( 0 ); | 71 | mb->setMargin( 0 ); |
71 | QPopupMenu *popup = new QPopupMenu( this ); | 72 | QPopupMenu *popup = new QPopupMenu( this ); |
72 | 73 | ||
73 | bar = new QPEToolBar( this ); | 74 | bar = new QPEToolBar( this ); |
74 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); | 75 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); |
@@ -116,220 +117,244 @@ MainWindow::MainWindow() | |||
116 | { | 117 | { |
117 | filename = cbDir; | 118 | filename = cbDir; |
118 | filename.append( (*it) ); | 119 | filename.append( (*it) ); |
119 | 120 | ||
120 | cb = new CBInfo( (*it).remove( (*it).find('.'), (*it).length() ), filename ); | 121 | cb = new CBInfo( (*it).remove( (*it).find('.'), (*it).length() ), filename ); |
121 | checkbooks->inSort( cb ); | 122 | checkbooks->inSort( cb ); |
122 | } | 123 | } |
123 | } | 124 | } |
124 | 125 | ||
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; |
149 | } | 166 | } |
150 | else | 167 | else |
151 | { | 168 | { |
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 ); |
159 | } | 176 | } |
160 | cbList->setAllColumnsShowFocus( TRUE ); | 177 | cbList->setAllColumnsShowFocus( TRUE ); |
161 | cbList->setSorting( posName ); | 178 | cbList->setSorting( posName ); |
162 | QPEApplication::setStylusOperation( cbList->viewport(), QPEApplication::RightOnHold ); | 179 | QPEApplication::setStylusOperation( cbList->viewport(), QPEApplication::RightOnHold ); |
163 | connect( cbList, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint &, int ) ), | 180 | connect( cbList, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint &, int ) ), |
164 | this, SLOT( slotEdit() ) ); | 181 | this, SLOT( slotEdit() ) ); |
165 | setCentralWidget( cbList ); | 182 | setCentralWidget( cbList ); |
166 | 183 | ||
167 | for ( CBInfo *cb = checkbooks->first(); cb; cb = checkbooks->next() ) | 184 | for ( CBInfo *cb = checkbooks->first(); cb; cb = checkbooks->next() ) |
168 | { | 185 | { |
169 | addCheckbook( cb ); | 186 | addCheckbook( cb ); |
170 | } | 187 | } |
171 | } | 188 | } |
172 | 189 | ||
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 | } |
188 | 205 | ||
189 | void MainWindow::buildFilename( const QString &name ) | 206 | void MainWindow::buildFilename( const QString &name ) |
190 | { | 207 | { |
191 | tempFilename = cbDir; | 208 | tempFilename = cbDir; |
192 | tempFilename.append( name ); | 209 | tempFilename.append( name ); |
193 | tempFilename.append( ".qcb" ); | 210 | tempFilename.append( ".qcb" ); |
194 | } | 211 | } |
195 | 212 | ||
196 | void MainWindow::slotNew() | 213 | 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 | ||
209 | // Add to listbox | 227 | // Add to listbox |
210 | checkbooks->inSort( cb ); | 228 | checkbooks->inSort( cb ); |
211 | addCheckbook( cb ); | 229 | addCheckbook( cb ); |
212 | } | 230 | } |
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(); |
241 | 262 | ||
242 | if ( currlock ) | 263 | if ( currlock ) |
243 | { | 264 | { |
244 | Password *pw = new Password( this, tr( "Enter password" ), tr( "Please enter your password:" ) ); | 265 | Password *pw = new Password( this, tr( "Enter password" ), tr( "Please enter your password:" ) ); |
245 | if ( pw->exec() != QDialog::Accepted || pw->password != cb->password() ) | 266 | if ( pw->exec() != QDialog::Accepted || pw->password != cb->password() ) |
246 | { | 267 | { |
247 | delete pw; | 268 | delete pw; |
248 | return; | 269 | return; |
249 | } | 270 | } |
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 | { |
257 | QString newname = cb->name(); | 279 | QString newname = cb->name(); |
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 ); |
273 | cb->setFilename( tempFilename ); | 296 | cb->setFilename( tempFilename ); |
274 | } | 297 | } |
275 | 298 | ||
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 ); |
283 | else | 306 | else |
284 | curritem->setPixmap( 0, nullIcon ); | 307 | curritem->setPixmap( 0, nullIcon ); |
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 ); |
301 | 325 | ||
302 | if ( QPEMessageBox::confirmDelete ( this, tr( "Delete checkbook" ), currname ) ) | 326 | if ( QPEMessageBox::confirmDelete ( this, tr( "Delete checkbook" ), currname ) ) |
303 | { | 327 | { |
304 | buildFilename( currname ); | 328 | buildFilename( currname ); |
305 | QFile f( tempFilename ); | 329 | QFile f( tempFilename ); |
306 | if ( f.exists() ) | 330 | if ( f.exists() ) |
307 | { | 331 | { |
308 | f.remove(); | 332 | f.remove(); |
309 | } | 333 | } |
310 | 334 | ||
311 | delete cbList->currentItem(); | 335 | delete cbList->currentItem(); |
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 | |||
@@ -22,48 +22,55 @@ | |||
22 | -_. . . )=. = see the file COPYING. If not, write to the | 22 | -_. . . )=. = see the file COPYING. If not, write to the |
23 | -- :-=` Free Software Foundation, Inc., | 23 | -- :-=` Free Software Foundation, Inc., |
24 | 59 Temple Place - Suite 330, | 24 | 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #ifndef MAINWINDOW_H | 29 | #ifndef MAINWINDOW_H |
30 | #define MAINWINDOW_H | 30 | #define MAINWINDOW_H |
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; |
51 | QString cbDir; | 60 | QString cbDir; |
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; |
61 | QString tempFilename; | 68 | QString tempFilename; |
62 | QPixmap lockIcon; | 69 | QPixmap lockIcon; |
63 | QPixmap nullIcon; | 70 | QPixmap nullIcon; |
64 | 71 | ||
65 | void buildList(); | 72 | void buildList(); |
66 | void addCheckbook( CBInfo * ); | 73 | void addCheckbook( CBInfo * ); |
67 | void buildFilename( const QString & ); | 74 | void buildFilename( const QString & ); |
68 | 75 | ||
69 | private slots: | 76 | private slots: |
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 | |||
@@ -25,36 +25,37 @@ | |||
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include "traninfo.h" | 29 | #include "traninfo.h" |
30 | 30 | ||
31 | #include <qpe/config.h> | 31 | #include <qpe/config.h> |
32 | 32 | ||
33 | QString tempstr; | 33 | 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; |
41 | td = date; | 41 | td = date; |
42 | w = withdrawal; | 42 | w = withdrawal; |
43 | t = type; | 43 | t = type; |
44 | c = category; | 44 | c = category; |
45 | a = amount; | 45 | a = amount; |
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 ) |
52 | { | 53 | { |
53 | config.setGroup( QString::number( entry ) ); | 54 | config.setGroup( QString::number( entry ) ); |
54 | QString desc = config.readEntry( "Description", "Not Found" ); | 55 | QString desc = config.readEntry( "Description", "Not Found" ); |
55 | if ( desc != "Not Found" ) | 56 | if ( desc != "Not Found" ) |
56 | { | 57 | { |
57 | // ID | 58 | // ID |
58 | i = entry; | 59 | i = entry; |
59 | 60 | ||
60 | // Description | 61 | // Description |
@@ -107,45 +108,50 @@ TranInfo::TranInfo( Config config, int entry ) | |||
107 | bool ok; | 108 | bool ok; |
108 | a = stramount.toFloat( &ok ); | 109 | a = stramount.toFloat( &ok ); |
109 | 110 | ||
110 | // Transaction fee | 111 | // Transaction fee |
111 | stramount = config.readEntry( "TransactionFee", "0.00" ); | 112 | stramount = config.readEntry( "TransactionFee", "0.00" ); |
112 | f = stramount.toFloat( &ok ); | 113 | f = stramount.toFloat( &ok ); |
113 | 114 | ||
114 | // Transaction number | 115 | // Transaction number |
115 | cn = config.readEntry( "CheckNumber", "" ); | 116 | cn = config.readEntry( "CheckNumber", "" ); |
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 | ||
143 | tempstr = QString::number( td.month() ); | 149 | tempstr = QString::number( td.month() ); |
144 | tempstr.append( '/' ); | 150 | tempstr.append( '/' ); |
145 | tempstr.append( QString::number( td.day() ) ); | 151 | tempstr.append( QString::number( td.day() ) ); |
146 | tempstr.append( '/' ); | 152 | tempstr.append( '/' ); |
147 | tempstr.append( QString::number( td.year() ) ); | 153 | tempstr.append( QString::number( td.year() ) ); |
148 | config->writeEntry( "Date", tempstr ); | 154 | config->writeEntry( "Date", tempstr ); |
149 | 155 | ||
150 | w ? tempstr = "true" | 156 | w ? tempstr = "true" |
151 | : tempstr = "false"; | 157 | : tempstr = "false"; |
@@ -161,30 +167,46 @@ void TranInfo::write( Config *config, int entry ) | |||
161 | tempstr = "3"; | 167 | tempstr = "3"; |
162 | config->writeEntry( "Type", tempstr ); | 168 | config->writeEntry( "Type", tempstr ); |
163 | 169 | ||
164 | config->writeEntry( "Category", c ); | 170 | config->writeEntry( "Category", c ); |
165 | 171 | ||
166 | tempstr.setNum( a, 'f', 2 ); | 172 | tempstr.setNum( a, 'f', 2 ); |
167 | config->writeEntry( "Amount", tempstr ); | 173 | config->writeEntry( "Amount", tempstr ); |
168 | 174 | ||
169 | tempstr.setNum( f, 'f', 2 ); | 175 | tempstr.setNum( f, 'f', 2 ); |
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(); |
180 | QDate d2 = ((TranInfo *)item2)->date(); | 187 | QDate d2 = ((TranInfo *)item2)->date(); |
181 | int r = -1; | 188 | int r = -1; |
182 | 189 | ||
183 | if ( d1 < d2 ) | 190 | if ( d1 < d2 ) |
184 | r = -1; | 191 | r = -1; |
185 | else if ( d1 == d2 ) | 192 | else if ( d1 == d2 ) |
186 | r = 0; | 193 | r = 0; |
187 | else if ( d1 > d2 ) | 194 | else if ( d1 > d2 ) |
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 | |||
@@ -31,59 +31,70 @@ | |||
31 | 31 | ||
32 | #include <qdatetime.h> | 32 | #include <qdatetime.h> |
33 | #include <qlist.h> | 33 | #include <qlist.h> |
34 | 34 | ||
35 | class Config; | 35 | class Config; |
36 | 36 | ||
37 | class TranInfo | 37 | class TranInfo |
38 | { | 38 | { |
39 | public: | 39 | public: |
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(); |
50 | bool withdrawal()const { return w; } | 53 | bool withdrawal()const { return w; } |
51 | const QString &type() const { return t; } | 54 | const QString &type() const { return t; } |
52 | const QString &category()const { return c; } | 55 | const QString &category()const { return c; } |
53 | float amount() const { return a; } | 56 | float amount() const { return a; } |
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; } |
61 | void setType( const QString &type ) { t = type; } | 66 | void setType( const QString &type ) { t = type; } |
62 | void setCategory( const QString &cat ){ c = cat; } | 67 | void setCategory( const QString &cat ){ c = cat; } |
63 | void setAmount( float amount ) { a = amount; } | 68 | void setAmount( float amount ) { a = amount; } |
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; |
72 | QString d; | 82 | QString d; |
73 | QDate td; | 83 | QDate td; |
74 | bool w; | 84 | bool w; |
75 | QString t; | 85 | QString t; |
76 | QString c; | 86 | QString c; |
77 | float a; | 87 | float a; |
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> |
84 | { | 95 | { |
85 | protected: | 96 | protected: |
86 | int compareItems( QCollection::Item, QCollection::Item ); | 97 | int compareItems( QCollection::Item, QCollection::Item ); |
87 | }; | 98 | }; |
88 | 99 | ||
89 | #endif | 100 | #endif |
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 | |||
@@ -19,46 +19,47 @@ | |||
19 | ++= -. .` .: | 19 | ++= -. .` .: |
20 | : = ...= . :.=- You should have received a copy of the GNU | 20 | : = ...= . :.=- You should have received a copy of the GNU |
21 | -. .:....=;==+<; General Public License along with this file; | 21 | -. .:....=;==+<; General Public License along with this file; |
22 | -_. . . )=. = see the file COPYING. If not, write to the | 22 | -_. . . )=. = see the file COPYING. If not, write to the |
23 | -- :-=` Free Software Foundation, Inc., | 23 | -- :-=` Free Software Foundation, Inc., |
24 | 59 Temple Place - Suite 330, | 24 | 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include "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 | ||
34 | #include <qbuttongroup.h> | 35 | #include <qbuttongroup.h> |
35 | #include <qcombobox.h> | 36 | #include <qcombobox.h> |
36 | #include <qlabel.h> | 37 | #include <qlabel.h> |
37 | #include <qlayout.h> | 38 | #include <qlayout.h> |
38 | #include <qlineedit.h> | 39 | #include <qlineedit.h> |
39 | #include <qmultilineedit.h> | 40 | #include <qmultilineedit.h> |
40 | #include <qradiobutton.h> | 41 | #include <qradiobutton.h> |
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 " ); |
48 | tempstr.append( acctname ); | 49 | tempstr.append( acctname ); |
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 | ||
56 | QScrollView *sv = new QScrollView( this ); | 57 | QScrollView *sv = new QScrollView( this ); |
57 | vb->addWidget( sv, 0, 0 ); | 58 | vb->addWidget( sv, 0, 0 ); |
58 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 59 | sv->setResizePolicy( QScrollView::AutoOneFit ); |
59 | sv->setFrameStyle( QFrame::NoFrame ); | 60 | sv->setFrameStyle( QFrame::NoFrame ); |
60 | 61 | ||
61 | QWidget *container = new QWidget( sv->viewport() ); | 62 | QWidget *container = new QWidget( sv->viewport() ); |
62 | sv->addChild( container ); | 63 | sv->addChild( container ); |
63 | 64 | ||
64 | QGridLayout *layout = new QGridLayout( container ); | 65 | QGridLayout *layout = new QGridLayout( container ); |
@@ -221,53 +222,48 @@ void Transaction::accept() | |||
221 | bool ok; | 222 | bool ok; |
222 | tran->setAmount( amtEdit->text().toFloat( &ok ) ); | 223 | tran->setAmount( amtEdit->text().toFloat( &ok ) ); |
223 | tran->setFee( feeEdit->text().toFloat( &ok ) ); | 224 | tran->setFee( feeEdit->text().toFloat( &ok ) ); |
224 | tran->setNumber( numEdit->text() ); | 225 | tran->setNumber( numEdit->text() ); |
225 | tran->setNotes( noteEdit->text() ); | 226 | tran->setNotes( noteEdit->text() ); |
226 | 227 | ||
227 | QDialog::accept(); | 228 | QDialog::accept(); |
228 | } | 229 | } |
229 | 230 | ||
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" ) ); |
251 | typeList->insertItem( tr( "Transfer" ) ); | 244 | typeList->insertItem( tr( "Transfer" ) ); |
252 | typeList->insertItem( tr( "Credit Card" ) ); | 245 | typeList->insertItem( tr( "Credit Card" ) ); |
253 | } | 246 | } |
254 | 247 | ||
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" ) ); |
265 | typeList->insertItem( tr( "Transfer" ) ); | 261 | typeList->insertItem( tr( "Transfer" ) ); |
266 | typeList->insertItem( tr( "Cash" ) ); | 262 | typeList->insertItem( tr( "Cash" ) ); |
267 | } | 263 | } |
268 | 264 | ||
269 | void Transaction::slotDateChanged( int y, int m, int d ) | 265 | void Transaction::slotDateChanged( int y, int m, int d ) |
270 | { | 266 | { |
271 | QDate date; | 267 | QDate date; |
272 | date.setYMD( y, m, d ); | 268 | date.setYMD( y, m, d ); |
273 | dateBtn->setText( TimeString::shortDate( date ) ); | 269 | dateBtn->setText( TimeString::shortDate( date ) ); |
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 | |||
@@ -31,38 +31,38 @@ | |||
31 | 31 | ||
32 | #include <qdialog.h> | 32 | #include <qdialog.h> |
33 | 33 | ||
34 | class DateBookMonth; | 34 | class DateBookMonth; |
35 | class QComboBox; | 35 | class QComboBox; |
36 | class QLineEdit; | 36 | class QLineEdit; |
37 | class QMultiLineEdit; | 37 | class QMultiLineEdit; |
38 | class QPushButton; | 38 | class QPushButton; |
39 | class QRadioButton; | 39 | 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; |
60 | QPushButton *dateBtn; | 60 | QPushButton *dateBtn; |
61 | DateBookMonth *datePicker; | 61 | DateBookMonth *datePicker; |
62 | QLineEdit *numEdit; | 62 | QLineEdit *numEdit; |
63 | QLineEdit *descEdit; | 63 | QLineEdit *descEdit; |
64 | QComboBox *catList; | 64 | QComboBox *catList; |
65 | QComboBox *typeList; | 65 | QComboBox *typeList; |
66 | QLineEdit *amtEdit; | 66 | QLineEdit *amtEdit; |
67 | QLineEdit *feeEdit; | 67 | QLineEdit *feeEdit; |
68 | QMultiLineEdit *noteEdit; | 68 | QMultiLineEdit *noteEdit; |
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 | |||
@@ -8,22 +8,17 @@ | |||
8 | 8 | ||
9 | /*************************************************************************** | 9 | /*************************************************************************** |
10 | * * | 10 | * * |
11 | * This program is free software; you can redistribute it and/or modify * | 11 | * This program is free software; you can redistribute it and/or modify * |
12 | * it under the terms of the GNU General Public License as published by * | 12 | * it under the terms of the GNU General Public License as published by * |
13 | * the Free Software Foundation; either version 2 of the License, or * | 13 | * the Free Software Foundation; either version 2 of the License, or * |
14 | * ( at your option ) any later version. * | 14 | * ( at your option ) any later version. * |
15 | * * | 15 | * * |
16 | **************************************************************************/ | 16 | **************************************************************************/ |
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 | |||
@@ -27,25 +27,25 @@ | |||
27 | #include <qlabel.h> | 27 | #include <qlabel.h> |
28 | #include <qpushbutton.h> | 28 | #include <qpushbutton.h> |
29 | #include <qlineedit.h> | 29 | #include <qlineedit.h> |
30 | #include <qmainwindow.h> | 30 | #include <qmainwindow.h> |
31 | #include <qstring.h> | 31 | #include <qstring.h> |
32 | #include <qaction.h> | 32 | #include <qaction.h> |
33 | #include <qtextbrowser.h> | 33 | #include <qtextbrowser.h> |
34 | #include <qcombobox.h> | 34 | #include <qcombobox.h> |
35 | 35 | ||
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 | ||
43 | vbox = new QVBox( this ); | 43 | vbox = new QVBox( this ); |
44 | setCaption( tr( "Opie-Dictionary" ) ); | 44 | setCaption( tr( "Opie-Dictionary" ) ); |
45 | setupMenus(); | 45 | setupMenus(); |
46 | 46 | ||
47 | QHBox *hbox = new QHBox( vbox ); | 47 | QHBox *hbox = new QHBox( vbox ); |
48 | QLabel* query_label = new QLabel( tr( "Query:" ) , hbox ); | 48 | QLabel* query_label = new QLabel( tr( "Query:" ) , hbox ); |
49 | query_label->show(); | 49 | query_label->show(); |
50 | query_le = new QLineEdit( hbox ); | 50 | query_le = new QLineEdit( hbox ); |
51 | query_co = new QComboBox( hbox ); | 51 | query_co = new QComboBox( hbox ); |
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 | |||
@@ -20,30 +20,30 @@ class QAction; | |||
20 | class QVBoxLayout; | 20 | class QVBoxLayout; |
21 | class QActionGroup; | 21 | class QActionGroup; |
22 | class DingWidget; | 22 | class DingWidget; |
23 | class QTextBrowser; | 23 | class QTextBrowser; |
24 | class QComboBox; | 24 | class QComboBox; |
25 | class DingWidget; | 25 | class DingWidget; |
26 | 26 | ||
27 | class ODict : public QMainWindow | 27 | class ODict : public QMainWindow |
28 | { | 28 | { |
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; |
41 | QHBox *hbox; | 41 | QHBox *hbox; |
42 | QLineEdit *query_le; | 42 | QLineEdit *query_le; |
43 | QComboBox *query_co; | 43 | QComboBox *query_co; |
44 | QPushButton *ok_button; | 44 | QPushButton *ok_button; |
45 | 45 | ||
46 | QVBoxLayout *vbox_layout; | 46 | QVBoxLayout *vbox_layout; |
47 | 47 | ||
48 | QAction *setting_a, *setting_b; | 48 | QAction *setting_a, *setting_b; |
49 | 49 | ||
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,30 +1,27 @@ | |||
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 \ |
7 | dingwidget.h | 5 | dingwidget.h |
8 | 6 | ||
9 | SOURCES = main.cpp \ | 7 | SOURCES = main.cpp \ |
10 | odict.cpp \ | 8 | odict.cpp \ |
11 | searchmethoddlg.cpp \ | 9 | searchmethoddlg.cpp \ |
12 | configdlg.cpp \ | 10 | configdlg.cpp \ |
13 | dingwidget.cpp | 11 | dingwidget.cpp |
14 | INCLUDEPATH += $(OPIEDIR)/include | 12 | 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 \ |
22 | ../../../i18n/xx/odict.ts \ | 19 | ../../../i18n/xx/odict.ts \ |
23 | ../../../i18n/en/odict.ts \ | 20 | ../../../i18n/en/odict.ts \ |
24 | ../../../i18n/es/odict.ts \ | 21 | ../../../i18n/es/odict.ts \ |
25 | ../../../i18n/fr/odict.ts \ | 22 | ../../../i18n/fr/odict.ts \ |
26 | ../../../i18n/hu/odict.ts \ | 23 | ../../../i18n/hu/odict.ts \ |
27 | ../../../i18n/ja/odict.ts \ | 24 | ../../../i18n/ja/odict.ts \ |
28 | ../../../i18n/ko/odict.ts \ | 25 | ../../../i18n/ko/odict.ts \ |
29 | ../../../i18n/no/odict.ts \ | 26 | ../../../i18n/no/odict.ts \ |
30 | ../../../i18n/pl/odict.ts \ | 27 | ../../../i18n/pl/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,11 +1,11 @@ | |||
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> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Version: 0.6-$SUB_VERSION | 7 | Version: 0.6-$SUB_VERSION |
8 | Depends: qpe-base, libopie1, opie-console-help-en, lrzsz, opie-keytabs | 8 | Depends: qpe-base, libopie1, opie-console-help-en, lrzsz, opie-keytabs |
9 | License: GPL | 9 | License: GPL |
10 | Description: Opie terminal app | 10 | Description: Opie terminal app |
11 | 11 | ||
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,13 +1,12 @@ | |||
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 \ |
5 | BuffDoc.h \ | 4 | BuffDoc.h \ |
6 | CAnnoEdit.h \ | 5 | CAnnoEdit.h \ |
7 | CBuffer.h \ | 6 | CBuffer.h \ |
8 | CDrawBuffer.h \ | 7 | CDrawBuffer.h \ |
9 | CEncoding.h \ | 8 | CEncoding.h \ |
10 | CEncoding_tables.h \ | 9 | CEncoding_tables.h \ |
11 | CExpander.h \ | 10 | CExpander.h \ |
12 | CFilter.h \ | 11 | CFilter.h \ |
13 | CloseDialog.h \ | 12 | CloseDialog.h \ |
@@ -72,22 +71,22 @@ SOURCES = Aportis.cpp \ | |||
72 | arith_d.cpp \ | 71 | arith_d.cpp \ |
73 | fileBrowser.cpp \ | 72 | fileBrowser.cpp \ |
74 | infowin.cpp \ | 73 | infowin.cpp \ |
75 | main.cpp \ | 74 | main.cpp \ |
76 | pdb.cpp \ | 75 | pdb.cpp \ |
77 | plucker.cpp \ | 76 | plucker.cpp \ |
78 | plucker_base.cpp \ | 77 | plucker_base.cpp \ |
79 | ppm.cpp \ | 78 | ppm.cpp \ |
80 | ppm_expander.cpp \ | 79 | ppm_expander.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 ) |
92 | 91 | ||
93 | 92 | ||
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 | |||
@@ -7,22 +7,16 @@ | |||
7 | * * | 7 | * * |
8 | ***************************************************************************/ | 8 | ***************************************************************************/ |
9 | 9 | ||
10 | /* | 10 | /* |
11 | * Opie Sheet (formerly Sheet/Qt) | 11 | * Opie Sheet (formerly Sheet/Qt) |
12 | * by Serdar Ozler <sozler@sitebest.com> | 12 | * by Serdar Ozler <sozler@sitebest.com> |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <qpe/qpeapplication.h> | 15 | #include <qpe/qpeapplication.h> |
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 | |||
@@ -34,26 +34,26 @@ | |||
34 | #include "func-divide.xpm" | 34 | #include "func-divide.xpm" |
35 | #include "func-paran-open.xpm" | 35 | #include "func-paran-open.xpm" |
36 | #include "func-paran-close.xpm" | 36 | #include "func-paran-close.xpm" |
37 | #include "func-comma.xpm" | 37 | #include "func-comma.xpm" |
38 | #include "func-func.xpm" | 38 | #include "func-func.xpm" |
39 | #include "func-equal.xpm" | 39 | #include "func-equal.xpm" |
40 | #include "cell-select.xpm" | 40 | #include "cell-select.xpm" |
41 | 41 | ||
42 | #define DEFAULT_NUM_ROWS 199 | 42 | #define DEFAULT_NUM_ROWS 199 |
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; |
51 | 51 | ||
52 | // construct objects | 52 | // construct objects |
53 | currentDoc=0; | 53 | currentDoc=0; |
54 | fileSelector=new FileSelector("application/sheet-qt", this, QString::null); | 54 | fileSelector=new FileSelector("application/sheet-qt", this, QString::null); |
55 | connect(fileSelector, SIGNAL(closeMe()), this, SLOT(selectorHide())); | 55 | connect(fileSelector, SIGNAL(closeMe()), this, SLOT(selectorHide())); |
56 | connect(fileSelector, SIGNAL(newSelected(const DocLnk &)), this, SLOT(selectorFileNew(const DocLnk &))); | 56 | connect(fileSelector, SIGNAL(newSelected(const DocLnk &)), this, SLOT(selectorFileNew(const DocLnk &))); |
57 | connect(fileSelector, SIGNAL(fileSelected(const DocLnk &)), this, SLOT(selectorFileOpen(const DocLnk &))); | 57 | connect(fileSelector, SIGNAL(fileSelected(const DocLnk &)), this, SLOT(selectorFileOpen(const DocLnk &))); |
58 | 58 | ||
59 | listSheets.setAutoDelete(TRUE); | 59 | listSheets.setAutoDelete(TRUE); |
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 | |||
@@ -111,22 +111,23 @@ class MainWindow: public QMainWindow | |||
111 | void slotSheetRemove(); | 111 | void slotSheetRemove(); |
112 | void slotFuncOutput(); | 112 | void slotFuncOutput(); |
113 | void slotCellSelect(bool lock); | 113 | void slotCellSelect(bool lock); |
114 | void slotCellClicked(const QString &cell); | 114 | void slotCellClicked(const QString &cell); |
115 | void slotSheetChanged(const QString &name); | 115 | void slotSheetChanged(const QString &name); |
116 | void slotDocModified(); | 116 | void slotDocModified(); |
117 | void selectorShow(); | 117 | void selectorShow(); |
118 | void selectorHide(); | 118 | void selectorHide(); |
119 | void selectorFileNew(const DocLnk &lnkDoc); | 119 | void selectorFileNew(const DocLnk &lnkDoc); |
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; } |
127 | 128 | ||
128 | public slots: | 129 | public slots: |
129 | void setDocument(const QString &applnk_filename); | 130 | void setDocument(const QString &applnk_filename); |
130 | }; | 131 | }; |
131 | 132 | ||
132 | #endif | 133 | #endif |
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,15 +1,13 @@ | |||
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 |
7 | DEPENDPATH+= $(OPIEDIR)/include | 5 | DEPENDPATH+= $(OPIEDIR)/include |
8 | LIBS += -lqpe | 6 | LIBS += -lqpe |
9 | TARGET = sheetqt | 7 | TARGET = sheetqt |
10 | 8 | ||
11 | TRANSLATIONS = ../../../i18n/de/sheetqt.ts \ | 9 | TRANSLATIONS = ../../../i18n/de/sheetqt.ts \ |
12 | ../../../i18n/nl/sheetqt.ts \ | 10 | ../../../i18n/nl/sheetqt.ts \ |
13 | ../../../i18n/da/sheetqt.ts \ | 11 | ../../../i18n/da/sheetqt.ts \ |
14 | ../../../i18n/xx/sheetqt.ts \ | 12 | ../../../i18n/xx/sheetqt.ts \ |
15 | ../../../i18n/en/sheetqt.ts \ | 13 | ../../../i18n/en/sheetqt.ts \ |
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 | |||
@@ -11,27 +11,18 @@ | |||
11 | ** THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 11 | ** THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
12 | ** PURPOSE. | 12 | ** PURPOSE. |
13 | ** | 13 | ** |
14 | ** email sales@trolltech.com for information about Qtopia License | 14 | ** email sales@trolltech.com for information about Qtopia License |
15 | ** Agreements. | 15 | ** Agreements. |
16 | ** | 16 | ** |
17 | ** Contact info@trolltech.com if any conditions of this licensing are | 17 | ** Contact info@trolltech.com if any conditions of this licensing are |
18 | ** not clear to you. | 18 | ** not clear to you. |
19 | ** | 19 | ** |
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 | |||
@@ -91,26 +91,26 @@ protected: | |||
91 | virtual void drawButtonLabel( QPainter *p ) { | 91 | virtual void drawButtonLabel( QPainter *p ) { |
92 | p->translate( -4, 0 ); | 92 | p->translate( -4, 0 ); |
93 | QToolButton::drawButtonLabel( p ); | 93 | QToolButton::drawButtonLabel( p ); |
94 | p->translate( 4, 0 ); | 94 | p->translate( 4, 0 ); |
95 | } | 95 | } |
96 | 96 | ||
97 | private: | 97 | private: |
98 | int current; | 98 | int current; |
99 | }; | 99 | }; |
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); |
108 | 108 | ||
109 | editorStack = new QWidgetStack( this ); | 109 | editorStack = new QWidgetStack( this ); |
110 | 110 | ||
111 | fileSelector = new FileSelector( "text/html", | 111 | fileSelector = new FileSelector( "text/html", |
112 | editorStack, "fileselector" ); | 112 | editorStack, "fileselector" ); |
113 | 113 | ||
114 | 114 | ||
115 | fileSelector->setCloseVisible( FALSE ); | 115 | fileSelector->setCloseVisible( FALSE ); |
116 | editorStack->addWidget( fileSelector, 0 ); | 116 | editorStack->addWidget( fileSelector, 0 ); |
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 | |||
@@ -36,27 +36,29 @@ class ButtonMenu; | |||
36 | 36 | ||
37 | namespace Qt3 { | 37 | namespace Qt3 { |
38 | 38 | ||
39 | class QTextEdit; | 39 | class QTextEdit; |
40 | 40 | ||
41 | } | 41 | } |
42 | 42 | ||
43 | class MainWindow : public QMainWindow | 43 | class MainWindow : public QMainWindow |
44 | { | 44 | { |
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 | ||
54 | private slots: | 56 | private slots: |
55 | // new file functions | 57 | // new file functions |
56 | void fileOpen(); | 58 | void fileOpen(); |
57 | void fileRevert(); | 59 | void fileRevert(); |
58 | void fileNew(); | 60 | void fileNew(); |
59 | 61 | ||
60 | void editUndo(); | 62 | void editUndo(); |
61 | void editRedo(); | 63 | void editRedo(); |
62 | void editCut(); | 64 | void editCut(); |
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,46 +1,27 @@ | |||
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 \ |
8 | qrichtext_p.h \ | 7 | qrichtext_p.h \ |
9 | qstylesheet.h \ | 8 | qstylesheet.h \ |
10 | qtextedit.h \ | 9 | qtextedit.h \ |
11 | mainwindow.h | 10 | mainwindow.h |
12 | 11 | ||
13 | SOURCES =qcomplextext.cpp \ | 12 | SOURCES =qcomplextext.cpp \ |
14 | qstylesheet.cpp \ | 13 | qstylesheet.cpp \ |
15 | qrichtext_p.cpp \ | 14 | qrichtext_p.cpp \ |
16 | qrichtext.cpp \ | 15 | qrichtext.cpp \ |
17 | qtextedit.cpp \ | 16 | qtextedit.cpp \ |
18 | main.cpp \ | 17 | main.cpp \ |
19 | mainwindow.cpp | 18 | mainwindow.cpp |
20 | 19 | ||
21 | INCLUDEPATH+= $(OPIEDIR)/include | 20 | INCLUDEPATH+= $(OPIEDIR)/include |
22 | DEPENDPATH+= $(OPIEDIR)/include | 21 | DEPENDPATH+= $(OPIEDIR)/include |
23 | LIBS += -lqpe | 22 | 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 | |||
@@ -8,22 +8,17 @@ | |||
8 | 8 | ||
9 | /*************************************************************************** | 9 | /*************************************************************************** |
10 | * * | 10 | * * |
11 | * This program is free software; you can redistribute it and/or modify * | 11 | * This program is free software; you can redistribute it and/or modify * |
12 | * it under the terms of the GNU General Public License as published by * | 12 | * it under the terms of the GNU General Public License as published by * |
13 | * the Free Software Foundation; either version 2 of the License, or * | 13 | * the Free Software Foundation; either version 2 of the License, or * |
14 | * ( at your option ) any later version. * | 14 | * ( at your option ) any later version. * |
15 | * * | 15 | * * |
16 | **************************************************************************/ | 16 | **************************************************************************/ |
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 | |||
@@ -16,25 +16,25 @@ | |||
16 | **************************************************************************/ | 16 | **************************************************************************/ |
17 | #include "oxygen.h" | 17 | #include "oxygen.h" |
18 | 18 | ||
19 | #include <qapplication.h> | 19 | #include <qapplication.h> |
20 | #include <qtabwidget.h> | 20 | #include <qtabwidget.h> |
21 | 21 | ||
22 | #include "calcdlg.h" | 22 | #include "calcdlg.h" |
23 | #include "calcdlgui.h" | 23 | #include "calcdlgui.h" |
24 | #include "datawidgetui.h" | 24 | #include "datawidgetui.h" |
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(); |
32 | PSEWidget *pse = new PSEWidget(names); | 32 | PSEWidget *pse = new PSEWidget(names); |
33 | dataWidgetUI *DataWidgetUI = new dataWidgetUI(names); | 33 | dataWidgetUI *DataWidgetUI = new dataWidgetUI(names); |
34 | 34 | ||
35 | setCaption( tr( "Oxygen" ) ); | 35 | setCaption( tr( "Oxygen" ) ); |
36 | 36 | ||
37 | QTabWidget *tabw = new QTabWidget( this , "qtab" ); | 37 | QTabWidget *tabw = new QTabWidget( this , "qtab" ); |
38 | tabw->addTab( pse, tr( "PSE" )); | 38 | tabw->addTab( pse, tr( "PSE" )); |
39 | tabw->addTab( DataWidgetUI , tr( "Data" ) ); | 39 | tabw->addTab( DataWidgetUI , tr( "Data" ) ); |
40 | tabw->addTab( CalcDlgUI, tr( "Calculations" ) ); | 40 | tabw->addTab( CalcDlgUI, tr( "Calculations" ) ); |
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 | |||
@@ -7,18 +7,19 @@ | |||
7 | * * | 7 | * * |
8 | **************************************************************************/ | 8 | **************************************************************************/ |
9 | 9 | ||
10 | class QStringList; | 10 | class QStringList; |
11 | 11 | ||
12 | #include <qmainwindow.h> | 12 | #include <qmainwindow.h> |
13 | 13 | ||
14 | class Oxygen : public QMainWindow | 14 | class Oxygen : public QMainWindow |
15 | { | 15 | { |
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(); |
23 | QStringList names; | 24 | QStringList names; |
24 | }; | 25 | }; |
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,49 +1,27 @@ | |||
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 \ |
6 | calcdlgui.h \ | 5 | calcdlgui.h \ |
7 | dataTable.h \ | 6 | dataTable.h \ |
8 | psewidget.h \ | 7 | psewidget.h \ |
9 | oxyframe.h \ | 8 | oxyframe.h \ |
10 | datawidgetui.h | 9 | datawidgetui.h |
11 | 10 | ||
12 | SOURCES = main.cpp \ | 11 | SOURCES = main.cpp \ |
13 | oxygen.cpp \ | 12 | oxygen.cpp \ |
14 | kmolcalc.cpp \ | 13 | kmolcalc.cpp \ |
15 | calcdlgui.cpp \ | 14 | calcdlgui.cpp \ |
16 | kmolelements.cpp \ | 15 | kmolelements.cpp \ |
17 | dataTable.cpp \ | 16 | dataTable.cpp \ |
18 | psewidget.cpp \ | 17 | psewidget.cpp \ |
19 | oxyframe.cpp \ | 18 | oxyframe.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 | |||
@@ -10,23 +10,16 @@ | |||
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
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 | |||
@@ -31,24 +31,25 @@ class QMenuBar; | |||
31 | 31 | ||
32 | class TVListView; | 32 | class TVListView; |
33 | class TVBrowseView; | 33 | class TVBrowseView; |
34 | class TVFilterView; | 34 | class TVFilterView; |
35 | class TVEditView; | 35 | class TVEditView; |
36 | 36 | ||
37 | class DBStore; | 37 | class DBStore; |
38 | 38 | ||
39 | class TableViewerWindow: public QMainWindow | 39 | 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(); |
46 | 47 | ||
47 | public slots: | 48 | public slots: |
48 | void selectDocument(); | 49 | void selectDocument(); |
49 | 50 | ||
50 | void newDocument(); | 51 | void newDocument(); |
51 | void saveDocument(); | 52 | void saveDocument(); |
52 | void setDocument(const QString &); | 53 | void setDocument(const QString &); |
53 | void openDocument(const DocLnk &); | 54 | void openDocument(const DocLnk &); |
54 | 55 | ||
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,15 +1,13 @@ | |||
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 \ |
7 | ui/commonwidgets.h \ | 5 | ui/commonwidgets.h \ |
8 | ui/tvbrowseview.h \ | 6 | ui/tvbrowseview.h \ |
9 | ui/tvlistview.h \ | 7 | ui/tvlistview.h \ |
10 | ui/tvfilterview.h \ | 8 | ui/tvfilterview.h \ |
11 | ui/tveditview.h \ | 9 | ui/tveditview.h \ |
12 | ui/browsekeyentry.h \ | 10 | ui/browsekeyentry.h \ |
13 | ui/filterkeyentry.h \ | 11 | ui/filterkeyentry.h \ |
14 | ui/tvkeyedit.h \ | 12 | ui/tvkeyedit.h \ |
15 | db/datacache.h \ | 13 | db/datacache.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 | |||
@@ -4,25 +4,19 @@ | |||
4 | begin : November 2002 | 4 | begin : November 2002 |
5 | copyright : (C) 2002 by Joseph Wenninger <jowenn@kde.org> | 5 | copyright : (C) 2002 by Joseph Wenninger <jowenn@kde.org> |
6 | ***************************************************************************/ | 6 | ***************************************************************************/ |
7 | 7 | ||
8 | /*************************************************************************** | 8 | /*************************************************************************** |
9 | * * | 9 | * * |
10 | * This program is free software; you can redistribute it and/or modify * | 10 | * This program is free software; you can redistribute it and/or modify * |
11 | * it under the terms of the GNU General Public License as published by * | 11 | * it under the terms of the GNU General Public License as published by * |
12 | * the Free Software Foundation. * | 12 | * the Free Software Foundation. * |
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,9 +1,9 @@ | |||
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> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Depends: task-opie-minimal | 7 | Depends: task-opie-minimal |
8 | Description: Kate for opie | 8 | Description: Kate for opie |
9 | Version: $QPE_VERSION$EXTRAVERSION | 9 | Version: $QPE_VERSION$EXTRAVERSION |
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 | |||
@@ -24,24 +24,26 @@ | |||
24 | #include <ktexteditor.h> | 24 | #include <ktexteditor.h> |
25 | 25 | ||
26 | class QToolButton; | 26 | class QToolButton; |
27 | class QAction; | 27 | class QAction; |
28 | class QPopupMenu; | 28 | class QPopupMenu; |
29 | 29 | ||
30 | class TinyKate : public QMainWindow | 30 | class TinyKate : public QMainWindow |
31 | { | 31 | { |
32 | Q_OBJECT | 32 | 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(); |
39 | void setDocument(const QString& fileref); | 41 | void setDocument(const QString& fileref); |
40 | 42 | ||
41 | protected slots: | 43 | protected slots: |
42 | void slotOpen(); | 44 | void slotOpen(); |
43 | void slotClose(); | 45 | void slotClose(); |
44 | void slotCurrentChanged(QWidget *); | 46 | void slotCurrentChanged(QWidget *); |
45 | void slotSave(); | 47 | void slotSave(); |
46 | void slotSaveAs(); | 48 | void slotSaveAs(); |
47 | protected: | 49 | protected: |
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,22 +1,22 @@ | |||
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 |
6 | INTERFACES= | 6 | INTERFACES= |
7 | INCLUDEPATH+= $(OPIEDIR)/include \ | 7 | INCLUDEPATH+= $(OPIEDIR)/include \ |
8 | $(OPIEDIR)/noncore/apps/tinykate/libkate \ | 8 | $(OPIEDIR)/noncore/apps/tinykate/libkate \ |
9 | $(OPIEDIR)/noncore/apps/tinykate/libkate/microkde \ | 9 | $(OPIEDIR)/noncore/apps/tinykate/libkate/microkde \ |
10 | $(OPIEDIR)/noncore/apps/tinykate/libkate/document \ | 10 | $(OPIEDIR)/noncore/apps/tinykate/libkate/document \ |
11 | $(OPIEDIR)/noncore/apps/tinykate/libkate/view \ | 11 | $(OPIEDIR)/noncore/apps/tinykate/libkate/view \ |
12 | $(OPIEDIR)/noncore/apps/tinykate/libkate/interfaces \ | 12 | $(OPIEDIR)/noncore/apps/tinykate/libkate/interfaces \ |
13 | $(OPIEDIR)/noncore/apps/tinykate/libkate/ktexteditor \ | 13 | $(OPIEDIR)/noncore/apps/tinykate/libkate/ktexteditor \ |
14 | $(OPIEDIR)/noncore/apps/tinykate/libkate/qt3back | 14 | $(OPIEDIR)/noncore/apps/tinykate/libkate/qt3back |
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 | ||
22 | include ( $(OPIEDIR)/include.pro ) | 22 | include ( $(OPIEDIR)/include.pro ) |
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* | ||