summaryrefslogtreecommitdiffabout
path: root/libkdepim/externalapphandler.h
Unidiff
Diffstat (limited to 'libkdepim/externalapphandler.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/externalapphandler.h19
1 files changed, 14 insertions, 5 deletions
diff --git a/libkdepim/externalapphandler.h b/libkdepim/externalapphandler.h
index 7c8de4e..a74080f 100644
--- a/libkdepim/externalapphandler.h
+++ b/libkdepim/externalapphandler.h
@@ -14,118 +14,122 @@
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24/* 24/*
25Enhanced Version of the file for platform independent KDE tools. 25Enhanced Version of the file for platform independent KDE tools.
26Copyright (c) 2004 Ulf Schenk 26Copyright (c) 2004 Ulf Schenk
27 27
28$Id$ 28$Id$
29*/ 29*/
30 30
31#ifndef EXTERNALAPPHANDLER_H 31#ifndef EXTERNALAPPHANDLER_H
32#define EXTERNALAPPHANDLER_H 32#define EXTERNALAPPHANDLER_H
33 33
34#include <qobject.h> 34#include <qobject.h>
35#include <qlist.h> 35#include <qlist.h>
36#include <qmap.h> 36#include <qmap.h>
37 37
38class QCopEnvelope; 38class QCopEnvelope;
39 39
40 40
41class ExternalAppHandler; 41class ExternalAppHandler;
42class QCopTransferItem : public QObject 42class QCopTransferItem : public QObject
43{ 43{
44 Q_OBJECT 44 Q_OBJECT
45 public: 45 public:
46 QCopTransferItem(const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage); 46 QCopTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage);
47 QCopTransferItem(); 47 QCopTransferItem();
48 48
49 bool sendMessageToTarget(const QString& uid, const QString& param1); 49 bool sendMessageToTarget(const QString& uid, const QString& param1 = QString::null, const QString& param2 = QString::null, const QString& param3 = QString::null);
50 50
51 void setSourceChannel(const QString& sourceChannel); 51 void setSourceChannel(const QString& sourceChannel);
52 52
53 virtual bool appMessage( const QCString& msg, const QByteArray& data ); 53 virtual bool appMessage( const QCString& msg, const QByteArray& data );
54 54
55 55
56 signals: 56 signals:
57 void receivedMessageFromSource(const QString& sourceChannel, const QString& uid);
57 void receivedMessageFromSource(const QString& sourceChannel, const QString& uid, const QString& param1); 58 void receivedMessageFromSource(const QString& sourceChannel, const QString& uid, const QString& param1);
59 void receivedMessageFromSource(const QString& sourceChannel, const QString& uid, const QString& param1, const QString& param2);
60 void receivedMessageFromSource(const QString& sourceChannel, const QString& uid, const QString& param1, const QString& param2, const QString& param3);
58 61
59 62
60 public: 63 public:
64 int _usedSourceParameters;
61 QString _sourceChannel; 65 QString _sourceChannel;
62 QString _sourceMessage; 66 QString _sourceMessage;
63 QString _sourceMessageParameters; 67 QString _sourceMessageParameters;
64 QString _targetChannel; 68 QString _targetChannel;
65 QString _targetMessage; 69 QString _targetMessage;
66 QString _targetMessageParameters; 70 QString _targetMessageParameters;
67 71
68}; 72};
69 73
70/********************************************************************************* 74/*********************************************************************************
71 * 75 *
72 ********************************************************************************/ 76 ********************************************************************************/
73 77
74class QCopMapTransferItem : public QCopTransferItem 78class QCopMapTransferItem : public QCopTransferItem
75{ 79{
76 Q_OBJECT 80 Q_OBJECT
77 public: 81 public:
78 QCopMapTransferItem(const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage); 82 QCopMapTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage);
79 83
80 bool sendMessageToSource(const QString& uid, const QMap<QString,QString>& nameEmailMap); 84 bool sendMessageToSource(const QString& uid, const QMap<QString,QString>& nameEmailMap);
81 85
82 86
83 virtual bool appMessage( const QCString& msg, const QByteArray& data ); 87 virtual bool appMessage( const QCString& msg, const QByteArray& data );
84 88
85 89
86 signals: 90 signals:
87 void receivedMessageFromTarget(const QString& uid, const QMap<QString,QString>& nameEmailMap); 91 void receivedMessageFromTarget(const QString& uid, const QMap<QString,QString>& nameEmailMap);
88 92
89}; 93};
90 94
91/********************************************************************************* 95/*********************************************************************************
92 * 96 *
93 ********************************************************************************/ 97 ********************************************************************************/
94 98
95class QCopListTransferItem : public QCopTransferItem 99class QCopListTransferItem : public QCopTransferItem
96{ 100{
97 Q_OBJECT 101 Q_OBJECT
98 public: 102 public:
99 QCopListTransferItem(const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage); 103 QCopListTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage);
100 104
101 bool sendMessageToSource(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3); 105 bool sendMessageToSource(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3);
102 106
103 107
104 virtual bool appMessage( const QCString& msg, const QByteArray& data ); 108 virtual bool appMessage( const QCString& msg, const QByteArray& data );
105 109
106 110
107 signals: 111 signals:
108 void receivedMessageFromTarget(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3); 112 void receivedMessageFromTarget(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3);
109 113
110}; 114};
111 115
112/********************************************************************************* 116/*********************************************************************************
113 * 117 *
114 ********************************************************************************/ 118 ********************************************************************************/
115 119
116 120
117class DefaultAppItem 121class DefaultAppItem
118{ 122{
119 public: 123 public:
120 DefaultAppItem(int type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameters, const QString& message2, const QString& parameters2) 124 DefaultAppItem(int type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameters, const QString& message2, const QString& parameters2)
121 : _type(type), _id(id), _label(label), _channel(channel), _message(message), _parameters(parameters), _message2(message2), _parameters2(parameters2) 125 : _type(type), _id(id), _label(label), _channel(channel), _message(message), _parameters(parameters), _message2(message2), _parameters2(parameters2)
122 {} 126 {}
123 127
124 DefaultAppItem() 128 DefaultAppItem()
125 { } 129 { }
126 130
127 public: 131 public:
128 int _type; 132 int _type;
129 int _id; 133 int _id;
130 QString _label; 134 QString _label;
131 QString _channel; 135 QString _channel;
@@ -172,81 +176,86 @@ class ExternalAppHandler : public QObject
172 //calls the emailapplication and creates a mail with parameter as recipients 176 //calls the emailapplication and creates a mail with parameter as recipients
173 // parameters format is 177 // parameters format is
174 // NAME <EMAIL>:SUBJECT 178 // NAME <EMAIL>:SUBJECT
175 bool mailToOneContact( const QString& adressline ); 179 bool mailToOneContact( const QString& adressline );
176 180
177 //calls the phoneapplication with the number 181 //calls the phoneapplication with the number
178 bool callByPhone( const QString& phonenumber ); 182 bool callByPhone( const QString& phonenumber );
179 183
180 //calls the smsapplication with the number 184 //calls the smsapplication with the number
181 bool callBySMS( const QString& phonenumber ); 185 bool callBySMS( const QString& phonenumber );
182 186
183 //calls the pagerapplication with the number 187 //calls the pagerapplication with the number
184 bool callByPager( const QString& pagernumber ); 188 bool callByPager( const QString& pagernumber );
185 189
186 //calls the faxapplication with the number 190 //calls the faxapplication with the number
187 bool callByFax( const QString& faxnumber ); 191 bool callByFax( const QString& faxnumber );
188 192
189 bool isEmailAppAvailable(); 193 bool isEmailAppAvailable();
190 bool isSMSAppAvailable(); 194 bool isSMSAppAvailable();
191 bool isPhoneAppAvailable(); 195 bool isPhoneAppAvailable();
192 bool isFaxAppAvailable(); 196 bool isFaxAppAvailable();
193 bool isPagerAppAvailable(); 197 bool isPagerAppAvailable();
194 198
195 199
196 //Call this method on the source when you want to select names from the addressbook by using QCop 200 //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); 201 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). 202 //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); 203 bool returnNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& uid, const QStringList& name, const QStringList& email, const QStringList& uid);
200 204
201 bool requestFindByEmailFromKAPI(const QString& sourceChannel, const QString& uid, const QString& email); 205 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); 206 bool returnFindByEmailFromKAPI(const QString& sourceChannel, const QString& uid, const QStringList& name, const QStringList& email, const QStringList& uid);
203 207
208 bool requestDetailsFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid);
209
204 210
205 //loadConfig clears the cache and checks again if the applications are available or not 211 //loadConfig clears the cache and checks again if the applications are available or not
206 void loadConfig(); 212 void loadConfig();
207 213
208 QList<DefaultAppItem> getAvailableDefaultItems(Types); 214 QList<DefaultAppItem> getAvailableDefaultItems(Types);
209 DefaultAppItem* getDefaultItem(Types, int); 215 DefaultAppItem* getDefaultItem(Types, int);
210 216
211 public slots: 217 public slots:
212 void appMessage( const QCString& msg, const QByteArray& data ); 218 void appMessage( const QCString& msg, const QByteArray& data );
213 219
214 220
215 signals: 221 signals:
216 // Emmitted when the target app receives a request from the source app 222 // Emmitted when the target app receives a request from the source app
217 void requestForNameEmailUidList(const QString& sourceChannel, const QString& uid, const QString& param1); 223 void requestForNameEmailUidList(const QString& sourceChannel, const QString& uid);
218 224
219 // Emitted when the source app recieves a list of name/email pairs (=addresses) from another target app. Usually Ka/Pi 225 // 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 226 // 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); 227 void receivedNameEmailUidListEvent(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList);
222 228
223 void requestFindByEmail(const QString& sourceChannel, const QString& uid, const QString& email); 229 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); 230 void receivedFindBbyEmailEvent(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList);
225 231
232 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid);
233
226 234
227 private: 235 private:
228 ExternalAppHandler(); 236 ExternalAppHandler();
229 QList<DefaultAppItem> mDefaultItems; 237 QList<DefaultAppItem> mDefaultItems;
230 238
231 Availability mEmailAppAvailable; 239 Availability mEmailAppAvailable;
232 Availability mPhoneAppAvailable; 240 Availability mPhoneAppAvailable;
233 Availability mFaxAppAvailable; 241 Availability mFaxAppAvailable;
234 Availability mSMSAppAvailable; 242 Availability mSMSAppAvailable;
235 Availability mPagerAppAvailable; 243 Availability mPagerAppAvailable;
236 244
237 QCopListTransferItem* mNameEmailUidListFromKAPITransfer; 245 QCopListTransferItem* mNameEmailUidListFromKAPITransfer;
238 QCopListTransferItem* mFindByEmailFromKAPITransfer; 246 QCopListTransferItem* mFindByEmailFromKAPITransfer;
247 QCopTransferItem* mDisplayDetails;
239 248
240 249
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); 250 void addDefaultAppItem(Types type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameters, const QString& message2, const QString& parameters2);
242 251
243 QString& translateMessage(QString& message, const QString& param1, const QString& param2) const; 252 QString& translateMessage(QString& message, const QString& param1, const QString& param2) const;
244 void passParameters(QCopEnvelope* e, const QString& parameters, const QString& param1, const QString& param2) const; 253 void passParameters(QCopEnvelope* e, const QString& parameters, const QString& param1, const QString& param2) const;
245 254
246 255
247 static ExternalAppHandler *sInstance; 256 static ExternalAppHandler *sInstance;
248 257
249}; 258};
250 259
251 260
252#endif 261#endif