summaryrefslogtreecommitdiffabout
path: root/libkdepim/externalapphandler.h
authorulf69 <ulf69>2004-08-19 00:33:04 (UTC)
committer ulf69 <ulf69>2004-08-19 00:33:04 (UTC)
commit00101d27c9305ac3163e1a0c8ed27408b41fa192 (patch) (unidiff)
tree3051c96ef71245c97fb18d0804749e7d04bd4ad2 /libkdepim/externalapphandler.h
parent05a1b5cbea6a7c1a7500632f8e7c1bf5be9328d8 (diff)
downloadkdepimpi-00101d27c9305ac3163e1a0c8ed27408b41fa192.zip
kdepimpi-00101d27c9305ac3163e1a0c8ed27408b41fa192.tar.gz
kdepimpi-00101d27c9305ac3163e1a0c8ed27408b41fa192.tar.bz2
code cleanup
Diffstat (limited to 'libkdepim/externalapphandler.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/externalapphandler.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/libkdepim/externalapphandler.h b/libkdepim/externalapphandler.h
index a74080f..1b04b2b 100644
--- a/libkdepim/externalapphandler.h
+++ b/libkdepim/externalapphandler.h
@@ -1,261 +1,261 @@
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 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(int usedSourceParameters, 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 = QString::null, const QString& param2 = QString::null, const QString& param3 = QString::null); 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);
58 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); 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); 60 void receivedMessageFromSource(const QString& sourceChannel, const QString& uid, const QString& param1, const QString& param2, const QString& param3);
61 61
62 62
63 public: 63 public:
64 int _usedSourceParameters; 64 int _usedSourceParameters;
65 QString _sourceChannel; 65 QString _sourceChannel;
66 QString _sourceMessage; 66 QString _sourceMessage;
67 QString _sourceMessageParameters; 67 QString _sourceMessageParameters;
68 QString _targetChannel; 68 QString _targetChannel;
69 QString _targetMessage; 69 QString _targetMessage;
70 QString _targetMessageParameters; 70 QString _targetMessageParameters;
71 71
72}; 72};
73 73
74/********************************************************************************* 74/*********************************************************************************
75 * 75 *
76 ********************************************************************************/ 76 ********************************************************************************/
77 77
78class QCopMapTransferItem : public QCopTransferItem 78class QCopMapTransferItem : public QCopTransferItem
79{ 79{
80 Q_OBJECT 80 Q_OBJECT
81 public: 81 public:
82 QCopMapTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage); 82 QCopMapTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage);
83 83
84 bool sendMessageToSource(const QString& uid, const QMap<QString,QString>& nameEmailMap); 84 bool sendMessageToSource(const QString& uid, const QMap<QString,QString>& nameEmailMap);
85 85
86 86
87 virtual bool appMessage( const QCString& msg, const QByteArray& data ); 87 virtual bool appMessage( const QCString& msg, const QByteArray& data );
88 88
89 89
90 signals: 90 signals:
91 void receivedMessageFromTarget(const QString& uid, const QMap<QString,QString>& nameEmailMap); 91 void receivedMessageFromTarget(const QString& uid, const QMap<QString,QString>& nameEmailMap);
92 92
93}; 93};
94 94
95/********************************************************************************* 95/*********************************************************************************
96 * 96 *
97 ********************************************************************************/ 97 ********************************************************************************/
98 98
99class QCopListTransferItem : public QCopTransferItem 99class QCopListTransferItem : public QCopTransferItem
100{ 100{
101 Q_OBJECT 101 Q_OBJECT
102 public: 102 public:
103 QCopListTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage); 103 QCopListTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage);
104 104
105 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);
106 106
107 107
108 virtual bool appMessage( const QCString& msg, const QByteArray& data ); 108 virtual bool appMessage( const QCString& msg, const QByteArray& data );
109 109
110 110
111 signals: 111 signals:
112 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);
113 113
114}; 114};
115 115
116/********************************************************************************* 116/*********************************************************************************
117 * 117 *
118 ********************************************************************************/ 118 ********************************************************************************/
119 119
120 120
121class DefaultAppItem 121class DefaultAppItem
122{ 122{
123 public: 123 public:
124 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)
125 : _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)
126 {} 126 {}
127 127
128 DefaultAppItem() 128 DefaultAppItem()
129 { } 129 { }
130 130
131 public: 131 public:
132 int _type; 132 int _type;
133 int _id; 133 int _id;
134 QString _label; 134 QString _label;
135 QString _channel; 135 QString _channel;
136 QString _message; 136 QString _message;
137 QString _parameters;// a list of parameters in stringrepresentation. Delimiter is ; 137 QString _parameters;// a list of parameters in stringrepresentation. Delimiter is ;
138 QString _message2; 138 QString _message2;
139 QString _parameters2; // a list of parameters in stringrepresentation. Delimiter is ; 139 QString _parameters2; // a list of parameters in stringrepresentation. Delimiter is ;
140 140
141}; 141};
142 142
143/********************************************************************************* 143/*********************************************************************************
144 * 144 *
145 ********************************************************************************/ 145 ********************************************************************************/
146 146
147class ExternalAppHandler : public QObject 147class ExternalAppHandler : public QObject
148{ 148{
149 Q_OBJECT 149 Q_OBJECT
150 public: 150 public:
151 virtual ~ExternalAppHandler(); 151 virtual ~ExternalAppHandler();
152 152
153 static ExternalAppHandler *instance(); 153 static ExternalAppHandler *instance();
154 154
155 enum Types { 155 enum Types {
156 EMAIL = 0, 156 EMAIL = 0,
157 PHONE = 1, 157 PHONE = 1,
158 SMS = 2, 158 SMS = 2,
159 FAX = 3, 159 FAX = 3,
160 PAGER = 4 160 PAGER = 4
161 }; 161 };
162 162
163 enum Availability { 163 enum Availability {
164 UNDEFINED = -1, 164 UNDEFINED = -1,
165 UNAVAILABLE = 0, 165 UNAVAILABLE = 0,
166 AVAILABLE = 1 166 AVAILABLE = 1
167 }; 167 };
168 168
169 //calls the emailapplication with a number of attachments that need to be send. 169 //calls the emailapplication with a number of attachments that need to be send.
170 //either parameter can be left empty. 170 //either parameter can be left empty.
171 bool mailToMultipleContacts( const QString& recipients, const QString& attachmenturls ); 171 bool mailToMultipleContacts( const QString& recipients, const QString& attachmenturls );
172 172
173 //calls the emailapplication and creates a mail with parameter emailadress as recipients 173 //calls the emailapplication and creates a mail with parameter emailadress as recipients
174 bool mailToOneContact( const QString& name, const QString& emailadress ); 174 bool mailToOneContact( const QString& name, const QString& emailadress );
175 175
176 //calls the emailapplication and creates a mail with parameter as recipients 176 //calls the emailapplication and creates a mail with parameter as recipients
177 // parameters format is 177 // parameters format is
178 // NAME <EMAIL>:SUBJECT 178 // NAME <EMAIL>:SUBJECT
179 bool mailToOneContact( const QString& adressline ); 179 bool mailToOneContact( const QString& adressline );
180 180
181 //calls the phoneapplication with the number 181 //calls the phoneapplication with the number
182 bool callByPhone( const QString& phonenumber ); 182 bool callByPhone( const QString& phonenumber );
183 183
184 //calls the smsapplication with the number 184 //calls the smsapplication with the number
185 bool callBySMS( const QString& phonenumber ); 185 bool callBySMS( const QString& phonenumber );
186 186
187 //calls the pagerapplication with the number 187 //calls the pagerapplication with the number
188 bool callByPager( const QString& pagernumber ); 188 bool callByPager( const QString& pagernumber );
189 189
190 //calls the faxapplication with the number 190 //calls the faxapplication with the number
191 bool callByFax( const QString& faxnumber ); 191 bool callByFax( const QString& faxnumber );
192 192
193 bool isEmailAppAvailable(); 193 bool isEmailAppAvailable();
194 bool isSMSAppAvailable(); 194 bool isSMSAppAvailable();
195 bool isPhoneAppAvailable(); 195 bool isPhoneAppAvailable();
196 bool isFaxAppAvailable(); 196 bool isFaxAppAvailable();
197 bool isPagerAppAvailable(); 197 bool isPagerAppAvailable();
198 198
199 199
200 //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
201 bool requestNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& uid); 201 bool requestNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid);
202 //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).
203 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& sessionuid, const QStringList& name, const QStringList& email, const QStringList& uid);
204 204
205 bool requestFindByEmailFromKAPI(const QString& sourceChannel, const QString& uid, const QString& email); 205 bool requestFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QString& email);
206 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& sessionuid, const QStringList& name, const QStringList& email, const QStringList& uid);
207 207
208 bool requestDetailsFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); 208 bool requestDetailsFromKAPI(const QString& name, const QString& email, const QString& uid);
209 209
210 210
211 //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
212 void loadConfig(); 212 void loadConfig();
213 213
214 QList<DefaultAppItem> getAvailableDefaultItems(Types); 214 QList<DefaultAppItem> getAvailableDefaultItems(Types);
215 DefaultAppItem* getDefaultItem(Types, int); 215 DefaultAppItem* getDefaultItem(Types, int);
216 216
217 public slots: 217 public slots:
218 void appMessage( const QCString& msg, const QByteArray& data ); 218 void appMessage( const QCString& msg, const QByteArray& data );
219 219
220 220
221 signals: 221 signals:
222 // 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
223 void requestForNameEmailUidList(const QString& sourceChannel, const QString& uid); 223 void requestForNameEmailUidList(const QString& sourceChannel, const QString& uid);
224 224
225 // 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
226 // 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
227 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);
228 228
229 void requestFindByEmail(const QString& sourceChannel, const QString& uid, const QString& email); 229 void requestFindByEmail(const QString& sourceChannel, const QString& uid, const QString& email);
230 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);
231 231
232 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); 232 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid);
233 233
234 234
235 private: 235 private:
236 ExternalAppHandler(); 236 ExternalAppHandler();
237 QList<DefaultAppItem> mDefaultItems; 237 QList<DefaultAppItem> mDefaultItems;
238 238
239 Availability mEmailAppAvailable; 239 Availability mEmailAppAvailable;
240 Availability mPhoneAppAvailable; 240 Availability mPhoneAppAvailable;
241 Availability mFaxAppAvailable; 241 Availability mFaxAppAvailable;
242 Availability mSMSAppAvailable; 242 Availability mSMSAppAvailable;
243 Availability mPagerAppAvailable; 243 Availability mPagerAppAvailable;
244 244
245 QCopListTransferItem* mNameEmailUidListFromKAPITransfer; 245 QCopListTransferItem* mNameEmailUidListFromKAPITransfer;
246 QCopListTransferItem* mFindByEmailFromKAPITransfer; 246 QCopListTransferItem* mFindByEmailFromKAPITransfer;
247 QCopTransferItem* mDisplayDetails; 247 QCopTransferItem* mDisplayDetails;
248 248
249 249
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); 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);
251 251
252 QString& translateMessage(QString& message, const QString& param1, const QString& param2) const; 252 QString& translateMessage(QString& message, const QString& param1, const QString& param2) const;
253 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;
254 254
255 255
256 static ExternalAppHandler *sInstance; 256 static ExternalAppHandler *sInstance;
257 257
258}; 258};
259 259
260 260
261#endif 261#endif