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 | |
parent | 9d5c8750ae671e73ec8ebc0a71f30fd30680f2c0 (diff) | |
download | kdepimpi-64a8ef1629f523df3006de5cb2b9882a50d96a05.zip kdepimpi-64a8ef1629f523df3006de5cb2b9882a50d96a05.tar.gz kdepimpi-64a8ef1629f523df3006de5cb2b9882a50d96a05.tar.bz2 |
Fixed Kopi-Kapi external app communication
-rw-r--r-- | kabc/addressbook.cpp | 2 | ||||
-rw-r--r-- | kabc/stdaddressbook.cpp | 14 | ||||
-rw-r--r-- | kaddressbook/kabcore.cpp | 19 | ||||
-rw-r--r-- | korganizer/koeventviewer.cpp | 50 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 2 | ||||
-rw-r--r-- | libkdepim/externalapphandler.cpp | 2 |
6 files changed, 68 insertions, 21 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp index c61b387..47d298a 100644 --- a/kabc/addressbook.cpp +++ b/kabc/addressbook.cpp | |||
@@ -426,9 +426,9 @@ Addressee::List AddressBook::findByName( const QString &name ) | |||
426 | Addressee::List results; | 426 | Addressee::List results; |
427 | 427 | ||
428 | Iterator it; | 428 | Iterator it; |
429 | for ( it = begin(); it != end(); ++it ) { | 429 | for ( it = begin(); it != end(); ++it ) { |
430 | if ( name == (*it).name() ) { | 430 | if ( name == (*it).realName() ) { |
431 | results.append( *it ); | 431 | results.append( *it ); |
432 | } | 432 | } |
433 | } | 433 | } |
434 | 434 | ||
diff --git a/kabc/stdaddressbook.cpp b/kabc/stdaddressbook.cpp index 760820e..9f38f08 100644 --- a/kabc/stdaddressbook.cpp +++ b/kabc/stdaddressbook.cpp | |||
@@ -62,10 +62,13 @@ StdAddressBook *StdAddressBook::self() | |||
62 | 62 | ||
63 | if ( !mSelf ) | 63 | if ( !mSelf ) |
64 | { | 64 | { |
65 | QString appdir = StdAddressBook::setTempAppDir(); | 65 | QString appdir = StdAddressBook::setTempAppDir(); |
66 | 66 | qDebug("****************************************************** "); | |
67 | kdDebug(5700) << "StdAddressBook::self()" << endl; | 67 | qDebug("****************************************************** "); |
68 | qDebug("****************************************************** "); | ||
69 | qDebug("****************************************************** "); | ||
70 | qDebug("****************************************************** "); | ||
68 | // US im am not sure why I have to use the other format here?? | 71 | // US im am not sure why I have to use the other format here?? |
69 | #ifdef KAB_EMBEDDED | 72 | #ifdef KAB_EMBEDDED |
70 | mSelf = addressBookDeleter.setObject( new StdAddressBook ); | 73 | mSelf = addressBookDeleter.setObject( new StdAddressBook ); |
71 | #else //KAB_EMBEDDED | 74 | #else //KAB_EMBEDDED |
@@ -99,8 +102,15 @@ StdAddressBook *StdAddressBook::self( bool onlyFastResources ) | |||
99 | { | 102 | { |
100 | 103 | ||
101 | if ( !mSelf ) | 104 | if ( !mSelf ) |
102 | { | 105 | { |
106 | qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ "); | ||
107 | qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ "); | ||
108 | qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ "); | ||
109 | qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ "); | ||
110 | qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ "); | ||
111 | qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ "); | ||
112 | qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ "); | ||
103 | QString appdir =StdAddressBook::setTempAppDir(); | 113 | QString appdir =StdAddressBook::setTempAppDir(); |
104 | #ifdef KAB_EMBEDDED | 114 | #ifdef KAB_EMBEDDED |
105 | mSelf = addressBookDeleter.setObject( new StdAddressBook( onlyFastResources ) ); | 115 | mSelf = addressBookDeleter.setObject( new StdAddressBook( onlyFastResources ) ); |
106 | #else //KAB_EMBEDDED | 116 | #else //KAB_EMBEDDED |
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 4299ebd..2f9f1df 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -2040,9 +2040,9 @@ void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QSt | |||
2040 | /* this method will be called through the QCop interface from other apps to show details of a contact. | 2040 | /* this method will be called through the QCop interface from other apps to show details of a contact. |
2041 | */ | 2041 | */ |
2042 | void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) | 2042 | void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) |
2043 | { | 2043 | { |
2044 | // qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); | 2044 | //qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); |
2045 | 2045 | ||
2046 | QString foundUid = QString::null; | 2046 | QString foundUid = QString::null; |
2047 | if (uid.isEmpty()) | 2047 | if (uid.isEmpty()) |
2048 | { | 2048 | { |
@@ -2054,23 +2054,24 @@ void KABCore::requestForDetails(const QString& sourceChannel, const QString& ses | |||
2054 | namelist = mAddressBook->findByName( name ); | 2054 | namelist = mAddressBook->findByName( name ); |
2055 | 2055 | ||
2056 | if (!email.isEmpty()) | 2056 | if (!email.isEmpty()) |
2057 | emaillist = mAddressBook->findByEmail( email ); | 2057 | emaillist = mAddressBook->findByEmail( email ); |
2058 | 2058 | qDebug("count %d %d ", namelist.count(),emaillist.count() ); | |
2059 | //check if we have a match in Namelist and Emaillist | 2059 | //check if we have a match in Namelist and Emaillist |
2060 | if ((namelist.count() == 0) && (emaillist.count() > 0)) | 2060 | if ((namelist.count() == 0) && (emaillist.count() > 0)) { |
2061 | foundUid == emaillist[0].uid(); | 2061 | foundUid = emaillist[0].uid(); |
2062 | } | ||
2062 | else if ((namelist.count() > 0) && (emaillist.count() == 0)) | 2063 | else if ((namelist.count() > 0) && (emaillist.count() == 0)) |
2063 | foundUid == namelist[0].uid(); | 2064 | foundUid = namelist[0].uid(); |
2064 | else | 2065 | else |
2065 | { | 2066 | { |
2066 | for (int i = 0; i < namelist.count(); i++) | 2067 | for (int i = 0; i < namelist.count(); i++) |
2067 | { | 2068 | { |
2068 | for (int j = 0; j < emaillist.count(); j++) | 2069 | for (int j = 0; j < emaillist.count(); j++) |
2069 | { | 2070 | { |
2070 | if (namelist[i] == emaillist[j]) | 2071 | if (namelist[i] == emaillist[j]) |
2071 | { | 2072 | { |
2072 | foundUid == namelist[i].uid(); | 2073 | foundUid = namelist[i].uid(); |
2073 | } | 2074 | } |
2074 | } | 2075 | } |
2075 | } | 2076 | } |
2076 | } | 2077 | } |
@@ -2081,16 +2082,18 @@ void KABCore::requestForDetails(const QString& sourceChannel, const QString& ses | |||
2081 | } | 2082 | } |
2082 | 2083 | ||
2083 | if (!foundUid.isEmpty()) | 2084 | if (!foundUid.isEmpty()) |
2084 | { | 2085 | { |
2086 | |||
2085 | // raise Ka/Pi if it is in the background | 2087 | // raise Ka/Pi if it is in the background |
2086 | #ifndef DESKTOP_VERSION | 2088 | #ifndef DESKTOP_VERSION |
2087 | #ifndef KORG_NODCOP | 2089 | #ifndef KORG_NODCOP |
2088 | QCopEnvelope e("QPE/Application/kapi", "raise()"); | 2090 | //QCopEnvelope e("QPE/Application/kapi", "raise()"); |
2089 | #endif | 2091 | #endif |
2090 | #endif | 2092 | #endif |
2091 | 2093 | ||
2092 | mMainWindow->showMaximized(); | 2094 | mMainWindow->showMaximized(); |
2095 | mMainWindow-> raise(); | ||
2093 | 2096 | ||
2094 | mViewManager->setSelected( "", false); | 2097 | mViewManager->setSelected( "", false); |
2095 | mViewManager->refreshView( "" ); | 2098 | mViewManager->refreshView( "" ); |
2096 | mViewManager->setSelected( foundUid, true ); | 2099 | mViewManager->setSelected( foundUid, true ); |
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp index 1f69700..0866939 100644 --- a/korganizer/koeventviewer.cpp +++ b/korganizer/koeventviewer.cpp | |||
@@ -49,11 +49,15 @@ | |||
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 | { |
@@ -67,18 +71,17 @@ KOEventViewer::~KOEventViewer() | |||
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 ); |
@@ -98,12 +101,30 @@ void KOEventViewer::setSource(const QString& n) | |||
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 | } |
@@ -382,8 +403,9 @@ void KOEventViewer::formatAttendees(Incidence *event) | |||
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(); |
@@ -393,8 +415,13 @@ void KOEventViewer::formatAttendees(Incidence *event) | |||
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 | ||
@@ -409,8 +436,9 @@ void KOEventViewer::formatAttendees(Incidence *event) | |||
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) { |
@@ -427,8 +455,14 @@ void KOEventViewer::formatAttendees(Incidence *event) | |||
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(); |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index d4fadcb..7978b46 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -201,9 +201,11 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : | |||
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() "); |
diff --git a/libkdepim/externalapphandler.cpp b/libkdepim/externalapphandler.cpp index bd83626..6100097 100644 --- a/libkdepim/externalapphandler.cpp +++ b/libkdepim/externalapphandler.cpp | |||
@@ -305,9 +305,8 @@ bool QCopListTransferItem::appMessage( const QCString& cmsg, const QByteArray& d | |||
305 | QStringList list3; | 305 | QStringList list3; |
306 | QString uid; | 306 | QString uid; |
307 | 307 | ||
308 | stream >> uid >> list1 >> list2 >> list3; | 308 | stream >> uid >> list1 >> list2 >> list3; |
309 | |||
310 | emit receivedMessageFromTarget(uid, list1, list2, list3); | 309 | emit receivedMessageFromTarget(uid, list1, list2, list3); |
311 | 310 | ||
312 | 311 | ||
313 | return true; | 312 | return true; |
@@ -969,9 +968,8 @@ void ExternalAppHandler::passParameters(QCopEnvelope* e, const QString& paramete | |||
969 | 968 | ||
970 | void ExternalAppHandler::appMessage( const QCString& cmsg, const QByteArray& data ) | 969 | void ExternalAppHandler::appMessage( const QCString& cmsg, const QByteArray& data ) |
971 | { | 970 | { |
972 | bool res = mNameEmailUidListFromKAPITransfer->appMessage( cmsg, data ); | 971 | bool res = mNameEmailUidListFromKAPITransfer->appMessage( cmsg, data ); |
973 | |||
974 | if (!res) | 972 | if (!res) |
975 | res = mDisplayDetails->appMessage( cmsg, data ); | 973 | res = mDisplayDetails->appMessage( cmsg, data ); |
976 | 974 | ||
977 | // if (!res) | 975 | // if (!res) |