From 64a8ef1629f523df3006de5cb2b9882a50d96a05 Mon Sep 17 00:00:00 2001 From: zautrix Date: Tue, 07 Sep 2004 20:33:23 +0000 Subject: Fixed Kopi-Kapi external app communication --- diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp index c61b387..47d298a 100644 --- a/kabc/addressbook.cpp +++ b/kabc/addressbook.cpp @@ -427,7 +427,7 @@ Addressee::List AddressBook::findByName( const QString &name ) Iterator it; for ( it = begin(); it != end(); ++it ) { - if ( name == (*it).name() ) { + if ( name == (*it).realName() ) { results.append( *it ); } } diff --git a/kabc/stdaddressbook.cpp b/kabc/stdaddressbook.cpp index 760820e..9f38f08 100644 --- a/kabc/stdaddressbook.cpp +++ b/kabc/stdaddressbook.cpp @@ -63,8 +63,11 @@ StdAddressBook *StdAddressBook::self() if ( !mSelf ) { QString appdir = StdAddressBook::setTempAppDir(); - - kdDebug(5700) << "StdAddressBook::self()" << endl; + qDebug("****************************************************** "); + qDebug("****************************************************** "); + qDebug("****************************************************** "); + qDebug("****************************************************** "); + qDebug("****************************************************** "); // US im am not sure why I have to use the other format here?? #ifdef KAB_EMBEDDED mSelf = addressBookDeleter.setObject( new StdAddressBook ); @@ -100,6 +103,13 @@ StdAddressBook *StdAddressBook::self( bool onlyFastResources ) if ( !mSelf ) { + qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ "); + qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ "); + qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ "); + qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ "); + qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ "); + qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ "); + qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ "); QString appdir =StdAddressBook::setTempAppDir(); #ifdef KAB_EMBEDDED mSelf = addressBookDeleter.setObject( new StdAddressBook( onlyFastResources ) ); diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 4299ebd..2f9f1df 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp @@ -2041,7 +2041,7 @@ void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QSt */ void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) { -// qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); + //qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); QString foundUid = QString::null; if (uid.isEmpty()) @@ -2055,12 +2055,13 @@ void KABCore::requestForDetails(const QString& sourceChannel, const QString& ses if (!email.isEmpty()) emaillist = mAddressBook->findByEmail( email ); - + qDebug("count %d %d ", namelist.count(),emaillist.count() ); //check if we have a match in Namelist and Emaillist - if ((namelist.count() == 0) && (emaillist.count() > 0)) - foundUid == emaillist[0].uid(); + if ((namelist.count() == 0) && (emaillist.count() > 0)) { + foundUid = emaillist[0].uid(); + } else if ((namelist.count() > 0) && (emaillist.count() == 0)) - foundUid == namelist[0].uid(); + foundUid = namelist[0].uid(); else { for (int i = 0; i < namelist.count(); i++) @@ -2069,7 +2070,7 @@ void KABCore::requestForDetails(const QString& sourceChannel, const QString& ses { if (namelist[i] == emaillist[j]) { - foundUid == namelist[i].uid(); + foundUid = namelist[i].uid(); } } } @@ -2082,14 +2083,16 @@ void KABCore::requestForDetails(const QString& sourceChannel, const QString& ses if (!foundUid.isEmpty()) { + // raise Ka/Pi if it is in the background #ifndef DESKTOP_VERSION #ifndef KORG_NODCOP - QCopEnvelope e("QPE/Application/kapi", "raise()"); + //QCopEnvelope e("QPE/Application/kapi", "raise()"); #endif #endif - + mMainWindow->showMaximized(); + mMainWindow-> raise(); mViewManager->setSelected( "", false); mViewManager->refreshView( "" ); diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp index 1f69700..0866939 100644 --- a/korganizer/koeventviewer.cpp +++ b/korganizer/koeventviewer.cpp @@ -50,9 +50,13 @@ #include #define size count #endif -#ifndef DESKTOP_VERSION + +#ifdef DESKTOP_VERSION +#include +#else //DESKTOP_VERSION +#include #include -#endif +#endif //DESKTOP_VERSION KOEventViewer::KOEventViewer(QWidget *parent,const char *name) : QTextBrowser(parent,name) @@ -68,16 +72,15 @@ KOEventViewer::~KOEventViewer() void KOEventViewer::setSource(const QString& n) { - if ( n.left(3) == "uid" ) { + if ( n.left(3) == "uid" ) +#ifdef DESKTOP_VERSION + { KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); KABC::AddressBook::Iterator it; for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { // LR I do not understand, why the uid string is different on zaurus and desktop -#ifdef DESKTOP_VERSION QString uid = "uid://"+(*it).uid(); -#else - QString uid = "uid:"+(*it).uid(); -#endif + //qDebug("for *%s* +%s+ ", n.latin1(), uid.latin1()); if (n == uid ) { //qDebug("found %s ",(*it).mobileHomePhone().latin1() ); @@ -99,10 +102,28 @@ void KOEventViewer::setSource(const QString& n) } return; } +#else + { + QPtrList attendees = mCurrentIncidence->attendees(); + if (attendees.count()) { + Attendee *a; + for(a=attendees.first();a;a=attendees.next()) { + if ( "uid:"+a->uid() == n ) { + bool res = ExternalAppHandler::instance()->requestDetailsFromKAPI(a->name(), a->email(), ""); + return; + } + } + } + return; + } + //requestNameEmailUidListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); + // the result should now arrive through method insertAttendees + //QString uid = "uid:"+(*it).uid(); +#endif if ( n.left(6) == "mailto" ) { // qDebug("KOEventViewer::setSource %s ", n.mid(7).latin1()); #ifndef DESKTOP_VERSION - QCopEnvelope e("QPE/Application/kmpi", "newMail(QString)" ); + QCopEnvelope e("QPE/Application/ompi", "newMail(QString)" ); e << n.mid(7); #endif @@ -383,6 +404,7 @@ void KOEventViewer::formatAttendees(Incidence *event) mText.append("