-rw-r--r-- | korganizer/kotodoview.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 3011458..3483e95 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -463,193 +463,196 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : | |||
463 | mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"), | 463 | mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"), |
464 | this, SLOT( toggleCompleted() ),0, 33 ); | 464 | this, SLOT( toggleCompleted() ),0, 33 ); |
465 | mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), | 465 | mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), |
466 | this, SLOT( toggleQuickTodo() ),0, 34 ); | 466 | this, SLOT( toggleQuickTodo() ),0, 34 ); |
467 | mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), | 467 | mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), |
468 | this, SLOT( toggleRunning() ),0, 35 ); | 468 | this, SLOT( toggleRunning() ),0, 35 ); |
469 | 469 | ||
470 | #endif | 470 | #endif |
471 | mPopupMenu = new QPopupMenu(this); | 471 | mPopupMenu = new QPopupMenu(this); |
472 | mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, | 472 | mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, |
473 | SLOT (newTodo()),0,1); | 473 | SLOT (newTodo()),0,1); |
474 | mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed"), | 474 | mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed"), |
475 | this, SLOT(purgeCompleted()),0,2); | 475 | this, SLOT(purgeCompleted()),0,2); |
476 | mPopupMenu->insertItem(i18n("Show Completed"), | 476 | mPopupMenu->insertItem(i18n("Show Completed"), |
477 | this, SLOT( toggleCompleted() ),0,3 ); | 477 | this, SLOT( toggleCompleted() ),0,3 ); |
478 | mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), | 478 | mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), |
479 | this, SLOT( toggleQuickTodo() ),0,4 ); | 479 | this, SLOT( toggleQuickTodo() ),0,4 ); |
480 | mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), | 480 | mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), |
481 | this, SLOT( toggleRunning() ),0,5 ); | 481 | this, SLOT( toggleRunning() ),0,5 ); |
482 | mPopupMenu->insertItem(i18n(" set all open","Display all opened"), | 482 | mPopupMenu->insertItem(i18n(" set all open","Display all opened"), |
483 | this, SLOT( setAllOpen() ),0,6 ); | 483 | this, SLOT( setAllOpen() ),0,6 ); |
484 | mPopupMenu->insertItem(i18n(" set all close","Display all closed"), | 484 | mPopupMenu->insertItem(i18n(" set all close","Display all closed"), |
485 | this, SLOT( setAllClose() ),0,7 ); | 485 | this, SLOT( setAllClose() ),0,7 ); |
486 | mPopupMenu->insertItem(i18n(" set all flat","Display all flat"), | 486 | mPopupMenu->insertItem(i18n(" set all flat","Display all flat"), |
487 | this, SLOT( setAllFlat() ),0,8 ); | 487 | this, SLOT( setAllFlat() ),0,8 ); |
488 | mDocPrefs = new DocPrefs( name ); | 488 | mDocPrefs = new DocPrefs( name ); |
489 | 489 | ||
490 | mItemPopupMenu->insertItem(i18n("Todo View"),mPopupMenu ); | 490 | mItemPopupMenu->insertItem(i18n("Todo View"),mPopupMenu ); |
491 | mPopupMenu->setCheckable( true ); | 491 | mPopupMenu->setCheckable( true ); |
492 | mItemPopupMenu->setCheckable( true ); | 492 | mItemPopupMenu->setCheckable( true ); |
493 | 493 | ||
494 | 494 | ||
495 | mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); | 495 | mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); |
496 | mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); | 496 | mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); |
497 | 497 | ||
498 | mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); | 498 | mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); |
499 | mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); | 499 | mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); |
500 | 500 | ||
501 | mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); | 501 | mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); |
502 | mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); | 502 | mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); |
503 | 503 | ||
504 | 504 | ||
505 | // Double clicking conflicts with opening/closing the subtree | 505 | // Double clicking conflicts with opening/closing the subtree |
506 | connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ), | 506 | connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ), |
507 | SLOT( editItem( QListViewItem *) ) ); | 507 | SLOT( editItem( QListViewItem *) ) ); |
508 | /* | 508 | /* |
509 | connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, | 509 | connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, |
510 | const QPoint &,int ) ), | 510 | const QPoint &,int ) ), |
511 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); | 511 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); |
512 | */ | 512 | */ |
513 | connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *, | 513 | connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *, |
514 | const QPoint &,int ) ), | 514 | const QPoint &,int ) ), |
515 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); | 515 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); |
516 | connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), | 516 | connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), |
517 | SLOT( itemClicked( QListViewItem * ) ) ); | 517 | SLOT( itemClicked( QListViewItem * ) ) ); |
518 | connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), | 518 | connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), |
519 | SLOT( itemDoubleClicked( QListViewItem * ) ) ); | 519 | SLOT( itemDoubleClicked( QListViewItem * ) ) ); |
520 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), | 520 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), |
521 | SLOT( updateView() ) ); | 521 | SLOT( updateView() ) ); |
522 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), | 522 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), |
523 | SLOT( todoModified(Todo *, int) ) ); | 523 | SLOT( todoModified(Todo *, int) ) ); |
524 | connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), | 524 | connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), |
525 | SLOT( itemStateChanged( QListViewItem * ) ) ); | 525 | SLOT( itemStateChanged( QListViewItem * ) ) ); |
526 | connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), | 526 | connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), |
527 | SLOT( itemStateChanged( QListViewItem * ) ) ); | 527 | SLOT( itemStateChanged( QListViewItem * ) ) ); |
528 | connect( mTodoListView, SIGNAL( paintNeeded() ), | 528 | connect( mTodoListView, SIGNAL( paintNeeded() ), |
529 | SLOT( paintNeeded()) ); | 529 | SLOT( paintNeeded()) ); |
530 | 530 | ||
531 | #if 0 | 531 | #if 0 |
532 | connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), | 532 | connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), |
533 | SLOT(selectionChanged(QListViewItem *))); | 533 | SLOT(selectionChanged(QListViewItem *))); |
534 | connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), | 534 | connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), |
535 | SLOT(selectionChanged(QListViewItem *))); | 535 | SLOT(selectionChanged(QListViewItem *))); |
536 | connect(mTodoListView,SIGNAL(pressed(QListViewItem *)), | 536 | connect(mTodoListView,SIGNAL(pressed(QListViewItem *)), |
537 | SLOT(selectionChanged(QListViewItem *))); | 537 | SLOT(selectionChanged(QListViewItem *))); |
538 | #endif | 538 | #endif |
539 | 539 | ||
540 | connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) )); | 540 | connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) )); |
541 | connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) )); | 541 | connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) )); |
542 | connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) )); | 542 | connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) )); |
543 | 543 | ||
544 | connect( mTodoListView, SIGNAL(selectionChanged() ), | 544 | connect( mTodoListView, SIGNAL(selectionChanged() ), |
545 | SLOT( processSelectionChange() ) ); | 545 | SLOT( processSelectionChange() ) ); |
546 | connect( mQuickAdd, SIGNAL( returnPressed () ), | 546 | connect( mQuickAdd, SIGNAL( returnPressed () ), |
547 | SLOT( addQuickTodo() ) ); | 547 | SLOT( addQuickTodo() ) ); |
548 | 548 | ||
549 | } | 549 | } |
550 | 550 | ||
551 | KOTodoView::~KOTodoView() | 551 | KOTodoView::~KOTodoView() |
552 | { | 552 | { |
553 | delete mDocPrefs; | 553 | delete mDocPrefs; |
554 | } | 554 | } |
555 | QString KOTodoView::getWhatsThisText(QPoint p) | 555 | QString KOTodoView::getWhatsThisText(QPoint p) |
556 | { | 556 | { |
557 | KOTodoViewItem* item = ( KOTodoViewItem* ) mTodoListView->itemAt( p ); | 557 | KOTodoViewItem* item = ( KOTodoViewItem* ) mTodoListView->itemAt( p ); |
558 | if ( item ) | 558 | if ( item ) |
559 | return KIncidenceFormatter::instance()->getFormattedText( item->todo() ); | 559 | return KIncidenceFormatter::instance()->getFormattedText( item->todo(), |
560 | KOPrefs::instance()->mWTshowDetails, | ||
561 | KOPrefs::instance()->mWTshowCreated, | ||
562 | KOPrefs::instance()->mWTshowChanged); | ||
560 | return i18n("That is the todo view" ); | 563 | return i18n("That is the todo view" ); |
561 | 564 | ||
562 | } | 565 | } |
563 | 566 | ||
564 | void KOTodoView::jumpToDate () | 567 | void KOTodoView::jumpToDate () |
565 | { | 568 | { |
566 | // if (mActiveItem) { | 569 | // if (mActiveItem) { |
567 | // mActiveItem->todo()); | 570 | // mActiveItem->todo()); |
568 | // if ( mActiveItem->todo()->hasDueDate() ) | 571 | // if ( mActiveItem->todo()->hasDueDate() ) |
569 | // emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() ); | 572 | // emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() ); |
570 | } | 573 | } |
571 | void KOTodoView::paintNeeded() | 574 | void KOTodoView::paintNeeded() |
572 | { | 575 | { |
573 | if ( mPendingUpdateBeforeRepaint ) { | 576 | if ( mPendingUpdateBeforeRepaint ) { |
574 | updateView(); | 577 | updateView(); |
575 | mPendingUpdateBeforeRepaint = false; | 578 | mPendingUpdateBeforeRepaint = false; |
576 | } | 579 | } |
577 | } | 580 | } |
578 | void KOTodoView::paintEvent(QPaintEvent * pevent) | 581 | void KOTodoView::paintEvent(QPaintEvent * pevent) |
579 | { | 582 | { |
580 | if ( mPendingUpdateBeforeRepaint ) { | 583 | if ( mPendingUpdateBeforeRepaint ) { |
581 | updateView(); | 584 | updateView(); |
582 | mPendingUpdateBeforeRepaint = false; | 585 | mPendingUpdateBeforeRepaint = false; |
583 | } | 586 | } |
584 | KOrg::BaseView::paintEvent( pevent); | 587 | KOrg::BaseView::paintEvent( pevent); |
585 | } | 588 | } |
586 | 589 | ||
587 | void KOTodoView::updateView() | 590 | void KOTodoView::updateView() |
588 | { | 591 | { |
589 | pendingSubtodo = 0; | 592 | pendingSubtodo = 0; |
590 | if ( mBlockUpdate ) { | 593 | if ( mBlockUpdate ) { |
591 | return; | 594 | return; |
592 | } | 595 | } |
593 | if ( !isVisible() ) { | 596 | if ( !isVisible() ) { |
594 | mPendingUpdateBeforeRepaint = true; | 597 | mPendingUpdateBeforeRepaint = true; |
595 | return; | 598 | return; |
596 | } | 599 | } |
597 | //qDebug("KOTodoView::updateView() %x", this); | 600 | //qDebug("KOTodoView::updateView() %x", this); |
598 | if ( isFlatDisplay ) { | 601 | if ( isFlatDisplay ) { |
599 | displayAllFlat(); | 602 | displayAllFlat(); |
600 | return; | 603 | return; |
601 | } | 604 | } |
602 | //qDebug("update "); | 605 | //qDebug("update "); |
603 | // kdDebug() << "KOTodoView::updateView()" << endl; | 606 | // kdDebug() << "KOTodoView::updateView()" << endl; |
604 | QFont fo = KOPrefs::instance()->mTodoViewFont; | 607 | QFont fo = KOPrefs::instance()->mTodoViewFont; |
605 | mTodoListView->clear(); | 608 | mTodoListView->clear(); |
606 | if ( mName == "todolistsmall" ) { | 609 | if ( mName == "todolistsmall" ) { |
607 | if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) { | 610 | if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) { |
608 | int ps = fo.pointSize() -2; | 611 | int ps = fo.pointSize() -2; |
609 | if ( ps > 12 ) | 612 | if ( ps > 12 ) |
610 | ps -= 2; | 613 | ps -= 2; |
611 | fo.setPointSize( ps ); | 614 | fo.setPointSize( ps ); |
612 | } | 615 | } |
613 | } | 616 | } |
614 | 617 | ||
615 | mTodoListView->setFont( fo ); | 618 | mTodoListView->setFont( fo ); |
616 | // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont ); | 619 | // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont ); |
617 | //mTodoListView->header()->setMaximumHeight(fm.height()); | 620 | //mTodoListView->header()->setMaximumHeight(fm.height()); |
618 | QPtrList<Todo> todoList = calendar()->todos(); | 621 | QPtrList<Todo> todoList = calendar()->todos(); |
619 | 622 | ||
620 | /* | 623 | /* |
621 | kdDebug() << "KOTodoView::updateView(): Todo List:" << endl; | 624 | kdDebug() << "KOTodoView::updateView(): Todo List:" << endl; |
622 | Event *t; | 625 | Event *t; |
623 | for(t = todoList.first(); t; t = todoList.next()) { | 626 | for(t = todoList.first(); t; t = todoList.next()) { |
624 | kdDebug() << " " << t->getSummary() << endl; | 627 | kdDebug() << " " << t->getSummary() << endl; |
625 | 628 | ||
626 | if (t->getRelatedTo()) { | 629 | if (t->getRelatedTo()) { |
627 | kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl; | 630 | kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl; |
628 | } | 631 | } |
629 | 632 | ||
630 | QPtrList<Event> l = t->getRelations(); | 633 | QPtrList<Event> l = t->getRelations(); |
631 | Event *c; | 634 | Event *c; |
632 | for(c=l.first();c;c=l.next()) { | 635 | for(c=l.first();c;c=l.next()) { |
633 | kdDebug() << " - relation: " << c->getSummary() << endl; | 636 | kdDebug() << " - relation: " << c->getSummary() << endl; |
634 | } | 637 | } |
635 | } | 638 | } |
636 | */ | 639 | */ |
637 | 640 | ||
638 | // Put for each Event a KOTodoViewItem in the list view. Don't rely on a | 641 | // Put for each Event a KOTodoViewItem in the list view. Don't rely on a |
639 | // specific order of events. That means that we have to generate parent items | 642 | // specific order of events. That means that we have to generate parent items |
640 | // recursively for proper hierarchical display of Todos. | 643 | // recursively for proper hierarchical display of Todos. |
641 | mTodoMap.clear(); | 644 | mTodoMap.clear(); |
642 | Todo *todo; | 645 | Todo *todo; |
643 | todo = todoList.first();// todo; todo = todoList.next()) { | 646 | todo = todoList.first();// todo; todo = todoList.next()) { |
644 | while ( todo ) { | 647 | while ( todo ) { |
645 | bool next = true; | 648 | bool next = true; |
646 | // qDebug("todo %s ", todo->summary().latin1()); | 649 | // qDebug("todo %s ", todo->summary().latin1()); |
647 | Incidence *incidence = todo->relatedTo(); | 650 | Incidence *incidence = todo->relatedTo(); |
648 | while ( incidence ) { | 651 | while ( incidence ) { |
649 | if ( incidence->type() == "Todo") { | 652 | if ( incidence->type() == "Todo") { |
650 | //qDebug("related %s ",incidence->summary().latin1() ); | 653 | //qDebug("related %s ",incidence->summary().latin1() ); |
651 | if ( !(todoList.contains ( ((Todo* )incidence ) ) )) { | 654 | if ( !(todoList.contains ( ((Todo* )incidence ) ) )) { |
652 | //qDebug("related not found "); | 655 | //qDebug("related not found "); |
653 | todoList.remove( ); | 656 | todoList.remove( ); |
654 | todo = todoList.current(); | 657 | todo = todoList.current(); |
655 | next = false; | 658 | next = false; |