author | ulf69 <ulf69> | 2004-08-17 00:09:26 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-08-17 00:09:26 (UTC) |
commit | ab3b10a5018152dedbdb64d0d5a4bd8ec752ccdb (patch) (side-by-side diff) | |
tree | a9f62469297dda2981807b5235e7812cac72f44c /libkdepim/externalapphandler.h | |
parent | 0e46d151bca931ff5c69a637d91cfcc381094e0b (diff) | |
download | kdepimpi-ab3b10a5018152dedbdb64d0d5a4bd8ec752ccdb.zip kdepimpi-ab3b10a5018152dedbdb64d0d5a4bd8ec752ccdb.tar.gz kdepimpi-ab3b10a5018152dedbdb64d0d5a4bd8ec752ccdb.tar.bz2 |
QCop implementation for KOrganizer to access Ka/pi directly
Diffstat (limited to 'libkdepim/externalapphandler.h') (more/less context) (show whitespace changes)
-rw-r--r-- | libkdepim/externalapphandler.h | 111 |
1 files changed, 109 insertions, 2 deletions
diff --git a/libkdepim/externalapphandler.h b/libkdepim/externalapphandler.h index 3cf9e06..7c8de4e 100644 --- a/libkdepim/externalapphandler.h +++ b/libkdepim/externalapphandler.h @@ -30,14 +30,90 @@ $Id$ #ifndef EXTERNALAPPHANDLER_H #define EXTERNALAPPHANDLER_H +#include <qobject.h> #include <qlist.h> +#include <qmap.h> class QCopEnvelope; class ExternalAppHandler; +class QCopTransferItem : public QObject +{ + Q_OBJECT + public: + QCopTransferItem(const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage); + QCopTransferItem(); + + bool sendMessageToTarget(const QString& uid, const QString& param1); + + void setSourceChannel(const QString& sourceChannel); + + virtual bool appMessage( const QCString& msg, const QByteArray& data ); + + + signals: + void receivedMessageFromSource(const QString& sourceChannel, const QString& uid, const QString& param1); + + + public: + QString _sourceChannel; + QString _sourceMessage; + QString _sourceMessageParameters; + QString _targetChannel; + QString _targetMessage; + QString _targetMessageParameters; + +}; + +/********************************************************************************* + * + ********************************************************************************/ + +class QCopMapTransferItem : public QCopTransferItem +{ + Q_OBJECT + public: + QCopMapTransferItem(const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage); + + bool sendMessageToSource(const QString& uid, const QMap<QString,QString>& nameEmailMap); + + + virtual bool appMessage( const QCString& msg, const QByteArray& data ); + + + signals: + void receivedMessageFromTarget(const QString& uid, const QMap<QString,QString>& nameEmailMap); + +}; + +/********************************************************************************* + * + ********************************************************************************/ + +class QCopListTransferItem : public QCopTransferItem +{ + Q_OBJECT + public: + QCopListTransferItem(const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage); + + bool sendMessageToSource(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3); + + + virtual bool appMessage( const QCString& msg, const QByteArray& data ); + + + signals: + void receivedMessageFromTarget(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3); + +}; + +/********************************************************************************* + * + ********************************************************************************/ + class DefaultAppItem { public: @@ -59,10 +135,15 @@ class DefaultAppItem QString _parameters2; // a list of parameters in stringrepresentation. Delimiter is ; }; -class ExternalAppHandler +/********************************************************************************* + * + ********************************************************************************/ + +class ExternalAppHandler : public QObject { + Q_OBJECT public: virtual ~ExternalAppHandler(); static ExternalAppHandler *instance(); @@ -111,15 +192,38 @@ class ExternalAppHandler bool isFaxAppAvailable(); bool isPagerAppAvailable(); + //Call this method on the source when you want to select names from the addressbook by using QCop + bool requestNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& uid); + //Call this method on the target when you want to return the name/email map to the source (client). + bool returnNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& uid, const QStringList& name, const QStringList& email, const QStringList& uid); + + bool requestFindByEmailFromKAPI(const QString& sourceChannel, const QString& uid, const QString& email); + bool returnFindByEmailFromKAPI(const QString& sourceChannel, const QString& uid, const QStringList& name, const QStringList& email, const QStringList& uid); + //loadConfig clears the cache and checks again if the applications are available or not void loadConfig(); QList<DefaultAppItem> getAvailableDefaultItems(Types); DefaultAppItem* getDefaultItem(Types, int); + public slots: + void appMessage( const QCString& msg, const QByteArray& data ); + + + signals: + // Emmitted when the target app receives a request from the source app + void requestForNameEmailUidList(const QString& sourceChannel, const QString& uid, const QString& param1); + + // 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 receivedNameEmailUidListEvent(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList); + + 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); + private: ExternalAppHandler(); QList<DefaultAppItem> mDefaultItems; @@ -129,8 +233,11 @@ class ExternalAppHandler Availability mFaxAppAvailable; Availability mSMSAppAvailable; Availability mPagerAppAvailable; + QCopListTransferItem* mNameEmailUidListFromKAPITransfer; + QCopListTransferItem* mFindByEmailFromKAPITransfer; + void addDefaultAppItem(Types type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameters, const QString& message2, const QString& parameters2); QString& translateMessage(QString& message, const QString& param1, const QString& param2) const; @@ -138,8 +245,8 @@ class ExternalAppHandler static ExternalAppHandler *sInstance; - }; + #endif |