21 static const double Margin = 2 * Un; |
21 static const double Margin = 2 * Un; |
22 static const int MaxRows = 10000; |
22 static const int MaxRows = 10000; |
23 static const double LabelFieldWidth = 10 * Un + Un; |
23 static const double LabelFieldWidth = 10 * Un + Un; |
24 static const double ButtonWidth = 9.5 * Un; |
24 static const double ButtonWidth = 9.5 * Un; |
25 static const double FieldHeight = 5 * Un; |
25 static const double FieldHeight = 5 * Un; |
|
26 static const char *ContactsServiceName = "com.nokia.services.phonebookservices"; |
|
27 static const char *ContactsInterfaceName = "Fetch"; |
|
28 static const char *ContactsOperationName = "fetch(QString,QString,QString)"; |
26 |
29 |
27 /*! |
30 /*! |
28 Constructor |
31 Constructor |
29 */ |
32 */ |
30 NmRecipientField::NmRecipientField( |
33 NmRecipientField::NmRecipientField( |
35 HbWidget(parent), |
38 HbWidget(parent), |
36 mLabel(label), |
39 mLabel(label), |
37 mRecipientsEditor(edit), |
40 mRecipientsEditor(edit), |
38 mLaunchContactsPickerButton(button), |
41 mLaunchContactsPickerButton(button), |
39 mOwned(false) |
42 mOwned(false) |
40 #ifdef Q_OS_SYMBIAN |
|
41 ,mLaunchContactsPickerRequest(NULL) |
|
42 #endif |
|
43 { |
43 { |
44 mLaunchContactsPickerButton->setIcon(NmIcons::getIcon(NmIcons::NmIconContacts)); |
44 mLaunchContactsPickerButton->setIcon(NmIcons::getIcon(NmIcons::NmIconContacts)); |
45 createConnections(); |
45 createConnections(); |
46 } |
46 } |
47 |
47 |
54 HbWidget(parent), |
54 HbWidget(parent), |
55 mLabel(NULL), |
55 mLabel(NULL), |
56 mRecipientsEditor(NULL), |
56 mRecipientsEditor(NULL), |
57 mLaunchContactsPickerButton(NULL), |
57 mLaunchContactsPickerButton(NULL), |
58 mOwned(true) |
58 mOwned(true) |
59 #ifdef Q_OS_SYMBIAN |
|
60 ,mLaunchContactsPickerRequest(NULL) |
|
61 #endif |
|
62 { |
59 { |
63 mLayoutHorizontal = new QGraphicsLinearLayout(Qt::Horizontal, this); |
60 mLayoutHorizontal = new QGraphicsLinearLayout(Qt::Horizontal, this); |
64 |
61 |
65 mLabel = new HbLabel(labelString); |
62 mLabel = new HbLabel(labelString); |
66 if (mLabel) { |
63 if (mLabel) { |
189 /*! |
179 /*! |
190 This Slot launches the contacts-picker |
180 This Slot launches the contacts-picker |
191 */ |
181 */ |
192 void NmRecipientField::launchContactsPicker() |
182 void NmRecipientField::launchContactsPicker() |
193 { |
183 { |
194 if (mLaunchContactsPickerRequest) { |
184 XQApplicationManager mAppmgr; |
195 delete mLaunchContactsPickerRequest; |
185 XQAiwRequest *launchContactsPickerRequest; |
196 mLaunchContactsPickerRequest = 0; |
186 |
197 } |
187 bool isEmbeded = true; |
198 |
188 launchContactsPickerRequest = mAppmgr.create(ContactsServiceName, ContactsInterfaceName, |
199 mLaunchContactsPickerRequest = new XQServiceRequest |
189 ContactsOperationName, isEmbeded); |
200 ("com.nokia.services.phonebookservices.Fetch", |
190 |
201 "fetch(QString,QString,QString)", false); |
191 if (launchContactsPickerRequest) { |
202 connect(mLaunchContactsPickerRequest, SIGNAL(requestCompleted(QVariant)), |
192 connect(launchContactsPickerRequest, SIGNAL(requestOk(QVariant)), |
203 mRecipientsEditor, SLOT(insertSelectedContacts(QVariant))); |
193 mRecipientsEditor, SLOT(insertSelectedContacts(QVariant))); |
204 |
194 } |
205 // "Contacts" will be replaced by a hbTrId when it is ready |
195 else { |
206 *mLaunchContactsPickerRequest << tr("Contacts"); |
196 // Failed creating request |
207 *mLaunchContactsPickerRequest << KCntActionAll; |
197 NMLOG("XQApplicationManager: failed creating fecth contactspicker request."); |
208 *mLaunchContactsPickerRequest << KCntActionAll; |
198 return; |
209 |
199 } |
210 QVariant returnValue; |
200 |
211 mLaunchContactsPickerRequest->send(returnValue); |
201 // Send request |
|
202 if (!launchContactsPickerRequest->send()) { |
|
203 //Failed sending request |
|
204 NMLOG("XQApplicationManager: failed sending request."); |
|
205 } |
|
206 |
|
207 delete launchContactsPickerRequest; |
|
208 launchContactsPickerRequest = 0; |
212 } |
209 } |
213 #endif |
210 #endif |