-rw-r--r-- | libkdepim/externalapphandler.cpp | 68 | ||||
-rw-r--r-- | libkdepim/externalapphandler.h | 32 |
2 files changed, 86 insertions, 14 deletions
diff --git a/libkdepim/externalapphandler.cpp b/libkdepim/externalapphandler.cpp index 99aee86..07bdff2 100644 --- a/libkdepim/externalapphandler.cpp +++ b/libkdepim/externalapphandler.cpp @@ -257,9 +257,9 @@ QCopListTransferItem::QCopListTransferItem(int usedSourceParameters, const QStri { //targetMessage returns later two parameters: uid, and three lists - _targetMessageParameters = "(QString,QStringList,QStringList,QStringList)"; + _targetMessageParameters = "(QString,QStringList,QStringList,QStringList,QStringList,QStringList,QStringList)"; } /*********************************************************************************/ -bool QCopListTransferItem::sendMessageToSource(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3) +bool QCopListTransferItem::sendMessageToSource(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3, const QStringList& list4, const QStringList& list5, const QStringList& list6) { #ifndef DESKTOP_VERSION @@ -268,10 +268,14 @@ bool QCopListTransferItem::sendMessageToSource(const QString& uid, const QString qDebug("3Using QCopEnvelope e(\"%s\",\"%s\")", _sourceChannel.latin1(), targetMessage.latin1()); - qDebug("passing uid(%s) and list1, list2, list3 as parameter to QCopEnvelope", uid.latin1()); + qDebug("passing uid(%s) and list1, list2, list3, list4, list5, list6 as parameter to QCopEnvelope", uid.latin1()); + + + for ( int i = 0; i < list3.count(); i++) + qDebug("listentry list3: %s",list3[i].latin1()); QCopEnvelope e(_sourceChannel.latin1(), targetMessage.latin1()); //US we need no names in the To field. The emailadresses are enough - e << uid << list1 << list2 << list3; + e << uid << list1 << list2 << list3 << list4 << list5 << list6; qApp->processEvents(); @@ -305,8 +309,13 @@ bool QCopListTransferItem::appMessage( const QCString& cmsg, const QByteArray& d QStringList list2; QStringList list3; + QStringList list4; + QStringList list5; + QStringList list6; QString uid; - stream >> uid >> list1 >> list2 >> list3; - emit receivedMessageFromTarget(uid, list1, list2, list3); + qDebug("3QCopListTransferItem- QCOP message received: %s ", cmsg.data() ); + + stream >> uid >> list1 >> list2 >> list3 >> list4 >> list5 >> list6; + emit receivedMessageFromTarget(uid, list1, list2, list3, list4, list5, list6); @@ -334,5 +343,5 @@ ExternalAppHandler::ExternalAppHandler() mNameEmailUidListFromKAPITransfer = new QCopListTransferItem(0, "requestNameEmailUIDListFromKAPI", "QPE/Application/kapi", "receiveNameEmailUIDList"); connect(mNameEmailUidListFromKAPITransfer, SIGNAL (receivedMessageFromSource(const QString&, const QString&)), this, SIGNAL (requestForNameEmailUidList(const QString&, const QString&))); - connect(mNameEmailUidListFromKAPITransfer, SIGNAL (receivedMessageFromTarget(const QString&, const QStringList&, const QStringList&, const QStringList&)), this, SIGNAL (receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&))); + connect(mNameEmailUidListFromKAPITransfer, SIGNAL (receivedMessageFromTarget(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), this, SLOT (receivedNameEmailUidList_Slot(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); //US mFindByEmailFromKAPITransfer = new QCopListTransferItem(1, "requestFindByEmailFromKAPI", "QPE/Application/kapi", "receiveFindByEmailNameEmailUIDList"); @@ -342,4 +351,12 @@ ExternalAppHandler::ExternalAppHandler() mDisplayDetails = new QCopListTransferItem(3, "requestDisplayDetailsFromKAPI", "QPE/Application/kapi", ""); connect(mDisplayDetails, SIGNAL (receivedMessageFromSource(const QString&, const QString&, const QString&, const QString&, const QString&)), this, SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); + + + + mBirthdayListFromKAPITransfer = new QCopListTransferItem(0, "requestBirthdayListFromKAPI", "QPE/Application/kapi", "receiveBirthdayList"); + connect(mBirthdayListFromKAPITransfer, SIGNAL (receivedMessageFromSource(const QString&, const QString&)), this, SIGNAL (requestForBirthdayList(const QString&, const QString&))); + connect(mBirthdayListFromKAPITransfer, SIGNAL (receivedMessageFromTarget(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), this, SIGNAL (receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); + + } @@ -348,4 +365,17 @@ ExternalAppHandler::~ExternalAppHandler() } +void ExternalAppHandler::receivedNameEmailUidList_Slot(const QString& uid, + const QStringList& nameList, + const QStringList& emailList, + const QStringList& uidList, + const QStringList&, + const QStringList&, + const QStringList& ) +{ + // this method is a conevnient way to reduce the number of parameters I have to pass + emit receivedNameEmailUidListEvent(uid, nameList, emailList, uidList); +} + + void ExternalAppHandler::loadConfig() { @@ -1050,4 +1080,7 @@ void ExternalAppHandler::appMessage( const QCString& cmsg, const QByteArray& dat bool res = mNameEmailUidListFromKAPITransfer->appMessage( cmsg, data ); if (!res) + res = mBirthdayListFromKAPITransfer->appMessage( cmsg, data ); + + if (!res) res = mDisplayDetails->appMessage( cmsg, data ); @@ -1066,7 +1099,8 @@ bool ExternalAppHandler::requestNameEmailUidListFromKAPI(const QString& sourceCh bool ExternalAppHandler::returnNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3) { - + QStringList list4, list5, list6; + mNameEmailUidListFromKAPITransfer->setSourceChannel(sourceChannel); - return mNameEmailUidListFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3); + return mNameEmailUidListFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3, list4, list5, list6); } @@ -1079,6 +1113,8 @@ bool ExternalAppHandler::requestFindByEmailFromKAPI(const QString& sourceChannel bool ExternalAppHandler::returnFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3) { + QStringList list4, list5, list6; + mFindByEmailFromKAPITransfer->setSourceChannel(sourceChannel); - return mFindByEmailFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3); + return mFindByEmailFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3, list4, list5, list6); } @@ -1089,4 +1125,16 @@ bool ExternalAppHandler::requestDetailsFromKAPI(const QString& name, const QStri } +bool ExternalAppHandler::requestBirthdayListFromKAPI(const QString& sourceChannel, const QString& sessionuid) +{ + mBirthdayListFromKAPITransfer->setSourceChannel(sourceChannel); + return mBirthdayListFromKAPITransfer->sendMessageToTarget(sessionuid); +} + +bool ExternalAppHandler::returnBirthdayListFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3, const QStringList& list4, const QStringList& list5, const QStringList& list6) +{ + mBirthdayListFromKAPITransfer->setSourceChannel(sourceChannel); + return mBirthdayListFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3, list4, list5, list6); +} + diff --git a/libkdepim/externalapphandler.h b/libkdepim/externalapphandler.h index cfe577b..4c6f1ea 100644 --- a/libkdepim/externalapphandler.h +++ b/libkdepim/externalapphandler.h @@ -60,5 +60,4 @@ class QCopTransferItem : public QObject void receivedMessageFromSource(const QString& sourceChannel, const QString& uid, const QString& param1, const QString& param2, const QString& param3); - public: int _usedSourceParameters; @@ -103,5 +102,5 @@ class QCopListTransferItem : public QCopTransferItem QCopListTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage); - bool sendMessageToSource(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3); + bool sendMessageToSource(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3, const QStringList& list4, const QStringList& list5, const QStringList& list6); @@ -110,5 +109,5 @@ class QCopListTransferItem : public QCopTransferItem signals: - void receivedMessageFromTarget(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3); + void receivedMessageFromTarget(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3, const QStringList& list4 , const QStringList& list5, const QStringList& list6); }; @@ -208,4 +207,6 @@ class ExternalAppHandler : public QObject bool returnNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& name, const QStringList& email, const QStringList& uid); + + bool requestFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QString& email); bool returnFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& name, const QStringList& email, const QStringList& uid); @@ -214,4 +215,12 @@ class ExternalAppHandler : public QObject + + bool requestBirthdayListFromKAPI(const QString& sourceChannel, const QString& sessionuid); + bool returnBirthdayListFromKAPI(const QString& sourceChannel, const QString& sessionuid, + const QStringList& birthdayList, const QStringList& anniversaryList, + const QStringList& realNameList, const QStringList& emailList, + const QStringList& assembledNameList, const QStringList& uidList); + + //loadConfig clears the cache and checks again if the applications are available or not void loadConfig(); @@ -233,9 +242,20 @@ class ExternalAppHandler : public QObject void requestFindByEmail(const QString& sourceChannel, const QString& uid, const QString& email); - void receivedFindBbyEmailEvent(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList); + void receivedFindByEmailEvent(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList); void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); + // Emmitted when the target app receives a request from the source app + void requestForBirthdayList(const QString& sourceChannel, const QString& uid); + + // Emitted when the source app recieves a list of name/email pairs (=addresses) from another target app. Usually Ka/Pi + // The first parameter is a uniqueid. It can be used to identify the event + void receivedBirthdayListEvent(const QString& uid, const QStringList& birthdayList, + const QStringList& anniversaryList, const QStringList& realNameList, + const QStringList& emailList, const QStringList& assembledNameList, + const QStringList& uidList); + + private: ExternalAppHandler(); @@ -252,4 +272,5 @@ class ExternalAppHandler : public QObject QCopListTransferItem* mFindByEmailFromKAPITransfer; QCopTransferItem* mDisplayDetails; + QCopListTransferItem* mBirthdayListFromKAPITransfer; @@ -262,4 +283,7 @@ class ExternalAppHandler : public QObject static ExternalAppHandler *sInstance; + private slots: + void receivedNameEmailUidList_Slot(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList, const QStringList&, const QStringList&, const QStringList& ); + }; |