author | drw <drw> | 2005-05-16 18:28:46 (UTC) |
---|---|---|
committer | drw <drw> | 2005-05-16 18:28:46 (UTC) |
commit | 1a6137e3182a1b6974b64e22017207c32f9d4f7c (patch) (unidiff) | |
tree | 181be57df97461f2ea05eed85198ff373d4dd2f9 /noncore | |
parent | 97a12da2b324be1545b2b6942a14ab813e1a735b (diff) | |
download | opie-1a6137e3182a1b6974b64e22017207c32f9d4f7c.zip opie-1a6137e3182a1b6974b64e22017207c32f9d4f7c.tar.gz opie-1a6137e3182a1b6974b64e22017207c32f9d4f7c.tar.bz2 |
Resource -> OResource
-rw-r--r-- | noncore/apps/checkbook/checkbook.cpp | 62 | ||||
-rw-r--r-- | noncore/apps/checkbook/listedit.cpp | 56 | ||||
-rw-r--r-- | noncore/apps/checkbook/mainwindow.cpp | 67 |
3 files changed, 102 insertions, 83 deletions
diff --git a/noncore/apps/checkbook/checkbook.cpp b/noncore/apps/checkbook/checkbook.cpp index 44d3764..b325f45 100644 --- a/noncore/apps/checkbook/checkbook.cpp +++ b/noncore/apps/checkbook/checkbook.cpp | |||
@@ -1,64 +1,66 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the OPIE Project | 2 | This file is part of the OPIE Project |
3 | =. | 3 | =. |
4 | .=l. Copyright (c) 2002 Dan Williams <drw@handhelds.org> | 4 | .=l. Copyright (c) 2002 Dan Williams <drw@handhelds.org> |
5 | .>+-= | 5 | .>+-= |
6 | _;:, .> :=|. This file is free software; you can | 6 | _;:, .> :=|. This file is free software; you can |
7 | .> <`_, > . <= redistribute it and/or modify it under | 7 | .> <`_, > . <= redistribute it and/or modify it under |
8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
9 | .="- .-=="i, .._ License as published by the Free Software | 9 | .="- .-=="i, .._ License as published by the Free Software |
10 | - . .-<_> .<> Foundation; either version 2 of the License, | 10 | - . .-<_> .<> Foundation; either version 2 of the License, |
11 | ._= =} : or (at your option) any later version. | 11 | ._= =} : or (at your option) any later version. |
12 | .%`+i> _;_. | 12 | .%`+i> _;_. |
13 | .i_,=:_. -<s. This file is distributed in the hope that | 13 | .i_,=:_. -<s. This file is distributed in the hope that |
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
15 | : .. .:, . . . without even the implied warranty of | 15 | : .. .:, . . . without even the implied warranty of |
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
18 | ..}^=.= = ; Public License for more details. | 18 | ..}^=.= = ; Public License for more details. |
19 | ++= -. .` .: | 19 | ++= -. .` .: |
20 | : = ...= . :.=- You should have received a copy of the GNU | 20 | : = ...= . :.=- You should have received a copy of the GNU |
21 | -. .:....=;==+<; General Public License along with this file; | 21 | -. .:....=;==+<; General Public License along with this file; |
22 | -_. . . )=. = see the file COPYING. If not, write to the | 22 | -_. . . )=. = see the file COPYING. If not, write to the |
23 | -- :-=` Free Software Foundation, Inc., | 23 | -- :-=` Free Software Foundation, Inc., |
24 | 59 Temple Place - Suite 330, | 24 | 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #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 "cfg.h" | 36 | #include "cfg.h" |
37 | 37 | ||
38 | #include <opie2/oresource.h> | ||
39 | |||
40 | #include <qpe/applnk.h> | ||
38 | #include <qpe/qpeapplication.h> | 41 | #include <qpe/qpeapplication.h> |
39 | #include <qpe/qpemessagebox.h> | 42 | #include <qpe/qpemessagebox.h> |
40 | #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 | #include <qpopupmenu.h> | 52 | #include <qpopupmenu.h> |
51 | 53 | ||
52 | #define COL_ID 0 | 54 | #define COL_ID 0 |
53 | #define COL_SORTDATE 1 | 55 | #define COL_SORTDATE 1 |
54 | #define COL_NUM 2 | 56 | #define COL_NUM 2 |
55 | #define COL_DATE 3 | 57 | #define COL_DATE 3 |
56 | #define COL_DESC 4 | 58 | #define COL_DESC 4 |
57 | #define COL_AMOUNT 5 | 59 | #define COL_AMOUNT 5 |
58 | #define COL_BAL 6 | 60 | #define COL_BAL 6 |
59 | 61 | ||
60 | // --- Checkbook -------------------------------------------------------------- | 62 | // --- Checkbook -------------------------------------------------------------- |
61 | using namespace Opie::Ui; | 63 | using namespace Opie::Ui; |
62 | Checkbook::Checkbook( QWidget *parent, CBInfo *i, Cfg *cfg ) | 64 | Checkbook::Checkbook( QWidget *parent, CBInfo *i, Cfg *cfg ) |
63 | : QDialog( parent, 0, TRUE, WStyle_ContextHelp ) | 65 | : QDialog( parent, 0, TRUE, WStyle_ContextHelp ) |
64 | { | 66 | { |
@@ -226,91 +228,99 @@ QWidget *Checkbook::initTransactions() | |||
226 | tranTable->setColumnWidthMode( COL_ID, QListView::Manual ); | 228 | tranTable->setColumnWidthMode( COL_ID, QListView::Manual ); |
227 | tranTable->setColumnWidth( COL_ID, 0); | 229 | tranTable->setColumnWidth( COL_ID, 0); |
228 | tranTable->addColumn( tr( "SortDate" ) ); | 230 | tranTable->addColumn( tr( "SortDate" ) ); |
229 | tranTable->setColumnWidthMode( COL_SORTDATE, QListView::Manual ); | 231 | tranTable->setColumnWidthMode( COL_SORTDATE, QListView::Manual ); |
230 | tranTable->setColumnWidth( COL_SORTDATE, 0); | 232 | tranTable->setColumnWidth( COL_SORTDATE, 0); |
231 | tranTable->addColumn( tr( "Num" ) ); | 233 | tranTable->addColumn( tr( "Num" ) ); |
232 | tranTable->addColumn( tr( "Date" ) ); | 234 | tranTable->addColumn( tr( "Date" ) ); |
233 | //tranTable->addColumn( tr( "Cleared" ) ); | 235 | //tranTable->addColumn( tr( "Cleared" ) ); |
234 | tranTable->addColumn( tr( "Description" ) ); | 236 | tranTable->addColumn( tr( "Description" ) ); |
235 | int column = tranTable->addColumn( tr( "Amount" ) ); | 237 | int column = tranTable->addColumn( tr( "Amount" ) ); |
236 | tranTable->setColumnAlignment( column, Qt::AlignRight ); | 238 | tranTable->setColumnAlignment( column, Qt::AlignRight ); |
237 | column=tranTable->addColumn( tr("Balance") ); | 239 | column=tranTable->addColumn( tr("Balance") ); |
238 | tranTable->setColumnAlignment( column, Qt::AlignRight ); | 240 | tranTable->setColumnAlignment( column, Qt::AlignRight ); |
239 | tranTable->setAllColumnsShowFocus( TRUE ); | 241 | tranTable->setAllColumnsShowFocus( TRUE ); |
240 | tranTable->setSorting( -1 ); | 242 | tranTable->setSorting( -1 ); |
241 | layout->addMultiCellWidget( tranTable, 1, 1, 0, 2 ); | 243 | layout->addMultiCellWidget( tranTable, 1, 1, 0, 2 ); |
242 | QPEApplication::setStylusOperation( tranTable->viewport(), QPEApplication::RightOnHold ); | 244 | QPEApplication::setStylusOperation( tranTable->viewport(), QPEApplication::RightOnHold ); |
243 | connect( tranTable, SIGNAL( rightButtonPressed(QListViewItem*,const QPoint&,int) ), | 245 | connect( tranTable, SIGNAL( rightButtonPressed(QListViewItem*,const QPoint&,int) ), |
244 | this, SLOT( slotMenuTran(QListViewItem*,const QPoint&) ) ); | 246 | this, SLOT( slotMenuTran(QListViewItem*,const QPoint&) ) ); |
245 | connect( tranTable, SIGNAL( doubleClicked(QListViewItem*) ), | 247 | connect( tranTable, SIGNAL( doubleClicked(QListViewItem*) ), |
246 | this, SLOT( slotEditTran() ) ); | 248 | this, SLOT( slotEditTran() ) ); |
247 | _sortCol=COL_ID; | 249 | _sortCol=COL_ID; |
248 | 250 | ||
249 | // Buttons | 251 | // Buttons |
250 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), control ); | 252 | QPushButton *btn = new QPushButton( Opie::Core::OResource::loadPixmap( "new", Opie::Core::OResource::SmallIcon ), |
253 | tr( "New" ), control ); | ||
254 | btn->setFixedHeight( AppLnk::smallIconSize()+4 ); | ||
251 | QWhatsThis::add( btn, tr( "Click here to add a new transaction." ) ); | 255 | QWhatsThis::add( btn, tr( "Click here to add a new transaction." ) ); |
252 | connect( btn, SIGNAL( clicked() ), this, SLOT( slotNewTran() ) ); | 256 | connect( btn, SIGNAL( clicked() ), this, SLOT( slotNewTran() ) ); |
253 | layout->addWidget( btn, 2, 0 ); | 257 | layout->addWidget( btn, 2, 0 ); |
254 | 258 | ||
255 | btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Edit" ), control ); | 259 | btn = new QPushButton( Opie::Core::OResource::loadPixmap( "edit", Opie::Core::OResource::SmallIcon ), |
260 | tr( "Edit" ), control ); | ||
261 | btn->setFixedHeight( AppLnk::smallIconSize()+4 ); | ||
256 | QWhatsThis::add( btn, tr( "Select a transaction and then click here to edit it." ) ); | 262 | QWhatsThis::add( btn, tr( "Select a transaction and then click here to edit it." ) ); |
257 | connect( btn, SIGNAL( clicked() ), this, SLOT( slotEditTran() ) ); | 263 | connect( btn, SIGNAL( clicked() ), this, SLOT( slotEditTran() ) ); |
258 | layout->addWidget( btn, 2, 1 ); | 264 | layout->addWidget( btn, 2, 1 ); |
259 | 265 | ||
260 | btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), control ); | 266 | btn = new QPushButton( Opie::Core::OResource::loadPixmap( "trash", Opie::Core::OResource::SmallIcon ), |
267 | tr( "Delete" ), control ); | ||
268 | btn->setFixedHeight( AppLnk::smallIconSize()+4 ); | ||
261 | QWhatsThis::add( btn, tr( "Select a checkbook and then click here to delete it." ) ); | 269 | QWhatsThis::add( btn, tr( "Select a checkbook and then click here to delete it." ) ); |
262 | connect( btn, SIGNAL( clicked() ), this, SLOT( slotDeleteTran() ) ); | 270 | connect( btn, SIGNAL( clicked() ), this, SLOT( slotDeleteTran() ) ); |
263 | layout->addWidget( btn, 2, 2 ); | 271 | layout->addWidget( btn, 2, 2 ); |
264 | 272 | ||
265 | return( control ); | 273 | return( control ); |
266 | } | 274 | } |
267 | 275 | ||
268 | 276 | ||
269 | // --- initCharts ------------------------------------------------------------- | 277 | // --- initCharts ------------------------------------------------------------- |
270 | QWidget *Checkbook::initCharts() | 278 | QWidget *Checkbook::initCharts() |
271 | { | 279 | { |
272 | graphInfo = 0x0; | 280 | graphInfo = 0x0; |
273 | 281 | ||
274 | QWidget *control = new QWidget( mainWidget, tr("Charts") ); | 282 | QWidget *control = new QWidget( mainWidget, tr("Charts") ); |
275 | 283 | ||
276 | QGridLayout *layout = new QGridLayout( control ); | 284 | QGridLayout *layout = new QGridLayout( control ); |
277 | layout->setSpacing( 2 ); | 285 | layout->setSpacing( 2 ); |
278 | layout->setMargin( 4 ); | 286 | layout->setMargin( 4 ); |
279 | 287 | ||
280 | graphWidget = new Graph( control ); | 288 | graphWidget = new Graph( control ); |
281 | QWhatsThis::add( graphWidget, tr( "Select the desired chart below and then click on the Draw button." ) ); | 289 | QWhatsThis::add( graphWidget, tr( "Select the desired chart below and then click on the Draw button." ) ); |
282 | layout->addMultiCellWidget( graphWidget, 0, 0, 0, 2 ); | 290 | layout->addMultiCellWidget( graphWidget, 0, 0, 0, 2 ); |
283 | 291 | ||
284 | graphList = new QComboBox( control ); | 292 | graphList = new QComboBox( control ); |
285 | QWhatsThis::add( graphList, tr( "Click here to select the desired chart type." ) ); | 293 | QWhatsThis::add( graphList, tr( "Click here to select the desired chart type." ) ); |
286 | graphList->insertItem( tr( "Account balance" ) ); | 294 | graphList->insertItem( tr( "Account balance" ) ); |
287 | graphList->insertItem( tr( "Withdrawals by category" ) ); | 295 | graphList->insertItem( tr( "Withdrawals by category" ) ); |
288 | graphList->insertItem( tr( "Deposits by category" ) ); | 296 | graphList->insertItem( tr( "Deposits by category" ) ); |
289 | 297 | ||
290 | layout->addMultiCellWidget( graphList, 1, 1, 0, 1 ); | 298 | layout->addMultiCellWidget( graphList, 1, 1, 0, 1 ); |
291 | 299 | ||
292 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "checkbook/drawbtn" ), tr( "Draw" ), control ); | 300 | QPushButton *btn = new QPushButton( Opie::Core::OResource::loadPixmap( "checkbook/drawbtn", Opie::Core::OResource::SmallIcon ), |
301 | tr( "Draw" ), control ); | ||
302 | btn->setFixedHeight( AppLnk::smallIconSize()+4 ); | ||
293 | QWhatsThis::add( btn, tr( "Click here to draw the selected chart." ) ); | 303 | QWhatsThis::add( btn, tr( "Click here to draw the selected chart." ) ); |
294 | connect( btn, SIGNAL( clicked() ), this, SLOT( slotDrawGraph() ) ); | 304 | connect( btn, SIGNAL( clicked() ), this, SLOT( slotDrawGraph() ) ); |
295 | layout->addWidget( btn, 1, 2 ); | 305 | layout->addWidget( btn, 1, 2 ); |
296 | 306 | ||
297 | return control; | 307 | return control; |
298 | } | 308 | } |
299 | 309 | ||
300 | // --- loadCheckbook ---------------------------------------------------------- | 310 | // --- loadCheckbook ---------------------------------------------------------- |
301 | void Checkbook::loadCheckbook() | 311 | void Checkbook::loadCheckbook() |
302 | { | 312 | { |
303 | if ( !info ) | 313 | if ( !info ) |
304 | { | 314 | { |
305 | return; | 315 | return; |
306 | } | 316 | } |
307 | 317 | ||
308 | tranList = info->transactions(); | 318 | tranList = info->transactions(); |
309 | 319 | ||
310 | passwordCB->setChecked( !info->password().isNull() ); | 320 | passwordCB->setChecked( !info->password().isNull() ); |
311 | nameEdit->setText( info->name() ); | 321 | nameEdit->setText( info->name() ); |
312 | QString temptext = info->type(); | 322 | QString temptext = info->type(); |
313 | int i = typeList->count(); | 323 | int i = typeList->count(); |
314 | while ( i > 0 ) | 324 | while ( i > 0 ) |
315 | { | 325 | { |
316 | i--; | 326 | i--; |
diff --git a/noncore/apps/checkbook/listedit.cpp b/noncore/apps/checkbook/listedit.cpp index 2612488..e40377b 100644 --- a/noncore/apps/checkbook/listedit.cpp +++ b/noncore/apps/checkbook/listedit.cpp | |||
@@ -1,111 +1,117 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the OPIE Project | 2 | This file is part of the OPIE Project |
3 | =. | 3 | =. |
4 | .=l. Copyright (c) 2002 Dan Williams <drw@handhelds.org> | 4 | .=l. Copyright (c) 2002 Dan Williams <drw@handhelds.org> |
5 | .>+-= | 5 | .>+-= |
6 | _;:, .> :=|. This file is free software; you can | 6 | _;:, .> :=|. This file is free software; you can |
7 | .> <`_, > . <= redistribute it and/or modify it under | 7 | .> <`_, > . <= redistribute it and/or modify it under |
8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
9 | .="- .-=="i, .._ License as published by the Free Software | 9 | .="- .-=="i, .._ License as published by the Free Software |
10 | - . .-<_> .<> Foundation; either version 2 of the License, | 10 | - . .-<_> .<> Foundation; either version 2 of the License, |
11 | ._= =} : or (at your option) any later version. | 11 | ._= =} : or (at your option) any later version. |
12 | .%`+i> _;_. | 12 | .%`+i> _;_. |
13 | .i_,=:_. -<s. This file is distributed in the hope that | 13 | .i_,=:_. -<s. This file is distributed in the hope that |
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
15 | : .. .:, . . . without even the implied warranty of | 15 | : .. .:, . . . without even the implied warranty of |
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
18 | ..}^=.= = ; Public License for more details. | 18 | ..}^=.= = ; Public License for more details. |
19 | ++= -. .` .: | 19 | ++= -. .` .: |
20 | : = ...= . :.=- You should have received a copy of the GNU | 20 | : = ...= . :.=- You should have received a copy of the GNU |
21 | -. .:....=;==+<; General Public License along with this file; | 21 | -. .:....=;==+<; General Public License along with this file; |
22 | -_. . . )=. = see the file COPYING. If not, write to the | 22 | -_. . . )=. = see the file COPYING. If not, write to the |
23 | -- :-=` Free Software Foundation, Inc., | 23 | -- :-=` Free Software Foundation, Inc., |
24 | 59 Temple Place - Suite 330, | 24 | 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include "listedit.h" | 29 | #include "listedit.h" |
30 | 30 | ||
31 | /* OPIE */ | 31 | /* OPIE */ |
32 | #include <opie2/odebug.h> | 32 | #include <opie2/odebug.h> |
33 | #include <qpe/resource.h> | 33 | #include <opie2/oresource.h> |
34 | |||
35 | #include <qpe/applnk.h> | ||
36 | |||
34 | using namespace Opie::Core; | 37 | using namespace Opie::Core; |
35 | 38 | ||
36 | /* QT */ | 39 | /* QT */ |
37 | #include <qlayout.h> | 40 | #include <qlayout.h> |
38 | #include <qlineedit.h> | 41 | #include <qlineedit.h> |
39 | #include <qlistview.h> | 42 | #include <qlistview.h> |
40 | #include <qwidgetstack.h> | 43 | #include <qwidgetstack.h> |
41 | #include <qcombobox.h> | 44 | #include <qcombobox.h> |
42 | #include <qpushbutton.h> | 45 | #include <qpushbutton.h> |
43 | 46 | ||
44 | // --- ListEdit --------------------------------------------------------------- | 47 | // --- ListEdit --------------------------------------------------------------- |
45 | ListEdit::ListEdit( QWidget *parent, const char *sName ) | 48 | ListEdit::ListEdit( QWidget *parent, const char *sName ) |
46 | : QWidget(parent, sName), TableDef(sName) | 49 | : QWidget(parent, sName), TableDef(sName) |
47 | { | 50 | { |
48 | // get font height | 51 | // get font height |
49 | int fh = fontMetrics().height(); | 52 | int fh = fontMetrics().height(); |
50 | 53 | ||
51 | // create layout | 54 | // create layout |
52 | QGridLayout *layout=new QGridLayout(this); | 55 | QGridLayout *layout=new QGridLayout(this); |
53 | layout->setSpacing( 2 ); | 56 | layout->setSpacing( 2 ); |
54 | layout->setMargin( 4 ); | 57 | layout->setMargin( 4 ); |
55 | 58 | ||
56 | // type table | 59 | // type table |
57 | _typeTable = new QListView( this ); | 60 | _typeTable = new QListView( this ); |
58 | ColumnDef *def=first(); | 61 | ColumnDef *def=first(); |
59 | while( def ) { | 62 | while( def ) { |
60 | _typeTable->addColumn( def->getName() ); | 63 | _typeTable->addColumn( def->getName() ); |
61 | def=next(); | 64 | def=next(); |
62 | } | 65 | } |
63 | connect( _typeTable, SIGNAL( clicked(QListViewItem*,const QPoint&,int) ), this, SLOT( slotClick(QListViewItem*,const QPoint&,int) ) ); | 66 | connect( _typeTable, SIGNAL( clicked(QListViewItem*,const QPoint&,int) ), this, SLOT( slotClick(QListViewItem*,const QPoint&,int) ) ); |
64 | layout->addMultiCellWidget(_typeTable, 0,4,0,4); | 67 | layout->addMultiCellWidget(_typeTable, 0,4,0,4); |
65 | _currentItem=NULL; | 68 | _currentItem=NULL; |
66 | 69 | ||
67 | // edit field | 70 | // edit field |
68 | _stack=new QWidgetStack( this ); | 71 | _stack=new QWidgetStack( this ); |
69 | _stack->setMaximumHeight(fh+5); | 72 | _stack->setMaximumHeight(fh+5); |
70 | layout->addMultiCellWidget(_stack, 5,5,0,2); | 73 | layout->addMultiCellWidget(_stack, 5,5,0,2); |
71 | _typeEdit = new QLineEdit( _stack ); | 74 | _typeEdit = new QLineEdit( _stack ); |
72 | _stack->raiseWidget(_typeEdit ); | 75 | _stack->raiseWidget(_typeEdit ); |
73 | connect( _typeEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( slotEditChanged(const QString&) ) ); | 76 | connect( _typeEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( slotEditChanged(const QString&) ) ); |
74 | 77 | ||
75 | // combo box | 78 | // combo box |
76 | _box=new QComboBox( _stack ); | 79 | _box=new QComboBox( _stack ); |
77 | connect( _box, SIGNAL( activated(const QString&) ), this, SLOT( slotActivated(const QString&) ) ); | 80 | connect( _box, SIGNAL( activated(const QString&) ), this, SLOT( slotActivated(const QString&) ) ); |
78 | 81 | ||
79 | 82 | ||
80 | // add button | 83 | // add button |
81 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "checkbook/add" ), tr( "Add" ), this ); | 84 | QPushButton *btn = new QPushButton( Opie::Core::OResource::loadPixmap( "new", Opie::Core::OResource::SmallIcon ), |
85 | tr( "Add" ), this ); | ||
86 | btn->setFixedHeight( AppLnk::smallIconSize()+4 ); | ||
82 | connect( btn, SIGNAL( clicked() ), this, SLOT( slotAdd() ) ); | 87 | connect( btn, SIGNAL( clicked() ), this, SLOT( slotAdd() ) ); |
83 | layout->addWidget( btn, 5, 3 ); | 88 | layout->addWidget( btn, 5, 3 ); |
84 | 89 | ||
85 | // delete button | 90 | // delete button |
86 | btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), this ); | 91 | btn = new QPushButton( Opie::Core::OResource::loadPixmap( "trash", Opie::Core::OResource::SmallIcon ), tr( "Delete" ), this ); |
87 | connect( btn, SIGNAL( clicked() ), this, SLOT( slotDel() ) ); | 92 | btn->setFixedHeight( AppLnk::smallIconSize()+4 ); |
93 | connect( btn, SIGNAL( clicked() ), this, SLOT( slotDel() ) ); | ||
88 | layout->addWidget( btn, 5, 4 ); | 94 | layout->addWidget( btn, 5, 4 ); |
89 | } | 95 | } |
90 | 96 | ||
91 | // --- ~ListEdit -------------------------------------------------------------- | 97 | // --- ~ListEdit -------------------------------------------------------------- |
92 | ListEdit::~ListEdit() | 98 | ListEdit::~ListEdit() |
93 | { | 99 | { |
94 | } | 100 | } |
95 | 101 | ||
96 | 102 | ||
97 | // --- slotEditTypeChanged ---------------------------------------------------- | 103 | // --- slotEditTypeChanged ---------------------------------------------------- |
98 | void ListEdit::slotEditChanged(const QString &str) | 104 | void ListEdit::slotEditChanged(const QString &str) |
99 | { | 105 | { |
100 | if( !_currentItem || _currentColumn<0 ) return; | 106 | if( !_currentItem || _currentColumn<0 ) return; |
101 | _currentItem->setText(_currentColumn, str); | 107 | _currentItem->setText(_currentColumn, str); |
102 | } | 108 | } |
103 | 109 | ||
104 | // --- slotAddType ------------------------------------------------------------ | 110 | // --- slotAddType ------------------------------------------------------------ |
105 | void ListEdit::slotAdd() | 111 | void ListEdit::slotAdd() |
106 | { | 112 | { |
107 | // construct new row | 113 | // construct new row |
108 | QString args[8]; | 114 | QString args[8]; |
109 | ColumnDef *pCol=this->first(); | 115 | ColumnDef *pCol=this->first(); |
110 | int i=0; | 116 | int i=0; |
111 | while( pCol && i<8 ) { | 117 | while( pCol && i<8 ) { |
diff --git a/noncore/apps/checkbook/mainwindow.cpp b/noncore/apps/checkbook/mainwindow.cpp index c7ffa7c..d9e2047 100644 --- a/noncore/apps/checkbook/mainwindow.cpp +++ b/noncore/apps/checkbook/mainwindow.cpp | |||
@@ -1,116 +1,119 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the OPIE Project | 2 | This file is part of the OPIE Project |
3 | =. | 3 | =. |
4 | .=l. Copyright (c) 2002 Dan Williams <drw@handhelds.org> | 4 | .=l. Copyright (c) 2002 Dan Williams <drw@handhelds.org> |
5 | .>+-= | 5 | .>+-= |
6 | _;:, .> :=|. This file is free software; you can | 6 | _;:, .> :=|. This file is free software; you can |
7 | .> <`_, > . <= redistribute it and/or modify it under | 7 | .> <`_, > . <= redistribute it and/or modify it under |
8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
9 | .="- .-=="i, .._ License as published by the Free Software | 9 | .="- .-=="i, .._ License as published by the Free Software |
10 | - . .-<_> .<> Foundation; either version 2 of the License, | 10 | - . .-<_> .<> Foundation; either version 2 of the License, |
11 | ._= =} : or (at your option) any later version. | 11 | ._= =} : or (at your option) any later version. |
12 | .%`+i> _;_. | 12 | .%`+i> _;_. |
13 | .i_,=:_. -<s. This file is distributed in the hope that | 13 | .i_,=:_. -<s. This file is distributed in the hope that |
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
15 | : .. .:, . . . without even the implied warranty of | 15 | : .. .:, . . . without even the implied warranty of |
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
18 | ..}^=.= = ; Public License for more details. | 18 | ..}^=.= = ; Public License for more details. |
19 | ++= -. .` .: | 19 | ++= -. .` .: |
20 | : = ...= . :.=- You should have received a copy of the GNU | 20 | : = ...= . :.=- You should have received a copy of the GNU |
21 | -. .:....=;==+<; General Public License along with this file; | 21 | -. .:....=;==+<; General Public License along with this file; |
22 | -_. . . )=. = see the file COPYING. If not, write to the | 22 | -_. . . )=. = see the file COPYING. If not, write to the |
23 | -- :-=` Free Software Foundation, Inc., | 23 | -- :-=` Free Software Foundation, Inc., |
24 | 59 Temple Place - Suite 330, | 24 | 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #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 | 34 | ||
35 | #include <opie2/oresource.h> | ||
36 | |||
35 | #include <qpe/config.h> | 37 | #include <qpe/config.h> |
36 | #include <qpe/qpeapplication.h> | 38 | #include <qpe/qpeapplication.h> |
37 | #include <qpe/qpemessagebox.h> | 39 | #include <qpe/qpemessagebox.h> |
38 | #include <qtoolbar.h> | ||
39 | #include <qpe/resource.h> | ||
40 | 40 | ||
41 | #include <qmenubar.h> | ||
42 | #include <qaction.h> | 41 | #include <qaction.h> |
43 | #include <qdir.h> | 42 | #include <qdir.h> |
43 | #include <qmenubar.h> | ||
44 | #include <qtoolbar.h> | ||
44 | #include <qwhatsthis.h> | 45 | #include <qwhatsthis.h> |
45 | 46 | ||
46 | 47 | ||
47 | MainWindow::MainWindow( QWidget* parent, const char* name, WFlags /*fl*/ ) | 48 | MainWindow::MainWindow( QWidget* parent, const char* name, WFlags /*fl*/ ) |
48 | : QMainWindow( parent, name, WStyle_ContextHelp ) | 49 | : QMainWindow( parent, name, WStyle_ContextHelp ) |
49 | { | 50 | { |
50 | setCaption( tr( "Checkbook" ) ); | 51 | setCaption( tr( "Checkbook" ) ); |
51 | 52 | ||
52 | cbDir = Global::applicationFileName( "checkbook", "" ); | 53 | cbDir = Global::applicationFileName( "checkbook", "" ); |
53 | lockIcon = Resource::loadPixmap( "locked" ); | 54 | lockIcon = Opie::Core::OResource::loadPixmap( "locked", Opie::Core::OResource::SmallIcon ); |
54 | 55 | ||
55 | // Load configuration options | 56 | // Load configuration options |
56 | Config config( "checkbook" ); | 57 | Config config( "checkbook" ); |
57 | _cfg.readConfig( config ); | 58 | _cfg.readConfig( config ); |
58 | 59 | ||
59 | 60 | ||
60 | // Build menu and tool bars | 61 | // Build menu and tool bars |
61 | setToolBarsMovable( FALSE ); | 62 | setToolBarsMovable( FALSE ); |
62 | 63 | ||
63 | QToolBar *bar = new QToolBar( this ); | 64 | QToolBar *bar = new QToolBar( this ); |
64 | bar->setHorizontalStretchable( TRUE ); | 65 | bar->setHorizontalStretchable( TRUE ); |
65 | QMenuBar *mb = new QMenuBar( bar ); | 66 | QMenuBar *mb = new QMenuBar( bar ); |
66 | mb->setMargin( 0 ); | 67 | mb->setMargin( 0 ); |
67 | QPopupMenu *popup = new QPopupMenu( this ); | 68 | QPopupMenu *popup = new QPopupMenu( this ); |
68 | 69 | ||
69 | bar = new QToolBar( this ); | 70 | bar = new QToolBar( this ); |
70 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); | 71 | QAction *a = new QAction( tr( "New" ), Opie::Core::OResource::loadPixmap( "new", Opie::Core::OResource::SmallIcon ), |
72 | QString::null, 0, this, 0 ); | ||
71 | a->setWhatsThis( tr( "Click here to create a new checkbook.\n\nYou also can select New from the Checkbook menu." ) ); | 73 | a->setWhatsThis( tr( "Click here to create a new checkbook.\n\nYou also can select New from the Checkbook menu." ) ); |
72 | connect( a, SIGNAL( activated() ), this, SLOT( slotNew() ) ); | 74 | connect( a, SIGNAL( activated() ), this, SLOT( slotNew() ) ); |
73 | a->addTo( popup ); | 75 | a->addTo( popup ); |
74 | a->addTo( bar ); | 76 | a->addTo( bar ); |
75 | 77 | ||
76 | actionOpen = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), QString::null, | 78 | actionOpen = new QAction( tr( "Edit" ), Opie::Core::OResource::loadPixmap( "edit", Opie::Core::OResource::SmallIcon ), |
77 | 0, this, 0 ); | 79 | QString::null, 0, this, 0 ); |
78 | actionOpen->setWhatsThis( tr( "Select a checkbook and then click here to edit it.\n\nYou also can select Edit from the Checkbook menu, or click and hold on a checkbook name." ) ); | 80 | actionOpen->setWhatsThis( tr( "Select a checkbook and then click here to edit it.\n\nYou also can select Edit from the Checkbook menu, or click and hold on a checkbook name." ) ); |
79 | connect( actionOpen, SIGNAL( activated() ), this, SLOT( slotEdit() ) ); | 81 | connect( actionOpen, SIGNAL( activated() ), this, SLOT( slotEdit() ) ); |
80 | actionOpen->addTo( popup ); | 82 | actionOpen->addTo( popup ); |
81 | actionOpen->addTo( bar ); | 83 | actionOpen->addTo( bar ); |
82 | 84 | ||
83 | actionDelete = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, | 85 | actionDelete = new QAction( tr( "Delete" ), Opie::Core::OResource::loadPixmap( "trash", Opie::Core::OResource::SmallIcon ), |
84 | 0, this, 0 ); | 86 | QString::null, 0, this, 0 ); |
85 | actionDelete->setWhatsThis( tr( "Select a checkbook and then click here delete it.\n\nYou also can select Delete from the Checkbook menu." ) ); | 87 | actionDelete->setWhatsThis( tr( "Select a checkbook and then click here delete it.\n\nYou also can select Delete from the Checkbook menu." ) ); |
86 | connect( actionDelete, SIGNAL( activated() ), this, SLOT( slotDelete() ) ); | 88 | connect( actionDelete, SIGNAL( activated() ), this, SLOT( slotDelete() ) ); |
87 | actionDelete->addTo( popup ); | 89 | actionDelete->addTo( popup ); |
88 | actionDelete->addTo( bar ); | 90 | actionDelete->addTo( bar ); |
89 | 91 | ||
90 | popup->insertSeparator(); | 92 | popup->insertSeparator(); |
91 | 93 | ||
92 | a = new QAction( tr( "Configure" ), Resource::loadPixmap( "SettingsIcon" ), QString::null, 0, this, 0 ); | 94 | a = new QAction( tr( "Configure" ), Opie::Core::OResource::loadPixmap( "SettingsIcon", Opie::Core::OResource::SmallIcon ), |
95 | QString::null, 0, this, 0 ); | ||
93 | a->setWhatsThis( tr( "Click here to configure this app." ) ); | 96 | a->setWhatsThis( tr( "Click here to configure this app." ) ); |
94 | connect( a, SIGNAL( activated() ), this, SLOT( slotConfigure() ) ); | 97 | connect( a, SIGNAL( activated() ), this, SLOT( slotConfigure() ) ); |
95 | a->addTo( popup ); | 98 | a->addTo( popup ); |
96 | a->addTo( bar ); | 99 | a->addTo( bar ); |
97 | 100 | ||
98 | mb->insertItem( tr( "Checkbook" ), popup ); | 101 | mb->insertItem( tr( "Checkbook" ), popup ); |
99 | 102 | ||
100 | // Load Checkbook selection list | 103 | // Load Checkbook selection list |
101 | checkbooks = new CBInfoList(); | 104 | checkbooks = new CBInfoList(); |
102 | 105 | ||
103 | QDir checkdir( cbDir ); | 106 | QDir checkdir( cbDir ); |
104 | if (checkdir.exists() == true) | 107 | if (checkdir.exists() == true) |
105 | { | 108 | { |
106 | QStringList cblist = checkdir.entryList( "*.qcb", QDir::Files|QDir::Readable|QDir::Writable, | 109 | QStringList cblist = checkdir.entryList( "*.qcb", QDir::Files|QDir::Readable|QDir::Writable, |
107 | QDir::Time ); | 110 | QDir::Time ); |
108 | CBInfo *cb = 0x0; | 111 | CBInfo *cb = 0x0; |
109 | QString filename; | 112 | QString filename; |
110 | 113 | ||
111 | for ( QStringList::Iterator it = cblist.begin(); it != cblist.end(); it++ ) | 114 | for ( QStringList::Iterator it = cblist.begin(); it != cblist.end(); it++ ) |
112 | { | 115 | { |
113 | filename = cbDir; | 116 | filename = cbDir; |
114 | filename.append( (*it) ); | 117 | filename.append( (*it) ); |
115 | 118 | ||
116 | cb = new CBInfo( (*it).remove( (*it).find('.'), (*it).length() ), filename ); | 119 | cb = new CBInfo( (*it).remove( (*it).find('.'), (*it).length() ), filename ); |
@@ -135,49 +138,49 @@ MainWindow::MainWindow( QWidget* parent, const char* name, WFlags /*fl*/ ) | |||
135 | itm=itm->nextSibling(); | 138 | itm=itm->nextSibling(); |
136 | } | 139 | } |
137 | } | 140 | } |
138 | } | 141 | } |
139 | 142 | ||
140 | 143 | ||
141 | // --- ~MainWindow ------------------------------------------------------------ | 144 | // --- ~MainWindow ------------------------------------------------------------ |
142 | MainWindow::~MainWindow() | 145 | MainWindow::~MainWindow() |
143 | { | 146 | { |
144 | writeConfig(); | 147 | writeConfig(); |
145 | } | 148 | } |
146 | 149 | ||
147 | 150 | ||
148 | // --- buildList -------------------------------------------------------------- | 151 | // --- buildList -------------------------------------------------------------- |
149 | void MainWindow::buildList() | 152 | void MainWindow::buildList() |
150 | { | 153 | { |
151 | if ( cbList ) | 154 | if ( cbList ) |
152 | delete cbList; | 155 | delete cbList; |
153 | 156 | ||
154 | cbList = new QListView( this ); | 157 | cbList = new QListView( this ); |
155 | QWhatsThis::add( cbList, tr( "This is a listing of all checkbooks currently available." ) ); | 158 | QWhatsThis::add( cbList, tr( "This is a listing of all checkbooks currently available." ) ); |
156 | 159 | ||
157 | if ( _cfg.getShowLocks() ) | 160 | if ( _cfg.getShowLocks() ) |
158 | { | 161 | { |
159 | cbList->addColumn( Resource::loadIconSet( "locked" ), "", 24 ); | 162 | cbList->addColumn( lockIcon, "", 24 ); |
160 | posName = 1; | 163 | posName = 1; |
161 | } | 164 | } |
162 | else | 165 | else |
163 | { | 166 | { |
164 | posName = 0; | 167 | posName = 0; |
165 | } | 168 | } |
166 | cbList->addColumn( tr( "Checkbook Name" ) ); | 169 | cbList->addColumn( tr( "Checkbook Name" ) ); |
167 | if ( _cfg.getShowBalances() ) | 170 | if ( _cfg.getShowBalances() ) |
168 | { | 171 | { |
169 | int colnum = cbList->addColumn( tr( "Balance" ) ); | 172 | int colnum = cbList->addColumn( tr( "Balance" ) ); |
170 | cbList->setColumnAlignment( colnum, Qt::AlignRight ); | 173 | cbList->setColumnAlignment( colnum, Qt::AlignRight ); |
171 | } | 174 | } |
172 | cbList->setAllColumnsShowFocus( TRUE ); | 175 | cbList->setAllColumnsShowFocus( TRUE ); |
173 | cbList->setSorting( posName ); | 176 | cbList->setSorting( posName ); |
174 | QPEApplication::setStylusOperation( cbList->viewport(), QPEApplication::RightOnHold ); | 177 | QPEApplication::setStylusOperation( cbList->viewport(), QPEApplication::RightOnHold ); |
175 | connect( cbList, SIGNAL( rightButtonPressed(QListViewItem*,const QPoint&,int) ), | 178 | connect( cbList, SIGNAL( rightButtonPressed(QListViewItem*,const QPoint&,int) ), |
176 | this, SLOT( slotEdit() ) ); | 179 | this, SLOT( slotEdit() ) ); |
177 | setCentralWidget( cbList ); | 180 | setCentralWidget( cbList ); |
178 | 181 | ||
179 | for ( CBInfo *cb = checkbooks->first(); cb; cb = checkbooks->next() ) | 182 | for ( CBInfo *cb = checkbooks->first(); cb; cb = checkbooks->next() ) |
180 | { | 183 | { |
181 | addCheckbook( cb ); | 184 | addCheckbook( cb ); |
182 | } | 185 | } |
183 | } | 186 | } |