-rw-r--r-- | korganizer/kotodoview.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 86e1bd9..a87e6fc 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -1109,120 +1109,123 @@ void KOTodoView::editTodo() | |||
1109 | void KOTodoView::cloneTodo() | 1109 | void KOTodoView::cloneTodo() |
1110 | { | 1110 | { |
1111 | if (mActiveItem) { | 1111 | if (mActiveItem) { |
1112 | emit cloneTodoSignal((Incidence*)mActiveItem->todo()); | 1112 | emit cloneTodoSignal((Incidence*)mActiveItem->todo()); |
1113 | } | 1113 | } |
1114 | } | 1114 | } |
1115 | void KOTodoView::cancelTodo() | 1115 | void KOTodoView::cancelTodo() |
1116 | { | 1116 | { |
1117 | if (mActiveItem) { | 1117 | if (mActiveItem) { |
1118 | emit cancelTodoSignal((Incidence*)mActiveItem->todo()); | 1118 | emit cancelTodoSignal((Incidence*)mActiveItem->todo()); |
1119 | } | 1119 | } |
1120 | } | 1120 | } |
1121 | void KOTodoView::moveTodo() | 1121 | void KOTodoView::moveTodo() |
1122 | { | 1122 | { |
1123 | if (mActiveItem) { | 1123 | if (mActiveItem) { |
1124 | emit moveTodoSignal((Incidence*)mActiveItem->todo()); | 1124 | emit moveTodoSignal((Incidence*)mActiveItem->todo()); |
1125 | } | 1125 | } |
1126 | } | 1126 | } |
1127 | void KOTodoView::beamTodo() | 1127 | void KOTodoView::beamTodo() |
1128 | { | 1128 | { |
1129 | if (mActiveItem) { | 1129 | if (mActiveItem) { |
1130 | emit beamTodoSignal((Incidence*)mActiveItem->todo()); | 1130 | emit beamTodoSignal((Incidence*)mActiveItem->todo()); |
1131 | } | 1131 | } |
1132 | } | 1132 | } |
1133 | 1133 | ||
1134 | 1134 | ||
1135 | void KOTodoView::showTodo() | 1135 | void KOTodoView::showTodo() |
1136 | { | 1136 | { |
1137 | if (mActiveItem) { | 1137 | if (mActiveItem) { |
1138 | emit showTodoSignal(mActiveItem->todo()); | 1138 | emit showTodoSignal(mActiveItem->todo()); |
1139 | } | 1139 | } |
1140 | } | 1140 | } |
1141 | 1141 | ||
1142 | void KOTodoView::deleteTodo() | 1142 | void KOTodoView::deleteTodo() |
1143 | { | 1143 | { |
1144 | if (mActiveItem) { | 1144 | if (mActiveItem) { |
1145 | emit deleteTodoSignal(mActiveItem->todo()); | 1145 | emit deleteTodoSignal(mActiveItem->todo()); |
1146 | } | 1146 | } |
1147 | } | 1147 | } |
1148 | 1148 | ||
1149 | void KOTodoView::setNewPriority(int index) | 1149 | void KOTodoView::setNewPriority(int index) |
1150 | { | 1150 | { |
1151 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { | 1151 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { |
1152 | mActiveItem->todo()->setPriority(mPriority[index]); | 1152 | mActiveItem->todo()->setPriority(mPriority[index]); |
1153 | mActiveItem->construct(); | 1153 | mActiveItem->construct(); |
1154 | todoModified (mActiveItem->todo(), KOGlobals::PRIORITY_MODIFIED); | 1154 | todoModified (mActiveItem->todo(), KOGlobals::PRIORITY_MODIFIED); |
1155 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); | 1155 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); |
1156 | } | 1156 | } |
1157 | processSelectionChange(); | ||
1157 | } | 1158 | } |
1158 | 1159 | ||
1159 | void KOTodoView::setNewPercentage(int index) | 1160 | void KOTodoView::setNewPercentage(int index) |
1160 | { | 1161 | { |
1161 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { | 1162 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { |
1162 | 1163 | ||
1163 | if ( mPercentage[index] == 100 && !mActiveItem->isOn() ) { | 1164 | if ( mPercentage[index] == 100 && !mActiveItem->isOn() ) { |
1164 | mActiveItem->setOn( true ); | 1165 | mActiveItem->setOn( true ); |
1166 | processSelectionChange(); | ||
1165 | return; | 1167 | return; |
1166 | } else if ( mPercentage[index] != 100 && mActiveItem->isOn() ) { | 1168 | } else if ( mPercentage[index] != 100 && mActiveItem->isOn() ) { |
1167 | KOTodoViewItem* par = (static_cast<KOTodoViewItem*>(mActiveItem->parent())); | 1169 | KOTodoViewItem* par = (static_cast<KOTodoViewItem*>(mActiveItem->parent())); |
1168 | if ( par && par->isOn() ) | 1170 | if ( par && par->isOn() ) |
1169 | par->setOn( false ); | 1171 | par->setOn( false ); |
1170 | } | 1172 | } |
1171 | if (mPercentage[index] == 100) { | 1173 | if (mPercentage[index] == 100) { |
1172 | mActiveItem->todo()->setCompleted(QDateTime::currentDateTime()); | 1174 | mActiveItem->todo()->setCompleted(QDateTime::currentDateTime()); |
1173 | } else { | 1175 | } else { |
1174 | mActiveItem->todo()->setCompleted(false); | 1176 | mActiveItem->todo()->setCompleted(false); |
1175 | } | 1177 | } |
1176 | mActiveItem->todo()->setPercentComplete(mPercentage[index]); | 1178 | mActiveItem->todo()->setPercentComplete(mPercentage[index]); |
1177 | mActiveItem->construct(); | 1179 | mActiveItem->construct(); |
1178 | todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED); | 1180 | todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED); |
1179 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); | 1181 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); |
1180 | } | 1182 | } |
1183 | processSelectionChange(); | ||
1181 | } | 1184 | } |
1182 | 1185 | ||
1183 | void KOTodoView::fillCategories () | 1186 | void KOTodoView::fillCategories () |
1184 | { | 1187 | { |
1185 | mCategoryPopupMenu->clear(); | 1188 | mCategoryPopupMenu->clear(); |
1186 | if ( ! mActiveItem ) return; | 1189 | if ( ! mActiveItem ) return; |
1187 | QStringList checkedCategories = mActiveItem->todo()->categories (); | 1190 | QStringList checkedCategories = mActiveItem->todo()->categories (); |
1188 | for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); | 1191 | for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); |
1189 | it != KOPrefs::instance()->mCustomCategories.end (); | 1192 | it != KOPrefs::instance()->mCustomCategories.end (); |
1190 | ++it) { | 1193 | ++it) { |
1191 | int index = mCategoryPopupMenu->insertItem (*it); | 1194 | int index = mCategoryPopupMenu->insertItem (*it); |
1192 | mCategory[index] = *it; | 1195 | mCategory[index] = *it; |
1193 | if (checkedCategories.find (*it) != checkedCategories.end ()) mCategoryPopupMenu->setItemChecked (index, true); | 1196 | if (checkedCategories.find (*it) != checkedCategories.end ()) mCategoryPopupMenu->setItemChecked (index, true); |
1194 | } | 1197 | } |
1195 | } | 1198 | } |
1196 | void KOTodoView::fillCal () | 1199 | void KOTodoView::fillCal () |
1197 | { | 1200 | { |
1198 | mCalPopupMenu->clear(); | 1201 | mCalPopupMenu->clear(); |
1199 | if (!mActiveItem) return; | 1202 | if (!mActiveItem) return; |
1200 | bool readO = mActiveItem->todo()->isReadOnly(); | 1203 | bool readO = mActiveItem->todo()->isReadOnly(); |
1201 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); | 1204 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); |
1202 | while ( kkf ) { | 1205 | while ( kkf ) { |
1203 | int index = mCalPopupMenu->insertItem( kkf->mName, kkf->mCalNumber); | 1206 | int index = mCalPopupMenu->insertItem( kkf->mName, kkf->mCalNumber); |
1204 | if ( kkf->mErrorOnLoad || kkf->isReadOnly || readO ) | 1207 | if ( kkf->mErrorOnLoad || kkf->isReadOnly || readO ) |
1205 | mCalPopupMenu->setItemEnabled( index, false ); | 1208 | mCalPopupMenu->setItemEnabled( index, false ); |
1206 | mCalPopupMenu->setItemChecked (index, kkf->mCalNumber == mActiveItem->todo()->calID()); | 1209 | mCalPopupMenu->setItemChecked (index, kkf->mCalNumber == mActiveItem->todo()->calID()); |
1207 | kkf = KOPrefs::instance()->mCalendars.next(); | 1210 | kkf = KOPrefs::instance()->mCalendars.next(); |
1208 | } | 1211 | } |
1209 | } | 1212 | } |
1210 | void KOTodoView::changedCal (int index ) | 1213 | void KOTodoView::changedCal (int index ) |
1211 | { | 1214 | { |
1212 | if (!mActiveItem) return; | 1215 | if (!mActiveItem) return; |
1213 | mActiveItem->todo()->setCalID( index ); | 1216 | mActiveItem->todo()->setCalID( index ); |
1214 | mActiveItem->construct(); | 1217 | mActiveItem->construct(); |
1215 | } | 1218 | } |
1216 | void KOTodoView::changedCategories(int index) | 1219 | void KOTodoView::changedCategories(int index) |
1217 | { | 1220 | { |
1218 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { | 1221 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { |
1219 | QStringList categories = mActiveItem->todo()->categories (); | 1222 | QStringList categories = mActiveItem->todo()->categories (); |
1220 | QString colcat = categories.first(); | 1223 | QString colcat = categories.first(); |
1221 | if (categories.find (mCategory[index]) != categories.end ()) | 1224 | if (categories.find (mCategory[index]) != categories.end ()) |
1222 | categories.remove (mCategory[index]); | 1225 | categories.remove (mCategory[index]); |
1223 | else | 1226 | else |
1224 | categories.insert (categories.end(), mCategory[index]); | 1227 | categories.insert (categories.end(), mCategory[index]); |
1225 | categories.sort (); | 1228 | categories.sort (); |
1226 | if ( !colcat.isEmpty() ) { | 1229 | if ( !colcat.isEmpty() ) { |
1227 | if ( categories.find ( colcat ) != categories.end () ) { | 1230 | if ( categories.find ( colcat ) != categories.end () ) { |
1228 | categories.remove( colcat ); | 1231 | categories.remove( colcat ); |