-rw-r--r-- | korganizer/kotodoview.cpp | 47 | ||||
-rw-r--r-- | korganizer/kotodoview.h | 1 |
2 files changed, 31 insertions, 17 deletions
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index d79a9b9..ba94057 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp @@ -1343,2 +1343,22 @@ void KOTodoView::changedCategories(int index) } +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) @@ -1363,19 +1383,4 @@ void KOTodoView::itemDoubleClicked(QListViewItem *item) 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!")); - return; - } + toggleRunningItemQuick(); + return; } @@ -1710,2 +1715,10 @@ void KOTodoView::keyPressEvent ( QKeyEvent * e ) 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; diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h index 161ecb0..0cbc087 100644 --- a/korganizer/kotodoview.h +++ b/korganizer/kotodoview.h @@ -250,2 +250,3 @@ class KOTodoView : public KOrg::BaseView void toggleRunningItem(); + void toggleRunningItemQuick(); void paintNeeded(); |