summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/todo/mainwindow.cpp2
-rw-r--r--core/pim/todo/todotable.cpp7
2 files changed, 6 insertions, 3 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp
index d3f4cb4..a28fc3e 100644
--- a/core/pim/todo/mainwindow.cpp
+++ b/core/pim/todo/mainwindow.cpp
@@ -403,48 +403,49 @@ void TodoWindow::slotDuplicate()
403 { // uid 403 { // uid
404 Qtopia::UidGen *uidgen = new Qtopia::UidGen(); 404 Qtopia::UidGen *uidgen = new Qtopia::UidGen();
405 uid = uidgen->generate(); 405 uid = uidgen->generate();
406 delete uidgen; 406 delete uidgen;
407 } 407 }
408 ev2.setUid( uid ); 408 ev2.setUid( uid );
409 table->setPaintingEnabled( false ); 409 table->setPaintingEnabled( false );
410 table->addEntry( ev2 ); 410 table->addEntry( ev2 );
411 table->setPaintingEnabled( true ); 411 table->setPaintingEnabled( true );
412 412
413 mStack->raiseWidget( 1 ); 413 mStack->raiseWidget( 1 );
414} 414}
415void TodoWindow::slotShowPopup( const QPoint &p ) 415void TodoWindow::slotShowPopup( const QPoint &p )
416{ 416{
417 contextMenu->popup( p ); 417 contextMenu->popup( p );
418} 418}
419 419
420void TodoWindow::showCompleted( bool s ) 420void TodoWindow::showCompleted( bool s )
421{ 421{
422 if ( !table->isUpdatesEnabled() ) 422 if ( !table->isUpdatesEnabled() )
423 return; 423 return;
424 table->setPaintingEnabled( false ); 424 table->setPaintingEnabled( false );
425 table->setShowCompleted( s ); 425 table->setShowCompleted( s );
426 table->setPaintingEnabled( true ); 426 table->setPaintingEnabled( true );
427 mStack->raiseWidget( 1 );
427} 428}
428 429
429void TodoWindow::currentEntryChanged( int r, int ) 430void TodoWindow::currentEntryChanged( int r, int )
430{ 431{
431 if ( r != -1 && table->rowHeight( r ) > 0 ) { 432 if ( r != -1 && table->rowHeight( r ) > 0 ) {
432 editAction->setEnabled( TRUE ); 433 editAction->setEnabled( TRUE );
433 deleteAction->setEnabled( TRUE ); 434 deleteAction->setEnabled( TRUE );
434 duplicateAction->setEnabled( TRUE ); 435 duplicateAction->setEnabled( TRUE );
435 deleteAllAction->setEnabled( TRUE ); 436 deleteAllAction->setEnabled( TRUE );
436 } else { 437 } else {
437 editAction->setEnabled( FALSE ); 438 editAction->setEnabled( FALSE );
438 deleteAction->setEnabled( FALSE ); 439 deleteAction->setEnabled( FALSE );
439 duplicateAction->setEnabled( FALSE ); 440 duplicateAction->setEnabled( FALSE );
440 deleteAllAction->setEnabled( FALSE ); 441 deleteAllAction->setEnabled( FALSE );
441 } 442 }
442} 443}
443 444
444void TodoWindow::setCategory( int c ) 445void TodoWindow::setCategory( int c )
445{ 446{
446 if ( c <= 0 ) return; 447 if ( c <= 0 ) return;
447 if ( !table->isUpdatesEnabled() ) 448 if ( !table->isUpdatesEnabled() )
448 return; 449 return;
449 table->setPaintingEnabled( false ); 450 table->setPaintingEnabled( false );
450 for ( unsigned int i = 1; i < catMenu->count(); i++ ) 451 for ( unsigned int i = 1; i < catMenu->count(); i++ )
@@ -524,48 +525,49 @@ void TodoWindow::closeEvent( QCloseEvent *e )
524 config.setGroup( "View" ); 525 config.setGroup( "View" );
525 config.writeEntry( "ShowComplete", table->showCompleted() ); 526 config.writeEntry( "ShowComplete", table->showCompleted() );
526 config.writeEntry( "Category", table->showCategory() ); 527 config.writeEntry( "Category", table->showCategory() );
527 /* added 20.01.2k2 by se */ 528 /* added 20.01.2k2 by se */
528 config.writeEntry( "ShowDeadLine", table->showDeadline()); 529 config.writeEntry( "ShowDeadLine", table->showDeadline());
529 } else { 530 } else {
530 if ( QMessageBox::critical( this, tr("Out of space"), 531 if ( QMessageBox::critical( this, tr("Out of space"),
531 tr("Todo was unable\n" 532 tr("Todo was unable\n"
532 "to save your changes.\n" 533 "to save your changes.\n"
533 "Free up some space\n" 534 "Free up some space\n"
534 "and try again.\n" 535 "and try again.\n"
535 "\nQuit Anyway?"), 536 "\nQuit Anyway?"),
536 QMessageBox::Yes|QMessageBox::Escape, 537 QMessageBox::Yes|QMessageBox::Escape,
537 QMessageBox::No|QMessageBox::Default) 538 QMessageBox::No|QMessageBox::Default)
538 != QMessageBox::No ) 539 != QMessageBox::No )
539 e->accept(); 540 e->accept();
540 else 541 else
541 e->ignore(); 542 e->ignore();
542 } 543 }
543} 544}
544 545
545void TodoWindow::slotFind() 546void TodoWindow::slotFind()
546{ 547{
547 // put everything back to view all for searching... 548 // put everything back to view all for searching...
549 mStack->raiseWidget( 1 );
548 if ( !catMenu->isItemChecked( 0 ) ) 550 if ( !catMenu->isItemChecked( 0 ) )
549 setCategory( 0 ); 551 setCategory( 0 );
550 552
551 FindDialog dlg( "Todo List", this ); 553 FindDialog dlg( "Todo List", this );
552 QObject::connect( &dlg, 554 QObject::connect( &dlg,
553 SIGNAL(signalFindClicked(const QString &, 555 SIGNAL(signalFindClicked(const QString &,
554 bool, bool, int)), 556 bool, bool, int)),
555 table, 557 table,
556 SLOT(slotDoFind(const QString&, bool, bool, int)) ); 558 SLOT(slotDoFind(const QString&, bool, bool, int)) );
557 QObject::connect( table, SIGNAL(signalNotFound()), &dlg, 559 QObject::connect( table, SIGNAL(signalNotFound()), &dlg,
558 SLOT(slotNotFound()) ); 560 SLOT(slotNotFound()) );
559 QObject::connect( table, SIGNAL(signalWrapAround()), &dlg, 561 QObject::connect( table, SIGNAL(signalWrapAround()), &dlg,
560 SLOT(slotWrapAround()) ); 562 SLOT(slotWrapAround()) );
561 dlg.exec(); 563 dlg.exec();
562 if ( table->numSelections() ) 564 if ( table->numSelections() )
563 table->clearSelection(); 565 table->clearSelection();
564 table->clearFindRow(); 566 table->clearFindRow();
565} 567}
566 568
567 569
568void TodoWindow::setDocument( const QString &filename ) 570void TodoWindow::setDocument( const QString &filename )
569{ 571{
570 if ( filename.find(".vcs") != int(filename.length()) - 4 ) return; 572 if ( filename.find(".vcs") != int(filename.length()) - 4 ) return;
571 573
diff --git a/core/pim/todo/todotable.cpp b/core/pim/todo/todotable.cpp
index 753c036..dc60cc4 100644
--- a/core/pim/todo/todotable.cpp
+++ b/core/pim/todo/todotable.cpp
@@ -577,92 +577,93 @@ void TodoTable::updateJournal( const ToDoEvent &todo, journal_action action )
577 if(todo.hasDate() ) { 577 if(todo.hasDate() ) {
578 buf += " DateYear=\""+QString::number( todo.date().year() ) + "\""; 578 buf += " DateYear=\""+QString::number( todo.date().year() ) + "\"";
579 buf += " DateMonth=\"" + QString::number( todo.date().month() ) + "\""; 579 buf += " DateMonth=\"" + QString::number( todo.date().month() ) + "\"";
580 buf += " DateDay=\"" + QString::number( todo.date().day() ) + "\""; 580 buf += " DateDay=\"" + QString::number( todo.date().day() ) + "\"";
581 } 581 }
582 buf += "/>\n"; 582 buf += "/>\n";
583 str = buf.utf8(); 583 str = buf.utf8();
584 f.writeBlock( str.data(), str.length() ); 584 f.writeBlock( str.data(), str.length() );
585 f.close(); 585 f.close();
586} 586}
587 587
588void TodoTable::rowHeightChanged( int row ) 588void TodoTable::rowHeightChanged( int row )
589{ 589{
590 if ( enablePainting ) 590 if ( enablePainting )
591 QTable::rowHeightChanged( row ); 591 QTable::rowHeightChanged( row );
592} 592}
593 593
594void TodoTable::loadFile( const QString &/*we use the standard*/ ) 594void TodoTable::loadFile( const QString &/*we use the standard*/ )
595{ 595{
596 596
597 QList<ToDoEvent> list; 597 QList<ToDoEvent> list;
598 ToDoDB todoDB; 598 ToDoDB todoDB;
599 QValueList<ToDoEvent> vaList = todoDB.rawToDos(); 599 QValueList<ToDoEvent> vaList = todoDB.rawToDos();
600 for(QValueList<ToDoEvent>::ConstIterator it = vaList.begin(); it != vaList.end(); ++it ){ 600 for(QValueList<ToDoEvent>::ConstIterator it = vaList.begin(); it != vaList.end(); ++it ){
601 list.append( new ToDoEvent( (*it) ) ); 601 ToDoEvent *event = new ToDoEvent( (*it) );
602 list.append( event );
602 } 603 }
603 vaList.clear(); 604 vaList.clear();
604 // qDebug("parsing done=%d", t.elapsed() ); 605 // qDebug("parsing done=%d", t.elapsed() );
605 if ( list.count() > 0 ) { 606 if ( list.count() > 0 ) {
606 internalAddEntries( list ); 607 internalAddEntries( list );
607 list.clear(); 608 list.clear();
608 } 609 }
609// qDebug("loading done: t=%d", t.elapsed() ); 610// qDebug("loading done: t=%d", t.elapsed() );
610} 611}
611 612
612void TodoTable::journalFreeReplaceEntry( const ToDoEvent &todo, int row ) 613void TodoTable::journalFreeReplaceEntry( const ToDoEvent &todo, int row )
613{ 614{
614 QString strTodo; 615 QString strTodo;
615 strTodo = todo.description().left(40).simplifyWhiteSpace(); 616 strTodo = todo.description().left(40).simplifyWhiteSpace();
616 if ( row == -1 ) { 617 if ( row == -1 ) {
617 QMapIterator<CheckItem*, ToDoEvent *> it; 618 QMapIterator<CheckItem*, ToDoEvent *> it;
618 for ( it = todoList.begin(); it != todoList.end(); ++it ) { 619 for ( it = todoList.begin(); it != todoList.end(); ++it ) {
619 if ( *(*it) == todo ) { 620 if ( *(*it) == todo ) {
620 row = it.key()->row(); 621 row = it.key()->row();
621 it.key()->setChecked( todo.isCompleted() ); 622 it.key()->setChecked( todo.isCompleted() );
622 static_cast<ComboItem*>(item(row, 1))->setText( QString::number(todo.priority()) ); 623 static_cast<ComboItem*>(item(row, 1))->setText( QString::number(todo.priority()) );
623 item( row, 2 )->setText( strTodo ); 624 item( row, 2 )->setText( strTodo );
624 625
625 if (showDeadl){ 626 if (showDeadl){
626 static_cast<DueTextItem*>(item(row,3))->setToDoEvent(&todo ); 627 static_cast<DueTextItem*>(item(row,3))->setToDoEvent(&todo );
627 } 628 }
628 629
629 *(*it) = todo; 630 *(*it) = todo;
630 } 631 }
631 } 632 }
632 } else { 633 } else {
633 ToDoEvent *t = todoList[static_cast<CheckItem*>(item(row, 0))]; 634 ToDoEvent *t = todoList[static_cast<CheckItem*>(item(row, 0))];
634 todoList.remove( static_cast<CheckItem*>(item(row, 0)) ); 635 todoList.remove( static_cast<CheckItem*>(item(row, 0)) );
635 delete t; 636 delete t;
636 static_cast<CheckItem*>(item(row, 0))->setChecked( todo.isCompleted() ); 637 static_cast<CheckItem*>(item(row, 0))->setChecked( todo.isCompleted() );
637 static_cast<ComboItem*>(item(row, 1))->setText( QString::number(todo.priority()) ); 638 static_cast<ComboItem*>(item(row, 1))->setText( QString::number(todo.priority()) );
638 item( row, 2 )->setText( strTodo ); 639 item( row, 2 )->setText( strTodo );
639 640
640 if (showDeadl){ 641 if (showDeadl){
641 static_cast<DueTextItem*>(item(row,3))->setToDoEvent(&todo ); 642 static_cast<DueTextItem*>(item(row,3))->setToDoEvent(&todo );
642 } 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) );
645 } 646 }
646} 647}
647 648
648void TodoTable::journalFreeRemoveEntry( int row ) 649void TodoTable::journalFreeRemoveEntry( int row )
649{ 650{
650 CheckItem *chk; 651 CheckItem *chk;
651 chk = static_cast<CheckItem*>(item(row, 0 )); 652 chk = static_cast<CheckItem*>(item(row, 0 ));
652 if ( !chk ) 653 if ( !chk )
653 return; 654 return;
654 todoList.remove( chk ); 655 todoList.remove( chk );
655 656
656 realignTable( row ); 657 realignTable( row );
657} 658}
658 659
659void TodoTable::keyPressEvent( QKeyEvent *e ) 660void TodoTable::keyPressEvent( QKeyEvent *e )
660{ 661{
661 if ( e->key() == Key_Space || e->key() == Key_Return ) { 662 if ( e->key() == Key_Space || e->key() == Key_Return ) {
662 switch ( currentColumn() ) { 663 switch ( currentColumn() ) {
663 case 0: { 664 case 0: {
664 CheckItem *i = static_cast<CheckItem*>(item(currentRow(), 665 CheckItem *i = static_cast<CheckItem*>(item(currentRow(),
665 currentColumn())); 666 currentColumn()));
666 if ( i ) 667 if ( i )
667 i->toggle(); 668 i->toggle();
668 break; 669 break;