author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 13 Oct 2010 14:15:33 +0300 | |
branch | RCL_3 |
changeset 85 | 38bb213f60ba |
parent 68 | 9da50d567e3c |
permissions | -rw-r--r-- |
63 | 1 |
/* |
2 |
* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 |
* All rights reserved. |
|
4 |
* This component and the accompanying materials are made available |
|
5 |
* under the terms of "Eclipse Public License v1.0" |
|
6 |
* which accompanies this distribution, and is available |
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 |
* |
|
9 |
* Initial Contributors: |
|
10 |
* Nokia Corporation - initial contribution. |
|
11 |
* |
|
12 |
* Contributors: |
|
13 |
* |
|
14 |
* Description: Phonebook 2 Names List UI extension plug-in. |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
// INCLUDE FILES |
|
20 |
#include "Pbk2NamesListExtensionPlugin.h" |
|
21 |
#include "Pbk2NamesListEx.hrh" |
|
22 |
#include "Pbk2NamesListExView.h" |
|
23 |
||
24 |
#include "CPbk2NameslistUiControlExtension.h" |
|
25 |
#include "CPbk2NlxOpenCcaCmd.h" |
|
26 |
#include "CPbk2NlxAddToTopContactsCmd.h" |
|
27 |
#include "CPbk2NlxRemoveFromTopContactsCmd.h" |
|
28 |
#include "CPbk2NlxMoveTopContactsCmd.h" |
|
29 |
#include "Pbk2NlxMenuFiltering.h" |
|
30 |
#include "cpbk2deletemycardcmd.h" |
|
31 |
#include "cpbk2mycard.h" |
|
32 |
||
33 |
#include "cpbk2openmycardcmd.h" |
|
34 |
#include "CVPbkContactManager.h" |
|
35 |
#include <spbcontentprovider.h> |
|
36 |
||
37 |
// Phonebook 2 |
|
38 |
#include <MPbk2AppUi.h> |
|
39 |
#include <MPbk2ApplicationServices.h> |
|
40 |
#include <MPbk2ApplicationServices2.h> |
|
41 |
#include <CPbk2StoreConfiguration.h> |
|
42 |
#include <TVPbkContactStoreUriPtr.h> |
|
43 |
#include <CPbk2ApplicationServices.h> |
|
44 |
#include <Phonebook2PrivateCRKeys.h> |
|
45 |
||
46 |
#include <MPbk2ContactUiControl.h> |
|
47 |
#include <MPbk2ViewExplorer.h> |
|
48 |
#include <CPbk2ViewState.h> |
|
49 |
||
50 |
#include <MPbk2ContactUiControlExtension.h> |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
51 |
#include <Pbk2Commands.rsg> |
63 | 52 |
#include <MVPbkBaseContact.h> |
53 |
#include <MVPbkBaseContactFieldCollection.h> |
|
54 |
#include <MVPbkBaseContactField.h> |
|
55 |
#include <MVPbkFieldType.h> |
|
56 |
#include <MVPbkContactFieldData.h> |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
57 |
#include <VPbkEng.rsg> |
63 | 58 |
#include <CVPbkTopContactManager.h> |
59 |
#include <VPbkContactStoreUris.h> |
|
60 |
#include <CVPbkContactStoreUriArray.h> |
|
61 |
#include <MPbk2ContactUiControl2.h> |
|
62 |
#include <MVPbkContactStore.h> |
|
63 |
#include <MVPbkContactStoreList.h> |
|
64 |
#include <MVPbkContactStoreInfo.h> |
|
65 |
#include <MVPbkContactStoreProperties.h> |
|
66 |
||
67 |
// Debugging headers |
|
68 |
||
69 |
#include <Pbk2Debug.h> |
|
70 |
#include <Pbk2Profile.h> |
|
71 |
||
72 |
//CCA |
|
73 |
#include <mccaconnection.h> |
|
74 |
#include <mccaparameter.h> |
|
75 |
#include <ccafactory.h> |
|
76 |
||
77 |
// System includes |
|
78 |
#include <coemain.h> |
|
79 |
#include <eikmenub.h> |
|
80 |
#include <AiwCommon.hrh> |
|
81 |
#include <avkon.hrh> |
|
82 |
#include <avkon.rsg> |
|
83 |
#include <centralrepository.h> |
|
84 |
||
85 |
/// Unnamed namespace for local definitions |
|
86 |
namespace { |
|
87 |
const TInt KMinNumOfContactsToMerge = 2; // minimum number of contacts to merge |
|
88 |
} /// namespace |
|
89 |
||
90 |
// -------------------------------------------------------------------------- |
|
91 |
// CNamesListUIExtensionPlugin::CNamesListUIExtensionPlugin |
|
92 |
// -------------------------------------------------------------------------- |
|
93 |
// |
|
94 |
CNamesListUIExtensionPlugin::CNamesListUIExtensionPlugin() |
|
95 |
{ |
|
96 |
} |
|
97 |
||
98 |
// -------------------------------------------------------------------------- |
|
99 |
// CNamesListUIExtensionPlugin::~CNamesListUIExtensionPlugin |
|
100 |
// -------------------------------------------------------------------------- |
|
101 |
// |
|
102 |
CNamesListUIExtensionPlugin::~CNamesListUIExtensionPlugin() |
|
103 |
{ |
|
104 |
if ( iCCAConnection ) |
|
105 |
{ |
|
106 |
iCCAConnection->Close(); |
|
107 |
} |
|
108 |
delete iContentProvider; |
|
109 |
if ( iLocalStore ) |
|
110 |
{ |
|
111 |
iLocalStore->Close( *this ); |
|
112 |
} |
|
113 |
if ( iAdnStore ) |
|
114 |
{ |
|
115 |
iAdnStore->Close( *this ); |
|
116 |
} |
|
117 |
Release( iAppServices ); |
|
118 |
} |
|
119 |
||
120 |
||
121 |
||
122 |
// -------------------------------------------------------------------------- |
|
123 |
// CNamesListUIExtensionPlugin::NewL |
|
124 |
// -------------------------------------------------------------------------- |
|
125 |
// |
|
126 |
CNamesListUIExtensionPlugin* CNamesListUIExtensionPlugin::NewL() |
|
127 |
{ |
|
128 |
CNamesListUIExtensionPlugin* self = |
|
129 |
new ( ELeave ) CNamesListUIExtensionPlugin(); |
|
130 |
CleanupStack::PushL( self ); |
|
131 |
self->ConstructL(); |
|
132 |
CleanupStack::Pop( self ); |
|
133 |
return self; |
|
134 |
} |
|
135 |
||
136 |
// -------------------------------------------------------------------------- |
|
137 |
// CNamesListUIExtensionPlugin::ConstructL |
|
138 |
// -------------------------------------------------------------------------- |
|
139 |
// |
|
140 |
void CNamesListUIExtensionPlugin::ConstructL() |
|
141 |
{ |
|
142 |
iLocalStoreContactsCount = 0; |
|
143 |
iAppServices = CPbk2ApplicationServices::InstanceL(); |
|
144 |
} |
|
145 |
||
146 |
// -------------------------------------------------------------------------- |
|
147 |
// CNamesListUIExtensionPlugin::ContentProviderL |
|
148 |
// -------------------------------------------------------------------------- |
|
149 |
// |
|
150 |
inline CSpbContentProvider& CNamesListUIExtensionPlugin::ContentProviderL() |
|
151 |
{ |
|
152 |
if( !iContentProvider ) |
|
153 |
{ |
|
154 |
TAny* ext = iAppServices->MPbk2ApplicationServicesExtension( |
|
155 |
KMPbk2ApplicationServicesExtension2Uid ); |
|
156 |
if( !ext ) |
|
157 |
{ |
|
158 |
User::Leave( KErrNotReady ); |
|
159 |
} |
|
160 |
// Check status message variation |
|
161 |
TInt showStatusInNamesList = 0; |
|
162 |
CRepository* cenrep = |
|
163 |
CRepository::NewLC( TUid::Uid( KCRUidPhonebook ) ); |
|
164 |
User::LeaveIfError( |
|
165 |
cenrep->Get( KPhonebookStatusMessageVisibility, |
|
166 |
showStatusInNamesList ) ); |
|
167 |
CleanupStack::PopAndDestroy( cenrep ); |
|
168 |
||
169 |
// By default status is not shown in names list |
|
170 |
TInt32 spbContentFlags = CSpbContentProvider::EPhoneNumber; |
|
171 |
||
172 |
if( showStatusInNamesList ) |
|
173 |
{ |
|
174 |
spbContentFlags = (CSpbContentProvider::EStatusMessage | |
|
175 |
CSpbContentProvider::EPhoneNumber); |
|
176 |
} |
|
177 |
||
178 |
CPbk2StoreManager& storeManager = |
|
179 |
static_cast<MPbk2ApplicationServices2*>(ext)->StoreManager(); |
|
180 |
iContentProvider = CSpbContentProvider::NewL( |
|
181 |
iAppServices->ContactManager(), storeManager, spbContentFlags ); |
|
182 |
} |
|
183 |
return *iContentProvider; |
|
184 |
} |
|
185 |
||
186 |
||
187 |
// -------------------------------------------------------------------------- |
|
188 |
// CNamesListUIExtensionPlugin::CreateExtensionViewL |
|
189 |
// -------------------------------------------------------------------------- |
|
190 |
// |
|
191 |
MPbk2UIExtensionView* CNamesListUIExtensionPlugin::CreateExtensionViewL |
|
192 |
( TUid aViewId, CPbk2UIExtensionView& aView ) |
|
193 |
{ |
|
194 |
MPbk2UIExtensionView* result = NULL; |
|
195 |
if ( aViewId == TUid::Uid( EPbk2NamesListViewId ) ) |
|
196 |
{ |
|
197 |
iNamesListExViewRef = CPbk2NamesListExView::NewL( |
|
198 |
aView, ContentProviderL(), iCCAConnection ); |
|
199 |
result = iNamesListExViewRef; //ownership not taken |
|
200 |
} |
|
201 |
||
202 |
return result; |
|
203 |
} |
|
204 |
||
205 |
// -------------------------------------------------------------------------- |
|
206 |
// CNamesListUIExtensionPlugin::DynInitMenuPaneL |
|
207 |
// -------------------------------------------------------------------------- |
|
208 |
// |
|
209 |
void CNamesListUIExtensionPlugin::DynInitMenuPaneL(TInt aResourceId, |
|
210 |
CEikMenuPane* aMenuPane, MPbk2ContactUiControl& aControl ) |
|
211 |
{ |
|
212 |
//This is called before CPbk2CommandHandler::PerformStandardMenuFilteringL |
|
213 |
//so do not remove anything here that may be removed there. |
|
214 |
||
215 |
switch ( aResourceId ) |
|
216 |
{ |
|
217 |
case R_PHONEBOOK2_OPEN_CCA: |
|
218 |
{ |
|
219 |
if ( !Pbk2NlxMenuFiltering::OpenReady( aControl ) ) |
|
220 |
{ |
|
221 |
DimItem( aMenuPane, EPbk2CmdOpenCca ); |
|
222 |
} |
|
223 |
break; |
|
224 |
} |
|
225 |
case R_PHONEBOOK2_SELECT_ADDFAVORITES: |
|
226 |
{ |
|
227 |
if ( !Pbk2NlxMenuFiltering::AddToFavoritesCmdSelected( aControl ) || |
|
228 |
aControl.ContactsMarked() ) |
|
229 |
{ |
|
230 |
DimItem( aMenuPane, EPbk2CmdAddFavourites ); |
|
231 |
} |
|
232 |
break; |
|
233 |
} |
|
234 |
case R_PHONEBOOK2_SELECT_MYCARD: |
|
235 |
{ |
|
236 |
if ( !Pbk2NlxMenuFiltering::MyCardCmdSelected( aControl ) || |
|
237 |
aControl.ContactsMarked() ) |
|
238 |
{ |
|
239 |
DimItem( aMenuPane, EPbk2CmdOpenMyCard ); |
|
240 |
DimItem( aMenuPane, EPbk2CmdSelectMyCard ); |
|
241 |
} |
|
242 |
else |
|
243 |
{ |
|
244 |
if( MyCardLink() ) |
|
245 |
{ |
|
246 |
// MyCard exists -> show "open" |
|
247 |
DimItem( aMenuPane, EPbk2CmdSelectMyCard ); |
|
248 |
} |
|
249 |
else |
|
250 |
{ |
|
251 |
// MyCard not created -> show "select" |
|
252 |
DimItem( aMenuPane, EPbk2CmdOpenMyCard ); |
|
253 |
} |
|
254 |
} |
|
255 |
break; |
|
256 |
} |
|
257 |
case R_PHONEBOOK2_RCL_MENU: |
|
258 |
{ |
|
259 |
if ( aControl.ContactsMarked() || |
|
260 |
!(iNamesListExViewRef && iNamesListExViewRef->IsRclOnL())) |
|
261 |
{ |
|
262 |
DimItem( aMenuPane, EPbk2CmdRcl ); |
|
263 |
} |
|
264 |
break; |
|
265 |
} |
|
266 |
case R_PHONEBOOK2_SELECT_RCL: |
|
267 |
{ |
|
268 |
//Promotion item (RclCmdSelectOptSelected) may only be visible if rcl feature is on |
|
269 |
if ( !Pbk2NlxMenuFiltering::RclCmdSelectOptSelected( aControl ) || |
|
270 |
aControl.ContactsMarked() ) |
|
271 |
{ |
|
272 |
DimItem( aMenuPane, EPbk2CmdSelectRclCmdItem ); |
|
273 |
} |
|
274 |
break; |
|
275 |
} |
|
276 |
case R_PHONEBOOK2_ADD_TO_TOPCONTACTS: |
|
277 |
{ |
|
278 |
TBool dimAdd = EFalse; |
|
279 |
if ( aControl.ContactsMarked() ) |
|
280 |
{ |
|
281 |
// multiple top assign/reassign doesn't work yet, enable when ready |
|
282 |
#if 0 |
|
283 |
dimAdd = !Pbk2NlxMenuFiltering::NonTopContactMarkedL( aControl ); |
|
284 |
#else |
|
285 |
dimAdd = ETrue; |
|
286 |
#endif |
|
287 |
} |
|
288 |
else |
|
289 |
{ |
|
290 |
dimAdd = !Pbk2NlxMenuFiltering::TopReadyL( aControl ); |
|
291 |
} |
|
292 |
if ( dimAdd ) |
|
293 |
{ |
|
294 |
DimItem( aMenuPane, EPbk2CmdAddToTopContacts ); |
|
295 |
} |
|
296 |
||
297 |
break; |
|
298 |
} |
|
299 |
case R_PHONEBOOK2_REMOVE_FROM_TOPCONTACTS: |
|
300 |
{ |
|
301 |
TBool dimRemove = EFalse; |
|
302 |
if ( aControl.ContactsMarked() ) |
|
303 |
{ |
|
304 |
// multiple top assign/reassign doesn't work yet, enable when ready |
|
305 |
#if 0 |
|
306 |
dimRemove = !Pbk2NlxMenuFiltering::TopContactMarkedL( aControl ); |
|
307 |
#else |
|
308 |
dimRemove = ETrue; |
|
309 |
#endif |
|
310 |
} |
|
311 |
else |
|
312 |
{ |
|
313 |
dimRemove = !Pbk2NlxMenuFiltering::TopContactSelectedL( aControl ); |
|
314 |
} |
|
315 |
if ( dimRemove ) |
|
316 |
{ |
|
317 |
DimItem( aMenuPane, EPbk2CmdRemoveFromTopContacts ); |
|
318 |
} |
|
319 |
break; |
|
320 |
} |
|
321 |
case R_PHONEBOOK2_NAMELIST_CALL_CONTACT_MENU: |
|
322 |
{ |
|
323 |
if ( Pbk2NlxMenuFiltering::AddToFavoritesCmdSelected( aControl ) ) |
|
324 |
{ |
|
325 |
DimItem( aMenuPane, EPbk2CmdCall ); |
|
326 |
} |
|
327 |
if ( Pbk2NlxMenuFiltering::MyCardCmdSelected( aControl ) ) |
|
328 |
{ |
|
329 |
DimItem( aMenuPane, EPbk2CmdCall ); |
|
330 |
} |
|
331 |
break; |
|
332 |
} |
|
333 |
case R_PHONEBOOK2_NAMELIST_CREATE_MESSAGE_MENU: |
|
334 |
{ |
|
335 |
if ( !aControl.ContactsMarked() ) |
|
336 |
{ |
|
337 |
if ( Pbk2NlxMenuFiltering::AddToFavoritesCmdSelected( aControl ) ) |
|
338 |
{ |
|
339 |
DimItem( aMenuPane, EPbk2CmdWriteNoQuery ); |
|
340 |
} |
|
341 |
if ( Pbk2NlxMenuFiltering::MyCardCmdSelected( aControl ) ) |
|
342 |
{ |
|
343 |
DimItem( aMenuPane, EPbk2CmdWriteNoQuery ); |
|
344 |
} |
|
345 |
} |
|
346 |
break; |
|
347 |
} |
|
348 |
case R_PHONEBOOK2_NAMESLIST_SEND_URL_MENU: |
|
349 |
{ |
|
350 |
if ( Pbk2NlxMenuFiltering::AddToFavoritesCmdSelected( aControl ) ) |
|
351 |
{ |
|
352 |
DimItem( aMenuPane, EPbk2CmdSend ); |
|
353 |
} |
|
354 |
// if mycard is not created and is selected |
|
355 |
if( !MyCardLink() && Pbk2NlxMenuFiltering::MyCardCmdSelected( aControl ) ) |
|
356 |
{ |
|
357 |
DimItem( aMenuPane, EPbk2CmdSend ); |
|
358 |
} |
|
359 |
break; |
|
360 |
} |
|
361 |
||
362 |
#if 0 |
|
363 |
case R_PHONEBOOK2_NAMESLIST_EDIT_MENU: |
|
364 |
{ |
|
365 |
if ( aControl.ContactsMarked() || |
|
366 |
aControl.NumberOfContacts() == 0 || |
|
367 |
addFavouritesSelected ) |
|
368 |
{ |
|
369 |
DimItem( aMenuPane, EPbk2CmdEditMe ); |
|
370 |
} |
|
371 |
break; |
|
372 |
} |
|
373 |
#endif |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
374 |
case R_AVKON_MENUPANE_MARKABLE_LIST_IMPLEMENTATION: |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
375 |
{ |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
376 |
|
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
377 |
if ( Pbk2NlxMenuFiltering::AddToFavoritesCmdSelected( aControl ) ) |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
378 |
{ |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
379 |
DimItem( aMenuPane, EAknCmdMark ); |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
380 |
} |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
381 |
if ( Pbk2NlxMenuFiltering::MyCardCmdSelected( aControl ) ) |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
382 |
{ |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
383 |
DimItem( aMenuPane, EAknCmdMark ); |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
384 |
} |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
385 |
break; |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
386 |
} |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
387 |
case R_PHONEBOOK2_MARKABLE_LIST_CONTEXT_MENU: |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
388 |
{ |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
389 |
if ( Pbk2NlxMenuFiltering::AddToFavoritesCmdSelected( aControl ) ) |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
390 |
{ |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
391 |
DimItem( aMenuPane, EAknCmdMark ); |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
392 |
DimItem( aMenuPane, EAknCmdUnmark ); |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
393 |
} |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
394 |
if ( Pbk2NlxMenuFiltering::MyCardCmdSelected( aControl ) ) |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
395 |
{ |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
396 |
DimItem( aMenuPane, EAknCmdMark ); |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
397 |
DimItem( aMenuPane, EAknCmdUnmark ); |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
398 |
} |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
399 |
break; |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
400 |
} |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
401 |
case R_AVKON_MENUPANE_MARKABLE_LIST: |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
402 |
{ |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
403 |
if ( !aControl.NumberOfContacts() ) |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
404 |
{ |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
405 |
DimItem( aMenuPane, EAknCmdEditListMenu ); |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
406 |
} |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
407 |
break; |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
68
diff
changeset
|
408 |
} |
63 | 409 |
case R_PHONEBOOK2_NAMESLIST_COPY_MENU: |
410 |
{ |
|
411 |
MPbk2ContactUiControl2* tempControl = |
|
412 |
reinterpret_cast<MPbk2ContactUiControl2*> |
|
413 |
(aControl.ContactUiControlExtension( |
|
414 |
KMPbk2ContactUiControlExtension2Uid )); |
|
415 |
||
416 |
if ( tempControl->FocusedCommandItem() && |
|
417 |
!aControl.ContactsMarked() ) |
|
418 |
{ |
|
419 |
DimItem( aMenuPane, EPbk2CmdCopy ); |
|
420 |
} |
|
421 |
break; |
|
422 |
} |
|
423 |
case R_PHONEBOOK2_NAMESLIST_DELETE_MENU: |
|
424 |
{ |
|
425 |
// show delete mycard if mycard command is focused / tapped and |
|
426 |
// mycard is available and there aren't any marked contacts. |
|
427 |
if( !Pbk2NlxMenuFiltering::MyCardCmdSelected( aControl ) || |
|
428 |
!MyCardLink() || |
|
429 |
aControl.ContactsMarked() ) |
|
430 |
{ |
|
431 |
DimItem( aMenuPane, EPbk2CmdDeleteMyCard ); |
|
432 |
} |
|
433 |
break; |
|
434 |
} |
|
435 |
case R_PHONEBOOK2_MERGE_CONTACTS: |
|
436 |
{ |
|
437 |
TInt numberOfContacts = 0; |
|
438 |
MVPbkContactLink* mylink = MyCardLink(); |
|
439 |
numberOfContacts = iLocalStoreContactsCount - ( mylink ? 1 : 0 ); |
|
440 |
||
441 |
// there must be two contacts to do merge |
|
442 |
if ( numberOfContacts < KMinNumOfContactsToMerge ) |
|
443 |
{ |
|
444 |
aMenuPane->SetItemDimmed( EPbk2CmdMergeContacts, ETrue ); |
|
445 |
} |
|
446 |
break; |
|
447 |
} |
|
448 |
default: |
|
449 |
{ |
|
450 |
break; |
|
451 |
} |
|
452 |
} |
|
453 |
} |
|
454 |
||
455 |
// -------------------------------------------------------------------------- |
|
456 |
// CNamesListUIExtensionPlugin::DimItem |
|
457 |
// -------------------------------------------------------------------------- |
|
458 |
// |
|
459 |
void CNamesListUIExtensionPlugin::DimItem( CEikMenuPane* aMenuPane, TInt aCmd ) |
|
460 |
{ |
|
461 |
TInt p; |
|
462 |
||
463 |
if ( aMenuPane->MenuItemExists( aCmd, p ) ) |
|
464 |
{ |
|
465 |
aMenuPane->SetItemDimmed( aCmd, ETrue ); |
|
466 |
} |
|
467 |
} |
|
468 |
||
469 |
// -------------------------------------------------------------------------- |
|
470 |
// CNamesListUIExtensionPlugin::IsTopContact |
|
471 |
// -------------------------------------------------------------------------- |
|
472 |
// |
|
473 |
inline TBool CNamesListUIExtensionPlugin::IsTopContact( |
|
474 |
const MVPbkBaseContact* aContact ) |
|
475 |
{ |
|
476 |
TBool topContact( EFalse ); |
|
477 |
||
478 |
if( aContact ) |
|
479 |
{ |
|
480 |
topContact = CVPbkTopContactManager::IsTopContact( *aContact ); |
|
481 |
} |
|
482 |
||
483 |
return topContact; |
|
484 |
} |
|
485 |
||
486 |
// -------------------------------------------------------------------------- |
|
487 |
// CNamesListUIExtensionPlugin::MyCardLink |
|
488 |
// -------------------------------------------------------------------------- |
|
489 |
// |
|
490 |
inline MVPbkContactLink* CNamesListUIExtensionPlugin::MyCardLink() const |
|
491 |
{ |
|
492 |
MVPbkContactLink* result = NULL; |
|
493 |
if( iNamesListExViewRef ) |
|
494 |
{ |
|
495 |
const CPbk2MyCard* mycard = iNamesListExViewRef->MyCard(); |
|
496 |
if( mycard ) |
|
497 |
{ |
|
498 |
result = mycard->MyCardLink(); |
|
499 |
} |
|
500 |
} |
|
501 |
return result; |
|
502 |
} |
|
503 |
||
504 |
// -------------------------------------------------------------------------- |
|
505 |
// CNamesListUIExtensionPlugin::UpdateStorePropertiesL |
|
506 |
// -------------------------------------------------------------------------- |
|
507 |
// |
|
508 |
void CNamesListUIExtensionPlugin::UpdateStorePropertiesL |
|
509 |
( CPbk2StorePropertyArray& /*aPropertyArray*/ ) |
|
510 |
{ |
|
511 |
// Do nothing |
|
512 |
} |
|
513 |
||
514 |
// -------------------------------------------------------------------------- |
|
515 |
// CNamesListUIExtensionPlugin::CreatePbk2ContactEditorExtensionL |
|
516 |
// -------------------------------------------------------------------------- |
|
517 |
// |
|
518 |
MPbk2ContactEditorExtension* |
|
519 |
CNamesListUIExtensionPlugin::CreatePbk2ContactEditorExtensionL |
|
520 |
( CVPbkContactManager& /*aContactManager*/, |
|
521 |
CPbk2PresentationContact& /*aContact*/, |
|
522 |
MPbk2ContactEditorControl& /*aEditorControl*/ ) |
|
523 |
{ |
|
524 |
// Do nothing |
|
525 |
return NULL; |
|
526 |
} |
|
527 |
||
528 |
// -------------------------------------------------------------------------- |
|
529 |
// CNamesListUIExtensionPlugin::CreatePbk2UiControlExtensionL |
|
530 |
// -------------------------------------------------------------------------- |
|
531 |
// |
|
532 |
MPbk2ContactUiControlExtension* |
|
533 |
CNamesListUIExtensionPlugin::CreatePbk2UiControlExtensionL |
|
534 |
( CVPbkContactManager& aContactManager ) |
|
535 |
{ |
|
536 |
CPbk2MyCard* mycard = NULL; |
|
537 |
if( iNamesListExViewRef ) |
|
538 |
{ |
|
539 |
mycard = iNamesListExViewRef->MyCard(); |
|
540 |
} |
|
541 |
InitLocalStoreObserverL(); |
|
542 |
InitAdnStoreObserverL(); |
|
543 |
||
544 |
MPbk2ContactUiControlExtension* extension = |
|
545 |
CPbk2NameslistUiControlExtension::NewL( aContactManager, ContentProviderL(), mycard ); |
|
546 |
return extension; |
|
547 |
} |
|
548 |
||
549 |
// -------------------------------------------------------------------------- |
|
550 |
// CNamesListUIExtensionPlugin::CreatePbk2SettingsViewExtensionL |
|
551 |
// -------------------------------------------------------------------------- |
|
552 |
// |
|
553 |
MPbk2SettingsViewExtension* |
|
554 |
CNamesListUIExtensionPlugin::CreatePbk2SettingsViewExtensionL() |
|
555 |
{ |
|
556 |
// Do nothing |
|
557 |
return NULL; |
|
558 |
} |
|
559 |
||
560 |
// -------------------------------------------------------------------------- |
|
561 |
// CNamesListUIExtensionPlugin::CreatePbk2AppUiExtensionL |
|
562 |
// -------------------------------------------------------------------------- |
|
563 |
// |
|
564 |
MPbk2AppUiExtension* CNamesListUIExtensionPlugin::CreatePbk2AppUiExtensionL |
|
565 |
( CVPbkContactManager& /*aContactManager*/ ) |
|
566 |
{ |
|
567 |
// Do nothing |
|
568 |
return NULL; |
|
569 |
} |
|
570 |
||
571 |
// -------------------------------------------------------------------------- |
|
572 |
// CNamesListUIExtensionPlugin::CreatePbk2CommandForIdL |
|
573 |
// -------------------------------------------------------------------------- |
|
574 |
// |
|
575 |
MPbk2Command* CNamesListUIExtensionPlugin::CreatePbk2CommandForIdL |
|
576 |
( TInt aCommandId, MPbk2ContactUiControl& aUiControl ) const |
|
577 |
{ |
|
578 |
MPbk2Command* result = NULL; |
|
579 |
||
580 |
switch( aCommandId ) |
|
581 |
{ |
|
582 |
case EPbk2CmdOpenCca: |
|
583 |
{ |
|
584 |
result = CPbk2NlxOpenCcaCmd::NewL( |
|
585 |
aUiControl, |
|
586 |
const_cast<MCCAConnection*&>( iCCAConnection ) ); |
|
587 |
break; |
|
588 |
} |
|
589 |
||
590 |
case EPbk2CmdAddToTopContacts: |
|
591 |
{ |
|
592 |
// Give the ETrue argument for aAddFavourites = EFalse. |
|
593 |
result = CPbk2NlxAddToTopContactsCmd::NewL( aUiControl, EFalse ); |
|
594 |
break; |
|
595 |
} |
|
596 |
case EPbk2CmdAddFavourites: |
|
597 |
{ |
|
598 |
// Give the ETrue argument for aAddFavourites = ETrue. |
|
599 |
result = CPbk2NlxAddToTopContactsCmd::NewL( aUiControl, ETrue ); |
|
600 |
break; |
|
601 |
} |
|
602 |
case EPbk2CmdRemoveFromTopContacts: |
|
603 |
{ |
|
604 |
result = CPbk2NlxRemoveFromTopContactsCmd::NewL( aUiControl ); |
|
605 |
break; |
|
606 |
} |
|
607 |
case EPbk2CmdMoveInTopContactsList: |
|
608 |
{ |
|
609 |
result = CPbk2NlxMoveTopContactsCmd::NewL( aUiControl ); |
|
610 |
break; |
|
611 |
} |
|
612 |
case EPbk2CmdOpenMyCard: // fallthrough |
|
613 |
case EPbk2CmdSelectMyCard: |
|
614 |
{ |
|
615 |
result = CPbk2OpenMyCardCmd::NewL( |
|
616 |
const_cast<MCCAConnection*&>( iCCAConnection ), |
|
617 |
iNamesListExViewRef ? iNamesListExViewRef->MyCard() : NULL, |
|
618 |
&aUiControl ); |
|
619 |
break; |
|
620 |
} |
|
621 |
case EPbk2CmdDeleteMyCard: |
|
622 |
{ |
|
623 |
MVPbkContactLink* mylink = MyCardLink(); |
|
624 |
if( mylink ) |
|
625 |
{ |
|
626 |
result = CPbk2DeleteMyCardCmd::NewL( aUiControl, *mylink ); |
|
627 |
} |
|
628 |
break; |
|
629 |
} |
|
630 |
default: |
|
631 |
break; |
|
632 |
} |
|
633 |
||
634 |
return result; |
|
635 |
} |
|
636 |
||
637 |
// -------------------------------------------------------------------------- |
|
638 |
// CNamesListUIExtensionPlugin::CreatePbk2AiwInterestForIdL |
|
639 |
// -------------------------------------------------------------------------- |
|
640 |
// |
|
641 |
MPbk2AiwInterestItem* CNamesListUIExtensionPlugin::CreatePbk2AiwInterestForIdL |
|
642 |
( TInt /*aInterestId*/, |
|
643 |
CAiwServiceHandler& /*aServiceHandler*/ ) const |
|
644 |
{ |
|
645 |
// Do nothing |
|
646 |
return NULL; |
|
647 |
} |
|
648 |
||
649 |
// -------------------------------------------------------------------------- |
|
650 |
// CNamesListUIExtensionPlugin::GetHelpContextL |
|
651 |
// -------------------------------------------------------------------------- |
|
652 |
// |
|
653 |
TBool CNamesListUIExtensionPlugin::GetHelpContextL |
|
654 |
( TCoeHelpContext& /*aContext*/, const CPbk2AppViewBase& /*aView*/, |
|
655 |
MPbk2ContactUiControl& /*aUiControl*/ ) |
|
656 |
{ |
|
657 |
return EFalse; |
|
658 |
} |
|
659 |
||
660 |
// -------------------------------------------------------------------------- |
|
661 |
// CNamesListUIExtensionPlugin::ApplyDynamicViewGraphChangesL |
|
662 |
// -------------------------------------------------------------------------- |
|
663 |
// |
|
664 |
void CNamesListUIExtensionPlugin::ApplyDynamicViewGraphChangesL( |
|
665 |
CPbk2ViewGraph& /*aViewGraph*/) |
|
666 |
{ |
|
667 |
// Do nothing |
|
668 |
} |
|
669 |
||
670 |
// -------------------------------------------------------------------------- |
|
671 |
// CNamesListUIExtensionPlugin::CmdOpenGroupL |
|
672 |
// -------------------------------------------------------------------------- |
|
673 |
// |
|
674 |
void CNamesListUIExtensionPlugin::CmdOpenGroupL |
|
675 |
( MPbk2ContactUiControl& /*aUiControl*/ ) const |
|
676 |
{ |
|
677 |
// Do nothing |
|
678 |
} |
|
679 |
// -------------------------------------------------------------------------- |
|
680 |
// CNamesListUIExtensionPlugin::ApplyDynamicPluginInformationDataL |
|
681 |
// |
|
682 |
// Allows extensions to add plugin information dynamically |
|
683 |
// during the application initialisation. |
|
684 |
// |
|
685 |
// The UI extension's start-up policy must be KPbk2LoadInStartup. |
|
686 |
// -------------------------------------------------------------------------- |
|
687 |
// |
|
688 |
void CNamesListUIExtensionPlugin::ApplyDynamicPluginInformationDataL( |
|
689 |
CPbk2UIExtensionInformation& /* aUiExtensionInformation */ ) |
|
690 |
{ |
|
691 |
// Do nothing |
|
692 |
} |
|
693 |
||
694 |
MPbk2ContactEditorExtension* CNamesListUIExtensionPlugin::CreatePbk2ContactEditorExtensionL( |
|
695 |
CVPbkContactManager& /*aContactManager*/, |
|
696 |
MVPbkStoreContact& /*aContact*/, |
|
697 |
MPbk2ContactEditorControl& /*aEditorControl*/ ) |
|
698 |
{ |
|
699 |
return NULL; |
|
700 |
} |
|
701 |
||
702 |
MPbk2SettingsViewExtension* CNamesListUIExtensionPlugin::CreatePbk2SettingsViewExtensionL( |
|
703 |
CVPbkContactManager& /*aContactManager*/ ) |
|
704 |
{ |
|
705 |
return NULL; |
|
706 |
} |
|
707 |
MPbk2AiwInterestItem* CNamesListUIExtensionPlugin::CreatePbk2AiwInterestForIdL( |
|
708 |
TInt /*aInterestId*/, |
|
709 |
CAiwServiceHandler& /*aServiceHandler*/ ) |
|
710 |
{ |
|
711 |
return NULL; |
|
712 |
} |
|
713 |
||
714 |
TAny* CNamesListUIExtensionPlugin::UIExtensionPluginExtension( TUid aExtensionUid ) |
|
715 |
{ |
|
716 |
TAny* ret = NULL; |
|
717 |
if (aExtensionUid == ImplementationUid()) |
|
718 |
{ |
|
719 |
ret = static_cast<MPbk2PluginCommandListerner*>( this ); |
|
720 |
} |
|
721 |
return ret; |
|
722 |
} |
|
723 |
||
724 |
void CNamesListUIExtensionPlugin::HandlePbk2Command( TInt aCommand ) |
|
725 |
{ |
|
726 |
switch( aCommand ) |
|
727 |
{ |
|
728 |
// If Pbk2 goes to the backgound, child applications are closed |
|
729 |
case EAknCmdHideInBackground: |
|
730 |
{ |
|
731 |
// Close CCA if it is open |
|
732 |
if ( iCCAConnection ) |
|
733 |
{ |
|
734 |
iCCAConnection->Close(); |
|
735 |
iCCAConnection = NULL; |
|
736 |
} |
|
737 |
} |
|
738 |
break; |
|
739 |
||
740 |
default: |
|
741 |
break; |
|
742 |
} |
|
743 |
} |
|
744 |
// -------------------------------------------------------------------------- |
|
745 |
// CNamesListUIExtensionPlugin::StoreReady |
|
746 |
// -------------------------------------------------------------------------- |
|
747 |
// |
|
748 |
void CNamesListUIExtensionPlugin::StoreReady( MVPbkContactStore& aContactStore ) |
|
749 |
{ |
|
750 |
if ( !aContactStore.StoreProperties().Uri().UriDes().Compare |
|
751 |
( VPbkContactStoreUris::DefaultCntDbUri() ) ) |
|
752 |
{ |
|
753 |
TRAP_IGNORE( |
|
754 |
iLocalStoreContactsCount = iLocalStore->StoreInfo().NumberOfContactsL(); |
|
755 |
); |
|
756 |
} |
|
757 |
} |
|
758 |
||
759 |
// -------------------------------------------------------------------------- |
|
760 |
// CNamesListUIExtensionPlugin::StoreUnavailable |
|
761 |
// -------------------------------------------------------------------------- |
|
762 |
// |
|
763 |
void CNamesListUIExtensionPlugin::StoreUnavailable |
|
764 |
( MVPbkContactStore& aContactStore, TInt /*aReason*/ ) |
|
765 |
{ |
|
766 |
if( iContentProvider ) |
|
767 |
{ |
|
768 |
// when store unavailable, its cached content is to be deleted |
|
769 |
iContentProvider->CleanContentL( aContactStore ); |
|
770 |
} |
|
771 |
} |
|
772 |
||
773 |
// -------------------------------------------------------------------------- |
|
774 |
// CNamesListUIExtensionPlugin::HandleStoreEventL |
|
775 |
// -------------------------------------------------------------------------- |
|
776 |
// |
|
777 |
void CNamesListUIExtensionPlugin::HandleStoreEventL( |
|
778 |
MVPbkContactStore& aContactStore, |
|
779 |
TVPbkContactStoreEvent aStoreEvent ) |
|
780 |
{ |
|
781 |
if ( !aContactStore.StoreProperties().Uri().UriDes().Compare |
|
782 |
( VPbkContactStoreUris::DefaultCntDbUri() ) ) |
|
783 |
{ |
|
784 |
switch ( aStoreEvent.iEventType ) |
|
785 |
{ |
|
786 |
case TVPbkContactStoreEvent::EContactAdded: |
|
787 |
{ |
|
788 |
iLocalStoreContactsCount++; |
|
789 |
break; |
|
790 |
} |
|
791 |
||
792 |
case TVPbkContactStoreEvent::EContactDeleted: |
|
793 |
{ |
|
794 |
iLocalStoreContactsCount--; |
|
795 |
break; |
|
796 |
} |
|
797 |
default: |
|
798 |
break; |
|
799 |
} |
|
800 |
} |
|
801 |
} |
|
802 |
// -------------------------------------------------------------------------- |
|
803 |
// CNamesListUIExtensionPlugin::InitLocalStoreObserverL |
|
804 |
// -------------------------------------------------------------------------- |
|
805 |
// |
|
806 |
void CNamesListUIExtensionPlugin::InitLocalStoreObserverL() |
|
807 |
{ |
|
808 |
if ( !iLocalStore ) |
|
809 |
{ |
|
810 |
MVPbkContactStoreList& storeList = iAppServices->ContactManager().ContactStoresL(); |
|
811 |
iLocalStore = storeList.Find( VPbkContactStoreUris::DefaultCntDbUri() ); |
|
812 |
if ( iLocalStore ) |
|
813 |
{ |
|
814 |
iLocalStore->OpenL( *this ); |
|
815 |
} |
|
816 |
} |
|
817 |
} |
|
818 |
||
819 |
// -------------------------------------------------------------------------- |
|
820 |
// CNamesListUIExtensionPlugin::InitAdnStoreObserverL |
|
821 |
// -------------------------------------------------------------------------- |
|
822 |
// |
|
823 |
void CNamesListUIExtensionPlugin::InitAdnStoreObserverL() |
|
824 |
{ |
|
825 |
if ( !iAdnStore ) |
|
826 |
{ |
|
827 |
MVPbkContactStoreList& storeList = iAppServices->ContactManager().ContactStoresL(); |
|
828 |
iAdnStore = storeList.Find( VPbkContactStoreUris::SimGlobalAdnUri() ); |
|
829 |
if ( iAdnStore ) |
|
830 |
{ |
|
831 |
iAdnStore->OpenL( *this ); |
|
832 |
} |
|
833 |
} |
|
834 |
} |
|
835 |
// End of File |