author | hgs |
Thu, 05 Aug 2010 14:31:09 +0300 | |
changeset 54 | 47627ab5d7a4 |
parent 50 | 77bc263e1626 |
child 61 | d30183af6ca6 |
permissions | -rw-r--r-- |
24
0ba2181d7c28
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1 |
/* |
0ba2181d7c28
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
0ba2181d7c28
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
3 |
* All rights reserved. |
0ba2181d7c28
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
0ba2181d7c28
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
5 |
* under the terms of "Eclipse Public License v1.0" |
0ba2181d7c28
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
0ba2181d7c28
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
0ba2181d7c28
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
8 |
* |
0ba2181d7c28
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
9 |
* Initial Contributors: |
0ba2181d7c28
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
10 |
* Nokia Corporation - initial contribution. |
0ba2181d7c28
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
11 |
* |
0ba2181d7c28
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
12 |
* Contributors: |
0ba2181d7c28
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
13 |
* |
0ba2181d7c28
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
14 |
* Description: |
0ba2181d7c28
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
15 |
* |
0ba2181d7c28
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
16 |
*/ |
0ba2181d7c28
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
17 |
|
0ba2181d7c28
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
18 |
#include "cntservicecontactfetchview.h" |
0ba2181d7c28
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
19 |
|
27
de1630741fbe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
20 |
#include <cntservicescontact.h> |
40
b46a585f6909
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
21 |
#include <cntlistmodel.h> |
50 | 22 |
#include "cntserviceviewparams.h" |
24
0ba2181d7c28
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
23 |
|
0ba2181d7c28
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
24 |
#include <hbmenu.h> |
27
de1630741fbe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
25 |
#include <hbview.h> |
de1630741fbe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
26 |
#include <hblistview.h> |
de1630741fbe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
27 |
#include <hbdocumentloader.h> |
de1630741fbe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
28 |
#include <hbaction.h> |
54 | 29 |
#include "cntactionpopup.h" |
24
0ba2181d7c28
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
30 |
|
27
de1630741fbe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
31 |
#include <QCoreApplication> |
de1630741fbe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
32 |
|
50 | 33 |
CntServiceContactFetchView::CntServiceContactFetchView( CntAbstractServiceProvider& aServiceProvider ): |
27
de1630741fbe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
34 |
CntBaseSelectionView(), |
50 | 35 |
mProvider( aServiceProvider ) |
36 |
{ |
|
27
de1630741fbe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
37 |
HbAction* cancel = static_cast<HbAction*>( mDocument->findObject( "cnt:cancel" ) ); |
de1630741fbe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
38 |
mView->menu()->addAction( cancel ); |
de1630741fbe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
39 |
connect(cancel, SIGNAL(triggered()), this, SLOT(cancelFetch()) ); |
50 | 40 |
connect( this, SIGNAL(viewClosed()), this, SLOT(closeFetchView()) ); |
46
efe85016a067
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
40
diff
changeset
|
41 |
connect( this, SIGNAL(viewOpened(CntAbstractViewManager*, const CntViewParameters)), this, SLOT(aboutToOpenView(CntAbstractViewManager*, const CntViewParameters)) ); |
24
0ba2181d7c28
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
42 |
} |
0ba2181d7c28
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
43 |
|
0ba2181d7c28
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
44 |
CntServiceContactFetchView::~CntServiceContactFetchView() |
0ba2181d7c28
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
45 |
{ |
0ba2181d7c28
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
46 |
} |
0ba2181d7c28
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
47 |
|
0ba2181d7c28
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
48 |
|
0ba2181d7c28
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
49 |
void CntServiceContactFetchView::cancelFetch() |
50 | 50 |
{ |
24
0ba2181d7c28
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
51 |
CntServicesContactList serviceList; |
50 | 52 |
QVariant variant; |
53 |
variant.setValue(serviceList); |
|
54 |
mProvider.CompleteServiceAndCloseApp(variant); |
|
55 |
} |
|
24
0ba2181d7c28
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
56 |
|
50 | 57 |
|
58 |
||
59 |
void CntServiceContactFetchView::closeFetchView() |
|
24
0ba2181d7c28
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
60 |
{ |
27
de1630741fbe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
61 |
QContactManager* mgr = mMgr->contactManager(SYMBIAN_BACKEND); |
de1630741fbe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
62 |
QModelIndexList temp = mListView->selectionModel()->selection().indexes(); |
54 | 63 |
mIndex = 0; |
24
0ba2181d7c28
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
64 |
for(int i = 0; i < temp.count(); i++ ) |
0ba2181d7c28
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
65 |
{ |
27
de1630741fbe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
66 |
QContact contact = mListModel->contact(temp.at(i)); |
54 | 67 |
if (mAction == KCntActionCall) |
68 |
{ |
|
69 |
serviceCallMessageAction(contact, KCntActionCall); |
|
70 |
} |
|
71 |
else if (mAction == KCntActionSms ) |
|
24
0ba2181d7c28
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
72 |
{ |
54 | 73 |
serviceCallMessageAction(contact, "message"); |
74 |
} |
|
75 |
else if (mAction == KCntActionEmail) |
|
76 |
{ |
|
77 |
serviceEmailAction(contact); |
|
24
0ba2181d7c28
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
78 |
} |
0ba2181d7c28
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
79 |
else |
0ba2181d7c28
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
80 |
{ |
54 | 81 |
serviceAllAction(contact); |
24
0ba2181d7c28
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
82 |
} |
54 | 83 |
} |
84 |
showPreviousView(); |
|
85 |
} |
|
86 |
||
87 |
void CntServiceContactFetchView::serviceCallMessageAction(QContact& aContact, QString aAction) |
|
88 |
{ |
|
89 |
CntServicesContact servicesContact; |
|
90 |
//get the phonenumber |
|
91 |
QList<QContactPhoneNumber> phonenumbers = aContact.details<QContactPhoneNumber>(); |
|
92 |
||
93 |
Q_ASSERT_X( phonenumbers.count() > 0, "serviceCallMessageAction", "Number count is zero"); |
|
94 |
||
95 |
QContactDetail detail = aContact.preferredDetail(aAction); |
|
96 |
if (!detail.isEmpty()) |
|
97 |
{ |
|
98 |
//Set preferred detail for services |
|
99 |
QContactPhoneNumber number = detail; |
|
100 |
servicesContact.mDisplayName = aContact.displayLabel(); |
|
101 |
servicesContact.mPhoneNumber = number.number(); |
|
102 |
servicesContact.mEmailAddress = ""; |
|
103 |
servicesContact.mContactId = aContact.localId(); |
|
104 |
mServiceList.append(servicesContact); |
|
105 |
} |
|
106 |
else |
|
107 |
{ |
|
108 |
// show popup for call numbers |
|
109 |
CntActionPopup *actionPopup = new CntActionPopup(&aContact); |
|
110 |
bool popup = actionPopup->showActionPopup(aAction); |
|
111 |
if(popup) |
|
112 |
{ |
|
113 |
//if call numbers are present wait for signals |
|
114 |
mIndex++; |
|
115 |
connect( actionPopup, SIGNAL(executeContactAction(QContact&,QContactDetail, QString)), this, |
|
116 |
SLOT(popupContactAction(QContact&, QContactDetail, QString))); |
|
117 |
connect( actionPopup, SIGNAL(actionPopupCancelPressed()), this, |
|
118 |
SLOT(actionPopupCancelSlot())); |
|
119 |
} |
|
120 |
else |
|
121 |
{ |
|
122 |
//else delete popup if no call number present |
|
123 |
delete actionPopup; |
|
124 |
} |
|
125 |
} |
|
126 |
} |
|
24
0ba2181d7c28
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
127 |
|
54 | 128 |
void CntServiceContactFetchView::serviceEmailAction(QContact& aContact) |
129 |
{ |
|
130 |
CntServicesContact servicesContact; |
|
131 |
//get the email address |
|
132 |
QList<QContactEmailAddress> emailAddresses = aContact.details<QContactEmailAddress>(); |
|
133 |
||
134 |
Q_ASSERT_X( emailAddresses.count() > 0, "serviceEmailAction", "email address count is zero"); |
|
135 |
||
136 |
QContactDetail detail = aContact.preferredDetail("email"); |
|
137 |
if (!detail.isEmpty()) |
|
138 |
{ |
|
139 |
//Set preferred detail for services |
|
140 |
QContactEmailAddress email = detail; |
|
141 |
servicesContact.mDisplayName = aContact.displayLabel(); |
|
142 |
servicesContact.mPhoneNumber = ""; |
|
143 |
servicesContact.mEmailAddress = email.emailAddress(); |
|
144 |
servicesContact.mContactId = aContact.localId(); |
|
145 |
mServiceList.append(servicesContact); |
|
146 |
||
147 |
} |
|
148 |
else |
|
149 |
{ |
|
150 |
// show popup for email id's |
|
151 |
CntActionPopup *actionPopup = new CntActionPopup(&aContact); |
|
152 |
bool popup = actionPopup->showActionPopup("email"); |
|
153 |
if(popup) |
|
154 |
{ |
|
155 |
//if email id's are present wait for signals |
|
156 |
mIndex++; |
|
157 |
connect( actionPopup, SIGNAL(executeContactAction(QContact&,QContactDetail, QString)), this, |
|
158 |
SLOT(popupContactAction(QContact&, QContactDetail, QString))); |
|
159 |
connect( actionPopup, SIGNAL(actionPopupCancelPressed()), this, |
|
160 |
SLOT(actionPopupCancelSlot())); |
|
161 |
} |
|
162 |
else |
|
163 |
{ |
|
164 |
//else delete popup if no email present |
|
165 |
delete actionPopup; |
|
166 |
} |
|
167 |
} |
|
168 |
} |
|
169 |
||
170 |
void CntServiceContactFetchView::serviceAllAction(QContact& aContact) |
|
171 |
{ |
|
172 |
CntServicesContact servicesContact; |
|
173 |
servicesContact.mDisplayName = aContact.displayLabel(); |
|
174 |
QContactDetail callDetail = aContact.preferredDetail("call"); |
|
175 |
//Check for preferredDetail from call |
|
176 |
// if not present check for preferredDetail for message |
|
177 |
// if not present pick first phone number |
|
178 |
if (!callDetail.isEmpty()) |
|
179 |
{ |
|
180 |
QContactPhoneNumber number = callDetail; |
|
181 |
servicesContact.mPhoneNumber = number.number(); |
|
182 |
} |
|
183 |
else |
|
184 |
{ |
|
185 |
QContactDetail smsDetail = aContact.preferredDetail("message"); |
|
186 |
if (!callDetail.isEmpty()) |
|
187 |
{ |
|
188 |
QContactPhoneNumber number = smsDetail; |
|
189 |
servicesContact.mPhoneNumber = number.number(); |
|
190 |
} |
|
191 |
else |
|
192 |
{ |
|
193 |
QList<QContactPhoneNumber> phonenumbers = aContact.details<QContactPhoneNumber>(); |
|
194 |
if(phonenumbers.count() > 0) |
|
195 |
{ |
|
196 |
servicesContact.mPhoneNumber = phonenumbers.first().number(); |
|
197 |
} |
|
198 |
else |
|
199 |
{ |
|
200 |
servicesContact.mPhoneNumber = ""; |
|
201 |
} |
|
202 |
} |
|
203 |
} |
|
204 |
||
205 |
QContactDetail emailDetail = aContact.preferredDetail("email"); |
|
206 |
if (!emailDetail.isEmpty()) |
|
207 |
{ |
|
208 |
QContactEmailAddress email = emailDetail; |
|
209 |
servicesContact.mEmailAddress = email.emailAddress(); |
|
210 |
} |
|
211 |
else |
|
212 |
{ |
|
24
0ba2181d7c28
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
213 |
//get first email address |
54 | 214 |
QList<QContactEmailAddress> emailAddresses = aContact.details<QContactEmailAddress>(); |
24
0ba2181d7c28
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
215 |
if(emailAddresses.count() > 0) |
0ba2181d7c28
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
216 |
{ |
0ba2181d7c28
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
217 |
servicesContact.mEmailAddress = emailAddresses.first().emailAddress(); |
0ba2181d7c28
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
218 |
} |
54 | 219 |
else |
220 |
{ |
|
221 |
servicesContact.mEmailAddress = ""; |
|
222 |
} |
|
24
0ba2181d7c28
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
223 |
} |
54 | 224 |
servicesContact.mContactId = aContact.localId(); |
225 |
mServiceList.append(servicesContact); |
|
24
0ba2181d7c28
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
226 |
} |
0ba2181d7c28
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
227 |
|
46
efe85016a067
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
40
diff
changeset
|
228 |
void CntServiceContactFetchView::aboutToOpenView(CntAbstractViewManager* aMgr, const CntViewParameters aArgs) |
25
76a2435edfd4
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
229 |
{ |
46
efe85016a067
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
40
diff
changeset
|
230 |
mMgr = aMgr; |
efe85016a067
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
40
diff
changeset
|
231 |
|
25
76a2435edfd4
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
232 |
// Set title of the view. |
50 | 233 |
QString title = aArgs.value(KCntServiceViewParamTitle).toString(); |
27
de1630741fbe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
234 |
mView->setTitle(title); |
25
76a2435edfd4
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
235 |
|
27
de1630741fbe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
236 |
// Set action filter |
54 | 237 |
mAction = aArgs.value(ESelectedAction).toString(); |
50 | 238 |
// ESelectedAction is defined in cntviewparams.h |
239 |
||
240 |
// Has never been implemented. |
|
241 |
//QString filterStr = aArgs.value(KCntServiceViewParamFilter).toString(); |
|
242 |
// KCntServiceViewParamFilter is defined in cntserviceviewparams.h |
|
243 |
||
54 | 244 |
if (mAction == KCntActionSms) |
27
de1630741fbe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
245 |
{ |
de1630741fbe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
246 |
QContactActionFilter actionFilter; |
de1630741fbe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
247 |
actionFilter.setActionName("message"); |
46
efe85016a067
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
40
diff
changeset
|
248 |
mListModel->setFilter(actionFilter); |
27
de1630741fbe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
249 |
} |
54 | 250 |
else if (mAction == KCntActionCall) |
27
de1630741fbe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
251 |
{ |
de1630741fbe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
252 |
QContactActionFilter actionFilter; |
de1630741fbe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
253 |
actionFilter.setActionName("call"); |
46
efe85016a067
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
40
diff
changeset
|
254 |
mListModel->setFilter(actionFilter); |
27
de1630741fbe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
255 |
} |
54 | 256 |
else if (mAction == KCntActionEmail) |
27
de1630741fbe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
257 |
{ |
de1630741fbe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
258 |
QContactActionFilter actionFilter; |
de1630741fbe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
259 |
actionFilter.setActionName("email"); |
46
efe85016a067
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
40
diff
changeset
|
260 |
mListModel->setFilter(actionFilter); |
27
de1630741fbe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
261 |
} |
de1630741fbe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
262 |
else |
de1630741fbe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
263 |
{ |
de1630741fbe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
264 |
QContactDetailFilter filter; |
de1630741fbe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
265 |
filter.setDetailDefinitionName(QContactType::DefinitionName, QContactType::FieldType); |
de1630741fbe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
266 |
QString typeContact = QContactType::TypeContact; |
de1630741fbe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
267 |
filter.setValue(typeContact); |
46
efe85016a067
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
40
diff
changeset
|
268 |
mListModel->setFilter(filter); |
27
de1630741fbe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
269 |
} |
24
0ba2181d7c28
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
270 |
|
27
de1630741fbe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
271 |
// hide my card if it's not set |
de1630741fbe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
272 |
if ( mListModel->myCardId() == 0 ) |
de1630741fbe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
273 |
{ |
de1630741fbe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
274 |
mListModel->showMyCard( false ); |
de1630741fbe
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
25
diff
changeset
|
275 |
} |
24
0ba2181d7c28
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
276 |
} |
0ba2181d7c28
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
277 |
|
54 | 278 |
void CntServiceContactFetchView::popupContactAction(QContact& aContact,QContactDetail contactDetail, QString aAction) |
279 |
{ |
|
280 |
if (aAction.compare("call", Qt::CaseInsensitive) == 0 |
|
281 |
|| aAction.compare("message", Qt::CaseInsensitive) == 0 ) |
|
282 |
{ |
|
283 |
CntServicesContact servicesContact; |
|
284 |
QContactPhoneNumber number = static_cast<QContactPhoneNumber>(contactDetail); |
|
285 |
QString name = aContact.displayLabel(); |
|
286 |
servicesContact.mDisplayName = aContact.displayLabel(); |
|
287 |
servicesContact.mPhoneNumber = number.number(); |
|
288 |
servicesContact.mEmailAddress = ""; |
|
289 |
servicesContact.mContactId = aContact.localId(); |
|
290 |
mServiceList.append(servicesContact); |
|
291 |
mIndex--; |
|
292 |
} |
|
293 |
else if (aAction.compare("email", Qt::CaseInsensitive) == 0 ) |
|
294 |
{ |
|
295 |
CntServicesContact servicesContact; |
|
296 |
QContactEmailAddress email = static_cast<QContactEmailAddress>(contactDetail); |
|
297 |
servicesContact.mDisplayName = aContact.displayLabel(); |
|
298 |
servicesContact.mPhoneNumber = ""; |
|
299 |
servicesContact.mEmailAddress = email.emailAddress(); |
|
300 |
servicesContact.mContactId = aContact.localId(); |
|
301 |
mServiceList.append(servicesContact); |
|
302 |
mIndex--; |
|
303 |
} |
|
304 |
||
305 |
if (aContact.preferredDetail(aAction).isEmpty() && (aAction == "call" || aAction == "message" || aAction == "email")) |
|
306 |
{ |
|
307 |
aContact.setPreferredDetail(aAction, contactDetail); |
|
308 |
//return value will be ignored because we cannot do anything if it fails. |
|
309 |
mMgr->contactManager(SYMBIAN_BACKEND)->saveContact(&aContact); |
|
310 |
} |
|
311 |
||
312 |
showPreviousView(); |
|
313 |
} |
|
314 |
||
315 |
void CntServiceContactFetchView::actionPopupCancelSlot() |
|
316 |
{ |
|
317 |
mIndex--; |
|
318 |
showPreviousView(); |
|
319 |
} |
|
320 |
||
321 |
void CntServiceContactFetchView::showPreviousView() |
|
322 |
{ |
|
323 |
if(mIndex==0) |
|
324 |
{ |
|
325 |
QVariant variant; |
|
326 |
variant.setValue(mServiceList); |
|
327 |
mProvider.CompleteServiceAndCloseApp(variant); |
|
328 |
||
329 |
CntViewParameters args; |
|
330 |
mMgr->back( args ); |
|
331 |
} |
|
332 |
} |
|
24
0ba2181d7c28
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
333 |
// EOF |