summaryrefslogtreecommitdiffabout
path: root/korganizer/kotodoview.cpp
Unidiff
Diffstat (limited to 'korganizer/kotodoview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kotodoview.cpp30
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) :
481 SLOT (cancelTodo())); 481 SLOT (cancelTodo()));
482 mItemPopupMenu->insertSeparator(); 482 mItemPopupMenu->insertSeparator();
483 483
484 mItemPopupMenu->insertItem( i18n("Start/Stop todo..."), this,
485 SLOT (toggleRunningItem()));
484 mItemPopupMenu->insertItem( i18n("New Todo..."), this, 486 mItemPopupMenu->insertItem( i18n("New Todo..."), this,
485 SLOT (newTodo())); 487 SLOT (newTodo()));
486 mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this, 488 mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this,
@@ -1099,17 +1101,43 @@ void KOTodoView::itemDoubleClicked(QListViewItem *item)
1099 newTodo(); 1101 newTodo();
1100 return; 1102 return;
1101 } else { 1103 } else {
1102 if ( row == 1 || row == 2 ) { 1104 if ( row == 2 ) {
1103 mActiveItem = (KOTodoViewItem *) item; 1105 mActiveItem = (KOTodoViewItem *) item;
1104 newSubTodo(); 1106 newSubTodo();
1105 return; 1107 return;
1106 } 1108 }
1109 if ( row == 1 ) {
1110 mActiveItem = (KOTodoViewItem *) item;
1111 toggleRunningItem();
1112 return;
1113 }
1107 } 1114 }
1108 if ( KOPrefs::instance()->mEditOnDoubleClick ) 1115 if ( KOPrefs::instance()->mEditOnDoubleClick )
1109 editItem( item ); 1116 editItem( item );
1110 else 1117 else
1111 showItem( item , QPoint(), 0 ); 1118 showItem( item , QPoint(), 0 );
1112} 1119}
1120void KOTodoView::toggleRunningItem()
1121{
1122 qDebug("KOTodoView::toggleRunning() ");
1123 if ( ! mActiveItem )
1124 return;
1125 Todo * t = mActiveItem->todo();
1126 if ( t->isRunning() ) {
1127 int result = KMessageBox::warningContinueCancel(this,
1128 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);
1129 if (result != KMessageBox::Continue) return;
1130 t->setRunning( false );
1131 mActiveItem->construct();
1132 } else {
1133 int result = KMessageBox::warningContinueCancel(this,
1134 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);
1135 if (result != KMessageBox::Continue) return;
1136 t->setRunning( true );
1137 mActiveItem->construct();
1138 }
1139}
1140
1113void KOTodoView::itemClicked(QListViewItem *item) 1141void KOTodoView::itemClicked(QListViewItem *item)
1114{ 1142{
1115 //qDebug("KOTodoView::itemClicked %d", item); 1143 //qDebug("KOTodoView::itemClicked %d", item);