-rw-r--r-- | korganizer/koagendaview.cpp | 16 | ||||
-rw-r--r-- | korganizer/koeventviewer.cpp | 5 | ||||
-rw-r--r-- | korganizer/koeventviewerdialog.cpp | 1 |
3 files changed, 17 insertions, 5 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index e0a1a21..1864e22 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp | |||
@@ -1024,272 +1024,278 @@ void KOAgendaView::fillAgenda(const QDate &) | |||
1024 | 1024 | ||
1025 | void KOAgendaView::fillAgenda() | 1025 | void KOAgendaView::fillAgenda() |
1026 | { | 1026 | { |
1027 | if ( globalFlagBlockStartup ) | 1027 | if ( globalFlagBlockStartup ) |
1028 | return; | 1028 | return; |
1029 | if ( globalFlagBlockAgenda == 1 ) | 1029 | if ( globalFlagBlockAgenda == 1 ) |
1030 | return; | 1030 | return; |
1031 | //if ( globalFlagBlockAgenda == 2 ) | 1031 | //if ( globalFlagBlockAgenda == 2 ) |
1032 | //globalFlagBlockAgenda = 0; | 1032 | //globalFlagBlockAgenda = 0; |
1033 | // globalFlagBlockPainting = false; | 1033 | // globalFlagBlockPainting = false; |
1034 | if ( globalFlagBlockAgenda == 0 ) | 1034 | if ( globalFlagBlockAgenda == 0 ) |
1035 | globalFlagBlockAgenda = 1; | 1035 | globalFlagBlockAgenda = 1; |
1036 | // clearView(); | 1036 | // clearView(); |
1037 | //qDebug("fillAgenda()++++ "); | 1037 | //qDebug("fillAgenda()++++ "); |
1038 | globalFlagBlockAgendaItemPaint = 1; | 1038 | globalFlagBlockAgendaItemPaint = 1; |
1039 | mAllDayAgenda->changeColumns(mSelectedDates.count()); | 1039 | mAllDayAgenda->changeColumns(mSelectedDates.count()); |
1040 | mAgenda->changeColumns(mSelectedDates.count()); | 1040 | mAgenda->changeColumns(mSelectedDates.count()); |
1041 | qApp->processEvents(); | 1041 | qApp->processEvents(); |
1042 | mEventIndicatorTop->changeColumns(mSelectedDates.count()); | 1042 | mEventIndicatorTop->changeColumns(mSelectedDates.count()); |
1043 | mEventIndicatorBottom->changeColumns(mSelectedDates.count()); | 1043 | mEventIndicatorBottom->changeColumns(mSelectedDates.count()); |
1044 | setHolidayMasks(); | 1044 | setHolidayMasks(); |
1045 | 1045 | ||
1046 | //mAgenda->hideUnused(); | 1046 | //mAgenda->hideUnused(); |
1047 | //mAllDayAgenda->hideUnused(); | 1047 | //mAllDayAgenda->hideUnused(); |
1048 | 1048 | ||
1049 | // mAgenda->blockNextRepaint( false ); | 1049 | // mAgenda->blockNextRepaint( false ); |
1050 | // mAgenda->viewport()->repaint(); | 1050 | // mAgenda->viewport()->repaint(); |
1051 | // mAgenda->blockNextRepaint( true ); | 1051 | // mAgenda->blockNextRepaint( true ); |
1052 | mMinY.resize(mSelectedDates.count()); | 1052 | mMinY.resize(mSelectedDates.count()); |
1053 | mMaxY.resize(mSelectedDates.count()); | 1053 | mMaxY.resize(mSelectedDates.count()); |
1054 | 1054 | ||
1055 | QPtrList<Event> dayEvents; | 1055 | QPtrList<Event> dayEvents; |
1056 | 1056 | ||
1057 | // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. | 1057 | // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. |
1058 | // Therefore, get all of them. | 1058 | // Therefore, get all of them. |
1059 | QPtrList<Todo> todos = calendar()->todos(); | 1059 | QPtrList<Todo> todos = calendar()->todos(); |
1060 | 1060 | ||
1061 | mAgenda->setDateList(mSelectedDates); | 1061 | mAgenda->setDateList(mSelectedDates); |
1062 | 1062 | ||
1063 | QDate today = QDate::currentDate(); | 1063 | QDate today = QDate::currentDate(); |
1064 | 1064 | ||
1065 | DateList::ConstIterator dit; | 1065 | DateList::ConstIterator dit; |
1066 | int curCol = 0; | 1066 | int curCol = 0; |
1067 | for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { | 1067 | for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { |
1068 | QDate currentDate = *dit; | 1068 | QDate currentDate = *dit; |
1069 | // kdDebug() << "KOAgendaView::fillAgenda(): " << currentDate.toString() | 1069 | // kdDebug() << "KOAgendaView::fillAgenda(): " << currentDate.toString() |
1070 | // << endl; | 1070 | // << endl; |
1071 | 1071 | ||
1072 | dayEvents = calendar()->events(currentDate,true); | 1072 | dayEvents = calendar()->events(currentDate,true); |
1073 | 1073 | ||
1074 | // Default values, which can never be reached | 1074 | // Default values, which can never be reached |
1075 | mMinY[curCol] = mAgenda->timeToY(QTime(23,59)) + 1; | 1075 | mMinY[curCol] = mAgenda->timeToY(QTime(23,59)) + 1; |
1076 | mMaxY[curCol] = mAgenda->timeToY(QTime(0,0)) - 1; | 1076 | mMaxY[curCol] = mAgenda->timeToY(QTime(0,0)) - 1; |
1077 | 1077 | ||
1078 | unsigned int numEvent; | 1078 | unsigned int numEvent; |
1079 | for(numEvent=0;numEvent<dayEvents.count();++numEvent) { | 1079 | for(numEvent=0;numEvent<dayEvents.count();++numEvent) { |
1080 | Event *event = dayEvents.at(numEvent); | 1080 | Event *event = dayEvents.at(numEvent); |
1081 | if ( !KOPrefs::instance()->mShowSyncEvents && event->uid().left(2) == QString("la") ) | 1081 | if ( !KOPrefs::instance()->mShowSyncEvents && event->uid().left(2) == QString("la") ) |
1082 | if ( event->uid().left(15) == QString("last-syncEvent-") ) | 1082 | if ( event->uid().left(15) == QString("last-syncEvent-") ) |
1083 | continue; | 1083 | continue; |
1084 | // kdDebug() << " Event: " << event->summary() << endl; | 1084 | // kdDebug() << " Event: " << event->summary() << endl; |
1085 | 1085 | ||
1086 | int beginX = currentDate.daysTo(event->dtStart().date()) + curCol; | 1086 | int beginX = currentDate.daysTo(event->dtStart().date()) + curCol; |
1087 | int endX = currentDate.daysTo(event->dtEnd().date()) + curCol; | 1087 | int endX = currentDate.daysTo(event->dtEnd().date()) + curCol; |
1088 | 1088 | ||
1089 | // kdDebug() << " beginX: " << beginX << " endX: " << endX << endl; | 1089 | // kdDebug() << " beginX: " << beginX << " endX: " << endX << endl; |
1090 | 1090 | ||
1091 | if (event->doesFloat()) { | 1091 | if (event->doesFloat()) { |
1092 | if (event->recurrence()->doesRecur()) { | 1092 | if (event->recurrence()->doesRecur()) { |
1093 | mAllDayAgenda->insertAllDayItem(event,currentDate,curCol,curCol); | 1093 | mAllDayAgenda->insertAllDayItem(event,currentDate,curCol,curCol); |
1094 | } else { | 1094 | } else { |
1095 | if (beginX <= 0 && curCol == 0) { | 1095 | if (beginX <= 0 && curCol == 0) { |
1096 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); | 1096 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); |
1097 | } else if (beginX == curCol) { | 1097 | } else if (beginX == curCol) { |
1098 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); | 1098 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); |
1099 | } | 1099 | } |
1100 | } | 1100 | } |
1101 | } else if (event->isMultiDay()) { | 1101 | } else if (event->isMultiDay()) { |
1102 | if ( event->doesRecur () ) { | 1102 | if ( event->doesRecur () ) { |
1103 | QDate dateit = currentDate; | 1103 | QDate dateit = currentDate; |
1104 | int count = 0; | 1104 | int count = 0; |
1105 | int max = event->dtStart().daysTo( event->dtEnd() ) +2; | 1105 | int max = event->dtStart().daysTo( event->dtEnd() ) +2; |
1106 | while (! event->recursOn( dateit ) && count <= max ) { | 1106 | while (! event->recursOn( dateit ) && count <= max ) { |
1107 | ++count; | 1107 | ++count; |
1108 | dateit = dateit.addDays( -1 ); | 1108 | dateit = dateit.addDays( -1 ); |
1109 | } | 1109 | } |
1110 | bool ok; | 1110 | bool ok; |
1111 | QDateTime nextOcstart = event->getNextOccurence( QDateTime(dateit) ,&ok ); | 1111 | QDateTime nextOcstart = event->getNextOccurence( QDateTime(dateit) ,&ok ); |
1112 | if ( ok ) | 1112 | if ( ok ) |
1113 | { | 1113 | { |
1114 | int secs = event->dtStart().secsTo( event->dtEnd() ); | 1114 | int secs = event->dtStart().secsTo( event->dtEnd() ); |
1115 | QDateTime nextOcend =nextOcstart.addSecs( secs ); ; | 1115 | QDateTime nextOcend =nextOcstart.addSecs( secs ); ; |
1116 | beginX = currentDate.daysTo(nextOcstart.date()) + curCol; | 1116 | beginX = currentDate.daysTo(nextOcstart.date()) + curCol; |
1117 | endX = currentDate.daysTo(nextOcend.date()) + curCol; | 1117 | endX = currentDate.daysTo(nextOcend.date()) + curCol; |
1118 | 1118 | ||
1119 | } | 1119 | } |
1120 | } | 1120 | } |
1121 | int startY = mAgenda->timeToY(event->dtStart().time()); | 1121 | int startY = mAgenda->timeToY(event->dtStart().time()); |
1122 | int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; | 1122 | int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; |
1123 | //qDebug("insert %d %d %d %d %d ",beginX,endX,startY,endY , curCol ); | 1123 | //qDebug("insert %d %d %d %d %d ",beginX,endX,startY,endY , curCol ); |
1124 | if ((beginX <= 0 && curCol == 0) || beginX == curCol) { | 1124 | if ((beginX <= 0 && curCol == 0) || beginX == curCol) { |
1125 | //qDebug("insert!!! "); | 1125 | //qDebug("insert!!! "); |
1126 | mAgenda->insertMultiItem(event,currentDate,beginX,endX,startY,endY); | 1126 | mAgenda->insertMultiItem(event,currentDate,beginX,endX,startY,endY); |
1127 | } | 1127 | } |
1128 | if (beginX == curCol) { | 1128 | if (beginX == curCol) { |
1129 | mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); | 1129 | mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); |
1130 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; | 1130 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; |
1131 | } else if (endX == curCol) { | 1131 | } else if (endX == curCol) { |
1132 | mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); | 1132 | mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); |
1133 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; | 1133 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; |
1134 | } else { | 1134 | } else { |
1135 | mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); | 1135 | mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); |
1136 | mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); | 1136 | mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); |
1137 | } | 1137 | } |
1138 | } else { | 1138 | } else { |
1139 | int startY = mAgenda->timeToY(event->dtStart().time()); | 1139 | int startY = mAgenda->timeToY(event->dtStart().time()); |
1140 | int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; | 1140 | int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; |
1141 | if (endY < startY) endY = startY; | 1141 | if (endY < startY) endY = startY; |
1142 | mAgenda->insertItem(event,currentDate,curCol,startY,endY); | 1142 | mAgenda->insertItem(event,currentDate,curCol,startY,endY); |
1143 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; | 1143 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; |
1144 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; | 1144 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; |
1145 | } | 1145 | } |
1146 | } | 1146 | } |
1147 | // ---------- [display Todos -------------- | 1147 | // ---------- [display Todos -------------- |
1148 | unsigned int numTodo; | 1148 | unsigned int numTodo; |
1149 | for (numTodo = 0; numTodo < todos.count(); ++numTodo) { | 1149 | for (numTodo = 0; numTodo < todos.count(); ++numTodo) { |
1150 | Todo *todo = todos.at(numTodo); | 1150 | Todo *todo = todos.at(numTodo); |
1151 | 1151 | ||
1152 | if ( ! todo->hasDueDate() ) continue; // todo shall not be displayed if it has no date | 1152 | if ( ! todo->hasDueDate() && !todo->hasCompletedDate()) continue; // todo shall not be displayed if it has no date |
1153 | 1153 | ||
1154 | // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. | 1154 | // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. |
1155 | // Already completed items can be displayed on their original due date | 1155 | // Already completed items can be displayed on their original due date |
1156 | //if not KOPrefs::instance()->mShowTodoInAgenda, show overdue in agenda | 1156 | //if not KOPrefs::instance()->mShowTodoInAgenda, show overdue in agenda |
1157 | bool overdue = (!todo->isCompleted()) && (todo->dtDue() < today) && KOPrefs::instance()->mShowTodoInAgenda; | 1157 | bool overdue = (!todo->isCompleted()) && (todo->dtDue() < today) && KOPrefs::instance()->mShowTodoInAgenda; |
1158 | 1158 | ||
1159 | if ( ((todo->dtDue().date() == currentDate) && !overdue) || | 1159 | if ( ((todo->dtDue().date() == currentDate) && !overdue) || ( todo->hasCompletedDate() && todo->completed().date() == currentDate )|| |
1160 | ((currentDate == today) && overdue) ) { | 1160 | ((currentDate == today) && overdue) ) { |
1161 | if ( todo->doesFloat() || overdue ) { // Todo has no due-time set or is already overdue | 1161 | if ( (todo->doesFloat() || overdue ) && !todo->hasCompletedDate() ) { // Todo has no due-time set or is already overdue |
1162 | if ( KOPrefs::instance()->mShowTodoInAgenda ) | 1162 | if ( KOPrefs::instance()->mShowTodoInAgenda ) |
1163 | mAllDayAgenda->insertAllDayItem(todo, currentDate, curCol, curCol); | 1163 | mAllDayAgenda->insertAllDayItem(todo, currentDate, curCol, curCol); |
1164 | } | 1164 | } |
1165 | else { | 1165 | else { |
1166 | 1166 | QDateTime dt; | |
1167 | int endY = mAgenda->timeToY(todo->dtDue().time()) - 1; | 1167 | if ( todo->hasCompletedDate() ) |
1168 | dt = todo->completed(); | ||
1169 | else | ||
1170 | dt = todo->dtDue();; | ||
1171 | |||
1172 | |||
1173 | int endY = mAgenda->timeToY(dt.time()) - 1; | ||
1168 | int hi = (18/KOPrefs::instance()->mHourSize); | 1174 | int hi = (18/KOPrefs::instance()->mHourSize); |
1169 | //qDebug("hei %d ",KOPrefs::instance()->mHourSize); | 1175 | //qDebug("hei %d ",KOPrefs::instance()->mHourSize); |
1170 | int startY = endY -hi; | 1176 | int startY = endY -hi; |
1171 | 1177 | ||
1172 | mAgenda->insertItem(todo,currentDate,curCol,startY,endY); | 1178 | mAgenda->insertItem(todo,currentDate,curCol,startY,endY); |
1173 | 1179 | ||
1174 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; | 1180 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; |
1175 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; | 1181 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; |
1176 | } | 1182 | } |
1177 | } | 1183 | } |
1178 | } | 1184 | } |
1179 | // ---------- display Todos] -------------- | 1185 | // ---------- display Todos] -------------- |
1180 | 1186 | ||
1181 | ++curCol; | 1187 | ++curCol; |
1182 | } | 1188 | } |
1183 | mAgenda->hideUnused(); | 1189 | mAgenda->hideUnused(); |
1184 | mAllDayAgenda->hideUnused(); | 1190 | mAllDayAgenda->hideUnused(); |
1185 | mAgenda->checkScrollBoundaries(); | 1191 | mAgenda->checkScrollBoundaries(); |
1186 | 1192 | ||
1187 | deleteSelectedDateTime(); | 1193 | deleteSelectedDateTime(); |
1188 | 1194 | ||
1189 | createDayLabels(); | 1195 | createDayLabels(); |
1190 | emit incidenceSelected( 0 ); | 1196 | emit incidenceSelected( 0 ); |
1191 | 1197 | ||
1192 | if ( globalFlagBlockAgenda == 2 ) { | 1198 | if ( globalFlagBlockAgenda == 2 ) { |
1193 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) | 1199 | if ( KOPrefs::instance()->mSetTimeToDayStartAt ) |
1194 | setStartHour( KOPrefs::instance()->mDayBegins ); | 1200 | setStartHour( KOPrefs::instance()->mDayBegins ); |
1195 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) | 1201 | else if ( KOPrefs::instance()->mCenterOnCurrentTime ) |
1196 | setStartHour( QTime::currentTime ().hour() ); | 1202 | setStartHour( QTime::currentTime ().hour() ); |
1197 | // qApp->processEvents(); | 1203 | // qApp->processEvents(); |
1198 | } | 1204 | } |
1199 | qApp->processEvents(); | 1205 | qApp->processEvents(); |
1200 | //qDebug("qApp->processEvents(); END "); | 1206 | //qDebug("qApp->processEvents(); END "); |
1201 | globalFlagBlockAgenda = 0; | 1207 | globalFlagBlockAgenda = 0; |
1202 | 1208 | ||
1203 | // mAgenda->hideUnused(); | 1209 | // mAgenda->hideUnused(); |
1204 | //mAllDayAgenda->hideUnused(); | 1210 | //mAllDayAgenda->hideUnused(); |
1205 | mAllDayAgenda->drawContentsToPainter(); | 1211 | mAllDayAgenda->drawContentsToPainter(); |
1206 | mAgenda->drawContentsToPainter(); | 1212 | mAgenda->drawContentsToPainter(); |
1207 | repaintAgenda(); | 1213 | repaintAgenda(); |
1208 | // mAgenda->finishUpdate(); | 1214 | // mAgenda->finishUpdate(); |
1209 | //mAllDayAgenda->finishUpdate(); | 1215 | //mAllDayAgenda->finishUpdate(); |
1210 | 1216 | ||
1211 | // repaintAgenda(); | 1217 | // repaintAgenda(); |
1212 | //qApp->processEvents(); | 1218 | //qApp->processEvents(); |
1213 | // globalFlagBlockAgenda = 0; | 1219 | // globalFlagBlockAgenda = 0; |
1214 | } | 1220 | } |
1215 | void KOAgendaView::repaintAgenda() | 1221 | void KOAgendaView::repaintAgenda() |
1216 | { | 1222 | { |
1217 | // mAllDayAgenda->drawContentsToPainter(); | 1223 | // mAllDayAgenda->drawContentsToPainter(); |
1218 | // mAllDayAgenda->viewport()->repaint( false ); | 1224 | // mAllDayAgenda->viewport()->repaint( false ); |
1219 | // mAgenda->drawContentsToPainter(); | 1225 | // mAgenda->drawContentsToPainter(); |
1220 | // mAgenda->viewport()->repaint( false ); | 1226 | // mAgenda->viewport()->repaint( false ); |
1221 | // qApp->processEvents(); | 1227 | // qApp->processEvents(); |
1222 | 1228 | ||
1223 | //qDebug("KOAgendaView::repaintAgenda() "); | 1229 | //qDebug("KOAgendaView::repaintAgenda() "); |
1224 | //qApp->processEvents(); | 1230 | //qApp->processEvents(); |
1225 | mAgenda->viewport()->repaint( false ); | 1231 | mAgenda->viewport()->repaint( false ); |
1226 | mAllDayAgenda->viewport()->repaint( false ); | 1232 | mAllDayAgenda->viewport()->repaint( false ); |
1227 | mAgenda->finishUpdate(); | 1233 | mAgenda->finishUpdate(); |
1228 | mAllDayAgenda->finishUpdate(); | 1234 | mAllDayAgenda->finishUpdate(); |
1229 | } | 1235 | } |
1230 | 1236 | ||
1231 | 1237 | ||
1232 | void KOAgendaView::clearView() | 1238 | void KOAgendaView::clearView() |
1233 | { | 1239 | { |
1234 | // kdDebug() << "ClearView" << endl; | 1240 | // kdDebug() << "ClearView" << endl; |
1235 | mAllDayAgenda->clear(); | 1241 | mAllDayAgenda->clear(); |
1236 | mAgenda->clear(); | 1242 | mAgenda->clear(); |
1237 | } | 1243 | } |
1238 | 1244 | ||
1239 | void KOAgendaView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 1245 | void KOAgendaView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
1240 | const QDate &td) | 1246 | const QDate &td) |
1241 | { | 1247 | { |
1242 | #ifndef KORG_NOPRINTER | 1248 | #ifndef KORG_NOPRINTER |
1243 | if (fd == td) | 1249 | if (fd == td) |
1244 | calPrinter->preview(CalPrinter::Day, fd, td); | 1250 | calPrinter->preview(CalPrinter::Day, fd, td); |
1245 | else | 1251 | else |
1246 | calPrinter->preview(CalPrinter::Week, fd, td); | 1252 | calPrinter->preview(CalPrinter::Week, fd, td); |
1247 | #endif | 1253 | #endif |
1248 | } | 1254 | } |
1249 | 1255 | ||
1250 | // void KOAgendaView::updateMovedTodo() | 1256 | // void KOAgendaView::updateMovedTodo() |
1251 | // { | 1257 | // { |
1252 | // // updateConfig(); | 1258 | // // updateConfig(); |
1253 | // // emit updateTodoViews(); | 1259 | // // emit updateTodoViews(); |
1254 | // } | 1260 | // } |
1255 | 1261 | ||
1256 | void KOAgendaView::newEvent(int gx, int gy) | 1262 | void KOAgendaView::newEvent(int gx, int gy) |
1257 | { | 1263 | { |
1258 | if (!mSelectedDates.count()) return; | 1264 | if (!mSelectedDates.count()) return; |
1259 | 1265 | ||
1260 | QDate day = mSelectedDates[gx]; | 1266 | QDate day = mSelectedDates[gx]; |
1261 | 1267 | ||
1262 | QTime time = mAgenda->gyToTime(gy); | 1268 | QTime time = mAgenda->gyToTime(gy); |
1263 | QDateTime dt(day,time); | 1269 | QDateTime dt(day,time); |
1264 | // if ( dt < QDateTime::currentDateTime () ) | 1270 | // if ( dt < QDateTime::currentDateTime () ) |
1265 | // dt = QDateTime::currentDateTime ().addSecs( 3600 ); | 1271 | // dt = QDateTime::currentDateTime ().addSecs( 3600 ); |
1266 | emit newEventSignal(dt); | 1272 | emit newEventSignal(dt); |
1267 | } | 1273 | } |
1268 | 1274 | ||
1269 | void KOAgendaView::newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd) | 1275 | void KOAgendaView::newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd) |
1270 | { | 1276 | { |
1271 | if (!mSelectedDates.count()) return; | 1277 | if (!mSelectedDates.count()) return; |
1272 | 1278 | ||
1273 | QDate dayStart = mSelectedDates[gxStart]; | 1279 | QDate dayStart = mSelectedDates[gxStart]; |
1274 | QDate dayEnd = mSelectedDates[gxEnd]; | 1280 | QDate dayEnd = mSelectedDates[gxEnd]; |
1275 | 1281 | ||
1276 | QTime timeStart = mAgenda->gyToTime(gyStart); | 1282 | QTime timeStart = mAgenda->gyToTime(gyStart); |
1277 | QTime timeEnd = mAgenda->gyToTime( gyEnd + 1 ); | 1283 | QTime timeEnd = mAgenda->gyToTime( gyEnd + 1 ); |
1278 | 1284 | ||
1279 | QDateTime dtStart(dayStart,timeStart); | 1285 | QDateTime dtStart(dayStart,timeStart); |
1280 | QDateTime dtEnd(dayEnd,timeEnd); | 1286 | QDateTime dtEnd(dayEnd,timeEnd); |
1281 | 1287 | ||
1282 | emit newEventSignal(dtStart,dtEnd); | 1288 | emit newEventSignal(dtStart,dtEnd); |
1283 | } | 1289 | } |
1284 | 1290 | ||
1285 | void KOAgendaView::newEventAllDay(int gx, int ) | 1291 | void KOAgendaView::newEventAllDay(int gx, int ) |
1286 | { | 1292 | { |
1287 | if (!mSelectedDates.count()) return; | 1293 | if (!mSelectedDates.count()) return; |
1288 | 1294 | ||
1289 | QDate day = mSelectedDates[gx]; | 1295 | QDate day = mSelectedDates[gx]; |
1290 | 1296 | ||
1291 | emit newEventSignal(day); | 1297 | emit newEventSignal(day); |
1292 | } | 1298 | } |
1293 | void KOAgendaView::newTodoAllDay(int gx, int ) | 1299 | void KOAgendaView::newTodoAllDay(int gx, int ) |
1294 | { | 1300 | { |
1295 | if (!mSelectedDates.count()) return; | 1301 | if (!mSelectedDates.count()) return; |
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp index 2f0fa9e..36a2947 100644 --- a/korganizer/koeventviewer.cpp +++ b/korganizer/koeventviewer.cpp | |||
@@ -254,258 +254,263 @@ void KOEventViewer::appendEvent(Event *event, int mode ) | |||
254 | .arg(event->dtEndDateStr(shortDate))); | 254 | .arg(event->dtEndDateStr(shortDate))); |
255 | } else { | 255 | } else { |
256 | mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); | 256 | mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); |
257 | } | 257 | } |
258 | } else { | 258 | } else { |
259 | if (event->isMultiDay()) { | 259 | if (event->isMultiDay()) { |
260 | mText.append(i18n("<p><b>From:</b> %1</p> ") | 260 | mText.append(i18n("<p><b>From:</b> %1</p> ") |
261 | .arg(event->dtStartStr( shortDate))); | 261 | .arg(event->dtStartStr( shortDate))); |
262 | mText.append(i18n("<p><b>To:</b> %1</p>") | 262 | mText.append(i18n("<p><b>To:</b> %1</p>") |
263 | .arg(event->dtEndStr(shortDate))); | 263 | .arg(event->dtEndStr(shortDate))); |
264 | } else { | 264 | } else { |
265 | mText.append(i18n("<p><b>On:</b> %1</p> ") | 265 | mText.append(i18n("<p><b>On:</b> %1</p> ") |
266 | .arg(event->dtStartDateStr( shortDate ))); | 266 | .arg(event->dtStartDateStr( shortDate ))); |
267 | mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>") | 267 | mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>") |
268 | .arg(event->dtStartTimeStr()) | 268 | .arg(event->dtStartTimeStr()) |
269 | .arg(event->dtEndTimeStr())); | 269 | .arg(event->dtEndTimeStr())); |
270 | } | 270 | } |
271 | } | 271 | } |
272 | 272 | ||
273 | if (event->recurrence()->doesRecur()) { | 273 | if (event->recurrence()->doesRecur()) { |
274 | 274 | ||
275 | QString recurText = event->recurrence()->recurrenceText(); | 275 | QString recurText = event->recurrence()->recurrenceText(); |
276 | addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); | 276 | addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); |
277 | bool last; | 277 | bool last; |
278 | QDate start = QDate::currentDate(); | 278 | QDate start = QDate::currentDate(); |
279 | QDate next; | 279 | QDate next; |
280 | next = event->recurrence()->getPreviousDate( start , &last ); | 280 | next = event->recurrence()->getPreviousDate( start , &last ); |
281 | if ( !last ) { | 281 | if ( !last ) { |
282 | next = event->recurrence()->getNextDate( start.addDays( - 1 ) ); | 282 | next = event->recurrence()->getNextDate( start.addDays( - 1 ) ); |
283 | addTag("p",i18n("<b>Next recurrence is on:</b>") ); | 283 | addTag("p",i18n("<b>Next recurrence is on:</b>") ); |
284 | addTag("p", KGlobal::locale()->formatDate( next, shortDate )); | 284 | addTag("p", KGlobal::locale()->formatDate( next, shortDate )); |
285 | QDateTime nextdt = QDateTime( next, event->dtStart().time()); | 285 | QDateTime nextdt = QDateTime( next, event->dtStart().time()); |
286 | mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( nextdt, true ); | 286 | mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( nextdt, true ); |
287 | 287 | ||
288 | } else { | 288 | } else { |
289 | addTag("p",i18n("<b>Last recurrence was on:</b>") ); | 289 | addTag("p",i18n("<b>Last recurrence was on:</b>") ); |
290 | addTag("p", KGlobal::locale()->formatDate( next, shortDate )); | 290 | addTag("p", KGlobal::locale()->formatDate( next, shortDate )); |
291 | } | 291 | } |
292 | } else { | 292 | } else { |
293 | mMailSubject += i18n(" - " )+event->dtStartStr( true ); | 293 | mMailSubject += i18n(" - " )+event->dtStartStr( true ); |
294 | 294 | ||
295 | } | 295 | } |
296 | 296 | ||
297 | 297 | ||
298 | if (event->isAlarmEnabled()) { | 298 | if (event->isAlarmEnabled()) { |
299 | Alarm *alarm =event->alarms().first() ; | 299 | Alarm *alarm =event->alarms().first() ; |
300 | QDateTime t = alarm->time(); | 300 | QDateTime t = alarm->time(); |
301 | int min = t.secsTo( event->dtStart() )/60; | 301 | int min = t.secsTo( event->dtStart() )/60; |
302 | QString s =i18n("( %1 min before )").arg( min ); | 302 | QString s =i18n("( %1 min before )").arg( min ); |
303 | addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); | 303 | addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); |
304 | addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); | 304 | addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); |
305 | //addTag("p",s); | 305 | //addTag("p",s); |
306 | } | 306 | } |
307 | 307 | ||
308 | addTag("b",i18n("Access: ")); | 308 | addTag("b",i18n("Access: ")); |
309 | mText.append(event->secrecyStr()+"<br>"); | 309 | mText.append(event->secrecyStr()+"<br>"); |
310 | if (!event->description().isEmpty()) { | 310 | if (!event->description().isEmpty()) { |
311 | addTag("p",i18n("<b>Details: </b>")); | 311 | addTag("p",i18n("<b>Details: </b>")); |
312 | addTag("p",event->description()); | 312 | addTag("p",event->description()); |
313 | } | 313 | } |
314 | 314 | ||
315 | formatCategories(event); | 315 | formatCategories(event); |
316 | 316 | ||
317 | formatReadOnly(event); | 317 | formatReadOnly(event); |
318 | formatAttendees(event); | 318 | formatAttendees(event); |
319 | 319 | ||
320 | setText(mText); | 320 | setText(mText); |
321 | //QWhatsThis::add(this,mText); | 321 | //QWhatsThis::add(this,mText); |
322 | 322 | ||
323 | } | 323 | } |
324 | 324 | ||
325 | void KOEventViewer::appendTodo(Todo *event, int mode ) | 325 | void KOEventViewer::appendTodo(Todo *event, int mode ) |
326 | { | 326 | { |
327 | mMailSubject = ""; | 327 | mMailSubject = ""; |
328 | mCurrentIncidence = event; | 328 | mCurrentIncidence = event; |
329 | topLevelWidget()->setCaption(i18n("Todo Viewer")); | 329 | topLevelWidget()->setCaption(i18n("Todo Viewer")); |
330 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; | 330 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; |
331 | if (mode == 0 ) | 331 | if (mode == 0 ) |
332 | addTag("h2",event->summary()); | 332 | addTag("h2",event->summary()); |
333 | else { | 333 | else { |
334 | if ( mColorMode == 1 ) { | 334 | if ( mColorMode == 1 ) { |
335 | mText +="<font color=\"#00A000\">"; | 335 | mText +="<font color=\"#00A000\">"; |
336 | } | 336 | } |
337 | if ( mColorMode == 2 ) { | 337 | if ( mColorMode == 2 ) { |
338 | mText +="<font color=\"#B00000\">"; | 338 | mText +="<font color=\"#B00000\">"; |
339 | } | 339 | } |
340 | if ( mode == 1 ) { | 340 | if ( mode == 1 ) { |
341 | addTag("h2",i18n( "Local: " ) +event->summary()); | 341 | addTag("h2",i18n( "Local: " ) +event->summary()); |
342 | } else { | 342 | } else { |
343 | addTag("h2",i18n( "Remote: " ) +event->summary()); | 343 | addTag("h2",i18n( "Remote: " ) +event->summary()); |
344 | } | 344 | } |
345 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); | 345 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); |
346 | if ( mColorMode ) | 346 | if ( mColorMode ) |
347 | mText += "</font>"; | 347 | mText += "</font>"; |
348 | } | 348 | } |
349 | mMailSubject += i18n( "Todo " )+ event->summary(); | 349 | mMailSubject += i18n( "Todo " )+ event->summary(); |
350 | if (event->cancelled ()) { | 350 | if (event->cancelled ()) { |
351 | mText +="<font color=\"#B00000\">"; | 351 | mText +="<font color=\"#B00000\">"; |
352 | addTag("i",i18n("This todo has been cancelled!")); | 352 | addTag("i",i18n("This todo has been cancelled!")); |
353 | mText.append("<br>"); | 353 | mText.append("<br>"); |
354 | mText += "</font>"; | 354 | mText += "</font>"; |
355 | mMailSubject += i18n("(cancelled)"); | 355 | mMailSubject += i18n("(cancelled)"); |
356 | } | 356 | } |
357 | 357 | ||
358 | if (!event->location().isEmpty()) { | 358 | if (!event->location().isEmpty()) { |
359 | addTag("b",i18n("Location: ")); | 359 | addTag("b",i18n("Location: ")); |
360 | mText.append(event->location()+"<br>"); | 360 | mText.append(event->location()+"<br>"); |
361 | mMailSubject += i18n(" at ") + event->location(); | 361 | mMailSubject += i18n(" at ") + event->location(); |
362 | } | 362 | } |
363 | if (event->hasStartDate()) { | 363 | if (event->hasStartDate()) { |
364 | mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(KOPrefs::instance()->mShortDateInViewer))); | 364 | mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(KOPrefs::instance()->mShortDateInViewer))); |
365 | } | 365 | } |
366 | if (event->hasDueDate()) { | 366 | if (event->hasDueDate()) { |
367 | mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer))); | 367 | mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer))); |
368 | mMailSubject += i18n(" - " )+event->dtDueStr( true ); | 368 | mMailSubject += i18n(" - " )+event->dtDueStr( true ); |
369 | } | 369 | } |
370 | addTag("b",i18n("Access: ")); | 370 | addTag("b",i18n("Access: ")); |
371 | mText.append(event->secrecyStr()+"<br>"); | 371 | mText.append(event->secrecyStr()+"<br>"); |
372 | if (!event->description().isEmpty()) { | 372 | if (!event->description().isEmpty()) { |
373 | addTag("p",i18n("<b>Details: </b>")); | 373 | addTag("p",i18n("<b>Details: </b>")); |
374 | addTag("p",event->description()); | 374 | addTag("p",event->description()); |
375 | } | 375 | } |
376 | 376 | ||
377 | formatCategories(event); | 377 | formatCategories(event); |
378 | 378 | ||
379 | mText.append(i18n("<p><b>Priority:</b> %2</p>") | 379 | mText.append(i18n("<p><b>Priority:</b> %2</p>") |
380 | .arg(QString::number(event->priority()))); | 380 | .arg(QString::number(event->priority()))); |
381 | 381 | ||
382 | if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { | ||
383 | mText.append(i18n("<p><i>Completed on %1</i></p>") | ||
384 | .arg( event->completedStr() )); | ||
385 | } else { | ||
382 | mText.append(i18n("<p><i>%1 % completed</i></p>") | 386 | mText.append(i18n("<p><i>%1 % completed</i></p>") |
383 | .arg(event->percentComplete())); | 387 | .arg(event->percentComplete())); |
388 | } | ||
384 | 389 | ||
385 | formatReadOnly(event); | 390 | formatReadOnly(event); |
386 | formatAttendees(event); | 391 | formatAttendees(event); |
387 | if ( event->relatedTo() ) { | 392 | if ( event->relatedTo() ) { |
388 | addTag("b",i18n("Parent todo: ")); | 393 | addTag("b",i18n("Parent todo: ")); |
389 | mText.append(event->relatedTo()->summary()+" [" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] <br>"); | 394 | mText.append(event->relatedTo()->summary()+" [" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] <br>"); |
390 | } | 395 | } |
391 | QPtrList<Incidence> Relations = event->relations(); | 396 | QPtrList<Incidence> Relations = event->relations(); |
392 | Incidence *to; | 397 | Incidence *to; |
393 | if ( Relations.first() ) | 398 | if ( Relations.first() ) |
394 | addTag("b",i18n("Sub todos:<br>")); | 399 | addTag("b",i18n("Sub todos:<br>")); |
395 | for (to=Relations.first();to;to=Relations.next()) { | 400 | for (to=Relations.first();to;to=Relations.next()) { |
396 | mText.append( to->summary()+" [" +QString::number(to->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%]<br>"); | 401 | mText.append( to->summary()+" [" +QString::number(to->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%]<br>"); |
397 | 402 | ||
398 | } | 403 | } |
399 | setText(mText); | 404 | setText(mText); |
400 | } | 405 | } |
401 | 406 | ||
402 | void KOEventViewer::formatCategories(Incidence *event) | 407 | void KOEventViewer::formatCategories(Incidence *event) |
403 | { | 408 | { |
404 | if (!event->categoriesStr().isEmpty()) { | 409 | if (!event->categoriesStr().isEmpty()) { |
405 | if (event->categories().count() == 1) { | 410 | if (event->categories().count() == 1) { |
406 | addTag("h3",i18n("Category")); | 411 | addTag("h3",i18n("Category")); |
407 | } else { | 412 | } else { |
408 | addTag("h3",i18n("Categories")); | 413 | addTag("h3",i18n("Categories")); |
409 | } | 414 | } |
410 | addTag("p",event->categoriesStr()); | 415 | addTag("p",event->categoriesStr()); |
411 | } | 416 | } |
412 | } | 417 | } |
413 | void KOEventViewer::formatAttendees(Incidence *event) | 418 | void KOEventViewer::formatAttendees(Incidence *event) |
414 | { | 419 | { |
415 | QPtrList<Attendee> attendees = event->attendees(); | 420 | QPtrList<Attendee> attendees = event->attendees(); |
416 | if (attendees.count()) { | 421 | if (attendees.count()) { |
417 | 422 | ||
418 | 423 | ||
419 | QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); | 424 | QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); |
420 | QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small); | 425 | QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small); |
421 | addTag("h3",i18n("Organizer")); | 426 | addTag("h3",i18n("Organizer")); |
422 | mText.append("<ul><li>"); | 427 | mText.append("<ul><li>"); |
423 | #ifndef KORG_NOKABC | 428 | #ifndef KORG_NOKABC |
424 | 429 | ||
425 | #ifdef DESKTOP_VERSION | 430 | #ifdef DESKTOP_VERSION |
426 | KABC::AddressBook *add_book = KABC::StdAddressBook::self(); | 431 | KABC::AddressBook *add_book = KABC::StdAddressBook::self(); |
427 | KABC::Addressee::List addressList; | 432 | KABC::Addressee::List addressList; |
428 | addressList = add_book->findByEmail(event->organizer()); | 433 | addressList = add_book->findByEmail(event->organizer()); |
429 | KABC::Addressee o = addressList.first(); | 434 | KABC::Addressee o = addressList.first(); |
430 | if (!o.isEmpty() && addressList.size()<2) { | 435 | if (!o.isEmpty() && addressList.size()<2) { |
431 | mText += "<a href=\"uid:" + o.uid() + "\">"; | 436 | mText += "<a href=\"uid:" + o.uid() + "\">"; |
432 | mText += o.formattedName(); | 437 | mText += o.formattedName(); |
433 | mText += "</a>\n"; | 438 | mText += "</a>\n"; |
434 | } else { | 439 | } else { |
435 | mText.append(event->organizer()); | 440 | mText.append(event->organizer()); |
436 | } | 441 | } |
437 | #else //DESKTOP_VERSION | 442 | #else //DESKTOP_VERSION |
438 | mText += "<a href=\"uid:organizer\">"; | 443 | mText += "<a href=\"uid:organizer\">"; |
439 | mText += event->organizer(); | 444 | mText += event->organizer(); |
440 | mText += "</a>\n"; | 445 | mText += "</a>\n"; |
441 | #endif //DESKTOP_VERSION | 446 | #endif //DESKTOP_VERSION |
442 | 447 | ||
443 | 448 | ||
444 | #else | 449 | #else |
445 | mText.append(event->organizer()); | 450 | mText.append(event->organizer()); |
446 | #endif | 451 | #endif |
447 | 452 | ||
448 | if (iconPath) { | 453 | if (iconPath) { |
449 | mText += " <a href=\"mailto:" + event->organizer() + "\">"; | 454 | mText += " <a href=\"mailto:" + event->organizer() + "\">"; |
450 | mText += "<IMG src=\"" + iconPath + "\">"; | 455 | mText += "<IMG src=\"" + iconPath + "\">"; |
451 | mText += "</a>\n"; | 456 | mText += "</a>\n"; |
452 | } | 457 | } |
453 | mText.append("</li></ul>"); | 458 | mText.append("</li></ul>"); |
454 | 459 | ||
455 | addTag("h3",i18n("Attendees")); | 460 | addTag("h3",i18n("Attendees")); |
456 | Attendee *a; | 461 | Attendee *a; |
457 | mText.append("<ul>"); | 462 | mText.append("<ul>"); |
458 | for(a=attendees.first();a;a=attendees.next()) { | 463 | for(a=attendees.first();a;a=attendees.next()) { |
459 | #ifndef KORG_NOKABC | 464 | #ifndef KORG_NOKABC |
460 | #ifdef DESKTOP_VERSION | 465 | #ifdef DESKTOP_VERSION |
461 | if (a->name().isEmpty()) { | 466 | if (a->name().isEmpty()) { |
462 | addressList = add_book->findByEmail(a->email()); | 467 | addressList = add_book->findByEmail(a->email()); |
463 | KABC::Addressee o = addressList.first(); | 468 | KABC::Addressee o = addressList.first(); |
464 | if (!o.isEmpty() && addressList.size()<2) { | 469 | if (!o.isEmpty() && addressList.size()<2) { |
465 | mText += "<a href=\"uid:" + o.uid() + "\">"; | 470 | mText += "<a href=\"uid:" + o.uid() + "\">"; |
466 | mText += o.formattedName(); | 471 | mText += o.formattedName(); |
467 | mText += "</a>\n"; | 472 | mText += "</a>\n"; |
468 | } else { | 473 | } else { |
469 | mText += "<li>"; | 474 | mText += "<li>"; |
470 | mText.append(a->email()); | 475 | mText.append(a->email()); |
471 | mText += "\n"; | 476 | mText += "\n"; |
472 | } | 477 | } |
473 | } else { | 478 | } else { |
474 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; | 479 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; |
475 | if (!a->name().isEmpty()) mText += a->name(); | 480 | if (!a->name().isEmpty()) mText += a->name(); |
476 | else mText += a->email(); | 481 | else mText += a->email(); |
477 | mText += "</a>\n"; | 482 | mText += "</a>\n"; |
478 | } | 483 | } |
479 | #else //DESKTOP_VERSION | 484 | #else //DESKTOP_VERSION |
480 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; | 485 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; |
481 | if (!a->name().isEmpty()) mText += a->name(); | 486 | if (!a->name().isEmpty()) mText += a->name(); |
482 | else mText += a->email(); | 487 | else mText += a->email(); |
483 | mText += "</a>\n"; | 488 | mText += "</a>\n"; |
484 | #endif //DESKTOP_VERSION | 489 | #endif //DESKTOP_VERSION |
485 | #else | 490 | #else |
486 | //qDebug("nokabc "); | 491 | //qDebug("nokabc "); |
487 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; | 492 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; |
488 | if (!a->name().isEmpty()) mText += a->name(); | 493 | if (!a->name().isEmpty()) mText += a->name(); |
489 | else mText += a->email(); | 494 | else mText += a->email(); |
490 | mText += "</a>\n"; | 495 | mText += "</a>\n"; |
491 | #endif | 496 | #endif |
492 | 497 | ||
493 | 498 | ||
494 | if (!a->email().isEmpty()) { | 499 | if (!a->email().isEmpty()) { |
495 | if (iconPath) { | 500 | if (iconPath) { |
496 | mText += "<a href=\"mailto:" + a->name() +" <" + a->email() + ">:" + mMailSubject + "\">"; | 501 | mText += "<a href=\"mailto:" + a->name() +" <" + a->email() + ">:" + mMailSubject + "\">"; |
497 | if ( a->RSVP() ) | 502 | if ( a->RSVP() ) |
498 | mText += "<IMG src=\"" + iconPath + "\">"; | 503 | mText += "<IMG src=\"" + iconPath + "\">"; |
499 | else | 504 | else |
500 | mText += "<IMG src=\"" + NOiconPath + "\">"; | 505 | mText += "<IMG src=\"" + NOiconPath + "\">"; |
501 | mText += "</a>\n"; | 506 | mText += "</a>\n"; |
502 | } | 507 | } |
503 | } | 508 | } |
504 | if (a->status() != Attendee::NeedsAction ) | 509 | if (a->status() != Attendee::NeedsAction ) |
505 | mText +="[" + a->statusStr() + "] "; | 510 | mText +="[" + a->statusStr() + "] "; |
506 | if (a->role() == Attendee::Chair ) | 511 | if (a->role() == Attendee::Chair ) |
507 | mText +="(" + a->roleStr().left(1) + ".)"; | 512 | mText +="(" + a->roleStr().left(1) + ".)"; |
508 | } | 513 | } |
509 | mText.append("</li></ul>"); | 514 | mText.append("</li></ul>"); |
510 | } | 515 | } |
511 | 516 | ||
diff --git a/korganizer/koeventviewerdialog.cpp b/korganizer/koeventviewerdialog.cpp index 3979ed2..f6f7258 100644 --- a/korganizer/koeventviewerdialog.cpp +++ b/korganizer/koeventviewerdialog.cpp | |||
@@ -96,164 +96,165 @@ void KOEventViewerDialog::setSyncMode( bool b ) | |||
96 | } | 96 | } |
97 | mEventViewer->setSyncMode( b ); | 97 | mEventViewer->setSyncMode( b ); |
98 | } | 98 | } |
99 | void KOEventViewerDialog::setColorMode( int m ) | 99 | void KOEventViewerDialog::setColorMode( int m ) |
100 | { | 100 | { |
101 | mEventViewer->setColorMode( m ); | 101 | mEventViewer->setColorMode( m ); |
102 | } | 102 | } |
103 | int KOEventViewerDialog::executeS( bool local ) | 103 | int KOEventViewerDialog::executeS( bool local ) |
104 | { | 104 | { |
105 | mSyncResult = 3; | 105 | mSyncResult = 3; |
106 | if ( local ) | 106 | if ( local ) |
107 | findButton( User1 )->setFocus(); | 107 | findButton( User1 )->setFocus(); |
108 | else | 108 | else |
109 | findButton( Ok )->setFocus(); | 109 | findButton( Ok )->setFocus(); |
110 | exec(); | 110 | exec(); |
111 | return mSyncResult; | 111 | return mSyncResult; |
112 | } | 112 | } |
113 | 113 | ||
114 | void KOEventViewerDialog::updateConfig() | 114 | void KOEventViewerDialog::updateConfig() |
115 | { | 115 | { |
116 | mEventViewer->setFont( KOPrefs::instance()->mEventViewFont ); | 116 | mEventViewer->setFont( KOPrefs::instance()->mEventViewFont ); |
117 | 117 | ||
118 | } | 118 | } |
119 | void KOEventViewerDialog::setEvent(Event *event) | 119 | void KOEventViewerDialog::setEvent(Event *event) |
120 | { | 120 | { |
121 | mEventViewer->setEvent(event); | 121 | mEventViewer->setEvent(event); |
122 | mIncidence = event; | 122 | mIncidence = event; |
123 | findButton( Close )->setFocus(); | 123 | findButton( Close )->setFocus(); |
124 | if ( !mSyncMode ) { | 124 | if ( !mSyncMode ) { |
125 | findButton( User1 )->setText( i18n("Agenda")); | 125 | findButton( User1 )->setText( i18n("Agenda")); |
126 | } | 126 | } |
127 | } | 127 | } |
128 | void KOEventViewerDialog::setIncidence(Incidence *in ) | 128 | void KOEventViewerDialog::setIncidence(Incidence *in ) |
129 | { | 129 | { |
130 | if ( in->type() == "Event" ) | 130 | if ( in->type() == "Event" ) |
131 | setEvent( (Event*) in ); | 131 | setEvent( (Event*) in ); |
132 | else if ( in->type() =="Todo" ) | 132 | else if ( in->type() =="Todo" ) |
133 | setTodo( (Todo*) in ); | 133 | setTodo( (Todo*) in ); |
134 | else if ( in->type() =="Journal" ) | 134 | else if ( in->type() =="Journal" ) |
135 | setJournal( (Journal*) in ); | 135 | setJournal( (Journal*) in ); |
136 | } | 136 | } |
137 | void KOEventViewerDialog::addIncidence(Incidence *in) | 137 | void KOEventViewerDialog::addIncidence(Incidence *in) |
138 | { | 138 | { |
139 | if ( in->type() == "Event" ) | 139 | if ( in->type() == "Event" ) |
140 | addEvent( (Event*) in ); | 140 | addEvent( (Event*) in ); |
141 | else if ( in->type() =="Todo" ) | 141 | else if ( in->type() =="Todo" ) |
142 | mEventViewer->setTodo( (Todo*) in, false ); | 142 | mEventViewer->setTodo( (Todo*) in, false ); |
143 | else if ( in->type() =="Journal" ) | 143 | else if ( in->type() =="Journal" ) |
144 | mEventViewer->setJournal( (Journal*) in, false ); | 144 | mEventViewer->setJournal( (Journal*) in, false ); |
145 | if ( mSyncMode ) { | 145 | if ( mSyncMode ) { |
146 | findButton( User1 )->setFocus(); | 146 | findButton( User1 )->setFocus(); |
147 | setCaption(i18n("Conflict! Please choose entry")); | 147 | setCaption(i18n("Conflict! Please choose entry")); |
148 | } | 148 | } |
149 | } | 149 | } |
150 | 150 | ||
151 | void KOEventViewerDialog::addEvent(Event *event) | 151 | void KOEventViewerDialog::addEvent(Event *event) |
152 | { | 152 | { |
153 | mEventViewer->addEvent(event); | 153 | mEventViewer->addEvent(event); |
154 | mIncidence = event; | 154 | mIncidence = event; |
155 | findButton( Close )->setFocus(); | 155 | findButton( Close )->setFocus(); |
156 | if ( !mSyncMode ) { | 156 | if ( !mSyncMode ) { |
157 | findButton( User1 )->setText( i18n("Agenda")); | 157 | findButton( User1 )->setText( i18n("Agenda")); |
158 | } | 158 | } |
159 | } | 159 | } |
160 | 160 | ||
161 | void KOEventViewerDialog::setTodo(Todo *event) | 161 | void KOEventViewerDialog::setTodo(Todo *event) |
162 | { | 162 | { |
163 | mEventViewer->setTodo(event); | 163 | mEventViewer->setTodo(event); |
164 | mIncidence = (Incidence*)event; | 164 | mIncidence = (Incidence*)event; |
165 | findButton( Close )->setFocus(); | 165 | findButton( Close )->setFocus(); |
166 | if ( !mSyncMode ) { | 166 | if ( !mSyncMode ) { |
167 | findButton( User1 )->setText( i18n("Set complete")); | 167 | findButton( User1 )->setText( i18n("Set complete")); |
168 | } | 168 | } |
169 | } | 169 | } |
170 | void KOEventViewerDialog::setJournal(Journal *j) | 170 | void KOEventViewerDialog::setJournal(Journal *j) |
171 | { | 171 | { |
172 | mEventViewer->setJournal(j); | 172 | mEventViewer->setJournal(j); |
173 | mIncidence = (Incidence*)j; | 173 | mIncidence = (Incidence*)j; |
174 | findButton( Close )->setFocus(); | 174 | findButton( Close )->setFocus(); |
175 | if ( !mSyncMode ) { | 175 | if ( !mSyncMode ) { |
176 | findButton( User1 )->setText( i18n("Agenda")); | 176 | findButton( User1 )->setText( i18n("Agenda")); |
177 | } | 177 | } |
178 | } | 178 | } |
179 | 179 | ||
180 | void KOEventViewerDialog::addText(QString text) | 180 | void KOEventViewerDialog::addText(QString text) |
181 | { | 181 | { |
182 | mEventViewer->addText(text); | 182 | mEventViewer->addText(text); |
183 | findButton( Close )->setFocus(); | 183 | findButton( Close )->setFocus(); |
184 | } | 184 | } |
185 | void KOEventViewerDialog::editIncidence() | 185 | void KOEventViewerDialog::editIncidence() |
186 | { | 186 | { |
187 | if ( mSyncMode ) { | 187 | if ( mSyncMode ) { |
188 | mSyncResult = 2; | 188 | mSyncResult = 2; |
189 | accept(); | 189 | accept(); |
190 | return; | 190 | return; |
191 | } | 191 | } |
192 | if ( mIncidence ){ | 192 | if ( mIncidence ){ |
193 | #ifndef DESKTOP_VERSION | 193 | #ifndef DESKTOP_VERSION |
194 | hide(); | 194 | hide(); |
195 | #endif | 195 | #endif |
196 | emit editIncidence( mIncidence ); | 196 | emit editIncidence( mIncidence ); |
197 | } | 197 | } |
198 | } | 198 | } |
199 | void KOEventViewerDialog::showIncidence() | 199 | void KOEventViewerDialog::showIncidence() |
200 | { | 200 | { |
201 | 201 | ||
202 | if ( mSyncMode ) { | 202 | if ( mSyncMode ) { |
203 | mSyncResult = 1; | 203 | mSyncResult = 1; |
204 | accept(); | 204 | accept(); |
205 | return; | 205 | return; |
206 | } | 206 | } |
207 | 207 | ||
208 | if ( mIncidence ){ | 208 | if ( mIncidence ){ |
209 | #ifndef DESKTOP_VERSION | 209 | #ifndef DESKTOP_VERSION |
210 | hide(); | 210 | hide(); |
211 | #endif | 211 | #endif |
212 | QDate date; | 212 | QDate date; |
213 | if ( mIncidence->type() == "Todo" ) { | 213 | if ( mIncidence->type() == "Todo" ) { |
214 | /* | 214 | /* |
215 | if ( ((Todo*)mIncidence)->hasDueDate() ) | 215 | if ( ((Todo*)mIncidence)->hasDueDate() ) |
216 | date = ((Todo*)mIncidence)->dtDue().date(); | 216 | date = ((Todo*)mIncidence)->dtDue().date(); |
217 | else { | 217 | else { |
218 | globalFlagBlockAgenda = 2; | 218 | globalFlagBlockAgenda = 2; |
219 | emit showAgendaView( false ); | 219 | emit showAgendaView( false ); |
220 | return; | 220 | return; |
221 | } | 221 | } |
222 | */ | 222 | */ |
223 | ((Todo*)mIncidence)->setCompleted( true ); | 223 | ((Todo*)mIncidence)->setCompleted( true ); |
224 | ((Todo*)mIncidence)->setCompleted(QDateTime::currentDateTime() ); | ||
224 | hide(); | 225 | hide(); |
225 | emit todoCompleted(((Todo*)mIncidence)); | 226 | emit todoCompleted(((Todo*)mIncidence)); |
226 | return; | 227 | return; |
227 | 228 | ||
228 | } else | 229 | } else |
229 | date = mIncidence->dtStart().date(); | 230 | date = mIncidence->dtStart().date(); |
230 | globalFlagBlockAgenda = 1; | 231 | globalFlagBlockAgenda = 1; |
231 | emit showAgendaView( false ); | 232 | emit showAgendaView( false ); |
232 | globalFlagBlockAgenda = 2; | 233 | globalFlagBlockAgenda = 2; |
233 | emit jumpToTime( date ); | 234 | emit jumpToTime( date ); |
234 | } | 235 | } |
235 | } | 236 | } |
236 | void KOEventViewerDialog::keyPressEvent ( QKeyEvent * e ) | 237 | void KOEventViewerDialog::keyPressEvent ( QKeyEvent * e ) |
237 | { | 238 | { |
238 | switch ( e->key() ) { | 239 | switch ( e->key() ) { |
239 | 240 | ||
240 | case Qt::Key_A : | 241 | case Qt::Key_A : |
241 | case Qt::Key_L : | 242 | case Qt::Key_L : |
242 | showIncidence(); | 243 | showIncidence(); |
243 | break; | 244 | break; |
244 | case Qt::Key_E : | 245 | case Qt::Key_E : |
245 | case Qt::Key_R : | 246 | case Qt::Key_R : |
246 | editIncidence(); | 247 | editIncidence(); |
247 | break; | 248 | break; |
248 | case Qt::Key_C: | 249 | case Qt::Key_C: |
249 | case Qt::Key_Escape: | 250 | case Qt::Key_Escape: |
250 | close(); | 251 | close(); |
251 | break; | 252 | break; |
252 | case Qt::Key_I: | 253 | case Qt::Key_I: |
253 | accept(); | 254 | accept(); |
254 | break; | 255 | break; |
255 | default: | 256 | default: |
256 | break; | 257 | break; |
257 | } | 258 | } |
258 | 259 | ||
259 | } | 260 | } |