author | zautrix <zautrix> | 2004-09-09 21:10:16 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-09 21:10:16 (UTC) |
commit | 5b0e3c87bbe32aacd51f6faff5446ed3838a68e0 (patch) (unidiff) | |
tree | 131651cf98ced42d2389f03f7a3f11aa47cf575f | |
parent | 480ffef4859d24cc0a936377f8983fd59312d4b6 (diff) | |
download | kdepimpi-5b0e3c87bbe32aacd51f6faff5446ed3838a68e0.zip kdepimpi-5b0e3c87bbe32aacd51f6faff5446ed3838a68e0.tar.gz kdepimpi-5b0e3c87bbe32aacd51f6faff5446ed3838a68e0.tar.bz2 |
Fixed organizer request details bug
-rw-r--r-- | korganizer/koeventviewer.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp index 2f538c4..d34e6a9 100644 --- a/korganizer/koeventviewer.cpp +++ b/korganizer/koeventviewer.cpp | |||
@@ -11,192 +11,196 @@ | |||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <qcstring.h> | 20 | #include <qcstring.h> |
21 | #include <qwhatsthis.h> | 21 | #include <qwhatsthis.h> |
22 | #include <qdialog.h> | 22 | #include <qdialog.h> |
23 | #include <qapplication.h> | 23 | #include <qapplication.h> |
24 | #include <qlabel.h> | 24 | #include <qlabel.h> |
25 | #include <qlayout.h> | 25 | #include <qlayout.h> |
26 | 26 | ||
27 | #include <klocale.h> | 27 | #include <klocale.h> |
28 | #include <kapplication.h> | 28 | #include <kapplication.h> |
29 | #include <libkcal/event.h> | 29 | #include <libkcal/event.h> |
30 | #include <libkcal/todo.h> | 30 | #include <libkcal/todo.h> |
31 | #include <kdebug.h> | 31 | #include <kdebug.h> |
32 | #include <kiconloader.h> | 32 | #include <kiconloader.h> |
33 | #include <krun.h> | 33 | #include <krun.h> |
34 | #include <kglobal.h> | 34 | #include <kglobal.h> |
35 | #include <kprocess.h> | 35 | #include <kprocess.h> |
36 | #include "koprefs.h" | 36 | #include "koprefs.h" |
37 | 37 | ||
38 | #include <libkdepim/addresseeview.h> | 38 | #include <libkdepim/addresseeview.h> |
39 | #include <kabc/stdaddressbook.h> | 39 | #include <kabc/stdaddressbook.h> |
40 | 40 | ||
41 | #ifndef KORG_NODCOP | 41 | #ifndef KORG_NODCOP |
42 | #include <dcopclient.h> | 42 | #include <dcopclient.h> |
43 | #include "korganizer.h" | 43 | #include "korganizer.h" |
44 | #include "koprefs.h" | 44 | #include "koprefs.h" |
45 | #include "actionmanager.h" | 45 | #include "actionmanager.h" |
46 | #endif | 46 | #endif |
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 | 53 | ||
54 | #ifdef DESKTOP_VERSION | 54 | #ifdef DESKTOP_VERSION |
55 | #include <kabc/addresseedialog.h> | 55 | #include <kabc/addresseedialog.h> |
56 | #else //DESKTOP_VERSION | 56 | #else //DESKTOP_VERSION |
57 | #include <externalapphandler.h> | 57 | #include <externalapphandler.h> |
58 | #include <qtopia/qcopenvelope_qws.h> | 58 | #include <qtopia/qcopenvelope_qws.h> |
59 | #endif //DESKTOP_VERSION | 59 | #endif //DESKTOP_VERSION |
60 | 60 | ||
61 | KOEventViewer::KOEventViewer(QWidget *parent,const char *name) | 61 | KOEventViewer::KOEventViewer(QWidget *parent,const char *name) |
62 | : QTextBrowser(parent,name) | 62 | : QTextBrowser(parent,name) |
63 | { | 63 | { |
64 | mSyncMode = false; | 64 | mSyncMode = false; |
65 | mColorMode = 0; | 65 | mColorMode = 0; |
66 | } | 66 | } |
67 | 67 | ||
68 | KOEventViewer::~KOEventViewer() | 68 | KOEventViewer::~KOEventViewer() |
69 | { | 69 | { |
70 | } | 70 | } |
71 | 71 | ||
72 | void KOEventViewer::setSource(const QString& n) | 72 | void KOEventViewer::setSource(const QString& n) |
73 | { | 73 | { |
74 | 74 | ||
75 | if ( n.left(3) == "uid" ) | 75 | if ( n.left(3) == "uid" ) |
76 | #ifdef DESKTOP_VERSION | 76 | #ifdef DESKTOP_VERSION |
77 | { | 77 | { |
78 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); | 78 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); |
79 | KABC::AddressBook::Iterator it; | 79 | KABC::AddressBook::Iterator it; |
80 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { | 80 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { |
81 | // LR I do not understand, why the uid string is different on zaurus and desktop | 81 | // LR I do not understand, why the uid string is different on zaurus and desktop |
82 | QString uid = "uid://"+(*it).uid(); | 82 | QString uid = "uid://"+(*it).uid(); |
83 | 83 | ||
84 | //qDebug("for *%s* +%s+ ", n.latin1(), uid.latin1()); | 84 | //qDebug("for *%s* +%s+ ", n.latin1(), uid.latin1()); |
85 | if (n == uid ) { | 85 | if (n == uid ) { |
86 | //qDebug("found %s ",(*it).mobileHomePhone().latin1() ); | 86 | //qDebug("found %s ",(*it).mobileHomePhone().latin1() ); |
87 | QDialog dia( this,"dia123", true ); | 87 | QDialog dia( this,"dia123", true ); |
88 | dia.setCaption( i18n("Details of attendee") ); | 88 | dia.setCaption( i18n("Details of attendee") ); |
89 | QVBoxLayout lay ( &dia ); | 89 | QVBoxLayout lay ( &dia ); |
90 | KPIM::AddresseeView av ( &dia ); | 90 | KPIM::AddresseeView av ( &dia ); |
91 | av.setAddressee( (*it) ); | 91 | av.setAddressee( (*it) ); |
92 | lay.addWidget( &av ); | 92 | lay.addWidget( &av ); |
93 | if ( QApplication::desktop()->width() < 480 ) | 93 | if ( QApplication::desktop()->width() < 480 ) |
94 | dia.resize( 220, 240); | 94 | dia.resize( 220, 240); |
95 | else { | 95 | else { |
96 | dia.resize( 400,400); | 96 | dia.resize( 400,400); |
97 | 97 | ||
98 | } | 98 | } |
99 | dia.exec(); | 99 | dia.exec(); |
100 | break; | 100 | break; |
101 | } | 101 | } |
102 | } | 102 | } |
103 | return; | 103 | return; |
104 | } | 104 | } |
105 | #else | 105 | #else |
106 | { | 106 | { |
107 | if ( "uid:organizer" == n ) { | ||
108 | ExternalAppHandler::instance()->requestDetailsFromKAPI("", mCurrentIncidence->organizer(),""); | ||
109 | return; | ||
110 | } | ||
107 | QPtrList<Attendee> attendees = mCurrentIncidence->attendees(); | 111 | QPtrList<Attendee> attendees = mCurrentIncidence->attendees(); |
108 | if (attendees.count()) { | 112 | if (attendees.count()) { |
109 | Attendee *a; | 113 | Attendee *a; |
110 | for(a=attendees.first();a;a=attendees.next()) { | 114 | for(a=attendees.first();a;a=attendees.next()) { |
111 | if ( "uid:"+a->uid() == n ) { | 115 | if ( "uid:"+a->uid() == n ) { |
112 | bool res = ExternalAppHandler::instance()->requestDetailsFromKAPI(a->name(), a->email(), a->uid()); | 116 | bool res = ExternalAppHandler::instance()->requestDetailsFromKAPI(a->name(), a->email(), a->uid()); |
113 | return; | 117 | return; |
114 | } | 118 | } |
115 | } | 119 | } |
116 | } | 120 | } |
117 | return; | 121 | return; |
118 | } | 122 | } |
119 | //requestNameEmailUidListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); | 123 | //requestNameEmailUidListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); |
120 | // the result should now arrive through method insertAttendees | 124 | // the result should now arrive through method insertAttendees |
121 | //QString uid = "uid:"+(*it).uid(); | 125 | //QString uid = "uid:"+(*it).uid(); |
122 | #endif | 126 | #endif |
123 | if ( n.left(6) == "mailto" ) { | 127 | if ( n.left(6) == "mailto" ) { |
124 | // qDebug("KOEventViewer::setSource %s ", n.mid(7).latin1()); | 128 | // qDebug("KOEventViewer::setSource %s ", n.mid(7).latin1()); |
125 | #ifndef DESKTOP_VERSION | 129 | #ifndef DESKTOP_VERSION |
126 | QCopEnvelope e("QPE/Application/ompi", "newMail(QString)" ); | 130 | QCopEnvelope e("QPE/Application/ompi", "newMail(QString)" ); |
127 | e << n.mid(7); | 131 | e << n.mid(7); |
128 | #endif | 132 | #endif |
129 | 133 | ||
130 | } | 134 | } |
131 | 135 | ||
132 | 136 | ||
133 | #ifndef KORG_NODCOP | 137 | #ifndef KORG_NODCOP |
134 | kdDebug() << "KOEventViewer::setSource(): " << n << endl; | 138 | kdDebug() << "KOEventViewer::setSource(): " << n << endl; |
135 | QString tmpStr; | 139 | QString tmpStr; |
136 | if (n.startsWith("mailto:")) { | 140 | if (n.startsWith("mailto:")) { |
137 | KApplication::kApplication()->invokeMailer(n.mid(7),QString::null); | 141 | KApplication::kApplication()->invokeMailer(n.mid(7),QString::null); |
138 | //emit showIncidence(n); | 142 | //emit showIncidence(n); |
139 | return; | 143 | return; |
140 | } else if (n.startsWith("uid:")) { | 144 | } else if (n.startsWith("uid:")) { |
141 | DCOPClient *client = KApplication::kApplication()->dcopClient(); | 145 | DCOPClient *client = KApplication::kApplication()->dcopClient(); |
142 | const QByteArray noParamData; | 146 | const QByteArray noParamData; |
143 | const QByteArray paramData; | 147 | const QByteArray paramData; |
144 | QByteArray replyData; | 148 | QByteArray replyData; |
145 | QCString replyTypeStr; | 149 | QCString replyTypeStr; |
146 | #define PING_ABBROWSER (client->call("kaddressbook", "KAddressBookIface", "interfaces()", noParamData, replyTypeStr, replyData)) | 150 | #define PING_ABBROWSER (client->call("kaddressbook", "KAddressBookIface", "interfaces()", noParamData, replyTypeStr, replyData)) |
147 | bool foundAbbrowser = PING_ABBROWSER; | 151 | bool foundAbbrowser = PING_ABBROWSER; |
148 | 152 | ||
149 | if (foundAbbrowser) { | 153 | if (foundAbbrowser) { |
150 | //KAddressbook is already running, so just DCOP to it to bring up the contact editor | 154 | //KAddressbook is already running, so just DCOP to it to bring up the contact editor |
151 | //client->send("kaddressbook","KAddressBookIface", | 155 | //client->send("kaddressbook","KAddressBookIface", |
152 | QDataStream arg(paramData, IO_WriteOnly); | 156 | QDataStream arg(paramData, IO_WriteOnly); |
153 | arg << n.mid(6); | 157 | arg << n.mid(6); |
154 | client->send("kaddressbook", "KAddressBookIface", "showContactEditor( QString )", paramData); | 158 | client->send("kaddressbook", "KAddressBookIface", "showContactEditor( QString )", paramData); |
155 | return; | 159 | return; |
156 | } else { | 160 | } else { |
157 | /* | 161 | /* |
158 | KaddressBook is not already running. Pass it the UID of the contact via the command line while starting it - its neater. | 162 | KaddressBook is not already running. Pass it the UID of the contact via the command line while starting it - its neater. |
159 | We start it without its main interface | 163 | We start it without its main interface |
160 | */ | 164 | */ |
161 | KIconLoader* iconLoader = new KIconLoader(); | 165 | KIconLoader* iconLoader = new KIconLoader(); |
162 | QString iconPath = iconLoader->iconPath("go",KIcon::Small); | 166 | QString iconPath = iconLoader->iconPath("go",KIcon::Small); |
163 | ActionManager::setStartedKAddressBook(true); | 167 | ActionManager::setStartedKAddressBook(true); |
164 | tmpStr = "kaddressbook --editor-only --uid "; | 168 | tmpStr = "kaddressbook --editor-only --uid "; |
165 | tmpStr += KProcess::quote(n.mid(6)); | 169 | tmpStr += KProcess::quote(n.mid(6)); |
166 | KRun::runCommand(tmpStr,"KAddressBook",iconPath); | 170 | KRun::runCommand(tmpStr,"KAddressBook",iconPath); |
167 | return; | 171 | return; |
168 | } | 172 | } |
169 | } else { | 173 | } else { |
170 | //QTextBrowser::setSource(n); | 174 | //QTextBrowser::setSource(n); |
171 | } | 175 | } |
172 | #endif | 176 | #endif |
173 | } | 177 | } |
174 | 178 | ||
175 | void KOEventViewer::addTag(const QString & tag,const QString & text) | 179 | void KOEventViewer::addTag(const QString & tag,const QString & text) |
176 | { | 180 | { |
177 | int number=text.contains("\n"); | 181 | int number=text.contains("\n"); |
178 | QString str = "<" + tag + ">"; | 182 | QString str = "<" + tag + ">"; |
179 | QString tmpText=text; | 183 | QString tmpText=text; |
180 | QString tmpStr=str; | 184 | QString tmpStr=str; |
181 | if(number !=-1) | 185 | if(number !=-1) |
182 | { | 186 | { |
183 | if (number > 0) { | 187 | if (number > 0) { |
184 | int pos=0; | 188 | int pos=0; |
185 | QString tmp; | 189 | QString tmp; |
186 | for(int i=0;i<=number;i++) { | 190 | for(int i=0;i<=number;i++) { |
187 | pos=tmpText.find("\n"); | 191 | pos=tmpText.find("\n"); |
188 | tmp=tmpText.left(pos); | 192 | tmp=tmpText.left(pos); |
189 | tmpText=tmpText.right(tmpText.length()-pos-1); | 193 | tmpText=tmpText.right(tmpText.length()-pos-1); |
190 | tmpStr+=tmp+"<br>"; | 194 | tmpStr+=tmp+"<br>"; |
191 | } | 195 | } |
192 | } | 196 | } |
193 | else tmpStr += tmpText; | 197 | else tmpStr += tmpText; |
194 | tmpStr+="</" + tag + ">"; | 198 | tmpStr+="</" + tag + ">"; |
195 | mText.append(tmpStr); | 199 | mText.append(tmpStr); |
196 | } | 200 | } |
197 | else | 201 | else |
198 | { | 202 | { |
199 | str += text + "</" + tag + ">"; | 203 | str += text + "</" + tag + ">"; |
200 | mText.append(str); | 204 | mText.append(str); |
201 | } | 205 | } |
202 | } | 206 | } |
@@ -324,193 +328,195 @@ void KOEventViewer::appendTodo(Todo *event, int mode ) | |||
324 | mMailSubject = ""; | 328 | mMailSubject = ""; |
325 | mCurrentIncidence = event; | 329 | mCurrentIncidence = event; |
326 | topLevelWidget()->setCaption(i18n("Todo Viewer")); | 330 | topLevelWidget()->setCaption(i18n("Todo Viewer")); |
327 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; | 331 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; |
328 | if (mode == 0 ) | 332 | if (mode == 0 ) |
329 | addTag("h2",event->summary()); | 333 | addTag("h2",event->summary()); |
330 | else { | 334 | else { |
331 | if ( mColorMode == 1 ) { | 335 | if ( mColorMode == 1 ) { |
332 | mText +="<font color=\"#00A000\">"; | 336 | mText +="<font color=\"#00A000\">"; |
333 | } | 337 | } |
334 | if ( mColorMode == 2 ) { | 338 | if ( mColorMode == 2 ) { |
335 | mText +="<font color=\"#B00000\">"; | 339 | mText +="<font color=\"#B00000\">"; |
336 | } | 340 | } |
337 | if ( mode == 1 ) { | 341 | if ( mode == 1 ) { |
338 | addTag("h2",i18n( "Local: " ) +event->summary()); | 342 | addTag("h2",i18n( "Local: " ) +event->summary()); |
339 | } else { | 343 | } else { |
340 | addTag("h2",i18n( "Remote: " ) +event->summary()); | 344 | addTag("h2",i18n( "Remote: " ) +event->summary()); |
341 | } | 345 | } |
342 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); | 346 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); |
343 | if ( mColorMode ) | 347 | if ( mColorMode ) |
344 | mText += "</font>"; | 348 | mText += "</font>"; |
345 | } | 349 | } |
346 | mMailSubject += i18n( "Todo " )+ event->summary(); | 350 | mMailSubject += i18n( "Todo " )+ event->summary(); |
347 | if (event->cancelled ()) { | 351 | if (event->cancelled ()) { |
348 | mText +="<font color=\"#B00000\">"; | 352 | mText +="<font color=\"#B00000\">"; |
349 | addTag("i",i18n("This todo has been cancelled!")); | 353 | addTag("i",i18n("This todo has been cancelled!")); |
350 | mText.append("<br>"); | 354 | mText.append("<br>"); |
351 | mText += "</font>"; | 355 | mText += "</font>"; |
352 | mMailSubject += i18n("(cancelled)"); | 356 | mMailSubject += i18n("(cancelled)"); |
353 | } | 357 | } |
354 | 358 | ||
355 | if (!event->location().isEmpty()) { | 359 | if (!event->location().isEmpty()) { |
356 | addTag("b",i18n("Location: ")); | 360 | addTag("b",i18n("Location: ")); |
357 | mText.append(event->location()+"<br>"); | 361 | mText.append(event->location()+"<br>"); |
358 | mMailSubject += i18n(" at ") + event->location(); | 362 | mMailSubject += i18n(" at ") + event->location(); |
359 | } | 363 | } |
360 | if (event->hasDueDate()) { | 364 | if (event->hasDueDate()) { |
361 | mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer))); | 365 | mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer))); |
362 | mMailSubject += i18n(" - " )+event->dtDueStr( true ); | 366 | mMailSubject += i18n(" - " )+event->dtDueStr( true ); |
363 | } | 367 | } |
364 | addTag("b",i18n("Access: ")); | 368 | addTag("b",i18n("Access: ")); |
365 | mText.append(event->secrecyStr()+"<br>"); | 369 | mText.append(event->secrecyStr()+"<br>"); |
366 | if (!event->description().isEmpty()) { | 370 | if (!event->description().isEmpty()) { |
367 | addTag("p",i18n("<b>Details: </b>")); | 371 | addTag("p",i18n("<b>Details: </b>")); |
368 | addTag("p",event->description()); | 372 | addTag("p",event->description()); |
369 | } | 373 | } |
370 | 374 | ||
371 | formatCategories(event); | 375 | formatCategories(event); |
372 | 376 | ||
373 | mText.append(i18n("<p><b>Priority:</b> %2</p>") | 377 | mText.append(i18n("<p><b>Priority:</b> %2</p>") |
374 | .arg(QString::number(event->priority()))); | 378 | .arg(QString::number(event->priority()))); |
375 | 379 | ||
376 | mText.append(i18n("<p><i>%1 % completed</i></p>") | 380 | mText.append(i18n("<p><i>%1 % completed</i></p>") |
377 | .arg(event->percentComplete())); | 381 | .arg(event->percentComplete())); |
378 | 382 | ||
379 | formatReadOnly(event); | 383 | formatReadOnly(event); |
380 | formatAttendees(event); | 384 | formatAttendees(event); |
381 | 385 | ||
382 | setText(mText); | 386 | setText(mText); |
383 | } | 387 | } |
384 | 388 | ||
385 | void KOEventViewer::formatCategories(Incidence *event) | 389 | void KOEventViewer::formatCategories(Incidence *event) |
386 | { | 390 | { |
387 | if (!event->categoriesStr().isEmpty()) { | 391 | if (!event->categoriesStr().isEmpty()) { |
388 | if (event->categories().count() == 1) { | 392 | if (event->categories().count() == 1) { |
389 | addTag("h3",i18n("Category")); | 393 | addTag("h3",i18n("Category")); |
390 | } else { | 394 | } else { |
391 | addTag("h3",i18n("Categories")); | 395 | addTag("h3",i18n("Categories")); |
392 | } | 396 | } |
393 | addTag("p",event->categoriesStr()); | 397 | addTag("p",event->categoriesStr()); |
394 | } | 398 | } |
395 | } | 399 | } |
396 | void KOEventViewer::formatAttendees(Incidence *event) | 400 | void KOEventViewer::formatAttendees(Incidence *event) |
397 | { | 401 | { |
398 | QPtrList<Attendee> attendees = event->attendees(); | 402 | QPtrList<Attendee> attendees = event->attendees(); |
399 | if (attendees.count()) { | 403 | if (attendees.count()) { |
400 | 404 | ||
401 | 405 | ||
402 | QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); | 406 | QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); |
403 | addTag("h3",i18n("Organizer")); | 407 | addTag("h3",i18n("Organizer")); |
404 | mText.append("<ul><li>"); | 408 | mText.append("<ul><li>"); |
405 | #ifndef KORG_NOKABC | 409 | #ifndef KORG_NOKABC |
406 | 410 | ||
407 | #ifdef DESKTOP_VERSION | 411 | #ifdef DESKTOP_VERSION |
408 | KABC::AddressBook *add_book = KABC::StdAddressBook::self(); | 412 | KABC::AddressBook *add_book = KABC::StdAddressBook::self(); |
409 | KABC::Addressee::List addressList; | 413 | KABC::Addressee::List addressList; |
410 | addressList = add_book->findByEmail(event->organizer()); | 414 | addressList = add_book->findByEmail(event->organizer()); |
411 | KABC::Addressee o = addressList.first(); | 415 | KABC::Addressee o = addressList.first(); |
412 | if (!o.isEmpty() && addressList.size()<2) { | 416 | if (!o.isEmpty() && addressList.size()<2) { |
413 | mText += "<a href=\"uid:" + o.uid() + "\">"; | 417 | mText += "<a href=\"uid:" + o.uid() + "\">"; |
414 | mText += o.formattedName(); | 418 | mText += o.formattedName(); |
415 | mText += "</a>\n"; | 419 | mText += "</a>\n"; |
416 | } else { | 420 | } else { |
417 | mText.append(event->organizer()); | 421 | mText.append(event->organizer()); |
418 | } | 422 | } |
419 | #else //DESKTOP_VERSION | 423 | #else //DESKTOP_VERSION |
420 | mText.append(event->organizer()); | 424 | mText += "<a href=\"uid:organizer\">"; |
425 | mText += event->organizer(); | ||
426 | mText += "</a>\n"; | ||
421 | #endif //DESKTOP_VERSION | 427 | #endif //DESKTOP_VERSION |
422 | 428 | ||
423 | 429 | ||
424 | #else | 430 | #else |
425 | mText.append(event->organizer()); | 431 | mText.append(event->organizer()); |
426 | #endif | 432 | #endif |
427 | 433 | ||
428 | if (iconPath) { | 434 | if (iconPath) { |
429 | mText += " <a href=\"mailto:" + event->organizer() + "\">"; | 435 | mText += " <a href=\"mailto:" + event->organizer() + "\">"; |
430 | mText += "<IMG src=\"" + iconPath + "\">"; | 436 | mText += "<IMG src=\"" + iconPath + "\">"; |
431 | mText += "</a>\n"; | 437 | mText += "</a>\n"; |
432 | } | 438 | } |
433 | mText.append("</li></ul>"); | 439 | mText.append("</li></ul>"); |
434 | 440 | ||
435 | addTag("h3",i18n("Attendees")); | 441 | addTag("h3",i18n("Attendees")); |
436 | Attendee *a; | 442 | Attendee *a; |
437 | mText.append("<ul>"); | 443 | mText.append("<ul>"); |
438 | for(a=attendees.first();a;a=attendees.next()) { | 444 | for(a=attendees.first();a;a=attendees.next()) { |
439 | #ifndef KORG_NOKABC | 445 | #ifndef KORG_NOKABC |
440 | #ifdef DESKTOP_VERSION | 446 | #ifdef DESKTOP_VERSION |
441 | if (a->name().isEmpty()) { | 447 | if (a->name().isEmpty()) { |
442 | addressList = add_book->findByEmail(a->email()); | 448 | addressList = add_book->findByEmail(a->email()); |
443 | KABC::Addressee o = addressList.first(); | 449 | KABC::Addressee o = addressList.first(); |
444 | if (!o.isEmpty() && addressList.size()<2) { | 450 | if (!o.isEmpty() && addressList.size()<2) { |
445 | mText += "<a href=\"uid:" + o.uid() + "\">"; | 451 | mText += "<a href=\"uid:" + o.uid() + "\">"; |
446 | mText += o.formattedName(); | 452 | mText += o.formattedName(); |
447 | mText += "</a>\n"; | 453 | mText += "</a>\n"; |
448 | } else { | 454 | } else { |
449 | mText += "<li>"; | 455 | mText += "<li>"; |
450 | mText.append(a->email()); | 456 | mText.append(a->email()); |
451 | mText += "\n"; | 457 | mText += "\n"; |
452 | } | 458 | } |
453 | } else { | 459 | } else { |
454 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; | 460 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; |
455 | if (!a->name().isEmpty()) mText += a->name(); | 461 | if (!a->name().isEmpty()) mText += a->name(); |
456 | else mText += a->email(); | 462 | else mText += a->email(); |
457 | mText += "</a>\n"; | 463 | mText += "</a>\n"; |
458 | } | 464 | } |
459 | #else //DESKTOP_VERSION | 465 | #else //DESKTOP_VERSION |
460 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; | 466 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; |
461 | if (!a->name().isEmpty()) mText += a->name(); | 467 | if (!a->name().isEmpty()) mText += a->name(); |
462 | else mText += a->email(); | 468 | else mText += a->email(); |
463 | mText += "</a>\n"; | 469 | mText += "</a>\n"; |
464 | #endif //DESKTOP_VERSION | 470 | #endif //DESKTOP_VERSION |
465 | #else | 471 | #else |
466 | //qDebug("nokabc "); | 472 | //qDebug("nokabc "); |
467 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; | 473 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; |
468 | if (!a->name().isEmpty()) mText += a->name(); | 474 | if (!a->name().isEmpty()) mText += a->name(); |
469 | else mText += a->email(); | 475 | else mText += a->email(); |
470 | mText += "</a>\n"; | 476 | mText += "</a>\n"; |
471 | #endif | 477 | #endif |
472 | 478 | ||
473 | 479 | ||
474 | if (!a->email().isEmpty()) { | 480 | if (!a->email().isEmpty()) { |
475 | if (iconPath) { | 481 | if (iconPath) { |
476 | mText += "<a href=\"mailto:" + a->name() +" <" + a->email() + ">:" + mMailSubject + "\">"; | 482 | mText += "<a href=\"mailto:" + a->name() +" <" + a->email() + ">:" + mMailSubject + "\">"; |
477 | mText += "<IMG src=\"" + iconPath + "\">"; | 483 | mText += "<IMG src=\"" + iconPath + "\">"; |
478 | mText += "</a>\n"; | 484 | mText += "</a>\n"; |
479 | } | 485 | } |
480 | } | 486 | } |
481 | if (a->status() != Attendee::NeedsAction ) | 487 | if (a->status() != Attendee::NeedsAction ) |
482 | mText +="[" + a->statusStr() + "] "; | 488 | mText +="[" + a->statusStr() + "] "; |
483 | if (a->role() == Attendee::Chair ) | 489 | if (a->role() == Attendee::Chair ) |
484 | mText +="(" + a->roleStr().left(1) + ".)"; | 490 | mText +="(" + a->roleStr().left(1) + ".)"; |
485 | } | 491 | } |
486 | mText.append("</li></ul>"); | 492 | mText.append("</li></ul>"); |
487 | } | 493 | } |
488 | 494 | ||
489 | } | 495 | } |
490 | void KOEventViewer::appendJournal(Journal *jour, int mode ) | 496 | void KOEventViewer::appendJournal(Journal *jour, int mode ) |
491 | { | 497 | { |
492 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; | 498 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; |
493 | if (mode == 0 ) | 499 | if (mode == 0 ) |
494 | addTag("h2",i18n("Journal from: ")); | 500 | addTag("h2",i18n("Journal from: ")); |
495 | else { | 501 | else { |
496 | if ( mode == 1 ) { | 502 | if ( mode == 1 ) { |
497 | addTag("h2",i18n( "Local: " ) +i18n("Journal from: ")); | 503 | addTag("h2",i18n( "Local: " ) +i18n("Journal from: ")); |
498 | } else { | 504 | } else { |
499 | addTag("h2",i18n( "Remote: " ) +i18n("Journal from: ")); | 505 | addTag("h2",i18n( "Remote: " ) +i18n("Journal from: ")); |
500 | } | 506 | } |
501 | addTag("h3",i18n( "Last modified " ) + KGlobal::locale()->formatDateTime(jour->lastModified(),shortDate ) ); | 507 | addTag("h3",i18n( "Last modified " ) + KGlobal::locale()->formatDateTime(jour->lastModified(),shortDate ) ); |
502 | } | 508 | } |
503 | topLevelWidget()->setCaption("Journal Viewer"); | 509 | topLevelWidget()->setCaption("Journal Viewer"); |
504 | mText.append(i18n("<h3> %1 </h3> ").arg(jour->dtStartDateStr(KOPrefs::instance()->mShortDateInViewer))); | 510 | mText.append(i18n("<h3> %1 </h3> ").arg(jour->dtStartDateStr(KOPrefs::instance()->mShortDateInViewer))); |
505 | if (!jour->description().isEmpty()) { | 511 | if (!jour->description().isEmpty()) { |
506 | addTag("p",jour->description()); | 512 | addTag("p",jour->description()); |
507 | } | 513 | } |
508 | setText(mText); | 514 | setText(mText); |
509 | } | 515 | } |
510 | 516 | ||
511 | void KOEventViewer::formatReadOnly(Incidence *event) | 517 | void KOEventViewer::formatReadOnly(Incidence *event) |
512 | { | 518 | { |
513 | if (event->isReadOnly()) { | 519 | if (event->isReadOnly()) { |
514 | addTag("p","<em>(" + i18n("read-only") + ")</em>"); | 520 | addTag("p","<em>(" + i18n("read-only") + ")</em>"); |
515 | } | 521 | } |
516 | } | 522 | } |