-rw-r--r-- | korganizer/kotodoview.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 98c9bd9..8d957eb 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -1159,57 +1159,70 @@ void KOTodoView::changedCategories(int index) | |||
1159 | if ( categories.find ( colcat ) != categories.end () ) { | 1159 | if ( categories.find ( colcat ) != categories.end () ) { |
1160 | categories.remove( colcat ); | 1160 | categories.remove( colcat ); |
1161 | categories.prepend( colcat ); | 1161 | categories.prepend( colcat ); |
1162 | } | 1162 | } |
1163 | } | 1163 | } |
1164 | mActiveItem->todo()->setCategories (categories); | 1164 | mActiveItem->todo()->setCategories (categories); |
1165 | mActiveItem->construct(); | 1165 | mActiveItem->construct(); |
1166 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); | 1166 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); |
1167 | todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED); | 1167 | todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED); |
1168 | } | 1168 | } |
1169 | } | 1169 | } |
1170 | void KOTodoView::itemDoubleClicked(QListViewItem *item) | 1170 | void KOTodoView::itemDoubleClicked(QListViewItem *item) |
1171 | { | 1171 | { |
1172 | if ( pendingSubtodo != 0 ) { | 1172 | if ( pendingSubtodo != 0 ) { |
1173 | topLevelWidget()->setCaption(i18n("Reparenting aborted!")); | 1173 | topLevelWidget()->setCaption(i18n("Reparenting aborted!")); |
1174 | } | 1174 | } |
1175 | pendingSubtodo = 0; | 1175 | pendingSubtodo = 0; |
1176 | //int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() ); | 1176 | //int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() ); |
1177 | int row = mTodoListView->header()->sectionAt ( mTodoListView->viewportToContents(mTodoListView->viewport()->mapFromGlobal( QCursor::pos())) .x() ); | 1177 | int row = mTodoListView->header()->sectionAt ( mTodoListView->viewportToContents(mTodoListView->viewport()->mapFromGlobal( QCursor::pos())) .x() ); |
1178 | //qDebug("ROW %d ", row); | 1178 | //qDebug("ROW %d ", row); |
1179 | if (!item) { | 1179 | if (!item) { |
1180 | newTodo(); | 1180 | newTodo(); |
1181 | return; | 1181 | return; |
1182 | } else { | 1182 | } else { |
1183 | if ( row == 2 || row == 1 ) { | 1183 | if ( row == 1 ) { |
1184 | mActiveItem = (KOTodoViewItem *) item; | 1184 | mActiveItem = (KOTodoViewItem *) item; |
1185 | newSubTodo(); | 1185 | newSubTodo(); |
1186 | return; | 1186 | return; |
1187 | } | 1187 | } |
1188 | if ( row == 5 || row == 6 ) { | 1188 | if ( row == 5 || row == 6 || row == 2) { |
1189 | mActiveItem = (KOTodoViewItem *) item; | 1189 | mActiveItem = (KOTodoViewItem *) item; |
1190 | Todo * t = mActiveItem->todo(); | ||
1191 | if ( t->isRunning() ) { | ||
1192 | if ( t->runTime() < 15) { | ||
1193 | t->stopRunning(); | ||
1194 | mActiveItem->construct(); | ||
1195 | return; | ||
1196 | } | ||
1197 | else | ||
1190 | toggleRunningItem(); | 1198 | toggleRunningItem(); |
1191 | return; | 1199 | return; |
1200 | } else { | ||
1201 | t->setRunning( true ); | ||
1202 | mActiveItem->construct(); | ||
1203 | return; | ||
1204 | } | ||
1192 | } | 1205 | } |
1193 | } | 1206 | } |
1194 | if ( KOPrefs::instance()->mEditOnDoubleClick ) | 1207 | if ( KOPrefs::instance()->mEditOnDoubleClick ) |
1195 | editItem( item ); | 1208 | editItem( item ); |
1196 | else | 1209 | else |
1197 | showItem( item , QPoint(), 0 ); | 1210 | showItem( item , QPoint(), 0 ); |
1198 | } | 1211 | } |
1199 | void KOTodoView::toggleRunningItem() | 1212 | void KOTodoView::toggleRunningItem() |
1200 | { | 1213 | { |
1201 | // qDebug("KOTodoView::toggleRunning() "); | 1214 | // qDebug("KOTodoView::toggleRunning() "); |
1202 | if ( ! mActiveItem ) | 1215 | if ( ! mActiveItem ) |
1203 | return; | 1216 | return; |
1204 | Todo * t = mActiveItem->todo(); | 1217 | Todo * t = mActiveItem->todo(); |
1205 | if ( t->isRunning() ) { | 1218 | if ( t->isRunning() ) { |
1206 | KOStopTodoPrefs tp ( t, this ); | 1219 | KOStopTodoPrefs tp ( t, this ); |
1207 | if (QApplication::desktop()->width() < 800 ){ | 1220 | if (QApplication::desktop()->width() < 800 ){ |
1208 | int wid = tp.width(); | 1221 | int wid = tp.width(); |
1209 | int hei = tp.height(); | 1222 | int hei = tp.height(); |
1210 | int xx = (QApplication::desktop()->width()-wid)/2; | 1223 | int xx = (QApplication::desktop()->width()-wid)/2; |
1211 | int yy = (QApplication::desktop()->height()-hei)/2; | 1224 | int yy = (QApplication::desktop()->height()-hei)/2; |
1212 | tp.setGeometry( xx,yy,wid,hei ); | 1225 | tp.setGeometry( xx,yy,wid,hei ); |
1213 | } | 1226 | } |
1214 | tp.exec(); | 1227 | tp.exec(); |
1215 | mActiveItem->construct(); | 1228 | mActiveItem->construct(); |