summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/todo/mainwindow.cpp3
-rw-r--r--core/pim/todo/todotable.cpp3
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
@@ -327,106 +327,107 @@ void TodoWindow::slotDelete()
327 327
328 328
329 329
330 table->setPaintingEnabled( false ); 330 table->setPaintingEnabled( false );
331 table->removeCurrentEntry(); 331 table->removeCurrentEntry();
332 table->setPaintingEnabled( true ); 332 table->setPaintingEnabled( true );
333 333
334 if ( table->numRows() == 0 ) { 334 if ( table->numRows() == 0 ) {
335 currentEntryChanged( -1, 0 ); 335 currentEntryChanged( -1, 0 );
336 findAction->setEnabled( FALSE ); 336 findAction->setEnabled( FALSE );
337 } 337 }
338 mStack->raiseWidget(1); 338 mStack->raiseWidget(1);
339} 339}
340void TodoWindow::slotDeleteAll() 340void TodoWindow::slotDeleteAll()
341{ 341{
342 if(syncing) { 342 if(syncing) {
343 QMessageBox::warning(this, tr("Todo"), 343 QMessageBox::warning(this, tr("Todo"),
344 tr("Can not edit data, currently syncing")); 344 tr("Can not edit data, currently syncing"));
345 return; 345 return;
346 } 346 }
347 347
348 //QString strName = table->text( table->currentRow(), 2 ).left( 30 ); 348 //QString strName = table->text( table->currentRow(), 2 ).left( 30 );
349 349
350 if ( !QPEMessageBox::confirmDelete( this, tr( "Todo" ), tr("Delete all tasks?") ) ) 350 if ( !QPEMessageBox::confirmDelete( this, tr( "Todo" ), tr("Delete all tasks?") ) )
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
366void TodoWindow::slotEdit() 366void 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}
393void TodoWindow::slotDuplicate() 394void 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 );
409 table->setPaintingEnabled( false ); 410 table->setPaintingEnabled( false );
410 table->addEntry( ev2 ); 411 table->addEntry( ev2 );
411 table->setPaintingEnabled( true ); 412 table->setPaintingEnabled( true );
412 413
413 mStack->raiseWidget( 1 ); 414 mStack->raiseWidget( 1 );
414} 415}
415void TodoWindow::slotShowPopup( const QPoint &p ) 416void TodoWindow::slotShowPopup( const QPoint &p )
416{ 417{
417 contextMenu->popup( p ); 418 contextMenu->popup( p );
418} 419}
419 420
420void TodoWindow::showCompleted( bool s ) 421void TodoWindow::showCompleted( bool s )
421{ 422{
422 if ( !table->isUpdatesEnabled() ) 423 if ( !table->isUpdatesEnabled() )
423 return; 424 return;
424 table->setPaintingEnabled( false ); 425 table->setPaintingEnabled( false );
425 table->setShowCompleted( s ); 426 table->setShowCompleted( s );
426 table->setPaintingEnabled( true ); 427 table->setPaintingEnabled( true );
427 mStack->raiseWidget( 1 ); 428 mStack->raiseWidget( 1 );
428} 429}
429 430
430void TodoWindow::currentEntryChanged( int r, int ) 431void TodoWindow::currentEntryChanged( int r, int )
431{ 432{
432 if ( r != -1 && table->rowHeight( r ) > 0 ) { 433 if ( r != -1 && table->rowHeight( r ) > 0 ) {
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
@@ -596,98 +596,97 @@ void TodoTable::loadFile( const QString &/*we use the standard*/ )
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 ToDoEvent *event = new ToDoEvent( (*it) ); 601 ToDoEvent *event = new ToDoEvent( (*it) );
602 list.append( event ); 602 list.append( event );
603 } 603 }
604 vaList.clear(); 604 vaList.clear();
605 // qDebug("parsing done=%d", t.elapsed() ); 605 // qDebug("parsing done=%d", t.elapsed() );
606 if ( list.count() > 0 ) { 606 if ( list.count() > 0 ) {
607 internalAddEntries( list ); 607 internalAddEntries( list );
608 list.clear(); 608 list.clear();
609 } 609 }
610// qDebug("loading done: t=%d", t.elapsed() ); 610// qDebug("loading done: t=%d", t.elapsed() );
611} 611}
612 612
613void TodoTable::journalFreeReplaceEntry( const ToDoEvent &todo, int row ) 613void TodoTable::journalFreeReplaceEntry( const ToDoEvent &todo, int row )
614{ 614{
615 QString strTodo; 615 QString strTodo;
616 strTodo = todo.description().left(40).simplifyWhiteSpace(); 616 strTodo = todo.description().left(40).simplifyWhiteSpace();
617 if ( row == -1 ) { 617 if ( row == -1 ) {
618 QMapIterator<CheckItem*, ToDoEvent *> it; 618 QMapIterator<CheckItem*, ToDoEvent *> it;
619 for ( it = todoList.begin(); it != todoList.end(); ++it ) { 619 for ( it = todoList.begin(); it != todoList.end(); ++it ) {
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
649void TodoTable::journalFreeRemoveEntry( int row ) 648void 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
660void TodoTable::keyPressEvent( QKeyEvent *e ) 659void 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;
670 } 669 }
671 case 1: 670 case 1:
672 break; 671 break;
673 case 2: 672 case 2:
674 emit signalEdit(); 673 emit signalEdit();
675 default: 674 default:
676 break; 675 break;
677 } 676 }
678 } else { 677 } else {
679 QTable::keyPressEvent( e ); 678 QTable::keyPressEvent( e );
680 } 679 }
681} 680}
682 681
683QStringList TodoTable::categories() 682QStringList TodoTable::categories()
684{ 683{
685 // This is called seldom, so calling a load in here 684 // This is called seldom, so calling a load in here
686 // should be fine. 685 // should be fine.
687 mCat.load( categoryFileName() ); 686 mCat.load( categoryFileName() );
688 QStringList categoryList = mCat.labels( "Todo List" ); 687 QStringList categoryList = mCat.labels( "Todo List" );
689 return categoryList; 688 return categoryList;
690} 689}
691 690
692void TodoTable::slotDoFind( const QString &findString, bool caseSensitive, 691void TodoTable::slotDoFind( const QString &findString, bool caseSensitive,
693 bool backwards, int category ) 692 bool backwards, int category )