author | zecke <zecke> | 2002-04-29 10:17:33 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-04-29 10:17:33 (UTC) |
commit | e4d0908ec054b71a9b97e9c35efbd5a697d0b58d (patch) (unidiff) | |
tree | 1c483d82624c8af936af99399db9c7ea7922c90c | |
parent | 9e2a233287309bdb6bcb228aaf075f8c14a1a687 (diff) | |
download | opie-e4d0908ec054b71a9b97e9c35efbd5a697d0b58d.zip opie-e4d0908ec054b71a9b97e9c35efbd5a697d0b58d.tar.gz opie-e4d0908ec054b71a9b97e9c35efbd5a697d0b58d.tar.bz2 |
Create an Event. And modify it and try to view it
The Event gets "losed" this was reported by Stefan Eilers
Currently I'm searching my brown paper bag but I just wanted to say
I fixed it it was introduced with the change from Task-> ToDoDB
-rw-r--r-- | core/pim/todo/mainwindow.cpp | 3 | ||||
-rw-r--r-- | core/pim/todo/todotable.cpp | 3 |
2 files changed, 3 insertions, 3 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp index a28fc3e..294f37c 100644 --- a/core/pim/todo/mainwindow.cpp +++ b/core/pim/todo/mainwindow.cpp | |||
@@ -351,58 +351,59 @@ void TodoWindow::slotDeleteAll() | |||
351 | return; | 351 | return; |
352 | 352 | ||
353 | 353 | ||
354 | 354 | ||
355 | table->setPaintingEnabled( false ); | 355 | table->setPaintingEnabled( false ); |
356 | table->removeAllEntries(); | 356 | table->removeAllEntries(); |
357 | table->setPaintingEnabled( true ); | 357 | table->setPaintingEnabled( true ); |
358 | 358 | ||
359 | if ( table->numRows() == 0 ) { | 359 | if ( table->numRows() == 0 ) { |
360 | currentEntryChanged( -1, 0 ); | 360 | currentEntryChanged( -1, 0 ); |
361 | findAction->setEnabled( FALSE ); | 361 | findAction->setEnabled( FALSE ); |
362 | } | 362 | } |
363 | mStack->raiseWidget(1 ); | 363 | mStack->raiseWidget(1 ); |
364 | } | 364 | } |
365 | 365 | ||
366 | void TodoWindow::slotEdit() | 366 | void TodoWindow::slotEdit() |
367 | { | 367 | { |
368 | if(syncing) { | 368 | if(syncing) { |
369 | QMessageBox::warning(this, tr("Todo"), | 369 | QMessageBox::warning(this, tr("Todo"), |
370 | tr("Can not edit data, currently syncing")); | 370 | tr("Can not edit data, currently syncing")); |
371 | return; | 371 | return; |
372 | } | 372 | } |
373 | 373 | ||
374 | ToDoEvent todo = table->currentEntry(); | 374 | ToDoEvent todo = table->currentEntry(); |
375 | 375 | qWarning("slotEdit" ); | |
376 | NewTaskDialog e( todo, this, 0, TRUE ); | 376 | NewTaskDialog e( todo, this, 0, TRUE ); |
377 | e.setCaption( tr( "Edit Task" ) ); | 377 | e.setCaption( tr( "Edit Task" ) ); |
378 | 378 | ||
379 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) | 379 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) |
380 | e.showMaximized(); | 380 | e.showMaximized(); |
381 | #endif | 381 | #endif |
382 | int ret = e.exec(); | 382 | int ret = e.exec(); |
383 | 383 | ||
384 | if ( ret == QDialog::Accepted ) { | 384 | if ( ret == QDialog::Accepted ) { |
385 | qWarning("Replacing now" ); | ||
385 | table->setPaintingEnabled( false ); | 386 | table->setPaintingEnabled( false ); |
386 | todo = e.todoEntry(); | 387 | todo = e.todoEntry(); |
387 | table->replaceCurrentEntry( todo ); | 388 | table->replaceCurrentEntry( todo ); |
388 | table->setPaintingEnabled( true ); | 389 | table->setPaintingEnabled( true ); |
389 | } | 390 | } |
390 | populateCategories(); | 391 | populateCategories(); |
391 | mStack->raiseWidget( 1 ); | 392 | mStack->raiseWidget( 1 ); |
392 | } | 393 | } |
393 | void TodoWindow::slotDuplicate() | 394 | void TodoWindow::slotDuplicate() |
394 | { | 395 | { |
395 | if(syncing) { | 396 | if(syncing) { |
396 | QMessageBox::warning(this, tr("Todo"), | 397 | QMessageBox::warning(this, tr("Todo"), |
397 | tr("Can not edit data, currently syncing")); | 398 | tr("Can not edit data, currently syncing")); |
398 | return; | 399 | return; |
399 | } | 400 | } |
400 | ToDoEvent ev = table->currentEntry(); | 401 | ToDoEvent ev = table->currentEntry(); |
401 | ToDoEvent ev2 = ToDoEvent( ev ); // what about the uid | 402 | ToDoEvent ev2 = ToDoEvent( ev ); // what about the uid |
402 | int uid; | 403 | int uid; |
403 | { // uid | 404 | { // uid |
404 | Qtopia::UidGen *uidgen = new Qtopia::UidGen(); | 405 | Qtopia::UidGen *uidgen = new Qtopia::UidGen(); |
405 | uid = uidgen->generate(); | 406 | uid = uidgen->generate(); |
406 | delete uidgen; | 407 | delete uidgen; |
407 | } | 408 | } |
408 | ev2.setUid( uid ); | 409 | ev2.setUid( uid ); |
diff --git a/core/pim/todo/todotable.cpp b/core/pim/todo/todotable.cpp index dc60cc4..208a084 100644 --- a/core/pim/todo/todotable.cpp +++ b/core/pim/todo/todotable.cpp | |||
@@ -620,50 +620,49 @@ void TodoTable::journalFreeReplaceEntry( const ToDoEvent &todo, int row ) | |||
620 | if ( *(*it) == todo ) { | 620 | if ( *(*it) == todo ) { |
621 | row = it.key()->row(); | 621 | row = it.key()->row(); |
622 | it.key()->setChecked( todo.isCompleted() ); | 622 | it.key()->setChecked( todo.isCompleted() ); |
623 | static_cast<ComboItem*>(item(row, 1))->setText( QString::number(todo.priority()) ); | 623 | static_cast<ComboItem*>(item(row, 1))->setText( QString::number(todo.priority()) ); |
624 | item( row, 2 )->setText( strTodo ); | 624 | item( row, 2 )->setText( strTodo ); |
625 | 625 | ||
626 | if (showDeadl){ | 626 | if (showDeadl){ |
627 | static_cast<DueTextItem*>(item(row,3))->setToDoEvent(&todo ); | 627 | static_cast<DueTextItem*>(item(row,3))->setToDoEvent(&todo ); |
628 | } | 628 | } |
629 | 629 | ||
630 | *(*it) = todo; | 630 | *(*it) = todo; |
631 | } | 631 | } |
632 | } | 632 | } |
633 | } else { | 633 | } else { |
634 | ToDoEvent *t = todoList[static_cast<CheckItem*>(item(row, 0))]; | 634 | ToDoEvent *t = todoList[static_cast<CheckItem*>(item(row, 0))]; |
635 | todoList.remove( static_cast<CheckItem*>(item(row, 0)) ); | 635 | todoList.remove( static_cast<CheckItem*>(item(row, 0)) ); |
636 | delete t; | 636 | delete t; |
637 | static_cast<CheckItem*>(item(row, 0))->setChecked( todo.isCompleted() ); | 637 | static_cast<CheckItem*>(item(row, 0))->setChecked( todo.isCompleted() ); |
638 | static_cast<ComboItem*>(item(row, 1))->setText( QString::number(todo.priority()) ); | 638 | static_cast<ComboItem*>(item(row, 1))->setText( QString::number(todo.priority()) ); |
639 | item( row, 2 )->setText( strTodo ); | 639 | item( row, 2 )->setText( strTodo ); |
640 | 640 | ||
641 | if (showDeadl){ | 641 | if (showDeadl){ |
642 | static_cast<DueTextItem*>(item(row,3))->setToDoEvent(&todo ); | 642 | static_cast<DueTextItem*>(item(row,3))->setToDoEvent(&todo ); |
643 | } | 643 | } |
644 | ToDoEvent *ev = new ToDoEvent( todo ); | 644 | todoList.insert( static_cast<CheckItem*>(item(row,0)), new ToDoEvent(todo) ); |
645 | todoList.insert( static_cast<CheckItem*>(item(row,0)), new ToDoEvent(ev) ); | ||
646 | } | 645 | } |
647 | } | 646 | } |
648 | 647 | ||
649 | void TodoTable::journalFreeRemoveEntry( int row ) | 648 | void TodoTable::journalFreeRemoveEntry( int row ) |
650 | { | 649 | { |
651 | CheckItem *chk; | 650 | CheckItem *chk; |
652 | chk = static_cast<CheckItem*>(item(row, 0 )); | 651 | chk = static_cast<CheckItem*>(item(row, 0 )); |
653 | if ( !chk ) | 652 | if ( !chk ) |
654 | return; | 653 | return; |
655 | todoList.remove( chk ); | 654 | todoList.remove( chk ); |
656 | 655 | ||
657 | realignTable( row ); | 656 | realignTable( row ); |
658 | } | 657 | } |
659 | 658 | ||
660 | void TodoTable::keyPressEvent( QKeyEvent *e ) | 659 | void TodoTable::keyPressEvent( QKeyEvent *e ) |
661 | { | 660 | { |
662 | if ( e->key() == Key_Space || e->key() == Key_Return ) { | 661 | if ( e->key() == Key_Space || e->key() == Key_Return ) { |
663 | switch ( currentColumn() ) { | 662 | switch ( currentColumn() ) { |
664 | case 0: { | 663 | case 0: { |
665 | CheckItem *i = static_cast<CheckItem*>(item(currentRow(), | 664 | CheckItem *i = static_cast<CheckItem*>(item(currentRow(), |
666 | currentColumn())); | 665 | currentColumn())); |
667 | if ( i ) | 666 | if ( i ) |
668 | i->toggle(); | 667 | i->toggle(); |
669 | break; | 668 | break; |