author | zautrix <zautrix> | 2004-09-07 20:33:23 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-07 20:33:23 (UTC) |
commit | 64a8ef1629f523df3006de5cb2b9882a50d96a05 (patch) (unidiff) | |
tree | b931dc5397b4eec926603080b20eddda131999ff /korganizer | |
parent | 9d5c8750ae671e73ec8ebc0a71f30fd30680f2c0 (diff) | |
download | kdepimpi-64a8ef1629f523df3006de5cb2b9882a50d96a05.zip kdepimpi-64a8ef1629f523df3006de5cb2b9882a50d96a05.tar.gz kdepimpi-64a8ef1629f523df3006de5cb2b9882a50d96a05.tar.bz2 |
Fixed Kopi-Kapi external app communication
-rw-r--r-- | korganizer/koeventviewer.cpp | 50 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 2 |
2 files changed, 44 insertions, 8 deletions
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp index 1f69700..0866939 100644 --- a/korganizer/koeventviewer.cpp +++ b/korganizer/koeventviewer.cpp | |||
@@ -5,149 +5,170 @@ | |||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
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 | #ifndef DESKTOP_VERSION | 53 | |
54 | #ifdef DESKTOP_VERSION | ||
55 | #include <kabc/addresseedialog.h> | ||
56 | #else //DESKTOP_VERSION | ||
57 | #include <externalapphandler.h> | ||
54 | #include <qtopia/qcopenvelope_qws.h> | 58 | #include <qtopia/qcopenvelope_qws.h> |
55 | #endif | 59 | #endif //DESKTOP_VERSION |
56 | 60 | ||
57 | KOEventViewer::KOEventViewer(QWidget *parent,const char *name) | 61 | KOEventViewer::KOEventViewer(QWidget *parent,const char *name) |
58 | : QTextBrowser(parent,name) | 62 | : QTextBrowser(parent,name) |
59 | { | 63 | { |
60 | mSyncMode = false; | 64 | mSyncMode = false; |
61 | mColorMode = 0; | 65 | mColorMode = 0; |
62 | } | 66 | } |
63 | 67 | ||
64 | KOEventViewer::~KOEventViewer() | 68 | KOEventViewer::~KOEventViewer() |
65 | { | 69 | { |
66 | } | 70 | } |
67 | 71 | ||
68 | void KOEventViewer::setSource(const QString& n) | 72 | void KOEventViewer::setSource(const QString& n) |
69 | { | 73 | { |
70 | 74 | ||
71 | if ( n.left(3) == "uid" ) { | 75 | if ( n.left(3) == "uid" ) |
76 | #ifdef DESKTOP_VERSION | ||
77 | { | ||
72 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); | 78 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); |
73 | KABC::AddressBook::Iterator it; | 79 | KABC::AddressBook::Iterator it; |
74 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { | 80 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { |
75 | // 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 |
76 | #ifdef DESKTOP_VERSION | ||
77 | QString uid = "uid://"+(*it).uid(); | 82 | QString uid = "uid://"+(*it).uid(); |
78 | #else | 83 | |
79 | QString uid = "uid:"+(*it).uid(); | ||
80 | #endif | ||
81 | //qDebug("for *%s* +%s+ ", n.latin1(), uid.latin1()); | 84 | //qDebug("for *%s* +%s+ ", n.latin1(), uid.latin1()); |
82 | if (n == uid ) { | 85 | if (n == uid ) { |
83 | //qDebug("found %s ",(*it).mobileHomePhone().latin1() ); | 86 | //qDebug("found %s ",(*it).mobileHomePhone().latin1() ); |
84 | QDialog dia( this,"dia123", true ); | 87 | QDialog dia( this,"dia123", true ); |
85 | dia.setCaption( i18n("Details of attendee") ); | 88 | dia.setCaption( i18n("Details of attendee") ); |
86 | QVBoxLayout lay ( &dia ); | 89 | QVBoxLayout lay ( &dia ); |
87 | KPIM::AddresseeView av ( &dia ); | 90 | KPIM::AddresseeView av ( &dia ); |
88 | av.setAddressee( (*it) ); | 91 | av.setAddressee( (*it) ); |
89 | lay.addWidget( &av ); | 92 | lay.addWidget( &av ); |
90 | if ( QApplication::desktop()->width() < 480 ) | 93 | if ( QApplication::desktop()->width() < 480 ) |
91 | dia.resize( 220, 240); | 94 | dia.resize( 220, 240); |
92 | else { | 95 | else { |
93 | dia.resize( 400,400); | 96 | dia.resize( 400,400); |
94 | 97 | ||
95 | } | 98 | } |
96 | dia.exec(); | 99 | dia.exec(); |
97 | break; | 100 | break; |
98 | } | 101 | } |
99 | } | 102 | } |
100 | return; | 103 | return; |
101 | } | 104 | } |
105 | #else | ||
106 | { | ||
107 | QPtrList<Attendee> attendees = mCurrentIncidence->attendees(); | ||
108 | if (attendees.count()) { | ||
109 | Attendee *a; | ||
110 | for(a=attendees.first();a;a=attendees.next()) { | ||
111 | if ( "uid:"+a->uid() == n ) { | ||
112 | bool res = ExternalAppHandler::instance()->requestDetailsFromKAPI(a->name(), a->email(), ""); | ||
113 | return; | ||
114 | } | ||
115 | } | ||
116 | } | ||
117 | return; | ||
118 | } | ||
119 | //requestNameEmailUidListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); | ||
120 | // the result should now arrive through method insertAttendees | ||
121 | //QString uid = "uid:"+(*it).uid(); | ||
122 | #endif | ||
102 | if ( n.left(6) == "mailto" ) { | 123 | if ( n.left(6) == "mailto" ) { |
103 | // qDebug("KOEventViewer::setSource %s ", n.mid(7).latin1()); | 124 | // qDebug("KOEventViewer::setSource %s ", n.mid(7).latin1()); |
104 | #ifndef DESKTOP_VERSION | 125 | #ifndef DESKTOP_VERSION |
105 | QCopEnvelope e("QPE/Application/kmpi", "newMail(QString)" ); | 126 | QCopEnvelope e("QPE/Application/ompi", "newMail(QString)" ); |
106 | e << n.mid(7); | 127 | e << n.mid(7); |
107 | #endif | 128 | #endif |
108 | 129 | ||
109 | } | 130 | } |
110 | 131 | ||
111 | 132 | ||
112 | #ifndef KORG_NODCOP | 133 | #ifndef KORG_NODCOP |
113 | kdDebug() << "KOEventViewer::setSource(): " << n << endl; | 134 | kdDebug() << "KOEventViewer::setSource(): " << n << endl; |
114 | QString tmpStr; | 135 | QString tmpStr; |
115 | if (n.startsWith("mailto:")) { | 136 | if (n.startsWith("mailto:")) { |
116 | KApplication::kApplication()->invokeMailer(n.mid(7),QString::null); | 137 | KApplication::kApplication()->invokeMailer(n.mid(7),QString::null); |
117 | //emit showIncidence(n); | 138 | //emit showIncidence(n); |
118 | return; | 139 | return; |
119 | } else if (n.startsWith("uid:")) { | 140 | } else if (n.startsWith("uid:")) { |
120 | DCOPClient *client = KApplication::kApplication()->dcopClient(); | 141 | DCOPClient *client = KApplication::kApplication()->dcopClient(); |
121 | const QByteArray noParamData; | 142 | const QByteArray noParamData; |
122 | const QByteArray paramData; | 143 | const QByteArray paramData; |
123 | QByteArray replyData; | 144 | QByteArray replyData; |
124 | QCString replyTypeStr; | 145 | QCString replyTypeStr; |
125 | #define PING_ABBROWSER (client->call("kaddressbook", "KAddressBookIface", "interfaces()", noParamData, replyTypeStr, replyData)) | 146 | #define PING_ABBROWSER (client->call("kaddressbook", "KAddressBookIface", "interfaces()", noParamData, replyTypeStr, replyData)) |
126 | bool foundAbbrowser = PING_ABBROWSER; | 147 | bool foundAbbrowser = PING_ABBROWSER; |
127 | 148 | ||
128 | if (foundAbbrowser) { | 149 | if (foundAbbrowser) { |
129 | //KAddressbook is already running, so just DCOP to it to bring up the contact editor | 150 | //KAddressbook is already running, so just DCOP to it to bring up the contact editor |
130 | //client->send("kaddressbook","KAddressBookIface", | 151 | //client->send("kaddressbook","KAddressBookIface", |
131 | QDataStream arg(paramData, IO_WriteOnly); | 152 | QDataStream arg(paramData, IO_WriteOnly); |
132 | arg << n.mid(6); | 153 | arg << n.mid(6); |
133 | client->send("kaddressbook", "KAddressBookIface", "showContactEditor( QString )", paramData); | 154 | client->send("kaddressbook", "KAddressBookIface", "showContactEditor( QString )", paramData); |
134 | return; | 155 | return; |
135 | } else { | 156 | } else { |
136 | /* | 157 | /* |
137 | KaddressBook is not already running. Pass it the UID of the contact via the command line while starting it - its neater. | 158 | KaddressBook is not already running. Pass it the UID of the contact via the command line while starting it - its neater. |
138 | We start it without its main interface | 159 | We start it without its main interface |
139 | */ | 160 | */ |
140 | KIconLoader* iconLoader = new KIconLoader(); | 161 | KIconLoader* iconLoader = new KIconLoader(); |
141 | QString iconPath = iconLoader->iconPath("go",KIcon::Small); | 162 | QString iconPath = iconLoader->iconPath("go",KIcon::Small); |
142 | ActionManager::setStartedKAddressBook(true); | 163 | ActionManager::setStartedKAddressBook(true); |
143 | tmpStr = "kaddressbook --editor-only --uid "; | 164 | tmpStr = "kaddressbook --editor-only --uid "; |
144 | tmpStr += KProcess::quote(n.mid(6)); | 165 | tmpStr += KProcess::quote(n.mid(6)); |
145 | KRun::runCommand(tmpStr,"KAddressBook",iconPath); | 166 | KRun::runCommand(tmpStr,"KAddressBook",iconPath); |
146 | return; | 167 | return; |
147 | } | 168 | } |
148 | } else { | 169 | } else { |
149 | //QTextBrowser::setSource(n); | 170 | //QTextBrowser::setSource(n); |
150 | } | 171 | } |
151 | #endif | 172 | #endif |
152 | } | 173 | } |
153 | 174 | ||
@@ -338,141 +359,154 @@ void KOEventViewer::appendTodo(Todo *event, int mode ) | |||
338 | } | 359 | } |
339 | if (event->hasDueDate()) { | 360 | if (event->hasDueDate()) { |
340 | mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer))); | 361 | mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer))); |
341 | mMailSubject += i18n(" - " )+event->dtDueStr( true ); | 362 | mMailSubject += i18n(" - " )+event->dtDueStr( true ); |
342 | } | 363 | } |
343 | addTag("b",i18n("Access: ")); | 364 | addTag("b",i18n("Access: ")); |
344 | mText.append(event->secrecyStr()+"<br>"); | 365 | mText.append(event->secrecyStr()+"<br>"); |
345 | if (!event->description().isEmpty()) { | 366 | if (!event->description().isEmpty()) { |
346 | addTag("p",i18n("<b>Details: </b>")); | 367 | addTag("p",i18n("<b>Details: </b>")); |
347 | addTag("p",event->description()); | 368 | addTag("p",event->description()); |
348 | } | 369 | } |
349 | 370 | ||
350 | formatCategories(event); | 371 | formatCategories(event); |
351 | 372 | ||
352 | mText.append(i18n("<p><b>Priority:</b> %2</p>") | 373 | mText.append(i18n("<p><b>Priority:</b> %2</p>") |
353 | .arg(QString::number(event->priority()))); | 374 | .arg(QString::number(event->priority()))); |
354 | 375 | ||
355 | mText.append(i18n("<p><i>%1 % completed</i></p>") | 376 | mText.append(i18n("<p><i>%1 % completed</i></p>") |
356 | .arg(event->percentComplete())); | 377 | .arg(event->percentComplete())); |
357 | 378 | ||
358 | formatReadOnly(event); | 379 | formatReadOnly(event); |
359 | formatAttendees(event); | 380 | formatAttendees(event); |
360 | 381 | ||
361 | setText(mText); | 382 | setText(mText); |
362 | } | 383 | } |
363 | 384 | ||
364 | void KOEventViewer::formatCategories(Incidence *event) | 385 | void KOEventViewer::formatCategories(Incidence *event) |
365 | { | 386 | { |
366 | if (!event->categoriesStr().isEmpty()) { | 387 | if (!event->categoriesStr().isEmpty()) { |
367 | if (event->categories().count() == 1) { | 388 | if (event->categories().count() == 1) { |
368 | addTag("h3",i18n("Category")); | 389 | addTag("h3",i18n("Category")); |
369 | } else { | 390 | } else { |
370 | addTag("h3",i18n("Categories")); | 391 | addTag("h3",i18n("Categories")); |
371 | } | 392 | } |
372 | addTag("p",event->categoriesStr()); | 393 | addTag("p",event->categoriesStr()); |
373 | } | 394 | } |
374 | } | 395 | } |
375 | void KOEventViewer::formatAttendees(Incidence *event) | 396 | void KOEventViewer::formatAttendees(Incidence *event) |
376 | { | 397 | { |
377 | QPtrList<Attendee> attendees = event->attendees(); | 398 | QPtrList<Attendee> attendees = event->attendees(); |
378 | if (attendees.count()) { | 399 | if (attendees.count()) { |
379 | 400 | ||
380 | 401 | ||
381 | QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); | 402 | QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); |
382 | addTag("h3",i18n("Organizer")); | 403 | addTag("h3",i18n("Organizer")); |
383 | mText.append("<ul><li>"); | 404 | mText.append("<ul><li>"); |
384 | #ifndef KORG_NOKABC | 405 | #ifndef KORG_NOKABC |
385 | 406 | ||
407 | #ifdef DESKTOP_VERSION | ||
386 | KABC::AddressBook *add_book = KABC::StdAddressBook::self(); | 408 | KABC::AddressBook *add_book = KABC::StdAddressBook::self(); |
387 | KABC::Addressee::List addressList; | 409 | KABC::Addressee::List addressList; |
388 | addressList = add_book->findByEmail(event->organizer()); | 410 | addressList = add_book->findByEmail(event->organizer()); |
389 | KABC::Addressee o = addressList.first(); | 411 | KABC::Addressee o = addressList.first(); |
390 | if (!o.isEmpty() && addressList.size()<2) { | 412 | if (!o.isEmpty() && addressList.size()<2) { |
391 | mText += "<a href=\"uid:" + o.uid() + "\">"; | 413 | mText += "<a href=\"uid:" + o.uid() + "\">"; |
392 | mText += o.formattedName(); | 414 | mText += o.formattedName(); |
393 | mText += "</a>\n"; | 415 | mText += "</a>\n"; |
394 | } else { | 416 | } else { |
395 | mText.append(event->organizer()); | 417 | mText.append(event->organizer()); |
396 | } | 418 | } |
419 | #else //DESKTOP_VERSION | ||
420 | mText.append(event->organizer()); | ||
421 | #endif //DESKTOP_VERSION | ||
422 | |||
423 | |||
397 | #else | 424 | #else |
398 | mText.append(event->organizer()); | 425 | mText.append(event->organizer()); |
399 | #endif | 426 | #endif |
400 | 427 | ||
401 | if (iconPath) { | 428 | if (iconPath) { |
402 | mText += " <a href=\"mailto:" + event->organizer() + "\">"; | 429 | mText += " <a href=\"mailto:" + event->organizer() + "\">"; |
403 | mText += "<IMG src=\"" + iconPath + "\">"; | 430 | mText += "<IMG src=\"" + iconPath + "\">"; |
404 | mText += "</a>\n"; | 431 | mText += "</a>\n"; |
405 | } | 432 | } |
406 | mText.append("</li></ul>"); | 433 | mText.append("</li></ul>"); |
407 | 434 | ||
408 | addTag("h3",i18n("Attendees")); | 435 | addTag("h3",i18n("Attendees")); |
409 | Attendee *a; | 436 | Attendee *a; |
410 | mText.append("<ul>"); | 437 | mText.append("<ul>"); |
411 | for(a=attendees.first();a;a=attendees.next()) { | 438 | for(a=attendees.first();a;a=attendees.next()) { |
412 | #ifndef KORG_NOKABC | 439 | #ifndef KORG_NOKABC |
440 | #ifdef DESKTOP_VERSION | ||
413 | if (a->name().isEmpty()) { | 441 | if (a->name().isEmpty()) { |
414 | addressList = add_book->findByEmail(a->email()); | 442 | addressList = add_book->findByEmail(a->email()); |
415 | KABC::Addressee o = addressList.first(); | 443 | KABC::Addressee o = addressList.first(); |
416 | if (!o.isEmpty() && addressList.size()<2) { | 444 | if (!o.isEmpty() && addressList.size()<2) { |
417 | mText += "<a href=\"uid:" + o.uid() + "\">"; | 445 | mText += "<a href=\"uid:" + o.uid() + "\">"; |
418 | mText += o.formattedName(); | 446 | mText += o.formattedName(); |
419 | mText += "</a>\n"; | 447 | mText += "</a>\n"; |
420 | } else { | 448 | } else { |
421 | mText += "<li>"; | 449 | mText += "<li>"; |
422 | mText.append(a->email()); | 450 | mText.append(a->email()); |
423 | mText += "\n"; | 451 | mText += "\n"; |
424 | } | 452 | } |
425 | } else { | 453 | } else { |
426 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; | 454 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; |
427 | if (!a->name().isEmpty()) mText += a->name(); | 455 | if (!a->name().isEmpty()) mText += a->name(); |
428 | else mText += a->email(); | 456 | else mText += a->email(); |
429 | mText += "</a>\n"; | 457 | mText += "</a>\n"; |
430 | } | 458 | } |
459 | #else //DESKTOP_VERSION | ||
460 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; | ||
461 | if (!a->name().isEmpty()) mText += a->name(); | ||
462 | else mText += a->email(); | ||
463 | mText += "</a>\n"; | ||
464 | #endif //DESKTOP_VERSION | ||
431 | #else | 465 | #else |
432 | //qDebug("nokabc "); | 466 | //qDebug("nokabc "); |
433 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; | 467 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; |
434 | if (!a->name().isEmpty()) mText += a->name(); | 468 | if (!a->name().isEmpty()) mText += a->name(); |
435 | else mText += a->email(); | 469 | else mText += a->email(); |
436 | mText += "</a>\n"; | 470 | mText += "</a>\n"; |
437 | #endif | 471 | #endif |
438 | 472 | ||
439 | 473 | ||
440 | if (!a->email().isEmpty()) { | 474 | if (!a->email().isEmpty()) { |
441 | if (iconPath) { | 475 | if (iconPath) { |
442 | mText += "<a href=\"mailto:" + a->name() +" <" + a->email() + ">:" + mMailSubject + "\">"; | 476 | mText += "<a href=\"mailto:" + a->name() +" <" + a->email() + ">:" + mMailSubject + "\">"; |
443 | mText += "<IMG src=\"" + iconPath + "\">"; | 477 | mText += "<IMG src=\"" + iconPath + "\">"; |
444 | mText += "</a>\n"; | 478 | mText += "</a>\n"; |
445 | } | 479 | } |
446 | } | 480 | } |
447 | if (a->status() != Attendee::NeedsAction ) | 481 | if (a->status() != Attendee::NeedsAction ) |
448 | mText +="[" + a->statusStr() + "] "; | 482 | mText +="[" + a->statusStr() + "] "; |
449 | if (a->role() == Attendee::Chair ) | 483 | if (a->role() == Attendee::Chair ) |
450 | mText +="(" + a->roleStr().left(1) + ".)"; | 484 | mText +="(" + a->roleStr().left(1) + ".)"; |
451 | } | 485 | } |
452 | mText.append("</li></ul>"); | 486 | mText.append("</li></ul>"); |
453 | } | 487 | } |
454 | 488 | ||
455 | } | 489 | } |
456 | void KOEventViewer::appendJournal(Journal *jour, int mode ) | 490 | void KOEventViewer::appendJournal(Journal *jour, int mode ) |
457 | { | 491 | { |
458 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; | 492 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; |
459 | if (mode == 0 ) | 493 | if (mode == 0 ) |
460 | addTag("h2",i18n("Journal from: ")); | 494 | addTag("h2",i18n("Journal from: ")); |
461 | else { | 495 | else { |
462 | if ( mode == 1 ) { | 496 | if ( mode == 1 ) { |
463 | addTag("h2",i18n( "Local: " ) +i18n("Journal from: ")); | 497 | addTag("h2",i18n( "Local: " ) +i18n("Journal from: ")); |
464 | } else { | 498 | } else { |
465 | addTag("h2",i18n( "Remote: " ) +i18n("Journal from: ")); | 499 | addTag("h2",i18n( "Remote: " ) +i18n("Journal from: ")); |
466 | } | 500 | } |
467 | addTag("h3",i18n( "Last modified " ) + KGlobal::locale()->formatDateTime(jour->lastModified(),shortDate ) ); | 501 | addTag("h3",i18n( "Last modified " ) + KGlobal::locale()->formatDateTime(jour->lastModified(),shortDate ) ); |
468 | } | 502 | } |
469 | topLevelWidget()->setCaption("Journal Viewer"); | 503 | topLevelWidget()->setCaption("Journal Viewer"); |
470 | mText.append(i18n("<h3> %1 </h3> ").arg(jour->dtStartDateStr(KOPrefs::instance()->mShortDateInViewer))); | 504 | mText.append(i18n("<h3> %1 </h3> ").arg(jour->dtStartDateStr(KOPrefs::instance()->mShortDateInViewer))); |
471 | if (!jour->description().isEmpty()) { | 505 | if (!jour->description().isEmpty()) { |
472 | addTag("p",jour->description()); | 506 | addTag("p",jour->description()); |
473 | } | 507 | } |
474 | setText(mText); | 508 | setText(mText); |
475 | } | 509 | } |
476 | 510 | ||
477 | void KOEventViewer::formatReadOnly(Incidence *event) | 511 | void KOEventViewer::formatReadOnly(Incidence *event) |
478 | { | 512 | { |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index d4fadcb..7978b46 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -157,97 +157,99 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : | |||
157 | mView->openCalendar( oldFile ); | 157 | mView->openCalendar( oldFile ); |
158 | qApp->processEvents(); | 158 | qApp->processEvents(); |
159 | } | 159 | } |
160 | } | 160 | } |
161 | mView->saveCalendar( defaultFileName() ); | 161 | mView->saveCalendar( defaultFileName() ); |
162 | newFile = true; | 162 | newFile = true; |
163 | } | 163 | } |
164 | 164 | ||
165 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 165 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
166 | if ( ! oldOpened ) | 166 | if ( ! oldOpened ) |
167 | mView->openCalendar( defaultFileName() ); | 167 | mView->openCalendar( defaultFileName() ); |
168 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 168 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
169 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); | 169 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); |
170 | 170 | ||
171 | if ( KOPrefs::instance()->mLanguageChanged ) { | 171 | if ( KOPrefs::instance()->mLanguageChanged ) { |
172 | KOPrefs::instance()->setCategoryDefaults(); | 172 | KOPrefs::instance()->setCategoryDefaults(); |
173 | int count = mView->addCategories(); | 173 | int count = mView->addCategories(); |
174 | KOPrefs::instance()->mLanguageChanged = false; | 174 | KOPrefs::instance()->mLanguageChanged = false; |
175 | } | 175 | } |
176 | processIncidenceSelection( 0 ); | 176 | processIncidenceSelection( 0 ); |
177 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), | 177 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), |
178 | SLOT( processIncidenceSelection( Incidence * ) ) ); | 178 | SLOT( processIncidenceSelection( Incidence * ) ) ); |
179 | connect( mView, SIGNAL( modifiedChanged( bool ) ), | 179 | connect( mView, SIGNAL( modifiedChanged( bool ) ), |
180 | SLOT( slotModifiedChanged( bool ) ) ); | 180 | SLOT( slotModifiedChanged( bool ) ) ); |
181 | 181 | ||
182 | 182 | ||
183 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); | 183 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); |
184 | mView->setModified( false ); | 184 | mView->setModified( false ); |
185 | mBlockAtStartup = false; | 185 | mBlockAtStartup = false; |
186 | mView->setModified( false ); | 186 | mView->setModified( false ); |
187 | setCentralWidget( mView ); | 187 | setCentralWidget( mView ); |
188 | globalFlagBlockStartup = 0; | 188 | globalFlagBlockStartup = 0; |
189 | mView->show(); | 189 | mView->show(); |
190 | delete splash; | 190 | delete splash; |
191 | if ( newFile ) | 191 | if ( newFile ) |
192 | mView->updateConfig(); | 192 | mView->updateConfig(); |
193 | // qApp->processEvents(); | 193 | // qApp->processEvents(); |
194 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 194 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
195 | fillSyncMenu(); | 195 | fillSyncMenu(); |
196 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); | 196 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); |
197 | if ( showWarning ) { | 197 | if ( showWarning ) { |
198 | KMessageBox::information( this, | 198 | KMessageBox::information( this, |
199 | "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); | 199 | "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); |
200 | qApp->processEvents(); | 200 | qApp->processEvents(); |
201 | mView->dialogManager()->showSyncOptions(); | 201 | mView->dialogManager()->showSyncOptions(); |
202 | } | 202 | } |
203 | 203 | ||
204 | //US listen for result adressed from Ka/Pi | 204 | //US listen for result adressed from Ka/Pi |
205 | #ifndef DESKTOP_VERSION | ||
205 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 206 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
207 | #endif | ||
206 | } | 208 | } |
207 | MainWindow::~MainWindow() | 209 | MainWindow::~MainWindow() |
208 | { | 210 | { |
209 | //qDebug("MainWindow::~MainWindow() "); | 211 | //qDebug("MainWindow::~MainWindow() "); |
210 | //save toolbar location | 212 | //save toolbar location |
211 | 213 | ||
212 | delete mCalendar; | 214 | delete mCalendar; |
213 | delete KOPrefs::instance(); | 215 | delete KOPrefs::instance(); |
214 | delete KIncidenceFormatter::instance(); | 216 | delete KIncidenceFormatter::instance(); |
215 | 217 | ||
216 | 218 | ||
217 | } | 219 | } |
218 | void MainWindow::showMaximized () | 220 | void MainWindow::showMaximized () |
219 | { | 221 | { |
220 | #ifndef DESKTOP_VERSION | 222 | #ifndef DESKTOP_VERSION |
221 | if ( ! globalFlagBlockStartup ) | 223 | if ( ! globalFlagBlockStartup ) |
222 | mView->goToday(); | 224 | mView->goToday(); |
223 | #endif | 225 | #endif |
224 | QWidget::showMaximized () ; | 226 | QWidget::showMaximized () ; |
225 | } | 227 | } |
226 | void MainWindow::closeEvent( QCloseEvent* ce ) | 228 | void MainWindow::closeEvent( QCloseEvent* ce ) |
227 | { | 229 | { |
228 | 230 | ||
229 | 231 | ||
230 | 232 | ||
231 | if ( ! KOPrefs::instance()->mAskForQuit ) { | 233 | if ( ! KOPrefs::instance()->mAskForQuit ) { |
232 | saveOnClose(); | 234 | saveOnClose(); |
233 | ce->accept(); | 235 | ce->accept(); |
234 | return; | 236 | return; |
235 | 237 | ||
236 | } | 238 | } |
237 | 239 | ||
238 | switch( QMessageBox::information( this, "KO/Pi", | 240 | switch( QMessageBox::information( this, "KO/Pi", |
239 | i18n("Do you really want\nto close KO/Pi?"), | 241 | i18n("Do you really want\nto close KO/Pi?"), |
240 | i18n("Close"), i18n("No"), | 242 | i18n("Close"), i18n("No"), |
241 | 0, 0 ) ) { | 243 | 0, 0 ) ) { |
242 | case 0: | 244 | case 0: |
243 | saveOnClose(); | 245 | saveOnClose(); |
244 | ce->accept(); | 246 | ce->accept(); |
245 | break; | 247 | break; |
246 | case 1: | 248 | case 1: |
247 | ce->ignore(); | 249 | ce->ignore(); |
248 | break; | 250 | break; |
249 | case 2: | 251 | case 2: |
250 | 252 | ||
251 | default: | 253 | default: |
252 | break; | 254 | break; |
253 | } | 255 | } |