-rw-r--r-- | korganizer/kotodoview.cpp | 53 |
1 files changed, 41 insertions, 12 deletions
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index e2966f8..4f42c83 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -474,210 +474,224 @@ void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e) | |||
474 | ///////////////////////////////////////////////////////////////////////////// | 474 | ///////////////////////////////////////////////////////////////////////////// |
475 | 475 | ||
476 | KOQuickTodo::KOQuickTodo(QWidget *parent) : | 476 | KOQuickTodo::KOQuickTodo(QWidget *parent) : |
477 | QLineEdit(parent) | 477 | QLineEdit(parent) |
478 | { | 478 | { |
479 | setText(i18n("Click to add a new Todo")); | 479 | setText(i18n("Click to add a new Todo")); |
480 | } | 480 | } |
481 | 481 | ||
482 | void KOQuickTodo::focusInEvent(QFocusEvent *ev) | 482 | void KOQuickTodo::focusInEvent(QFocusEvent *ev) |
483 | { | 483 | { |
484 | if ( text()==i18n("Click to add a new Todo") ) | 484 | if ( text()==i18n("Click to add a new Todo") ) |
485 | setText(""); | 485 | setText(""); |
486 | QLineEdit::focusInEvent(ev); | 486 | QLineEdit::focusInEvent(ev); |
487 | } | 487 | } |
488 | 488 | ||
489 | void KOQuickTodo::focusOutEvent(QFocusEvent *ev) | 489 | void KOQuickTodo::focusOutEvent(QFocusEvent *ev) |
490 | { | 490 | { |
491 | setText(i18n("Click to add a new Todo")); | 491 | setText(i18n("Click to add a new Todo")); |
492 | QLineEdit::focusOutEvent(ev); | 492 | QLineEdit::focusOutEvent(ev); |
493 | } | 493 | } |
494 | 494 | ||
495 | ///////////////////////////////////////////////////////////////////////////// | 495 | ///////////////////////////////////////////////////////////////////////////// |
496 | 496 | ||
497 | KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : | 497 | KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : |
498 | KOrg::BaseView(calendar,parent,name) | 498 | KOrg::BaseView(calendar,parent,name) |
499 | { | 499 | { |
500 | mCategoryPopupMenu = 0; | 500 | mCategoryPopupMenu = 0; |
501 | mPendingUpdateBeforeRepaint = false; | 501 | mPendingUpdateBeforeRepaint = false; |
502 | isFlatDisplay = false; | 502 | isFlatDisplay = false; |
503 | mNavigator = 0; | 503 | mNavigator = 0; |
504 | QBoxLayout *topLayout = new QVBoxLayout(this); | 504 | QBoxLayout *topLayout = new QVBoxLayout(this); |
505 | mName = QString ( name ); | 505 | mName = QString ( name ); |
506 | mBlockUpdate = false; | 506 | mBlockUpdate = false; |
507 | mQuickAdd = new KOQuickTodo(this); | 507 | mQuickAdd = new KOQuickTodo(this); |
508 | topLayout->addWidget(mQuickAdd); | 508 | topLayout->addWidget(mQuickAdd); |
509 | 509 | ||
510 | if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide(); | 510 | if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide(); |
511 | 511 | ||
512 | mTodoListView = new KOTodoListView(calendar,this, name ); | 512 | mTodoListView = new KOTodoListView(calendar,this, name ); |
513 | topLayout->addWidget(mTodoListView); | 513 | topLayout->addWidget(mTodoListView); |
514 | //mTodoListView->header()->setMaximumHeight(30); | 514 | //mTodoListView->header()->setMaximumHeight(30); |
515 | mTodoListView->setRootIsDecorated(true); | 515 | mTodoListView->setRootIsDecorated(true); |
516 | mTodoListView->setAllColumnsShowFocus(true); | 516 | mTodoListView->setAllColumnsShowFocus(true); |
517 | 517 | ||
518 | mTodoListView->setShowSortIndicator(true); | 518 | mTodoListView->setShowSortIndicator(true); |
519 | 519 | ||
520 | mTodoListView->addColumn(i18n("Todo")); | 520 | mTodoListView->addColumn(i18n("Todo")); |
521 | mTodoListView->addColumn(i18n("Prio")); | 521 | mTodoListView->addColumn(i18n("Prio")); |
522 | mTodoListView->setColumnAlignment(1,AlignHCenter); | 522 | mTodoListView->setColumnAlignment(1,AlignHCenter); |
523 | mTodoListView->addColumn(i18n("Complete")); | 523 | mTodoListView->addColumn(i18n("Complete")); |
524 | mTodoListView->setColumnAlignment(2,AlignCenter); | 524 | mTodoListView->setColumnAlignment(2,AlignCenter); |
525 | 525 | ||
526 | mTodoListView->addColumn(i18n("Due Date")); | 526 | mTodoListView->addColumn(i18n("Due Date")); |
527 | mTodoListView->setColumnAlignment(3,AlignLeft); | 527 | mTodoListView->setColumnAlignment(3,AlignLeft); |
528 | mTodoListView->addColumn(i18n("Due Time")); | 528 | mTodoListView->addColumn(i18n("Due Time")); |
529 | mTodoListView->setColumnAlignment(4,AlignHCenter); | 529 | mTodoListView->setColumnAlignment(4,AlignHCenter); |
530 | 530 | ||
531 | mTodoListView->addColumn(i18n("Start Date")); | 531 | mTodoListView->addColumn(i18n("Start Date")); |
532 | mTodoListView->setColumnAlignment(5,AlignLeft); | 532 | mTodoListView->setColumnAlignment(5,AlignLeft); |
533 | mTodoListView->addColumn(i18n("Start Time")); | 533 | mTodoListView->addColumn(i18n("Start Time")); |
534 | mTodoListView->setColumnAlignment(6,AlignHCenter); | 534 | mTodoListView->setColumnAlignment(6,AlignHCenter); |
535 | 535 | ||
536 | mTodoListView->addColumn(i18n("Cancelled")); | 536 | mTodoListView->addColumn(i18n("Cancelled")); |
537 | mTodoListView->addColumn(i18n("Categories")); | 537 | mTodoListView->addColumn(i18n("Categories")); |
538 | mTodoListView->addColumn(i18n("Calendar")); | 538 | mTodoListView->addColumn(i18n("Calendar")); |
539 | #if 0 | 539 | #if 0 |
540 | mTodoListView->addColumn(i18n("Sort Id")); | 540 | mTodoListView->addColumn(i18n("Sort Id")); |
541 | mTodoListView->setColumnAlignment(4,AlignHCenter); | 541 | mTodoListView->setColumnAlignment(4,AlignHCenter); |
542 | #endif | 542 | #endif |
543 | 543 | ||
544 | mTodoListView->setMinimumHeight( 60 ); | 544 | mTodoListView->setMinimumHeight( 60 ); |
545 | mTodoListView->setItemsRenameable( true ); | 545 | mTodoListView->setItemsRenameable( true ); |
546 | mTodoListView->setRenameable( 0 ); | 546 | mTodoListView->setRenameable( 0 ); |
547 | mTodoListView->setColumnWidth( 0, 120 ); | 547 | mTodoListView->setColumnWidth( 0, 120 ); |
548 | int iii = 0; | 548 | int iii = 0; |
549 | for ( iii = 0; iii< 10 ; ++iii ) | 549 | for ( iii = 0; iii< 10 ; ++iii ) |
550 | mTodoListView->setColumnWidthMode( iii, QListView::Manual ); | 550 | mTodoListView->setColumnWidthMode( iii, QListView::Manual ); |
551 | 551 | ||
552 | 552 | ||
553 | mKOTodoViewWhatsThis = new KOTodoViewWhatsThis(mTodoListView->viewport(),this); | 553 | mKOTodoViewWhatsThis = new KOTodoViewWhatsThis(mTodoListView->viewport(),this); |
554 | 554 | ||
555 | mPriorityPopupMenu = new QPopupMenu(this); | 555 | mPriorityPopupMenu = new QPopupMenu(this); |
556 | for (int i = 1; i <= 5; i++) { | 556 | for (int i = 1; i <= 5; i++) { |
557 | QString label = QString ("%1").arg (i); | 557 | QString label = QString ("%1").arg (i); |
558 | mPriority[mPriorityPopupMenu->insertItem (label)] = i; | 558 | mPriority[mPriorityPopupMenu->insertItem (label)] = i; |
559 | } | 559 | } |
560 | connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); | 560 | connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); |
561 | 561 | ||
562 | mPercentageCompletedPopupMenu = new QPopupMenu(this); | 562 | mPercentageCompletedPopupMenu = new QPopupMenu(this); |
563 | for (int i = 0; i <= 100; i+=20) { | 563 | for (int i = 0; i <= 100; i+=20) { |
564 | QString label = QString ("%1 %").arg (i); | 564 | QString label = QString ("%1 %").arg (i); |
565 | mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; | 565 | mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; |
566 | } | 566 | } |
567 | connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); | 567 | connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); |
568 | 568 | ||
569 | 569 | ||
570 | mCategoryPopupMenu = new QPopupMenu (this); | ||
571 | mCategoryPopupMenu->setCheckable (true); | ||
572 | connect (mCategoryPopupMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); | ||
573 | connect (mCategoryPopupMenu, SIGNAL (aboutToShow ()), SLOT (fillCategories ())); | ||
574 | |||
575 | mCalPopupMenu = new QPopupMenu (this); | ||
576 | mCalPopupMenu->setCheckable (true); | ||
577 | connect (mCalPopupMenu, SIGNAL (activated (int)), SLOT (changedCal (int))); | ||
578 | connect (mCalPopupMenu, SIGNAL (aboutToShow ()), SLOT (fillCal ())); | ||
579 | |||
580 | |||
581 | |||
570 | 582 | ||
571 | mItemPopupMenu = new QPopupMenu(this); | 583 | mItemPopupMenu = new QPopupMenu(this); |
572 | mItemPopupMenu->insertItem(i18n("Show..."), this, | 584 | mItemPopupMenu->insertItem(i18n("Show"), this, |
573 | SLOT (showTodo())); | 585 | SLOT (showTodo())); |
574 | mItemPopupMenu->insertItem(i18n("Edit..."), this, | 586 | mItemPopupMenu->insertItem(i18n("Edit..."), this, |
575 | SLOT (editTodo())); | 587 | SLOT (editTodo())); |
576 | mItemPopupMenu->insertItem( i18n("Delete"), this, | 588 | mItemPopupMenu->insertItem( i18n("Delete"), this, |
577 | SLOT (deleteTodo())); | 589 | SLOT (deleteTodo())); |
578 | mItemPopupMenu->insertItem( i18n("Clone..."), this, | 590 | mItemPopupMenu->insertItem( i18n("Clone..."), this, |
579 | SLOT (cloneTodo())); | 591 | SLOT (cloneTodo())); |
580 | mItemPopupMenu->insertItem( i18n("Move..."), this, | 592 | mItemPopupMenu->insertItem( i18n("Move..."), this, |
581 | SLOT (moveTodo())); | 593 | SLOT (moveTodo())); |
582 | #ifndef DESKTOP_VERSION | 594 | #ifndef DESKTOP_VERSION |
583 | mItemPopupMenu->insertItem( i18n("Beam..."), this, | 595 | mItemPopupMenu->insertItem( i18n("Beam..."), this, |
584 | SLOT (beamTodo())); | 596 | SLOT (beamTodo())); |
585 | #endif | 597 | #endif |
586 | mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, | 598 | mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, |
587 | SLOT (cancelTodo())); | 599 | SLOT (cancelTodo())); |
600 | mItemPopupMenu->insertItem( i18n("Categories"), mCategoryPopupMenu); | ||
601 | mItemPopupMenu->insertItem( i18n("Calendar"), mCalPopupMenu); | ||
588 | mItemPopupMenu->insertSeparator(); | 602 | mItemPopupMenu->insertSeparator(); |
589 | mItemPopupMenu->insertItem( i18n("Start/Stop todo..."), this, | 603 | mItemPopupMenu->insertItem( i18n("Start/Stop todo..."), this, |
590 | SLOT (toggleRunningItem())); | 604 | SLOT (toggleRunningItem())); |
591 | mItemPopupMenu->insertSeparator(); | 605 | mItemPopupMenu->insertSeparator(); |
592 | /* | 606 | /* |
593 | mItemPopupMenu->insertItem( i18n("New Todo..."), this, | 607 | mItemPopupMenu->insertItem( i18n("New Todo..."), this, |
594 | SLOT (newTodo())); | 608 | SLOT (newTodo())); |
595 | */ | 609 | */ |
596 | mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this, | 610 | mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this, |
597 | SLOT (newSubTodo())); | 611 | SLOT (newSubTodo())); |
598 | mItemPopupMenu->insertItem(i18n("Unparent Todo"), this, | 612 | mItemPopupMenu->insertItem(i18n("Unparent Todo"), this, |
599 | SLOT (unparentTodo()),0,21); | 613 | SLOT (unparentTodo()),0,21); |
600 | mItemPopupMenu->insertItem(i18n("Reparent Todo"), this, | 614 | mItemPopupMenu->insertItem(i18n("Reparent Todo"), this, |
601 | SLOT (reparentTodo()),0,22); | 615 | SLOT (reparentTodo()),0,22); |
602 | mItemPopupMenu->insertSeparator(); | 616 | mItemPopupMenu->insertSeparator(); |
603 | #if 0 | 617 | #if 0 |
604 | mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed..."), | 618 | mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed..."), |
605 | this, SLOT( purgeCompleted() ) ); | 619 | this, SLOT( purgeCompleted() ) ); |
606 | mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"), | 620 | mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"), |
607 | this, SLOT( toggleCompleted() ),0, 33 ); | 621 | this, SLOT( toggleCompleted() ),0, 33 ); |
608 | mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), | 622 | mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), |
609 | this, SLOT( toggleQuickTodo() ),0, 34 ); | 623 | this, SLOT( toggleQuickTodo() ),0, 34 ); |
610 | mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), | 624 | mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), |
611 | this, SLOT( toggleRunning() ),0, 35 ); | 625 | this, SLOT( toggleRunning() ),0, 35 ); |
612 | 626 | ||
613 | #endif | 627 | #endif |
614 | mPopupMenu = new QPopupMenu(this); | 628 | mPopupMenu = new QPopupMenu(this); |
615 | mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, | 629 | mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, |
616 | SLOT (newTodo()),0,1); | 630 | SLOT (newTodo()),0,1); |
617 | mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed..."), | 631 | mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed..."), |
618 | this, SLOT(purgeCompleted()),0,2); | 632 | this, SLOT(purgeCompleted()),0,2); |
619 | mPopupMenu->insertItem(i18n("Show Completed"), | 633 | mPopupMenu->insertItem(i18n("Show Completed"), |
620 | this, SLOT( toggleCompleted() ),0,3 ); | 634 | this, SLOT( toggleCompleted() ),0,3 ); |
621 | mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), | 635 | mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), |
622 | this, SLOT( toggleRunning() ),0,5 ); | 636 | this, SLOT( toggleRunning() ),0,5 ); |
623 | mPopupMenu->insertItem(i18n(" set all open","Display all opened"), | 637 | mPopupMenu->insertItem(i18n(" set all open","Display all opened"), |
624 | this, SLOT( setAllOpen() ),0,6 ); | 638 | this, SLOT( setAllOpen() ),0,6 ); |
625 | mPopupMenu->insertItem(i18n(" set all close","Display all closed"), | 639 | mPopupMenu->insertItem(i18n(" set all close","Display all closed"), |
626 | this, SLOT( setAllClose() ),0,7 ); | 640 | this, SLOT( setAllClose() ),0,7 ); |
627 | mPopupMenu->insertItem(i18n(" set all flat","Display all flat"), | 641 | mPopupMenu->insertItem(i18n(" set all flat","Display all flat"), |
628 | this, SLOT( setAllFlat() ),0,8 ); | 642 | this, SLOT( setAllFlat() ),0,8 ); |
629 | mPopupMenu->insertSeparator(); | 643 | mPopupMenu->insertSeparator(); |
630 | mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), | 644 | mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), |
631 | this, SLOT( toggleQuickTodo() ),0,4 ); | 645 | this, SLOT( toggleQuickTodo() ),0,4 ); |
632 | mDocPrefs = new DocPrefs( name ); | 646 | mDocPrefs = new DocPrefs( name ); |
633 | 647 | ||
634 | mItemPopupMenu->insertItem(i18n("Todo View"),mPopupMenu ); | 648 | mItemPopupMenu->insertItem(i18n("Todo View"),mPopupMenu ); |
635 | mPopupMenu->setCheckable( true ); | 649 | mPopupMenu->setCheckable( true ); |
636 | mItemPopupMenu->setCheckable( true ); | 650 | mItemPopupMenu->setCheckable( true ); |
637 | 651 | ||
638 | 652 | ||
639 | mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); | 653 | mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); |
640 | mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); | 654 | mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); |
641 | 655 | ||
642 | mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); | 656 | mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); |
643 | mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); | 657 | mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); |
644 | 658 | ||
645 | mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); | 659 | mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); |
646 | mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); | 660 | mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); |
647 | 661 | ||
648 | 662 | ||
649 | // Double clicking conflicts with opening/closing the subtree | 663 | // Double clicking conflicts with opening/closing the subtree |
650 | connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ), | 664 | connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ), |
651 | SLOT( editItem( QListViewItem *) ) ); | 665 | SLOT( editItem( QListViewItem *) ) ); |
652 | /* | 666 | /* |
653 | connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, | 667 | connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, |
654 | const QPoint &,int ) ), | 668 | const QPoint &,int ) ), |
655 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); | 669 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); |
656 | */ | 670 | */ |
657 | connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *, | 671 | connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *, |
658 | const QPoint &,int ) ), | 672 | const QPoint &,int ) ), |
659 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); | 673 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); |
660 | connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), | 674 | connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), |
661 | SLOT( itemClicked( QListViewItem * ) ) ); | 675 | SLOT( itemClicked( QListViewItem * ) ) ); |
662 | connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), | 676 | connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), |
663 | SLOT( itemDoubleClicked( QListViewItem * ) ) ); | 677 | SLOT( itemDoubleClicked( QListViewItem * ) ) ); |
664 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), | 678 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), |
665 | SLOT( updateView() ) ); | 679 | SLOT( updateView() ) ); |
666 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), | 680 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), |
667 | SLOT( todoModified(Todo *, int) ) ); | 681 | SLOT( todoModified(Todo *, int) ) ); |
668 | connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), | 682 | connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), |
669 | SLOT( itemStateChanged( QListViewItem * ) ) ); | 683 | SLOT( itemStateChanged( QListViewItem * ) ) ); |
670 | connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), | 684 | connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), |
671 | SLOT( itemStateChanged( QListViewItem * ) ) ); | 685 | SLOT( itemStateChanged( QListViewItem * ) ) ); |
672 | connect( mTodoListView, SIGNAL( paintNeeded() ), | 686 | connect( mTodoListView, SIGNAL( paintNeeded() ), |
673 | SLOT( paintNeeded()) ); | 687 | SLOT( paintNeeded()) ); |
674 | 688 | ||
675 | #if 0 | 689 | #if 0 |
676 | connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), | 690 | connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), |
677 | SLOT(selectionChanged(QListViewItem *))); | 691 | SLOT(selectionChanged(QListViewItem *))); |
678 | connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), | 692 | connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), |
679 | SLOT(selectionChanged(QListViewItem *))); | 693 | SLOT(selectionChanged(QListViewItem *))); |
680 | connect(mTodoListView,SIGNAL(pressed(QListViewItem *)), | 694 | connect(mTodoListView,SIGNAL(pressed(QListViewItem *)), |
681 | SLOT(selectionChanged(QListViewItem *))); | 695 | SLOT(selectionChanged(QListViewItem *))); |
682 | #endif | 696 | #endif |
683 | 697 | ||
@@ -960,322 +974,337 @@ KOTodoView::insertTodoItem(Todo *todo) | |||
960 | Todo *relatedTodo = static_cast<Todo *>(incidence); | 974 | Todo *relatedTodo = static_cast<Todo *>(incidence); |
961 | 975 | ||
962 | // kdDebug() << " has Related" << endl; | 976 | // kdDebug() << " has Related" << endl; |
963 | QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; | 977 | QMap<Todo *,KOTodoViewItem *>::ConstIterator itemIterator; |
964 | itemIterator = mTodoMap.find(relatedTodo); | 978 | itemIterator = mTodoMap.find(relatedTodo); |
965 | if (itemIterator == mTodoMap.end()) { | 979 | if (itemIterator == mTodoMap.end()) { |
966 | // kdDebug() << " related not yet in list" << endl; | 980 | // kdDebug() << " related not yet in list" << endl; |
967 | itemIterator = insertTodoItem (relatedTodo); | 981 | itemIterator = insertTodoItem (relatedTodo); |
968 | } | 982 | } |
969 | // isn't this pretty stupid? We give one Todo to the KOTodoViewItem | 983 | // isn't this pretty stupid? We give one Todo to the KOTodoViewItem |
970 | // and one into the map. Sure finding is more easy but why? -zecke | 984 | // and one into the map. Sure finding is more easy but why? -zecke |
971 | KOTodoViewItem *todoItem = new KOTodoViewItem(*itemIterator,todo,this); | 985 | KOTodoViewItem *todoItem = new KOTodoViewItem(*itemIterator,todo,this); |
972 | return mTodoMap.insert(todo,todoItem); | 986 | return mTodoMap.insert(todo,todoItem); |
973 | } else { | 987 | } else { |
974 | // kdDebug() << " no Related" << endl; | 988 | // kdDebug() << " no Related" << endl; |
975 | // see above -zecke | 989 | // see above -zecke |
976 | KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); | 990 | KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); |
977 | return mTodoMap.insert(todo,todoItem); | 991 | return mTodoMap.insert(todo,todoItem); |
978 | } | 992 | } |
979 | } | 993 | } |
980 | 994 | ||
981 | 995 | ||
982 | void KOTodoView::updateConfig() | 996 | void KOTodoView::updateConfig() |
983 | { | 997 | { |
984 | updateView(); | 998 | updateView(); |
985 | mTodoListView->repaintContents(); | 999 | mTodoListView->repaintContents(); |
986 | } | 1000 | } |
987 | 1001 | ||
988 | QPtrList<Incidence> KOTodoView::selectedIncidences() | 1002 | QPtrList<Incidence> KOTodoView::selectedIncidences() |
989 | { | 1003 | { |
990 | QPtrList<Incidence> selected; | 1004 | QPtrList<Incidence> selected; |
991 | 1005 | ||
992 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); | 1006 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); |
993 | // if (!item) item = mActiveItem; | 1007 | // if (!item) item = mActiveItem; |
994 | if (item) selected.append(item->todo()); | 1008 | if (item) selected.append(item->todo()); |
995 | 1009 | ||
996 | return selected; | 1010 | return selected; |
997 | } | 1011 | } |
998 | 1012 | ||
999 | QPtrList<Todo> KOTodoView::selectedTodos() | 1013 | QPtrList<Todo> KOTodoView::selectedTodos() |
1000 | { | 1014 | { |
1001 | QPtrList<Todo> selected; | 1015 | QPtrList<Todo> selected; |
1002 | 1016 | ||
1003 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); | 1017 | KOTodoViewItem *item = (KOTodoViewItem *)(mTodoListView->selectedItem()); |
1004 | // if (!item) item = mActiveItem; | 1018 | // if (!item) item = mActiveItem; |
1005 | if (item) selected.append(item->todo()); | 1019 | if (item) selected.append(item->todo()); |
1006 | 1020 | ||
1007 | return selected; | 1021 | return selected; |
1008 | } | 1022 | } |
1009 | 1023 | ||
1010 | void KOTodoView::changeEventDisplay(Event *, int) | 1024 | void KOTodoView::changeEventDisplay(Event *, int) |
1011 | { | 1025 | { |
1012 | updateView(); | 1026 | updateView(); |
1013 | } | 1027 | } |
1014 | 1028 | ||
1015 | void KOTodoView::showDates(const QDate &, const QDate &) | 1029 | void KOTodoView::showDates(const QDate &, const QDate &) |
1016 | { | 1030 | { |
1017 | } | 1031 | } |
1018 | 1032 | ||
1019 | void KOTodoView::showEvents(QPtrList<Event>) | 1033 | void KOTodoView::showEvents(QPtrList<Event>) |
1020 | { | 1034 | { |
1021 | kdDebug() << "KOTodoView::selectEvents(): not yet implemented" << endl; | 1035 | kdDebug() << "KOTodoView::selectEvents(): not yet implemented" << endl; |
1022 | } | 1036 | } |
1023 | 1037 | ||
1024 | void KOTodoView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 1038 | void KOTodoView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
1025 | const QDate &td) | 1039 | const QDate &td) |
1026 | { | 1040 | { |
1027 | #ifndef KORG_NOPRINTER | 1041 | #ifndef KORG_NOPRINTER |
1028 | calPrinter->preview(CalPrinter::Todolist, fd, td); | 1042 | calPrinter->preview(CalPrinter::Todolist, fd, td); |
1029 | #endif | 1043 | #endif |
1030 | } | 1044 | } |
1031 | 1045 | ||
1032 | void KOTodoView::editItem(QListViewItem *item ) | 1046 | void KOTodoView::editItem(QListViewItem *item ) |
1033 | { | 1047 | { |
1034 | emit editTodoSignal(((KOTodoViewItem *)item)->todo()); | 1048 | emit editTodoSignal(((KOTodoViewItem *)item)->todo()); |
1035 | } | 1049 | } |
1036 | 1050 | ||
1037 | void KOTodoView::showItem(QListViewItem *item,const QPoint &,int) | 1051 | void KOTodoView::showItem(QListViewItem *item,const QPoint &,int) |
1038 | { | 1052 | { |
1039 | emit showTodoSignal(((KOTodoViewItem *)item)->todo()); | 1053 | emit showTodoSignal(((KOTodoViewItem *)item)->todo()); |
1040 | } | 1054 | } |
1041 | 1055 | ||
1042 | void KOTodoView::popupMenu(QListViewItem *item,const QPoint &p,int column) | 1056 | void KOTodoView::popupMenu(QListViewItem *item,const QPoint &p,int column) |
1043 | { | 1057 | { |
1044 | pendingSubtodo = 0; | 1058 | pendingSubtodo = 0; |
1045 | mActiveItem = (KOTodoViewItem *)item; | 1059 | mActiveItem = (KOTodoViewItem *)item; |
1046 | if (item) { | 1060 | if (item) { |
1047 | switch (column){ | 1061 | switch (column){ |
1048 | case 1: | 1062 | case 1: |
1049 | mPriorityPopupMenu->popup(QCursor::pos ()); break; | 1063 | mPriorityPopupMenu->popup(QCursor::pos ()); break; |
1050 | case 2: | 1064 | case 2: |
1051 | mPercentageCompletedPopupMenu->popup(QCursor::pos ()); break; | 1065 | mPercentageCompletedPopupMenu->popup(QCursor::pos ()); break; |
1052 | case 3: | 1066 | case 3: |
1053 | moveTodo(); | 1067 | moveTodo(); |
1054 | break; | 1068 | break; |
1055 | case 8: | 1069 | case 8: |
1056 | getCategoryPopupMenu((KOTodoViewItem *)item)->popup(QCursor::pos ()); break; | 1070 | mCategoryPopupMenu->popup(QCursor::pos ()); break; |
1071 | case 9: | ||
1072 | mCalPopupMenu->popup(QCursor::pos ()); break; | ||
1057 | default: | 1073 | default: |
1058 | mItemPopupMenu->popup(QCursor::pos()); | 1074 | mItemPopupMenu->popup(QCursor::pos()); |
1059 | } | 1075 | } |
1060 | } else mPopupMenu->popup(QCursor::pos()); | 1076 | } else mPopupMenu->popup(QCursor::pos()); |
1061 | } | 1077 | } |
1062 | void KOTodoView::newTodo() | 1078 | void KOTodoView::newTodo() |
1063 | { | 1079 | { |
1064 | emit newTodoSignal(); | 1080 | emit newTodoSignal(); |
1065 | } | 1081 | } |
1066 | 1082 | ||
1067 | void KOTodoView::newSubTodo() | 1083 | void KOTodoView::newSubTodo() |
1068 | { | 1084 | { |
1069 | if (mActiveItem) { | 1085 | if (mActiveItem) { |
1070 | emit newSubTodoSignal(mActiveItem->todo()); | 1086 | emit newSubTodoSignal(mActiveItem->todo()); |
1071 | } | 1087 | } |
1072 | } | 1088 | } |
1073 | void KOTodoView::unparentTodo() | 1089 | void KOTodoView::unparentTodo() |
1074 | { | 1090 | { |
1075 | if (mActiveItem) { | 1091 | if (mActiveItem) { |
1076 | emit unparentTodoSignal(mActiveItem->todo()); | 1092 | emit unparentTodoSignal(mActiveItem->todo()); |
1077 | } | 1093 | } |
1078 | } | 1094 | } |
1079 | 1095 | ||
1080 | void KOTodoView::reparentTodo() | 1096 | void KOTodoView::reparentTodo() |
1081 | { | 1097 | { |
1082 | if (mActiveItem) { | 1098 | if (mActiveItem) { |
1083 | topLevelWidget()->setCaption(i18n("Click on new parent item")); | 1099 | topLevelWidget()->setCaption(i18n("Click on new parent item")); |
1084 | pendingSubtodo = mActiveItem; | 1100 | pendingSubtodo = mActiveItem; |
1085 | } | 1101 | } |
1086 | } | 1102 | } |
1087 | void KOTodoView::editTodo() | 1103 | void KOTodoView::editTodo() |
1088 | { | 1104 | { |
1089 | if (mActiveItem) { | 1105 | if (mActiveItem) { |
1090 | emit editTodoSignal(mActiveItem->todo()); | 1106 | emit editTodoSignal(mActiveItem->todo()); |
1091 | } | 1107 | } |
1092 | } | 1108 | } |
1093 | void KOTodoView::cloneTodo() | 1109 | void KOTodoView::cloneTodo() |
1094 | { | 1110 | { |
1095 | if (mActiveItem) { | 1111 | if (mActiveItem) { |
1096 | emit cloneTodoSignal((Incidence*)mActiveItem->todo()); | 1112 | emit cloneTodoSignal((Incidence*)mActiveItem->todo()); |
1097 | } | 1113 | } |
1098 | } | 1114 | } |
1099 | void KOTodoView::cancelTodo() | 1115 | void KOTodoView::cancelTodo() |
1100 | { | 1116 | { |
1101 | if (mActiveItem) { | 1117 | if (mActiveItem) { |
1102 | emit cancelTodoSignal((Incidence*)mActiveItem->todo()); | 1118 | emit cancelTodoSignal((Incidence*)mActiveItem->todo()); |
1103 | } | 1119 | } |
1104 | } | 1120 | } |
1105 | void KOTodoView::moveTodo() | 1121 | void KOTodoView::moveTodo() |
1106 | { | 1122 | { |
1107 | if (mActiveItem) { | 1123 | if (mActiveItem) { |
1108 | emit moveTodoSignal((Incidence*)mActiveItem->todo()); | 1124 | emit moveTodoSignal((Incidence*)mActiveItem->todo()); |
1109 | } | 1125 | } |
1110 | } | 1126 | } |
1111 | void KOTodoView::beamTodo() | 1127 | void KOTodoView::beamTodo() |
1112 | { | 1128 | { |
1113 | if (mActiveItem) { | 1129 | if (mActiveItem) { |
1114 | emit beamTodoSignal((Incidence*)mActiveItem->todo()); | 1130 | emit beamTodoSignal((Incidence*)mActiveItem->todo()); |
1115 | } | 1131 | } |
1116 | } | 1132 | } |
1117 | 1133 | ||
1118 | 1134 | ||
1119 | void KOTodoView::showTodo() | 1135 | void KOTodoView::showTodo() |
1120 | { | 1136 | { |
1121 | if (mActiveItem) { | 1137 | if (mActiveItem) { |
1122 | emit showTodoSignal(mActiveItem->todo()); | 1138 | emit showTodoSignal(mActiveItem->todo()); |
1123 | } | 1139 | } |
1124 | } | 1140 | } |
1125 | 1141 | ||
1126 | void KOTodoView::deleteTodo() | 1142 | void KOTodoView::deleteTodo() |
1127 | { | 1143 | { |
1128 | if (mActiveItem) { | 1144 | if (mActiveItem) { |
1129 | emit deleteTodoSignal(mActiveItem->todo()); | 1145 | emit deleteTodoSignal(mActiveItem->todo()); |
1130 | } | 1146 | } |
1131 | } | 1147 | } |
1132 | 1148 | ||
1133 | void KOTodoView::setNewPriority(int index) | 1149 | void KOTodoView::setNewPriority(int index) |
1134 | { | 1150 | { |
1135 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { | 1151 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { |
1136 | mActiveItem->todo()->setPriority(mPriority[index]); | 1152 | mActiveItem->todo()->setPriority(mPriority[index]); |
1137 | mActiveItem->construct(); | 1153 | mActiveItem->construct(); |
1138 | todoModified (mActiveItem->todo(), KOGlobals::PRIORITY_MODIFIED); | 1154 | todoModified (mActiveItem->todo(), KOGlobals::PRIORITY_MODIFIED); |
1139 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); | 1155 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); |
1140 | } | 1156 | } |
1141 | } | 1157 | } |
1142 | 1158 | ||
1143 | void KOTodoView::setNewPercentage(int index) | 1159 | void KOTodoView::setNewPercentage(int index) |
1144 | { | 1160 | { |
1145 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { | 1161 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { |
1146 | 1162 | ||
1147 | if ( mPercentage[index] == 100 && !mActiveItem->isOn() ) { | 1163 | if ( mPercentage[index] == 100 && !mActiveItem->isOn() ) { |
1148 | mActiveItem->setOn( true ); | 1164 | mActiveItem->setOn( true ); |
1149 | return; | 1165 | return; |
1150 | } else if ( mPercentage[index] != 100 && mActiveItem->isOn() ) { | 1166 | } else if ( mPercentage[index] != 100 && mActiveItem->isOn() ) { |
1151 | KOTodoViewItem* par = (static_cast<KOTodoViewItem*>(mActiveItem->parent())); | 1167 | KOTodoViewItem* par = (static_cast<KOTodoViewItem*>(mActiveItem->parent())); |
1152 | if ( par && par->isOn() ) | 1168 | if ( par && par->isOn() ) |
1153 | par->setOn( false ); | 1169 | par->setOn( false ); |
1154 | } | 1170 | } |
1155 | if (mPercentage[index] == 100) { | 1171 | if (mPercentage[index] == 100) { |
1156 | mActiveItem->todo()->setCompleted(QDateTime::currentDateTime()); | 1172 | mActiveItem->todo()->setCompleted(QDateTime::currentDateTime()); |
1157 | } else { | 1173 | } else { |
1158 | mActiveItem->todo()->setCompleted(false); | 1174 | mActiveItem->todo()->setCompleted(false); |
1159 | } | 1175 | } |
1160 | mActiveItem->todo()->setPercentComplete(mPercentage[index]); | 1176 | mActiveItem->todo()->setPercentComplete(mPercentage[index]); |
1161 | mActiveItem->construct(); | 1177 | mActiveItem->construct(); |
1162 | todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED); | 1178 | todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED); |
1163 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); | 1179 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); |
1164 | } | 1180 | } |
1165 | } | 1181 | } |
1166 | 1182 | ||
1167 | 1183 | void KOTodoView::fillCategories () | |
1168 | QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem) | ||
1169 | { | 1184 | { |
1170 | if ( !mCategoryPopupMenu ) { | ||
1171 | mCategoryPopupMenu = new QPopupMenu (this); | ||
1172 | mCategoryPopupMenu->setCheckable (true); | ||
1173 | connect (mCategoryPopupMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); | ||
1174 | } | ||
1175 | mCategoryPopupMenu->clear(); | 1185 | mCategoryPopupMenu->clear(); |
1176 | QStringList checkedCategories = todoItem->todo()->categories (); | 1186 | if ( ! mActiveItem ) return; |
1177 | 1187 | QStringList checkedCategories = mActiveItem->todo()->categories (); | |
1178 | for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); | 1188 | for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); |
1179 | it != KOPrefs::instance()->mCustomCategories.end (); | 1189 | it != KOPrefs::instance()->mCustomCategories.end (); |
1180 | ++it) { | 1190 | ++it) { |
1181 | int index = mCategoryPopupMenu->insertItem (*it); | 1191 | int index = mCategoryPopupMenu->insertItem (*it); |
1182 | mCategory[index] = *it; | 1192 | mCategory[index] = *it; |
1183 | if (checkedCategories.find (*it) != checkedCategories.end ()) mCategoryPopupMenu->setItemChecked (index, true); | 1193 | if (checkedCategories.find (*it) != checkedCategories.end ()) mCategoryPopupMenu->setItemChecked (index, true); |
1184 | } | 1194 | } |
1185 | return mCategoryPopupMenu; | 1195 | } |
1196 | void KOTodoView::fillCal () | ||
1197 | { | ||
1198 | mCalPopupMenu->clear(); | ||
1199 | if (!mActiveItem) return; | ||
1200 | bool readO = mActiveItem->todo()->isReadOnly(); | ||
1201 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); | ||
1202 | while ( kkf ) { | ||
1203 | int index = mCalPopupMenu->insertItem( kkf->mName, kkf->mCalNumber); | ||
1204 | if ( kkf->mErrorOnLoad || kkf->isReadOnly || readO ) | ||
1205 | mCalPopupMenu->setItemEnabled( index, false ); | ||
1206 | mCalPopupMenu->setItemChecked (index, kkf->mCalNumber == mActiveItem->todo()->calID()); | ||
1207 | kkf = KOPrefs::instance()->mCalendars.next(); | ||
1208 | } | ||
1209 | } | ||
1210 | void KOTodoView::changedCal (int index ) | ||
1211 | { | ||
1212 | if (!mActiveItem) return; | ||
1213 | mActiveItem->todo()->setCalID( index ); | ||
1214 | mActiveItem->construct(); | ||
1186 | } | 1215 | } |
1187 | void KOTodoView::changedCategories(int index) | 1216 | void KOTodoView::changedCategories(int index) |
1188 | { | 1217 | { |
1189 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { | 1218 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { |
1190 | QStringList categories = mActiveItem->todo()->categories (); | 1219 | QStringList categories = mActiveItem->todo()->categories (); |
1191 | QString colcat = categories.first(); | 1220 | QString colcat = categories.first(); |
1192 | if (categories.find (mCategory[index]) != categories.end ()) | 1221 | if (categories.find (mCategory[index]) != categories.end ()) |
1193 | categories.remove (mCategory[index]); | 1222 | categories.remove (mCategory[index]); |
1194 | else | 1223 | else |
1195 | categories.insert (categories.end(), mCategory[index]); | 1224 | categories.insert (categories.end(), mCategory[index]); |
1196 | categories.sort (); | 1225 | categories.sort (); |
1197 | if ( !colcat.isEmpty() ) { | 1226 | if ( !colcat.isEmpty() ) { |
1198 | if ( categories.find ( colcat ) != categories.end () ) { | 1227 | if ( categories.find ( colcat ) != categories.end () ) { |
1199 | categories.remove( colcat ); | 1228 | categories.remove( colcat ); |
1200 | categories.prepend( colcat ); | 1229 | categories.prepend( colcat ); |
1201 | } | 1230 | } |
1202 | } | 1231 | } |
1203 | mActiveItem->todo()->setCategories (categories); | 1232 | mActiveItem->todo()->setCategories (categories); |
1204 | mActiveItem->construct(); | 1233 | mActiveItem->construct(); |
1205 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); | 1234 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); |
1206 | todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED); | 1235 | todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED); |
1207 | } | 1236 | } |
1208 | } | 1237 | } |
1209 | void KOTodoView::itemDoubleClicked(QListViewItem *item) | 1238 | void KOTodoView::itemDoubleClicked(QListViewItem *item) |
1210 | { | 1239 | { |
1211 | if ( pendingSubtodo != 0 ) { | 1240 | if ( pendingSubtodo != 0 ) { |
1212 | topLevelWidget()->setCaption(i18n("Reparenting aborted!")); | 1241 | topLevelWidget()->setCaption(i18n("Reparenting aborted!")); |
1213 | } | 1242 | } |
1214 | pendingSubtodo = 0; | 1243 | pendingSubtodo = 0; |
1215 | //int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() ); | 1244 | //int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() ); |
1216 | int row = mTodoListView->header()->sectionAt ( mTodoListView->viewportToContents(mTodoListView->viewport()->mapFromGlobal( QCursor::pos())) .x() ); | 1245 | int row = mTodoListView->header()->sectionAt ( mTodoListView->viewportToContents(mTodoListView->viewport()->mapFromGlobal( QCursor::pos())) .x() ); |
1217 | //qDebug("ROW %d ", row); | 1246 | //qDebug("ROW %d ", row); |
1218 | if (!item) { | 1247 | if (!item) { |
1219 | newTodo(); | 1248 | newTodo(); |
1220 | return; | 1249 | return; |
1221 | } else { | 1250 | } else { |
1222 | if ( row == 1 ) { | 1251 | if ( row == 1 ) { |
1223 | mActiveItem = (KOTodoViewItem *) item; | 1252 | mActiveItem = (KOTodoViewItem *) item; |
1224 | newSubTodo(); | 1253 | newSubTodo(); |
1225 | return; | 1254 | return; |
1226 | } | 1255 | } |
1227 | if ( row == 5 || row == 6 || row == 2) { | 1256 | if ( row == 5 || row == 6 || row == 2) { |
1228 | mActiveItem = (KOTodoViewItem *) item; | 1257 | mActiveItem = (KOTodoViewItem *) item; |
1229 | Todo * t = mActiveItem->todo(); | 1258 | Todo * t = mActiveItem->todo(); |
1230 | if ( t->isRunning() ) { | 1259 | if ( t->isRunning() ) { |
1231 | if ( t->runTime() < 15) { | 1260 | if ( t->runTime() < 15) { |
1232 | t->stopRunning(); | 1261 | t->stopRunning(); |
1233 | mActiveItem->construct(); | 1262 | mActiveItem->construct(); |
1234 | topLevelWidget()->setCaption(i18n("Todo stopped - no data saved because runtime was < 15 sec!")); | 1263 | topLevelWidget()->setCaption(i18n("Todo stopped - no data saved because runtime was < 15 sec!")); |
1235 | return; | 1264 | return; |
1236 | } | 1265 | } |
1237 | else | 1266 | else |
1238 | toggleRunningItem(); | 1267 | toggleRunningItem(); |
1239 | return; | 1268 | return; |
1240 | } else { | 1269 | } else { |
1241 | t->setRunning( true ); | 1270 | t->setRunning( true ); |
1242 | mActiveItem->construct(); | 1271 | mActiveItem->construct(); |
1243 | topLevelWidget()->setCaption(i18n("Todo started! Double click again to stop!")); | 1272 | topLevelWidget()->setCaption(i18n("Todo started! Double click again to stop!")); |
1244 | return; | 1273 | return; |
1245 | } | 1274 | } |
1246 | } | 1275 | } |
1247 | } | 1276 | } |
1248 | if ( KOPrefs::instance()->mEditOnDoubleClick ) | 1277 | if ( KOPrefs::instance()->mEditOnDoubleClick ) |
1249 | editItem( item ); | 1278 | editItem( item ); |
1250 | else | 1279 | else |
1251 | showItem( item , QPoint(), 0 ); | 1280 | showItem( item , QPoint(), 0 ); |
1252 | } | 1281 | } |
1253 | void KOTodoView::toggleRunningItem() | 1282 | void KOTodoView::toggleRunningItem() |
1254 | { | 1283 | { |
1255 | // qDebug("KOTodoView::toggleRunning() "); | 1284 | // qDebug("KOTodoView::toggleRunning() "); |
1256 | if ( ! mActiveItem ) | 1285 | if ( ! mActiveItem ) |
1257 | return; | 1286 | return; |
1258 | Todo * t = mActiveItem->todo(); | 1287 | Todo * t = mActiveItem->todo(); |
1259 | if ( t->isRunning() ) { | 1288 | if ( t->isRunning() ) { |
1260 | KOStopTodoPrefs tp ( t, this ); | 1289 | KOStopTodoPrefs tp ( t, this ); |
1261 | if (QApplication::desktop()->width() <= 800 ){ | 1290 | if (QApplication::desktop()->width() <= 800 ){ |
1262 | int wid = tp.width(); | 1291 | int wid = tp.width(); |
1263 | int hei = tp.height(); | 1292 | int hei = tp.height(); |
1264 | int xx = (QApplication::desktop()->width()-wid)/2; | 1293 | int xx = (QApplication::desktop()->width()-wid)/2; |
1265 | int yy = (QApplication::desktop()->height()-hei)/2; | 1294 | int yy = (QApplication::desktop()->height()-hei)/2; |
1266 | tp.setGeometry( xx,yy,wid,hei ); | 1295 | tp.setGeometry( xx,yy,wid,hei ); |
1267 | } | 1296 | } |
1268 | tp.exec(); | 1297 | tp.exec(); |
1269 | mActiveItem->construct(); | 1298 | mActiveItem->construct(); |
1270 | } else { | 1299 | } else { |
1271 | KOStartTodoPrefs tp ( t->summary(), this ); | 1300 | KOStartTodoPrefs tp ( t->summary(), this ); |
1272 | if (QApplication::desktop()->width() <= 800 ){ | 1301 | if (QApplication::desktop()->width() <= 800 ){ |
1273 | int wid = tp.width(); | 1302 | int wid = tp.width(); |
1274 | int hei = tp.height(); | 1303 | int hei = tp.height(); |
1275 | int xx = (QApplication::desktop()->width()-wid)/2; | 1304 | int xx = (QApplication::desktop()->width()-wid)/2; |
1276 | int yy = (QApplication::desktop()->height()-hei)/2; | 1305 | int yy = (QApplication::desktop()->height()-hei)/2; |
1277 | tp.setGeometry( xx,yy,wid,hei ); | 1306 | tp.setGeometry( xx,yy,wid,hei ); |
1278 | } | 1307 | } |
1279 | if ( !tp.exec() ) return; | 1308 | if ( !tp.exec() ) return; |
1280 | if ( tp.stopAll() ) { | 1309 | if ( tp.stopAll() ) { |
1281 | mCalendar->stopAllTodos(); | 1310 | mCalendar->stopAllTodos(); |