-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 | |||
@@ -1332,61 +1332,66 @@ void KOTodoView::changedCategories(int index) | |||
1332 | if ( !colcat.isEmpty() ) { | 1332 | if ( !colcat.isEmpty() ) { |
1333 | if ( categories.find ( colcat ) != categories.end () ) { | 1333 | if ( categories.find ( colcat ) != categories.end () ) { |
1334 | categories.remove( colcat ); | 1334 | categories.remove( colcat ); |
1335 | categories.prepend( colcat ); | 1335 | categories.prepend( colcat ); |
1336 | } | 1336 | } |
1337 | } | 1337 | } |
1338 | mActiveItem->todo()->setCategories (categories); | 1338 | mActiveItem->todo()->setCategories (categories); |
1339 | mActiveItem->construct(); | 1339 | mActiveItem->construct(); |
1340 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); | 1340 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); |
1341 | todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED); | 1341 | todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED); |
1342 | } | 1342 | } |
1343 | } | 1343 | } |
1344 | void KOTodoView::toggleRunningItemQuick() | ||
1345 | { | ||
1346 | if ( !mActiveItem ) return; | ||
1347 | Todo * t = mActiveItem->todo(); | ||
1348 | if ( t->isRunning() ) { | ||
1349 | if ( t->runTime() < 15) { | ||
1350 | t->stopRunning(); | ||
1351 | mActiveItem->construct(); | ||
1352 | topLevelWidget()->setCaption(i18n("Todo stopped - no data saved because runtime was < 15 sec!")); | ||
1353 | return; | ||
1354 | } | ||
1355 | else | ||
1356 | toggleRunningItem(); | ||
1357 | return; | ||
1358 | } else { | ||
1359 | t->setRunning( true ); | ||
1360 | mActiveItem->construct(); | ||
1361 | topLevelWidget()->setCaption(i18n("Todo started! Double click again to stop!")); | ||
1362 | } | ||
1363 | } | ||
1344 | void KOTodoView::itemDoubleClicked(QListViewItem *item) | 1364 | void KOTodoView::itemDoubleClicked(QListViewItem *item) |
1345 | { | 1365 | { |
1346 | if ( pendingSubtodo != 0 ) { | 1366 | if ( pendingSubtodo != 0 ) { |
1347 | topLevelWidget()->setCaption(i18n("Reparenting aborted!")); | 1367 | topLevelWidget()->setCaption(i18n("Reparenting aborted!")); |
1348 | } | 1368 | } |
1349 | pendingSubtodo = 0; | 1369 | pendingSubtodo = 0; |
1350 | //int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() ); | 1370 | //int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() ); |
1351 | int row = mTodoListView->header()->sectionAt ( mTodoListView->viewportToContents(mTodoListView->viewport()->mapFromGlobal( QCursor::pos())) .x() ); | 1371 | int row = mTodoListView->header()->sectionAt ( mTodoListView->viewportToContents(mTodoListView->viewport()->mapFromGlobal( QCursor::pos())) .x() ); |
1352 | //qDebug("ROW %d ", row); | 1372 | //qDebug("ROW %d ", row); |
1353 | if (!item) { | 1373 | if (!item) { |
1354 | newTodo(); | 1374 | newTodo(); |
1355 | return; | 1375 | return; |
1356 | } else { | 1376 | } else { |
1357 | if ( row == 1 ) { | 1377 | if ( row == 1 ) { |
1358 | mActiveItem = (KOTodoViewItem *) item; | 1378 | mActiveItem = (KOTodoViewItem *) item; |
1359 | newSubTodo(); | 1379 | newSubTodo(); |
1360 | return; | 1380 | return; |
1361 | } | 1381 | } |
1362 | if ( row == 5 || row == 6 || row == 2) { | 1382 | if ( row == 5 || row == 6 || row == 2) { |
1363 | mActiveItem = (KOTodoViewItem *) item; | 1383 | mActiveItem = (KOTodoViewItem *) item; |
1364 | Todo * t = mActiveItem->todo(); | 1384 | toggleRunningItemQuick(); |
1365 | if ( t->isRunning() ) { | 1385 | return; |
1366 | if ( t->runTime() < 15) { | ||
1367 | t->stopRunning(); | ||
1368 | mActiveItem->construct(); | ||
1369 | topLevelWidget()->setCaption(i18n("Todo stopped - no data saved because runtime was < 15 sec!")); | ||
1370 | return; | ||
1371 | } | ||
1372 | else | ||
1373 | toggleRunningItem(); | ||
1374 | return; | ||
1375 | } else { | ||
1376 | t->setRunning( true ); | ||
1377 | mActiveItem->construct(); | ||
1378 | topLevelWidget()->setCaption(i18n("Todo started! Double click again to stop!")); | ||
1379 | return; | ||
1380 | } | ||
1381 | } | 1386 | } |
1382 | } | 1387 | } |
1383 | if ( KOPrefs::instance()->mEditOnDoubleClick ) | 1388 | if ( KOPrefs::instance()->mEditOnDoubleClick ) |
1384 | editItem( item ); | 1389 | editItem( item ); |
1385 | else | 1390 | else |
1386 | showItem( item , QPoint(), 0 ); | 1391 | showItem( item , QPoint(), 0 ); |
1387 | } | 1392 | } |
1388 | void KOTodoView::toggleRunningItem() | 1393 | void KOTodoView::toggleRunningItem() |
1389 | { | 1394 | { |
1390 | // qDebug("KOTodoView::toggleRunning() "); | 1395 | // qDebug("KOTodoView::toggleRunning() "); |
1391 | if ( ! mActiveItem ) | 1396 | if ( ! mActiveItem ) |
1392 | return; | 1397 | return; |
@@ -1699,24 +1704,32 @@ void KOTodoView::keyPressEvent ( QKeyEvent * e ) | |||
1699 | e->accept(); | 1704 | e->accept(); |
1700 | } else | 1705 | } else |
1701 | e->ignore(); | 1706 | e->ignore(); |
1702 | break; | 1707 | break; |
1703 | case Qt::Key_P: | 1708 | case Qt::Key_P: |
1704 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { | 1709 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) { |
1705 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); | 1710 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); |
1706 | if ( pendingSubtodo ) | 1711 | if ( pendingSubtodo ) |
1707 | itemClicked(mActiveItem); | 1712 | itemClicked(mActiveItem); |
1708 | e->accept(); | 1713 | e->accept(); |
1709 | } else | 1714 | } else |
1710 | e->ignore(); | 1715 | e->ignore(); |
1716 | break; | ||
1717 | case Qt::Key_R: | ||
1718 | if (!( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) ) { | ||
1719 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); | ||
1720 | toggleRunningItemQuick(); | ||
1721 | e->accept(); | ||
1722 | } else | ||
1723 | e->ignore(); | ||
1711 | break; | 1724 | break; |
1712 | case Qt::Key_Escape: | 1725 | case Qt::Key_Escape: |
1713 | if ( pendingSubtodo ) { | 1726 | if ( pendingSubtodo ) { |
1714 | itemClicked(0); | 1727 | itemClicked(0); |
1715 | e->accept(); | 1728 | e->accept(); |
1716 | } else | 1729 | } else |
1717 | e->ignore(); | 1730 | e->ignore(); |
1718 | break; | 1731 | break; |
1719 | default: | 1732 | default: |
1720 | e->ignore(); | 1733 | e->ignore(); |
1721 | } | 1734 | } |
1722 | 1735 | ||
diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h index 161ecb0..0cbc087 100644 --- a/korganizer/kotodoview.h +++ b/korganizer/kotodoview.h | |||
@@ -239,24 +239,25 @@ class KOTodoView : public KOrg::BaseView | |||
239 | void deleteTodoSignal(Todo *); | 239 | void deleteTodoSignal(Todo *); |
240 | void todoModifiedSignal (Todo *, int); | 240 | void todoModifiedSignal (Todo *, int); |
241 | 241 | ||
242 | void isModified(bool); | 242 | void isModified(bool); |
243 | void cloneTodoSignal( Incidence * ); | 243 | void cloneTodoSignal( Incidence * ); |
244 | void cancelTodoSignal( Incidence * ); | 244 | void cancelTodoSignal( Incidence * ); |
245 | void moveTodoSignal( Incidence * ); | 245 | void moveTodoSignal( Incidence * ); |
246 | void beamTodoSignal( Incidence * ); | 246 | void beamTodoSignal( Incidence * ); |
247 | void purgeCompletedSignal(); | 247 | void purgeCompletedSignal(); |
248 | 248 | ||
249 | protected slots: | 249 | protected slots: |
250 | void toggleRunningItem(); | 250 | void toggleRunningItem(); |
251 | void toggleRunningItemQuick(); | ||
251 | void paintNeeded(); | 252 | void paintNeeded(); |
252 | void processSelectionChange(); | 253 | void processSelectionChange(); |
253 | void addQuickTodo(); | 254 | void addQuickTodo(); |
254 | void setTodoModified( Todo* ); | 255 | void setTodoModified( Todo* ); |
255 | void todoModified(Todo *, int ); | 256 | void todoModified(Todo *, int ); |
256 | 257 | ||
257 | private: | 258 | private: |
258 | bool mIsActiveWindow; | 259 | bool mIsActiveWindow; |
259 | void addQuickTodoPar( Todo * parentTodo); | 260 | void addQuickTodoPar( Todo * parentTodo); |
260 | /* | 261 | /* |
261 | * the TodoEditor approach is rather unscaling in the long | 262 | * the TodoEditor approach is rather unscaling in the long |
262 | * run. | 263 | * run. |