-rw-r--r-- | korganizer/koeventviewer.cpp | 2 | ||||
-rw-r--r-- | korganizer/komonthview.cpp | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp index db695f5..976ee2c 100644 --- a/korganizer/koeventviewer.cpp +++ b/korganizer/koeventviewer.cpp | |||
@@ -137,384 +137,386 @@ void KOEventViewer::setSource(const QString& n) | |||
137 | QVBoxLayout lay ( &dia ); | 137 | QVBoxLayout lay ( &dia ); |
138 | KABC::AddresseeView av ( &dia ); | 138 | KABC::AddresseeView av ( &dia ); |
139 | av.setAddressee( (*it) ); | 139 | av.setAddressee( (*it) ); |
140 | lay.addWidget( &av ); | 140 | lay.addWidget( &av ); |
141 | if ( QApplication::desktop()->width() < 480 ) | 141 | if ( QApplication::desktop()->width() < 480 ) |
142 | dia.resize( 220, 240); | 142 | dia.resize( 220, 240); |
143 | else { | 143 | else { |
144 | dia.resize( 400,400); | 144 | dia.resize( 400,400); |
145 | } | 145 | } |
146 | dia.exec(); | 146 | dia.exec(); |
147 | break; | 147 | break; |
148 | } | 148 | } |
149 | } | 149 | } |
150 | return; | 150 | return; |
151 | } | 151 | } |
152 | #else | 152 | #else |
153 | { | 153 | { |
154 | if ( "uid:organizer" == n ) { | 154 | if ( "uid:organizer" == n ) { |
155 | ExternalAppHandler::instance()->requestDetailsFromKAPI("", mCurrentIncidence->organizer(),""); | 155 | ExternalAppHandler::instance()->requestDetailsFromKAPI("", mCurrentIncidence->organizer(),""); |
156 | return; | 156 | return; |
157 | } | 157 | } |
158 | QPtrList<Attendee> attendees = mCurrentIncidence->attendees(); | 158 | QPtrList<Attendee> attendees = mCurrentIncidence->attendees(); |
159 | if (attendees.count()) { | 159 | if (attendees.count()) { |
160 | Attendee *a; | 160 | Attendee *a; |
161 | for(a=attendees.first();a;a=attendees.next()) { | 161 | for(a=attendees.first();a;a=attendees.next()) { |
162 | if ( "uid:"+a->uid() == n ) { | 162 | if ( "uid:"+a->uid() == n ) { |
163 | bool res = ExternalAppHandler::instance()->requestDetailsFromKAPI(a->name(), a->email(), a->uid()); | 163 | bool res = ExternalAppHandler::instance()->requestDetailsFromKAPI(a->name(), a->email(), a->uid()); |
164 | return; | 164 | return; |
165 | } | 165 | } |
166 | } | 166 | } |
167 | } | 167 | } |
168 | return; | 168 | return; |
169 | } | 169 | } |
170 | //requestNameEmailUidListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); | 170 | //requestNameEmailUidListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); |
171 | // the result should now arrive through method insertAttendees | 171 | // the result should now arrive through method insertAttendees |
172 | //QString uid = "uid:"+(*it).uid(); | 172 | //QString uid = "uid:"+(*it).uid(); |
173 | #endif | 173 | #endif |
174 | if ( n.left(6) == "mailto" ) { | 174 | if ( n.left(6) == "mailto" ) { |
175 | // qDebug("KOEventViewer::setSource %s ", n.mid(7).latin1()); | 175 | // qDebug("KOEventViewer::setSource %s ", n.mid(7).latin1()); |
176 | #ifndef DESKTOP_VERSION | 176 | #ifndef DESKTOP_VERSION |
177 | if ( n.mid(7,3) == "ALL" ) { | 177 | if ( n.mid(7,3) == "ALL" ) { |
178 | mailToAttendees( true ); | 178 | mailToAttendees( true ); |
179 | } else if ( n.mid(7,4) == "RSVP" ) { | 179 | } else if ( n.mid(7,4) == "RSVP" ) { |
180 | mailToAttendees( false ); | 180 | mailToAttendees( false ); |
181 | } else { | 181 | } else { |
182 | QCopEnvelope e("QPE/Application/ompi", "newMail(QString)" ); | 182 | QCopEnvelope e("QPE/Application/ompi", "newMail(QString)" ); |
183 | e << n.mid(7); | 183 | e << n.mid(7); |
184 | } | 184 | } |
185 | #endif | 185 | #endif |
186 | 186 | ||
187 | } | 187 | } |
188 | 188 | ||
189 | 189 | ||
190 | #ifndef KORG_NODCOP | 190 | #ifndef KORG_NODCOP |
191 | kdDebug() << "KOEventViewer::setSource(): " << n << endl; | 191 | kdDebug() << "KOEventViewer::setSource(): " << n << endl; |
192 | QString tmpStr; | 192 | QString tmpStr; |
193 | if (n.startsWith("mailto:")) { | 193 | if (n.startsWith("mailto:")) { |
194 | KApplication::kApplication()->invokeMailer(n.mid(7),QString::null); | 194 | KApplication::kApplication()->invokeMailer(n.mid(7),QString::null); |
195 | //emit showIncidence(n); | 195 | //emit showIncidence(n); |
196 | return; | 196 | return; |
197 | } else if (n.startsWith("uid:")) { | 197 | } else if (n.startsWith("uid:")) { |
198 | DCOPClient *client = KApplication::kApplication()->dcopClient(); | 198 | DCOPClient *client = KApplication::kApplication()->dcopClient(); |
199 | const QByteArray noParamData; | 199 | const QByteArray noParamData; |
200 | const QByteArray paramData; | 200 | const QByteArray paramData; |
201 | QByteArray replyData; | 201 | QByteArray replyData; |
202 | QCString replyTypeStr; | 202 | QCString replyTypeStr; |
203 | #define PING_ABBROWSER (client->call("kaddressbook", "KAddressBookIface", "interfaces()", noParamData, replyTypeStr, replyData)) | 203 | #define PING_ABBROWSER (client->call("kaddressbook", "KAddressBookIface", "interfaces()", noParamData, replyTypeStr, replyData)) |
204 | bool foundAbbrowser = PING_ABBROWSER; | 204 | bool foundAbbrowser = PING_ABBROWSER; |
205 | 205 | ||
206 | if (foundAbbrowser) { | 206 | if (foundAbbrowser) { |
207 | //KAddressbook is already running, so just DCOP to it to bring up the contact editor | 207 | //KAddressbook is already running, so just DCOP to it to bring up the contact editor |
208 | //client->send("kaddressbook","KAddressBookIface", | 208 | //client->send("kaddressbook","KAddressBookIface", |
209 | QDataStream arg(paramData, IO_WriteOnly); | 209 | QDataStream arg(paramData, IO_WriteOnly); |
210 | arg << n.mid(6); | 210 | arg << n.mid(6); |
211 | client->send("kaddressbook", "KAddressBookIface", "showContactEditor( QString )", paramData); | 211 | client->send("kaddressbook", "KAddressBookIface", "showContactEditor( QString )", paramData); |
212 | return; | 212 | return; |
213 | } else { | 213 | } else { |
214 | /* | 214 | /* |
215 | KaddressBook is not already running. Pass it the UID of the contact via the command line while starting it - its neater. | 215 | KaddressBook is not already running. Pass it the UID of the contact via the command line while starting it - its neater. |
216 | We start it without its main interface | 216 | We start it without its main interface |
217 | */ | 217 | */ |
218 | KIconLoader* iconLoader = new KIconLoader(); | 218 | KIconLoader* iconLoader = new KIconLoader(); |
219 | QString iconPath = iconLoader->iconPath("go",KIcon::Small); | 219 | QString iconPath = iconLoader->iconPath("go",KIcon::Small); |
220 | ActionManager::setStartedKAddressBook(true); | 220 | ActionManager::setStartedKAddressBook(true); |
221 | tmpStr = "kaddressbook --editor-only --uid "; | 221 | tmpStr = "kaddressbook --editor-only --uid "; |
222 | tmpStr += KProcess::quote(n.mid(6)); | 222 | tmpStr += KProcess::quote(n.mid(6)); |
223 | KRun::runCommand(tmpStr,"KAddressBook",iconPath); | 223 | KRun::runCommand(tmpStr,"KAddressBook",iconPath); |
224 | return; | 224 | return; |
225 | } | 225 | } |
226 | } else { | 226 | } else { |
227 | //QTextBrowser::setSource(n); | 227 | //QTextBrowser::setSource(n); |
228 | } | 228 | } |
229 | #endif | 229 | #endif |
230 | } | 230 | } |
231 | void KOEventViewer::mailToAttendees( bool all ) | 231 | void KOEventViewer::mailToAttendees( bool all ) |
232 | { | 232 | { |
233 | QPtrList<Attendee> attendees = mCurrentIncidence->attendees(); | 233 | QPtrList<Attendee> attendees = mCurrentIncidence->attendees(); |
234 | if (attendees.count() == 0) return; | 234 | if (attendees.count() == 0) return; |
235 | QStringList nameList; | 235 | QStringList nameList; |
236 | QStringList emailList; | 236 | QStringList emailList; |
237 | QStringList uidList; | 237 | QStringList uidList; |
238 | Attendee* a; | 238 | Attendee* a; |
239 | for(a=attendees.first();a;a=attendees.next()) { | 239 | for(a=attendees.first();a;a=attendees.next()) { |
240 | if ( !all && !a->RSVP() ) continue; | 240 | if ( !all && !a->RSVP() ) continue; |
241 | if (!a->email().isEmpty()) { | 241 | if (!a->email().isEmpty()) { |
242 | nameList.append (a->name() ); | 242 | nameList.append (a->name() ); |
243 | emailList.append (a->email() ); | 243 | emailList.append (a->email() ); |
244 | uidList.append (a->uid() ); | 244 | uidList.append (a->uid() ); |
245 | } | 245 | } |
246 | } | 246 | } |
247 | QString uid = "ComposeMailUIpick2"+mMailSubject; | 247 | QString uid = "ComposeMailUIpick2"+mMailSubject; |
248 | #ifndef DESKTOP_VERSION | 248 | #ifndef DESKTOP_VERSION |
249 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); | 249 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); |
250 | #endif | 250 | #endif |
251 | 251 | ||
252 | } | 252 | } |
253 | void KOEventViewer::addTag(const QString & tag,const QString & text) | 253 | void KOEventViewer::addTag(const QString & tag,const QString & text) |
254 | { | 254 | { |
255 | int number=text.contains("\n"); | 255 | int number=text.contains("\n"); |
256 | QString str = "<" + tag + ">"; | 256 | QString str = "<" + tag + ">"; |
257 | QString tmpText=text; | 257 | QString tmpText=text; |
258 | QString tmpStr=str; | 258 | QString tmpStr=str; |
259 | if(number !=-1) | 259 | if(number !=-1) |
260 | { | 260 | { |
261 | if (number > 0) { | 261 | if (number > 0) { |
262 | int pos=0; | 262 | int pos=0; |
263 | QString tmp; | 263 | QString tmp; |
264 | for(int i=0;i<=number;i++) { | 264 | for(int i=0;i<=number;i++) { |
265 | pos=tmpText.find("\n"); | 265 | pos=tmpText.find("\n"); |
266 | tmp=tmpText.left(pos); | 266 | tmp=tmpText.left(pos); |
267 | tmpText=tmpText.right(tmpText.length()-pos-1); | 267 | tmpText=tmpText.right(tmpText.length()-pos-1); |
268 | tmpStr+=tmp+"<br>"; | 268 | tmpStr+=tmp+"<br>"; |
269 | } | 269 | } |
270 | } | 270 | } |
271 | else tmpStr += tmpText; | 271 | else tmpStr += tmpText; |
272 | tmpStr+="</" + tag + ">"; | 272 | tmpStr+="</" + tag + ">"; |
273 | mText.append(tmpStr); | 273 | mText.append(tmpStr); |
274 | } | 274 | } |
275 | else | 275 | else |
276 | { | 276 | { |
277 | str += text + "</" + tag + ">"; | 277 | str += text + "</" + tag + ">"; |
278 | mText.append(str); | 278 | mText.append(str); |
279 | } | 279 | } |
280 | } | 280 | } |
281 | 281 | ||
282 | void KOEventViewer::setColorMode( int m ) | 282 | void KOEventViewer::setColorMode( int m ) |
283 | { | 283 | { |
284 | mColorMode = m; | 284 | mColorMode = m; |
285 | } | 285 | } |
286 | void KOEventViewer::appendEvent(Event *event, int mode ) | 286 | void KOEventViewer::appendEvent(Event *event, int mode ) |
287 | { | 287 | { |
288 | mMailSubject = ""; | 288 | mMailSubject = ""; |
289 | mCurrentIncidence = event; | 289 | mCurrentIncidence = event; |
290 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; | 290 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; |
291 | bool wideScreen = ( QApplication::desktop()->width() >= 640 ); | 291 | bool wideScreen = ( QApplication::desktop()->width() >= 640 ); |
292 | topLevelWidget()->setCaption(i18n("Event Viewer")); | 292 | topLevelWidget()->setCaption(i18n("Event Viewer")); |
293 | if ( mode == 0 ) { | 293 | if ( mode == 0 ) { |
294 | addTag("h2",deTag(event->summary())); | 294 | addTag("h2",deTag(event->summary())); |
295 | formatReadOnly(event); | 295 | formatReadOnly(event); |
296 | } | 296 | } |
297 | else { | 297 | else { |
298 | if ( mColorMode == 1 ) { | 298 | if ( mColorMode == 1 ) { |
299 | mText +="<font color=\"#00A000\">"; | 299 | mText +="<font color=\"#00A000\">"; |
300 | } | 300 | } |
301 | if ( mColorMode == 2 ) { | 301 | if ( mColorMode == 2 ) { |
302 | mText +="<font color=\"#C00000\">"; | 302 | mText +="<font color=\"#C00000\">"; |
303 | } | 303 | } |
304 | // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; | 304 | // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; |
305 | if ( mode == 1 ) { | 305 | if ( mode == 1 ) { |
306 | addTag("h2",i18n( "Local: " ) +deTag(event->summary())); | 306 | addTag("h2",i18n( "Local: " ) +deTag(event->summary())); |
307 | } else { | 307 | } else { |
308 | addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); | 308 | addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); |
309 | } | 309 | } |
310 | formatReadOnly(event); | 310 | formatReadOnly(event); |
311 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); | 311 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); |
312 | if ( mColorMode ) | 312 | if ( mColorMode ) |
313 | mText += "</font>"; | 313 | mText += "</font>"; |
314 | } | 314 | } |
315 | mMailSubject += i18n( "Meeting " )+ event->summary(); | 315 | mMailSubject += i18n( "Meeting " )+ event->summary(); |
316 | if (event->cancelled ()) { | 316 | if (event->cancelled ()) { |
317 | mText +="<font color=\"#B00000\">"; | 317 | mText +="<font color=\"#B00000\">"; |
318 | addTag("i",i18n("This event has been cancelled!")); | 318 | addTag("i",i18n("This event has been cancelled!")); |
319 | mText.append("<br>"); | 319 | mText.append("<br>"); |
320 | mText += "</font>"; | 320 | mText += "</font>"; |
321 | mMailSubject += i18n("(cancelled)"); | 321 | mMailSubject += i18n("(cancelled)"); |
322 | } | 322 | } |
323 | 323 | ||
324 | if (event->doesFloat()) { | 324 | if (event->doesFloat()) { |
325 | if (event->isMultiDay()) { | 325 | if (event->isMultiDay()) { |
326 | mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") | 326 | mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") |
327 | .arg(event->dtStartDateStr(shortDate)) | 327 | .arg(event->dtStartDateStr(shortDate)) |
328 | .arg(event->dtEndDateStr(shortDate))); | 328 | .arg(event->dtEndDateStr(shortDate))); |
329 | mText.append(i18n("<p><b>Duration:</b> %1 days</p>") | ||
330 | .arg(event->dtStart().daysTo(event->dtEnd())+1)); | ||
329 | } else { | 331 | } else { |
330 | mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); | 332 | mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); |
331 | } | 333 | } |
332 | } else { | 334 | } else { |
333 | if (event->isMultiDay()) { | 335 | if (event->isMultiDay()) { |
334 | mText.append(i18n("<p><b>From:</b> %1</p> ") | 336 | mText.append(i18n("<p><b>From:</b> %1</p> ") |
335 | .arg(event->dtStartStr( shortDate))); | 337 | .arg(event->dtStartStr( shortDate))); |
336 | mText.append(i18n("<p><b>To:</b> %1</p>") | 338 | mText.append(i18n("<p><b>To:</b> %1</p>") |
337 | .arg(event->dtEndStr(shortDate))); | 339 | .arg(event->dtEndStr(shortDate))); |
338 | } else { | 340 | } else { |
339 | mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>") | 341 | mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>") |
340 | .arg(event->dtStartTimeStr()) | 342 | .arg(event->dtStartTimeStr()) |
341 | .arg(event->dtEndTimeStr())); | 343 | .arg(event->dtEndTimeStr())); |
342 | mText.append(i18n("<p><b>On:</b> %1</p> ") | 344 | mText.append(i18n("<p><b>On:</b> %1</p> ") |
343 | .arg(event->dtStartDateStr( shortDate ))); | 345 | .arg(event->dtStartDateStr( shortDate ))); |
344 | } | 346 | } |
345 | } | 347 | } |
346 | if (!event->location().isEmpty()) { | 348 | if (!event->location().isEmpty()) { |
347 | addTag("p","<b>"+i18n("Location: ")+"</b>"+ deTag(event->location() ) ); | 349 | addTag("p","<b>"+i18n("Location: ")+"</b>"+ deTag(event->location() ) ); |
348 | mMailSubject += i18n(" at ") + event->location(); | 350 | mMailSubject += i18n(" at ") + event->location(); |
349 | } | 351 | } |
350 | if (event->doesRecur()) { | 352 | if (event->doesRecur()) { |
351 | 353 | ||
352 | QString recurText = event->recurrenceText(); | 354 | QString recurText = event->recurrenceText(); |
353 | addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); | 355 | addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); |
354 | bool ok; | 356 | bool ok; |
355 | QDate start = QDate::currentDate(); | 357 | QDate start = QDate::currentDate(); |
356 | QDateTime next; | 358 | QDateTime next; |
357 | next = event->getNextOccurence( QDateTime::currentDateTime() , &ok ); | 359 | next = event->getNextOccurence( QDateTime::currentDateTime() , &ok ); |
358 | if ( ok ) { | 360 | if ( ok ) { |
359 | if ( wideScreen ){ | 361 | if ( wideScreen ){ |
360 | addTag("p",i18n("<b>Next recurrence is on:</b>") +" " + KGlobal::locale()->formatDate( next.date(), shortDate ) ); | 362 | addTag("p",i18n("<b>Next recurrence is on:</b>") +" " + KGlobal::locale()->formatDate( next.date(), shortDate ) ); |
361 | } else { | 363 | } else { |
362 | addTag("p",i18n("<b>Next recurrence is on:</b>") ); | 364 | addTag("p",i18n("<b>Next recurrence is on:</b>") ); |
363 | addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate )); | 365 | addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate )); |
364 | } | 366 | } |
365 | mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( next, true ); | 367 | mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( next, true ); |
366 | 368 | ||
367 | } else { | 369 | } else { |
368 | bool last; | 370 | bool last; |
369 | QDate nextd; | 371 | QDate nextd; |
370 | nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last ); | 372 | nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last ); |
371 | if ( last ) { | 373 | if ( last ) { |
372 | if ( wideScreen ){ | 374 | if ( wideScreen ){ |
373 | addTag("p",i18n("<b>Last recurrence was on:</b>") +" " + KGlobal::locale()->formatDate( nextd, shortDate )); | 375 | addTag("p",i18n("<b>Last recurrence was on:</b>") +" " + KGlobal::locale()->formatDate( nextd, shortDate )); |
374 | } else{ | 376 | } else{ |
375 | addTag("p",i18n("<b>Last recurrence was on:</b>") ); | 377 | addTag("p",i18n("<b>Last recurrence was on:</b>") ); |
376 | addTag("p", KGlobal::locale()->formatDate( nextd, shortDate )); | 378 | addTag("p", KGlobal::locale()->formatDate( nextd, shortDate )); |
377 | } | 379 | } |
378 | } | 380 | } |
379 | } | 381 | } |
380 | } else { | 382 | } else { |
381 | mMailSubject += i18n(" - " )+event->dtStartStr( true ); | 383 | mMailSubject += i18n(" - " )+event->dtStartStr( true ); |
382 | 384 | ||
383 | } | 385 | } |
384 | 386 | ||
385 | 387 | ||
386 | if (event->isAlarmEnabled()) { | 388 | if (event->isAlarmEnabled()) { |
387 | Alarm *alarm =event->alarms().first() ; | 389 | Alarm *alarm =event->alarms().first() ; |
388 | QDateTime t = alarm->time(); | 390 | QDateTime t = alarm->time(); |
389 | QString s =i18n("( %1 before )").arg( alarm->offsetText() ); | 391 | QString s =i18n("( %1 before )").arg( alarm->offsetText() ); |
390 | if(wideScreen ){ | 392 | if(wideScreen ){ |
391 | addTag("p",i18n("<b>Alarm on: ") + s +" </b>"+ KGlobal::locale()->formatDateTime( t, shortDate )); | 393 | addTag("p",i18n("<b>Alarm on: ") + s +" </b>"+ KGlobal::locale()->formatDateTime( t, shortDate )); |
392 | }else{ | 394 | }else{ |
393 | addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); | 395 | addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); |
394 | addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); | 396 | addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); |
395 | } | 397 | } |
396 | //addTag("p",s); | 398 | //addTag("p",s); |
397 | } | 399 | } |
398 | 400 | ||
399 | addTag("p","<b>"+i18n("Access: ") + "</b>" + event->secrecyStr()); | 401 | addTag("p","<b>"+i18n("Access: ") + "</b>" + event->secrecyStr()); |
400 | 402 | ||
401 | formatCategories(event); | 403 | formatCategories(event); |
402 | 404 | ||
403 | formatAttendees(event); | 405 | formatAttendees(event); |
404 | 406 | ||
405 | if ( KOPrefs::instance()->mEVshowCreated ) { | 407 | if ( KOPrefs::instance()->mEVshowCreated ) { |
406 | if(wideScreen ){ | 408 | if(wideScreen ){ |
407 | addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate )); | 409 | addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate )); |
408 | }else{ | 410 | }else{ |
409 | addTag("p",i18n("<b>Created: ") +" </b>"); | 411 | addTag("p",i18n("<b>Created: ") +" </b>"); |
410 | addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); | 412 | addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); |
411 | } | 413 | } |
412 | 414 | ||
413 | 415 | ||
414 | } | 416 | } |
415 | if ( KOPrefs::instance()->mEVshowChanged ) { | 417 | if ( KOPrefs::instance()->mEVshowChanged ) { |
416 | if(wideScreen ){ | 418 | if(wideScreen ){ |
417 | addTag("p",i18n("<b>Last modified: ") +" </b>" + KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ) ); | 419 | addTag("p",i18n("<b>Last modified: ") +" </b>" + KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ) ); |
418 | }else{ | 420 | }else{ |
419 | addTag("p",i18n("<b>Last modified: ") +" </b>"); | 421 | addTag("p",i18n("<b>Last modified: ") +" </b>"); |
420 | addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); | 422 | addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); |
421 | } | 423 | } |
422 | 424 | ||
423 | } | 425 | } |
424 | if ( KOPrefs::instance()->mEVshowDetails ) { | 426 | if ( KOPrefs::instance()->mEVshowDetails ) { |
425 | if (!event->description().isEmpty()) { | 427 | if (!event->description().isEmpty()) { |
426 | addTag("p",i18n("<b>Details: </b>")); | 428 | addTag("p",i18n("<b>Details: </b>")); |
427 | addTag("p",deTag(event->description())); | 429 | addTag("p",deTag(event->description())); |
428 | } | 430 | } |
429 | } | 431 | } |
430 | setText(mText); | 432 | setText(mText); |
431 | //QWhatsThis::add(this,mText); | 433 | //QWhatsThis::add(this,mText); |
432 | 434 | ||
433 | } | 435 | } |
434 | 436 | ||
435 | void KOEventViewer::appendTodo(Todo *event, int mode ) | 437 | void KOEventViewer::appendTodo(Todo *event, int mode ) |
436 | { | 438 | { |
437 | mMailSubject = ""; | 439 | mMailSubject = ""; |
438 | mCurrentIncidence = event; | 440 | mCurrentIncidence = event; |
439 | topLevelWidget()->setCaption(i18n("Todo Viewer")); | 441 | topLevelWidget()->setCaption(i18n("Todo Viewer")); |
440 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; | 442 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; |
441 | bool wideScreen = ( QApplication::desktop()->width() >= 640 ); | 443 | bool wideScreen = ( QApplication::desktop()->width() >= 640 ); |
442 | if (mode == 0 ) { | 444 | if (mode == 0 ) { |
443 | addTag("h2",deTag(event->summary())); | 445 | addTag("h2",deTag(event->summary())); |
444 | formatReadOnly(event); | 446 | formatReadOnly(event); |
445 | } | 447 | } |
446 | else { | 448 | else { |
447 | if ( mColorMode == 1 ) { | 449 | if ( mColorMode == 1 ) { |
448 | mText +="<font color=\"#00A000\">"; | 450 | mText +="<font color=\"#00A000\">"; |
449 | } | 451 | } |
450 | if ( mColorMode == 2 ) { | 452 | if ( mColorMode == 2 ) { |
451 | mText +="<font color=\"#B00000\">"; | 453 | mText +="<font color=\"#B00000\">"; |
452 | } | 454 | } |
453 | if ( mode == 1 ) { | 455 | if ( mode == 1 ) { |
454 | addTag("h2",i18n( "Local: " ) +deTag(event->summary())); | 456 | addTag("h2",i18n( "Local: " ) +deTag(event->summary())); |
455 | } else { | 457 | } else { |
456 | addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); | 458 | addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); |
457 | } | 459 | } |
458 | formatReadOnly(event); | 460 | formatReadOnly(event); |
459 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); | 461 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); |
460 | if ( mColorMode ) | 462 | if ( mColorMode ) |
461 | mText += "</font>"; | 463 | mText += "</font>"; |
462 | } | 464 | } |
463 | mMailSubject += i18n( "Todo " )+ event->summary(); | 465 | mMailSubject += i18n( "Todo " )+ event->summary(); |
464 | 466 | ||
465 | if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { | 467 | if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { |
466 | mText +="<font color=\"#B00000\">"; | 468 | mText +="<font color=\"#B00000\">"; |
467 | addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(KOPrefs::instance()->mShortDateInViewer) ) ); | 469 | addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(KOPrefs::instance()->mShortDateInViewer) ) ); |
468 | mText += "</font>"; | 470 | mText += "</font>"; |
469 | } else { | 471 | } else { |
470 | mText.append(i18n("<p><i>%1 % completed</i></p>") | 472 | mText.append(i18n("<p><i>%1 % completed</i></p>") |
471 | .arg(event->percentComplete())); | 473 | .arg(event->percentComplete())); |
472 | } | 474 | } |
473 | 475 | ||
474 | if (event->cancelled ()) { | 476 | if (event->cancelled ()) { |
475 | mText +="<font color=\"#B00000\">"; | 477 | mText +="<font color=\"#B00000\">"; |
476 | addTag("i",i18n("This todo has been cancelled!")); | 478 | addTag("i",i18n("This todo has been cancelled!")); |
477 | mText.append("<br>"); | 479 | mText.append("<br>"); |
478 | mText += "</font>"; | 480 | mText += "</font>"; |
479 | mMailSubject += i18n("(cancelled)"); | 481 | mMailSubject += i18n("(cancelled)"); |
480 | } | 482 | } |
481 | 483 | ||
482 | 484 | ||
483 | 485 | ||
484 | if (event->doesRecur()) { | 486 | if (event->doesRecur()) { |
485 | 487 | ||
486 | QString recurText = event->recurrence()->recurrenceText(); | 488 | QString recurText = event->recurrence()->recurrenceText(); |
487 | addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>"); | 489 | addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>"); |
488 | 490 | ||
489 | } | 491 | } |
490 | if (event->hasStartDate()) { | 492 | if (event->hasStartDate()) { |
491 | mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(KOPrefs::instance()->mShortDateInViewer))); | 493 | mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(KOPrefs::instance()->mShortDateInViewer))); |
492 | } | 494 | } |
493 | if (event->hasDueDate()) { | 495 | if (event->hasDueDate()) { |
494 | mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer))); | 496 | mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer))); |
495 | mMailSubject += i18n(" - " )+event->dtDueStr( true ); | 497 | mMailSubject += i18n(" - " )+event->dtDueStr( true ); |
496 | } | 498 | } |
497 | if (!event->location().isEmpty()) { | 499 | if (!event->location().isEmpty()) { |
498 | addTag("p","<b>"+i18n("Location: ")+"</b>"+ deTag(event->location() ) ); | 500 | addTag("p","<b>"+i18n("Location: ")+"</b>"+ deTag(event->location() ) ); |
499 | mMailSubject += i18n(" at ") + event->location(); | 501 | mMailSubject += i18n(" at ") + event->location(); |
500 | } | 502 | } |
501 | mText.append(i18n("<p><b>Priority:</b> %2</p>") | 503 | mText.append(i18n("<p><b>Priority:</b> %2</p>") |
502 | .arg(QString::number(event->priority()))); | 504 | .arg(QString::number(event->priority()))); |
503 | 505 | ||
504 | if (event->isAlarmEnabled()) { | 506 | if (event->isAlarmEnabled()) { |
505 | Alarm *alarm =event->alarms().first() ; | 507 | Alarm *alarm =event->alarms().first() ; |
506 | QDateTime t = alarm->time(); | 508 | QDateTime t = alarm->time(); |
507 | QString s =i18n("( %1 before )").arg( alarm->offsetText() ); | 509 | QString s =i18n("( %1 before )").arg( alarm->offsetText() ); |
508 | if ( wideScreen ) { | 510 | if ( wideScreen ) { |
509 | addTag("p",i18n("<b>Alarm on: ") + s +" </b>"+ KGlobal::locale()->formatDateTime( t, shortDate )); | 511 | addTag("p",i18n("<b>Alarm on: ") + s +" </b>"+ KGlobal::locale()->formatDateTime( t, shortDate )); |
510 | } else { | 512 | } else { |
511 | addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); | 513 | addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); |
512 | addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); | 514 | addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); |
513 | } | 515 | } |
514 | } | 516 | } |
515 | 517 | ||
516 | addTag("p","<b>"+i18n("Access: ") + "</b>" + event->secrecyStr()); | 518 | addTag("p","<b>"+i18n("Access: ") + "</b>" + event->secrecyStr()); |
517 | 519 | ||
518 | formatCategories(event); | 520 | formatCategories(event); |
519 | 521 | ||
520 | formatAttendees(event); | 522 | formatAttendees(event); |
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 8d06040..610aae6 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -548,386 +548,391 @@ QToolTipGroup *MonthViewCell::toolTipGroup() | |||
548 | if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); | 548 | if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); |
549 | return mToolTipGroup; | 549 | return mToolTipGroup; |
550 | } | 550 | } |
551 | #endif | 551 | #endif |
552 | 552 | ||
553 | void MonthViewCell::setDate( const QDate &date ) | 553 | void MonthViewCell::setDate( const QDate &date ) |
554 | { | 554 | { |
555 | // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl; | 555 | // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl; |
556 | mDate = date; | 556 | mDate = date; |
557 | 557 | ||
558 | 558 | ||
559 | 559 | ||
560 | //resizeEvent( 0 ); | 560 | //resizeEvent( 0 ); |
561 | } | 561 | } |
562 | 562 | ||
563 | QDate MonthViewCell::date() const | 563 | QDate MonthViewCell::date() const |
564 | { | 564 | { |
565 | return mDate; | 565 | return mDate; |
566 | } | 566 | } |
567 | 567 | ||
568 | void MonthViewCell::setPrimary( bool primary ) | 568 | void MonthViewCell::setPrimary( bool primary ) |
569 | { | 569 | { |
570 | mPrimary = primary; | 570 | mPrimary = primary; |
571 | //setMyPalette(); | 571 | //setMyPalette(); |
572 | } | 572 | } |
573 | void MonthViewCell::setMyPalette() | 573 | void MonthViewCell::setMyPalette() |
574 | { | 574 | { |
575 | 575 | ||
576 | if ( mHoliday) { | 576 | if ( mHoliday) { |
577 | if ( currentPalette == 1 ) return; | 577 | if ( currentPalette == 1 ) return; |
578 | mLabel->setPalette( QPalette ( mHolidayPalette.color( QPalette::Normal,QColorGroup::Base),mHolidayPalette.color(QPalette::Normal,QColorGroup::Base ) )); | 578 | mLabel->setPalette( QPalette ( mHolidayPalette.color( QPalette::Normal,QColorGroup::Base),mHolidayPalette.color(QPalette::Normal,QColorGroup::Base ) )); |
579 | setPalette( mHolidayPalette ); | 579 | setPalette( mHolidayPalette ); |
580 | //mLabel->setPalette( mHolidayPalette ); | 580 | //mLabel->setPalette( mHolidayPalette ); |
581 | currentPalette = 1; | 581 | currentPalette = 1; |
582 | 582 | ||
583 | } else { | 583 | } else { |
584 | if ( mPrimary ) { | 584 | if ( mPrimary ) { |
585 | if ( currentPalette == 2 ) return; | 585 | if ( currentPalette == 2 ) return; |
586 | mLabel->setPalette( QPalette ( mPrimaryPalette.color( QPalette::Normal,QColorGroup::Base),mPrimaryPalette.color(QPalette::Normal,QColorGroup::Base ) )); | 586 | mLabel->setPalette( QPalette ( mPrimaryPalette.color( QPalette::Normal,QColorGroup::Base),mPrimaryPalette.color(QPalette::Normal,QColorGroup::Base ) )); |
587 | //mLabel->setPalette( mPrimaryPalette ); | 587 | //mLabel->setPalette( mPrimaryPalette ); |
588 | setPalette( mPrimaryPalette ); | 588 | setPalette( mPrimaryPalette ); |
589 | currentPalette = 2; | 589 | currentPalette = 2; |
590 | 590 | ||
591 | } else { | 591 | } else { |
592 | if ( currentPalette == 3 ) return; | 592 | if ( currentPalette == 3 ) return; |
593 | setPalette( mNonPrimaryPalette ); | 593 | setPalette( mNonPrimaryPalette ); |
594 | mLabel->setPalette( QPalette ( mNonPrimaryPalette.color( QPalette::Normal,QColorGroup::Base),mNonPrimaryPalette.color(QPalette::Normal,QColorGroup::Base ) )); | 594 | mLabel->setPalette( QPalette ( mNonPrimaryPalette.color( QPalette::Normal,QColorGroup::Base),mNonPrimaryPalette.color(QPalette::Normal,QColorGroup::Base ) )); |
595 | //mLabel->setPalette( mNonPrimaryPalette );; | 595 | //mLabel->setPalette( mNonPrimaryPalette );; |
596 | currentPalette = 3; | 596 | currentPalette = 3; |
597 | } | 597 | } |
598 | } | 598 | } |
599 | //QPalette pal = palette(); | 599 | //QPalette pal = palette(); |
600 | 600 | ||
601 | //mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) )); | 601 | //mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) )); |
602 | } | 602 | } |
603 | QPalette MonthViewCell::getPalette () | 603 | QPalette MonthViewCell::getPalette () |
604 | { | 604 | { |
605 | if ( !KOPrefs::instance()->mMonthViewUsesDayColors ) | 605 | if ( !KOPrefs::instance()->mMonthViewUsesDayColors ) |
606 | return mStandardPalette; | 606 | return mStandardPalette; |
607 | if ( mHoliday) { | 607 | if ( mHoliday) { |
608 | return mHolidayPalette ; | 608 | return mHolidayPalette ; |
609 | } else { | 609 | } else { |
610 | if ( mPrimary ) { | 610 | if ( mPrimary ) { |
611 | return mPrimaryPalette ; | 611 | return mPrimaryPalette ; |
612 | } | 612 | } |
613 | } | 613 | } |
614 | return mNonPrimaryPalette; | 614 | return mNonPrimaryPalette; |
615 | } | 615 | } |
616 | bool MonthViewCell::isPrimary() const | 616 | bool MonthViewCell::isPrimary() const |
617 | { | 617 | { |
618 | return mPrimary; | 618 | return mPrimary; |
619 | } | 619 | } |
620 | 620 | ||
621 | void MonthViewCell::setHoliday( bool holiday ) | 621 | void MonthViewCell::setHoliday( bool holiday ) |
622 | { | 622 | { |
623 | mHoliday = holiday; | 623 | mHoliday = holiday; |
624 | //setMyPalette(); | 624 | //setMyPalette(); |
625 | } | 625 | } |
626 | 626 | ||
627 | void MonthViewCell::setHoliday( const QString &holiday ) | 627 | void MonthViewCell::setHoliday( const QString &holiday ) |
628 | { | 628 | { |
629 | mHolidayString = holiday; | 629 | mHolidayString = holiday; |
630 | 630 | ||
631 | if ( !holiday.isEmpty() ) { | 631 | if ( !holiday.isEmpty() ) { |
632 | setHoliday( true ); | 632 | setHoliday( true ); |
633 | } | 633 | } |
634 | } | 634 | } |
635 | 635 | ||
636 | void MonthViewCell::startUpdateCell() | 636 | void MonthViewCell::startUpdateCell() |
637 | { | 637 | { |
638 | blockSignals( true ); | 638 | blockSignals( true ); |
639 | mdayCount = 0; | 639 | mdayCount = 0; |
640 | setFocusPolicy(NoFocus); | 640 | setFocusPolicy(NoFocus); |
641 | if ( !mMonthView->isUpdatePossible() ) | 641 | if ( !mMonthView->isUpdatePossible() ) |
642 | return; | 642 | return; |
643 | MonthViewItem *mitem = (MonthViewItem*) firstItem (); | 643 | MonthViewItem *mitem = (MonthViewItem*) firstItem (); |
644 | while ( mitem ) { | 644 | while ( mitem ) { |
645 | mitem->setBlockRepaint( true ); | 645 | mitem->setBlockRepaint( true ); |
646 | mitem = (MonthViewItem *)mitem->next(); | 646 | mitem = (MonthViewItem *)mitem->next(); |
647 | } | 647 | } |
648 | if ( mAvailItemList.count() > 20 ) { | 648 | if ( mAvailItemList.count() > 20 ) { |
649 | mAvailItemList.setAutoDelete( true ); | 649 | mAvailItemList.setAutoDelete( true ); |
650 | mAvailItemList.clear(); | 650 | mAvailItemList.clear(); |
651 | mAvailItemList.setAutoDelete( false ); | 651 | mAvailItemList.setAutoDelete( false ); |
652 | clear(); | 652 | clear(); |
653 | } | 653 | } |
654 | 654 | ||
655 | setPrimary( mDate.month()%2 ); | 655 | setPrimary( mDate.month()%2 ); |
656 | setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); | 656 | setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); |
657 | if ( mDate == QDate::currentDate() ) { | 657 | if ( mDate == QDate::currentDate() ) { |
658 | setLineWidth( 3 ); | 658 | setLineWidth( 3 ); |
659 | } else { | 659 | } else { |
660 | setLineWidth( 1 ); | 660 | setLineWidth( 1 ); |
661 | } | 661 | } |
662 | MonthViewItem* CurrentAvailItem = (MonthViewItem*) firstItem (); | 662 | MonthViewItem* CurrentAvailItem = (MonthViewItem*) firstItem (); |
663 | //clear(); | 663 | //clear(); |
664 | while ( CurrentAvailItem ) { | 664 | while ( CurrentAvailItem ) { |
665 | MonthViewItem *item = CurrentAvailItem; | 665 | MonthViewItem *item = CurrentAvailItem; |
666 | //item->setHighlightedFalse(); | 666 | //item->setHighlightedFalse(); |
667 | item->recycle( 0, ""); | 667 | item->recycle( 0, ""); |
668 | CurrentAvailItem = (MonthViewItem *)item->next(); | 668 | CurrentAvailItem = (MonthViewItem *)item->next(); |
669 | mAvailItemList.append( item ); | 669 | mAvailItemList.append( item ); |
670 | takeItem ( item ); | 670 | takeItem ( item ); |
671 | } | 671 | } |
672 | 672 | ||
673 | #ifdef DESKTOP_VERSION | 673 | #ifdef DESKTOP_VERSION |
674 | QToolTip::remove(this); | 674 | QToolTip::remove(this); |
675 | #endif | 675 | #endif |
676 | mToolTip.clear(); | 676 | mToolTip.clear(); |
677 | //qApp->processEvents(); | 677 | //qApp->processEvents(); |
678 | #if 0 | 678 | #if 0 |
679 | if ( !mHolidayString.isEmpty() ) { | 679 | if ( !mHolidayString.isEmpty() ) { |
680 | MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); | 680 | MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); |
681 | item->setPalette( mHolidayPalette ); | 681 | item->setPalette( mHolidayPalette ); |
682 | insertItem( item ); | 682 | insertItem( item ); |
683 | mToolTip.append ( mHolidayString ); | 683 | mToolTip.append ( mHolidayString ); |
684 | } | 684 | } |
685 | #endif | 685 | #endif |
686 | } | 686 | } |
687 | 687 | ||
688 | int MonthViewCell::insertEvent(Event *event) | 688 | int MonthViewCell::insertEvent(Event *event) |
689 | { | 689 | { |
690 | bool useToolTips = true; | 690 | bool useToolTips = true; |
691 | #ifndef DESKTOP_VERSION | 691 | #ifndef DESKTOP_VERSION |
692 | useToolTips = false; | 692 | useToolTips = false; |
693 | #endif | 693 | #endif |
694 | QString mToolTipText; | 694 | QString mToolTipText; |
695 | setFocusPolicy(WheelFocus); | 695 | setFocusPolicy(WheelFocus); |
696 | if ( !(event->doesRecur() == Recurrence::rNone) ) { | 696 | if ( !(event->doesRecur() == Recurrence::rNone) ) { |
697 | if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) | 697 | if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) |
698 | return mdayCount; | 698 | return mdayCount; |
699 | else | 699 | else |
700 | if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) | 700 | if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) |
701 | return mdayCount; | 701 | return mdayCount; |
702 | } | 702 | } |
703 | 703 | ||
704 | if ( event->isHoliday()) { | 704 | if ( event->isHoliday()) { |
705 | setHoliday( true ); | 705 | setHoliday( true ); |
706 | if ( mDate.dayOfWeek() == 7 ) | 706 | if ( mDate.dayOfWeek() == 7 ) |
707 | setLineWidth( 3 ); | 707 | setLineWidth( 3 ); |
708 | } | 708 | } |
709 | QString text; | 709 | QString text; |
710 | int multiday = 0;// 1 = start, 2 = midddle, 3 = end day | 710 | int multiday = 0;// 1 = start, 2 = midddle, 3 = end day |
711 | if (event->isMultiDay()) { | 711 | if (event->isMultiDay()) { |
712 | QString prefix = "<->";multiday = 2; | 712 | QString prefix = "<->";multiday = 2; |
713 | QString time; | 713 | QString time; |
714 | if ( event->doesRecur() ) { | 714 | if ( event->doesRecur() ) { |
715 | if ( event->recursOn( mDate) ) { | 715 | if ( event->recursOn( mDate) ) { |
716 | prefix ="->" ;multiday = 1; | 716 | prefix ="->" ;multiday = 1; |
717 | } | 717 | } |
718 | else { | 718 | else { |
719 | int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); | 719 | int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); |
720 | if ( event->recursOn( mDate.addDays( -days)) ) { | 720 | if ( event->recursOn( mDate.addDays( -days)) ) { |
721 | prefix ="<-" ;multiday = 3; | 721 | prefix ="<-" ;multiday = 3; |
722 | } | 722 | } |
723 | } | 723 | } |
724 | 724 | ||
725 | } else { | 725 | } else { |
726 | if (mDate == event->dtStart().date()) { | 726 | if (mDate == event->dtStart().date()) { |
727 | prefix ="->" ;multiday = 1; | 727 | prefix ="->" ;multiday = 1; |
728 | } else if (mDate == event->dtEnd().date()) { | 728 | } else if (mDate == event->dtEnd().date()) { |
729 | prefix ="<-" ;multiday = 3; | 729 | prefix ="<-" ;multiday = 3; |
730 | } | 730 | } |
731 | } | 731 | } |
732 | if ( !event->doesFloat() ) { | 732 | if ( !event->doesFloat() ) { |
733 | if ( mDate == event->dtStart().date () ) | 733 | if ( mDate == event->dtStart().date () ) |
734 | time = KGlobal::locale()->formatTime(event->dtStart().time())+" "; | 734 | time = KGlobal::locale()->formatTime(event->dtStart().time())+" "; |
735 | else if ( mDate == event->dtEnd().date () ) | 735 | else if ( mDate == event->dtEnd().date () ) |
736 | time = KGlobal::locale()->formatTime(event->dtEnd().time())+" "; | 736 | time = KGlobal::locale()->formatTime(event->dtEnd().time())+" "; |
737 | 737 | ||
738 | } | 738 | } |
739 | text = time + event->summary(); | 739 | text = time + event->summary(); |
740 | if ( useToolTips ) | 740 | if ( useToolTips ) { |
741 | mToolTipText += prefix + text; | 741 | mToolTipText += prefix + text; |
742 | if ( event->doesFloat() ) { | ||
743 | mToolTipText += i18n(" (Duration: %1 days)" ).arg ( event->dtStart().daysTo(event->dtEnd())+1); | ||
744 | |||
745 | } | ||
746 | } | ||
742 | } else { | 747 | } else { |
743 | if (event->doesFloat()) { | 748 | if (event->doesFloat()) { |
744 | text = event->summary(); | 749 | text = event->summary(); |
745 | if ( useToolTips ) | 750 | if ( useToolTips ) |
746 | mToolTipText += text; | 751 | mToolTipText += text; |
747 | } | 752 | } |
748 | else { | 753 | else { |
749 | text = KGlobal::locale()->formatTime(event->dtStart().time()); | 754 | text = KGlobal::locale()->formatTime(event->dtStart().time()); |
750 | text += " " + event->summary(); | 755 | text += " " + event->summary(); |
751 | if ( useToolTips ) | 756 | if ( useToolTips ) |
752 | mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); | 757 | mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); |
753 | } | 758 | } |
754 | } | 759 | } |
755 | if ( useToolTips && ! event->location().isEmpty() ) { | 760 | if ( useToolTips && ! event->location().isEmpty() ) { |
756 | mToolTipText += " (" + event->location() +")"; | 761 | mToolTipText += " (" + event->location() +")"; |
757 | } | 762 | } |
758 | MonthViewItem *item ; | 763 | MonthViewItem *item ; |
759 | 764 | ||
760 | if ( mAvailItemList.count() ) { | 765 | if ( mAvailItemList.count() ) { |
761 | item = mAvailItemList.first(); | 766 | item = mAvailItemList.first(); |
762 | mAvailItemList.remove( item ); | 767 | mAvailItemList.remove( item ); |
763 | item->recycle( event, text ); | 768 | item->recycle( event, text ); |
764 | } else { | 769 | } else { |
765 | item = new MonthViewItem( event, text ); | 770 | item = new MonthViewItem( event, text ); |
766 | } | 771 | } |
767 | 772 | ||
768 | QPalette pal; | 773 | QPalette pal; |
769 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { | 774 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { |
770 | QStringList categories = event->categories(); | 775 | QStringList categories = event->categories(); |
771 | QString cat = categories.first(); | 776 | QString cat = categories.first(); |
772 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { | 777 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { |
773 | pal = getPalette(); | 778 | pal = getPalette(); |
774 | if (cat.isEmpty()) { | 779 | if (cat.isEmpty()) { |
775 | //pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); | 780 | //pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); |
776 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->defaultColor( event->calID() )); | 781 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->defaultColor( event->calID() )); |
777 | } else { | 782 | } else { |
778 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); | 783 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); |
779 | } | 784 | } |
780 | 785 | ||
781 | } else { | 786 | } else { |
782 | if (cat.isEmpty()) { | 787 | if (cat.isEmpty()) { |
783 | //pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); | 788 | //pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); |
784 | pal = QPalette( KOPrefs::instance()->defaultColor( event->calID() ), KOPrefs::instance()->defaultColor( event->calID() )); | 789 | pal = QPalette( KOPrefs::instance()->defaultColor( event->calID() ), KOPrefs::instance()->defaultColor( event->calID() )); |
785 | } else { | 790 | } else { |
786 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); | 791 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); |
787 | } | 792 | } |
788 | } | 793 | } |
789 | 794 | ||
790 | } else { | 795 | } else { |
791 | pal = mStandardPalette ; | 796 | pal = mStandardPalette ; |
792 | } | 797 | } |
793 | pal.setColor(QColorGroup::Highlight, KOPrefs::instance()->mHighlightColor); | 798 | pal.setColor(QColorGroup::Highlight, KOPrefs::instance()->mHighlightColor); |
794 | item->setPalette( pal ); | 799 | item->setPalette( pal ); |
795 | item->setRecur( event->doesRecur() ); | 800 | item->setRecur( event->doesRecur() ); |
796 | item->setAlarm( event->isAlarmEnabled() && multiday < 2 && event->alarmEnabled() ); | 801 | item->setAlarm( event->isAlarmEnabled() && multiday < 2 && event->alarmEnabled() ); |
797 | item->setMoreInfo( event->description().length() > 0 ); | 802 | item->setMoreInfo( event->description().length() > 0 ); |
798 | #ifdef DESKTOP_VERSION | 803 | #ifdef DESKTOP_VERSION |
799 | Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, | 804 | Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, |
800 | KOPrefs::instance()->email()); | 805 | KOPrefs::instance()->email()); |
801 | if ( me != 0 ) { | 806 | if ( me != 0 ) { |
802 | if ( me->status() == Attendee::NeedsAction && me->RSVP()) | 807 | if ( me->status() == Attendee::NeedsAction && me->RSVP()) |
803 | item->setReply(true && multiday < 2); | 808 | item->setReply(true && multiday < 2); |
804 | else | 809 | else |
805 | item->setReply(false); | 810 | item->setReply(false); |
806 | } else | 811 | } else |
807 | item->setReply(false); | 812 | item->setReply(false); |
808 | #endif | 813 | #endif |
809 | 814 | ||
810 | item->setMultiDay( multiday ); | 815 | item->setMultiDay( multiday ); |
811 | if ( multiday ) { | 816 | if ( multiday ) { |
812 | insertItem( item ,mdayCount); | 817 | insertItem( item ,mdayCount); |
813 | ++mdayCount; | 818 | ++mdayCount; |
814 | } else { | 819 | } else { |
815 | uint i = mdayCount; | 820 | uint i = mdayCount; |
816 | uint pos = mdayCount; | 821 | uint pos = mdayCount; |
817 | uint itcount = count(); | 822 | uint itcount = count(); |
818 | if ( itcount > 1000 ) { | 823 | if ( itcount > 1000 ) { |
819 | qDebug("KO: Bug in MonthViewCell::insertEvent %u ", itcount); | 824 | qDebug("KO: Bug in MonthViewCell::insertEvent %u ", itcount); |
820 | itcount = 0; | 825 | itcount = 0; |
821 | } | 826 | } |
822 | for ( i = pos; i < itcount;++i ) { | 827 | for ( i = pos; i < itcount;++i ) { |
823 | // qDebug("i %d mday %u count %d ",i,itcount,mdayCount ); | 828 | // qDebug("i %d mday %u count %d ",i,itcount,mdayCount ); |
824 | QListBoxItem* it = this->item ( i ); | 829 | QListBoxItem* it = this->item ( i ); |
825 | if ( it && text < it->text() ) { | 830 | if ( it && text < it->text() ) { |
826 | pos = i; | 831 | pos = i; |
827 | break; | 832 | break; |
828 | } | 833 | } |
829 | ++pos; | 834 | ++pos; |
830 | } | 835 | } |
831 | insertItem( item ,pos); | 836 | insertItem( item ,pos); |
832 | } | 837 | } |
833 | if ( useToolTips ) { | 838 | if ( useToolTips ) { |
834 | mToolTip.append( mToolTipText ); | 839 | mToolTip.append( mToolTipText ); |
835 | } | 840 | } |
836 | return mdayCount; | 841 | return mdayCount; |
837 | } | 842 | } |
838 | void MonthViewCell::insertTodo(Todo *todo) | 843 | void MonthViewCell::insertTodo(Todo *todo) |
839 | { | 844 | { |
840 | setFocusPolicy(WheelFocus); | 845 | setFocusPolicy(WheelFocus); |
841 | QString text; | 846 | QString text; |
842 | if (todo->hasDueDate()) { | 847 | if (todo->hasDueDate()) { |
843 | if (!todo->doesFloat()) { | 848 | if (!todo->doesFloat()) { |
844 | text += KGlobal::locale()->formatTime(todo->dtDue().time()); | 849 | text += KGlobal::locale()->formatTime(todo->dtDue().time()); |
845 | text += " "; | 850 | text += " "; |
846 | } | 851 | } |
847 | } | 852 | } |
848 | text += todo->summary(); | 853 | text += todo->summary(); |
849 | MonthViewItem *item ; | 854 | MonthViewItem *item ; |
850 | if ( mAvailItemList.count() ) { | 855 | if ( mAvailItemList.count() ) { |
851 | item = mAvailItemList.first(); | 856 | item = mAvailItemList.first(); |
852 | mAvailItemList.remove( item ); | 857 | mAvailItemList.remove( item ); |
853 | item->recycle( todo, text ); | 858 | item->recycle( todo, text ); |
854 | } else { | 859 | } else { |
855 | item = new MonthViewItem( todo, text ); | 860 | item = new MonthViewItem( todo, text ); |
856 | } | 861 | } |
857 | //MonthViewItem *item = new MonthViewItem( todo, mDate, text ); | 862 | //MonthViewItem *item = new MonthViewItem( todo, mDate, text ); |
858 | //item->setPalette( mStandardPalette ); | 863 | //item->setPalette( mStandardPalette ); |
859 | QPalette pal; | 864 | QPalette pal; |
860 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { | 865 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { |
861 | QStringList categories = todo->categories(); | 866 | QStringList categories = todo->categories(); |
862 | QString cat = categories.first(); | 867 | QString cat = categories.first(); |
863 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { | 868 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { |
864 | pal = getPalette(); | 869 | pal = getPalette(); |
865 | if (cat.isEmpty()) { | 870 | if (cat.isEmpty()) { |
866 | //pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); | 871 | //pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); |
867 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->defaultColor( todo->calID() )); | 872 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->defaultColor( todo->calID() )); |
868 | } else { | 873 | } else { |
869 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); | 874 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); |
870 | } | 875 | } |
871 | 876 | ||
872 | } else { | 877 | } else { |
873 | if (cat.isEmpty()) { | 878 | if (cat.isEmpty()) { |
874 | //pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); | 879 | //pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); |
875 | pal = QPalette(KOPrefs::instance()->defaultColor( todo->calID() ), KOPrefs::instance()->defaultColor( todo->calID() )); | 880 | pal = QPalette(KOPrefs::instance()->defaultColor( todo->calID() ), KOPrefs::instance()->defaultColor( todo->calID() )); |
876 | } else { | 881 | } else { |
877 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); | 882 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); |
878 | } | 883 | } |
879 | } | 884 | } |
880 | 885 | ||
881 | } else { | 886 | } else { |
882 | pal = mStandardPalette ; | 887 | pal = mStandardPalette ; |
883 | } | 888 | } |
884 | pal.setColor(QColorGroup::Highlight, KOPrefs::instance()->mHighlightColor); | 889 | pal.setColor(QColorGroup::Highlight, KOPrefs::instance()->mHighlightColor); |
885 | item->setPalette( pal ); | 890 | item->setPalette( pal ); |
886 | item->setRecur( todo->doesRecur() ); | 891 | item->setRecur( todo->doesRecur() ); |
887 | item->setAlarm( todo->isAlarmEnabled() && todo->alarmEnabled() ); | 892 | item->setAlarm( todo->isAlarmEnabled() && todo->alarmEnabled() ); |
888 | item->setMoreInfo( todo->description().length() > 0 ); | 893 | item->setMoreInfo( todo->description().length() > 0 ); |
889 | insertItem( item , count()); | 894 | insertItem( item , count()); |
890 | #ifdef DESKTOP_VERSION | 895 | #ifdef DESKTOP_VERSION |
891 | mToolTip.append( text ); | 896 | mToolTip.append( text ); |
892 | #endif | 897 | #endif |
893 | } | 898 | } |
894 | void MonthViewCell::repaintfinishUpdateCell() | 899 | void MonthViewCell::repaintfinishUpdateCell() |
895 | { | 900 | { |
896 | MonthViewItem *mitem = (MonthViewItem*) firstItem (); | 901 | MonthViewItem *mitem = (MonthViewItem*) firstItem (); |
897 | while ( mitem ) { | 902 | while ( mitem ) { |
898 | mitem->setBlockRepaint( false ); | 903 | mitem->setBlockRepaint( false ); |
899 | updateItem ( mitem ); | 904 | updateItem ( mitem ); |
900 | mitem = (MonthViewItem *)mitem->next(); | 905 | mitem = (MonthViewItem *)mitem->next(); |
901 | } | 906 | } |
902 | blockSignals( false ); | 907 | blockSignals( false ); |
903 | } | 908 | } |
904 | void MonthViewCell::finishUpdateCell() | 909 | void MonthViewCell::finishUpdateCell() |
905 | { | 910 | { |
906 | 911 | ||
907 | 912 | ||
908 | 913 | ||
909 | #ifdef DESKTOP_VERSION | 914 | #ifdef DESKTOP_VERSION |
910 | if (mToolTip.count() > 0 ) { | 915 | if (mToolTip.count() > 0 ) { |
911 | mToolTip.sort(); | 916 | mToolTip.sort(); |
912 | QToolTip::add(this,mToolTip.join("\n"),toolTipGroup(),""); | 917 | QToolTip::add(this,mToolTip.join("\n"),toolTipGroup(),""); |
913 | } | 918 | } |
914 | #endif | 919 | #endif |
915 | //sort(); | 920 | //sort(); |
916 | //setMyPalette(); | 921 | //setMyPalette(); |
917 | setMyPalette(); | 922 | setMyPalette(); |
918 | 923 | ||
919 | resizeEvent( 0 ); | 924 | resizeEvent( 0 ); |
920 | 925 | ||
921 | } | 926 | } |
922 | void MonthViewCell::updateCell() | 927 | void MonthViewCell::updateCell() |
923 | { | 928 | { |
924 | if ( !mMonthView->isUpdatePossible() ) | 929 | if ( !mMonthView->isUpdatePossible() ) |
925 | return; | 930 | return; |
926 | startUpdateCell(); | 931 | startUpdateCell(); |
927 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); | 932 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); |
928 | QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); | 933 | QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); |
929 | Event *event; | 934 | Event *event; |
930 | for( event = events.first(); event; event = events.next() ) { // for event | 935 | for( event = events.first(); event; event = events.next() ) { // for event |
931 | insertEvent(event); | 936 | insertEvent(event); |
932 | } | 937 | } |
933 | // insert due todos | 938 | // insert due todos |