-rw-r--r-- | korganizer/koeventviewer.cpp | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp index bac66d3..1f69700 100644 --- a/korganizer/koeventviewer.cpp +++ b/korganizer/koeventviewer.cpp | |||
@@ -47,12 +47,16 @@ | |||
47 | 47 | ||
48 | #include "koeventviewer.h" | 48 | #include "koeventviewer.h" |
49 | #ifndef KORG_NOKABC | 49 | #ifndef KORG_NOKABC |
50 | #include <kabc/stdaddressbook.h> | 50 | #include <kabc/stdaddressbook.h> |
51 | #define size count | 51 | #define size count |
52 | #endif | 52 | #endif |
53 | #ifndef DESKTOP_VERSION | ||
54 | #include <qtopia/qcopenvelope_qws.h> | ||
55 | #endif | ||
56 | |||
53 | KOEventViewer::KOEventViewer(QWidget *parent,const char *name) | 57 | KOEventViewer::KOEventViewer(QWidget *parent,const char *name) |
54 | : QTextBrowser(parent,name) | 58 | : QTextBrowser(parent,name) |
55 | { | 59 | { |
56 | mSyncMode = false; | 60 | mSyncMode = false; |
57 | mColorMode = 0; | 61 | mColorMode = 0; |
58 | } | 62 | } |
@@ -60,12 +64,14 @@ KOEventViewer::KOEventViewer(QWidget *parent,const char *name) | |||
60 | KOEventViewer::~KOEventViewer() | 64 | KOEventViewer::~KOEventViewer() |
61 | { | 65 | { |
62 | } | 66 | } |
63 | 67 | ||
64 | void KOEventViewer::setSource(const QString& n) | 68 | void KOEventViewer::setSource(const QString& n) |
65 | { | 69 | { |
70 | |||
71 | if ( n.left(3) == "uid" ) { | ||
66 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); | 72 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); |
67 | KABC::AddressBook::Iterator it; | 73 | KABC::AddressBook::Iterator it; |
68 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { | 74 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { |
69 | // LR I do not understand, why the uid string is different on zaurus and desktop | 75 | // LR I do not understand, why the uid string is different on zaurus and desktop |
70 | #ifdef DESKTOP_VERSION | 76 | #ifdef DESKTOP_VERSION |
71 | QString uid = "uid://"+(*it).uid(); | 77 | QString uid = "uid://"+(*it).uid(); |
@@ -88,12 +94,22 @@ void KOEventViewer::setSource(const QString& n) | |||
88 | 94 | ||
89 | } | 95 | } |
90 | dia.exec(); | 96 | dia.exec(); |
91 | break; | 97 | break; |
92 | } | 98 | } |
93 | } | 99 | } |
100 | return; | ||
101 | } | ||
102 | if ( n.left(6) == "mailto" ) { | ||
103 | // qDebug("KOEventViewer::setSource %s ", n.mid(7).latin1()); | ||
104 | #ifndef DESKTOP_VERSION | ||
105 | QCopEnvelope e("QPE/Application/kmpi", "newMail(QString)" ); | ||
106 | e << n.mid(7); | ||
107 | #endif | ||
108 | |||
109 | } | ||
94 | 110 | ||
95 | 111 | ||
96 | #ifndef KORG_NODCOP | 112 | #ifndef KORG_NODCOP |
97 | kdDebug() << "KOEventViewer::setSource(): " << n << endl; | 113 | kdDebug() << "KOEventViewer::setSource(): " << n << endl; |
98 | QString tmpStr; | 114 | QString tmpStr; |
99 | if (n.startsWith("mailto:")) { | 115 | if (n.startsWith("mailto:")) { |
@@ -167,12 +183,13 @@ void KOEventViewer::addTag(const QString & tag,const QString & text) | |||
167 | void KOEventViewer::setColorMode( int m ) | 183 | void KOEventViewer::setColorMode( int m ) |
168 | { | 184 | { |
169 | mColorMode = m; | 185 | mColorMode = m; |
170 | } | 186 | } |
171 | void KOEventViewer::appendEvent(Event *event, int mode ) | 187 | void KOEventViewer::appendEvent(Event *event, int mode ) |
172 | { | 188 | { |
189 | mMailSubject = ""; | ||
173 | mCurrentIncidence = event; | 190 | mCurrentIncidence = event; |
174 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; | 191 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; |
175 | topLevelWidget()->setCaption(i18n("Event Viewer")); | 192 | topLevelWidget()->setCaption(i18n("Event Viewer")); |
176 | if ( mode == 0 ) { | 193 | if ( mode == 0 ) { |
177 | addTag("h2",event->summary()); | 194 | addTag("h2",event->summary()); |
178 | } | 195 | } |
@@ -190,21 +207,24 @@ void KOEventViewer::appendEvent(Event *event, int mode ) | |||
190 | addTag("h2",i18n( "Remote: " ) +event->summary()); | 207 | addTag("h2",i18n( "Remote: " ) +event->summary()); |
191 | } | 208 | } |
192 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); | 209 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); |
193 | if ( mColorMode ) | 210 | if ( mColorMode ) |
194 | mText += "</font>"; | 211 | mText += "</font>"; |
195 | } | 212 | } |
213 | mMailSubject += i18n( "Meeting " )+ event->summary(); | ||
196 | if (event->cancelled ()) { | 214 | if (event->cancelled ()) { |
197 | mText +="<font color=\"#B00000\">"; | 215 | mText +="<font color=\"#B00000\">"; |
198 | addTag("i",i18n("This event has been cancelled!")); | 216 | addTag("i",i18n("This event has been cancelled!")); |
199 | mText.append("<br>"); | 217 | mText.append("<br>"); |
200 | mText += "</font>"; | 218 | mText += "</font>"; |
219 | mMailSubject += i18n("(cancelled)"); | ||
201 | } | 220 | } |
202 | if (!event->location().isEmpty()) { | 221 | if (!event->location().isEmpty()) { |
203 | addTag("b",i18n("Location: ")); | 222 | addTag("b",i18n("Location: ")); |
204 | mText.append(event->location()+"<br>"); | 223 | mText.append(event->location()+"<br>"); |
224 | mMailSubject += i18n(" at ") + event->location(); | ||
205 | } | 225 | } |
206 | if (event->doesFloat()) { | 226 | if (event->doesFloat()) { |
207 | if (event->isMultiDay()) { | 227 | if (event->isMultiDay()) { |
208 | mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") | 228 | mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") |
209 | .arg(event->dtStartDateStr(shortDate)) | 229 | .arg(event->dtStartDateStr(shortDate)) |
210 | .arg(event->dtEndDateStr(shortDate))); | 230 | .arg(event->dtEndDateStr(shortDate))); |
@@ -235,16 +255,22 @@ void KOEventViewer::appendEvent(Event *event, int mode ) | |||
235 | QDate next; | 255 | QDate next; |
236 | next = event->recurrence()->getPreviousDate( start , &last ); | 256 | next = event->recurrence()->getPreviousDate( start , &last ); |
237 | if ( !last ) { | 257 | if ( !last ) { |
238 | next = event->recurrence()->getNextDate( start.addDays( - 1 ) ); | 258 | next = event->recurrence()->getNextDate( start.addDays( - 1 ) ); |
239 | addTag("p",i18n("<b>Next recurrence is on:</b>") ); | 259 | addTag("p",i18n("<b>Next recurrence is on:</b>") ); |
240 | addTag("p", KGlobal::locale()->formatDate( next, shortDate )); | 260 | addTag("p", KGlobal::locale()->formatDate( next, shortDate )); |
261 | QDateTime nextdt = QDateTime( next, event->dtStart().time()); | ||
262 | mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( nextdt, true ); | ||
263 | |||
241 | } else { | 264 | } else { |
242 | addTag("p",i18n("<b>Last recurrence was on:</b>") ); | 265 | addTag("p",i18n("<b>Last recurrence was on:</b>") ); |
243 | addTag("p", KGlobal::locale()->formatDate( next, shortDate )); | 266 | addTag("p", KGlobal::locale()->formatDate( next, shortDate )); |
244 | } | 267 | } |
268 | } else { | ||
269 | mMailSubject += i18n(" - " )+event->dtStartStr( true ); | ||
270 | |||
245 | } | 271 | } |
246 | 272 | ||
247 | 273 | ||
248 | if (event->isAlarmEnabled()) { | 274 | if (event->isAlarmEnabled()) { |
249 | Alarm *alarm =event->alarms().first() ; | 275 | Alarm *alarm =event->alarms().first() ; |
250 | QDateTime t = alarm->time(); | 276 | QDateTime t = alarm->time(); |
@@ -271,12 +297,13 @@ void KOEventViewer::appendEvent(Event *event, int mode ) | |||
271 | //QWhatsThis::add(this,mText); | 297 | //QWhatsThis::add(this,mText); |
272 | 298 | ||
273 | } | 299 | } |
274 | 300 | ||
275 | void KOEventViewer::appendTodo(Todo *event, int mode ) | 301 | void KOEventViewer::appendTodo(Todo *event, int mode ) |
276 | { | 302 | { |
303 | mMailSubject = ""; | ||
277 | mCurrentIncidence = event; | 304 | mCurrentIncidence = event; |
278 | topLevelWidget()->setCaption(i18n("Todo Viewer")); | 305 | topLevelWidget()->setCaption(i18n("Todo Viewer")); |
279 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; | 306 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; |
280 | if (mode == 0 ) | 307 | if (mode == 0 ) |
281 | addTag("h2",event->summary()); | 308 | addTag("h2",event->summary()); |
282 | else { | 309 | else { |
@@ -292,25 +319,29 @@ void KOEventViewer::appendTodo(Todo *event, int mode ) | |||
292 | addTag("h2",i18n( "Remote: " ) +event->summary()); | 319 | addTag("h2",i18n( "Remote: " ) +event->summary()); |
293 | } | 320 | } |
294 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); | 321 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); |
295 | if ( mColorMode ) | 322 | if ( mColorMode ) |
296 | mText += "</font>"; | 323 | mText += "</font>"; |
297 | } | 324 | } |
325 | mMailSubject += i18n( "Todo " )+ event->summary(); | ||
298 | if (event->cancelled ()) { | 326 | if (event->cancelled ()) { |
299 | mText +="<font color=\"#B00000\">"; | 327 | mText +="<font color=\"#B00000\">"; |
300 | addTag("i",i18n("This todo has been cancelled!")); | 328 | addTag("i",i18n("This todo has been cancelled!")); |
301 | mText.append("<br>"); | 329 | mText.append("<br>"); |
302 | mText += "</font>"; | 330 | mText += "</font>"; |
331 | mMailSubject += i18n("(cancelled)"); | ||
303 | } | 332 | } |
304 | 333 | ||
305 | if (!event->location().isEmpty()) { | 334 | if (!event->location().isEmpty()) { |
306 | addTag("b",i18n("Location: ")); | 335 | addTag("b",i18n("Location: ")); |
307 | mText.append(event->location()+"<br>"); | 336 | mText.append(event->location()+"<br>"); |
337 | mMailSubject += i18n(" at ") + event->location(); | ||
308 | } | 338 | } |
309 | if (event->hasDueDate()) { | 339 | if (event->hasDueDate()) { |
310 | mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer))); | 340 | mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer))); |
341 | mMailSubject += i18n(" - " )+event->dtDueStr( true ); | ||
311 | } | 342 | } |
312 | addTag("b",i18n("Access: ")); | 343 | addTag("b",i18n("Access: ")); |
313 | mText.append(event->secrecyStr()+"<br>"); | 344 | mText.append(event->secrecyStr()+"<br>"); |
314 | if (!event->description().isEmpty()) { | 345 | if (!event->description().isEmpty()) { |
315 | addTag("p",i18n("<b>Details: </b>")); | 346 | addTag("p",i18n("<b>Details: </b>")); |
316 | addTag("p",event->description()); | 347 | addTag("p",event->description()); |
@@ -402,15 +433,16 @@ void KOEventViewer::formatAttendees(Incidence *event) | |||
402 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; | 433 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; |
403 | if (!a->name().isEmpty()) mText += a->name(); | 434 | if (!a->name().isEmpty()) mText += a->name(); |
404 | else mText += a->email(); | 435 | else mText += a->email(); |
405 | mText += "</a>\n"; | 436 | mText += "</a>\n"; |
406 | #endif | 437 | #endif |
407 | 438 | ||
439 | |||
408 | if (!a->email().isEmpty()) { | 440 | if (!a->email().isEmpty()) { |
409 | if (iconPath) { | 441 | if (iconPath) { |
410 | mText += "<a href=\"mailto:" + a->name() +" "+ "<" + a->email() + ">" + "\">"; | 442 | mText += "<a href=\"mailto:" + a->name() +" <" + a->email() + ">:" + mMailSubject + "\">"; |
411 | mText += "<IMG src=\"" + iconPath + "\">"; | 443 | mText += "<IMG src=\"" + iconPath + "\">"; |
412 | mText += "</a>\n"; | 444 | mText += "</a>\n"; |
413 | } | 445 | } |
414 | } | 446 | } |
415 | if (a->status() != Attendee::NeedsAction ) | 447 | if (a->status() != Attendee::NeedsAction ) |
416 | mText +="[" + a->statusStr() + "] "; | 448 | mText +="[" + a->statusStr() + "] "; |