Diffstat (limited to 'libkdepim/externalapphandler.h') (more/less context) (ignore 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 | |||
@@ -32,5 +32,7 @@ $Id$ | |||
32 | #define EXTERNALAPPHANDLER_H | 32 | #define EXTERNALAPPHANDLER_H |
33 | 33 | ||
34 | #include <qobject.h> | ||
34 | #include <qlist.h> | 35 | #include <qlist.h> |
36 | #include <qmap.h> | ||
35 | 37 | ||
36 | class QCopEnvelope; | 38 | class QCopEnvelope; |
@@ -38,4 +40,78 @@ class QCopEnvelope; | |||
38 | 40 | ||
39 | class ExternalAppHandler; | 41 | class ExternalAppHandler; |
42 | class QCopTransferItem : public QObject | ||
43 | { | ||
44 | Q_OBJECT | ||
45 | public: | ||
46 | QCopTransferItem(const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage); | ||
47 | QCopTransferItem(); | ||
48 | |||
49 | bool sendMessageToTarget(const QString& uid, const QString& param1); | ||
50 | |||
51 | void setSourceChannel(const QString& sourceChannel); | ||
52 | |||
53 | virtual bool appMessage( const QCString& msg, const QByteArray& data ); | ||
54 | |||
55 | |||
56 | signals: | ||
57 | void receivedMessageFromSource(const QString& sourceChannel, const QString& uid, const QString& param1); | ||
58 | |||
59 | |||
60 | public: | ||
61 | QString _sourceChannel; | ||
62 | QString _sourceMessage; | ||
63 | QString _sourceMessageParameters; | ||
64 | QString _targetChannel; | ||
65 | QString _targetMessage; | ||
66 | QString _targetMessageParameters; | ||
67 | |||
68 | }; | ||
69 | |||
70 | /********************************************************************************* | ||
71 | * | ||
72 | ********************************************************************************/ | ||
73 | |||
74 | class QCopMapTransferItem : public QCopTransferItem | ||
75 | { | ||
76 | Q_OBJECT | ||
77 | public: | ||
78 | QCopMapTransferItem(const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage); | ||
79 | |||
80 | bool sendMessageToSource(const QString& uid, const QMap<QString,QString>& nameEmailMap); | ||
81 | |||
82 | |||
83 | virtual bool appMessage( const QCString& msg, const QByteArray& data ); | ||
84 | |||
85 | |||
86 | signals: | ||
87 | void receivedMessageFromTarget(const QString& uid, const QMap<QString,QString>& nameEmailMap); | ||
88 | |||
89 | }; | ||
90 | |||
91 | /********************************************************************************* | ||
92 | * | ||
93 | ********************************************************************************/ | ||
94 | |||
95 | class QCopListTransferItem : public QCopTransferItem | ||
96 | { | ||
97 | Q_OBJECT | ||
98 | public: | ||
99 | QCopListTransferItem(const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage); | ||
100 | |||
101 | bool sendMessageToSource(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3); | ||
102 | |||
103 | |||
104 | virtual bool appMessage( const QCString& msg, const QByteArray& data ); | ||
105 | |||
106 | |||
107 | signals: | ||
108 | void receivedMessageFromTarget(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3); | ||
109 | |||
110 | }; | ||
111 | |||
112 | /********************************************************************************* | ||
113 | * | ||
114 | ********************************************************************************/ | ||
115 | |||
40 | 116 | ||
41 | class DefaultAppItem | 117 | class DefaultAppItem |
@@ -61,6 +137,11 @@ class DefaultAppItem | |||
61 | }; | 137 | }; |
62 | 138 | ||
63 | class ExternalAppHandler | 139 | /********************************************************************************* |
140 | * | ||
141 | ********************************************************************************/ | ||
142 | |||
143 | class ExternalAppHandler : public QObject | ||
64 | { | 144 | { |
145 | Q_OBJECT | ||
65 | public: | 146 | public: |
66 | virtual ~ExternalAppHandler(); | 147 | virtual ~ExternalAppHandler(); |
@@ -113,4 +194,12 @@ class ExternalAppHandler | |||
113 | 194 | ||
114 | 195 | ||
196 | //Call this method on the source when you want to select names from the addressbook by using QCop | ||
197 | bool requestNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& uid); | ||
198 | //Call this method on the target when you want to return the name/email map to the source (client). | ||
199 | bool returnNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& uid, const QStringList& name, const QStringList& email, const QStringList& uid); | ||
200 | |||
201 | bool requestFindByEmailFromKAPI(const QString& sourceChannel, const QString& uid, const QString& email); | ||
202 | bool returnFindByEmailFromKAPI(const QString& sourceChannel, const QString& uid, const QStringList& name, const QStringList& email, const QStringList& uid); | ||
203 | |||
115 | 204 | ||
116 | //loadConfig clears the cache and checks again if the applications are available or not | 205 | //loadConfig clears the cache and checks again if the applications are available or not |
@@ -120,4 +209,19 @@ class ExternalAppHandler | |||
120 | DefaultAppItem* getDefaultItem(Types, int); | 209 | DefaultAppItem* getDefaultItem(Types, int); |
121 | 210 | ||
211 | public slots: | ||
212 | void appMessage( const QCString& msg, const QByteArray& data ); | ||
213 | |||
214 | |||
215 | signals: | ||
216 | // Emmitted when the target app receives a request from the source app | ||
217 | void requestForNameEmailUidList(const QString& sourceChannel, const QString& uid, const QString& param1); | ||
218 | |||
219 | // Emitted when the source app recieves a list of name/email pairs (=addresses) from another target app. Usually Ka/Pi | ||
220 | // The first parameter is a uniqueid. It can be used to identify the event | ||
221 | void receivedNameEmailUidListEvent(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList); | ||
222 | |||
223 | void requestFindByEmail(const QString& sourceChannel, const QString& uid, const QString& email); | ||
224 | void receivedFindBbyEmailEvent(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList); | ||
225 | |||
122 | 226 | ||
123 | private: | 227 | private: |
@@ -131,4 +235,7 @@ class ExternalAppHandler | |||
131 | Availability mPagerAppAvailable; | 235 | Availability mPagerAppAvailable; |
132 | 236 | ||
237 | QCopListTransferItem* mNameEmailUidListFromKAPITransfer; | ||
238 | QCopListTransferItem* mFindByEmailFromKAPITransfer; | ||
239 | |||
133 | 240 | ||
134 | void addDefaultAppItem(Types type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameters, const QString& message2, const QString& parameters2); | 241 | void addDefaultAppItem(Types type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameters, const QString& message2, const QString& parameters2); |
@@ -140,6 +247,6 @@ class ExternalAppHandler | |||
140 | static ExternalAppHandler *sInstance; | 247 | static ExternalAppHandler *sInstance; |
141 | 248 | ||
142 | |||
143 | }; | 249 | }; |
144 | 250 | ||
251 | |||
145 | #endif | 252 | #endif |