summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-09-09 21:10:16 (UTC)
committer zautrix <zautrix>2004-09-09 21:10:16 (UTC)
commit5b0e3c87bbe32aacd51f6faff5446ed3838a68e0 (patch) (unidiff)
tree131651cf98ced42d2389f03f7a3f11aa47cf575f
parent480ffef4859d24cc0a936377f8983fd59312d4b6 (diff)
downloadkdepimpi-5b0e3c87bbe32aacd51f6faff5446ed3838a68e0.zip
kdepimpi-5b0e3c87bbe32aacd51f6faff5446ed3838a68e0.tar.gz
kdepimpi-5b0e3c87bbe32aacd51f6faff5446ed3838a68e0.tar.bz2
Fixed organizer request details bug
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koeventviewer.cpp8
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
@@ -43,128 +43,132 @@
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
61KOEventViewer::KOEventViewer(QWidget *parent,const char *name) 61KOEventViewer::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
68KOEventViewer::~KOEventViewer() 68KOEventViewer::~KOEventViewer()
69{ 69{
70} 70}
71 71
72void KOEventViewer::setSource(const QString& n) 72void 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);
@@ -356,129 +360,131 @@ void KOEventViewer::appendTodo(Todo *event, int mode )
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
385void KOEventViewer::formatCategories(Incidence *event) 389void 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}
396void KOEventViewer::formatAttendees(Incidence *event) 400void 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) + ".)";