-rw-r--r-- | korganizer/kotodoview.cpp | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 935a5f5..7ee1eef 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp @@ -483,2 +483,4 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : + mItemPopupMenu->insertItem( i18n("Start/Stop todo..."), this, + SLOT (toggleRunningItem())); mItemPopupMenu->insertItem( i18n("New Todo..."), this, @@ -1101,3 +1103,3 @@ void KOTodoView::itemDoubleClicked(QListViewItem *item) } else { - if ( row == 1 || row == 2 ) { + if ( row == 2 ) { mActiveItem = (KOTodoViewItem *) item; @@ -1106,2 +1108,7 @@ void KOTodoView::itemDoubleClicked(QListViewItem *item) } + if ( row == 1 ) { + mActiveItem = (KOTodoViewItem *) item; + toggleRunningItem(); + return; + } } @@ -1112,2 +1119,23 @@ void KOTodoView::itemDoubleClicked(QListViewItem *item) } +void KOTodoView::toggleRunningItem() +{ + qDebug("KOTodoView::toggleRunning() "); + if ( ! mActiveItem ) + return; + Todo * t = mActiveItem->todo(); + if ( t->isRunning() ) { + int result = KMessageBox::warningContinueCancel(this, + i18n("The todo\n%1\nis started.\nDo you want to set\nthe state to stopped?").arg(mActiveItem->text(0).left( 20 ) ),i18n("Todo is started"),i18n("Stop todo"),i18n("Cancel"), true); + if (result != KMessageBox::Continue) return; + t->setRunning( false ); + mActiveItem->construct(); + } else { + int result = KMessageBox::warningContinueCancel(this, + i18n("The todo\n%1\nis stopped.\nDo you want to set\nthe state to started?").arg(mActiveItem->text(0).left( 20 ) ),i18n("Todo is stopped"),i18n("Start todo"),i18n("Cancel"), true); + if (result != KMessageBox::Continue) return; + t->setRunning( true ); + mActiveItem->construct(); + } +} + void KOTodoView::itemClicked(QListViewItem *item) |