-rw-r--r-- | korganizer/kotodoview.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index a8143a0..a12acd1 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -415,389 +415,391 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : | |||
415 | mItemPopupMenu->insertItem( i18n("New Todo..."), this, | 415 | mItemPopupMenu->insertItem( i18n("New Todo..."), this, |
416 | SLOT (newTodo())); | 416 | SLOT (newTodo())); |
417 | mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this, | 417 | mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this, |
418 | SLOT (newSubTodo())); | 418 | SLOT (newSubTodo())); |
419 | mItemPopupMenu->insertItem(i18n("Unparent Todo"), this, | 419 | mItemPopupMenu->insertItem(i18n("Unparent Todo"), this, |
420 | SLOT (unparentTodo()),0,21); | 420 | SLOT (unparentTodo()),0,21); |
421 | mItemPopupMenu->insertItem(i18n("Reparent Todo"), this, | 421 | mItemPopupMenu->insertItem(i18n("Reparent Todo"), this, |
422 | SLOT (reparentTodo()),0,22); | 422 | SLOT (reparentTodo()),0,22); |
423 | mItemPopupMenu->insertSeparator(); | 423 | mItemPopupMenu->insertSeparator(); |
424 | mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"), | 424 | mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"), |
425 | this, SLOT( purgeCompleted() ) ); | 425 | this, SLOT( purgeCompleted() ) ); |
426 | mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"), | 426 | mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"), |
427 | this, SLOT( toggleCompleted() ),0, 33 ); | 427 | this, SLOT( toggleCompleted() ),0, 33 ); |
428 | mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), | 428 | mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), |
429 | this, SLOT( toggleQuickTodo() ),0, 34 ); | 429 | this, SLOT( toggleQuickTodo() ),0, 34 ); |
430 | 430 | ||
431 | mPopupMenu = new QPopupMenu(this); | 431 | mPopupMenu = new QPopupMenu(this); |
432 | mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, | 432 | mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, |
433 | SLOT (newTodo()),0,1); | 433 | SLOT (newTodo()),0,1); |
434 | mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed"), | 434 | mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed"), |
435 | this, SLOT(purgeCompleted()),0,2); | 435 | this, SLOT(purgeCompleted()),0,2); |
436 | mPopupMenu->insertItem(i18n("Show Completed"), | 436 | mPopupMenu->insertItem(i18n("Show Completed"), |
437 | this, SLOT( toggleCompleted() ),0,3 ); | 437 | this, SLOT( toggleCompleted() ),0,3 ); |
438 | mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), | 438 | mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), |
439 | this, SLOT( toggleQuickTodo() ),0,4 ); | 439 | this, SLOT( toggleQuickTodo() ),0,4 ); |
440 | mDocPrefs = new DocPrefs( name ); | 440 | mDocPrefs = new DocPrefs( name ); |
441 | 441 | ||
442 | mPopupMenu->setCheckable( true ); | 442 | mPopupMenu->setCheckable( true ); |
443 | mItemPopupMenu->setCheckable( true ); | 443 | mItemPopupMenu->setCheckable( true ); |
444 | // Double clicking conflicts with opening/closing the subtree | 444 | // Double clicking conflicts with opening/closing the subtree |
445 | connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ), | 445 | connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ), |
446 | SLOT( editItem( QListViewItem *) ) ); | 446 | SLOT( editItem( QListViewItem *) ) ); |
447 | /* | 447 | /* |
448 | connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, | 448 | connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, |
449 | const QPoint &,int ) ), | 449 | const QPoint &,int ) ), |
450 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); | 450 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); |
451 | */ | 451 | */ |
452 | connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *, | 452 | connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *, |
453 | const QPoint &,int ) ), | 453 | const QPoint &,int ) ), |
454 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); | 454 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); |
455 | connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), | 455 | connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), |
456 | SLOT( itemClicked( QListViewItem * ) ) ); | 456 | SLOT( itemClicked( QListViewItem * ) ) ); |
457 | connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), | 457 | connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), |
458 | SLOT( itemDoubleClicked( QListViewItem * ) ) ); | 458 | SLOT( itemDoubleClicked( QListViewItem * ) ) ); |
459 | connect( mTodoListView, SIGNAL( todoDropped( Todo * ) ), | 459 | connect( mTodoListView, SIGNAL( todoDropped( Todo * ) ), |
460 | SLOT( updateView() ) ); | 460 | SLOT( updateView() ) ); |
461 | connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), | 461 | connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), |
462 | SLOT( itemStateChanged( QListViewItem * ) ) ); | 462 | SLOT( itemStateChanged( QListViewItem * ) ) ); |
463 | connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), | 463 | connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), |
464 | SLOT( itemStateChanged( QListViewItem * ) ) ); | 464 | SLOT( itemStateChanged( QListViewItem * ) ) ); |
465 | 465 | ||
466 | #if 0 | 466 | #if 0 |
467 | connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), | 467 | connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), |
468 | SLOT(selectionChanged(QListViewItem *))); | 468 | SLOT(selectionChanged(QListViewItem *))); |
469 | connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), | 469 | connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), |
470 | SLOT(selectionChanged(QListViewItem *))); | 470 | SLOT(selectionChanged(QListViewItem *))); |
471 | connect(mTodoListView,SIGNAL(pressed(QListViewItem *)), | 471 | connect(mTodoListView,SIGNAL(pressed(QListViewItem *)), |
472 | SLOT(selectionChanged(QListViewItem *))); | 472 | SLOT(selectionChanged(QListViewItem *))); |
473 | #endif | 473 | #endif |
474 | connect( mTodoListView, SIGNAL(selectionChanged() ), | 474 | connect( mTodoListView, SIGNAL(selectionChanged() ), |
475 | SLOT( processSelectionChange() ) ); | 475 | SLOT( processSelectionChange() ) ); |
476 | connect( mQuickAdd, SIGNAL( returnPressed () ), | 476 | connect( mQuickAdd, SIGNAL( returnPressed () ), |
477 | SLOT( addQuickTodo() ) ); | 477 | SLOT( addQuickTodo() ) ); |
478 | // if ( QApplication::desktop()->width() < 480 ) { | 478 | // if ( QApplication::desktop()->width() < 480 ) { |
479 | // setNarrow(); | 479 | // setNarrow(); |
480 | // mTodoListView->setColumnWidth( 0, 100 ); | 480 | // mTodoListView->setColumnWidth( 0, 100 ); |
481 | 481 | ||
482 | // } | 482 | // } |
483 | 483 | ||
484 | } | 484 | } |
485 | 485 | ||
486 | KOTodoView::~KOTodoView() | 486 | KOTodoView::~KOTodoView() |
487 | { | 487 | { |
488 | delete mDocPrefs; | 488 | delete mDocPrefs; |
489 | } | 489 | } |
490 | 490 | ||
491 | void KOTodoView::jumpToDate () | 491 | void KOTodoView::jumpToDate () |
492 | { | 492 | { |
493 | // if (mActiveItem) { | 493 | // if (mActiveItem) { |
494 | // mActiveItem->todo()); | 494 | // mActiveItem->todo()); |
495 | // if ( mActiveItem->todo()->hasDueDate() ) | 495 | // if ( mActiveItem->todo()->hasDueDate() ) |
496 | // emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() ); | 496 | // emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() ); |
497 | } | 497 | } |
498 | 498 | ||
499 | void KOTodoView::setNarrow() | 499 | void KOTodoView::setNarrow() |
500 | { | 500 | { |
501 | //mTodoListView->setColumnWidth( 0, 120 ); | 501 | //mTodoListView->setColumnWidth( 0, 120 ); |
502 | mTodoListView->setColumnWidth( 1, 35 ); | 502 | mTodoListView->setColumnWidth( 1, 35 ); |
503 | mTodoListView->setColumnWidth( 2, 40 ); | 503 | mTodoListView->setColumnWidth( 2, 40 ); |
504 | mTodoListView->setColumnWidth( 3, 80 ); | 504 | mTodoListView->setColumnWidth( 3, 80 ); |
505 | mTodoListView->setColumnWidth( 4, 40 ); | 505 | mTodoListView->setColumnWidth( 4, 40 ); |
506 | mTodoListView->setColumnWidth( 5, 90 ); | 506 | mTodoListView->setColumnWidth( 5, 90 ); |
507 | 507 | ||
508 | } | 508 | } |
509 | void KOTodoView::updateView() | 509 | void KOTodoView::updateView() |
510 | { | 510 | { |
511 | 511 | pendingSubtodo = 0; | |
512 | if ( mBlockUpdate ) { | 512 | if ( mBlockUpdate ) { |
513 | //qDebug("blocked "); | 513 | //qDebug("blocked "); |
514 | return; | 514 | return; |
515 | } | 515 | } |
516 | //qDebug("update "); | 516 | //qDebug("update "); |
517 | // kdDebug() << "KOTodoView::updateView()" << endl; | 517 | // kdDebug() << "KOTodoView::updateView()" << endl; |
518 | QFont fo = KOPrefs::instance()->mTodoViewFont; | 518 | QFont fo = KOPrefs::instance()->mTodoViewFont; |
519 | mTodoListView->clear(); | 519 | mTodoListView->clear(); |
520 | if ( mName == "todolistsmall" ) { | 520 | if ( mName == "todolistsmall" ) { |
521 | if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) { | 521 | if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) { |
522 | int ps = fo.pointSize() -2; | 522 | int ps = fo.pointSize() -2; |
523 | if ( ps > 12 ) | 523 | if ( ps > 12 ) |
524 | ps -= 2; | 524 | ps -= 2; |
525 | fo.setPointSize( ps ); | 525 | fo.setPointSize( ps ); |
526 | } | 526 | } |
527 | } | 527 | } |
528 | 528 | ||
529 | mTodoListView->setFont( fo ); | 529 | mTodoListView->setFont( fo ); |
530 | // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont ); | 530 | // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont ); |
531 | //mTodoListView->header()->setMaximumHeight(fm.height()); | 531 | //mTodoListView->header()->setMaximumHeight(fm.height()); |
532 | QPtrList<Todo> todoList = calendar()->todos(); | 532 | QPtrList<Todo> todoList = calendar()->todos(); |
533 | 533 | ||
534 | /* | 534 | /* |
535 | kdDebug() << "KOTodoView::updateView(): Todo List:" << endl; | 535 | kdDebug() << "KOTodoView::updateView(): Todo List:" << endl; |
536 | Event *t; | 536 | Event *t; |
537 | for(t = todoList.first(); t; t = todoList.next()) { | 537 | for(t = todoList.first(); t; t = todoList.next()) { |
538 | kdDebug() << " " << t->getSummary() << endl; | 538 | kdDebug() << " " << t->getSummary() << endl; |
539 | 539 | ||
540 | if (t->getRelatedTo()) { | 540 | if (t->getRelatedTo()) { |
541 | kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl; | 541 | kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl; |
542 | } | 542 | } |
543 | 543 | ||
544 | QPtrList<Event> l = t->getRelations(); | 544 | QPtrList<Event> l = t->getRelations(); |
545 | Event *c; | 545 | Event *c; |
546 | for(c=l.first();c;c=l.next()) { | 546 | for(c=l.first();c;c=l.next()) { |
547 | kdDebug() << " - relation: " << c->getSummary() << endl; | 547 | kdDebug() << " - relation: " << c->getSummary() << endl; |
548 | } | 548 | } |
549 | } | 549 | } |
550 | */ | 550 | */ |
551 | 551 | ||
552 | // Put for each Event a KOTodoViewItem in the list view. Don't rely on a | 552 | // Put for each Event a KOTodoViewItem in the list view. Don't rely on a |
553 | // specific order of events. That means that we have to generate parent items | 553 | // specific order of events. That means that we have to generate parent items |
554 | // recursively for proper hierarchical display of Todos. | 554 | // recursively for proper hierarchical display of Todos. |
555 | mTodoMap.clear(); | 555 | mTodoMap.clear(); |
556 | Todo *todo; | 556 | Todo *todo; |
557 | todo = todoList.first();// todo; todo = todoList.next()) { | 557 | todo = todoList.first();// todo; todo = todoList.next()) { |
558 | while ( todo ) { | 558 | while ( todo ) { |
559 | bool next = true; | 559 | bool next = true; |
560 | // qDebug("todo %s ", todo->summary().latin1()); | 560 | // qDebug("todo %s ", todo->summary().latin1()); |
561 | Incidence *incidence = todo->relatedTo(); | 561 | Incidence *incidence = todo->relatedTo(); |
562 | while ( incidence ) { | 562 | while ( incidence ) { |
563 | if ( incidence->type() == "Todo") { | 563 | if ( incidence->type() == "Todo") { |
564 | //qDebug("related %s ",incidence->summary().latin1() ); | 564 | //qDebug("related %s ",incidence->summary().latin1() ); |
565 | if ( !(todoList.contains ( ((Todo* )incidence ) ) )) { | 565 | if ( !(todoList.contains ( ((Todo* )incidence ) ) )) { |
566 | //qDebug("related not found "); | 566 | //qDebug("related not found "); |
567 | todoList.remove( ); | 567 | todoList.remove( ); |
568 | todo = todoList.current(); | 568 | todo = todoList.current(); |
569 | next = false; | 569 | next = false; |
570 | incidence = 0; | 570 | incidence = 0; |
571 | 571 | ||
572 | } else { | 572 | } else { |
573 | //qDebug("related found "); | 573 | //qDebug("related found "); |
574 | incidence = incidence->relatedTo(); | 574 | incidence = incidence->relatedTo(); |
575 | } | 575 | } |
576 | } else | 576 | } else |
577 | incidence = 0; | 577 | incidence = 0; |
578 | } | 578 | } |
579 | if ( next ) | 579 | if ( next ) |
580 | todo = todoList.next(); | 580 | todo = todoList.next(); |
581 | } | 581 | } |
582 | // qDebug("again .... "); | 582 | // qDebug("again .... "); |
583 | // for(todo = todoList.first(); todo; todo = todoList.next()) { | 583 | // for(todo = todoList.first(); todo; todo = todoList.next()) { |
584 | 584 | ||
585 | // qDebug("yytodo %s ", todo->summary().latin1()); | 585 | // qDebug("yytodo %s ", todo->summary().latin1()); |
586 | // } | 586 | // } |
587 | //qDebug("for "); | 587 | //qDebug("for "); |
588 | for(todo = todoList.first(); todo; todo = todoList.next()) { | 588 | for(todo = todoList.first(); todo; todo = todoList.next()) { |
589 | if (!mTodoMap.contains(todo) && ( KOPrefs::instance()->mShowCompletedTodo || !todo->isCompleted() ) ) | 589 | if (!mTodoMap.contains(todo) && ( KOPrefs::instance()->mShowCompletedTodo || !todo->isCompleted() ) ) |
590 | { | 590 | { |
591 | insertTodoItem(todo); | 591 | insertTodoItem(todo); |
592 | } | 592 | } |
593 | } | 593 | } |
594 | //qDebug("for end "); | 594 | //qDebug("for end "); |
595 | // Restore opened/closed state | 595 | // Restore opened/closed state |
596 | mTodoListView->blockSignals( true ); | 596 | mTodoListView->blockSignals( true ); |
597 | if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() ); | 597 | if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() ); |
598 | mTodoListView->blockSignals( false ); | 598 | mTodoListView->blockSignals( false ); |
599 | mTodoListView->setFocus(); | 599 | mTodoListView->setFocus(); |
600 | processSelectionChange(); | 600 | processSelectionChange(); |
601 | } | 601 | } |
602 | 602 | ||
603 | void KOTodoView::restoreItemState( QListViewItem *item ) | 603 | void KOTodoView::restoreItemState( QListViewItem *item ) |
604 | { | 604 | { |
605 | pendingSubtodo = 0; | ||
605 | while( item ) { | 606 | while( item ) { |
606 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; | 607 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; |
607 | todoItem->setOpen( mDocPrefs->readBoolEntry( todoItem->todo()->uid() ) ); | 608 | todoItem->setOpen( mDocPrefs->readBoolEntry( todoItem->todo()->uid() ) ); |
608 | if( item->childCount() > 0 ) restoreItemState( item->firstChild() ); | 609 | if( item->childCount() > 0 ) restoreItemState( item->firstChild() ); |
609 | item = item->nextSibling(); | 610 | item = item->nextSibling(); |
610 | } | 611 | } |
611 | } | 612 | } |
612 | 613 | ||
613 | 614 | ||
614 | QMap<Todo *,KOTodoViewItem *>::ConstIterator | 615 | QMap<Todo *,KOTodoViewItem *>::ConstIterator |
615 | KOTodoView::insertTodoItem(Todo *todo) | 616 | KOTodoView::insertTodoItem(Todo *todo) |
616 | { | 617 | { |
617 | // kdDebug() << "KOTodoView::insertTodoItem(): " << todo->getSummary() << endl; | 618 | // kdDebug() << "KOTodoView::insertTodoItem(): " << todo->getSummary() << endl; |
618 | // TODO: Check, if dynmaic cast is necessary | 619 | // TODO: Check, if dynmaic cast is necessary |
619 | 620 | ||
620 | 621 | pendingSubtodo = 0; | |
621 | Incidence *incidence = todo->relatedTo(); | 622 | Incidence *incidence = todo->relatedTo(); |
622 | if (incidence && incidence->type() == "Todo") { | 623 | if (incidence && incidence->type() == "Todo") { |
623 | Todo *relatedTodo = static_cast<Todo *>(incidence); | 624 | Todo *relatedTodo = static_cast<Todo *>(incidence); |
624 | 625 | ||
625 | // kdDebug() << " has Related" << endl; | 626 | // kdDebug() << " has Related" << endl; |
626 | QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; | 627 | QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; |
627 | itemIterator = mTodoMap.find(relatedTodo); | 628 | itemIterator = mTodoMap.find(relatedTodo); |
628 | if (itemIterator == mTodoMap.end()) { | 629 | if (itemIterator == mTodoMap.end()) { |
629 | // kdDebug() << " related not yet in list" << endl; | 630 | // kdDebug() << " related not yet in list" << endl; |
630 | itemIterator = insertTodoItem (relatedTodo); | 631 | itemIterator = insertTodoItem (relatedTodo); |
631 | } | 632 | } |
632 | // isn't this pretty stupid? We give one Todo to the KOTodoViewItem | 633 | // isn't this pretty stupid? We give one Todo to the KOTodoViewItem |
633 | // and one into the map. Sure finding is more easy but why? -zecke | 634 | // and one into the map. Sure finding is more easy but why? -zecke |
634 | KOTodoViewItem *todoItem = new KOTodoViewItem(*itemIterator,todo,this); | 635 | KOTodoViewItem *todoItem = new KOTodoViewItem(*itemIterator,todo,this); |
635 | return mTodoMap.insert(todo,todoItem); | 636 | return mTodoMap.insert(todo,todoItem); |
636 | } else { | 637 | } else { |
637 | // kdDebug() << " no Related" << endl; | 638 | // kdDebug() << " no Related" << endl; |
638 | // see above -zecke | 639 | // see above -zecke |
639 | KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); | 640 | KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); |
640 | return mTodoMap.insert(todo,todoItem); | 641 | return mTodoMap.insert(todo,todoItem); |
641 | } | 642 | } |
642 | } | 643 | } |
643 | 644 | ||
644 | 645 | ||
645 | void KOTodoView::updateConfig() | 646 | void KOTodoView::updateConfig() |
646 | { | 647 | { |
647 | updateView(); | 648 | updateView(); |
648 | mTodoListView->repaintContents(); | 649 | mTodoListView->repaintContents(); |
649 | } | 650 | } |
650 | 651 | ||
651 | QPtrList<Incidence> KOTodoView::selectedIncidences() | 652 | QPtrList<Incidence> KOTodoView::selectedIncidences() |
652 | { | 653 | { |
653 | QPtrList<Incidence> selected; | 654 | QPtrList<Incidence> selected; |
654 | 655 | ||
655 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); | 656 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); |
656 | // if (!item) item = mActiveItem; | 657 | // if (!item) item = mActiveItem; |
657 | if (item) selected.append(item->todo()); | 658 | if (item) selected.append(item->todo()); |
658 | 659 | ||
659 | return selected; | 660 | return selected; |
660 | } | 661 | } |
661 | 662 | ||
662 | QPtrList<Todo> KOTodoView::selectedTodos() | 663 | QPtrList<Todo> KOTodoView::selectedTodos() |
663 | { | 664 | { |
664 | QPtrList<Todo> selected; | 665 | QPtrList<Todo> selected; |
665 | 666 | ||
666 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); | 667 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); |
667 | // if (!item) item = mActiveItem; | 668 | // if (!item) item = mActiveItem; |
668 | if (item) selected.append(item->todo()); | 669 | if (item) selected.append(item->todo()); |
669 | 670 | ||
670 | return selected; | 671 | return selected; |
671 | } | 672 | } |
672 | 673 | ||
673 | void KOTodoView::changeEventDisplay(Event *, int) | 674 | void KOTodoView::changeEventDisplay(Event *, int) |
674 | { | 675 | { |
675 | updateView(); | 676 | updateView(); |
676 | } | 677 | } |
677 | 678 | ||
678 | void KOTodoView::showDates(const QDate &, const QDate &) | 679 | void KOTodoView::showDates(const QDate &, const QDate &) |
679 | { | 680 | { |
680 | } | 681 | } |
681 | 682 | ||
682 | void KOTodoView::showEvents(QPtrList<Event>) | 683 | void KOTodoView::showEvents(QPtrList<Event>) |
683 | { | 684 | { |
684 | kdDebug() << "KOTodoView::selectEvents(): not yet implemented" << endl; | 685 | kdDebug() << "KOTodoView::selectEvents(): not yet implemented" << endl; |
685 | } | 686 | } |
686 | 687 | ||
687 | void KOTodoView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 688 | void KOTodoView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
688 | const QDate &td) | 689 | const QDate &td) |
689 | { | 690 | { |
690 | #ifndef KORG_NOPRINTER | 691 | #ifndef KORG_NOPRINTER |
691 | calPrinter->preview(CalPrinter::Todolist, fd, td); | 692 | calPrinter->preview(CalPrinter::Todolist, fd, td); |
692 | #endif | 693 | #endif |
693 | } | 694 | } |
694 | 695 | ||
695 | void KOTodoView::editItem(QListViewItem *item ) | 696 | void KOTodoView::editItem(QListViewItem *item ) |
696 | { | 697 | { |
697 | // qDebug("editItem(QListViewItem *item ) "); | 698 | // qDebug("editItem(QListViewItem *item ) "); |
698 | emit editTodoSignal(((KOTodoViewItem *)item)->todo()); | 699 | emit editTodoSignal(((KOTodoViewItem *)item)->todo()); |
699 | } | 700 | } |
700 | 701 | ||
701 | void KOTodoView::showItem(QListViewItem *item,const QPoint &,int) | 702 | void KOTodoView::showItem(QListViewItem *item,const QPoint &,int) |
702 | { | 703 | { |
703 | emit showTodoSignal(((KOTodoViewItem *)item)->todo()); | 704 | emit showTodoSignal(((KOTodoViewItem *)item)->todo()); |
704 | } | 705 | } |
705 | 706 | ||
706 | void KOTodoView::popupMenu(QListViewItem *item,const QPoint &,int column) | 707 | void KOTodoView::popupMenu(QListViewItem *item,const QPoint &,int column) |
707 | { | 708 | { |
709 | pendingSubtodo = 0; | ||
708 | mActiveItem = (KOTodoViewItem *)item; | 710 | mActiveItem = (KOTodoViewItem *)item; |
709 | if (item) { | 711 | if (item) { |
710 | switch (column){ | 712 | switch (column){ |
711 | case 1: | 713 | case 1: |
712 | mPriorityPopupMenu->popup(QCursor::pos ()); break; | 714 | mPriorityPopupMenu->popup(QCursor::pos ()); break; |
713 | case 2: | 715 | case 2: |
714 | mPercentageCompletedPopupMenu->popup(QCursor::pos ()); break; | 716 | mPercentageCompletedPopupMenu->popup(QCursor::pos ()); break; |
715 | case 3: | 717 | case 3: |
716 | moveTodo(); | 718 | moveTodo(); |
717 | break; | 719 | break; |
718 | case 6: | 720 | case 6: |
719 | getCategoryPopupMenu((KOTodoViewItem *)item)->popup(QCursor::pos ()); break; | 721 | getCategoryPopupMenu((KOTodoViewItem *)item)->popup(QCursor::pos ()); break; |
720 | default: | 722 | default: |
721 | mItemPopupMenu->popup(QCursor::pos()); | 723 | mItemPopupMenu->popup(QCursor::pos()); |
722 | } | 724 | } |
723 | } else mPopupMenu->popup(QCursor::pos()); | 725 | } else mPopupMenu->popup(QCursor::pos()); |
724 | } | 726 | } |
725 | void KOTodoView::newTodo() | 727 | void KOTodoView::newTodo() |
726 | { | 728 | { |
727 | emit newTodoSignal(); | 729 | emit newTodoSignal(); |
728 | } | 730 | } |
729 | 731 | ||
730 | void KOTodoView::newSubTodo() | 732 | void KOTodoView::newSubTodo() |
731 | { | 733 | { |
732 | if (mActiveItem) { | 734 | if (mActiveItem) { |
733 | emit newSubTodoSignal(mActiveItem->todo()); | 735 | emit newSubTodoSignal(mActiveItem->todo()); |
734 | } | 736 | } |
735 | } | 737 | } |
736 | void KOTodoView::unparentTodo() | 738 | void KOTodoView::unparentTodo() |
737 | { | 739 | { |
738 | if (mActiveItem) { | 740 | if (mActiveItem) { |
739 | emit unparentTodoSignal(mActiveItem->todo()); | 741 | emit unparentTodoSignal(mActiveItem->todo()); |
740 | } | 742 | } |
741 | } | 743 | } |
742 | 744 | ||
743 | void KOTodoView::reparentTodo() | 745 | void KOTodoView::reparentTodo() |
744 | { | 746 | { |
745 | if (mActiveItem) { | 747 | if (mActiveItem) { |
746 | qDebug("KOTodoView::reparentTodo() "); | 748 | qDebug("KOTodoView::reparentTodo() "); |
747 | topLevelWidget()->setCaption(i18n("Click on new parent item")); | 749 | topLevelWidget()->setCaption(i18n("Click on new parent item")); |
748 | pendingSubtodo = mActiveItem; | 750 | pendingSubtodo = mActiveItem; |
749 | } | 751 | } |
750 | } | 752 | } |
751 | void KOTodoView::editTodo() | 753 | void KOTodoView::editTodo() |
752 | { | 754 | { |
753 | if (mActiveItem) { | 755 | if (mActiveItem) { |
754 | emit editTodoSignal(mActiveItem->todo()); | 756 | emit editTodoSignal(mActiveItem->todo()); |
755 | } | 757 | } |
756 | } | 758 | } |
757 | void KOTodoView::cloneTodo() | 759 | void KOTodoView::cloneTodo() |
758 | { | 760 | { |
759 | if (mActiveItem) { | 761 | if (mActiveItem) { |
760 | emit cloneTodoSignal((Incidence*)mActiveItem->todo()); | 762 | emit cloneTodoSignal((Incidence*)mActiveItem->todo()); |
761 | } | 763 | } |
762 | } | 764 | } |
763 | void KOTodoView::cancelTodo() | 765 | void KOTodoView::cancelTodo() |
764 | { | 766 | { |
765 | if (mActiveItem) { | 767 | if (mActiveItem) { |
766 | emit cancelTodoSignal((Incidence*)mActiveItem->todo()); | 768 | emit cancelTodoSignal((Incidence*)mActiveItem->todo()); |
767 | } | 769 | } |
768 | } | 770 | } |
769 | void KOTodoView::moveTodo() | 771 | void KOTodoView::moveTodo() |
770 | { | 772 | { |
771 | if (mActiveItem) { | 773 | if (mActiveItem) { |
772 | emit moveTodoSignal((Incidence*)mActiveItem->todo()); | 774 | emit moveTodoSignal((Incidence*)mActiveItem->todo()); |
773 | } | 775 | } |
774 | } | 776 | } |
775 | void KOTodoView::beamTodo() | 777 | void KOTodoView::beamTodo() |
776 | { | 778 | { |
777 | if (mActiveItem) { | 779 | if (mActiveItem) { |
778 | emit beamTodoSignal((Incidence*)mActiveItem->todo()); | 780 | emit beamTodoSignal((Incidence*)mActiveItem->todo()); |
779 | } | 781 | } |
780 | } | 782 | } |
781 | 783 | ||
782 | 784 | ||
783 | void KOTodoView::showTodo() | 785 | void KOTodoView::showTodo() |
784 | { | 786 | { |
785 | if (mActiveItem) { | 787 | if (mActiveItem) { |
786 | emit showTodoSignal(mActiveItem->todo()); | 788 | emit showTodoSignal(mActiveItem->todo()); |
787 | } | 789 | } |
788 | } | 790 | } |
789 | 791 | ||
790 | void KOTodoView::deleteTodo() | 792 | void KOTodoView::deleteTodo() |
791 | { | 793 | { |
792 | if (mActiveItem) { | 794 | if (mActiveItem) { |
793 | if (mActiveItem->childCount()) { | 795 | if (mActiveItem->childCount()) { |
794 | KMessageBox::sorry(this,i18n("Cannot delete To-Do which has children."), | 796 | KMessageBox::sorry(this,i18n("Cannot delete To-Do which has children."), |
795 | i18n("Delete To-Do")); | 797 | i18n("Delete To-Do")); |
796 | } else { | 798 | } else { |
797 | emit deleteTodoSignal(mActiveItem->todo()); | 799 | emit deleteTodoSignal(mActiveItem->todo()); |
798 | } | 800 | } |
799 | } | 801 | } |
800 | } | 802 | } |
801 | 803 | ||
802 | void KOTodoView::setNewPriority(int index) | 804 | void KOTodoView::setNewPriority(int index) |
803 | { | 805 | { |