-rw-r--r-- | korganizer/kotodoview.cpp | 45 | ||||
-rw-r--r-- | korganizer/kotodoview.h | 1 |
2 files changed, 30 insertions, 16 deletions
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index d79a9b9..ba94057 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp @@ -1341,6 +1341,26 @@ void KOTodoView::changedCategories(int index) todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED); } } +void KOTodoView::toggleRunningItemQuick() +{ + if ( !mActiveItem ) return; + Todo * t = mActiveItem->todo(); + if ( t->isRunning() ) { + if ( t->runTime() < 15) { + t->stopRunning(); + mActiveItem->construct(); + topLevelWidget()->setCaption(i18n("Todo stopped - no data saved because runtime was < 15 sec!")); + return; + } + else + toggleRunningItem(); + return; + } else { + t->setRunning( true ); + mActiveItem->construct(); + topLevelWidget()->setCaption(i18n("Todo started! Double click again to stop!")); + } +} void KOTodoView::itemDoubleClicked(QListViewItem *item) { if ( pendingSubtodo != 0 ) { @@ -1361,25 +1381,10 @@ void KOTodoView::itemDoubleClicked(QListViewItem *item) } if ( row == 5 || row == 6 || row == 2) { mActiveItem = (KOTodoViewItem *) item; - Todo * t = mActiveItem->todo(); - if ( t->isRunning() ) { - if ( t->runTime() < 15) { - t->stopRunning(); - mActiveItem->construct(); - topLevelWidget()->setCaption(i18n("Todo stopped - no data saved because runtime was < 15 sec!")); - return; - } - else - toggleRunningItem(); - return; - } else { - t->setRunning( true ); - mActiveItem->construct(); - topLevelWidget()->setCaption(i18n("Todo started! Double click again to stop!")); + toggleRunningItemQuick(); return; } } - } if ( KOPrefs::instance()->mEditOnDoubleClick ) editItem( item ); else @@ -1709,6 +1714,14 @@ void KOTodoView::keyPressEvent ( QKeyEvent * e ) } else e->ignore(); break; + case Qt::Key_R: + if (!( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) ) { + mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); + toggleRunningItemQuick(); + e->accept(); + } else + e->ignore(); + break; case Qt::Key_Escape: if ( pendingSubtodo ) { itemClicked(0); diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h index 161ecb0..0cbc087 100644 --- a/korganizer/kotodoview.h +++ b/korganizer/kotodoview.h @@ -248,6 +248,7 @@ class KOTodoView : public KOrg::BaseView protected slots: void toggleRunningItem(); + void toggleRunningItemQuick(); void paintNeeded(); void processSelectionChange(); void addQuickTodo(); |