-rw-r--r-- | noncore/apps/checkbook/mainwindow.cpp | 432 |
1 files changed, 216 insertions, 216 deletions
diff --git a/noncore/apps/checkbook/mainwindow.cpp b/noncore/apps/checkbook/mainwindow.cpp index 9fc2125..f29001a 100644 --- a/noncore/apps/checkbook/mainwindow.cpp +++ b/noncore/apps/checkbook/mainwindow.cpp | |||
@@ -35,331 +35,331 @@ | |||
35 | 35 | ||
36 | #include <qpe/config.h> | 36 | #include <qpe/config.h> |
37 | #include <qpe/global.h> | 37 | #include <qpe/global.h> |
38 | #include <qpe/qpeapplication.h> | 38 | #include <qpe/qpeapplication.h> |
39 | #include <qmenubar.h> | 39 | #include <qmenubar.h> |
40 | #include <qpe/qpemessagebox.h> | 40 | #include <qpe/qpemessagebox.h> |
41 | #include <qpe/qpetoolbar.h> | 41 | #include <qpe/qpetoolbar.h> |
42 | #include <qpe/resource.h> | 42 | #include <qpe/resource.h> |
43 | 43 | ||
44 | #include <qaction.h> | 44 | #include <qaction.h> |
45 | #include <qcheckbox.h> | 45 | #include <qcheckbox.h> |
46 | #include <qdir.h> | 46 | #include <qdir.h> |
47 | #include <qlineedit.h> | 47 | #include <qlineedit.h> |
48 | #include <qwhatsthis.h> | 48 | #include <qwhatsthis.h> |
49 | 49 | ||
50 | 50 | ||
51 | MainWindow::MainWindow( QWidget* parent, const char* name, WFlags fl ) | 51 | MainWindow::MainWindow( QWidget* parent, const char* name, WFlags /*fl*/ ) |
52 | : QMainWindow( parent, name, fl || WStyle_ContextHelp ) | 52 | : QMainWindow( parent, name, WStyle_ContextHelp ) |
53 | { | 53 | { |
54 | setCaption( tr( "Checkbook" ) ); | 54 | setCaption( tr( "Checkbook" ) ); |
55 | 55 | ||
56 | cbDir = Global::applicationFileName( "checkbook", "" ); | 56 | cbDir = Global::applicationFileName( "checkbook", "" ); |
57 | lockIcon = Resource::loadPixmap( "locked" ); | 57 | lockIcon = Resource::loadPixmap( "locked" ); |
58 | 58 | ||
59 | // Load configuration options | 59 | // Load configuration options |
60 | Config config( "checkbook" ); | 60 | Config config( "checkbook" ); |
61 | _cfg.readConfig( config ); | 61 | _cfg.readConfig( config ); |
62 | 62 | ||
63 | 63 | ||
64 | // Build menu and tool bars | 64 | // Build menu and tool bars |
65 | setToolBarsMovable( FALSE ); | 65 | setToolBarsMovable( FALSE ); |
66 | 66 | ||
67 | QToolBar *bar = new QToolBar( this ); | 67 | QToolBar *bar = new QToolBar( this ); |
68 | bar->setHorizontalStretchable( TRUE ); | 68 | bar->setHorizontalStretchable( TRUE ); |
69 | QMenuBar *mb = new QMenuBar( bar ); | 69 | QMenuBar *mb = new QMenuBar( bar ); |
70 | mb->setMargin( 0 ); | 70 | mb->setMargin( 0 ); |
71 | QPopupMenu *popup = new QPopupMenu( this ); | 71 | QPopupMenu *popup = new QPopupMenu( this ); |
72 | 72 | ||
73 | bar = new QToolBar( this ); | 73 | bar = new QToolBar( this ); |
74 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); | 74 | QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); |
75 | a->setWhatsThis( tr( "Click here to create a new checkbook.\n\nYou also can select New from the Checkbook menu." ) ); | 75 | a->setWhatsThis( tr( "Click here to create a new checkbook.\n\nYou also can select New from the Checkbook menu." ) ); |
76 | connect( a, SIGNAL( activated() ), this, SLOT( slotNew() ) ); | 76 | connect( a, SIGNAL( activated() ), this, SLOT( slotNew() ) ); |
77 | a->addTo( popup ); | 77 | a->addTo( popup ); |
78 | a->addTo( bar ); | 78 | a->addTo( bar ); |
79 | 79 | ||
80 | actionOpen = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), QString::null, | 80 | actionOpen = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), QString::null, |
81 | 0, this, 0 ); | 81 | 0, this, 0 ); |
82 | 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." ) ); | 82 | 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." ) ); |
83 | connect( actionOpen, SIGNAL( activated() ), this, SLOT( slotEdit() ) ); | 83 | connect( actionOpen, SIGNAL( activated() ), this, SLOT( slotEdit() ) ); |
84 | actionOpen->addTo( popup ); | 84 | actionOpen->addTo( popup ); |
85 | actionOpen->addTo( bar ); | 85 | actionOpen->addTo( bar ); |
86 | 86 | ||
87 | actionDelete = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, | 87 | actionDelete = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, |
88 | 0, this, 0 ); | 88 | 0, this, 0 ); |
89 | actionDelete->setWhatsThis( tr( "Select a checkbook and then click here delete it.\n\nYou also can select Delete from the Checkbook menu." ) ); | 89 | actionDelete->setWhatsThis( tr( "Select a checkbook and then click here delete it.\n\nYou also can select Delete from the Checkbook menu." ) ); |
90 | connect( actionDelete, SIGNAL( activated() ), this, SLOT( slotDelete() ) ); | 90 | connect( actionDelete, SIGNAL( activated() ), this, SLOT( slotDelete() ) ); |
91 | actionDelete->addTo( popup ); | 91 | actionDelete->addTo( popup ); |
92 | actionDelete->addTo( bar ); | 92 | actionDelete->addTo( bar ); |
93 | 93 | ||
94 | popup->insertSeparator(); | 94 | popup->insertSeparator(); |
95 | 95 | ||
96 | a = new QAction( tr( "Configure" ), Resource::loadPixmap( "SettingsIcon" ), QString::null, 0, this, 0 ); | 96 | a = new QAction( tr( "Configure" ), Resource::loadPixmap( "SettingsIcon" ), QString::null, 0, this, 0 ); |
97 | a->setWhatsThis( tr( "Click here to configure this app." ) ); | 97 | a->setWhatsThis( tr( "Click here to configure this app." ) ); |
98 | connect( a, SIGNAL( activated() ), this, SLOT( slotConfigure() ) ); | 98 | connect( a, SIGNAL( activated() ), this, SLOT( slotConfigure() ) ); |
99 | a->addTo( popup ); | 99 | a->addTo( popup ); |
100 | a->addTo( bar ); | 100 | a->addTo( bar ); |
101 | 101 | ||
102 | mb->insertItem( tr( "Checkbook" ), popup ); | 102 | mb->insertItem( tr( "Checkbook" ), popup ); |
103 | 103 | ||
104 | // Load Checkbook selection list | 104 | // Load Checkbook selection list |
105 | checkbooks = new CBInfoList(); | 105 | checkbooks = new CBInfoList(); |
106 | 106 | ||
107 | QDir checkdir( cbDir ); | 107 | QDir checkdir( cbDir ); |
108 | if (checkdir.exists() == true) | 108 | if (checkdir.exists() == true) |
109 | { | 109 | { |
110 | QStringList cblist = checkdir.entryList( "*.qcb", QDir::Files|QDir::Readable|QDir::Writable, | 110 | QStringList cblist = checkdir.entryList( "*.qcb", QDir::Files|QDir::Readable|QDir::Writable, |
111 | QDir::Time ); | 111 | QDir::Time ); |
112 | CBInfo *cb = 0x0; | 112 | CBInfo *cb = 0x0; |
113 | QString filename; | 113 | QString filename; |
114 | 114 | ||
115 | for ( QStringList::Iterator it = cblist.begin(); it != cblist.end(); it++ ) | 115 | for ( QStringList::Iterator it = cblist.begin(); it != cblist.end(); it++ ) |
116 | { | 116 | { |
117 | filename = cbDir; | 117 | filename = cbDir; |
118 | filename.append( (*it) ); | 118 | filename.append( (*it) ); |
119 | 119 | ||
120 | cb = new CBInfo( (*it).remove( (*it).find('.'), (*it).length() ), filename ); | 120 | cb = new CBInfo( (*it).remove( (*it).find('.'), (*it).length() ), filename ); |
121 | checkbooks->inSort( cb ); | 121 | checkbooks->inSort( cb ); |
122 | } | 122 | } |
123 | } | 123 | } |
124 | 124 | ||
125 | // Build Checkbook selection list control | 125 | // Build Checkbook selection list control |
126 | cbList = 0x0; | 126 | cbList = 0x0; |
127 | buildList(); | 127 | buildList(); |
128 | 128 | ||
129 | // open last book? | 129 | // open last book? |
130 | if( _cfg.isOpenLastBook() ) { | 130 | if( _cfg.isOpenLastBook() ) { |
131 | this->show(); | 131 | this->show(); |
132 | this->showMaximized(); | 132 | this->showMaximized(); |
133 | QListViewItem *itm=cbList->firstChild(); | 133 | QListViewItem *itm=cbList->firstChild(); |
134 | while( itm ) { | 134 | while( itm ) { |
135 | if( itm->text(posName)==_cfg.getLastBook() ) { | 135 | if( itm->text(posName)==_cfg.getLastBook() ) { |
136 | openBook( itm ); | 136 | openBook( itm ); |
137 | break; | 137 | break; |
138 | } | 138 | } |
139 | itm=itm->nextSibling(); | 139 | itm=itm->nextSibling(); |
140 | } | 140 | } |
141 | } | 141 | } |
142 | } | 142 | } |
143 | 143 | ||
144 | 144 | ||
145 | // --- ~MainWindow ------------------------------------------------------------ | 145 | // --- ~MainWindow ------------------------------------------------------------ |
146 | MainWindow::~MainWindow() | 146 | MainWindow::~MainWindow() |
147 | { | 147 | { |
148 | writeConfig(); | 148 | writeConfig(); |
149 | } | 149 | } |
150 | 150 | ||
151 | 151 | ||
152 | // --- buildList -------------------------------------------------------------- | 152 | // --- buildList -------------------------------------------------------------- |
153 | void MainWindow::buildList() | 153 | void MainWindow::buildList() |
154 | { | 154 | { |
155 | if ( cbList ) | 155 | if ( cbList ) |
156 | delete cbList; | 156 | delete cbList; |
157 | 157 | ||
158 | cbList = new QListView( this ); | 158 | cbList = new QListView( this ); |
159 | QWhatsThis::add( cbList, tr( "This is a listing of all checkbooks currently available." ) ); | 159 | QWhatsThis::add( cbList, tr( "This is a listing of all checkbooks currently available." ) ); |
160 | 160 | ||
161 | if ( _cfg.getShowLocks() ) | 161 | if ( _cfg.getShowLocks() ) |
162 | { | 162 | { |
163 | cbList->addColumn( Resource::loadIconSet( "locked" ), "", 24 ); | 163 | cbList->addColumn( Resource::loadIconSet( "locked" ), "", 24 ); |
164 | posName = 1; | 164 | posName = 1; |
165 | } | 165 | } |
166 | else | 166 | else |
167 | { | 167 | { |
168 | posName = 0; | 168 | posName = 0; |
169 | } | 169 | } |
170 | cbList->addColumn( tr( "Checkbook Name" ) ); | 170 | cbList->addColumn( tr( "Checkbook Name" ) ); |
171 | if ( _cfg.getShowBalances() ) | 171 | if ( _cfg.getShowBalances() ) |
172 | { | 172 | { |
173 | int colnum = cbList->addColumn( tr( "Balance" ) ); | 173 | int colnum = cbList->addColumn( tr( "Balance" ) ); |
174 | cbList->setColumnAlignment( colnum, Qt::AlignRight ); | 174 | cbList->setColumnAlignment( colnum, Qt::AlignRight ); |
175 | } | 175 | } |
176 | cbList->setAllColumnsShowFocus( TRUE ); | 176 | cbList->setAllColumnsShowFocus( TRUE ); |
177 | cbList->setSorting( posName ); | 177 | cbList->setSorting( posName ); |
178 | QPEApplication::setStylusOperation( cbList->viewport(), QPEApplication::RightOnHold ); | 178 | QPEApplication::setStylusOperation( cbList->viewport(), QPEApplication::RightOnHold ); |
179 | connect( cbList, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint &, int ) ), | 179 | connect( cbList, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint &, int ) ), |
180 | this, SLOT( slotEdit() ) ); | 180 | this, SLOT( slotEdit() ) ); |
181 | setCentralWidget( cbList ); | 181 | setCentralWidget( cbList ); |
182 | 182 | ||
183 | for ( CBInfo *cb = checkbooks->first(); cb; cb = checkbooks->next() ) | 183 | for ( CBInfo *cb = checkbooks->first(); cb; cb = checkbooks->next() ) |
184 | { | 184 | { |
185 | addCheckbook( cb ); | 185 | addCheckbook( cb ); |
186 | } | 186 | } |
187 | } | 187 | } |
188 | 188 | ||
189 | void MainWindow::addCheckbook( CBInfo *cb ) | 189 | void MainWindow::addCheckbook( CBInfo *cb ) |
190 | { | 190 | { |
191 | QListViewItem *lvi = new QListViewItem( cbList ); | 191 | QListViewItem *lvi = new QListViewItem( cbList ); |
192 | if ( _cfg.getShowLocks() && !cb->password().isNull() ) | 192 | if ( _cfg.getShowLocks() && !cb->password().isNull() ) |
193 | { | 193 | { |
194 | lvi->setPixmap( 0, lockIcon ); | 194 | lvi->setPixmap( 0, lockIcon ); |
195 | } | 195 | } |
196 | lvi->setText( posName, cb->name() ); | 196 | lvi->setText( posName, cb->name() ); |
197 | if ( _cfg.getShowBalances() ) | 197 | if ( _cfg.getShowBalances() ) |
198 | { | 198 | { |
199 | QString balance; | 199 | QString balance; |
200 | balance.sprintf( "%s%.2f", _cfg.getCurrencySymbol().latin1(), cb->balance() ); | 200 | balance.sprintf( "%s%.2f", _cfg.getCurrencySymbol().latin1(), cb->balance() ); |
201 | lvi->setText( posName + 1, balance ); | 201 | lvi->setText( posName + 1, balance ); |
202 | } | 202 | } |
203 | } | 203 | } |
204 | 204 | ||
205 | void MainWindow::buildFilename( const QString &name ) | 205 | void MainWindow::buildFilename( const QString &name ) |
206 | { | 206 | { |
207 | tempFilename = cbDir; | 207 | tempFilename = cbDir; |
208 | tempFilename.append( name ); | 208 | tempFilename.append( name ); |
209 | tempFilename.append( ".qcb" ); | 209 | tempFilename.append( ".qcb" ); |
210 | } | 210 | } |
211 | 211 | ||
212 | void MainWindow::slotNew() | 212 | void MainWindow::slotNew() |
213 | { | 213 | { |
214 | CBInfo *cb = new CBInfo(); | 214 | CBInfo *cb = new CBInfo(); |
215 | 215 | ||
216 | Checkbook *currcb = new Checkbook( this, cb, &_cfg ); | 216 | Checkbook *currcb = new Checkbook( this, cb, &_cfg ); |
217 | currcb->showMaximized(); | 217 | currcb->showMaximized(); |
218 | if ( currcb->exec() == QDialog::Accepted ) | 218 | if ( currcb->exec() == QDialog::Accepted ) |
219 | { | 219 | { |
220 | // Save new checkbook | 220 | // Save new checkbook |
221 | buildFilename( cb->name() ); | 221 | buildFilename( cb->name() ); |
222 | _cfg.setLastBook( cb->name() ); | 222 | _cfg.setLastBook( cb->name() ); |
223 | cb->setFilename( tempFilename ); | 223 | cb->setFilename( tempFilename ); |
224 | cb->write(); | 224 | cb->write(); |
225 | 225 | ||
226 | // Add to listbox | 226 | // Add to listbox |
227 | checkbooks->inSort( cb ); | 227 | checkbooks->inSort( cb ); |
228 | addCheckbook( cb ); | 228 | addCheckbook( cb ); |
229 | } | 229 | } |
230 | delete currcb; | 230 | delete currcb; |
231 | } | 231 | } |
232 | 232 | ||
233 | // --- slotEdit --------------------------------------------------------------- | 233 | // --- slotEdit --------------------------------------------------------------- |
234 | void MainWindow::slotEdit() | 234 | void MainWindow::slotEdit() |
235 | { | 235 | { |
236 | // get name and open it | 236 | // get name and open it |
237 | QListViewItem *curritem = cbList->currentItem(); | 237 | QListViewItem *curritem = cbList->currentItem(); |
238 | if ( !curritem ) | 238 | if ( !curritem ) |
239 | return; | 239 | return; |
240 | openBook( curritem ); | 240 | openBook( curritem ); |
241 | } | 241 | } |
242 | 242 | ||
243 | 243 | ||
244 | // --- openBook --------------------------------------------------------------- | 244 | // --- openBook --------------------------------------------------------------- |
245 | void MainWindow::openBook(QListViewItem *curritem) | 245 | void MainWindow::openBook(QListViewItem *curritem) |
246 | { | 246 | { |
247 | // find book in List | 247 | // find book in List |
248 | QString currname=curritem->text(posName); | 248 | QString currname=curritem->text(posName); |
249 | CBInfo *cb = checkbooks->first(); | 249 | CBInfo *cb = checkbooks->first(); |
250 | while ( cb ) { | 250 | while ( cb ) { |
251 | if ( cb->name() == currname ) | 251 | if ( cb->name() == currname ) |
252 | break; | 252 | break; |
253 | cb = checkbooks->next(); | 253 | cb = checkbooks->next(); |
254 | } | 254 | } |
255 | if ( !cb ) return; | 255 | if ( !cb ) return; |
256 | 256 | ||
257 | // | 257 | // |
258 | buildFilename( currname ); | 258 | buildFilename( currname ); |
259 | float currbalance = cb->balance(); | 259 | float currbalance = cb->balance(); |
260 | bool currlock = !cb->password().isNull(); | 260 | bool currlock = !cb->password().isNull(); |
261 | 261 | ||
262 | if ( currlock ) | 262 | if ( currlock ) |
263 | { | 263 | { |
264 | Password *pw = new Password( this, tr( "Enter password" ), tr( "Please enter your password:" ) ); | 264 | Password *pw = new Password( this, tr( "Enter password" ), tr( "Please enter your password:" ) ); |
265 | if ( pw->exec() != QDialog::Accepted || pw->password != cb->password() ) | 265 | if ( pw->exec() != QDialog::Accepted || pw->password != cb->password() ) |
266 | { | 266 | { |
267 | delete pw; | 267 | delete pw; |
268 | return; | 268 | return; |
269 | } | 269 | } |
270 | delete pw; | 270 | delete pw; |
271 | } | 271 | } |
272 | 272 | ||
273 | _cfg.setLastBook( currname ); | 273 | _cfg.setLastBook( currname ); |
274 | Checkbook *currcb = new Checkbook( this, cb, &_cfg ); | 274 | Checkbook *currcb = new Checkbook( this, cb, &_cfg ); |
275 | currcb->showMaximized(); | 275 | currcb->showMaximized(); |
276 | if ( currcb->exec() == QDialog::Accepted ) | 276 | if ( currcb->exec() == QDialog::Accepted ) |
277 | { | 277 | { |
278 | QString newname = cb->name(); | 278 | QString newname = cb->name(); |
279 | if ( currname != newname ) | 279 | if ( currname != newname ) |
280 | { | 280 | { |
281 | // Update name if changed | 281 | // Update name if changed |
282 | if( curritem ) { | 282 | if( curritem ) { |
283 | curritem->setText( posName, newname ); | 283 | curritem->setText( posName, newname ); |
284 | cbList->sort(); | 284 | cbList->sort(); |
285 | } | 285 | } |
286 | _cfg.setLastBook( newname ); | 286 | _cfg.setLastBook( newname ); |
287 | 287 | ||
288 | // Remove old file | 288 | // Remove old file |
289 | QFile f( tempFilename ); | 289 | QFile f( tempFilename ); |
290 | if ( f.exists() ) | 290 | if ( f.exists() ) |
291 | f.remove(); | 291 | f.remove(); |
292 | 292 | ||
293 | // Get new filename | 293 | // Get new filename |
294 | buildFilename( newname ); | 294 | buildFilename( newname ); |
295 | cb->setFilename( tempFilename ); | 295 | cb->setFilename( tempFilename ); |
296 | } | 296 | } |
297 | 297 | ||
298 | cb->write(); | 298 | cb->write(); |
299 | 299 | ||
300 | // Update lock if changed | 300 | // Update lock if changed |
301 | if ( _cfg.getShowLocks() && !cb->password().isNull() != currlock ) | 301 | if ( _cfg.getShowLocks() && !cb->password().isNull() != currlock ) |
302 | { | 302 | { |
303 | if ( !cb->password().isNull() ) | 303 | if ( !cb->password().isNull() ) |
304 | curritem->setPixmap( 0, lockIcon ); | 304 | curritem->setPixmap( 0, lockIcon ); |
305 | else | 305 | else |
306 | curritem->setPixmap( 0, nullIcon ); | 306 | curritem->setPixmap( 0, nullIcon ); |
307 | } | 307 | } |
308 | 308 | ||
309 | // Update balance if changed | 309 | // Update balance if changed |
310 | if ( _cfg.getShowBalances() && cb->balance() != currbalance ) | 310 | if ( _cfg.getShowBalances() && cb->balance() != currbalance ) |
311 | { | 311 | { |
312 | QString tempstr; | 312 | QString tempstr; |
313 | tempstr.sprintf( "%s%.2f", _cfg.getCurrencySymbol().latin1(), cb->balance() ); | 313 | tempstr.sprintf( "%s%.2f", _cfg.getCurrencySymbol().latin1(), cb->balance() ); |
314 | curritem->setText( posName + 1, tempstr ); | 314 | curritem->setText( posName + 1, tempstr ); |
315 | } | 315 | } |
316 | 316 | ||
317 | // write config, if needed | 317 | // write config, if needed |
318 | if( _cfg.isDirty() ) { | 318 | if( _cfg.isDirty() ) { |
319 | Config config("checkbook"); | 319 | Config config("checkbook"); |
320 | _cfg.writeConfig( config ); | 320 | _cfg.writeConfig( config ); |
321 | } | 321 | } |
322 | } | 322 | } |
323 | delete currcb; | 323 | delete currcb; |
324 | } | 324 | } |
325 | 325 | ||
326 | // --- slotDelete ------------------------------------------------------------- | 326 | // --- slotDelete ------------------------------------------------------------- |
327 | void MainWindow::slotDelete() | 327 | void MainWindow::slotDelete() |
328 | { | 328 | { |
329 | QString currname = cbList->currentItem()->text( posName ); | 329 | QString currname = cbList->currentItem()->text( posName ); |
330 | 330 | ||
331 | if ( QPEMessageBox::confirmDelete ( this, tr( "Delete checkbook" ), currname ) ) | 331 | if ( QPEMessageBox::confirmDelete ( this, tr( "Delete checkbook" ), currname ) ) |
332 | { | 332 | { |
333 | buildFilename( currname ); | 333 | buildFilename( currname ); |
334 | QFile f( tempFilename ); | 334 | QFile f( tempFilename ); |
335 | if ( f.exists() ) | 335 | if ( f.exists() ) |
336 | { | 336 | { |
337 | f.remove(); | 337 | f.remove(); |
338 | } | 338 | } |
339 | 339 | ||
340 | delete cbList->currentItem(); | 340 | delete cbList->currentItem(); |
341 | } | 341 | } |
342 | } | 342 | } |
343 | 343 | ||
344 | // --- slotConfigure ---------------------------------------------------------- | 344 | // --- slotConfigure ---------------------------------------------------------- |
345 | void MainWindow::slotConfigure() | 345 | void MainWindow::slotConfigure() |
346 | { | 346 | { |
347 | Configuration *cfgdlg = new Configuration( this, _cfg ); | 347 | Configuration *cfgdlg = new Configuration( this, _cfg ); |
348 | cfgdlg->showMaximized(); | 348 | cfgdlg->showMaximized(); |
349 | if ( cfgdlg->exec() == QDialog::Accepted ) | 349 | if ( cfgdlg->exec() == QDialog::Accepted ) |
350 | { | 350 | { |
351 | // read data from config dialog & save it | 351 | // read data from config dialog & save it |
352 | cfgdlg->saveConfig( _cfg ); | 352 | cfgdlg->saveConfig( _cfg ); |
353 | writeConfig(); | 353 | writeConfig(); |
354 | buildList(); | 354 | buildList(); |
355 | } | 355 | } |
356 | delete cfgdlg; | 356 | delete cfgdlg; |
357 | } | 357 | } |
358 | 358 | ||
359 | 359 | ||
360 | // --- writeConfig -------------------------------------------------------------- | 360 | // --- writeConfig -------------------------------------------------------------- |
361 | void MainWindow::writeConfig() | 361 | void MainWindow::writeConfig() |
362 | { | 362 | { |
363 | Config config("checkbook"); | 363 | Config config("checkbook"); |
364 | _cfg.writeConfig( config ); | 364 | _cfg.writeConfig( config ); |
365 | } | 365 | } |