-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 @@ -481,6 +481,8 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : SLOT (cancelTodo())); mItemPopupMenu->insertSeparator(); + mItemPopupMenu->insertItem( i18n("Start/Stop todo..."), this, + SLOT (toggleRunningItem())); mItemPopupMenu->insertItem( i18n("New Todo..."), this, SLOT (newTodo())); mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this, @@ -1099,17 +1101,43 @@ void KOTodoView::itemDoubleClicked(QListViewItem *item) newTodo(); return; } else { - if ( row == 1 || row == 2 ) { + if ( row == 2 ) { mActiveItem = (KOTodoViewItem *) item; newSubTodo(); return; } + if ( row == 1 ) { + mActiveItem = (KOTodoViewItem *) item; + toggleRunningItem(); + return; + } } if ( KOPrefs::instance()->mEditOnDoubleClick ) editItem( item ); else showItem( item , QPoint(), 0 ); } +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) { //qDebug("KOTodoView::itemClicked %d", item); |