summaryrefslogtreecommitdiffabout
path: root/libkdepim/externalapphandler.h
Unidiff
Diffstat (limited to 'libkdepim/externalapphandler.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/externalapphandler.h15
1 files changed, 9 insertions, 6 deletions
diff --git a/libkdepim/externalapphandler.h b/libkdepim/externalapphandler.h
index b899ad7..3247fe4 100644
--- a/libkdepim/externalapphandler.h
+++ b/libkdepim/externalapphandler.h
@@ -1,155 +1,158 @@
1/* 1/*
2 This file is part of libkdepim. 2 This file is part of libkdepim.
3 Copyright (c) 2004 Ulf Schenk 3 Copyright (c) 2004 Ulf Schenk
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
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#include <Q3PtrList>
38//Added by qt3to4:
39#include <Q3CString>
37 40
38class QCopEnvelope; 41class QCopEnvelope;
39 42
40 43
41class ExternalAppHandler; 44class ExternalAppHandler;
42class QCopTransferItem : public QObject 45class QCopTransferItem : public QObject
43{ 46{
44 Q_OBJECT 47 Q_OBJECT
45 public: 48 public:
46 QCopTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage); 49 QCopTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage);
47 QCopTransferItem(); 50 QCopTransferItem();
48 51
49 bool sendMessageToTarget(const QString& uid, const QString& param1 = QString::null, const QString& param2 = QString::null, const QString& param3 = QString::null); 52 bool sendMessageToTarget(const QString& uid, const QString& param1 = QString::null, const QString& param2 = QString::null, const QString& param3 = QString::null);
50 53
51 void setSourceChannel(const QString& sourceChannel); 54 void setSourceChannel(const QString& sourceChannel);
52 55
53 virtual bool appMessage( const QCString& msg, const QByteArray& data ); 56 virtual bool appMessage( const Q3CString& msg, const QByteArray& data );
54 57
55 58
56 signals: 59 signals:
57 void receivedMessageFromSource(const QString& sourceChannel, const QString& uid); 60 void receivedMessageFromSource(const QString& sourceChannel, const QString& uid);
58 void receivedMessageFromSource(const QString& sourceChannel, const QString& uid, const QString& param1); 61 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); 62 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); 63 void receivedMessageFromSource(const QString& sourceChannel, const QString& uid, const QString& param1, const QString& param2, const QString& param3);
61 64
62 public: 65 public:
63 int _usedSourceParameters; 66 int _usedSourceParameters;
64 QString _sourceChannel; 67 QString _sourceChannel;
65 QString _sourceMessage; 68 QString _sourceMessage;
66 QString _sourceMessageParameters; 69 QString _sourceMessageParameters;
67 QString _targetChannel; 70 QString _targetChannel;
68 QString _targetMessage; 71 QString _targetMessage;
69 QString _targetMessageParameters; 72 QString _targetMessageParameters;
70 73
71}; 74};
72 75
73/********************************************************************************* 76/*********************************************************************************
74 * 77 *
75 ********************************************************************************/ 78 ********************************************************************************/
76 79
77class QCopMapTransferItem : public QCopTransferItem 80class QCopMapTransferItem : public QCopTransferItem
78{ 81{
79 Q_OBJECT 82 Q_OBJECT
80 public: 83 public:
81 QCopMapTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage); 84 QCopMapTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage);
82 85
83 bool sendMessageToSource(const QString& uid, const QMap<QString,QString>& nameEmailMap); 86 bool sendMessageToSource(const QString& uid, const QMap<QString,QString>& nameEmailMap);
84 87
85 88
86 virtual bool appMessage( const QCString& msg, const QByteArray& data ); 89 virtual bool appMessage( const Q3CString& msg, const QByteArray& data );
87 90
88 91
89 signals: 92 signals:
90 void receivedMessageFromTarget(const QString& uid, const QMap<QString,QString>& nameEmailMap); 93 void receivedMessageFromTarget(const QString& uid, const QMap<QString,QString>& nameEmailMap);
91 94
92}; 95};
93 96
94/********************************************************************************* 97/*********************************************************************************
95 * 98 *
96 ********************************************************************************/ 99 ********************************************************************************/
97 100
98class QCopListTransferItem : public QCopTransferItem 101class QCopListTransferItem : public QCopTransferItem
99{ 102{
100 Q_OBJECT 103 Q_OBJECT
101 public: 104 public:
102 QCopListTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage); 105 QCopListTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage);
103 ~QCopListTransferItem(); 106 ~QCopListTransferItem();
104 bool sendMessageToSource(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3, const QStringList& list4, const QStringList& list5, const QStringList& list6); 107 bool sendMessageToSource(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3, const QStringList& list4, const QStringList& list5, const QStringList& list6);
105 108
106 109
107 virtual bool appMessage( const QCString& msg, const QByteArray& data ); 110 virtual bool appMessage( const Q3CString& msg, const QByteArray& data );
108 111
109 112
110 signals: 113 signals:
111 void receivedMessageFromTarget(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3, const QStringList& list4 , const QStringList& list5, const QStringList& list6); 114 void receivedMessageFromTarget(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3, const QStringList& list4 , const QStringList& list5, const QStringList& list6);
112 115
113}; 116};
114 117
115/********************************************************************************* 118/*********************************************************************************
116 * 119 *
117 ********************************************************************************/ 120 ********************************************************************************/
118 121
119 122
120class DefaultAppItem 123class DefaultAppItem
121{ 124{
122 public: 125 public:
123 DefaultAppItem(int type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameters, const QString& message2, const QString& parameters2) 126 DefaultAppItem(int type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameters, const QString& message2, const QString& parameters2)
124 : _type(type), _id(id), _label(label), _channel(channel), _message(message), _parameters(parameters), _message2(message2), _parameters2(parameters2) 127 : _type(type), _id(id), _label(label), _channel(channel), _message(message), _parameters(parameters), _message2(message2), _parameters2(parameters2)
125 {} 128 {}
126 129
127 DefaultAppItem() 130 DefaultAppItem()
128 { } 131 { }
129 132
130 public: 133 public:
131 int _type; 134 int _type;
132 int _id; 135 int _id;
133 QString _label; 136 QString _label;
134 QString _channel; 137 QString _channel;
135 QString _message; 138 QString _message;
136 QString _parameters;// a list of parameters in stringrepresentation. Delimiter is ; 139 QString _parameters;// a list of parameters in stringrepresentation. Delimiter is ;
137 QString _message2; 140 QString _message2;
138 QString _parameters2; // a list of parameters in stringrepresentation. Delimiter is ; 141 QString _parameters2; // a list of parameters in stringrepresentation. Delimiter is ;
139 142
140}; 143};
141 144
142/********************************************************************************* 145/*********************************************************************************
143 * 146 *
144 ********************************************************************************/ 147 ********************************************************************************/
145 148
146class ExternalAppHandler : public QObject 149class ExternalAppHandler : public QObject
147{ 150{
148 Q_OBJECT 151 Q_OBJECT
149 public: 152 public:
150 virtual ~ExternalAppHandler(); 153 virtual ~ExternalAppHandler();
151 154
152 static ExternalAppHandler *instance(); 155 static ExternalAppHandler *instance();
153 156
154 enum Types { 157 enum Types {
155 EMAIL = 0, 158 EMAIL = 0,
@@ -180,115 +183,115 @@ class ExternalAppHandler : public QObject
180 183
181 //calls the phoneapplication with the number 184 //calls the phoneapplication with the number
182 bool callByPhone( const QString& phonenumber ); 185 bool callByPhone( const QString& phonenumber );
183 186
184 //calls the smsapplication with the number 187 //calls the smsapplication with the number
185 bool callBySMS( const QString& phonenumber ); 188 bool callBySMS( const QString& phonenumber );
186 189
187 //calls the pagerapplication with the number 190 //calls the pagerapplication with the number
188 bool callByPager( const QString& pagernumber ); 191 bool callByPager( const QString& pagernumber );
189 192
190 //calls the faxapplication with the number 193 //calls the faxapplication with the number
191 bool callByFax( const QString& faxnumber ); 194 bool callByFax( const QString& faxnumber );
192 195
193 //calls the sipapplication with the number 196 //calls the sipapplication with the number
194 bool callBySIP( const QString& sipnumber ); 197 bool callBySIP( const QString& sipnumber );
195 198
196 bool isEmailAppAvailable(); 199 bool isEmailAppAvailable();
197 bool isSMSAppAvailable(); 200 bool isSMSAppAvailable();
198 bool isPhoneAppAvailable(); 201 bool isPhoneAppAvailable();
199 bool isFaxAppAvailable(); 202 bool isFaxAppAvailable();
200 bool isPagerAppAvailable(); 203 bool isPagerAppAvailable();
201 bool isSIPAppAvailable(); 204 bool isSIPAppAvailable();
202 205
203 206
204 //Call this method on the source when you want to select names from the addressbook by using QCop 207 //Call this method on the source when you want to select names from the addressbook by using QCop
205 bool requestNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid); 208 bool requestNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid);
206 //Call this method on the target when you want to return the name/email map to the source (client). 209 //Call this method on the target when you want to return the name/email map to the source (client).
207 bool returnNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& name, const QStringList& email, const QStringList& uid); 210 bool returnNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& name, const QStringList& email, const QStringList& uid);
208 211
209 212
210 213
211 bool requestFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QString& email); 214 bool requestFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QString& email);
212 bool returnFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& name, const QStringList& email, const QStringList& uid); 215 bool returnFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& name, const QStringList& email, const QStringList& uid);
213 216
214 bool requestDetailsFromKAPI(const QString& name, const QString& email, const QString& uid); 217 bool requestDetailsFromKAPI(const QString& name, const QString& email, const QString& uid);
215 218
216 219
217 220
218 bool requestBirthdayListFromKAPI(const QString& sourceChannel, const QString& sessionuid); 221 bool requestBirthdayListFromKAPI(const QString& sourceChannel, const QString& sessionuid);
219 bool returnBirthdayListFromKAPI(const QString& sourceChannel, const QString& sessionuid, 222 bool returnBirthdayListFromKAPI(const QString& sourceChannel, const QString& sessionuid,
220 const QStringList& birthdayList, const QStringList& anniversaryList, 223 const QStringList& birthdayList, const QStringList& anniversaryList,
221 const QStringList& realNameList, const QStringList& emailList, 224 const QStringList& realNameList, const QStringList& emailList,
222 const QStringList& assembledNameList, const QStringList& uidList); 225 const QStringList& assembledNameList, const QStringList& uidList);
223 226
224 227
225 //loadConfig clears the cache and checks again if the applications are available or not 228 //loadConfig clears the cache and checks again if the applications are available or not
226 void loadConfig(); 229 void loadConfig();
227 230
228 QList<DefaultAppItem> getAvailableDefaultItems(Types); 231 Q3PtrList<DefaultAppItem> getAvailableDefaultItems(Types);
229 DefaultAppItem* getDefaultItem(Types, int); 232 DefaultAppItem* getDefaultItem(Types, int);
230 233
231 public slots: 234 public slots:
232 void appMessage( const QCString& msg, const QByteArray& data ); 235 void appMessage( const Q3CString& msg, const QByteArray& data );
233 236
234 237
235 signals: 238 signals:
236 void callContactdialog(); 239 void callContactdialog();
237 void nextView(); 240 void nextView();
238 void doRingSync(); 241 void doRingSync();
239 // Emmitted when the target app receives a request from the source app 242 // Emmitted when the target app receives a request from the source app
240 void requestForNameEmailUidList(const QString& sourceChannel, const QString& uid); 243 void requestForNameEmailUidList(const QString& sourceChannel, const QString& uid);
241 244
242 // Emitted when the source app recieves a list of name/email pairs (=addresses) from another target app. Usually Ka/Pi 245 // Emitted when the source app recieves a list of name/email pairs (=addresses) from another target app. Usually Ka/Pi
243 // The first parameter is a uniqueid. It can be used to identify the event 246 // The first parameter is a uniqueid. It can be used to identify the event
244 void receivedNameEmailUidListEvent(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList); 247 void receivedNameEmailUidListEvent(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList);
245 248
246 void requestFindByEmail(const QString& sourceChannel, const QString& uid, const QString& email); 249 void requestFindByEmail(const QString& sourceChannel, const QString& uid, const QString& email);
247 void receivedFindByEmailEvent(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList); 250 void receivedFindByEmailEvent(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList);
248 251
249 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); 252 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid);
250 253
251 254
252 // Emmitted when the target app receives a request from the source app 255 // Emmitted when the target app receives a request from the source app
253 void requestForBirthdayList(const QString& sourceChannel, const QString& uid); 256 void requestForBirthdayList(const QString& sourceChannel, const QString& uid);
254 257
255 // Emitted when the source app recieves a list of name/email pairs (=addresses) from another target app. Usually Ka/Pi 258 // Emitted when the source app recieves a list of name/email pairs (=addresses) from another target app. Usually Ka/Pi
256 // The first parameter is a uniqueid. It can be used to identify the event 259 // The first parameter is a uniqueid. It can be used to identify the event
257 void receivedBirthdayListEvent(const QString& uid, const QStringList& birthdayList, 260 void receivedBirthdayListEvent(const QString& uid, const QStringList& birthdayList,
258 const QStringList& anniversaryList, const QStringList& realNameList, 261 const QStringList& anniversaryList, const QStringList& realNameList,
259 const QStringList& emailList, const QStringList& assembledNameList, 262 const QStringList& emailList, const QStringList& assembledNameList,
260 const QStringList& uidList); 263 const QStringList& uidList);
261 264
262 265
263 private: 266 private:
264 ExternalAppHandler(); 267 ExternalAppHandler();
265 QList<DefaultAppItem> mDefaultItems; 268 Q3PtrList<DefaultAppItem> mDefaultItems;
266 269
267 Availability mEmailAppAvailable; 270 Availability mEmailAppAvailable;
268 Availability mPhoneAppAvailable; 271 Availability mPhoneAppAvailable;
269 Availability mFaxAppAvailable; 272 Availability mFaxAppAvailable;
270 Availability mSMSAppAvailable; 273 Availability mSMSAppAvailable;
271 Availability mPagerAppAvailable; 274 Availability mPagerAppAvailable;
272 Availability mSIPAppAvailable; 275 Availability mSIPAppAvailable;
273 276
274 QCopListTransferItem* mNameEmailUidListFromKAPITransfer; 277 QCopListTransferItem* mNameEmailUidListFromKAPITransfer;
275 QCopListTransferItem* mFindByEmailFromKAPITransfer; 278 QCopListTransferItem* mFindByEmailFromKAPITransfer;
276 QCopTransferItem* mDisplayDetails; 279 QCopTransferItem* mDisplayDetails;
277 QCopListTransferItem* mBirthdayListFromKAPITransfer; 280 QCopListTransferItem* mBirthdayListFromKAPITransfer;
278 281
279 282
280 void addDefaultAppItem(Types type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameters, const QString& message2, const QString& parameters2); 283 void addDefaultAppItem(Types type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameters, const QString& message2, const QString& parameters2);
281 284
282 QString& translateMessage(QString& message, const QString& param1, const QString& param2) const; 285 QString& translateMessage(QString& message, const QString& param1, const QString& param2) const;
283 void passParameters(QCopEnvelope* e, const QString& parameters, const QString& param1, const QString& param2) const; 286 void passParameters(QCopEnvelope* e, const QString& parameters, const QString& param1, const QString& param2) const;
284 287
285 288
286 static ExternalAppHandler *sInstance; 289 static ExternalAppHandler *sInstance;
287 290
288 private slots: 291 private slots:
289 void receivedNameEmailUidList_Slot(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList, const QStringList&, const QStringList&, const QStringList& ); 292 void receivedNameEmailUidList_Slot(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList, const QStringList&, const QStringList&, const QStringList& );
290 293
291}; 294};
292 295
293 296
294#endif 297#endif