summaryrefslogtreecommitdiffabout
path: root/korganizer/kotodoview.cpp
Unidiff
Diffstat (limited to 'korganizer/kotodoview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kotodoview.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 2b01c23..e008625 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -457,193 +457,193 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
457 mItemPopupMenu->insertItem(i18n("Reparent Todo"), this, 457 mItemPopupMenu->insertItem(i18n("Reparent Todo"), this,
458 SLOT (reparentTodo()),0,22); 458 SLOT (reparentTodo()),0,22);
459 mItemPopupMenu->insertSeparator(); 459 mItemPopupMenu->insertSeparator();
460#if 0 460#if 0
461 mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"), 461 mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"),
462 this, SLOT( purgeCompleted() ) ); 462 this, SLOT( purgeCompleted() ) );
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
551KOTodoView::~KOTodoView() 551KOTodoView::~KOTodoView()
552{ 552{
553 delete mKOTodoViewWhatsThis; 553 // delete mKOTodoViewWhatsThis;
554 delete mDocPrefs; 554 delete mDocPrefs;
555} 555}
556QString KOTodoView::getWhatsThisText(QPoint p) 556QString KOTodoView::getWhatsThisText(QPoint p)
557{ 557{
558 KOTodoViewItem* item = ( KOTodoViewItem* ) mTodoListView->itemAt( p ); 558 KOTodoViewItem* item = ( KOTodoViewItem* ) mTodoListView->itemAt( p );
559 if ( item ) 559 if ( item )
560 return KIncidenceFormatter::instance()->getFormattedText( item->todo(), 560 return KIncidenceFormatter::instance()->getFormattedText( item->todo(),
561 KOPrefs::instance()->mWTshowDetails, 561 KOPrefs::instance()->mWTshowDetails,
562 KOPrefs::instance()->mWTshowCreated, 562 KOPrefs::instance()->mWTshowCreated,
563 KOPrefs::instance()->mWTshowChanged); 563 KOPrefs::instance()->mWTshowChanged);
564 return i18n("That is the todo view" ); 564 return i18n("That is the todo view" );
565 565
566} 566}
567 567
568void KOTodoView::jumpToDate () 568void KOTodoView::jumpToDate ()
569{ 569{
570 // if (mActiveItem) { 570 // if (mActiveItem) {
571// mActiveItem->todo()); 571// mActiveItem->todo());
572// if ( mActiveItem->todo()->hasDueDate() ) 572// if ( mActiveItem->todo()->hasDueDate() )
573// emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() ); 573// emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() );
574} 574}
575void KOTodoView::paintNeeded() 575void KOTodoView::paintNeeded()
576{ 576{
577 if ( mPendingUpdateBeforeRepaint ) { 577 if ( mPendingUpdateBeforeRepaint ) {
578 updateView(); 578 updateView();
579 mPendingUpdateBeforeRepaint = false; 579 mPendingUpdateBeforeRepaint = false;
580 } 580 }
581} 581}
582void KOTodoView::paintEvent(QPaintEvent * pevent) 582void KOTodoView::paintEvent(QPaintEvent * pevent)
583{ 583{
584 if ( mPendingUpdateBeforeRepaint ) { 584 if ( mPendingUpdateBeforeRepaint ) {
585 updateView(); 585 updateView();
586 mPendingUpdateBeforeRepaint = false; 586 mPendingUpdateBeforeRepaint = false;
587 } 587 }
588 KOrg::BaseView::paintEvent( pevent); 588 KOrg::BaseView::paintEvent( pevent);
589} 589}
590 590
591void KOTodoView::updateView() 591void KOTodoView::updateView()
592{ 592{
593 pendingSubtodo = 0; 593 pendingSubtodo = 0;
594 if ( mBlockUpdate ) { 594 if ( mBlockUpdate ) {
595 return; 595 return;
596 } 596 }
597 if ( !isVisible() ) { 597 if ( !isVisible() ) {
598 mPendingUpdateBeforeRepaint = true; 598 mPendingUpdateBeforeRepaint = true;
599 return; 599 return;
600 } 600 }
601 //qDebug("KOTodoView::updateView() %x", this); 601 //qDebug("KOTodoView::updateView() %x", this);
602 if ( isFlatDisplay ) { 602 if ( isFlatDisplay ) {
603 displayAllFlat(); 603 displayAllFlat();
604 return; 604 return;
605 } 605 }
606 //qDebug("update "); 606 //qDebug("update ");
607// kdDebug() << "KOTodoView::updateView()" << endl; 607// kdDebug() << "KOTodoView::updateView()" << endl;
608 QFont fo = KOPrefs::instance()->mTodoViewFont; 608 QFont fo = KOPrefs::instance()->mTodoViewFont;
609 Incidence* oldInc = 0; 609 Incidence* oldInc = 0;
610 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); 610 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem();
611 if (mActiveItem) 611 if (mActiveItem)
612 oldInc = mActiveItem->todo(); 612 oldInc = mActiveItem->todo();
613 613
614 mTodoListView->clear(); 614 mTodoListView->clear();
615 if ( mName == "todolistsmall" ) { 615 if ( mName == "todolistsmall" ) {
616 if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) { 616 if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) {
617 int ps = fo.pointSize() -2; 617 int ps = fo.pointSize() -2;
618 if ( ps > 12 ) 618 if ( ps > 12 )
619 ps -= 2; 619 ps -= 2;
620 fo.setPointSize( ps ); 620 fo.setPointSize( ps );
621 } 621 }
622 } 622 }
623 623
624 mTodoListView->setFont( fo ); 624 mTodoListView->setFont( fo );
625 // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont ); 625 // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont );
626 //mTodoListView->header()->setMaximumHeight(fm.height()); 626 //mTodoListView->header()->setMaximumHeight(fm.height());
627 QPtrList<Todo> todoList = calendar()->todos(); 627 QPtrList<Todo> todoList = calendar()->todos();
628 628
629/* 629/*
630 kdDebug() << "KOTodoView::updateView(): Todo List:" << endl; 630 kdDebug() << "KOTodoView::updateView(): Todo List:" << endl;
631 Event *t; 631 Event *t;
632 for(t = todoList.first(); t; t = todoList.next()) { 632 for(t = todoList.first(); t; t = todoList.next()) {
633 kdDebug() << " " << t->getSummary() << endl; 633 kdDebug() << " " << t->getSummary() << endl;
634 634
635 if (t->getRelatedTo()) { 635 if (t->getRelatedTo()) {
636 kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl; 636 kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl;
637 } 637 }
638 638
639 QPtrList<Event> l = t->getRelations(); 639 QPtrList<Event> l = t->getRelations();
640 Event *c; 640 Event *c;
641 for(c=l.first();c;c=l.next()) { 641 for(c=l.first();c;c=l.next()) {
642 kdDebug() << " - relation: " << c->getSummary() << endl; 642 kdDebug() << " - relation: " << c->getSummary() << endl;
643 } 643 }
644 } 644 }
645*/ 645*/
646 646
647 // Put for each Event a KOTodoViewItem in the list view. Don't rely on a 647 // Put for each Event a KOTodoViewItem in the list view. Don't rely on a
648 // specific order of events. That means that we have to generate parent items 648 // specific order of events. That means that we have to generate parent items
649 // recursively for proper hierarchical display of Todos. 649 // recursively for proper hierarchical display of Todos.