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 | |
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,484 +1,494 @@ | |||
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 | { |
65 | info = i; | 67 | info = i; |
66 | _pCfg=cfg; | 68 | _pCfg=cfg; |
67 | 69 | ||
68 | // Title bar | 70 | // Title bar |
69 | if ( info->name() != "" ) | 71 | if ( info->name() != "" ) |
70 | { | 72 | { |
71 | QString tempstr = info->name(); | 73 | QString tempstr = info->name(); |
72 | tempstr.append( " - " ); | 74 | tempstr.append( " - " ); |
73 | tempstr.append( tr( "Checkbook" ) ); | 75 | tempstr.append( tr( "Checkbook" ) ); |
74 | setCaption( tempstr ); | 76 | setCaption( tempstr ); |
75 | } | 77 | } |
76 | else | 78 | else |
77 | { | 79 | { |
78 | setCaption( tr( "New checkbook" ) ); | 80 | setCaption( tr( "New checkbook" ) ); |
79 | } | 81 | } |
80 | 82 | ||
81 | 83 | ||
82 | // Setup layout to make everything pretty | 84 | // Setup layout to make everything pretty |
83 | QVBoxLayout *layout = new QVBoxLayout( this ); | 85 | QVBoxLayout *layout = new QVBoxLayout( this ); |
84 | layout->setMargin( 2 ); | 86 | layout->setMargin( 2 ); |
85 | layout->setSpacing( 4 ); | 87 | layout->setSpacing( 4 ); |
86 | 88 | ||
87 | // Setup tabs for all info | 89 | // Setup tabs for all info |
88 | mainWidget = new OTabWidget( this ); | 90 | mainWidget = new OTabWidget( this ); |
89 | layout->addWidget( mainWidget ); | 91 | layout->addWidget( mainWidget ); |
90 | mainWidget->addTab( initInfo(), "checkbook/infotab", tr( "Info" ) ); | 92 | mainWidget->addTab( initInfo(), "checkbook/infotab", tr( "Info" ) ); |
91 | mainWidget->addTab( initTransactions(), "checkbook/trantab", tr( "Transactions" ) ); | 93 | mainWidget->addTab( initTransactions(), "checkbook/trantab", tr( "Transactions" ) ); |
92 | mainWidget->addTab( initCharts(), "checkbook/charttab", tr( "Charts" ) ); | 94 | mainWidget->addTab( initCharts(), "checkbook/charttab", tr( "Charts" ) ); |
93 | if( _pCfg->isShowLastTab() ) | 95 | if( _pCfg->isShowLastTab() ) |
94 | mainWidget->setCurrentTab( info->getLastTab() ); | 96 | mainWidget->setCurrentTab( info->getLastTab() ); |
95 | else | 97 | else |
96 | mainWidget->setCurrentTab( tr( "Info" ) ); | 98 | mainWidget->setCurrentTab( tr( "Info" ) ); |
97 | connect( mainWidget, SIGNAL( currentChanged(QWidget*) ), this, SLOT( slotTab(QWidget*) ) ); | 99 | connect( mainWidget, SIGNAL( currentChanged(QWidget*) ), this, SLOT( slotTab(QWidget*) ) ); |
98 | 100 | ||
99 | // Load checkbook information | 101 | // Load checkbook information |
100 | loadCheckbook(); | 102 | loadCheckbook(); |
101 | } | 103 | } |
102 | 104 | ||
103 | Checkbook::~Checkbook() | 105 | Checkbook::~Checkbook() |
104 | { | 106 | { |
105 | } | 107 | } |
106 | 108 | ||
107 | // --- initInfo --------------------------------------------------------------- | 109 | // --- initInfo --------------------------------------------------------------- |
108 | QWidget *Checkbook::initInfo() | 110 | QWidget *Checkbook::initInfo() |
109 | { | 111 | { |
110 | QWidget *control = new QWidget( mainWidget, tr("Info") ); | 112 | QWidget *control = new QWidget( mainWidget, tr("Info") ); |
111 | 113 | ||
112 | QVBoxLayout *vb = new QVBoxLayout( control ); | 114 | QVBoxLayout *vb = new QVBoxLayout( control ); |
113 | 115 | ||
114 | QScrollView *sv = new QScrollView( control ); | 116 | QScrollView *sv = new QScrollView( control ); |
115 | vb->addWidget( sv, 0, 0 ); | 117 | vb->addWidget( sv, 0, 0 ); |
116 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 118 | sv->setResizePolicy( QScrollView::AutoOneFit ); |
117 | sv->setFrameStyle( QFrame::NoFrame ); | 119 | sv->setFrameStyle( QFrame::NoFrame ); |
118 | 120 | ||
119 | QWidget *container = new QWidget( sv->viewport() ); | 121 | QWidget *container = new QWidget( sv->viewport() ); |
120 | sv->addChild( container ); | 122 | sv->addChild( container ); |
121 | 123 | ||
122 | QGridLayout *layout = new QGridLayout( container ); | 124 | QGridLayout *layout = new QGridLayout( container ); |
123 | layout->setSpacing( 2 ); | 125 | layout->setSpacing( 2 ); |
124 | layout->setMargin( 4 ); | 126 | layout->setMargin( 4 ); |
125 | 127 | ||
126 | // Password protection | 128 | // Password protection |
127 | passwordCB = new QCheckBox( tr( "Password protect" ), container ); | 129 | passwordCB = new QCheckBox( tr( "Password protect" ), container ); |
128 | QWhatsThis::add( passwordCB, tr( "Click here to enable/disable password protection of this checkbook." ) ); | 130 | QWhatsThis::add( passwordCB, tr( "Click here to enable/disable password protection of this checkbook." ) ); |
129 | connect( passwordCB, SIGNAL( clicked() ), this, SLOT( slotPasswordClicked() ) ); | 131 | connect( passwordCB, SIGNAL( clicked() ), this, SLOT( slotPasswordClicked() ) ); |
130 | layout->addMultiCellWidget( passwordCB, 0, 0, 0, 1 ); | 132 | layout->addMultiCellWidget( passwordCB, 0, 0, 0, 1 ); |
131 | 133 | ||
132 | // Account name | 134 | // Account name |
133 | QLabel *label = new QLabel( tr( "Name:" ), container ); | 135 | QLabel *label = new QLabel( tr( "Name:" ), container ); |
134 | QWhatsThis::add( label, tr( "Enter name of checkbook here." ) ); | 136 | QWhatsThis::add( label, tr( "Enter name of checkbook here." ) ); |
135 | layout->addWidget( label, 1, 0 ); | 137 | layout->addWidget( label, 1, 0 ); |
136 | nameEdit = new QLineEdit( container ); | 138 | nameEdit = new QLineEdit( container ); |
137 | QWhatsThis::add( nameEdit, tr( "Enter name of checkbook here." ) ); | 139 | QWhatsThis::add( nameEdit, tr( "Enter name of checkbook here." ) ); |
138 | connect( nameEdit, SIGNAL( textChanged(const QString&) ), | 140 | connect( nameEdit, SIGNAL( textChanged(const QString&) ), |
139 | this, SLOT( slotNameChanged(const QString&) ) ); | 141 | this, SLOT( slotNameChanged(const QString&) ) ); |
140 | layout->addWidget( nameEdit, 1, 1 ); | 142 | layout->addWidget( nameEdit, 1, 1 ); |
141 | 143 | ||
142 | // Type of account | 144 | // Type of account |
143 | label = new QLabel( tr( "Type:" ), container ); | 145 | label = new QLabel( tr( "Type:" ), container ); |
144 | QWhatsThis::add( label, tr( "Select type of checkbook here." ) ); | 146 | QWhatsThis::add( label, tr( "Select type of checkbook here." ) ); |
145 | layout->addWidget( label, 2, 0 ); | 147 | layout->addWidget( label, 2, 0 ); |
146 | typeList = new QComboBox( container ); | 148 | typeList = new QComboBox( container ); |
147 | QWhatsThis::add( typeList, tr( "Select type of checkbook here." ) ); | 149 | QWhatsThis::add( typeList, tr( "Select type of checkbook here." ) ); |
148 | typeList->insertStringList( _pCfg->getAccountTypes() ); | 150 | typeList->insertStringList( _pCfg->getAccountTypes() ); |
149 | layout->addWidget( typeList, 2, 1 ); | 151 | layout->addWidget( typeList, 2, 1 ); |
150 | 152 | ||
151 | // Bank/institution name | 153 | // Bank/institution name |
152 | label = new QLabel( tr( "Bank:" ), container ); | 154 | label = new QLabel( tr( "Bank:" ), container ); |
153 | QWhatsThis::add( label, tr( "Enter name of the bank for this checkbook here." ) ); | 155 | QWhatsThis::add( label, tr( "Enter name of the bank for this checkbook here." ) ); |
154 | layout->addWidget( label, 3, 0 ); | 156 | layout->addWidget( label, 3, 0 ); |
155 | bankEdit = new QLineEdit( container ); | 157 | bankEdit = new QLineEdit( container ); |
156 | QWhatsThis::add( bankEdit, tr( "Enter name of the bank for this checkbook here." ) ); | 158 | QWhatsThis::add( bankEdit, tr( "Enter name of the bank for this checkbook here." ) ); |
157 | layout->addWidget( bankEdit, 3, 1 ); | 159 | layout->addWidget( bankEdit, 3, 1 ); |
158 | 160 | ||
159 | // Account number | 161 | // Account number |
160 | label = new QLabel( tr( "Account number:" ), container ); | 162 | label = new QLabel( tr( "Account number:" ), container ); |
161 | QWhatsThis::add( label, tr( "Enter account number for this checkbook here." ) ); | 163 | QWhatsThis::add( label, tr( "Enter account number for this checkbook here." ) ); |
162 | layout->addWidget( label, 4, 0 ); | 164 | layout->addWidget( label, 4, 0 ); |
163 | acctNumEdit = new QLineEdit( container ); | 165 | acctNumEdit = new QLineEdit( container ); |
164 | QWhatsThis::add( acctNumEdit, tr( "Enter account number for this checkbook here." ) ); | 166 | QWhatsThis::add( acctNumEdit, tr( "Enter account number for this checkbook here." ) ); |
165 | layout->addWidget( acctNumEdit, 4, 1 ); | 167 | layout->addWidget( acctNumEdit, 4, 1 ); |
166 | 168 | ||
167 | // PIN number | 169 | // PIN number |
168 | label = new QLabel( tr( "PIN number:" ), container ); | 170 | label = new QLabel( tr( "PIN number:" ), container ); |
169 | QWhatsThis::add( label, tr( "Enter PIN number for this checkbook here." ) ); | 171 | QWhatsThis::add( label, tr( "Enter PIN number for this checkbook here." ) ); |
170 | layout->addWidget( label, 5, 0 ); | 172 | layout->addWidget( label, 5, 0 ); |
171 | pinNumEdit = new QLineEdit( container ); | 173 | pinNumEdit = new QLineEdit( container ); |
172 | QWhatsThis::add( pinNumEdit, tr( "Enter PIN number for this checkbook here." ) ); | 174 | QWhatsThis::add( pinNumEdit, tr( "Enter PIN number for this checkbook here." ) ); |
173 | layout->addWidget( pinNumEdit, 5, 1 ); | 175 | layout->addWidget( pinNumEdit, 5, 1 ); |
174 | 176 | ||
175 | // Starting balance | 177 | // Starting balance |
176 | label = new QLabel( tr( "Starting balance:" ), container ); | 178 | label = new QLabel( tr( "Starting balance:" ), container ); |
177 | QWhatsThis::add( label, tr( "Enter the initial balance for this checkbook here." ) ); | 179 | QWhatsThis::add( label, tr( "Enter the initial balance for this checkbook here." ) ); |
178 | layout->addWidget( label, 6, 0 ); | 180 | layout->addWidget( label, 6, 0 ); |
179 | balanceEdit = new QLineEdit( container ); | 181 | balanceEdit = new QLineEdit( container ); |
180 | QWhatsThis::add( balanceEdit, tr( "Enter the initial balance for this checkbook here." ) ); | 182 | QWhatsThis::add( balanceEdit, tr( "Enter the initial balance for this checkbook here." ) ); |
181 | connect( balanceEdit, SIGNAL( textChanged(const QString&) ), | 183 | connect( balanceEdit, SIGNAL( textChanged(const QString&) ), |
182 | this, SLOT( slotStartingBalanceChanged(const QString&) ) ); | 184 | this, SLOT( slotStartingBalanceChanged(const QString&) ) ); |
183 | layout->addWidget( balanceEdit, 6, 1 ); | 185 | layout->addWidget( balanceEdit, 6, 1 ); |
184 | 186 | ||
185 | // Notes | 187 | // Notes |
186 | label = new QLabel( tr( "Notes:" ), container ); | 188 | label = new QLabel( tr( "Notes:" ), container ); |
187 | QWhatsThis::add( label, tr( "Enter any additional information for this checkbook here." ) ); | 189 | QWhatsThis::add( label, tr( "Enter any additional information for this checkbook here." ) ); |
188 | layout->addWidget( label, 7, 0 ); | 190 | layout->addWidget( label, 7, 0 ); |
189 | notesEdit = new QMultiLineEdit( container ); | 191 | notesEdit = new QMultiLineEdit( container ); |
190 | QWhatsThis::add( notesEdit, tr( "Enter any additional information for this checkbook here." ) ); | 192 | QWhatsThis::add( notesEdit, tr( "Enter any additional information for this checkbook here." ) ); |
191 | notesEdit->setMinimumHeight( 25 ); | 193 | notesEdit->setMinimumHeight( 25 ); |
192 | notesEdit->setMaximumHeight( 65 ); | 194 | notesEdit->setMaximumHeight( 65 ); |
193 | layout->addMultiCellWidget( notesEdit, 8, 8, 0, 1 ); | 195 | layout->addMultiCellWidget( notesEdit, 8, 8, 0, 1 ); |
194 | 196 | ||
195 | return control; | 197 | return control; |
196 | } | 198 | } |
197 | 199 | ||
198 | 200 | ||
199 | // --- initTransactions ------------------------------------------------------- | 201 | // --- initTransactions ------------------------------------------------------- |
200 | QWidget *Checkbook::initTransactions() | 202 | QWidget *Checkbook::initTransactions() |
201 | { | 203 | { |
202 | QWidget *control = new QWidget( mainWidget, tr("Transactions") ); | 204 | QWidget *control = new QWidget( mainWidget, tr("Transactions") ); |
203 | 205 | ||
204 | QGridLayout *layout = new QGridLayout( control ); | 206 | QGridLayout *layout = new QGridLayout( control ); |
205 | layout->setSpacing( 2 ); | 207 | layout->setSpacing( 2 ); |
206 | layout->setMargin( 4 ); | 208 | layout->setMargin( 4 ); |
207 | 209 | ||
208 | // Sort selector | 210 | // Sort selector |
209 | QLabel *label = new QLabel( tr( "Sort by:" ), control ); | 211 | QLabel *label = new QLabel( tr( "Sort by:" ), control ); |
210 | QWhatsThis::add( label, tr( "Select checkbook sorting here." ) ); | 212 | QWhatsThis::add( label, tr( "Select checkbook sorting here." ) ); |
211 | layout->addMultiCellWidget( label, 0, 0, 0, 1 ); | 213 | layout->addMultiCellWidget( label, 0, 0, 0, 1 ); |
212 | _cbSortType=new QComboBox( control ); | 214 | _cbSortType=new QComboBox( control ); |
213 | _cbSortType->insertItem( tr("Entry Order") ); | 215 | _cbSortType->insertItem( tr("Entry Order") ); |
214 | _cbSortType->insertItem( tr("Date") ); | 216 | _cbSortType->insertItem( tr("Date") ); |
215 | _cbSortType->insertItem( tr("Number") ); | 217 | _cbSortType->insertItem( tr("Number") ); |
216 | layout->addMultiCellWidget( _cbSortType, 0, 0, 1, 2 ); | 218 | layout->addMultiCellWidget( _cbSortType, 0, 0, 1, 2 ); |
217 | connect( _cbSortType, SIGNAL( activated(const QString&) ), this, SLOT( slotSortChanged(const QString&) ) ); | 219 | connect( _cbSortType, SIGNAL( activated(const QString&) ), this, SLOT( slotSortChanged(const QString&) ) ); |
218 | 220 | ||
219 | // Table | 221 | // Table |
220 | tranTable = new QListView( control ); | 222 | tranTable = new QListView( control ); |
221 | QFont fnt(QPEApplication::font()); | 223 | QFont fnt(QPEApplication::font()); |
222 | fnt.setPointSize( fnt.pointSize()-1 ); | 224 | fnt.setPointSize( fnt.pointSize()-1 ); |
223 | tranTable->setFont( fnt ); | 225 | tranTable->setFont( fnt ); |
224 | 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." ) ); | 226 | QWhatsThis::add( tranTable, tr( "This is a listing of all transactions entered for this checkbook.\n\nTo sort entries by a specific field, click on the column name." ) ); |
225 | tranTable->addColumn( tr( "Id" ) ); | 227 | tranTable->addColumn( tr( "Id" ) ); |
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--; |
317 | typeList->setCurrentItem( i ); | 327 | typeList->setCurrentItem( i ); |
318 | if ( typeList->currentText() == temptext ) | 328 | if ( typeList->currentText() == temptext ) |
319 | { | 329 | { |
320 | break; | 330 | break; |
321 | } | 331 | } |
322 | } | 332 | } |
323 | if( i<=0 ) { | 333 | if( i<=0 ) { |
324 | typeList->insertItem( temptext, 0 ); | 334 | typeList->insertItem( temptext, 0 ); |
325 | typeList->setCurrentItem(0); | 335 | typeList->setCurrentItem(0); |
326 | } | 336 | } |
327 | bankEdit->setText( info->bank() ); | 337 | bankEdit->setText( info->bank() ); |
328 | acctNumEdit->setText( info->account() ); | 338 | acctNumEdit->setText( info->account() ); |
329 | pinNumEdit->setText( info->pin() ); | 339 | pinNumEdit->setText( info->pin() ); |
330 | temptext.setNum( info->startingBalance(), 'f', 2 ); | 340 | temptext.setNum( info->startingBalance(), 'f', 2 ); |
331 | balanceEdit->setText( temptext ); | 341 | balanceEdit->setText( temptext ); |
332 | notesEdit->setText( info->notes() ); | 342 | notesEdit->setText( info->notes() ); |
333 | 343 | ||
334 | // Load transactions | 344 | // Load transactions |
335 | float amount; | 345 | float amount; |
336 | QString stramount; | 346 | QString stramount; |
337 | QString symbol = _pCfg->getCurrencySymbol(); | 347 | QString symbol = _pCfg->getCurrencySymbol(); |
338 | for ( TranInfo *tran = tranList->first(); tran; tran = tranList->next() ) | 348 | for ( TranInfo *tran = tranList->first(); tran; tran = tranList->next() ) |
339 | { | 349 | { |
340 | amount = tran->amount(); | 350 | amount = tran->amount(); |
341 | if ( tran->withdrawal() ) | 351 | if ( tran->withdrawal() ) |
342 | { | 352 | { |
343 | amount *= -1; | 353 | amount *= -1; |
344 | } | 354 | } |
345 | stramount.sprintf( "%.2f", amount ); | 355 | stramount.sprintf( "%.2f", amount ); |
346 | stramount.prepend( symbol ); | 356 | stramount.prepend( symbol ); |
347 | ( void ) new CBListItem( tran, tranTable, tran->getIdStr(), tran->datestr(false), tran->number(), tran->datestr(true), tran->desc(), stramount ); | 357 | ( void ) new CBListItem( tran, tranTable, tran->getIdStr(), tran->datestr(false), tran->number(), tran->datestr(true), tran->desc(), stramount ); |
348 | } | 358 | } |
349 | 359 | ||
350 | // set sort order | 360 | // set sort order |
351 | bool bOk=false; | 361 | bool bOk=false; |
352 | for(int i=0; i<_cbSortType->count(); i++) { | 362 | for(int i=0; i<_cbSortType->count(); i++) { |
353 | if( _cbSortType->text(i)==info->getSortOrder() ) { | 363 | if( _cbSortType->text(i)==info->getSortOrder() ) { |
354 | _cbSortType->setCurrentItem(i); | 364 | _cbSortType->setCurrentItem(i); |
355 | slotSortChanged( info->getSortOrder() ); | 365 | slotSortChanged( info->getSortOrder() ); |
356 | bOk=true; | 366 | bOk=true; |
357 | break; | 367 | break; |
358 | } | 368 | } |
359 | } | 369 | } |
360 | if( !bOk ) { | 370 | if( !bOk ) { |
361 | _cbSortType->setCurrentItem(0); | 371 | _cbSortType->setCurrentItem(0); |
362 | slotSortChanged( _cbSortType->currentText() ); | 372 | slotSortChanged( _cbSortType->currentText() ); |
363 | } | 373 | } |
364 | 374 | ||
365 | // calc running balance | 375 | // calc running balance |
366 | adjustBalance(); | 376 | adjustBalance(); |
367 | } | 377 | } |
368 | 378 | ||
369 | 379 | ||
370 | // --- adjustBalance ---------------------------------------------------------- | 380 | // --- adjustBalance ---------------------------------------------------------- |
371 | void Checkbook::adjustBalance() | 381 | void Checkbook::adjustBalance() |
372 | { | 382 | { |
373 | // update running balance in register | 383 | // update running balance in register |
374 | QString sRunning; | 384 | QString sRunning; |
375 | QString symbol = _pCfg->getCurrencySymbol(); | 385 | QString symbol = _pCfg->getCurrencySymbol(); |
376 | float bal=info->startingBalance(); | 386 | float bal=info->startingBalance(); |
377 | 387 | ||
378 | for(CBListItem *item=(CBListItem *)tranTable->firstChild(); item; item=(CBListItem *)item->nextSibling() ) { | 388 | for(CBListItem *item=(CBListItem *)tranTable->firstChild(); item; item=(CBListItem *)item->nextSibling() ) { |
379 | TranInfo *tran=item->getTranInfo(); | 389 | TranInfo *tran=item->getTranInfo(); |
380 | bal=bal + (tran->withdrawal() ? -1 : 1)*tran->amount() - tran->fee(); | 390 | bal=bal + (tran->withdrawal() ? -1 : 1)*tran->amount() - tran->fee(); |
381 | sRunning.sprintf( "%.2f", bal ); | 391 | sRunning.sprintf( "%.2f", bal ); |
382 | sRunning.prepend(symbol); | 392 | sRunning.prepend(symbol); |
383 | item->setText( COL_BAL, sRunning); | 393 | item->setText( COL_BAL, sRunning); |
384 | } | 394 | } |
385 | } | 395 | } |
386 | 396 | ||
387 | // --- resort ----------------------------------------------------------------- | 397 | // --- resort ----------------------------------------------------------------- |
388 | void Checkbook::resort() | 398 | void Checkbook::resort() |
389 | { | 399 | { |
390 | tranTable->setSorting(_sortCol); | 400 | tranTable->setSorting(_sortCol); |
391 | tranTable->sort(); | 401 | tranTable->sort(); |
392 | tranTable->setSorting(-1); | 402 | tranTable->setSorting(-1); |
393 | } | 403 | } |
394 | 404 | ||
395 | 405 | ||
396 | // --- accept ----------------------------------------------------------------- | 406 | // --- accept ----------------------------------------------------------------- |
397 | void Checkbook::accept() | 407 | void Checkbook::accept() |
398 | { | 408 | { |
399 | info->setName( nameEdit->text() ); | 409 | info->setName( nameEdit->text() ); |
400 | info->setType( typeList->currentText() ); | 410 | info->setType( typeList->currentText() ); |
401 | info->setBank( bankEdit->text() ); | 411 | info->setBank( bankEdit->text() ); |
402 | info->setAccount( acctNumEdit->text() ); | 412 | info->setAccount( acctNumEdit->text() ); |
403 | info->setPin( pinNumEdit->text() ); | 413 | info->setPin( pinNumEdit->text() ); |
404 | bool ok; | 414 | bool ok; |
405 | info->setStartingBalance( balanceEdit->text().toFloat( &ok ) ); | 415 | info->setStartingBalance( balanceEdit->text().toFloat( &ok ) ); |
406 | info->setNotes( notesEdit->text() ); | 416 | info->setNotes( notesEdit->text() ); |
407 | 417 | ||
408 | QDialog::accept(); | 418 | QDialog::accept(); |
409 | } | 419 | } |
410 | 420 | ||
411 | // --- slotPasswordClicked ---------------------------------------------------- | 421 | // --- slotPasswordClicked ---------------------------------------------------- |
412 | void Checkbook::slotPasswordClicked() | 422 | void Checkbook::slotPasswordClicked() |
413 | { | 423 | { |
414 | if ( info->password().isNull() && passwordCB->isChecked() ) | 424 | if ( info->password().isNull() && passwordCB->isChecked() ) |
415 | { | 425 | { |
416 | Password *pw = new Password( this, tr( "Enter password" ), tr( "Please enter your password:" ) ); | 426 | Password *pw = new Password( this, tr( "Enter password" ), tr( "Please enter your password:" ) ); |
417 | if ( pw->exec() != QDialog::Accepted ) | 427 | if ( pw->exec() != QDialog::Accepted ) |
418 | { | 428 | { |
419 | passwordCB->setChecked( FALSE ); | 429 | passwordCB->setChecked( FALSE ); |
420 | delete pw; | 430 | delete pw; |
421 | return; | 431 | return; |
422 | } | 432 | } |
423 | info->setPassword( pw->password ); | 433 | info->setPassword( pw->password ); |
424 | delete pw; | 434 | delete pw; |
425 | 435 | ||
426 | pw = new Password( this, tr( "Confirm password" ), tr( "Please confirm your password:" ) ); | 436 | pw = new Password( this, tr( "Confirm password" ), tr( "Please confirm your password:" ) ); |
427 | if ( pw->exec() != QDialog::Accepted || pw->password != info->password() ) | 437 | if ( pw->exec() != QDialog::Accepted || pw->password != info->password() ) |
428 | { | 438 | { |
429 | passwordCB->setChecked( FALSE ); | 439 | passwordCB->setChecked( FALSE ); |
430 | info->setPassword( QString::null ); | 440 | info->setPassword( QString::null ); |
431 | } | 441 | } |
432 | 442 | ||
433 | delete pw; | 443 | delete pw; |
434 | } | 444 | } |
435 | else if ( !info->password().isNull() && !passwordCB->isChecked() ) | 445 | else if ( !info->password().isNull() && !passwordCB->isChecked() ) |
436 | { | 446 | { |
437 | Password *pw = new Password( this, tr( "Enter password" ), | 447 | Password *pw = new Password( this, tr( "Enter password" ), |
438 | tr( "Please enter your password to confirm removal of password protection:" ) ); | 448 | tr( "Please enter your password to confirm removal of password protection:" ) ); |
439 | if ( pw->exec() == QDialog::Accepted && pw->password == info->password() ) | 449 | if ( pw->exec() == QDialog::Accepted && pw->password == info->password() ) |
440 | { | 450 | { |
441 | info->setPassword( QString::null ); | 451 | info->setPassword( QString::null ); |
442 | delete pw; | 452 | delete pw; |
443 | return; | 453 | return; |
444 | } | 454 | } |
445 | else | 455 | else |
446 | { | 456 | { |
447 | passwordCB->setChecked( TRUE ); | 457 | passwordCB->setChecked( TRUE ); |
448 | } | 458 | } |
449 | 459 | ||
450 | delete pw; | 460 | delete pw; |
451 | } | 461 | } |
452 | } | 462 | } |
453 | 463 | ||
454 | void Checkbook::slotNameChanged( const QString &newname ) | 464 | void Checkbook::slotNameChanged( const QString &newname ) |
455 | { | 465 | { |
456 | info->setName( newname ); | 466 | info->setName( newname ); |
457 | 467 | ||
458 | // TODO - need filedir | 468 | // TODO - need filedir |
459 | // QString namestr = filedir; | 469 | // QString namestr = filedir; |
460 | // namestr.append( newname ); | 470 | // namestr.append( newname ); |
461 | // namestr.append( ".qcb" ); | 471 | // namestr.append( ".qcb" ); |
462 | // info->setFilename( namestr ); | 472 | // info->setFilename( namestr ); |
463 | 473 | ||
464 | QString namestr = newname; | 474 | QString namestr = newname; |
465 | namestr.append( " - " ); | 475 | namestr.append( " - " ); |
466 | namestr.append( tr( "Checkbook" ) ); | 476 | namestr.append( tr( "Checkbook" ) ); |
467 | setCaption( namestr ); | 477 | setCaption( namestr ); |
468 | } | 478 | } |
469 | 479 | ||
470 | 480 | ||
471 | // ---slotStartingBalanceChanged ---------------------------------------------- | 481 | // ---slotStartingBalanceChanged ---------------------------------------------- |
472 | void Checkbook::slotStartingBalanceChanged( const QString &newbalance ) | 482 | void Checkbook::slotStartingBalanceChanged( const QString &newbalance ) |
473 | { | 483 | { |
474 | bool ok; | 484 | bool ok; |
475 | info->setStartingBalance( newbalance.toFloat( &ok ) ); | 485 | info->setStartingBalance( newbalance.toFloat( &ok ) ); |
476 | adjustBalance(); | 486 | adjustBalance(); |
477 | } | 487 | } |
478 | 488 | ||
479 | 489 | ||
480 | // --- slotNewTran ------------------------------------------------------------ | 490 | // --- slotNewTran ------------------------------------------------------------ |
481 | void Checkbook::slotNewTran() | 491 | void Checkbook::slotNewTran() |
482 | { | 492 | { |
483 | TranInfo *traninfo = new TranInfo( info->getNextNumber() ); | 493 | TranInfo *traninfo = new TranInfo( info->getNextNumber() ); |
484 | if( !_dLastNew.isNull() ) | 494 | if( !_dLastNew.isNull() ) |
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,279 +1,285 @@ | |||
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 ) { |
112 | args[i++]=pCol->getNewValue(); | 118 | args[i++]=pCol->getNewValue(); |
113 | pCol=this->next(); | 119 | pCol=this->next(); |
114 | } | 120 | } |
115 | _currentItem=new QListViewItem(_typeTable, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7] ); | 121 | _currentItem=new QListViewItem(_typeTable, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7] ); |
116 | 122 | ||
117 | // fix uniques | 123 | // fix uniques |
118 | fixTypes(); | 124 | fixTypes(); |
119 | 125 | ||
120 | // display col 0 of new value | 126 | // display col 0 of new value |
121 | QPoint pnt; | 127 | QPoint pnt; |
122 | slotClick(_currentItem, pnt, 0); | 128 | slotClick(_currentItem, pnt, 0); |
123 | _typeTable->setSelected( _currentItem, true ); | 129 | _typeTable->setSelected( _currentItem, true ); |
124 | 130 | ||
125 | // make it selected | 131 | // make it selected |
126 | _typeEdit->setCursorPosition(0); | 132 | _typeEdit->setCursorPosition(0); |
127 | _typeEdit->setSelection(0, _typeEdit->text().length() ); | 133 | _typeEdit->setSelection(0, _typeEdit->text().length() ); |
128 | } | 134 | } |
129 | 135 | ||
130 | // --- slotDel ------------------------------------------------------------- | 136 | // --- slotDel ------------------------------------------------------------- |
131 | void ListEdit::slotDel() | 137 | void ListEdit::slotDel() |
132 | { | 138 | { |
133 | if( !_currentItem ) return; | 139 | if( !_currentItem ) return; |
134 | delete _currentItem; | 140 | delete _currentItem; |
135 | _currentItem=NULL; | 141 | _currentItem=NULL; |
136 | _typeEdit->setText(""); | 142 | _typeEdit->setText(""); |
137 | _stack->raiseWidget(_typeEdit); | 143 | _stack->raiseWidget(_typeEdit); |
138 | } | 144 | } |
139 | 145 | ||
140 | 146 | ||
141 | // --- fixTypes ---------------------------------------------------------------- | 147 | // --- fixTypes ---------------------------------------------------------------- |
142 | // Makes sure all entries have a unique name and empty entries are replaced | 148 | // Makes sure all entries have a unique name and empty entries are replaced |
143 | // by a generic string. The first version performs the operation on a particular | 149 | // by a generic string. The first version performs the operation on a particular |
144 | // column, whereas the 2nd does it for all unique columns. | 150 | // column, whereas the 2nd does it for all unique columns. |
145 | class ColMap { | 151 | class ColMap { |
146 | public: | 152 | public: |
147 | ColMap(QString sValue, QListViewItem *pEntry) { | 153 | ColMap(QString sValue, QListViewItem *pEntry) { |
148 | _sValue=sValue; | 154 | _sValue=sValue; |
149 | _pEntry=pEntry; | 155 | _pEntry=pEntry; |
150 | } | 156 | } |
151 | QString &getValue() { return(_sValue); } | 157 | QString &getValue() { return(_sValue); } |
152 | QListViewItem *getItem() { return(_pEntry); } | 158 | QListViewItem *getItem() { return(_pEntry); } |
153 | 159 | ||
154 | protected: | 160 | protected: |
155 | QString _sValue; | 161 | QString _sValue; |
156 | QListViewItem *_pEntry; | 162 | QListViewItem *_pEntry; |
157 | }; | 163 | }; |
158 | 164 | ||
159 | class ColList : public QList<QString> | 165 | class ColList : public QList<QString> |
160 | { | 166 | { |
161 | public: | 167 | public: |
162 | ColList() : QList<QString>() { } | 168 | ColList() : QList<QString>() { } |
163 | 169 | ||
164 | protected: | 170 | protected: |
165 | int compareItems(QCollection::Item, QCollection::Item); | 171 | int compareItems(QCollection::Item, QCollection::Item); |
166 | }; | 172 | }; |
167 | 173 | ||
168 | int ColList::compareItems(QCollection::Item i1, QCollection::Item i2) { | 174 | int ColList::compareItems(QCollection::Item i1, QCollection::Item i2) { |
169 | return( ((QString *)i1)->compare(*(QString *)i2) ); | 175 | return( ((QString *)i1)->compare(*(QString *)i2) ); |
170 | } | 176 | } |
171 | 177 | ||
172 | void ListEdit::fixTypes(int iColumn) | 178 | void ListEdit::fixTypes(int iColumn) |
173 | { | 179 | { |
174 | // get column def | 180 | // get column def |
175 | ColumnDef *pDef=this->at(iColumn); | 181 | ColumnDef *pDef=this->at(iColumn); |
176 | 182 | ||
177 | // create map of entries | 183 | // create map of entries |
178 | if( !_typeTable->childCount() ) return; | 184 | if( !_typeTable->childCount() ) return; |
179 | ColMap **colMap=new ColMap *[_typeTable->childCount()]; | 185 | ColMap **colMap=new ColMap *[_typeTable->childCount()]; |
180 | QListViewItem *cur=_typeTable->firstChild(); | 186 | QListViewItem *cur=_typeTable->firstChild(); |
181 | ColList lst; | 187 | ColList lst; |
182 | for(int i=0; i<_typeTable->childCount(); i++) { | 188 | for(int i=0; i<_typeTable->childCount(); i++) { |
183 | colMap[i]=new ColMap(cur->text(iColumn), cur); | 189 | colMap[i]=new ColMap(cur->text(iColumn), cur); |
184 | lst.append( &(colMap[i]->getValue()) ); | 190 | lst.append( &(colMap[i]->getValue()) ); |
185 | cur=cur->nextSibling(); | 191 | cur=cur->nextSibling(); |
186 | } | 192 | } |
187 | 193 | ||
188 | // fix empty entries | 194 | // fix empty entries |
189 | int i=0; | 195 | int i=0; |
190 | for(QString *ptr=lst.first(); ptr; ptr=lst.next()) { | 196 | for(QString *ptr=lst.first(); ptr; ptr=lst.next()) { |
191 | *ptr=ptr->stripWhiteSpace(); | 197 | *ptr=ptr->stripWhiteSpace(); |
192 | if( ptr->isEmpty() ) { | 198 | if( ptr->isEmpty() ) { |
193 | i++; | 199 | i++; |
194 | if( i==1 ) *ptr=pDef->getNewValue(); | 200 | if( i==1 ) *ptr=pDef->getNewValue(); |
195 | else ptr->sprintf("%s %d", (const char *)pDef->getNewValue(), i); | 201 | else ptr->sprintf("%s %d", (const char *)pDef->getNewValue(), i); |
196 | } | 202 | } |
197 | } | 203 | } |
198 | 204 | ||
199 | // fix dups | 205 | // fix dups |
200 | lst.sort(); | 206 | lst.sort(); |
201 | QString repl; | 207 | QString repl; |
202 | for(uint iCur=0; iCur<lst.count()-1; iCur++) { | 208 | for(uint iCur=0; iCur<lst.count()-1; iCur++) { |
203 | QString *current=lst.at(iCur); | 209 | QString *current=lst.at(iCur); |
204 | for(uint iNext=iCur+1; iNext<lst.count(); iNext++ ) { | 210 | for(uint iNext=iCur+1; iNext<lst.count(); iNext++ ) { |
205 | if( *current!=*lst.at(iNext) ) continue; | 211 | if( *current!=*lst.at(iNext) ) continue; |
206 | for(int i=2; ; i++) { | 212 | for(int i=2; ; i++) { |
207 | repl.sprintf("%s %d", (const char *)*current, i); | 213 | repl.sprintf("%s %d", (const char *)*current, i); |
208 | bool bDup=false; | 214 | bool bDup=false; |
209 | uint iChk=iNext+1; | 215 | uint iChk=iNext+1; |
210 | while( iChk<lst.count() ) { | 216 | while( iChk<lst.count() ) { |
211 | QString *chk=lst.at(iChk); | 217 | QString *chk=lst.at(iChk); |
212 | if( !chk->startsWith(*current) ) break; | 218 | if( !chk->startsWith(*current) ) break; |
213 | if( *chk==repl ) { | 219 | if( *chk==repl ) { |
214 | bDup=true; | 220 | bDup=true; |
215 | break; | 221 | break; |
216 | } | 222 | } |
217 | iChk++; | 223 | iChk++; |
218 | } | 224 | } |
219 | if( !bDup ) { | 225 | if( !bDup ) { |
220 | *lst.at(iNext)=repl; | 226 | *lst.at(iNext)=repl; |
221 | break; | 227 | break; |
222 | } | 228 | } |
223 | } | 229 | } |
224 | } | 230 | } |
225 | } | 231 | } |
226 | lst.sort(); | 232 | lst.sort(); |
227 | 233 | ||
228 | // copy back clean up col map | 234 | // copy back clean up col map |
229 | for(int i=0; i<_typeTable->childCount(); i++) { | 235 | for(int i=0; i<_typeTable->childCount(); i++) { |
230 | colMap[i]->getItem()->setText(iColumn, colMap[i]->getValue()); | 236 | colMap[i]->getItem()->setText(iColumn, colMap[i]->getValue()); |
231 | delete colMap[i]; | 237 | delete colMap[i]; |
232 | } | 238 | } |
233 | delete colMap; | 239 | delete colMap; |
234 | } | 240 | } |
235 | 241 | ||
236 | void ListEdit::fixTypes() | 242 | void ListEdit::fixTypes() |
237 | { | 243 | { |
238 | int i; | 244 | int i; |
239 | ColumnDef *pDef; | 245 | ColumnDef *pDef; |
240 | for(pDef=this->first(), i=0; pDef; pDef=this->next(), i++) { | 246 | for(pDef=this->first(), i=0; pDef; pDef=this->next(), i++) { |
241 | if( pDef->hasFlag(ColumnDef::typeUnique) ) | 247 | if( pDef->hasFlag(ColumnDef::typeUnique) ) |
242 | fixTypes(i); | 248 | fixTypes(i); |
243 | } | 249 | } |
244 | _typeTable->sort(); | 250 | _typeTable->sort(); |
245 | } | 251 | } |
246 | 252 | ||
247 | 253 | ||
248 | // --- storeInList ------------------------------------------------------------ | 254 | // --- storeInList ------------------------------------------------------------ |
249 | void ListEdit::storeInList(QStringList &lst) | 255 | void ListEdit::storeInList(QStringList &lst) |
250 | { | 256 | { |
251 | // delete old content | 257 | // delete old content |
252 | lst.clear(); | 258 | lst.clear(); |
253 | 259 | ||
254 | // add new one | 260 | // add new one |
255 | fixTypes(); | 261 | fixTypes(); |
256 | QListViewItem *itm=_typeTable->firstChild(); | 262 | QListViewItem *itm=_typeTable->firstChild(); |
257 | while( itm ) { | 263 | while( itm ) { |
258 | int i=0; | 264 | int i=0; |
259 | QString sAdd; | 265 | QString sAdd; |
260 | ColumnDef *pDef; | 266 | ColumnDef *pDef; |
261 | for(pDef=this->first(), i=0; pDef; pDef=this->next(), i++) { | 267 | for(pDef=this->first(), i=0; pDef; pDef=this->next(), i++) { |
262 | if( i>=1 ) sAdd+=";"; | 268 | if( i>=1 ) sAdd+=";"; |
263 | sAdd += itm->text(i); | 269 | sAdd += itm->text(i); |
264 | } | 270 | } |
265 | lst.append( sAdd ); | 271 | lst.append( sAdd ); |
266 | itm=itm->nextSibling(); | 272 | itm=itm->nextSibling(); |
267 | } | 273 | } |
268 | } | 274 | } |
269 | 275 | ||
270 | 276 | ||
271 | // --- slotClicked ------------------------------------------------------------ | 277 | // --- slotClicked ------------------------------------------------------------ |
272 | void ListEdit::slotClick(QListViewItem *itm, const QPoint &pnt, int col) | 278 | void ListEdit::slotClick(QListViewItem *itm, const QPoint &pnt, int col) |
273 | { | 279 | { |
274 | (void)pnt; // get rid of unused warning; | 280 | (void)pnt; // get rid of unused warning; |
275 | 281 | ||
276 | // save values | 282 | // save values |
277 | _currentItem=itm; | 283 | _currentItem=itm; |
278 | _currentColumn=col; | 284 | _currentColumn=col; |
279 | if( itm==NULL ) { | 285 | if( itm==NULL ) { |
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,351 +1,354 @@ | |||
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 ); |
117 | checkbooks->inSort( cb ); | 120 | checkbooks->inSort( cb ); |
118 | } | 121 | } |
119 | } | 122 | } |
120 | 123 | ||
121 | // Build Checkbook selection list control | 124 | // Build Checkbook selection list control |
122 | cbList = 0x0; | 125 | cbList = 0x0; |
123 | buildList(); | 126 | buildList(); |
124 | 127 | ||
125 | // open last book? | 128 | // open last book? |
126 | if( _cfg.isOpenLastBook() ) { | 129 | if( _cfg.isOpenLastBook() ) { |
127 | this->show(); | 130 | this->show(); |
128 | this->showMaximized(); | 131 | this->showMaximized(); |
129 | QListViewItem *itm=cbList->firstChild(); | 132 | QListViewItem *itm=cbList->firstChild(); |
130 | while( itm ) { | 133 | while( itm ) { |
131 | if( itm->text(posName)==_cfg.getLastBook() ) { | 134 | if( itm->text(posName)==_cfg.getLastBook() ) { |
132 | openBook( itm ); | 135 | openBook( itm ); |
133 | break; | 136 | break; |
134 | } | 137 | } |
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 | } |
184 | 187 | ||
185 | void MainWindow::addCheckbook( CBInfo *cb ) | 188 | void MainWindow::addCheckbook( CBInfo *cb ) |
186 | { | 189 | { |
187 | QListViewItem *lvi = new QListViewItem( cbList ); | 190 | QListViewItem *lvi = new QListViewItem( cbList ); |
188 | if ( _cfg.getShowLocks() && !cb->password().isNull() ) | 191 | if ( _cfg.getShowLocks() && !cb->password().isNull() ) |
189 | { | 192 | { |
190 | lvi->setPixmap( 0, lockIcon ); | 193 | lvi->setPixmap( 0, lockIcon ); |
191 | } | 194 | } |
192 | lvi->setText( posName, cb->name() ); | 195 | lvi->setText( posName, cb->name() ); |
193 | if ( _cfg.getShowBalances() ) | 196 | if ( _cfg.getShowBalances() ) |
194 | { | 197 | { |
195 | QString balance; | 198 | QString balance; |
196 | balance.sprintf( "%.2f", cb->balance() ); | 199 | balance.sprintf( "%.2f", cb->balance() ); |
197 | balance.prepend( _cfg.getCurrencySymbol() ); | 200 | balance.prepend( _cfg.getCurrencySymbol() ); |
198 | lvi->setText( posName + 1, balance ); | 201 | lvi->setText( posName + 1, balance ); |
199 | } | 202 | } |
200 | } | 203 | } |
201 | 204 | ||
202 | void MainWindow::buildFilename( const QString &name ) | 205 | void MainWindow::buildFilename( const QString &name ) |
203 | { | 206 | { |
204 | tempFilename = cbDir; | 207 | tempFilename = cbDir; |
205 | tempFilename.append( name ); | 208 | tempFilename.append( name ); |
206 | tempFilename.append( ".qcb" ); | 209 | tempFilename.append( ".qcb" ); |
207 | } | 210 | } |
208 | 211 | ||
209 | void MainWindow::slotNew() | 212 | void MainWindow::slotNew() |
210 | { | 213 | { |
211 | CBInfo *cb = new CBInfo(); | 214 | CBInfo *cb = new CBInfo(); |
212 | 215 | ||
213 | Checkbook *currcb = new Checkbook( this, cb, &_cfg ); | 216 | Checkbook *currcb = new Checkbook( this, cb, &_cfg ); |
214 | if ( QPEApplication::execDialog( currcb ) == QDialog::Accepted ) | 217 | if ( QPEApplication::execDialog( currcb ) == QDialog::Accepted ) |
215 | { | 218 | { |
216 | // Save new checkbook | 219 | // Save new checkbook |
217 | buildFilename( cb->name() ); | 220 | buildFilename( cb->name() ); |
218 | _cfg.setLastBook( cb->name() ); | 221 | _cfg.setLastBook( cb->name() ); |
219 | cb->setFilename( tempFilename ); | 222 | cb->setFilename( tempFilename ); |
220 | cb->write(); | 223 | cb->write(); |
221 | 224 | ||
222 | // Add to listbox | 225 | // Add to listbox |
223 | checkbooks->inSort( cb ); | 226 | checkbooks->inSort( cb ); |
224 | addCheckbook( cb ); | 227 | addCheckbook( cb ); |
225 | } | 228 | } |
226 | delete currcb; | 229 | delete currcb; |
227 | } | 230 | } |
228 | 231 | ||
229 | // --- slotEdit --------------------------------------------------------------- | 232 | // --- slotEdit --------------------------------------------------------------- |
230 | void MainWindow::slotEdit() | 233 | void MainWindow::slotEdit() |
231 | { | 234 | { |
232 | // get name and open it | 235 | // get name and open it |
233 | QListViewItem *curritem = cbList->currentItem(); | 236 | QListViewItem *curritem = cbList->currentItem(); |
234 | if ( !curritem ) | 237 | if ( !curritem ) |
235 | return; | 238 | return; |
236 | openBook( curritem ); | 239 | openBook( curritem ); |
237 | } | 240 | } |
238 | 241 | ||
239 | 242 | ||
240 | // --- openBook --------------------------------------------------------------- | 243 | // --- openBook --------------------------------------------------------------- |
241 | void MainWindow::openBook(QListViewItem *curritem) | 244 | void MainWindow::openBook(QListViewItem *curritem) |
242 | { | 245 | { |
243 | // find book in List | 246 | // find book in List |
244 | QString currname=curritem->text(posName); | 247 | QString currname=curritem->text(posName); |
245 | CBInfo *cb = checkbooks->first(); | 248 | CBInfo *cb = checkbooks->first(); |
246 | while ( cb ) { | 249 | while ( cb ) { |
247 | if ( cb->name() == currname ) | 250 | if ( cb->name() == currname ) |
248 | break; | 251 | break; |
249 | cb = checkbooks->next(); | 252 | cb = checkbooks->next(); |
250 | } | 253 | } |
251 | if ( !cb ) return; | 254 | if ( !cb ) return; |
252 | 255 | ||
253 | // | 256 | // |
254 | buildFilename( currname ); | 257 | buildFilename( currname ); |
255 | float currbalance = cb->balance(); | 258 | float currbalance = cb->balance(); |
256 | bool currlock = !cb->password().isNull(); | 259 | bool currlock = !cb->password().isNull(); |
257 | 260 | ||
258 | if ( currlock ) | 261 | if ( currlock ) |
259 | { | 262 | { |
260 | Password *pw = new Password( this, tr( "Enter password" ), tr( "Please enter your password:" ) ); | 263 | Password *pw = new Password( this, tr( "Enter password" ), tr( "Please enter your password:" ) ); |
261 | if ( pw->exec() != QDialog::Accepted || pw->password != cb->password() ) | 264 | if ( pw->exec() != QDialog::Accepted || pw->password != cb->password() ) |
262 | { | 265 | { |
263 | delete pw; | 266 | delete pw; |
264 | return; | 267 | return; |
265 | } | 268 | } |
266 | delete pw; | 269 | delete pw; |
267 | } | 270 | } |
268 | 271 | ||
269 | _cfg.setLastBook( currname ); | 272 | _cfg.setLastBook( currname ); |
270 | Checkbook *currcb = new Checkbook( this, cb, &_cfg ); | 273 | Checkbook *currcb = new Checkbook( this, cb, &_cfg ); |
271 | if ( QPEApplication::execDialog( currcb ) == QDialog::Accepted ) | 274 | if ( QPEApplication::execDialog( currcb ) == QDialog::Accepted ) |
272 | { | 275 | { |
273 | QString newname = cb->name(); | 276 | QString newname = cb->name(); |
274 | if ( currname != newname ) | 277 | if ( currname != newname ) |
275 | { | 278 | { |
276 | // Update name if changed | 279 | // Update name if changed |
277 | if( curritem ) { | 280 | if( curritem ) { |
278 | curritem->setText( posName, newname ); | 281 | curritem->setText( posName, newname ); |
279 | cbList->sort(); | 282 | cbList->sort(); |
280 | } | 283 | } |
281 | _cfg.setLastBook( newname ); | 284 | _cfg.setLastBook( newname ); |
282 | 285 | ||
283 | // Remove old file | 286 | // Remove old file |
284 | QFile f( tempFilename ); | 287 | QFile f( tempFilename ); |
285 | if ( f.exists() ) | 288 | if ( f.exists() ) |
286 | f.remove(); | 289 | f.remove(); |
287 | 290 | ||
288 | // Get new filename | 291 | // Get new filename |
289 | buildFilename( newname ); | 292 | buildFilename( newname ); |
290 | cb->setFilename( tempFilename ); | 293 | cb->setFilename( tempFilename ); |
291 | } | 294 | } |
292 | 295 | ||
293 | cb->write(); | 296 | cb->write(); |
294 | 297 | ||
295 | // Update lock if changed | 298 | // Update lock if changed |
296 | if ( _cfg.getShowLocks() && !cb->password().isNull() != currlock ) | 299 | if ( _cfg.getShowLocks() && !cb->password().isNull() != currlock ) |
297 | { | 300 | { |
298 | if ( !cb->password().isNull() ) | 301 | if ( !cb->password().isNull() ) |
299 | curritem->setPixmap( 0, lockIcon ); | 302 | curritem->setPixmap( 0, lockIcon ); |
300 | else | 303 | else |
301 | curritem->setPixmap( 0, nullIcon ); | 304 | curritem->setPixmap( 0, nullIcon ); |
302 | } | 305 | } |
303 | 306 | ||
304 | // Update balance if changed | 307 | // Update balance if changed |
305 | if ( _cfg.getShowBalances() && cb->balance() != currbalance ) | 308 | if ( _cfg.getShowBalances() && cb->balance() != currbalance ) |
306 | { | 309 | { |
307 | QString tempstr; | 310 | QString tempstr; |
308 | tempstr.sprintf( "%.2f", cb->balance() ); | 311 | tempstr.sprintf( "%.2f", cb->balance() ); |
309 | tempstr.prepend( _cfg.getCurrencySymbol() ); | 312 | tempstr.prepend( _cfg.getCurrencySymbol() ); |
310 | curritem->setText( posName + 1, tempstr ); | 313 | curritem->setText( posName + 1, tempstr ); |
311 | } | 314 | } |
312 | 315 | ||
313 | // write config, if needed | 316 | // write config, if needed |
314 | if( _cfg.isDirty() ) { | 317 | if( _cfg.isDirty() ) { |
315 | Config config("checkbook"); | 318 | Config config("checkbook"); |
316 | _cfg.writeConfig( config ); | 319 | _cfg.writeConfig( config ); |
317 | } | 320 | } |
318 | } | 321 | } |
319 | delete currcb; | 322 | delete currcb; |
320 | } | 323 | } |
321 | 324 | ||
322 | // --- slotDelete ------------------------------------------------------------- | 325 | // --- slotDelete ------------------------------------------------------------- |
323 | void MainWindow::slotDelete() | 326 | void MainWindow::slotDelete() |
324 | { | 327 | { |
325 | QString currname = cbList->currentItem()->text( posName ); | 328 | QString currname = cbList->currentItem()->text( posName ); |
326 | 329 | ||
327 | if ( QPEMessageBox::confirmDelete ( this, tr( "Delete checkbook" ), currname ) ) | 330 | if ( QPEMessageBox::confirmDelete ( this, tr( "Delete checkbook" ), currname ) ) |
328 | { | 331 | { |
329 | buildFilename( currname ); | 332 | buildFilename( currname ); |
330 | QFile f( tempFilename ); | 333 | QFile f( tempFilename ); |
331 | if ( f.exists() ) | 334 | if ( f.exists() ) |
332 | { | 335 | { |
333 | f.remove(); | 336 | f.remove(); |
334 | } | 337 | } |
335 | 338 | ||
336 | delete cbList->currentItem(); | 339 | delete cbList->currentItem(); |
337 | } | 340 | } |
338 | } | 341 | } |
339 | 342 | ||
340 | // --- slotConfigure ---------------------------------------------------------- | 343 | // --- slotConfigure ---------------------------------------------------------- |
341 | void MainWindow::slotConfigure() | 344 | void MainWindow::slotConfigure() |
342 | { | 345 | { |
343 | Configuration *cfgdlg = new Configuration( this, _cfg ); | 346 | Configuration *cfgdlg = new Configuration( this, _cfg ); |
344 | if ( QPEApplication::execDialog( cfgdlg ) == QDialog::Accepted ) | 347 | if ( QPEApplication::execDialog( cfgdlg ) == QDialog::Accepted ) |
345 | { | 348 | { |
346 | // read data from config dialog & save it | 349 | // read data from config dialog & save it |
347 | cfgdlg->saveConfig( _cfg ); | 350 | cfgdlg->saveConfig( _cfg ); |
348 | writeConfig(); | 351 | writeConfig(); |
349 | buildList(); | 352 | buildList(); |
350 | } | 353 | } |
351 | delete cfgdlg; | 354 | delete cfgdlg; |