27 #include <qtcontacts.h> |
27 #include <qtcontacts.h> |
28 #include <hbview.h> |
28 #include <hbview.h> |
29 #include <QGraphicsLinearLayout> |
29 #include <QGraphicsLinearLayout> |
30 #include <QDebug> |
30 #include <QDebug> |
31 |
31 |
|
32 |
32 testPbkServices::testPbkServices(HbMainWindow *aParent) |
33 testPbkServices::testPbkServices(HbMainWindow *aParent) |
33 { |
34 { |
34 mSndFetch=0; |
35 mRequest=NULL; |
35 mSndEdit=0; |
|
36 mMainWindow=aParent; |
36 mMainWindow=aParent; |
37 setParent(aParent); |
37 setParent(aParent); |
38 |
38 |
39 } |
39 } |
40 |
40 |
41 testPbkServices::~testPbkServices() |
41 testPbkServices::~testPbkServices() |
42 { |
42 { |
43 |
43 if (mRequest) |
|
44 { |
|
45 delete mRequest; |
|
46 mRequest=0; |
|
47 } |
44 } |
48 } |
45 |
49 |
46 void testPbkServices::launchEditorNumber() |
50 void testPbkServices::launchEditorNumber() |
47 { |
51 { |
48 if (mSndEdit) |
52 if (mRequest) |
49 { |
53 { |
50 delete mSndEdit; |
54 delete mRequest; |
51 mSndEdit=0; |
55 mRequest=0; |
52 } |
56 } |
53 |
57 |
54 mSndEdit = new XQServiceRequest("com.nokia.services.phonebookservices.Fetch", "editCreateNew(QString,QString)", false); |
58 QVariantList args; |
55 connect(mSndEdit, SIGNAL(requestCompleted(QVariant)), this, SLOT(onEditCompleted(QVariant))); |
59 QString serviceName("com.nokia.services.phonebookservices"); |
56 |
60 QString operation("editCreateNew(QString,QString)"); |
57 QString type = QContactPhoneNumber::DefinitionName; |
61 XQApplicationManager appMng; |
58 *mSndEdit << type; |
62 mRequest = appMng.create(serviceName, "Fetch", operation, true); // embedded |
59 *mSndEdit << "1234567"; |
63 |
60 |
64 // Result handlers |
61 QVariant retValue; |
65 connect (mRequest, SIGNAL(requestOk(const QVariant&)), this, SLOT(onEditCompleted(const QVariant&))); |
62 bool res=mSndEdit->send(retValue); |
66 |
|
67 args << QContactPhoneNumber::DefinitionName.operator QVariant(); |
|
68 args << "1234567"; |
|
69 |
|
70 mRequest->setArguments(args); |
|
71 mRequest->send(); |
63 } |
72 } |
64 |
73 |
65 void testPbkServices::launchEditorEmail() |
74 void testPbkServices::launchEditorEmail() |
66 { |
75 { |
67 if (mSndEdit) |
76 if (mRequest) |
68 { |
77 { |
69 delete mSndEdit; |
78 delete mRequest; |
70 mSndEdit=0; |
79 mRequest=0; |
71 } |
80 } |
72 |
81 |
73 mSndEdit = new XQServiceRequest("com.nokia.services.phonebookservices.Fetch", "editCreateNew(QString,QString)", false); |
82 QVariantList args; |
74 connect(mSndEdit, SIGNAL(requestCompleted(QVariant)), this, SLOT(onEditCompleted(QVariant))); |
83 QString serviceName("com.nokia.services.phonebookservices"); |
75 |
84 QString operation("editCreateNew(QString,QString)"); |
76 QString type = QContactEmailAddress::DefinitionName; |
85 XQApplicationManager appMng; |
77 *mSndEdit << type; |
86 mRequest = appMng.create(serviceName, "Fetch", operation, true); // embedded |
78 *mSndEdit << "email@mailprovider.com"; |
87 |
79 |
88 // Result handlers |
80 QVariant retValue; |
89 connect (mRequest, SIGNAL(requestOk(const QVariant&)), this, SLOT(onEditCompleted(const QVariant&))); |
81 bool res=mSndEdit->send(retValue); |
90 |
|
91 args << QContactEmailAddress::DefinitionName.operator QVariant(); |
|
92 args << "email@mailprovider.com"; |
|
93 |
|
94 mRequest->setArguments(args); |
|
95 mRequest->send(); |
82 } |
96 } |
83 |
97 |
84 void testPbkServices::launchEditorOnlineAccount() |
98 void testPbkServices::launchEditorOnlineAccount() |
85 { |
99 { |
86 if (mSndEdit) |
100 if (mRequest) |
87 { |
101 { |
88 delete mSndEdit; |
102 delete mRequest; |
89 mSndEdit=0; |
103 mRequest=0; |
90 } |
104 } |
91 |
105 |
92 mSndEdit = new XQServiceRequest("com.nokia.services.phonebookservices.Fetch", "editCreateNew(QString,QString)", false); |
106 QVariantList args; |
93 connect(mSndEdit, SIGNAL(requestCompleted(QVariant)), this, SLOT(onEditCompleted(QVariant))); |
107 QString serviceName("com.nokia.services.phonebookservices"); |
94 |
108 QString operation("editCreateNew(QString,QString)"); |
95 QString type = QContactOnlineAccount::DefinitionName; |
109 XQApplicationManager appMng; |
96 *mSndEdit << type; |
110 mRequest = appMng.create(serviceName, "Fetch", operation, true); // embedded |
97 *mSndEdit << "account@provider.com"; |
111 |
98 |
112 // Result handlers |
99 QVariant retValue; |
113 connect (mRequest, SIGNAL(requestOk(const QVariant&)), this, SLOT(onEditCompleted(const QVariant&))); |
100 bool res=mSndEdit->send(retValue); |
114 |
|
115 args << QContactOnlineAccount::DefinitionName.operator QVariant(); |
|
116 args << "account@provider.com"; |
|
117 |
|
118 mRequest->setArguments(args); |
|
119 mRequest->send(); |
101 } |
120 } |
102 |
121 |
103 void testPbkServices::launchEditorVCard() |
122 void testPbkServices::launchEditorVCard() |
104 { |
123 { |
105 if (mSndEdit) |
124 if (mRequest) |
106 { |
125 { |
107 delete mSndEdit; |
126 delete mRequest; |
108 mSndEdit=0; |
127 mRequest=0; |
109 } |
128 } |
110 |
129 |
111 mSndEdit = new XQServiceRequest("com.nokia.services.phonebookservices.Fetch", "editCreateNew(QString)", false); |
130 QVariantList args; |
112 connect(mSndEdit, SIGNAL(requestCompleted(QVariant)), this, SLOT(onEditCompleted(QVariant))); |
131 QString serviceName("com.nokia.services.phonebookservices"); |
113 |
132 QString operation("editCreateNew(QString)"); |
114 QString filename("C:\\data\\Others\\testvcard.vcf"); |
133 XQApplicationManager appMng; |
115 *mSndEdit << filename; |
134 mRequest = appMng.create(serviceName, "Fetch", operation, true); // embedded |
116 |
135 |
117 QVariant retValue; |
136 // Result handlers |
118 bool res=mSndEdit->send(retValue); |
137 connect (mRequest, SIGNAL(requestOk(const QVariant&)), this, SLOT(onEditCompleted(const QVariant&))); |
|
138 |
|
139 args << "C:\\data\\Others\\testvcard.vcf"; |
|
140 |
|
141 mRequest->setArguments(args); |
|
142 mRequest->send(); |
119 } |
143 } |
120 |
144 |
121 void testPbkServices::launchUpdateEditorNumber() |
145 void testPbkServices::launchUpdateEditorNumber() |
122 { |
146 { |
123 if (mSndEdit) |
147 if (mRequest) |
124 { |
148 { |
125 delete mSndEdit; |
149 delete mRequest; |
126 mSndEdit=0; |
150 mRequest=0; |
127 } |
151 } |
128 |
152 |
129 mSndEdit = new XQServiceRequest("com.nokia.services.phonebookservices.Fetch", "editUpdateExisting(QString,QString)", false); |
153 QVariantList args; |
130 connect(mSndEdit, SIGNAL(requestCompleted(QVariant)), this, SLOT(onEditCompleted(QVariant))); |
154 QString serviceName("com.nokia.services.phonebookservices"); |
131 |
155 QString operation("editUpdateExisting(QString,QString)"); |
132 QString type = QContactPhoneNumber::DefinitionName; |
156 XQApplicationManager appMng; |
133 *mSndEdit << type; |
157 mRequest = appMng.create(serviceName, "Fetch", operation, true); // embedded |
134 *mSndEdit << "1234567"; |
158 |
135 |
159 // Result handlers |
136 QVariant retValue; |
160 connect (mRequest, SIGNAL(requestOk(const QVariant&)), this, SLOT(onEditCompleted(const QVariant&))); |
137 bool res=mSndEdit->send(retValue); |
161 |
|
162 args << QContactPhoneNumber::DefinitionName.operator QVariant(); |
|
163 args << "1234567"; |
|
164 |
|
165 mRequest->setArguments(args); |
|
166 mRequest->send(); |
138 } |
167 } |
139 |
168 |
140 void testPbkServices::launchUpdateEditorEmail() |
169 void testPbkServices::launchUpdateEditorEmail() |
141 { |
170 { |
142 if (mSndEdit) |
171 if (mRequest) |
143 { |
172 { |
144 delete mSndEdit; |
173 delete mRequest; |
145 mSndEdit=0; |
174 mRequest=0; |
146 } |
175 } |
147 |
176 |
148 mSndEdit = new XQServiceRequest("com.nokia.services.phonebookservices.Fetch", "editUpdateExisting(QString,QString)", false); |
177 QVariantList args; |
149 connect(mSndEdit, SIGNAL(requestCompleted(QVariant)), this, SLOT(onEditCompleted(QVariant))); |
178 QString serviceName("com.nokia.services.phonebookservices"); |
150 |
179 QString operation("editUpdateExisting(QString,QString)"); |
151 QString type = QContactEmailAddress::DefinitionName; |
180 XQApplicationManager appMng; |
152 *mSndEdit << type; |
181 mRequest = appMng.create(serviceName, "Fetch", operation, true); // embedded |
153 *mSndEdit << "email@mailprovider.com"; |
182 |
154 |
183 // Result handlers |
155 QVariant retValue; |
184 connect (mRequest, SIGNAL(requestOk(const QVariant&)), this, SLOT(onEditCompleted(const QVariant&))); |
156 bool res=mSndEdit->send(retValue); |
185 |
|
186 args << QContactEmailAddress::DefinitionName.operator QVariant(); |
|
187 args << "email@mailprovider.com"; |
|
188 |
|
189 mRequest->setArguments(args); |
|
190 mRequest->send(); |
157 } |
191 } |
158 |
192 |
159 void testPbkServices::launchUpdateEditorOnlineAccount() |
193 void testPbkServices::launchUpdateEditorOnlineAccount() |
160 { |
194 { |
161 if (mSndEdit) |
195 if (mRequest) |
162 { |
196 { |
163 delete mSndEdit; |
197 delete mRequest; |
164 mSndEdit=0; |
198 mRequest=0; |
165 } |
199 } |
166 |
200 |
167 mSndEdit = new XQServiceRequest("com.nokia.services.phonebookservices.Fetch", "editUpdateExisting(QString,QString)", false); |
201 QVariantList args; |
168 connect(mSndEdit, SIGNAL(requestCompleted(QVariant)), this, SLOT(onEditCompleted(QVariant))); |
202 QString serviceName("com.nokia.services.phonebookservices"); |
169 |
203 QString operation("editUpdateExisting(QString,QString)"); |
170 QString type = QContactOnlineAccount::DefinitionName; |
204 XQApplicationManager appMng; |
171 *mSndEdit << type; |
205 mRequest = appMng.create(serviceName, "Fetch", operation, true); // embedded |
172 *mSndEdit << "account@provider.com"; |
206 |
173 |
207 // Result handlers |
174 QVariant retValue; |
208 connect (mRequest, SIGNAL(requestOk(const QVariant&)), this, SLOT(onEditCompleted(const QVariant&))); |
175 bool res=mSndEdit->send(retValue); |
209 |
|
210 args << QContactOnlineAccount::DefinitionName.operator QVariant(); |
|
211 args << "account@provider.com"; |
|
212 |
|
213 mRequest->setArguments(args); |
|
214 mRequest->send(); |
176 } |
215 } |
177 |
216 |
178 void testPbkServices::onEditCompleted(const QVariant& value) |
217 void testPbkServices::onEditCompleted(const QVariant& value) |
179 { |
218 { |
180 mMainWindow->activateWindow(); |
219 mMainWindow->activateWindow(); |
195 } |
234 } |
196 } |
235 } |
197 |
236 |
198 void testPbkServices::launchFetch() |
237 void testPbkServices::launchFetch() |
199 { |
238 { |
200 |
239 if (mRequest) |
201 if (mSndFetch) |
240 { |
202 { |
241 delete mRequest; |
203 delete mSndFetch; |
242 mRequest=0; |
204 mSndFetch=0; |
243 } |
205 } |
244 |
206 |
245 QVariantList args; |
207 //XQServiceRequest snd("com.nokia.services.hbserviceprovider.Dialer","dial(QString)",true); |
246 QString serviceName("com.nokia.services.phonebookservices"); |
208 mSndFetch = new XQServiceRequest("com.nokia.services.phonebookservices.Fetch", "fetch(QString,QString,QString)",false); |
247 QString operation("fetch(QString,QString,QString)"); |
209 connect(mSndFetch, SIGNAL(requestCompleted(QVariant)), this, SLOT(onRequestCompleted(QVariant))); |
248 XQApplicationManager appMng; |
210 |
249 mRequest = appMng.create(serviceName, "Fetch", operation, true); // embedded |
211 *mSndFetch << "Non-filtered multi-fetch"; |
250 |
212 *mSndFetch << KCntActionAll; |
251 // Result handlers |
213 *mSndFetch << KCntFilterDisplayAll; |
252 connect (mRequest, SIGNAL(requestOk(const QVariant&)), this, SLOT(onRequestCompleted(const QVariant&))); |
214 |
253 |
215 QVariant retValue; |
254 args << "Non-filtered multi-fetch"; |
216 bool res=mSndFetch->send(retValue); |
255 args << KCntActionAll; |
217 |
256 args << KCntFilterDisplayAll; |
|
257 |
|
258 mRequest->setArguments(args); |
|
259 mRequest->send(); |
218 } |
260 } |
219 |
261 |
220 void testPbkServices::launchSingleFetch() |
262 void testPbkServices::launchSingleFetch() |
221 { |
263 { |
222 if (mSndFetch) |
264 if (mRequest) |
223 { |
265 { |
224 delete mSndFetch; |
266 delete mRequest; |
225 mSndFetch=0; |
267 mRequest=0; |
226 } |
268 } |
227 |
269 |
228 mSndFetch = new XQServiceRequest("com.nokia.services.phonebookservices.Fetch", "Dofetch(QString,QString,QString,QString)",false); |
270 QVariantList args; |
229 connect(mSndFetch, SIGNAL(requestCompleted(QVariant)), this, SLOT(onRequestCompleted(QVariant))); |
271 QString serviceName("com.nokia.services.phonebookservices"); |
230 |
272 QString operation("Dofetch(QString,QString,QString,QString)"); |
231 *mSndFetch << "Single-fetching"; |
273 XQApplicationManager appMng; |
232 *mSndFetch << KCntActionAll; |
274 mRequest = appMng.create(serviceName, "Fetch", operation, true); // embedded |
233 *mSndFetch << KCntFilterDisplayAll; |
275 |
234 *mSndFetch << KCntSingleSelectionMode; |
276 // Result handlers |
235 |
277 connect (mRequest, SIGNAL(requestOk(const QVariant&)), this, SLOT(onRequestCompleted(const QVariant&))); |
236 QVariant retValue; |
278 |
237 bool res=mSndFetch->send(retValue); |
279 args << "Single-fetching"; |
|
280 args << KCntActionAll; |
|
281 args << KCntFilterDisplayAll; |
|
282 args << KCntSingleSelectionMode; |
|
283 |
|
284 mRequest->setArguments(args); |
|
285 mRequest->send(); |
238 } |
286 } |
239 |
287 |
240 void testPbkServices::launchSmsFilteredFetch() |
288 void testPbkServices::launchSmsFilteredFetch() |
241 { |
289 { |
242 |
290 if (mRequest) |
243 if (mSndFetch) |
291 { |
244 { |
292 delete mRequest; |
245 delete mSndFetch; |
293 mRequest=0; |
246 mSndFetch=0; |
294 } |
247 } |
295 |
248 |
296 QVariantList args; |
249 //XQServiceRequest snd("com.nokia.services.hbserviceprovider.Dialer","dial(QString)",true); |
297 QString serviceName("com.nokia.services.phonebookservices"); |
250 mSndFetch = new XQServiceRequest("com.nokia.services.phonebookservices.Fetch", "fetch(QString,QString,QString)",false); |
298 QString operation("fetch(QString,QString,QString)"); |
251 connect(mSndFetch, SIGNAL(requestCompleted(QVariant)), this, SLOT(onRequestCompleted(QVariant))); |
299 XQApplicationManager appMng; |
252 |
300 mRequest = appMng.create(serviceName, "Fetch", operation, true); // embedded |
253 *mSndFetch << "Filtered multi-fetch"; |
301 |
254 *mSndFetch << KCntActionSms; |
302 // Result handlers |
255 *mSndFetch << KCntFilterDisplayAll; |
303 connect (mRequest, SIGNAL(requestOk(const QVariant&)), this, SLOT(onRequestCompleted(const QVariant&))); |
256 |
304 |
257 QVariant retValue; |
305 args << "Filtered multi-fetch"; |
258 bool res=mSndFetch->send(retValue); |
306 args << KCntActionSms; |
|
307 args << KCntFilterDisplayAll; |
|
308 |
|
309 mRequest->setArguments(args); |
|
310 mRequest->send(); |
259 } |
311 } |
260 |
312 |
261 void testPbkServices::launchEmailFilteredFetch() |
313 void testPbkServices::launchEmailFilteredFetch() |
262 { |
314 { |
263 |
315 if (mRequest) |
264 if (mSndFetch) |
316 { |
265 { |
317 delete mRequest; |
266 delete mSndFetch; |
318 mRequest=0; |
267 mSndFetch=0; |
319 } |
268 } |
320 |
269 mSndFetch = new XQServiceRequest("com.nokia.services.phonebookservices.Fetch", "fetch(QString,QString,QString)",false); |
321 QVariantList args; |
270 connect(mSndFetch, SIGNAL(requestCompleted(QVariant)), this, SLOT(onRequestCompleted(QVariant))); |
322 QString serviceName("com.nokia.services.phonebookservices"); |
271 |
323 QString operation("fetch(QString,QString,QString)"); |
272 *mSndFetch << "Filtered multi-fetch"; |
324 XQApplicationManager appMng; |
273 *mSndFetch << KCntActionEmail; |
325 mRequest = appMng.create(serviceName, "Fetch", operation, true); // embedded |
274 *mSndFetch << KCntFilterDisplayAll; |
326 |
275 |
327 // Result handlers |
276 QVariant retValue; |
328 connect (mRequest, SIGNAL(requestOk(const QVariant&)), this, SLOT(onRequestCompleted(const QVariant&))); |
277 bool res=mSndFetch->send(retValue); |
329 |
|
330 args << "Filtered multi-fetch"; |
|
331 args << KCntActionEmail; |
|
332 args << KCntFilterDisplayAll; |
|
333 |
|
334 mRequest->setArguments(args); |
|
335 mRequest->send(); |
278 } |
336 } |
279 |
337 |
280 |
338 |
281 |
339 |
282 void testPbkServices::onRequestCompleted(const QVariant& value) |
340 void testPbkServices::onRequestCompleted(const QVariant& value) |