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 74 | 6b5524b4f673 |
permissions | -rw-r--r-- |
63 | 1 |
/* |
2 |
* Copyright (c) 2009 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 extension view. |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
// INCLUDE FILES |
|
20 |
#include "Pbk2NamesListExView.h" |
|
21 |
#include "CPbk2CmdItemAddTop.h" |
|
22 |
#include "CPbk2CmdItemRemoteContactLookup.h" |
|
23 |
#include <cpbk2remotecontactlookupaccounts.h> |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
24 |
#include <Pbk2ExNamesListRes.rsg> |
63 | 25 |
#include "Pbk2NlxMenuFiltering.h" |
26 |
#include "cpbk2cmditemmycard.h" |
|
27 |
#include "cpbk2mycard.h" |
|
28 |
#include "Pbk2NamesListEx.hrh" |
|
29 |
#include "cpbk2contextlaunch.h" |
|
30 |
||
31 |
#include <spbcontentprovider.h> |
|
32 |
||
33 |
// Phonebook 2 |
|
34 |
#include <CPbk2UIExtensionView.h> |
|
35 |
#include <MPbk2AppUi.h> |
|
36 |
#include <MPbk2ViewExplorer.h> |
|
37 |
#include "CPbk2ViewState.h" |
|
38 |
#include <MPbk2StartupMonitor.h> |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
39 |
#include <Phonebook2.rsg> |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
40 |
#include <Pbk2Commands.rsg> |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
41 |
#include <Pbk2UIControls.rsg> |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
42 |
#include <Pbk2CommonUi.rsg> |
63 | 43 |
#include <CPbk2ControlContainer.h> |
44 |
#include <CPbk2NamesListControl.h> |
|
45 |
#include <MPbk2CommandHandler.h> |
|
46 |
#include <Pbk2Commands.hrh> |
|
47 |
#include <MPbk2ViewActivationTransaction.h> |
|
48 |
#include <CPbk2ViewStateTransformer.h> |
|
49 |
#include <csxhelp/phob.hlp.hrh> |
|
50 |
#include <Pbk2UID.h> |
|
51 |
#include <MPbk2PointerEventInspector.h> |
|
52 |
#include <Phonebook2PrivateCRKeys.h> |
|
53 |
#include <CPbk2IconFactory.h> |
|
54 |
#include <TPbk2IconId.h> |
|
55 |
#include <CPbk2IconInfoContainer.h> |
|
56 |
#include <MPbk2ApplicationServices.h> |
|
57 |
#include <MPbk2ContactViewSupplier.h> |
|
58 |
#include <CPbk2StoreConfiguration.h> |
|
59 |
#include <Pbk2IconId.hrh> |
|
60 |
#include "Pbk2ContactUiControlProxy.h" |
|
61 |
#include <MPbk2UiControlCmdItem.h> |
|
62 |
#include <pbk2mapcommands.hrh> |
|
63 |
#include "Pbk2InternalCommands.hrh" |
|
64 |
#include "CPbk2ContactViewListBox.h" |
|
65 |
#include <pbk2doublelistboxcmditemextension.h> |
|
66 |
||
67 |
#include "CVPbkContactManager.h" |
|
68 |
#include "MVPbkContactStoreList.h" |
|
69 |
#include "VPbkContactStoreUris.h" |
|
70 |
#include "TVPbkContactStoreUriPtr.h" |
|
71 |
||
72 |
//Cca |
|
73 |
#ifdef RD_PBK2_USE_CCA |
|
74 |
#include <MVPbkBaseContact.h> |
|
75 |
#include <mccaparameter.h> |
|
76 |
#include <mccaconnection.h> |
|
77 |
#include <ccafactory.h> |
|
78 |
// #include <ccaerrors.h> |
|
79 |
#endif |
|
80 |
#include <ccafactory.h> |
|
81 |
#include <mccaconnection.h> |
|
82 |
||
83 |
// System includes |
|
84 |
#include <StringLoader.h> |
|
85 |
#include <centralrepository.h> |
|
86 |
#include <AiwCommon.hrh> |
|
87 |
#include <eikbtgpc.h> |
|
88 |
#include <avkon.rsg> |
|
89 |
#include <eikmenub.h> |
|
90 |
#include <AknUtils.h> |
|
91 |
#include <akntoolbar.h> |
|
92 |
#include <akntouchpane.h> |
|
93 |
#include <gulicon.h> |
|
94 |
#include <AknsUtils.h> |
|
95 |
#include <aknbutton.h> |
|
96 |
#include <eikcolib.h> |
|
97 |
#include <eiklbx.h> |
|
98 |
#include <touchfeedback.h> |
|
99 |
#include <aknstyluspopupmenu.h> |
|
100 |
#include <Pbk2Config.hrh> |
|
101 |
#include <layoutmetadata.cdl.h> |
|
102 |
#include <featmgr.h> |
|
103 |
#include <ecom.h> |
|
104 |
||
105 |
// Debugging headers |
|
106 |
#include <Pbk2Debug.h> |
|
107 |
#include <Pbk2Profile.h> |
|
108 |
||
109 |
//Phone memory checking |
|
110 |
#include <CPbk2ApplicationServices.h> |
|
111 |
#include <CVPbkContactStoreUriArray.h> |
|
112 |
#include <CPbk2StoreConfiguration.h> |
|
113 |
#include <VPbkContactStoreUris.h> |
|
114 |
#include <TVPbkContactStoreUriPtr.h> |
|
115 |
#include <Pbk2InternalUID.h> |
|
116 |
||
117 |
/// Unnamed namespace for local definitions |
|
118 |
namespace { |
|
119 |
||
120 |
#ifdef _DEBUG |
|
121 |
enum TPanicCode |
|
122 |
{ |
|
123 |
EPanicPreCond_ConstructL = 1, |
|
124 |
EPanicPostCond_ConstructL, |
|
125 |
EPanicPostCond_DoActivateL, |
|
126 |
EPanicPreCond_HandleCommandL, |
|
127 |
EPanicLogic_DoTransformLegacyViewStateToPbk2ViewStateLC |
|
128 |
}; |
|
129 |
||
130 |
void Panic(TPanicCode aReason) |
|
131 |
{ |
|
132 |
_LIT( KPanicText, "CPbk2NamesListExView" ); |
|
133 |
User::Panic( KPanicText, aReason ); |
|
134 |
} |
|
135 |
#endif // _DEBUG |
|
136 |
||
137 |
||
138 |
/** |
|
139 |
* Returns ETrue if shift is depressed in aKeyEvent. |
|
140 |
* |
|
141 |
* @param aKeyEvent Key event. |
|
142 |
* @return ETrue if shift is down. |
|
143 |
*/ |
|
144 |
inline TBool ShiftDown |
|
145 |
( const TKeyEvent& aKeyEvent ) |
|
146 |
{ |
|
147 |
return ( aKeyEvent.iModifiers & |
|
148 |
( EModifierShift | EModifierLeftShift | EModifierRightShift ) ) != 0; |
|
149 |
} |
|
150 |
||
151 |
/** |
|
152 |
* Returns ETrue if either Shift or Control key is depressed. |
|
153 |
* |
|
154 |
* @param aKeyEvent Key event. |
|
155 |
* @return ETrue if shift or control is down. |
|
156 |
*/ |
|
157 |
inline TBool IsShiftOrControlDown( const TKeyEvent& aKeyEvent ) |
|
158 |
{ |
|
159 |
return ( aKeyEvent.iModifiers & |
|
160 |
( EModifierShift | EModifierLeftShift | EModifierRightShift | |
|
161 |
EModifierCtrl | EModifierLeftCtrl | EModifierRightCtrl ) ) != 0; |
|
162 |
} |
|
163 |
||
164 |
/** |
|
165 |
* Creates a toolbar button with a skinnable icon |
|
166 |
* |
|
167 |
* @param aIconFactory Icon factory that must contain the toolbar |
|
168 |
* button icon. |
|
169 |
* @param aPbk2IconId Id for Phonebook2 icon for all button states. |
|
170 |
* @return CAknButton instance. |
|
171 |
*/ |
|
172 |
CAknButton* CreateToolbarButtonLC |
|
173 |
( CPbk2IconFactory& aIconFactory, TInt aPbk2IconId, TInt aHelpTextResId ) |
|
174 |
{ |
|
175 |
TPbk2IconId iconId( TUid::Uid(KPbk2UID3), aPbk2IconId ); |
|
176 |
CGulIcon* icon = aIconFactory.CreateIconLC( iconId ); |
|
177 |
||
178 |
HBufC* helpText = CCoeEnv::Static()->AllocReadResourceLC( aHelpTextResId ); |
|
179 |
||
180 |
CAknButton* button = CAknButton::NewL( icon, NULL, NULL, NULL, |
|
181 |
KNullDesC, *helpText, KAknButtonSizeFitText, 0 ); |
|
182 |
||
183 |
CleanupStack::PopAndDestroy();//helpText |
|
184 |
||
185 |
CleanupStack::Pop( icon ); |
|
186 |
CleanupStack::PushL( button ); |
|
187 |
return button; |
|
188 |
} |
|
189 |
||
190 |
} /// namespace |
|
191 |
||
192 |
// -------------------------------------------------------------------------- |
|
193 |
// CPbk2NamesListExView::CPbk2NamesListExView |
|
194 |
// -------------------------------------------------------------------------- |
|
195 |
// |
|
196 |
CPbk2NamesListExView::CPbk2NamesListExView |
|
197 |
( CPbk2UIExtensionView& aView, |
|
198 |
CSpbContentProvider& aStatusProvider, |
|
199 |
MCCAConnection*& aCCAConnection ) : |
|
200 |
iView( aView ), |
|
201 |
iCommandState( ETrue ), |
|
202 |
iCurrentCommandId( KErrNotFound ), |
|
203 |
iCtrlVisibleStateBeforeLosingForground( ETrue ), |
|
204 |
iFirstTimeActivated( ETrue ), |
|
205 |
iContentProvider( aStatusProvider ), |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
206 |
iCCAConnection( aCCAConnection ) |
63 | 207 |
{ |
208 |
} |
|
209 |
||
210 |
// -------------------------------------------------------------------------- |
|
211 |
// CPbk2NamesListAppView::~CPbk2NamesListAppView |
|
212 |
// -------------------------------------------------------------------------- |
|
213 |
// |
|
214 |
CPbk2NamesListExView::~CPbk2NamesListExView() |
|
215 |
{ |
|
216 |
PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING |
|
217 |
("CPbk2NamesListExView(%x)::~CPbk2NamesListExView()"), this); |
|
218 |
||
219 |
if ( iStoreConfiguration ) |
|
220 |
{ |
|
221 |
iStoreConfiguration->RemoveObserver( *this ); |
|
222 |
} |
|
223 |
||
224 |
delete iControlState; |
|
225 |
delete iIdleToolbarWarden; |
|
226 |
delete iToolbarIcons; |
|
227 |
if ( iToolbar ) |
|
228 |
{ |
|
229 |
iToolbar->SetToolbarObserver( NULL ); |
|
230 |
} |
|
231 |
||
232 |
if (iContainer) |
|
233 |
{ |
|
234 |
iContainer->RemoveForegroundObserver(); |
|
235 |
CCoeEnv::Static()->AppUi()->RemoveFromStack(iContainer); |
|
236 |
delete iContainer; |
|
237 |
} |
|
238 |
||
239 |
delete iIdleTexter; |
|
240 |
delete iControlProxy; |
|
241 |
||
242 |
delete iMyCard; |
|
243 |
CCoeEnv::Static()->RemoveForegroundObserver( *this ); |
|
244 |
||
245 |
delete iContextLauncher; |
|
246 |
FeatureManager::UnInitializeLib(); |
|
247 |
} |
|
248 |
||
249 |
// -------------------------------------------------------------------------- |
|
250 |
// CPbk2NamesListExView::NewL |
|
251 |
// -------------------------------------------------------------------------- |
|
252 |
// |
|
253 |
CPbk2NamesListExView* CPbk2NamesListExView::NewL |
|
254 |
( CPbk2UIExtensionView& aView, |
|
255 |
CSpbContentProvider& aStatusProvider, |
|
256 |
MCCAConnection*& aCCAConnection ) |
|
257 |
{ |
|
258 |
CPbk2NamesListExView* self = new ( ELeave ) CPbk2NamesListExView |
|
259 |
( aView, aStatusProvider, aCCAConnection ); |
|
260 |
CleanupStack::PushL( self ); |
|
261 |
self->ConstructL(); |
|
262 |
CleanupStack::Pop( self ); |
|
263 |
return self; |
|
264 |
} |
|
265 |
||
266 |
// -------------------------------------------------------------------------- |
|
267 |
// CPbk2NamesListExView::ConstructL |
|
268 |
// -------------------------------------------------------------------------- |
|
269 |
// |
|
270 |
inline void CPbk2NamesListExView::ConstructL() |
|
271 |
{ |
|
272 |
FeatureManager::InitializeLibL(); |
|
273 |
||
274 |
// PreCond |
|
275 |
__ASSERT_DEBUG(!iContainer, Panic(EPanicPreCond_ConstructL)); |
|
276 |
PBK2_PROFILE_START(Pbk2Profile::ENamesListExViewConstruction); |
|
277 |
CCoeEnv::Static()->AddForegroundObserverL(*this); |
|
278 |
||
279 |
iContactManager = &(Phonebook2::Pbk2AppUi()->ApplicationServices().ContactManager()); |
|
280 |
iNameFormatter = &(Phonebook2::Pbk2AppUi()->ApplicationServices().NameFormatter()); |
|
281 |
||
282 |
PBK2_PROFILE_START(Pbk2Profile::ENamesListGetCommandHandler); |
|
283 |
iCommandHandler = Phonebook2::Pbk2AppUi()->ApplicationServices().CommandHandlerL(); |
|
284 |
PBK2_PROFILE_END(Pbk2Profile::ENamesListGetCommandHandler); |
|
285 |
||
286 |
// Register this view as a store configuration observer |
|
287 |
PBK2_PROFILE_START(Pbk2Profile::ENamesListRegisterStoreConfiguration); |
|
288 |
iStoreConfiguration = &Phonebook2::Pbk2AppUi()->ApplicationServices().StoreConfiguration(); |
|
289 |
iStoreConfiguration->AddObserverL( *this ); |
|
290 |
PBK2_PROFILE_END(Pbk2Profile::ENamesListRegisterStoreConfiguration); |
|
291 |
||
292 |
iControlProxy = new( ELeave )CPbk2ContactUiControlProxy; |
|
293 |
||
294 |
iContextLauncher = new(ELeave) CPbk2ContextLaunch( iCCAConnection ); |
|
295 |
||
296 |
PBK2_PROFILE_END(Pbk2Profile::ENamesListPenSupportConstruction); |
|
297 |
||
298 |
if( FeatureManager::FeatureSupported( KFeatureIdffContactsMycard ) ) |
|
299 |
{ |
|
300 |
// Get the phoneStore for MyCard |
|
301 |
MVPbkContactStore* phoneStore = iContactManager->ContactStoresL() |
|
302 |
.Find(VPbkContactStoreUris::DefaultCntDbUri()); |
|
303 |
||
304 |
if(phoneStore) |
|
305 |
{ |
|
306 |
iMyCard = CPbk2MyCard::NewL( *phoneStore ); |
|
307 |
} |
|
308 |
} |
|
309 |
||
310 |
// Attach AIW providers |
|
311 |
AttachAIWProvidersL(); |
|
312 |
||
313 |
// Do not create the container control here: defer creation to first |
|
314 |
// activation of the view (first DoActivateL call). This saves a lot |
|
315 |
// of memory and application starting time, because all the application |
|
316 |
// views (classes like this) must be created at startup. Controls will |
|
317 |
// be created on-demand as the views are accessed. |
|
318 |
||
319 |
PBK2_PROFILE_END(Pbk2Profile::ENamesListExViewConstruction); |
|
320 |
// PostCond |
|
321 |
__ASSERT_DEBUG(!iContainer, Panic(EPanicPostCond_ConstructL)); |
|
322 |
} |
|
323 |
||
324 |
// -------------------------------------------------------------------------- |
|
325 |
// CPbk2NamesListExView::ConstructToolbarL |
|
326 |
// -------------------------------------------------------------------------- |
|
327 |
// |
|
328 |
void CPbk2NamesListExView::ConstructToolbarL() |
|
329 |
{ |
|
330 |
if ( AknLayoutUtils::PenEnabled() ) |
|
331 |
{ |
|
332 |
iToolbar = iView.Toolbar(); |
|
333 |
if ( iToolbar ) |
|
334 |
{ |
|
335 |
// Take toolbar control event handling from touch pane. |
|
336 |
// Events need to be forwarded to touch pane manually. |
|
337 |
iToolbar->SetObserver( this ); |
|
338 |
iToolbar->SetToolbarObserver( this ); |
|
339 |
||
340 |
// Add toolbar buttons with skinnable icons |
|
341 |
iToolbarIcons = CPbk2IconInfoContainer::NewL( |
|
342 |
R_PBK2_NAMESLIST_TOOLBAR_ICON_INFO_ARRAY ); |
|
343 |
CPbk2IconFactory* factory = |
|
344 |
CPbk2IconFactory::NewLC( *iToolbarIcons ); |
|
345 |
||
346 |
// Button 1: Call |
|
347 |
CAknButton* button = CreateToolbarButtonLC( |
|
348 |
*factory, EPbk2qgn_indi_tb_call, R_PHOB_TB_CALL ); |
|
349 |
iToolbar->AddItemL( |
|
350 |
button, EAknCtButton, EPbk2CmdCall, 0, 0 ); |
|
351 |
CleanupStack::Pop( button ); |
|
352 |
||
353 |
// Button 2: Write message |
|
354 |
button = CreateToolbarButtonLC( |
|
355 |
*factory, EPbk2qgn_indi_tb_mce, R_PHOB_TB_CREATE_MSG ); |
|
356 |
iToolbar->AddItemL( |
|
357 |
button, EAknCtButton, EPbk2CmdWriteNoQuery, 0, 1 ); |
|
358 |
CleanupStack::Pop( button ); |
|
359 |
||
360 |
// Button 3: Create new contact |
|
361 |
button = CreateToolbarButtonLC( |
|
362 |
*factory, EPbk2qgn_indi_tb_avail_contacts, R_PHOB_TB_NEW_CONTACT ); |
|
363 |
iToolbar->AddItemL( |
|
364 |
button, EAknCtButton, EPbk2CmdCreateNew, 0, 2 ); |
|
365 |
CleanupStack::Pop( button ); |
|
366 |
||
367 |
CleanupStack::PopAndDestroy( factory ); |
|
368 |
||
369 |
// Load the previously saved toolbar state |
|
370 |
CRepository* cenrep = |
|
371 |
CRepository::NewLC( TUid::Uid( KCRUidPhonebook ) ); |
|
372 |
User::LeaveIfError( |
|
373 |
cenrep->Get( KPhonebookNamesListToolbarVisibility, |
|
374 |
iToolbarVisible ) ); |
|
375 |
CleanupStack::PopAndDestroy( cenrep ); |
|
376 |
||
377 |
// FIXME: toolbar is now always on after fixed toolbar is taken to use. |
|
378 |
// so the toolbar visibility storing and handling code including the cenrep key |
|
379 |
// could probably be removed now |
|
380 |
iToolbar->SetToolbarVisibility(ETrue, EFalse); |
|
381 |
} |
|
382 |
} |
|
383 |
} |
|
384 |
||
385 |
// -------------------------------------------------------------------------- |
|
386 |
// CPbk2NamesListExView::HandleCommandL |
|
387 |
// -------------------------------------------------------------------------- |
|
388 |
// |
|
389 |
void CPbk2NamesListExView::HandleCommandL(TInt aCommandId) |
|
390 |
{ |
|
391 |
// If this view has already been deactivated, just return. |
|
392 |
if ( Phonebook2::Pbk2AppUi()->ActiveView()->Id() != Phonebook2::KPbk2NamesListViewUid ) |
|
393 |
{ |
|
394 |
return; |
|
395 |
} |
|
396 |
||
397 |
// In case "open" is chosen and a command item is highlighted, need to remap |
|
398 |
// cmd ID from openCca to the correct cmd ID. For command items "select" is used. |
|
399 |
// Not very elegant. Another way would be to dynamically change the OK cmd assignment |
|
400 |
// all the time as UI state changes. |
|
401 |
if ( iControl->FocusedCommandItem() && |
|
402 |
!iControl->ContactsMarked() && |
|
403 |
(aCommandId == EPbk2CmdOpenCca || aCommandId == EAknSoftkeySelect ) ) |
|
404 |
{ |
|
405 |
aCommandId = iControl->FocusedCommandItem()->CommandId(); |
|
406 |
} |
|
407 |
||
408 |
if ( iControl->FocusedCommandItem() && |
|
409 |
!iControl->ContactsMarked() && |
|
410 |
aCommandId == EPbk2CmdSelectRclCmdItem ) |
|
411 |
{ |
|
412 |
aCommandId = EPbk2CmdRcl; |
|
413 |
} |
|
414 |
||
415 |
if ( EAknCmdHideInBackground != aCommandId ) |
|
416 |
{ |
|
417 |
iCurrentCommandId = aCommandId; |
|
418 |
} |
|
419 |
||
420 |
if ( EPbk2CmdOpenCca == aCommandId ) |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
421 |
{ |
63 | 422 |
iControl->SetOpeningCca( ETrue ); |
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
423 |
} |
63 | 424 |
|
425 |
// Set focus, keep current focus on the area of the client screen |
|
426 |
// when scoll to the bottom of Names list view. |
|
427 |
CPbk2ContactViewListBox* listbox = static_cast<CPbk2ContactViewListBox*>(iControl->ComponentControl(0)); |
|
428 |
if ( EPbk2CmdCreateNew == aCommandId && |
|
429 |
listbox->CurrentItemIndex() < listbox->TopItemIndex() && |
|
430 |
listbox->BottomItemIndex() == listbox->Model()->NumberOfItems()-1 ) |
|
431 |
{ |
|
432 |
listbox->SetCurrentItemIndex( listbox->TopItemIndex() ); |
|
433 |
} |
|
434 |
||
435 |
// No command handling in this class, forward to Commands |
|
436 |
if (!iCommandHandler->HandleCommandL( aCommandId, *iControlProxy, &iView )) |
|
437 |
{ |
|
438 |
iControl->ProcessCommandL(aCommandId); |
|
439 |
// Command was not handled in Pbk2Commands, forward it to AppUi |
|
440 |
Phonebook2::Pbk2AppUi()->HandleCommandL(aCommandId); |
|
441 |
||
442 |
// Update CBAs, if command handler is consuming the command |
|
443 |
// postcommandexecution is updating CBAs |
|
444 |
UpdateCbasL(); |
|
445 |
} |
|
446 |
} |
|
447 |
||
448 |
// -------------------------------------------------------------------------- |
|
449 |
// CPbk2NamesListExView::Id |
|
450 |
// -------------------------------------------------------------------------- |
|
451 |
// |
|
452 |
TUid CPbk2NamesListExView::Id() const |
|
453 |
{ |
|
454 |
return Phonebook2::KPbk2NamesListViewUid; |
|
455 |
} |
|
456 |
||
457 |
// -------------------------------------------------------------------------- |
|
458 |
// CPbk2NamesListExView::HandleStatusPaneSizeChange |
|
459 |
// -------------------------------------------------------------------------- |
|
460 |
// |
|
461 |
void CPbk2NamesListExView::HandleStatusPaneSizeChange() |
|
462 |
{ |
|
463 |
// Resize the container to fill the client rectangle |
|
464 |
if (iContainer) |
|
465 |
{ |
|
466 |
iContainer->SetRect(iView.ClientRect()); |
|
467 |
} |
|
468 |
if ( iToolbar && NeedToHideToolbar(iCurrentCommandId) ) |
|
469 |
{ |
|
470 |
// If Command is is executing (iCommandState:0) |
|
471 |
// Ordinal priority of iToolbar is set to ECoeWinPriorityLow. |
|
472 |
iToolbar->DrawableWindow()->SetOrdinalPosition |
|
473 |
( 0, iCommandState ? ECoeWinPriorityNormal : ECoeWinPriorityLow ); |
|
474 |
} |
|
475 |
} |
|
476 |
||
477 |
// -------------------------------------------------------------------------- |
|
478 |
// CPbk2NamesListExView::DoActivateL |
|
479 |
// -------------------------------------------------------------------------- |
|
480 |
// |
|
481 |
void CPbk2NamesListExView::DoActivateL |
|
482 |
( const TVwsViewId& aPrevViewId, TUid aCustomMessageId, |
|
483 |
const TDesC8& aCustomMessage ) |
|
484 |
{ |
|
485 |
/// Notice that when "always on" feature is used this is called second |
|
486 |
/// time without calling DoDeactivate, when exit is done. |
|
487 |
/// This function must not do any duplicate resource allocation. |
|
488 |
||
489 |
PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING |
|
490 |
("CPbk2NamesListExView(%x)::DoActivateL()"), this); |
|
491 |
||
492 |
PBK2_PROFILE_START(Pbk2Profile::ENamesListViewDoActivateL); |
|
493 |
||
494 |
PBK2_PROFILE_START |
|
495 |
( Pbk2Profile::ENamesListViewDoActivateAddMenuCommandObserver ); |
|
496 |
// Do not add duplicate if DoActivateL is called due to Exit in |
|
497 |
// always on mode. |
|
498 |
iCommandHandler->RemoveMenuCommandObserver( *this ); |
|
499 |
// Add this view to observ command events |
|
500 |
iCommandHandler->AddMenuCommandObserver(*this); |
|
501 |
PBK2_PROFILE_END |
|
502 |
( Pbk2Profile::ENamesListViewDoActivateAddMenuCommandObserver ); |
|
503 |
||
504 |
PBK2_PROFILE_START(Pbk2Profile::ENamesListViewDoActivateLoadTitle); |
|
505 |
HBufC* title = StringLoader::LoadLC(R_QTN_PHOB_TITLE); |
|
506 |
PBK2_PROFILE_END(Pbk2Profile::ENamesListViewDoActivateLoadTitle); |
|
507 |
||
508 |
PBK2_PROFILE_START |
|
509 |
( Pbk2Profile::ENamesListViewDoActivateHandleViewActivation ); |
|
510 |
MPbk2ViewActivationTransaction* viewActivationTransaction = |
|
511 |
Phonebook2::Pbk2AppUi()->Pbk2ViewExplorer()->HandleViewActivationLC |
|
512 |
( Id(), aPrevViewId, title, NULL, |
|
513 |
Phonebook2::EUpdateNaviPane | Phonebook2::EUpdateTitlePane | |
|
514 |
Phonebook2::EUpdateContextPane ); |
|
515 |
PBK2_PROFILE_END |
|
516 |
( Pbk2Profile::ENamesListViewDoActivateHandleViewActivation ); |
|
517 |
||
518 |
// Create control and activate it. |
|
519 |
PBK2_PROFILE_START(Pbk2Profile::ENamesListViewDoActivateActivateControl); |
|
520 |
CreateControlsL(); |
|
521 |
iContainer->ActivateL(); |
|
522 |
PBK2_PROFILE_END(Pbk2Profile::ENamesListViewDoActivateActivateControl); |
|
523 |
||
524 |
// Check activation parameters |
|
525 |
PBK2_PROFILE_START(Pbk2Profile::ENamesListViewDoActivateParamHandling); |
|
526 |
delete iParamState; |
|
527 |
iParamState = NULL; |
|
528 |
if( aCustomMessageId == CPbk2ContextLaunch::Uid() ) |
|
529 |
{ |
|
530 |
// Close up any open CCA instances |
|
531 |
if( iCCAConnection ) |
|
532 |
{ |
|
533 |
iCCAConnection->Close(); |
|
534 |
iCCAConnection = NULL; |
|
535 |
} |
|
536 |
||
537 |
// Handle context launch request |
|
538 |
if( iContextLauncher ) |
|
539 |
{ |
|
540 |
iContextLauncher->HandleMessageL( aCustomMessage ); |
|
541 |
} |
|
542 |
} |
|
543 |
else if (aCustomMessageId == CPbk2ViewState::Uid()) |
|
544 |
{ |
|
545 |
// Restore state when TPbk2ControlEvent::EReady comes. |
|
546 |
iParamState = CPbk2ViewState::NewL(aCustomMessage); |
|
547 |
} |
|
548 |
else if (aCustomMessageId == TUid::Uid(KPbkViewStateUid)) |
|
549 |
{ |
|
550 |
// Handle legacy view state |
|
551 |
CPbk2ViewStateTransformer* transformer = |
|
552 |
CPbk2ViewStateTransformer::NewLC( *iContactManager ); |
|
553 |
// Restore state when TPbk2ControlEvent::EReady comes. |
|
554 |
iParamState = transformer-> |
|
555 |
TransformLegacyViewStateToPbk2ViewStateLC |
|
556 |
( aCustomMessage ); |
|
557 |
CleanupStack::Pop(iParamState); |
|
558 |
CleanupStack::PopAndDestroy(transformer); |
|
559 |
} |
|
560 |
PBK2_PROFILE_END(Pbk2Profile::ENamesListViewDoActivateParamHandling); |
|
561 |
||
562 |
viewActivationTransaction->Commit(); |
|
563 |
CleanupStack::PopAndDestroy(2,title); // viewActivationTransaction, title |
|
564 |
||
565 |
// The application is set here to background if application exit occurs |
|
566 |
PBK2_PROFILE_START |
|
567 |
( Pbk2Profile::ENamesListViewDoActivateNotifyViewActivatation ); |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
568 |
|
63 | 569 |
// The application is set here to background if application exit occurs |
570 |
// When the device is powered on, Phonebook will start up automatically and |
|
571 |
// hide itself in the background. At the first time of names list view activation, |
|
572 |
// event is generated, the notification needs to be sent to Startup Monitor |
|
573 |
// so that making UI controls displaying properly. |
|
574 |
// At the first time of the activation, since all controls are brand new so |
|
575 |
// the iControl->Reset() needn’t to be called. |
|
576 |
if ( iParamState && iParamState->Flags() & |
|
577 |
CPbk2ViewState::ESendToBackground && !iFirstTimeActivated) |
|
578 |
{ |
|
579 |
// AppUi will send the application to background. |
|
580 |
||
581 |
// Because the control is not destroyed it must be reset so that |
|
582 |
// when the view comes foreground again it will look like a fresh |
|
583 |
// and brand new control. |
|
584 |
iControl->Reset(); |
|
585 |
} |
|
586 |
else if (Phonebook2::Pbk2AppUi()->Pbk2StartupMonitor()) |
|
587 |
{ |
|
588 |
// We are not going to background. Notify the start-up monitor that |
|
589 |
// will need to know the when the first view is activated. |
|
590 |
Phonebook2::Pbk2AppUi()->Pbk2StartupMonitor()->NotifyViewActivationL(Id()); |
|
591 |
||
592 |
// Reset flag |
|
593 |
iFirstTimeActivated = EFalse; |
|
594 |
} |
|
595 |
PBK2_PROFILE_END |
|
596 |
( Pbk2Profile::ENamesListViewDoActivateNotifyViewActivatation ); |
|
597 |
||
598 |
PBK2_PROFILE_END(Pbk2Profile::ENamesListViewDoActivateL); |
|
599 |
||
600 |
CCoeControl* ctrl=iControl->ComponentControl(0); |
|
601 |
CEikListBox* listbox=static_cast <CEikListBox*> (ctrl); |
|
602 |
listbox->SetListBoxObserver( this ); |
|
603 |
||
604 |
// iCtrlVisibleStateBeforeLosingForground records the names list control states before |
|
605 |
// losing foreground during a command execution. Set the iCtrlVisibleStateBeforeLosingForground |
|
606 |
// flag as ETrue as the control should be visible when active a view. |
|
607 |
iCtrlVisibleStateBeforeLosingForground = ETrue; |
|
608 |
||
609 |
// PostCond: |
|
610 |
__ASSERT_DEBUG(iContainer, Panic(EPanicPostCond_DoActivateL)); |
|
611 |
} |
|
612 |
||
613 |
// -------------------------------------------------------------------------- |
|
614 |
// CPbk2NamesListExView::AddCommandItemsToContainerL |
|
615 |
// -------------------------------------------------------------------------- |
|
616 |
// |
|
617 |
void CPbk2NamesListExView::AddCommandItemsToContainerL() |
|
618 |
{ |
|
619 |
// get command item count |
|
620 |
TInt commandCount = iControl->CommandItemCount(); |
|
621 |
||
622 |
// Check if there is need to create MyCard |
|
623 |
if( FeatureManager::FeatureSupported( KFeatureIdffContactsMycard ) && |
|
624 |
( !iMyCard && IsPhoneMemoryUsedL() ) ) |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
625 |
{ |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
626 |
// Get the phoneStore for MyCard |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
627 |
MVPbkContactStore* phoneStore = iContactManager->ContactStoresL() |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
628 |
.Find(VPbkContactStoreUris::DefaultCntDbUri() ); |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
629 |
|
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
630 |
if( phoneStore ) |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
631 |
{ |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
632 |
// Create MyCard if not already exist and the phone memory selected |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
633 |
iMyCard = CPbk2MyCard::NewL( *phoneStore ); |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
634 |
} |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
635 |
} |
63 | 636 |
|
637 |
// Add the MyCard item to the top of the list |
|
638 |
if( iMyCard && IsPhoneMemoryUsedL() ) |
|
639 |
{ |
|
640 |
CPbk2CmdItemMyCard* cmd = |
|
641 |
CPbk2CmdItemMyCard::NewLC( *iMyCard, iContentProvider ); |
|
642 |
iControl->AddCommandItemL( cmd, commandCount ); // ownership transferred |
|
643 |
CleanupStack::Pop( cmd ); |
|
644 |
commandCount++; |
|
645 |
} |
|
646 |
||
647 |
CPbk2CmdItemAddTop* listCmd = CPbk2CmdItemAddTop::NewLC(); |
|
648 |
// Add the command item to the bottom of the command list |
|
649 |
iControl->AddCommandItemL( listCmd, commandCount ); // ownership transferred |
|
650 |
CleanupStack::Pop( listCmd ); |
|
651 |
commandCount++; |
|
652 |
||
653 |
||
654 |
// promotion item disabled until we can support command items at the bottom of the list |
|
655 |
// if ( IsRclOnL() ) |
|
656 |
if( 0 ) |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
657 |
{ |
63 | 658 |
CPbk2CmdItemRemoteContactLookup* rclCmd = CPbk2CmdItemRemoteContactLookup::NewLC(); |
659 |
// Add the command item to the bottom of the command list |
|
660 |
iControl->AddCommandItemL( rclCmd, commandCount ); // ownership transferred |
|
661 |
CleanupStack::Pop( rclCmd ); |
|
662 |
commandCount++; |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
663 |
} |
63 | 664 |
} |
665 |
||
666 |
// -------------------------------------------------------------------------- |
|
667 |
// CPbk2NamesListExView::IsRclOnL |
|
668 |
// -------------------------------------------------------------------------- |
|
669 |
// |
|
670 |
TBool CPbk2NamesListExView::IsRclOnL() |
|
671 |
{ |
|
672 |
TBool ret(EFalse); |
|
673 |
||
674 |
if( FeatureManager::FeatureSupported( KFeatureIdFfContactsRemoteLookup )) |
|
675 |
{ |
|
676 |
//1. Get default protocol account |
|
677 |
TPbkxRemoteContactLookupProtocolAccountId accountID = |
|
678 |
CPbk2RemoteContactLookupAccounts::DefaultAccountIdL(); |
|
679 |
||
680 |
//2. Check that there really are implementation and account corresponding to |
|
681 |
//repository's value |
|
682 |
// If the iProtocolUid is NULL, then a default account has not been set. |
|
683 |
if ( accountID.iProtocolUid.iUid ) |
|
684 |
{ |
|
685 |
CPbkxRemoteContactLookupProtocolAccount* account = NULL; |
|
686 |
// Returns NULL if account or plugin doesn't exist |
|
687 |
account = CPbk2RemoteContactLookupAccounts::GetAccountL( accountID ); |
|
688 |
if ( account ) |
|
689 |
{ |
|
690 |
ret = ETrue; |
|
691 |
delete account; |
|
692 |
} |
|
693 |
} |
|
694 |
} |
|
695 |
return ret; |
|
696 |
} |
|
697 |
||
698 |
// -------------------------------------------------------------------------- |
|
699 |
// CPbk2NamesListExView::MyCard |
|
700 |
// -------------------------------------------------------------------------- |
|
701 |
// |
|
702 |
CPbk2MyCard* CPbk2NamesListExView::MyCard() const |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
703 |
{ |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
704 |
TBool phoneMemory = EFalse; |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
705 |
|
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
706 |
TRAP_IGNORE( phoneMemory = IsPhoneMemoryUsedL() ); |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
707 |
|
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
708 |
if( phoneMemory ) |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
709 |
{ |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
710 |
return iMyCard; |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
711 |
} |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
712 |
|
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
713 |
return NULL; |
63 | 714 |
} |
715 |
||
716 |
// -------------------------------------------------------------------------- |
|
717 |
// CPbk2NamesListExView::DoDeactivate |
|
718 |
// -------------------------------------------------------------------------- |
|
719 |
// |
|
720 |
void CPbk2NamesListExView::DoDeactivate() |
|
721 |
{ |
|
722 |
PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING |
|
723 |
("CPbk2NamesListExView(%x)::DoDeactivate()"), this); |
|
724 |
||
725 |
// CCA Connection should be closed when Name List View deactivated |
|
726 |
if( iCCAConnection ) |
|
727 |
{ |
|
728 |
iCCAConnection->Close(); |
|
729 |
iCCAConnection = NULL; |
|
730 |
} |
|
731 |
||
732 |
if ( iCommandHandler ) |
|
733 |
{ |
|
734 |
iCommandHandler->RemoveMenuCommandObserver( *this ); |
|
735 |
} |
|
736 |
||
737 |
// Cancel toolbar warden to prevent further state saving |
|
738 |
if( iIdleToolbarWarden ) |
|
739 |
{ |
|
740 |
iIdleToolbarWarden->Cancel(); |
|
741 |
} |
|
742 |
||
743 |
// Disable focus of toobar, so that it can't steal it from other views |
|
744 |
if( iToolbar ) |
|
745 |
{ |
|
746 |
iToolbar->SetFocusing( EFalse ); |
|
747 |
} |
|
748 |
||
749 |
if( iIdleTexter ) |
|
750 |
{ |
|
751 |
iIdleTexter->Cancel(); |
|
752 |
} |
|
753 |
||
754 |
// Trash the old states |
|
755 |
delete iParamState; |
|
756 |
iParamState = NULL; |
|
757 |
delete iControlState; |
|
758 |
iControlState = NULL; |
|
759 |
||
760 |
if (iContainer) |
|
761 |
{ |
|
762 |
CCoeEnv::Static()->AppUi()->RemoveFromStack(iContainer); |
|
763 |
// Store current state, safe to ignore. There's no real harm, |
|
764 |
// if theres no stored state when activating this view again |
|
765 |
TRAP_IGNORE(StoreStateL()); |
|
766 |
iControl->SetObserver(NULL); |
|
767 |
delete iContainer; |
|
768 |
iContainer = NULL; |
|
769 |
// Reset also the reference to the control |
|
770 |
iControl = NULL; |
|
771 |
iControlProxy->SetControl( NULL ); |
|
772 |
} |
|
773 |
} |
|
774 |
||
775 |
// -------------------------------------------------------------------------- |
|
776 |
// CPbk2NamesListExView::DynInitMenuPaneL |
|
777 |
// -------------------------------------------------------------------------- |
|
778 |
// |
|
779 |
void CPbk2NamesListExView::DynInitMenuPaneL |
|
780 |
( TInt aResourceId, CEikMenuPane* aMenuPane ) |
|
781 |
{ |
|
782 |
// Ask the control to do control specific filtering |
|
783 |
// (for example call HandleMarkableListDynInitMenuPane if needed) |
|
784 |
iControl->DynInitMenuPaneL(aResourceId, aMenuPane); |
|
785 |
||
786 |
// Phonebook 2 menu filtering happens in Commands |
|
787 |
iCommandHandler->DynInitMenuPaneL( |
|
788 |
aResourceId, aMenuPane, iView, *iControl); |
|
789 |
||
790 |
//This is called after CPbk2CommandHandler::PerformStandardMenuFilteringL |
|
791 |
//so we can safely remove here anything that may already also be removed |
|
792 |
//there. |
|
793 |
switch (aResourceId) |
|
794 |
{ |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
795 |
case R_PHONEBOOK2_NAMESLIST_SEND_URL_MENU: |
63 | 796 |
{ |
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
797 |
DimItem( aMenuPane, EPbk2CmdGoToURL ); |
63 | 798 |
break; |
799 |
} |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
800 |
case R_PHONEBOOK2_NAMELIST_CREATE_MESSAGE_MENU: |
63 | 801 |
{ |
802 |
TInt pos; |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
803 |
if ( aMenuPane->MenuItemExists( EPbk2CmdWriteNoQuery, pos ) ) |
63 | 804 |
{ |
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
805 |
aMenuPane->SetItemSpecific( EPbk2CmdWriteNoQuery, !iControl->ContactsMarked() ); |
63 | 806 |
} |
807 |
break; |
|
808 |
} |
|
809 |
default: |
|
810 |
{ |
|
811 |
break; |
|
812 |
} |
|
813 |
} |
|
814 |
} |
|
815 |
||
816 |
// -------------------------------------------------------------------------- |
|
817 |
// CPbk2NamesListAppView::DimItem |
|
818 |
// -------------------------------------------------------------------------- |
|
819 |
// |
|
820 |
void CPbk2NamesListExView::DimItem( CEikMenuPane* aMenuPane, TInt aCmd ) |
|
821 |
{ |
|
822 |
TInt pos; |
|
823 |
if ( aMenuPane->MenuItemExists( aCmd, pos ) ) |
|
824 |
{ |
|
825 |
aMenuPane->SetItemDimmed( aCmd, ETrue ); |
|
826 |
} |
|
827 |
} |
|
828 |
||
829 |
// -------------------------------------------------------------------------- |
|
830 |
// CPbk2NamesListExView::ViewStateLC |
|
831 |
// -------------------------------------------------------------------------- |
|
832 |
// |
|
833 |
CPbk2ViewState* CPbk2NamesListExView::ViewStateLC() const |
|
834 |
{ |
|
835 |
CPbk2ViewState* state = NULL; |
|
836 |
if (iControl) |
|
837 |
{ |
|
838 |
state = iControl->ControlStateL(); |
|
839 |
} |
|
840 |
CleanupStack::PushL(state); |
|
841 |
return state; |
|
842 |
} |
|
843 |
||
844 |
// -------------------------------------------------------------------------- |
|
845 |
// CPbk2NamesListExView::HandleCommandKeyL |
|
846 |
// -------------------------------------------------------------------------- |
|
847 |
// |
|
848 |
TBool CPbk2NamesListExView::HandleCommandKeyL |
|
849 |
( const TKeyEvent& aKeyEvent, TEventCode aType ) |
|
850 |
{ |
|
851 |
// re-initialized the findbox focus if the application is back in the |
|
852 |
// foreground. |
|
853 |
if ( iNeedSetFocus && iView.IsForeground() ) |
|
854 |
{ |
|
855 |
iNeedSetFocus = EFalse; |
|
856 |
iControl->FocusChanged( EDrawNow ); |
|
857 |
} |
|
858 |
||
859 |
/* Uncomment this code if it is necessary to enable navigation hardware keys |
|
860 |
* on devices which have these keys (its Map Extension feature) |
|
861 |
if( aKeyEvent.iScanCode == EStdKeyApplicationD && aType == EEventKeyUp ) |
|
862 |
{ |
|
863 |
HandleCommandL( EPbk2ExtensionAssignFromMap ); |
|
864 |
return ETrue; |
|
865 |
} |
|
866 |
||
867 |
if( aKeyEvent.iScanCode == EStdKeyApplicationE && aType == EEventKeyUp ) |
|
868 |
{ |
|
869 |
HandleCommandL( EPbk2ExtensionShowOnMap ); |
|
870 |
return ETrue; |
|
871 |
}*/ |
|
872 |
TBool itemSpecEnabled = iView.MenuBar()->ItemSpecificCommandsEnabled(); |
|
873 |
||
874 |
TBool result = EFalse; |
|
875 |
if (aType == EEventKey) |
|
876 |
{ |
|
877 |
switch (aKeyEvent.iCode) |
|
878 |
{ |
|
879 |
case EKeyPhoneSend: |
|
880 |
{ |
|
881 |
if ( itemSpecEnabled && iControl->NumberOfContacts() > 0 && |
|
882 |
!iControl->ContactsMarked() ) |
|
883 |
{ |
|
884 |
// Do not handle the call command if there is a dialog displayed |
|
885 |
if ( !(CEikonEnv::Static()->EikAppUi()->IsDisplayingDialog()) ) |
|
886 |
{ |
|
887 |
// Use the EPbk2CmdCall id to identify that |
|
888 |
// call is being launched with send key |
|
889 |
HandleCommandL(EPbk2CmdCall); |
|
890 |
} |
|
891 |
result = ETrue; |
|
892 |
} |
|
893 |
break; |
|
894 |
} |
|
895 |
case EKeyPoC: |
|
896 |
{ |
|
897 |
// Use the EPbk2CmdPoC id to identify that |
|
898 |
// call is being launched with PoC key |
|
899 |
HandleCommandL( EPbk2CmdPoC ); |
|
900 |
result = ETrue; |
|
901 |
break; |
|
902 |
} |
|
903 |
case EKeyBackspace: |
|
904 |
{ |
|
905 |
if ( itemSpecEnabled && ( iControl->FindTextL() == KNullDesC ) ) |
|
906 |
{ |
|
907 |
TBool contactsMarked( iControl->ContactsMarked() ); |
|
908 |
||
909 |
MPbk2UiControlCmdItem* cmdItem = const_cast<MPbk2UiControlCmdItem*> ( iControl->FocusedCommandItem() ); |
|
910 |
||
911 |
TBool onMyCard = cmdItem && ( EPbk2CmdOpenMyCard == cmdItem->CommandId() ); |
|
912 |
||
913 |
if ( !contactsMarked && onMyCard ) |
|
914 |
{ |
|
915 |
//Check to see whether the current focus is on MyCard or not |
|
916 |
//When none of the contacts are marked and with focus on MyCard, |
|
917 |
// pressing BackSpace/Del key leads to deletion of MyCard |
|
918 |
||
919 |
// get extension point and my card link |
|
920 |
TAny* object = cmdItem->ControlCmdItemExtension( TUid::Uid( KPbk2ControlCmdItemExtensionUID ) ); |
|
921 |
if( object ) |
|
922 |
{ |
|
923 |
MPbk2DoubleListboxCmdItemExtension* extension = |
|
924 |
static_cast<MPbk2DoubleListboxCmdItemExtension*>( object ); |
|
925 |
// if extension exists |
|
926 |
if( extension ) |
|
927 |
{ |
|
928 |
const MVPbkContactLink* link = extension->Link(); |
|
929 |
// if link exists, then MyCard has been Assigned |
|
930 |
if( link ) |
|
931 |
{ |
|
932 |
HandleCommandL( EPbk2CmdDeleteMyCard ); |
|
933 |
result = ETrue; |
|
934 |
} |
|
935 |
} |
|
936 |
} |
|
937 |
} |
|
938 |
else if( ( contactsMarked ) || (iControl->NumberOfContacts() > 0) ) |
|
939 |
{ |
|
940 |
HandleCommandL(EPbk2CmdDeleteMe); |
|
941 |
result = ETrue; |
|
942 |
} |
|
943 |
} |
|
944 |
break; |
|
945 |
} |
|
946 |
||
947 |
case EKeyEnter: // FALLTHROUGH |
|
948 |
case EKeyOK: |
|
949 |
{ |
|
950 |
if ( !ShiftDown(aKeyEvent) ) // pure OK key |
|
951 |
{ |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
952 |
if ( iControl->ContactsMarked() && itemSpecEnabled ) |
63 | 953 |
{ |
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
954 |
iView.LaunchPopupMenuL( |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
955 |
R_PHONEBOOK2_NAMESLIST_CONTEXT_MENUBAR_ITEMS_MARKED); |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
956 |
result = ETrue; |
63 | 957 |
} |
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
958 |
//else if ( iControl->NumberOfContacts() == 0 ) |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
959 |
// { |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
960 |
// result = ETrue; |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
961 |
// } |
63 | 962 |
} |
963 |
break; |
|
964 |
} |
|
965 |
default: |
|
966 |
{ |
|
967 |
break; |
|
968 |
} |
|
969 |
} |
|
970 |
} |
|
971 |
||
972 |
// Update selection modifier key state |
|
973 |
iSelectionModifierUsed = IsShiftOrControlDown( aKeyEvent ) || |
|
974 |
( (aType == EEventKeyDown) && (aKeyEvent.iCode == EStdKeyHash) ); |
|
975 |
||
976 |
return result; |
|
977 |
} |
|
978 |
||
979 |
||
980 |
// ---------------------------------------------------------------------------- |
|
981 |
// CLogsBaseView::HandleListBoxEventL |
|
982 |
// ---------------------------------------------------------------------------- |
|
983 |
// |
|
984 |
void CPbk2NamesListExView::HandleListBoxEventL( |
|
985 |
CEikListBox* aListBox, |
|
986 |
TListBoxEvent aEventType) |
|
987 |
{ |
|
988 |
if( AknLayoutUtils::PenEnabled() ) |
|
989 |
{ |
|
990 |
switch ( aEventType ) |
|
991 |
{ |
|
992 |
case EEventItemSingleClicked: |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
993 |
{ |
63 | 994 |
ShowContextMenuL(); |
995 |
break; |
|
996 |
} |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
997 |
#if 0 |
63 | 998 |
case EEventEmptyAreaClicked: //An empty area of non-empty listbox was clicked |
999 |
case EEventEmptyListClicked: //An empty listbox was clicked |
|
1000 |
{ |
|
1001 |
ProcessEmptyAreaClickL(); |
|
1002 |
break; |
|
1003 |
} |
|
1004 |
#endif |
|
1005 |
||
1006 |
case EEventItemClicked: //Happens after focus changed |
|
1007 |
break; |
|
1008 |
||
1009 |
case EEventPanningStarted: |
|
1010 |
case EEventFlickStarted: |
|
1011 |
case EEventPanningStopped: |
|
1012 |
case EEventFlickStopped: |
|
1013 |
{ |
|
1014 |
iControl->HandleListBoxEventL( aListBox, aEventType ); |
|
1015 |
break; |
|
1016 |
} |
|
1017 |
case EEventEnterKeyPressed: |
|
1018 |
{ |
|
1019 |
if ( iControl->FocusedCommandItem() && |
|
1020 |
!iControl->ContactsMarked() ) |
|
1021 |
{ |
|
1022 |
HandleCommandL(iControl->FocusedCommandItem()->CommandId() ); |
|
1023 |
} |
|
1024 |
else if (iControl->NumberOfContacts() > 0 && |
|
1025 |
!iControl->ContactsMarked()) |
|
1026 |
{ |
|
1027 |
// Select key is mapped to "Open Contact" command |
|
1028 |
HandleCommandL(EPbk2CmdOpenCca); |
|
1029 |
} |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
1030 |
else if (iControl->ContactsMarked()) |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
1031 |
{ |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
1032 |
iView.LaunchPopupMenuL( |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
1033 |
R_PHONEBOOK2_NAMESLIST_CONTEXT_MENUBAR_ITEMS_MARKED); |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
1034 |
} |
63 | 1035 |
break; |
1036 |
} |
|
1037 |
default: |
|
1038 |
break; |
|
1039 |
} |
|
1040 |
} |
|
1041 |
} |
|
1042 |
||
1043 |
// -------------------------------------------------------------------------- |
|
1044 |
// CPbk2NamesListExView::HandlePointerEventL |
|
1045 |
// -------------------------------------------------------------------------- |
|
1046 |
// |
|
1047 |
void CPbk2NamesListExView::HandlePointerEventL( |
|
1048 |
const TPointerEvent& aPointerEvent ) |
|
1049 |
{ |
|
1050 |
// re-initialized the findbox focus when the application is back in the |
|
1051 |
// foreground. |
|
1052 |
if ( iNeedSetFocus ) |
|
1053 |
{ |
|
1054 |
iNeedSetFocus = EFalse; |
|
1055 |
iControl->FocusChanged( EDrawNow ); |
|
1056 |
} |
|
1057 |
||
1058 |
if ( AknLayoutUtils::PenEnabled() ) |
|
1059 |
{ |
|
1060 |
// Longtap detection is currently not needed here |
|
1061 |
#if 0 |
|
1062 |
// If at some point we need to enable longtap detection here, then need |
|
1063 |
// to implement a way to prevent passing the event to longtap detector |
|
1064 |
// when a command item is tapped. Because command items should not have the |
|
1065 |
// longtap animation. |
|
1066 |
if ( iContainer |
|
1067 |
&& <tapped item is not a command item> // <-- implement this logic by any means |
|
1068 |
&& !iControl->ContactsMarked() && iPointerEventInspector->FocusableItemPointed() ) |
|
1069 |
{ |
|
1070 |
iContainer->LongTapDetectorL().PointerEventL( aPointerEvent ); |
|
1071 |
} |
|
1072 |
#endif |
|
1073 |
||
1074 |
// ece has stylus menu for empty state, no need to initiate touch feedback |
|
1075 |
// context menu disabled as well |
|
1076 |
#if 0 |
|
1077 |
if ( iControl->NumberOfContacts()==0) |
|
1078 |
{ |
|
1079 |
if ( aPointerEvent.iType == TPointerEvent::EButton1Down ) |
|
1080 |
{ |
|
1081 |
MTouchFeedback* feedback = MTouchFeedback::Instance(); |
|
1082 |
if ( feedback ) |
|
1083 |
{ |
|
1084 |
feedback->InstantFeedback( ETouchFeedbackBasic ); |
|
1085 |
} |
|
1086 |
} |
|
1087 |
else if ( ( aPointerEvent.iType == TPointerEvent::EButton1Up ) && iCommandState) |
|
1088 |
{ |
|
1089 |
ShowContextMenuL(); |
|
1090 |
} |
|
1091 |
} |
|
1092 |
#endif |
|
1093 |
} |
|
1094 |
||
1095 |
} |
|
1096 |
||
1097 |
// -------------------------------------------------------------------------- |
|
1098 |
// CPbk2NamesListExView::ShowContextMenuL |
|
1099 |
// -------------------------------------------------------------------------- |
|
1100 |
// |
|
1101 |
void CPbk2NamesListExView::ShowContextMenuL() |
|
1102 |
{ |
|
1103 |
||
1104 |
if ( iStylusPopupMenuLaunched ) |
|
1105 |
{ |
|
1106 |
// Absorb EButton1Up event if we already launched the stylus |
|
1107 |
// popup menu |
|
1108 |
iStylusPopupMenuLaunched = EFalse; |
|
1109 |
} |
|
1110 |
else if ( !iPointerEventInspector->SearchFieldPointed() && |
|
1111 |
!iSelectionModifierUsed ) |
|
1112 |
{ |
|
1113 |
if ( iControl->NumberOfContacts() > 0 || iControl->CommandItemCount() > 0) |
|
1114 |
{ |
|
1115 |
if ( iPointerEventInspector->FocusedItemPointed() ) |
|
1116 |
{ |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
1117 |
if ( iControl->ContactsMarked() ) |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
1118 |
{ |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
1119 |
// Display marked items context menu |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
1120 |
iView.LaunchPopupMenuL |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
1121 |
( R_PHONEBOOK2_NAMESLIST_CONTEXT_MENUBAR_ITEMS_MARKED ); |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
1122 |
} |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
1123 |
else |
63 | 1124 |
{ |
1125 |
// cancel the long tap animation with pointer up event |
|
1126 |
TPointerEvent event; |
|
1127 |
event.iType = TPointerEvent::EButton1Up; |
|
1128 |
iContainer->LongTapDetectorL().PointerEventL( event ); |
|
1129 |
||
1130 |
// Open contact |
|
1131 |
HandleCommandL( EPbk2CmdOpenCca ); |
|
1132 |
} |
|
1133 |
} |
|
1134 |
} |
|
1135 |
else |
|
1136 |
{ |
|
1137 |
#ifndef ECE_DISABLE_CONTEXT_MENU |
|
1138 |
// Display regular context menu |
|
1139 |
iView.LaunchPopupMenuL |
|
1140 |
( R_PHONEBOOK2_NAMESLIST_CONTEXT_MENUBAR ); |
|
1141 |
#endif |
|
1142 |
} |
|
1143 |
} |
|
1144 |
} |
|
1145 |
||
1146 |
#if 0 |
|
1147 |
// -------------------------------------------------------------------------- |
|
1148 |
// CPbk2NamesListExView::ProcessEmptyAreaClickL |
|
1149 |
// -------------------------------------------------------------------------- |
|
1150 |
// |
|
1151 |
void CPbk2NamesListExView::ProcessEmptyAreaClickL() |
|
1152 |
{ |
|
1153 |
if ( iStylusPopupMenuLaunched ) |
|
1154 |
{ |
|
1155 |
// Absorb EButton1Up event if we already launched the stylus |
|
1156 |
// popup menu |
|
1157 |
iStylusPopupMenuLaunched = EFalse; |
|
1158 |
} |
|
1159 |
else if ( !iPointerEventInspector->SearchFieldPointed() && |
|
1160 |
!iSelectionModifierUsed ) |
|
1161 |
{ |
|
1162 |
if ( iControl->NumberOfContacts() == 0 ) |
|
1163 |
{ |
|
1164 |
MTouchFeedback* feedback = MTouchFeedback::Instance(); |
|
1165 |
if ( feedback ) |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
1166 |
{ |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
1167 |
feedback->InstantFeedback( ETouchFeedbackBasic ); |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
1168 |
} |
63 | 1169 |
HandleCommandL( EPbk2CmdCreateNew ); |
1170 |
} |
|
1171 |
} |
|
1172 |
} |
|
1173 |
#endif |
|
1174 |
||
1175 |
// -------------------------------------------------------------------------- |
|
1176 |
// CPbk2NamesListExView::GetViewSpecificMenuFilteringFlagsL |
|
1177 |
// -------------------------------------------------------------------------- |
|
1178 |
// |
|
1179 |
TInt CPbk2NamesListExView::GetViewSpecificMenuFilteringFlagsL() const |
|
1180 |
{ |
|
1181 |
TInt flags(0); |
|
1182 |
||
1183 |
flags |= iControl->GetMenuFilteringFlagsL(); |
|
1184 |
||
1185 |
return flags; |
|
1186 |
} |
|
1187 |
||
1188 |
// -------------------------------------------------------------------------- |
|
1189 |
// CPbk2NamesListExView::HandleControlEventL |
|
1190 |
// -------------------------------------------------------------------------- |
|
1191 |
// |
|
1192 |
void CPbk2NamesListExView::HandleControlEventL |
|
1193 |
( MPbk2ContactUiControl& /*aControl*/, |
|
1194 |
const TPbk2ControlEvent& aEvent ) |
|
1195 |
{ |
|
1196 |
switch (aEvent.iEventType) |
|
1197 |
{ |
|
1198 |
case TPbk2ControlEvent::EUnavailable: // FALLTHROUGH |
|
1199 |
case TPbk2ControlEvent::EReady: |
|
1200 |
{ |
|
1201 |
DynInitToolbarL( R_PBK2_NAMESLIST_TOOLBAR, iToolbar ); |
|
1202 |
||
1203 |
// Restore control state |
|
1204 |
RestoreStateL(); |
|
1205 |
if ( iControl ) |
|
1206 |
{ |
|
1207 |
iControl->ShowThumbnail(); |
|
1208 |
iControl->DrawDeferred(); |
|
1209 |
} |
|
1210 |
// Restore control's state before updating cbas to get right state. |
|
1211 |
UpdateCbasL(); |
|
1212 |
PBK2_PROFILE_END(Pbk2Profile::EFullStartup); |
|
1213 |
break; |
|
1214 |
} |
|
1215 |
||
1216 |
case TPbk2ControlEvent::EContactSetChanged: |
|
1217 |
{ |
|
1218 |
UpdateCbasL(); |
|
1219 |
DynInitToolbarL( R_PBK2_NAMESLIST_TOOLBAR, iToolbar ); |
|
1220 |
iControl->ShowThumbnail(); |
|
1221 |
break; |
|
1222 |
} |
|
1223 |
||
1224 |
case TPbk2ControlEvent::EContactSelected: // FALLTHROUGH |
|
1225 |
case TPbk2ControlEvent::EContactUnselected: // FALLTHROUGH |
|
1226 |
case TPbk2ControlEvent::EContactUnselectedAll: |
|
1227 |
{ |
|
1228 |
// Do not UpdateCbasL here because control handles itself |
|
1229 |
// the MSK when it goes to selection mode. |
|
1230 |
DynInitToolbarL( R_PBK2_NAMESLIST_TOOLBAR, iToolbar ); |
|
1231 |
UpdateCbasL(); |
|
1232 |
break; |
|
1233 |
} |
|
1234 |
case TPbk2ControlEvent::EControlLeavesSelectionMode: |
|
1235 |
{ |
|
1236 |
// Update CBAs because the control doesn't know should |
|
1237 |
// the MSK be Open or Context menu when control leaves |
|
1238 |
// the selection mode. |
|
1239 |
UpdateCbasL(); |
|
1240 |
break; |
|
1241 |
} |
|
1242 |
||
1243 |
case TPbk2ControlEvent::EControlStateChanged: |
|
1244 |
{ |
|
1245 |
UpdateCbasL(); |
|
1246 |
DynInitToolbarL( R_PBK2_NAMESLIST_TOOLBAR, iToolbar ); |
|
1247 |
UpdateListEmptyTextL( aEvent.iInt ); |
|
1248 |
iControl->DrawDeferred(); |
|
1249 |
break; |
|
1250 |
} |
|
1251 |
||
1252 |
case TPbk2ControlEvent::EControlFocusChanged: |
|
1253 |
{ |
|
1254 |
DynInitToolbarL( R_PBK2_NAMESLIST_TOOLBAR, iToolbar ); |
|
1255 |
UpdateCbasL(); |
|
1256 |
break; |
|
1257 |
} |
|
1258 |
||
1259 |
default: |
|
1260 |
{ |
|
1261 |
// Do nothing |
|
1262 |
break; |
|
1263 |
} |
|
1264 |
} |
|
1265 |
} |
|
1266 |
||
1267 |
// -------------------------------------------------------------------------- |
|
1268 |
// CPbk2NamesListExView::ConfigurationChanged |
|
1269 |
// -------------------------------------------------------------------------- |
|
1270 |
// |
|
1271 |
void CPbk2NamesListExView::ConfigurationChanged() |
|
1272 |
{ |
|
1273 |
MVPbkContactStore* phoneStore = NULL; |
|
1274 |
||
1275 |
Reset(); |
|
1276 |
||
1277 |
if( iMyCard ) |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
1278 |
{ |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
1279 |
return; |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
1280 |
} |
63 | 1281 |
|
1282 |
if( FeatureManager::FeatureSupported( KFeatureIdffContactsMycard ) ) |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
1283 |
{ |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
1284 |
// Get the phoneStore for MyCard |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
1285 |
TRAP_IGNORE( phoneStore = iContactManager->ContactStoresL(). |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
1286 |
Find( VPbkContactStoreUris::DefaultCntDbUri() ) ); |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
1287 |
} |
63 | 1288 |
|
1289 |
if( !phoneStore ) |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
1290 |
{ |
63 | 1291 |
TRAP_IGNORE( iContactManager->LoadContactStoreL( |
1292 |
VPbkContactStoreUris::DefaultCntDbUri() ) ); |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
1293 |
} |
63 | 1294 |
} |
1295 |
||
1296 |
// -------------------------------------------------------------------------- |
|
1297 |
// CPbk2NamesListExView::ConfigurationChangedComplete |
|
1298 |
// -------------------------------------------------------------------------- |
|
1299 |
// |
|
1300 |
void CPbk2NamesListExView::ConfigurationChangedComplete() |
|
1301 |
{ |
|
1302 |
if ( iControl ) |
|
1303 |
{ |
|
1304 |
MVPbkContactViewBase* allContactsView = NULL; |
|
1305 |
||
1306 |
TRAPD( res, allContactsView = Phonebook2::Pbk2AppUi()-> |
|
1307 |
ApplicationServices().ViewSupplier().AllContactsViewL() ); |
|
1308 |
||
1309 |
if ( res == KErrNone ) |
|
1310 |
{ |
|
1311 |
TRAP( res, iControl->SetViewL( *allContactsView ) ); |
|
1312 |
iControl->DrawNow(); |
|
1313 |
} |
|
1314 |
||
1315 |
if ( res != KErrNone ) |
|
1316 |
{ |
|
1317 |
CCoeEnv::Static()->HandleError( res ); |
|
1318 |
iControl->Reset(); |
|
1319 |
} |
|
1320 |
} |
|
1321 |
} |
|
1322 |
||
1323 |
// -------------------------------------------------------------------------- |
|
1324 |
// CPbk2NamesListExView::PreCommandExecutionL |
|
1325 |
// -------------------------------------------------------------------------- |
|
1326 |
// |
|
1327 |
void CPbk2NamesListExView::PreCommandExecutionL |
|
1328 |
( const MPbk2Command& /*aCommand*/ ) |
|
1329 |
{ |
|
1330 |
iControl->AllowPointerEvents( EFalse ); |
|
1331 |
iCommandState = EFalse; |
|
1332 |
||
1333 |
if ( iControl ) |
|
1334 |
{ |
|
1335 |
// Note: PostCommandExecutionL() must match this if() |
|
1336 |
if ( iToolbar && NeedToHideToolbar(iCurrentCommandId) ) |
|
1337 |
{ |
|
1338 |
iToolbarVisible = iToolbar->IsShown(); |
|
1339 |
||
1340 |
// First hide the other components (FindBox etc.) |
|
1341 |
// No need to hide listbox and findbox for EPbk2CmdWriteNoQuery as |
|
1342 |
// it will go to Message view |
|
1343 |
if ( iCurrentCommandId != EPbk2CmdWriteNoQuery ) |
|
1344 |
{ |
|
1345 |
iControl->MakeVisible( EFalse ); |
|
1346 |
} |
|
1347 |
// Now hide toolbar items during the command execution... |
|
1348 |
iToolbar->HideItemsAndDrawOnlyBackground( ETrue ); |
|
1349 |
||
1350 |
// ..but don't save the state change |
|
1351 |
iIdleToolbarWarden->Cancel(); |
|
1352 |
} |
|
1353 |
||
1354 |
iControl->HideThumbnail(); |
|
1355 |
iControl->MassUpdateSkipProgressNote( ETrue ); |
|
1356 |
} |
|
1357 |
} |
|
1358 |
||
1359 |
// -------------------------------------------------------------------------- |
|
1360 |
// CPbk2NamesListExView::PostCommandExecutionL |
|
1361 |
// -------------------------------------------------------------------------- |
|
1362 |
// |
|
1363 |
void CPbk2NamesListExView::PostCommandExecutionL |
|
1364 |
( const MPbk2Command& /*aCommand*/ ) |
|
1365 |
{ |
|
1366 |
iCommandState = ETrue; |
|
1367 |
||
1368 |
if ( iControl ) |
|
1369 |
{ |
|
1370 |
iControl->MassUpdateSkipProgressNote( EFalse ); |
|
1371 |
||
1372 |
// There are some special cases that the names list view would be hide in backgroud |
|
1373 |
// before one command is executing, and then get foreground later after the command |
|
1374 |
// finished, which would cause the control to be set invisible. So reset the flag |
|
1375 |
// after a command is finished. |
|
1376 |
iCtrlVisibleStateBeforeLosingForground = ETrue; |
|
1377 |
||
1378 |
if( EPbk2CmdOpenCca == iCurrentCommandId ) |
|
1379 |
{ |
|
1380 |
iControl->SetOpeningCca( EFalse ); |
|
1381 |
} |
|
1382 |
||
1383 |
iControl->AllowPointerEvents( ETrue ); |
|
1384 |
iControl->ShowThumbnail(); |
|
1385 |
||
1386 |
TBool drawToolbar( EFalse ); |
|
1387 |
// Check the orientation of the screen. |
|
1388 |
const TBool isPortrait( Layout_Meta_Data::IsLandscapeOrientation() ? EFalse : ETrue ); |
|
1389 |
if ( isPortrait ) |
|
1390 |
{ |
|
1391 |
// If there is a menu shown do not draw the tool bar. It will be drawn |
|
1392 |
// once the dialog or menu disappears and an event is received from |
|
1393 |
// the control environment |
|
1394 |
CCoeAppUi* appUi = CCoeEnv::Static()->AppUi(); |
|
1395 |
||
1396 |
if ( NeedToHideToolbar(iCurrentCommandId) && |
|
1397 |
appUi && !appUi->IsDisplayingMenuOrDialog() ) |
|
1398 |
{ |
|
1399 |
drawToolbar = ETrue; |
|
1400 |
} |
|
1401 |
} |
|
1402 |
else |
|
1403 |
{ |
|
1404 |
// The orientation is landscape |
|
1405 |
drawToolbar = ETrue; |
|
1406 |
} |
|
1407 |
if ( iToolbar && drawToolbar ) |
|
1408 |
{ |
|
1409 |
// First show toolbar items |
|
1410 |
iToolbar->HideItemsAndDrawOnlyBackground( EFalse ); |
|
1411 |
||
1412 |
// Now show the other components (FindBox etc.) |
|
1413 |
// No need set the flag as it is not hidden. |
|
1414 |
if ( iCurrentCommandId != EPbk2CmdWriteNoQuery ) |
|
1415 |
{ |
|
1416 |
iControl->MakeVisible( ETrue ); |
|
1417 |
} |
|
1418 |
// Without the below lines the Toolbar is drawn |
|
1419 |
// above the Find box |
|
1420 |
iContainer->SetRect(iView.ClientRect()); |
|
1421 |
iControl->DrawNow(); |
|
1422 |
} |
|
1423 |
if ( EPbk2CmdCreateNew == iCurrentCommandId ) |
|
1424 |
{ |
|
1425 |
iControl->DrawDeferred(); |
|
1426 |
} |
|
1427 |
} |
|
1428 |
iCurrentCommandId = KErrNotFound; |
|
1429 |
UpdateCbasL(); |
|
1430 |
} |
|
1431 |
||
1432 |
// -------------------------------------------------------------------------- |
|
1433 |
// CPbk2NamesListExView::DynInitToolbarL |
|
1434 |
// -------------------------------------------------------------------------- |
|
1435 |
// |
|
1436 |
void CPbk2NamesListExView::DynInitToolbarL |
|
1437 |
( TInt aResourceId, CAknToolbar* aToolbar ) |
|
1438 |
{ |
|
1439 |
if ( aToolbar ) |
|
1440 |
{ |
|
1441 |
if ( iControl ) |
|
1442 |
{ |
|
1443 |
PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING |
|
1444 |
("CPbk2NamesListExView::DynInitToolbarL(0x%x) enable everything"), this); |
|
1445 |
// By default enable everything |
|
1446 |
aToolbar->SetItemDimmed( EPbk2CmdCall, EFalse, ETrue ); |
|
1447 |
aToolbar->SetItemDimmed( EPbk2CmdWriteNoQuery, EFalse, ETrue ); |
|
1448 |
aToolbar->SetItemDimmed( EPbk2CmdCreateNew, EFalse, ETrue ); |
|
1449 |
||
1450 |
// Forward to command handler |
|
1451 |
iCommandHandler->DynInitToolbarL |
|
1452 |
( aResourceId, aToolbar, iView, *iControl ); |
|
1453 |
} |
|
1454 |
else |
|
1455 |
{ |
|
1456 |
PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING |
|
1457 |
("CPbk2NamesListExView::DynInitToolbarL(0x%x) Disable all buttons"), this); |
|
1458 |
||
1459 |
// Disable all buttons if control has not yet been created |
|
1460 |
aToolbar->SetItemDimmed( EPbk2CmdCall, ETrue, ETrue ); |
|
1461 |
aToolbar->SetItemDimmed( EPbk2CmdWriteNoQuery, ETrue, ETrue ); |
|
1462 |
aToolbar->SetItemDimmed( EPbk2CmdCreateNew, ETrue, ETrue ); |
|
1463 |
} |
|
1464 |
} |
|
1465 |
} |
|
1466 |
||
1467 |
// -------------------------------------------------------------------------- |
|
1468 |
// CPbk2NamesListExView::OfferToolbarEventL |
|
1469 |
// -------------------------------------------------------------------------- |
|
1470 |
// |
|
1471 |
void CPbk2NamesListExView::OfferToolbarEventL |
|
1472 |
( TInt aCommand ) |
|
1473 |
{ |
|
1474 |
iCurrentCommandId = aCommand; |
|
1475 |
||
1476 |
if ( iControl ) |
|
1477 |
{ |
|
1478 |
// Forward to command handler |
|
1479 |
iCommandHandler->HandleCommandL( aCommand, *iControl, &iView ); |
|
1480 |
} |
|
1481 |
} |
|
1482 |
||
1483 |
// -------------------------------------------------------------------------- |
|
1484 |
// CPbk2NamesListExView::HandleControlEventL |
|
1485 |
// -------------------------------------------------------------------------- |
|
1486 |
// |
|
1487 |
void CPbk2NamesListExView::HandleControlEventL( |
|
1488 |
CCoeControl* aControl, |
|
1489 |
TCoeEvent aEventType ) |
|
1490 |
{ |
|
1491 |
if ( aControl == iToolbar ) |
|
1492 |
{ |
|
1493 |
// Forward control event to touch pane |
|
1494 |
CEikAppUiFactory* factory = new(ELeave) CEikAppUiFactory; |
|
1495 |
CleanupStack::PushL(factory); |
|
1496 |
CAknTouchPane* pane = factory->TouchPane(); |
|
1497 |
CleanupStack::PopAndDestroy(factory); |
|
1498 |
||
1499 |
if ( pane ) |
|
1500 |
{ |
|
1501 |
pane->HandleControlEventL( aControl, aEventType ); |
|
1502 |
if (!aControl->IsVisible() && iControl ) |
|
1503 |
{ |
|
1504 |
iControl->DrawDeferred(); |
|
1505 |
} |
|
1506 |
} |
|
1507 |
||
1508 |
if ( iControl ) |
|
1509 |
{ |
|
1510 |
// Forward event to view's control |
|
1511 |
iControl->HandleControlEventL( aControl, aEventType ); |
|
1512 |
} |
|
1513 |
||
1514 |
if ( aEventType == EEventStateChanged ) |
|
1515 |
{ |
|
1516 |
// Save state from idle callback. This gives possibility |
|
1517 |
// to prevent save if we are e.g. existing the view or just |
|
1518 |
// disabling the toolbar temporarily. |
|
1519 |
iIdleToolbarWarden->Cancel(); |
|
1520 |
iIdleToolbarWarden->Start( TCallBack( |
|
1521 |
( &CPbk2NamesListExView::IdleSaveToolbarStateL ), this ) ); |
|
1522 |
} |
|
1523 |
} |
|
1524 |
if ( aControl ==iControl && |
|
1525 |
aEventType == MCoeControlObserver::EEventStateChanged && |
|
1526 |
iCommandState ) |
|
1527 |
{ |
|
1528 |
// If the toolbar is not drawn for some reason, draw it here once |
|
1529 |
// view's control sends an event after updating itself |
|
1530 |
if ( iToolbar && !iToolbar->IsShown() ) |
|
1531 |
{ |
|
1532 |
// First show toolbar items |
|
1533 |
iToolbar->HideItemsAndDrawOnlyBackground( EFalse ); |
|
1534 |
||
1535 |
// Now show the other components (FindBox etc.) |
|
1536 |
// No need set the flag as it is not hide. |
|
1537 |
if ( iCurrentCommandId != EPbk2CmdWriteNoQuery ) |
|
1538 |
{ |
|
1539 |
iControl->MakeVisible( ETrue ); |
|
1540 |
} |
|
1541 |
||
1542 |
// Without the below lines the Toolbar is drawn |
|
1543 |
// above the Find box |
|
1544 |
iContainer->SetRect(iView.ClientRect()); |
|
1545 |
iControl->DrawNow(); |
|
1546 |
} |
|
1547 |
} |
|
1548 |
} |
|
1549 |
||
1550 |
//--------------------------------------------------------------------------- |
|
1551 |
// CPbk2NamesListExView::CreateControlsL |
|
1552 |
// -------------------------------------------------------------------------- |
|
1553 |
// |
|
1554 |
inline void CPbk2NamesListExView::CreateControlsL() |
|
1555 |
{ |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
1556 |
|
63 | 1557 |
if (!iContainer) |
1558 |
{ |
|
1559 |
PBK2_PROFILE_START(Pbk2Profile::ENamesListViewCreateControls); |
|
1560 |
// Create the container and control |
|
1561 |
PBK2_PROFILE_START(Pbk2Profile::ENamesListViewCreateContainer); |
|
1562 |
CContainer* container = CContainer::NewLC( &iView, &iView, iView ); |
|
1563 |
PBK2_PROFILE_END(Pbk2Profile::ENamesListViewCreateContainer); |
|
1564 |
||
1565 |
PBK2_PROFILE_START(Pbk2Profile::ENamesListViewSetHelpContext); |
|
1566 |
container->SetHelpContext( TCoeHelpContext( iView.ApplicationUid(), |
|
1567 |
KPHOB_HLP_NAME_LIST )); |
|
1568 |
PBK2_PROFILE_END(Pbk2Profile::ENamesListViewSetHelpContext); |
|
1569 |
||
1570 |
PBK2_PROFILE_START |
|
1571 |
( Pbk2Profile::ENamesListViewCreateNamesListControl ); |
|
1572 |
CPbk2NamesListControl* control = CPbk2NamesListControl::NewL( |
|
1573 |
R_PBK2_SPB_NAMES_LIST_EXTENSION_CONTROL, |
|
1574 |
container, |
|
1575 |
*iContactManager, |
|
1576 |
*Phonebook2::Pbk2AppUi()->ApplicationServices(). |
|
1577 |
ViewSupplier().AllContactsViewL(), |
|
1578 |
*iNameFormatter, |
|
1579 |
Phonebook2::Pbk2AppUi()->ApplicationServices().StoreProperties() ); |
|
1580 |
||
1581 |
PBK2_PROFILE_END |
|
1582 |
( Pbk2Profile::ENamesListViewCreateNamesListControl ); |
|
1583 |
||
1584 |
PBK2_PROFILE_START(Pbk2Profile::ENamesListViewSetControl); |
|
1585 |
container->SetControl(control, iView.ClientRect()); // takes ownership |
|
1586 |
container->AddForegroundObserver( control ); |
|
1587 |
control->AddObserverL(*this); |
|
1588 |
PBK2_PROFILE_END(Pbk2Profile::ENamesListViewSetControl); |
|
1589 |
||
1590 |
PBK2_PROFILE_START(Pbk2Profile::ENamesListViewAddToStack); |
|
1591 |
CCoeEnv::Static()->AppUi()->AddToStackL(iView, container); |
|
1592 |
PBK2_PROFILE_END(Pbk2Profile::ENamesListViewAddToStack); |
|
1593 |
CleanupStack::Pop(container); |
|
1594 |
iContainer = container; |
|
1595 |
iControl = control; |
|
1596 |
iControl->SetObserver(this); |
|
1597 |
iControlProxy->SetControl( iControl ); |
|
1598 |
iPointerEventInspector = control; |
|
1599 |
||
1600 |
// Add command item to container |
|
1601 |
AddCommandItemsToContainerL(); |
|
1602 |
PBK2_PROFILE_END(Pbk2Profile::ENamesListViewCreateControls); |
|
1603 |
} |
|
1604 |
} |
|
1605 |
||
1606 |
// -------------------------------------------------------------------------- |
|
1607 |
// CPbk2NamesListExView::StoreStateL |
|
1608 |
// -------------------------------------------------------------------------- |
|
1609 |
// |
|
1610 |
void CPbk2NamesListExView::StoreStateL() |
|
1611 |
{ |
|
1612 |
CPbk2ViewState* state = ViewStateLC(); |
|
1613 |
CleanupStack::Pop(state); |
|
1614 |
delete iControlState; |
|
1615 |
iControlState = state; |
|
1616 |
} |
|
1617 |
||
1618 |
// -------------------------------------------------------------------------- |
|
1619 |
// CPbk2NamesListExView::RestoreStateL |
|
1620 |
// -------------------------------------------------------------------------- |
|
1621 |
// |
|
1622 |
void CPbk2NamesListExView::RestoreStateL() |
|
1623 |
{ |
|
1624 |
iControl->RestoreControlStateL(iControlState); |
|
1625 |
// Parameter state overrides stored state |
|
1626 |
iControl->RestoreControlStateL(iParamState); |
|
1627 |
delete iControlState; |
|
1628 |
iControlState = NULL; |
|
1629 |
delete iParamState; |
|
1630 |
iParamState = NULL; |
|
1631 |
} |
|
1632 |
||
1633 |
// -------------------------------------------------------------------------- |
|
1634 |
// CPbk2NamesListExView::UpdateCbasL |
|
1635 |
// -------------------------------------------------------------------------- |
|
1636 |
// |
|
1637 |
void CPbk2NamesListExView::UpdateCbasL() |
|
1638 |
{ |
|
1639 |
if ( iControl ) |
|
1640 |
{ |
|
1641 |
TBool listContainsContacts = ( iControl->NumberOfContacts() > 0 ); |
|
1642 |
listContainsContacts = listContainsContacts || (iControl->CommandItemCount() > 0); |
|
1643 |
TBool contactsMarked = iControl->ContactsMarked(); |
|
1644 |
||
1645 |
if ( listContainsContacts && !contactsMarked ) |
|
1646 |
{ |
|
1647 |
//For command items msk is select |
|
1648 |
if( iControl->FocusedContactIndex() == KErrNotFound ) |
|
1649 |
{ |
|
1650 |
// Set middle softkey as select. |
|
1651 |
iView.Cba()->SetCommandSetL( R_PBK2_SOFTKEYS_OPTIONS_EXIT_SELECT ); |
|
1652 |
} |
|
1653 |
else |
|
1654 |
{ |
|
1655 |
// Set middle softkey as open cca. |
|
1656 |
iView.Cba()->SetCommandSetL( R_PBK2_SOFTKEYS_OPTIONS_EXIT_CONNECT ); |
|
1657 |
} |
|
1658 |
} |
|
1659 |
else if ( listContainsContacts && contactsMarked ) |
|
1660 |
{ |
|
1661 |
// Set middle softkey as Context Icon |
|
1662 |
iView.Cba()->SetCommandSetL( R_PBK2_SOFTKEYS_OPTIONS_EXIT_CONTEXT ); |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
1663 |
// Change context menu when marked items |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
1664 |
iView.MenuBar()->SetContextMenuTitleResourceId |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
1665 |
( R_PHONEBOOK2_NAMESLIST_CONTEXT_MENUBAR_ITEMS_MARKED ); |
63 | 1666 |
} |
1667 |
else // not listContainsContacts && not contactsMarked |
|
1668 |
{ |
|
1669 |
#ifndef ECE_DISABLE_CONTEXT_MENU |
|
1670 |
// Set middle softkey as Context Icon. |
|
1671 |
iView.Cba()->SetCommandSetL( R_PBK2_SOFTKEYS_OPTIONS_EXIT_CONTEXT ); |
|
1672 |
// Change context menu when nameslist is empty |
|
1673 |
iView.MenuBar()->SetContextMenuTitleResourceId |
|
1674 |
( R_PHONEBOOK2_NAMESLIST_CONTEXT_MENUBAR ); |
|
1675 |
#else |
|
1676 |
iView.Cba()->SetCommandSetL( R_PBK2_SOFTKEYS_OPTIONS_EXIT_EMPTY ); |
|
1677 |
#endif |
|
1678 |
} |
|
1679 |
iView.Cba()->DrawDeferred(); |
|
1680 |
} |
|
1681 |
||
1682 |
} |
|
1683 |
||
1684 |
// -------------------------------------------------------------------------- |
|
1685 |
// CPbk2NamesListExView::IdleSaveToolbarState |
|
1686 |
// -------------------------------------------------------------------------- |
|
1687 |
// |
|
1688 |
TInt CPbk2NamesListExView::IdleSaveToolbarStateL( TAny* aSelf ) |
|
1689 |
{ |
|
1690 |
CPbk2NamesListExView* self = |
|
1691 |
static_cast<CPbk2NamesListExView*>( aSelf ); |
|
1692 |
if ( AknLayoutUtils::PenEnabled() && self && self->iToolbar ) |
|
1693 |
{ |
|
1694 |
TBool shown = self->iToolbar->IsShown(); |
|
1695 |
self->ShowToolbarOnViewActivation( shown ); |
|
1696 |
||
1697 |
// Save state to central repository |
|
1698 |
CRepository* cenrep = |
|
1699 |
CRepository::NewLC( TUid::Uid( KCRUidPhonebook ) ); |
|
1700 |
User::LeaveIfError( |
|
1701 |
cenrep->Set( KPhonebookNamesListToolbarVisibility, shown ) ); |
|
1702 |
CleanupStack::PopAndDestroy( cenrep ); |
|
1703 |
} |
|
1704 |
return EFalse; // don't call again |
|
1705 |
} |
|
1706 |
||
1707 |
void CPbk2NamesListExView::ShowToolbarOnViewActivation(TBool aShown) |
|
1708 |
{ |
|
1709 |
iView.ShowToolbarOnViewActivation(aShown); |
|
1710 |
} |
|
1711 |
// -------------------------------------------------------------------------- |
|
1712 |
// CPbk2NamesListExView::AttachAIWProvidersL |
|
1713 |
// -------------------------------------------------------------------------- |
|
1714 |
// |
|
1715 |
inline void CPbk2NamesListExView::AttachAIWProvidersL() |
|
1716 |
{ |
|
1717 |
PBK2_PROFILE_START( Pbk2Profile::ENamesListAIWRegisterInterestCall ); |
|
1718 |
iCommandHandler->RegisterAiwInterestL |
|
1719 |
( KAiwCmdCall, R_PHONEBOOK2_CALL_MENU, |
|
1720 |
R_PHONEBOOK2_CALLUI_AIW_INTEREST, ETrue ); |
|
1721 |
PBK2_PROFILE_END( Pbk2Profile::ENamesListAIWRegisterInterestCall ); |
|
1722 |
||
1723 |
iCommandHandler->RegisterAiwInterestL |
|
1724 |
( KAiwCmdCall, R_PHONEBOOK2_STYLUS_CALL_MENU, |
|
1725 |
R_PHONEBOOK2_CALLUI_AIW_INTEREST, EFalse ); |
|
1726 |
||
1727 |
PBK2_PROFILE_START( Pbk2Profile::ENamesListAIWRegisterInterestPOC ); |
|
1728 |
iCommandHandler->RegisterAiwInterestL |
|
1729 |
( KAiwCmdPoC, R_PHONEBOOK2_POC_MENU, |
|
1730 |
R_PHONEBOOK2_POCUI_AIW_INTEREST, ETrue ); |
|
1731 |
PBK2_PROFILE_END( Pbk2Profile::ENamesListAIWRegisterInterestPOC ); |
|
1732 |
||
1733 |
PBK2_PROFILE_START( Pbk2Profile::ENamesListAIWRegisterInterestSyncML ); |
|
1734 |
iCommandHandler->RegisterAiwInterestL |
|
1735 |
( KAiwCmdSynchronize, R_PHONEBOOK2_SYNCML_MENU, |
|
1736 |
R_PHONEBOOK2_SYNCML_AIW_INTEREST, EFalse ); |
|
1737 |
PBK2_PROFILE_END( Pbk2Profile::ENamesListAIWRegisterInterestSyncML ); |
|
1738 |
iCommandHandler->RegisterAiwInterestL |
|
1739 |
( KOtasAiwCmdSynchronize, R_PHONEBOOK2_OVISYNC_MENU, |
|
1740 |
R_PHONEBOOK2_OVISYNC_AIW_INTEREST, ETrue ); |
|
1741 |
} |
|
1742 |
||
1743 |
// -------------------------------------------------------------------------- |
|
1744 |
// CPbk2NamesListExView::UpdateListEmptyTextL |
|
1745 |
// -------------------------------------------------------------------------- |
|
1746 |
// |
|
1747 |
void CPbk2NamesListExView::UpdateListEmptyTextL( |
|
1748 |
TInt aListState ) |
|
1749 |
{ |
|
1750 |
iListState = aListState; |
|
1751 |
||
1752 |
if ( !iIdleTexter ) |
|
1753 |
{ |
|
1754 |
iIdleTexter = CIdle::NewL( CActive::EPriorityStandard ); |
|
1755 |
} |
|
1756 |
||
1757 |
iIdleTexter->Cancel(); |
|
1758 |
iIdleTexter->Start( TCallBack( |
|
1759 |
( &CPbk2NamesListExView::IdleSetEmptyTextL ), this ) ); |
|
1760 |
} |
|
1761 |
||
1762 |
// -------------------------------------------------------------------------- |
|
1763 |
// CPbk2NamesListExView::HandleLongTapEventL |
|
1764 |
// -------------------------------------------------------------------------- |
|
1765 |
// |
|
1766 |
void CPbk2NamesListExView::HandleLongTapEventL( |
|
1767 |
const TPoint& /*aPenEventLocation*/, |
|
1768 |
const TPoint& /*aPenEventScreenLocation*/ ) |
|
1769 |
{ |
|
1770 |
//no implementation needed currently |
|
1771 |
} |
|
1772 |
||
1773 |
// -------------------------------------------------------------------------- |
|
1774 |
// CPbk2NamesListExView::Reset |
|
1775 |
// -------------------------------------------------------------------------- |
|
1776 |
// |
|
1777 |
void CPbk2NamesListExView::Reset() |
|
1778 |
{ |
|
1779 |
if ( iControl ) |
|
1780 |
{ |
|
1781 |
iControl->Reset(); |
|
1782 |
} |
|
1783 |
||
1784 |
delete iControlState; |
|
1785 |
iControlState = NULL; |
|
1786 |
delete iParamState; |
|
1787 |
iParamState = NULL; |
|
1788 |
} |
|
1789 |
||
1790 |
// -------------------------------------------------------------------------- |
|
1791 |
// CPbk2NamesListExView::IdleSetEmptyTextL |
|
1792 |
// -------------------------------------------------------------------------- |
|
1793 |
// |
|
1794 |
TInt CPbk2NamesListExView::IdleSetEmptyTextL( TAny* aSelf ) |
|
1795 |
{ |
|
1796 |
CPbk2NamesListExView* self = |
|
1797 |
static_cast<CPbk2NamesListExView*>( aSelf ); |
|
1798 |
||
1799 |
HBufC* text = NULL; |
|
1800 |
switch ( self->iListState ) |
|
1801 |
{ |
|
1802 |
case CPbk2NamesListControl::EStateEmpty: |
|
1803 |
case CPbk2NamesListControl::EStateNotReady: |
|
1804 |
{ |
|
1805 |
text = StringLoader::LoadLC( R_QTN_PHOB_NO_ENTRIES_LONG ); |
|
1806 |
||
1807 |
// Append secondary text |
|
1808 |
TInt secondaryTextId = R_QTN_PHOB_NO_ENTRIES_LONGER; |
|
1809 |
if ( self->iListState == CPbk2NamesListControl::EStateNotReady ) |
|
1810 |
{ |
|
1811 |
secondaryTextId = R_QTN_PHOB_STORES_NA; |
|
1812 |
} |
|
1813 |
_LIT( KNewline, "\n" ); |
|
1814 |
HBufC* secondaryText = StringLoader::LoadLC( secondaryTextId ); |
|
1815 |
TInt newLength = text->Length() |
|
1816 |
+ KNewline().Length() |
|
1817 |
+ secondaryText->Length(); |
|
1818 |
text = text->ReAllocL( newLength ); |
|
1819 |
TPtr ptr = text->Des(); |
|
1820 |
ptr.Append( KNewline ); |
|
1821 |
ptr.Append( *secondaryText ); |
|
1822 |
CleanupStack::PopAndDestroy( secondaryText ); |
|
1823 |
||
1824 |
// Fix text ptr in cleanup stack, see ReAllocL above |
|
1825 |
CleanupStack::Pop(); // text |
|
1826 |
CleanupStack::PushL( text ); |
|
1827 |
break; |
|
1828 |
} |
|
1829 |
case CPbk2NamesListControl::EStateReady: // FALLTHROUGH |
|
1830 |
case CPbk2NamesListControl::EStateFiltered: |
|
1831 |
{ |
|
1832 |
text = StringLoader::LoadLC( R_PBK2_FIND_NO_MATCHES ); |
|
1833 |
||
1834 |
if (self->iListState == CPbk2NamesListControl::EStateFiltered && |
|
1835 |
self->iControl->NumberOfContacts() == 0 && |
|
1836 |
self->iStylusPopupMenuLaunched |
|
1837 |
) |
|
1838 |
{ |
|
1839 |
self->iPopupMenu->RemoveMenuItem(EPbk2CmdAddToTopContacts); |
|
1840 |
self->iPopupMenu->RemoveMenuItem(EPbk2CmdRemoveFromTopContacts); |
|
1841 |
self->iPopupMenu->RemoveMenuItem(EPbk2CmdEditMe); |
|
1842 |
self->iPopupMenu->RemoveMenuItem(EPbk2CmdSend); |
|
1843 |
} |
|
1844 |
break; |
|
1845 |
} |
|
1846 |
default: |
|
1847 |
{ |
|
1848 |
text = KNullDesC().AllocLC(); |
|
1849 |
break; |
|
1850 |
} |
|
1851 |
} |
|
1852 |
if ( text ) |
|
1853 |
{ |
|
1854 |
self->iControl->SetTextL( *text ); |
|
1855 |
CleanupStack::PopAndDestroy( text ); |
|
1856 |
self->iControl->DrawDeferred(); |
|
1857 |
} |
|
1858 |
||
1859 |
return EFalse; // don't call again |
|
1860 |
} |
|
1861 |
||
1862 |
// -------------------------------------------------------------------------- |
|
1863 |
// CPbk2NamesListExView::NeedToHideToolbar |
|
1864 |
// -------------------------------------------------------------------------- |
|
1865 |
// |
|
1866 |
TBool CPbk2NamesListExView::NeedToHideToolbar(TInt aCurrentCommand) |
|
1867 |
{ |
|
1868 |
// before show new dialog or pop-up list, etc for the below commands, it is |
|
1869 |
// required to hide the toolbar, and retrieve it after command complete |
|
1870 |
if ( aCurrentCommand == EPbk2CmdCreateNew || |
|
1871 |
aCurrentCommand == EPbk2CmdWrite || |
|
1872 |
aCurrentCommand == EPbk2CmdAddFavourites || |
|
1873 |
aCurrentCommand == EPbk2CmdRcl || |
|
1874 |
aCurrentCommand == EPbk2CmdMoveInTopContactsList || |
|
1875 |
aCurrentCommand == EPbk2CmdEditMe || |
|
1876 |
aCurrentCommand == EPbk2CmdWriteNoQuery ) |
|
1877 |
{ |
|
1878 |
return ETrue; |
|
1879 |
} |
|
1880 |
else |
|
1881 |
{ |
|
1882 |
return EFalse; |
|
1883 |
} |
|
1884 |
} |
|
1885 |
||
1886 |
// -------------------------------------------------------------------------- |
|
1887 |
// CPbk2NamesListExView::IsPhoneMemoryUsedL |
|
1888 |
// -------------------------------------------------------------------------- |
|
1889 |
// |
|
1890 |
TBool CPbk2NamesListExView::IsPhoneMemoryUsedL() const |
|
85
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
1891 |
{ |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
1892 |
CPbk2ApplicationServices* appServices = CPbk2ApplicationServices::InstanceL(); |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
1893 |
|
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
1894 |
// Get current configuration |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
1895 |
CPbk2StoreConfiguration& storeConfig = appServices->StoreConfiguration(); |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
1896 |
|
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
1897 |
CVPbkContactStoreUriArray* uriArray = storeConfig.CurrentConfigurationL(); |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
1898 |
|
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
1899 |
TVPbkContactStoreUriPtr contactUri( VPbkContactStoreUris::DefaultCntDbUri() ); |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
1900 |
|
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
1901 |
// Check is phone memory included |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
1902 |
TBool phoneMemory = uriArray->IsIncluded( contactUri ); |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
1903 |
|
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
1904 |
delete uriArray; |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
1905 |
Release( appServices ); |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
1906 |
|
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
1907 |
return phoneMemory; |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
1908 |
} |
38bb213f60ba
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
1909 |
|
63 | 1910 |
// -------------------------------------------------------------------------- |
1911 |
// CPbk2NamesListExView::HandleGainingForeground |
|
1912 |
// -------------------------------------------------------------------------- |
|
1913 |
// |
|
1914 |
void CPbk2NamesListExView::HandleGainingForeground() |
|
1915 |
{ |
|
1916 |
// If the control state is not the same as the state before losing forground |
|
1917 |
// set it back to the state before losing forground. |
|
1918 |
if( iControl && ( ( iControl->IsVisible() && !iCtrlVisibleStateBeforeLosingForground ) || |
|
1919 |
( !iControl->IsVisible() && iCtrlVisibleStateBeforeLosingForground ) ) ) |
|
1920 |
{ |
|
1921 |
iControl->MakeVisible( iCtrlVisibleStateBeforeLosingForground ); |
|
1922 |
} |
|
1923 |
||
1924 |
// This flag is used to force the find box to be re-initialized when the application |
|
1925 |
// is back in the foreground. |
|
1926 |
iNeedSetFocus = ETrue; |
|
1927 |
} |
|
1928 |
||
1929 |
// -------------------------------------------------------------------------- |
|
1930 |
// CPbk2NamesListExView::HandleLosingForeground |
|
1931 |
// -------------------------------------------------------------------------- |
|
1932 |
// |
|
1933 |
void CPbk2NamesListExView::HandleLosingForeground() |
|
1934 |
{ |
|
1935 |
// If some command is executing now and control state is invisible. Set the control |
|
1936 |
// visible before it hide in background. |
|
1937 |
// To do this is because some special states, like creating new contact or |
|
1938 |
// creating new message, the iControl will be set invisible (In the function the control |
|
1939 |
// set invisible in the function PreCommandExecutionL which is to avoid displaying two |
|
1940 |
// find boxes after press the create new contact button). And during the command |
|
1941 |
// executing, set the control visible before it is hided into background.This is make |
|
1942 |
// sure that the control should be updated after it set foreground again. |
|
1943 |
if( iControl ) |
|
1944 |
{ |
|
1945 |
iCtrlVisibleStateBeforeLosingForground = iControl->IsVisible(); |
|
1946 |
if( !iCommandState && !iCtrlVisibleStateBeforeLosingForground ) |
|
1947 |
{ |
|
1948 |
iControl->MakeVisible( ETrue ); |
|
1949 |
} |
|
1950 |
} |
|
1951 |
||
1952 |
// This flag is used to force the find box to be re-initialized when the application |
|
1953 |
// is back in the foreground. |
|
1954 |
iNeedSetFocus = EFalse; |
|
1955 |
} |
|
1956 |
||
1957 |
// -------------------------------------------------------------------------- |
|
1958 |
// CPbk2NamesListExView::UIExtensionViewExtension |
|
1959 |
// -------------------------------------------------------------------------- |
|
1960 |
// |
|
1961 |
TAny* CPbk2NamesListExView::UIExtensionViewExtension( |
|
1962 |
TUid aExtensionUid ) |
|
1963 |
{ |
|
1964 |
if( aExtensionUid == KMPbk2UIExtensionView2Uid ) |
|
1965 |
{ |
|
1966 |
return static_cast<MPbk2UIExtensionView2*>( this ); |
|
1967 |
} |
|
1968 |
||
1969 |
return NULL; |
|
1970 |
} |
|
1971 |
||
1972 |
// -------------------------------------------------------------------------- |
|
1973 |
// CPbk2NamesListExView::HandleForegroundEventL |
|
1974 |
// -------------------------------------------------------------------------- |
|
1975 |
// |
|
1976 |
void CPbk2NamesListExView::HandleForegroundEventL(TBool aForeground) |
|
1977 |
{ |
|
1978 |
if ( iControl ) |
|
1979 |
{ |
|
1980 |
iControl->HandleViewForegroundEventL( aForeground ); |
|
1981 |
} |
|
1982 |
} |
|
1983 |
||
1984 |
// End of File |