author | ulf69 <ulf69> | 2004-08-17 00:09:26 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-08-17 00:09:26 (UTC) |
commit | ab3b10a5018152dedbdb64d0d5a4bd8ec752ccdb (patch) (unidiff) | |
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 | |||
@@ -31,12 +31,88 @@ $Id$ | |||
31 | #ifndef EXTERNALAPPHANDLER_H | 31 | #ifndef EXTERNALAPPHANDLER_H |
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; |
37 | 39 | ||
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 |
42 | { | 118 | { |
@@ -60,8 +136,13 @@ class DefaultAppItem | |||
60 | 136 | ||
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(); |
67 | 148 | ||
@@ -112,6 +193,14 @@ class ExternalAppHandler | |||
112 | bool isPagerAppAvailable(); | 193 | bool isPagerAppAvailable(); |
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 |
117 | void loadConfig(); | 206 | void loadConfig(); |
@@ -119,6 +208,21 @@ class ExternalAppHandler | |||
119 | QList<DefaultAppItem> getAvailableDefaultItems(Types); | 208 | QList<DefaultAppItem> getAvailableDefaultItems(Types); |
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: |
124 | ExternalAppHandler(); | 228 | ExternalAppHandler(); |
@@ -130,6 +234,9 @@ class ExternalAppHandler | |||
130 | Availability mSMSAppAvailable; | 234 | Availability mSMSAppAvailable; |
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); |
135 | 242 | ||
@@ -139,7 +246,7 @@ class ExternalAppHandler | |||
139 | 246 | ||
140 | static ExternalAppHandler *sInstance; | 247 | static ExternalAppHandler *sInstance; |
141 | 248 | ||
142 | |||
143 | }; | 249 | }; |
144 | 250 | ||
251 | |||
145 | #endif | 252 | #endif |