author | leseb <leseb> | 2002-07-10 17:49:35 (UTC) |
---|---|---|
committer | leseb <leseb> | 2002-07-10 17:49:35 (UTC) |
commit | 729309f7875915b2617f99228b0a71464ecfe699 (patch) (unidiff) | |
tree | 2d2f6e62674bac1807488a3a1684712bc848a101 | |
parent | 6456ddb2be2a874e858ee25d8463e446b7af58d5 (diff) | |
download | opie-729309f7875915b2617f99228b0a71464ecfe699.zip opie-729309f7875915b2617f99228b0a71464ecfe699.tar.gz opie-729309f7875915b2617f99228b0a71464ecfe699.tar.bz2 |
Fix "delete all" message box
-rw-r--r-- | core/pim/todo/mainwindow.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp index 27e76d9..974951e 100644 --- a/core/pim/todo/mainwindow.cpp +++ b/core/pim/todo/mainwindow.cpp | |||
@@ -259,193 +259,193 @@ TodoWindow::TodoWindow( QWidget *parent, const char *name, WFlags f ) : | |||
259 | table->setPaintingEnabled( TRUE ); | 259 | table->setPaintingEnabled( TRUE ); |
260 | table->viewport()->setUpdatesEnabled( TRUE ); | 260 | table->viewport()->setUpdatesEnabled( TRUE ); |
261 | 261 | ||
262 | // Initialize the table | 262 | // Initialize the table |
263 | table->updateVisible(); | 263 | table->updateVisible(); |
264 | 264 | ||
265 | connect( completedAction, SIGNAL( toggled(bool) ), this, SLOT( showCompleted(bool) ) ); | 265 | connect( completedAction, SIGNAL( toggled(bool) ), this, SLOT( showCompleted(bool) ) ); |
266 | connect( showdeadlineAction, SIGNAL( toggled(bool) ), this, SLOT( showDeadline(bool) ) ); | 266 | connect( showdeadlineAction, SIGNAL( toggled(bool) ), this, SLOT( showDeadline(bool) ) ); |
267 | connect( catMenu, SIGNAL(activated(int)), this, SLOT(setCategory(int)) ); | 267 | connect( catMenu, SIGNAL(activated(int)), this, SLOT(setCategory(int)) ); |
268 | connect( table, SIGNAL( currentChanged( int, int ) ), | 268 | connect( table, SIGNAL( currentChanged( int, int ) ), |
269 | this, SLOT( currentEntryChanged( int, int ) ) ); | 269 | this, SLOT( currentEntryChanged( int, int ) ) ); |
270 | 270 | ||
271 | connect( table, SIGNAL(showDetails(const ToDoEvent &) ), | 271 | connect( table, SIGNAL(showDetails(const ToDoEvent &) ), |
272 | this, SLOT(slotShowDetails(const ToDoEvent & ) ) ); | 272 | this, SLOT(slotShowDetails(const ToDoEvent & ) ) ); |
273 | // qDebug("done: t=%d", t.elapsed() ); | 273 | // qDebug("done: t=%d", t.elapsed() ); |
274 | } | 274 | } |
275 | 275 | ||
276 | void TodoWindow::slotNew() | 276 | void TodoWindow::slotNew() |
277 | { | 277 | { |
278 | if(syncing) { | 278 | if(syncing) { |
279 | QMessageBox::warning(this, tr("Todo"), | 279 | QMessageBox::warning(this, tr("Todo"), |
280 | tr("Can not edit data, currently syncing")); | 280 | tr("Can not edit data, currently syncing")); |
281 | return; | 281 | return; |
282 | } | 282 | } |
283 | 283 | ||
284 | int id; | 284 | int id; |
285 | id = -1; | 285 | id = -1; |
286 | QArray<int> ids; | 286 | QArray<int> ids; |
287 | ids = table->currentEntry().categories(); | 287 | ids = table->currentEntry().categories(); |
288 | if ( ids.count() ) | 288 | if ( ids.count() ) |
289 | id = ids[0]; | 289 | id = ids[0]; |
290 | NewTaskDialog e( id, this, 0, TRUE ); | 290 | NewTaskDialog e( id, this, 0, TRUE ); |
291 | 291 | ||
292 | ToDoEvent todo; | 292 | ToDoEvent todo; |
293 | 293 | ||
294 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) | 294 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) |
295 | e.showMaximized(); | 295 | e.showMaximized(); |
296 | #endif | 296 | #endif |
297 | int ret = e.exec(); | 297 | int ret = e.exec(); |
298 | // qWarning("finished" ); | 298 | // qWarning("finished" ); |
299 | if ( ret == QDialog::Accepted ) { | 299 | if ( ret == QDialog::Accepted ) { |
300 | table->setPaintingEnabled( false ); | 300 | table->setPaintingEnabled( false ); |
301 | todo = e.todoEntry(); | 301 | todo = e.todoEntry(); |
302 | //todo.assignUid(); | 302 | //todo.assignUid(); |
303 | table->addEntry( todo ); | 303 | table->addEntry( todo ); |
304 | table->setPaintingEnabled( true ); | 304 | table->setPaintingEnabled( true ); |
305 | findAction->setEnabled( TRUE ); | 305 | findAction->setEnabled( TRUE ); |
306 | } | 306 | } |
307 | // I'm afraid we must call this every time now, otherwise | 307 | // I'm afraid we must call this every time now, otherwise |
308 | // spend expensive time comparing all these strings... | 308 | // spend expensive time comparing all these strings... |
309 | populateCategories(); | 309 | populateCategories(); |
310 | mStack->raiseWidget(1 ); | 310 | mStack->raiseWidget(1 ); |
311 | } | 311 | } |
312 | 312 | ||
313 | TodoWindow::~TodoWindow() | 313 | TodoWindow::~TodoWindow() |
314 | { | 314 | { |
315 | } | 315 | } |
316 | 316 | ||
317 | void TodoWindow::slotDelete() | 317 | void TodoWindow::slotDelete() |
318 | { | 318 | { |
319 | if(syncing) { | 319 | if(syncing) { |
320 | QMessageBox::warning(this, tr("Todo"), | 320 | QMessageBox::warning(this, tr("Todo"), |
321 | tr("Can not edit data, currently syncing")); | 321 | tr("Can not edit data, currently syncing")); |
322 | return; | 322 | return; |
323 | } | 323 | } |
324 | 324 | ||
325 | if ( table->currentRow() == -1 ) | 325 | if ( table->currentRow() == -1 ) |
326 | return; | 326 | return; |
327 | 327 | ||
328 | QString strName = table->text( table->currentRow(), 2 ).left( 30 ); | 328 | QString strName = table->text( table->currentRow(), 2 ).left( 30 ); |
329 | 329 | ||
330 | if ( !QPEMessageBox::confirmDelete( this, tr( "Todo" ), strName ) ) | 330 | if ( !QPEMessageBox::confirmDelete( this, tr( "Todo" ), strName ) ) |
331 | return; | 331 | return; |
332 | 332 | ||
333 | 333 | ||
334 | 334 | ||
335 | table->setPaintingEnabled( false ); | 335 | table->setPaintingEnabled( false ); |
336 | table->removeCurrentEntry(); | 336 | table->removeCurrentEntry(); |
337 | table->setPaintingEnabled( true ); | 337 | table->setPaintingEnabled( true ); |
338 | 338 | ||
339 | if ( table->numRows() == 0 ) { | 339 | if ( table->numRows() == 0 ) { |
340 | currentEntryChanged( -1, 0 ); | 340 | currentEntryChanged( -1, 0 ); |
341 | findAction->setEnabled( FALSE ); | 341 | findAction->setEnabled( FALSE ); |
342 | } | 342 | } |
343 | mStack->raiseWidget(1); | 343 | mStack->raiseWidget(1); |
344 | } | 344 | } |
345 | void TodoWindow::slotDeleteAll() | 345 | void TodoWindow::slotDeleteAll() |
346 | { | 346 | { |
347 | if(syncing) { | 347 | if(syncing) { |
348 | QMessageBox::warning(this, tr("Todo"), | 348 | QMessageBox::warning(this, tr("Todo"), |
349 | tr("Can not edit data, currently syncing")); | 349 | tr("Can not edit data, currently syncing")); |
350 | return; | 350 | return; |
351 | } | 351 | } |
352 | 352 | ||
353 | //QString strName = table->text( table->currentRow(), 2 ).left( 30 ); | 353 | //QString strName = table->text( table->currentRow(), 2 ).left( 30 ); |
354 | 354 | ||
355 | if ( !QPEMessageBox::confirmDelete( this, tr( "Todo" ), tr("Delete all tasks?") ) ) | 355 | if ( !QPEMessageBox::confirmDelete( this, tr( "Todo" ), tr("all tasks") ) ) |
356 | return; | 356 | return; |
357 | 357 | ||
358 | 358 | ||
359 | 359 | ||
360 | table->setPaintingEnabled( false ); | 360 | table->setPaintingEnabled( false ); |
361 | table->removeAllEntries(); | 361 | table->removeAllEntries(); |
362 | table->setPaintingEnabled( true ); | 362 | table->setPaintingEnabled( true ); |
363 | 363 | ||
364 | if ( table->numRows() == 0 ) { | 364 | if ( table->numRows() == 0 ) { |
365 | currentEntryChanged( -1, 0 ); | 365 | currentEntryChanged( -1, 0 ); |
366 | findAction->setEnabled( FALSE ); | 366 | findAction->setEnabled( FALSE ); |
367 | } | 367 | } |
368 | mStack->raiseWidget(1 ); | 368 | mStack->raiseWidget(1 ); |
369 | } | 369 | } |
370 | 370 | ||
371 | void TodoWindow::slotEdit() | 371 | void TodoWindow::slotEdit() |
372 | { | 372 | { |
373 | if(syncing) { | 373 | if(syncing) { |
374 | QMessageBox::warning(this, tr("Todo"), | 374 | QMessageBox::warning(this, tr("Todo"), |
375 | tr("Can not edit data, currently syncing")); | 375 | tr("Can not edit data, currently syncing")); |
376 | return; | 376 | return; |
377 | } | 377 | } |
378 | 378 | ||
379 | ToDoEvent todo = table->currentEntry(); | 379 | ToDoEvent todo = table->currentEntry(); |
380 | qWarning("slotEdit" ); | 380 | qWarning("slotEdit" ); |
381 | NewTaskDialog e( todo, this, 0, TRUE ); | 381 | NewTaskDialog e( todo, this, 0, TRUE ); |
382 | e.setCaption( tr( "Edit Task" ) ); | 382 | e.setCaption( tr( "Edit Task" ) ); |
383 | 383 | ||
384 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) | 384 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) |
385 | e.showMaximized(); | 385 | e.showMaximized(); |
386 | #endif | 386 | #endif |
387 | int ret = e.exec(); | 387 | int ret = e.exec(); |
388 | 388 | ||
389 | if ( ret == QDialog::Accepted ) { | 389 | if ( ret == QDialog::Accepted ) { |
390 | qWarning("Replacing now" ); | 390 | qWarning("Replacing now" ); |
391 | table->setPaintingEnabled( false ); | 391 | table->setPaintingEnabled( false ); |
392 | todo = e.todoEntry(); | 392 | todo = e.todoEntry(); |
393 | table->replaceCurrentEntry( todo ); | 393 | table->replaceCurrentEntry( todo ); |
394 | table->setPaintingEnabled( true ); | 394 | table->setPaintingEnabled( true ); |
395 | } | 395 | } |
396 | populateCategories(); | 396 | populateCategories(); |
397 | mStack->raiseWidget( 1 ); | 397 | mStack->raiseWidget( 1 ); |
398 | } | 398 | } |
399 | void TodoWindow::slotDuplicate() | 399 | void TodoWindow::slotDuplicate() |
400 | { | 400 | { |
401 | if(syncing) { | 401 | if(syncing) { |
402 | QMessageBox::warning(this, tr("Todo"), | 402 | QMessageBox::warning(this, tr("Todo"), |
403 | tr("Can not edit data, currently syncing")); | 403 | tr("Can not edit data, currently syncing")); |
404 | return; | 404 | return; |
405 | } | 405 | } |
406 | ToDoEvent ev = table->currentEntry(); | 406 | ToDoEvent ev = table->currentEntry(); |
407 | ToDoEvent ev2 = ToDoEvent( ev ); // what about the uid | 407 | ToDoEvent ev2 = ToDoEvent( ev ); // what about the uid |
408 | int uid; | 408 | int uid; |
409 | { // uid | 409 | { // uid |
410 | Qtopia::UidGen *uidgen = new Qtopia::UidGen(); | 410 | Qtopia::UidGen *uidgen = new Qtopia::UidGen(); |
411 | uid = uidgen->generate(); | 411 | uid = uidgen->generate(); |
412 | delete uidgen; | 412 | delete uidgen; |
413 | } | 413 | } |
414 | ev2.setUid( uid ); | 414 | ev2.setUid( uid ); |
415 | table->setPaintingEnabled( false ); | 415 | table->setPaintingEnabled( false ); |
416 | table->addEntry( ev2 ); | 416 | table->addEntry( ev2 ); |
417 | table->setPaintingEnabled( true ); | 417 | table->setPaintingEnabled( true ); |
418 | 418 | ||
419 | mStack->raiseWidget( 1 ); | 419 | mStack->raiseWidget( 1 ); |
420 | } | 420 | } |
421 | void TodoWindow::slotShowPopup( const QPoint &p ) | 421 | void TodoWindow::slotShowPopup( const QPoint &p ) |
422 | { | 422 | { |
423 | contextMenu->popup( p ); | 423 | contextMenu->popup( p ); |
424 | } | 424 | } |
425 | 425 | ||
426 | void TodoWindow::showCompleted( bool s ) | 426 | void TodoWindow::showCompleted( bool s ) |
427 | { | 427 | { |
428 | if ( !table->isUpdatesEnabled() ) | 428 | if ( !table->isUpdatesEnabled() ) |
429 | return; | 429 | return; |
430 | table->setPaintingEnabled( false ); | 430 | table->setPaintingEnabled( false ); |
431 | table->setShowCompleted( s ); | 431 | table->setShowCompleted( s ); |
432 | table->setPaintingEnabled( true ); | 432 | table->setPaintingEnabled( true ); |
433 | mStack->raiseWidget( 1 ); | 433 | mStack->raiseWidget( 1 ); |
434 | } | 434 | } |
435 | 435 | ||
436 | void TodoWindow::currentEntryChanged( int r, int ) | 436 | void TodoWindow::currentEntryChanged( int r, int ) |
437 | { | 437 | { |
438 | if ( r != -1 && table->rowHeight( r ) > 0 ) { | 438 | if ( r != -1 && table->rowHeight( r ) > 0 ) { |
439 | editAction->setEnabled( TRUE ); | 439 | editAction->setEnabled( TRUE ); |
440 | viewAction->setEnabled( TRUE ); | 440 | viewAction->setEnabled( TRUE ); |
441 | deleteAction->setEnabled( TRUE ); | 441 | deleteAction->setEnabled( TRUE ); |
442 | duplicateAction->setEnabled( TRUE ); | 442 | duplicateAction->setEnabled( TRUE ); |
443 | deleteAllAction->setEnabled( TRUE ); | 443 | deleteAllAction->setEnabled( TRUE ); |
444 | } else { | 444 | } else { |
445 | editAction->setEnabled( FALSE ); | 445 | editAction->setEnabled( FALSE ); |
446 | viewAction->setEnabled( FALSE ); | 446 | viewAction->setEnabled( FALSE ); |
447 | deleteAction->setEnabled( FALSE ); | 447 | deleteAction->setEnabled( FALSE ); |
448 | duplicateAction->setEnabled( FALSE ); | 448 | duplicateAction->setEnabled( FALSE ); |
449 | deleteAllAction->setEnabled( FALSE ); | 449 | deleteAllAction->setEnabled( FALSE ); |
450 | } | 450 | } |
451 | } | 451 | } |