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 empty state.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
// INCLUDE FILES
|
|
20 |
#include "CPbk2NamesListEmptyState.h"
|
|
21 |
|
|
22 |
// Phonebook 2
|
|
23 |
#include "CPbk2ContactViewListBox.h"
|
|
24 |
#include "CPbk2ThumbnailLoader.h"
|
|
25 |
#include "CPbk2NamesListControl.h"
|
|
26 |
#include <Pbk2MenuFilteringFlags.hrh>
|
|
27 |
#include "PmuCommands.hrh" // For accessing EPmuCmdCascadingBackup
|
|
28 |
#include "Pbk2USimUI.hrh" // For accessing EPsu2CmdCascadingSimMemory
|
|
29 |
#include <Pbk2Commands.hrh>
|
|
30 |
#include <Pbk2InternalUID.h>
|
|
31 |
#include <pbk2doublelistboxcmditemextension.h>
|
|
32 |
|
|
33 |
// virtual phonebook
|
|
34 |
#include <CVPbkContactLinkArray.h>
|
|
35 |
#include <MVPbkContactLink.h>
|
|
36 |
|
|
37 |
// System includes
|
|
38 |
#include <eikmenup.h>
|
|
39 |
#include <aknsfld.h>
|
|
40 |
|
|
41 |
// Debugging headers
|
|
42 |
#include <Pbk2Debug.h>
|
|
43 |
|
|
44 |
#include <aknnavi.h>
|
|
45 |
#include <aknnavide.h>
|
|
46 |
#include <aknnavilabel.h>
|
|
47 |
|
|
48 |
|
|
49 |
/// Unnamed namespace for local definitions
|
|
50 |
namespace {
|
|
51 |
|
|
52 |
const TInt KNumberOfContacts = 0;
|
|
53 |
const TInt KNumberOfControls = 1;
|
|
54 |
|
|
55 |
} /// namespace
|
|
56 |
|
|
57 |
|
|
58 |
// --------------------------------------------------------------------------
|
|
59 |
// CPbk2NamesListEmptyState::CPbk2NamesListEmptyState
|
|
60 |
// --------------------------------------------------------------------------
|
|
61 |
//
|
|
62 |
inline CPbk2NamesListEmptyState::CPbk2NamesListEmptyState(
|
|
63 |
const CCoeControl* aParent,
|
|
64 |
CPbk2ContactViewListBox& aListBox,
|
|
65 |
CAknSearchField* aFindBox,
|
|
66 |
CPbk2ThumbnailLoader& aThumbnailLoader,
|
|
67 |
RPointerArray<MPbk2UiControlCmdItem>& aCommandItems ) :
|
|
68 |
iParent( *aParent ),
|
|
69 |
iListBox( aListBox ),
|
|
70 |
iFindBox( aFindBox ),
|
|
71 |
iThumbnailLoader( aThumbnailLoader ),
|
|
72 |
iCommandItems( aCommandItems )
|
|
73 |
{
|
|
74 |
}
|
|
75 |
|
|
76 |
// --------------------------------------------------------------------------
|
|
77 |
// CPbk2NamesListEmptyState::~CPbk2NamesListEmptyState
|
|
78 |
// --------------------------------------------------------------------------
|
|
79 |
//
|
|
80 |
CPbk2NamesListEmptyState::~CPbk2NamesListEmptyState()
|
|
81 |
{
|
|
82 |
}
|
|
83 |
|
|
84 |
// --------------------------------------------------------------------------
|
|
85 |
// CPbk2NamesListEmptyState::NewL
|
|
86 |
// --------------------------------------------------------------------------
|
|
87 |
//
|
|
88 |
CPbk2NamesListEmptyState* CPbk2NamesListEmptyState::NewLC
|
|
89 |
( const CCoeControl* aParent, CPbk2ContactViewListBox& aListBox,
|
|
90 |
CAknSearchField* aFindBox, CPbk2ThumbnailLoader& aThumbnailLoader,
|
|
91 |
RPointerArray<MPbk2UiControlCmdItem>& aCommandItems )
|
|
92 |
{
|
|
93 |
CPbk2NamesListEmptyState* self = new ( ELeave ) CPbk2NamesListEmptyState
|
|
94 |
( aParent, aListBox, aFindBox, aThumbnailLoader, aCommandItems );
|
|
95 |
CleanupStack::PushL( self );
|
|
96 |
return self;
|
|
97 |
}
|
|
98 |
|
|
99 |
|
|
100 |
// --------------------------------------------------------------------------
|
|
101 |
// CPbk2NamesListEmptyState::UnsubscribeCmdItemsVisibility
|
|
102 |
// --------------------------------------------------------------------------
|
|
103 |
//
|
|
104 |
void CPbk2NamesListEmptyState::UnsubscribeCmdItemsVisibility() const
|
|
105 |
{
|
|
106 |
for ( TInt i = 0; i < iCommandItems.Count(); ++i )
|
|
107 |
{
|
|
108 |
iCommandItems[i]->SetVisibilityObserver( NULL );
|
|
109 |
}
|
|
110 |
}
|
|
111 |
|
|
112 |
// --------------------------------------------------------------------------
|
|
113 |
// CPbk2NamesListEmptyState::SubscribeCmdItemsVisibility
|
|
114 |
// --------------------------------------------------------------------------
|
|
115 |
//
|
|
116 |
void CPbk2NamesListEmptyState::SubscribeCmdItemsVisibility()
|
|
117 |
{
|
|
118 |
for ( TInt i = 0; i < iCommandItems.Count(); ++i )
|
|
119 |
{
|
|
120 |
iCommandItems[i]->SetVisibilityObserver( this );
|
|
121 |
}
|
|
122 |
}
|
|
123 |
|
|
124 |
|
|
125 |
// --------------------------------------------------------------------------
|
|
126 |
// CPbk2NamesListEmptyState::ActivateStateL
|
|
127 |
// --------------------------------------------------------------------------
|
|
128 |
//
|
|
129 |
void CPbk2NamesListEmptyState::ActivateStateL()
|
|
130 |
{
|
|
131 |
AllowCommandsToShowThemselves( ETrue );
|
|
132 |
CPbk2NamesListControl& namesListControl =
|
|
133 |
reinterpret_cast<CPbk2NamesListControl&>(CoeControl());
|
|
134 |
if( namesListControl.GetMarkingMode() )
|
|
135 |
{
|
|
136 |
// If NamesListEmptyState and Marking mode are both active,
|
|
137 |
// the Marking mode should be canceled.
|
|
138 |
iListBox.SetMarkingMode(EFalse);
|
|
139 |
CEikonEnv* eikonEnv = CEikonEnv::Static();
|
|
140 |
if ( eikonEnv && eikonEnv->AppUiFactory() )
|
|
141 |
{
|
|
142 |
CEikStatusPane* statusPane = eikonEnv->AppUiFactory()->StatusPane();
|
|
143 |
if ( statusPane )
|
|
144 |
{
|
|
145 |
|
|
146 |
CAknNavigationControlContainer* naviPane =
|
|
147 |
(CAknNavigationControlContainer *)statusPane->ControlL(
|
|
148 |
TUid::Uid(EEikStatusPaneUidNavi));
|
|
149 |
CAknNavigationDecorator* decorator = naviPane->Top();
|
|
150 |
naviPane->Pop( decorator );
|
|
151 |
naviPane->DrawDeferred();
|
|
152 |
}
|
|
153 |
}
|
|
154 |
}
|
|
155 |
|
|
156 |
// hide findbox since there is no contact
|
|
157 |
if ( iFindBox && iFindBox->IsVisible() )
|
|
158 |
{
|
|
159 |
iFindBox->MakeVisible( EFalse );
|
|
160 |
}
|
|
161 |
|
|
162 |
}
|
|
163 |
|
|
164 |
// --------------------------------------------------------------------------
|
|
165 |
// CPbk2NamesListEmptyState::DeactivateState
|
|
166 |
// --------------------------------------------------------------------------
|
|
167 |
//
|
|
168 |
void CPbk2NamesListEmptyState::DeactivateState()
|
|
169 |
{
|
|
170 |
AllowCommandsToShowThemselves( EFalse );
|
|
171 |
|
|
172 |
if ( iFindBox && !iFindBox->IsFocused() )
|
|
173 |
{
|
|
174 |
iFindBox->SetFocus( ETrue );
|
|
175 |
}
|
|
176 |
}
|
|
177 |
|
|
178 |
// --------------------------------------------------------------------------
|
|
179 |
// CPbk2NamesListEmptyState::CountComponentControls
|
|
180 |
// --------------------------------------------------------------------------
|
|
181 |
//
|
|
182 |
TInt CPbk2NamesListEmptyState::CountComponentControls() const
|
|
183 |
{
|
|
184 |
return KNumberOfControls;
|
|
185 |
}
|
|
186 |
|
|
187 |
// --------------------------------------------------------------------------
|
|
188 |
// CPbk2NamesListEmptyState::ComponentControl
|
|
189 |
// --------------------------------------------------------------------------
|
|
190 |
//
|
|
191 |
CCoeControl* CPbk2NamesListEmptyState::ComponentControl
|
|
192 |
( TInt /*aIndex*/ ) const
|
|
193 |
{
|
|
194 |
return &iListBox;
|
|
195 |
}
|
|
196 |
|
|
197 |
// --------------------------------------------------------------------------
|
|
198 |
// CPbk2NamesListEmptyState::SizeChanged
|
|
199 |
// --------------------------------------------------------------------------
|
|
200 |
//
|
|
201 |
void CPbk2NamesListEmptyState::SizeChanged()
|
|
202 |
{
|
|
203 |
const TRect rect(iParent.Rect());
|
|
204 |
PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING
|
|
205 |
("CPbk2NamesListEmptyState::SizeChanged(0x%x), rect=(%d,%d,%d,%d)"),
|
|
206 |
this, rect.iTl.iX, rect.iTl.iY, rect.iBr.iX, rect.iBr.iY);
|
|
207 |
|
|
208 |
AknLayoutUtils::LayoutControl(&iListBox, rect,
|
|
209 |
AKN_LAYOUT_WINDOW_list_gen_pane(0));
|
|
210 |
}
|
|
211 |
|
|
212 |
// --------------------------------------------------------------------------
|
|
213 |
// CPbk2NamesListEmptyState::MakeComponentsVisible
|
|
214 |
// --------------------------------------------------------------------------
|
|
215 |
//
|
|
216 |
void CPbk2NamesListEmptyState::MakeComponentsVisible(TBool aVisible)
|
|
217 |
{
|
|
218 |
PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING
|
|
219 |
("CPbk2NamesListEmptyState::MakeComponentsVisible(0x%x,%d)"),
|
|
220 |
this, aVisible);
|
|
221 |
|
|
222 |
iListBox.MakeVisible(aVisible);
|
|
223 |
|
|
224 |
CEikScrollBar *scrollBar = iListBox.ScrollBarFrame()->GetScrollBarHandle
|
|
225 |
(CEikScrollBar::EVertical);
|
|
226 |
if ( scrollBar )
|
|
227 |
{
|
|
228 |
scrollBar->MakeVisible(aVisible);
|
|
229 |
}
|
|
230 |
}
|
|
231 |
|
|
232 |
// --------------------------------------------------------------------------
|
|
233 |
// CPbk2NamesListEmptyState::ActivateL
|
|
234 |
// --------------------------------------------------------------------------
|
|
235 |
//
|
|
236 |
void CPbk2NamesListEmptyState::ActivateL()
|
|
237 |
{
|
|
238 |
// Do nothing
|
|
239 |
}
|
|
240 |
|
|
241 |
// --------------------------------------------------------------------------
|
|
242 |
// CPbk2NamesListEmptyState::Draw
|
|
243 |
// --------------------------------------------------------------------------
|
|
244 |
//
|
|
245 |
void CPbk2NamesListEmptyState::Draw
|
|
246 |
(const TRect& aRect, CWindowGc& aGc) const
|
|
247 |
{
|
|
248 |
PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING(
|
|
249 |
"CPbk2NamesListEmptyState::Draw(0x%x, TRect(%d,%d,%d,%d))"),
|
|
250 |
this, aRect.iTl.iX, aRect.iTl.iY, aRect.iBr.iX, aRect.iBr.iY);
|
|
251 |
|
|
252 |
// Draw the skin background
|
|
253 |
MAknsSkinInstance* skin = AknsUtils::SkinInstance();
|
|
254 |
MAknsControlContext* cc =
|
|
255 |
AknsDrawUtils::ControlContext( &iListBox );
|
|
256 |
|
|
257 |
if ( !AknsDrawUtils::Background( skin, cc, &iListBox, aGc, aRect ) )
|
|
258 |
{
|
|
259 |
// Blank background if no skin present
|
|
260 |
aGc.SetPenStyle( CGraphicsContext::ENullPen );
|
|
261 |
aGc.SetBrushStyle( CGraphicsContext::ESolidBrush );
|
|
262 |
aGc.DrawRect( aRect );
|
|
263 |
}
|
|
264 |
}
|
|
265 |
|
|
266 |
// --------------------------------------------------------------------------
|
|
267 |
// CPbk2NamesListEmptyState::OfferKeyEventL
|
|
268 |
// --------------------------------------------------------------------------
|
|
269 |
//
|
|
270 |
TKeyResponse CPbk2NamesListEmptyState::OfferKeyEventL
|
|
271 |
(const TKeyEvent& aKeyEvent, TEventCode aType)
|
|
272 |
{
|
|
273 |
TKeyResponse result( EKeyWasNotConsumed );
|
|
274 |
// Offer the event to listbox
|
|
275 |
result = iListBox.OfferKeyEventL(aKeyEvent, aType);
|
|
276 |
return result;
|
|
277 |
}
|
|
278 |
|
|
279 |
// --------------------------------------------------------------------------
|
|
280 |
// CPbk2NamesListEmptyState::HandlePointerEventL
|
|
281 |
// --------------------------------------------------------------------------
|
|
282 |
//
|
|
283 |
void CPbk2NamesListEmptyState::HandlePointerEventL
|
|
284 |
( const TPointerEvent& aPointerEvent )
|
|
285 |
{
|
|
286 |
iListBox.HandlePointerEventL( aPointerEvent );
|
|
287 |
}
|
|
288 |
|
|
289 |
// --------------------------------------------------------------------------
|
|
290 |
// CPbk2NamesListEmptyState::NamesListState
|
|
291 |
// --------------------------------------------------------------------------
|
|
292 |
//
|
|
293 |
TInt CPbk2NamesListEmptyState::NamesListState() const
|
|
294 |
{
|
|
295 |
return CPbk2NamesListControl::EStateEmpty;
|
|
296 |
}
|
|
297 |
|
|
298 |
// --------------------------------------------------------------------------
|
|
299 |
// CPbk2NamesListEmptyState::HandleContactViewEventL
|
|
300 |
// --------------------------------------------------------------------------
|
|
301 |
//
|
|
302 |
void CPbk2NamesListEmptyState::HandleContactViewEventL
|
|
303 |
( TInt aEvent, TInt aIndex )
|
|
304 |
{
|
|
305 |
// need to calculate list index from contact
|
|
306 |
// view index
|
|
307 |
TInt listIndex = CommandItemCount() + aIndex;
|
|
308 |
HandleListboxEventL(aEvent, listIndex, EFalse );
|
|
309 |
}
|
|
310 |
|
|
311 |
// --------------------------------------------------------------------------
|
|
312 |
// CPbk2NamesListEmptyState::HandleCommandEventL
|
|
313 |
// --------------------------------------------------------------------------
|
|
314 |
//
|
|
315 |
void CPbk2NamesListEmptyState::HandleCommandEventL
|
|
316 |
(TInt aEvent, TInt /* aListboxIndex */)
|
|
317 |
{
|
|
318 |
HandleListboxEventL(aEvent, 0, ETrue );
|
|
319 |
}
|
|
320 |
|
|
321 |
// --------------------------------------------------------------------------
|
|
322 |
// CPbk2NamesListEmptyState::HandleListboxEventL
|
|
323 |
// --------------------------------------------------------------------------
|
|
324 |
//
|
|
325 |
void CPbk2NamesListEmptyState::HandleListboxEventL
|
|
326 |
(TInt aEvent, TInt aListboxIndex,
|
|
327 |
TBool /*aMantainFocus*/)
|
|
328 |
{
|
|
329 |
iListBox.HandleEventL( aEvent, aListboxIndex );
|
|
330 |
iParent.DrawDeferred();
|
|
331 |
}
|
|
332 |
// --------------------------------------------------------------------------
|
|
333 |
// CPbk2NamesListEmptyState::CoeControl
|
|
334 |
// --------------------------------------------------------------------------
|
|
335 |
//
|
|
336 |
CCoeControl& CPbk2NamesListEmptyState::CoeControl()
|
|
337 |
{
|
|
338 |
return const_cast<CCoeControl&>(iParent);
|
|
339 |
}
|
|
340 |
|
|
341 |
// --------------------------------------------------------------------------
|
|
342 |
// CPbk2NamesListEmptyState::HandleControlEventL
|
|
343 |
// --------------------------------------------------------------------------
|
|
344 |
//
|
|
345 |
void CPbk2NamesListEmptyState::HandleControlEventL( CCoeControl* /*aControl*/,
|
|
346 |
MCoeControlObserver::TCoeEvent /*aEventType*/, TInt /*aParam */)
|
|
347 |
{
|
|
348 |
// Do nothing in empty state
|
|
349 |
}
|
|
350 |
|
|
351 |
// --------------------------------------------------------------------------
|
|
352 |
// CPbk2NamesListEmptyState::TopContactL
|
|
353 |
// --------------------------------------------------------------------------
|
|
354 |
//
|
|
355 |
const MVPbkViewContact* CPbk2NamesListEmptyState::TopContactL()
|
|
356 |
{
|
|
357 |
return NULL;
|
|
358 |
}
|
|
359 |
|
|
360 |
// --------------------------------------------------------------------------
|
|
361 |
// CPbk2NamesListEmptyState::ParentControl
|
|
362 |
// --------------------------------------------------------------------------
|
|
363 |
//
|
|
364 |
MPbk2ContactUiControl* CPbk2NamesListEmptyState::ParentControl() const
|
|
365 |
{
|
|
366 |
// Names list control does not have a parent control
|
|
367 |
return NULL;
|
|
368 |
}
|
|
369 |
|
|
370 |
// --------------------------------------------------------------------------
|
|
371 |
// CPbk2NamesListEmptyState::NumberOfContacts
|
|
372 |
// --------------------------------------------------------------------------
|
|
373 |
//
|
|
374 |
TInt CPbk2NamesListEmptyState::NumberOfContacts() const
|
|
375 |
{
|
|
376 |
// The listbox can also have command items.
|
|
377 |
TInt result = iListBox.NumberOfItems() - CommandItemCount();
|
|
378 |
if ( result < 0 )
|
|
379 |
{
|
|
380 |
result = KNumberOfContacts; // No contacts
|
|
381 |
}
|
|
382 |
return result;
|
|
383 |
}
|
|
384 |
|
|
385 |
// --------------------------------------------------------------------------
|
|
386 |
// CPbk2NamesListEmptyState::FocusedContactL
|
|
387 |
// --------------------------------------------------------------------------
|
|
388 |
//
|
|
389 |
const MVPbkBaseContact* CPbk2NamesListEmptyState::FocusedContactL() const
|
|
390 |
{
|
|
391 |
return NULL;
|
|
392 |
}
|
|
393 |
|
|
394 |
// --------------------------------------------------------------------------
|
|
395 |
// CPbk2NamesListEmptyState::FocusedViewContactL
|
|
396 |
// --------------------------------------------------------------------------
|
|
397 |
//
|
|
398 |
const MVPbkViewContact* CPbk2NamesListEmptyState::FocusedViewContactL() const
|
|
399 |
{
|
|
400 |
return NULL;
|
|
401 |
}
|
|
402 |
|
|
403 |
// --------------------------------------------------------------------------
|
|
404 |
// CPbk2NamesListEmptyState::FocusedStoreContact
|
|
405 |
// --------------------------------------------------------------------------
|
|
406 |
//
|
|
407 |
const MVPbkStoreContact* CPbk2NamesListEmptyState::FocusedStoreContact() const
|
|
408 |
{
|
|
409 |
return NULL;
|
|
410 |
}
|
|
411 |
|
|
412 |
// --------------------------------------------------------------------------
|
|
413 |
// CPbk2NamesListEmptyState::SetFocusedContactL
|
|
414 |
// --------------------------------------------------------------------------
|
|
415 |
//
|
|
416 |
void CPbk2NamesListEmptyState::SetFocusedContactL
|
|
417 |
( const MVPbkBaseContact& /*aContact*/ )
|
|
418 |
{
|
|
419 |
// Do nothing
|
|
420 |
}
|
|
421 |
|
|
422 |
// --------------------------------------------------------------------------
|
|
423 |
// CPbk2NamesListEmptyState::SetFocusedContactL
|
|
424 |
// --------------------------------------------------------------------------
|
|
425 |
//
|
|
426 |
void CPbk2NamesListEmptyState::SetFocusedContactL
|
|
427 |
( const MVPbkContactBookmark& /*aContactBookmark*/ )
|
|
428 |
{
|
|
429 |
// Do nothing
|
|
430 |
}
|
|
431 |
|
|
432 |
// --------------------------------------------------------------------------
|
|
433 |
// CPbk2NamesListEmptyState::SetFocusedContactL
|
|
434 |
// --------------------------------------------------------------------------
|
|
435 |
//
|
|
436 |
void CPbk2NamesListEmptyState::SetFocusedContactL
|
|
437 |
( const MVPbkContactLink& /*aContactLink*/ )
|
|
438 |
{
|
|
439 |
// Do nothing
|
|
440 |
}
|
|
441 |
|
|
442 |
// --------------------------------------------------------------------------
|
|
443 |
// CPbk2NamesListEmptyState::FocusedContactIndex
|
|
444 |
// --------------------------------------------------------------------------
|
|
445 |
//
|
|
446 |
TInt CPbk2NamesListEmptyState::FocusedContactIndex() const
|
|
447 |
{
|
|
448 |
return KErrNotFound;
|
|
449 |
}
|
|
450 |
|
|
451 |
// --------------------------------------------------------------------------
|
|
452 |
// CPbk2NamesListEmptyState::SetFocusedContactIndex
|
|
453 |
// --------------------------------------------------------------------------
|
|
454 |
//
|
|
455 |
void CPbk2NamesListEmptyState::SetFocusedContactIndexL( TInt /*aIndex*/ )
|
|
456 |
{
|
|
457 |
// Do nothing
|
|
458 |
}
|
|
459 |
|
|
460 |
// --------------------------------------------------------------------------
|
|
461 |
// CPbk2NamesListEmptyState::NumberOfContactFields
|
|
462 |
// --------------------------------------------------------------------------
|
|
463 |
//
|
|
464 |
TInt CPbk2NamesListEmptyState::NumberOfContactFields() const
|
|
465 |
{
|
|
466 |
return KErrNotSupported;
|
|
467 |
}
|
|
468 |
|
|
469 |
// --------------------------------------------------------------------------
|
|
470 |
// CPbk2NamesListEmptyState::FocusedField
|
|
471 |
// --------------------------------------------------------------------------
|
|
472 |
//
|
|
473 |
const MVPbkBaseContactField* CPbk2NamesListEmptyState::FocusedField() const
|
|
474 |
{
|
|
475 |
return NULL;
|
|
476 |
}
|
|
477 |
|
|
478 |
// --------------------------------------------------------------------------
|
|
479 |
// CPbk2NamesListEmptyState::FocusedFieldIndex
|
|
480 |
// --------------------------------------------------------------------------
|
|
481 |
//
|
|
482 |
TInt CPbk2NamesListEmptyState::FocusedFieldIndex() const
|
|
483 |
{
|
|
484 |
return KErrNotFound;
|
|
485 |
}
|
|
486 |
|
|
487 |
// --------------------------------------------------------------------------
|
|
488 |
// CPbk2NamesListEmptyState::SetFocusedFieldIndex
|
|
489 |
// --------------------------------------------------------------------------
|
|
490 |
//
|
|
491 |
void CPbk2NamesListEmptyState::SetFocusedFieldIndex( TInt /*aIndex*/ )
|
|
492 |
{
|
|
493 |
// Do nothing
|
|
494 |
}
|
|
495 |
|
|
496 |
// --------------------------------------------------------------------------
|
|
497 |
// CPbk2NamesListEmptyState::ContactsMarked
|
|
498 |
// --------------------------------------------------------------------------
|
|
499 |
//
|
|
500 |
TBool CPbk2NamesListEmptyState::ContactsMarked() const
|
|
501 |
{
|
|
502 |
return EFalse;
|
|
503 |
}
|
|
504 |
|
|
505 |
// --------------------------------------------------------------------------
|
|
506 |
// CPbk2NamesListEmptyState::SelectedContactsL
|
|
507 |
// --------------------------------------------------------------------------
|
|
508 |
//
|
|
509 |
MVPbkContactLinkArray* CPbk2NamesListEmptyState::SelectedContactsL() const
|
|
510 |
{
|
|
511 |
return NULL;
|
|
512 |
}
|
|
513 |
|
|
514 |
// --------------------------------------------------------------------------
|
|
515 |
// CPbk2NamesListEmptyState::SelectedContactsOrFocusedContactL
|
|
516 |
// --------------------------------------------------------------------------
|
|
517 |
//
|
|
518 |
MVPbkContactLinkArray*
|
|
519 |
CPbk2NamesListEmptyState::SelectedContactsOrFocusedContactL() const
|
|
520 |
{
|
|
521 |
CVPbkContactLinkArray* array = NULL;
|
|
522 |
// my card is showing on empty list, check if the wanted contact is it
|
|
523 |
TInt currentItem = iListBox.CurrentItemIndex();
|
|
524 |
// if focused index is command item
|
|
525 |
if( currentItem < CommandItemCount() )
|
|
526 |
{
|
|
527 |
// check if the command is my card ( this search is copied from CommandItemAt - function to avoid const cast)
|
|
528 |
// Some of the commands might be disabled. Skip those.
|
|
529 |
TInt enabledCount = 0;
|
|
530 |
TInt indexOfResult = KErrNotFound;
|
|
531 |
for ( TInt n = 0; n < iCommandItems.Count() && indexOfResult == KErrNotFound; ++n )
|
|
532 |
{
|
|
533 |
if ( iCommandItems[ n ]->IsEnabled() )
|
|
534 |
{
|
|
535 |
enabledCount++;
|
|
536 |
if ( enabledCount-1 == currentItem )
|
|
537 |
{
|
|
538 |
indexOfResult = n;
|
|
539 |
}
|
|
540 |
}
|
|
541 |
}
|
|
542 |
MPbk2UiControlCmdItem* item = iCommandItems[ indexOfResult ];
|
|
543 |
// check if the command item was a my card
|
|
544 |
if( item->CommandId() == EPbk2CmdOpenMyCard )
|
|
545 |
{
|
|
546 |
// get extension point and my card link
|
|
547 |
TAny* object = item->ControlCmdItemExtension( TUid::Uid( KPbk2ControlCmdItemExtensionUID ) );
|
|
548 |
if( object )
|
|
549 |
{
|
|
550 |
MPbk2DoubleListboxCmdItemExtension* extension =
|
|
551 |
static_cast<MPbk2DoubleListboxCmdItemExtension*>( object );
|
|
552 |
// if extension exists
|
|
553 |
if( extension )
|
|
554 |
{
|
|
555 |
const MVPbkContactLink* link = extension->Link();
|
|
556 |
// if link exists, add it to the array
|
|
557 |
if( link )
|
|
558 |
{
|
|
559 |
array = CVPbkContactLinkArray::NewLC();
|
|
560 |
array->AppendL( link->CloneLC() );
|
|
561 |
CleanupStack::Pop( 2 ); // array, link
|
|
562 |
}
|
|
563 |
}
|
|
564 |
}
|
|
565 |
}
|
|
566 |
}
|
|
567 |
return array;
|
|
568 |
}
|
|
569 |
|
|
570 |
// --------------------------------------------------------------------------
|
|
571 |
// CPbk2NamesListEmptyState::SelectedContactsIteratorL
|
|
572 |
// --------------------------------------------------------------------------
|
|
573 |
//
|
|
574 |
MPbk2ContactLinkIterator*
|
|
575 |
CPbk2NamesListEmptyState::SelectedContactsIteratorL() const
|
|
576 |
{
|
|
577 |
return NULL;
|
|
578 |
}
|
|
579 |
|
|
580 |
// --------------------------------------------------------------------------
|
|
581 |
// CPbk2NamesListEmptyState::SelectedContactStoresL
|
|
582 |
// --------------------------------------------------------------------------
|
|
583 |
//
|
|
584 |
CArrayPtr<MVPbkContactStore>*
|
|
585 |
CPbk2NamesListEmptyState::SelectedContactStoresL() const
|
|
586 |
{
|
|
587 |
// This is not a state of the contact store control
|
|
588 |
return NULL;
|
|
589 |
}
|
|
590 |
|
|
591 |
// --------------------------------------------------------------------------
|
|
592 |
// CPbk2NamesListEmptyState::ClearMarks
|
|
593 |
// --------------------------------------------------------------------------
|
|
594 |
//
|
|
595 |
void CPbk2NamesListEmptyState::ClearMarks()
|
|
596 |
{
|
|
597 |
// Do nothing
|
|
598 |
}
|
|
599 |
|
|
600 |
// --------------------------------------------------------------------------
|
|
601 |
// CPbk2NamesListEmptyState::SetSelectedContactL
|
|
602 |
// --------------------------------------------------------------------------
|
|
603 |
//
|
|
604 |
void CPbk2NamesListEmptyState::SetSelectedContactL(
|
|
605 |
TInt /*aIndex*/, TBool /*aSelected*/)
|
|
606 |
{
|
|
607 |
// Do nothing
|
|
608 |
}
|
|
609 |
|
|
610 |
// --------------------------------------------------------------------------
|
|
611 |
// CPbk2NamesListEmptyState::SetSelectedContactL
|
|
612 |
// --------------------------------------------------------------------------
|
|
613 |
//
|
|
614 |
void CPbk2NamesListEmptyState::SetSelectedContactL(
|
|
615 |
const MVPbkContactBookmark& /*aContactBookmark*/,
|
|
616 |
TBool /*aSelected*/ )
|
|
617 |
{
|
|
618 |
// Do nothing
|
|
619 |
}
|
|
620 |
|
|
621 |
// --------------------------------------------------------------------------
|
|
622 |
// CPbk2NamesListEmptyState::SetSelectedContactL
|
|
623 |
// --------------------------------------------------------------------------
|
|
624 |
//
|
|
625 |
void CPbk2NamesListEmptyState::SetSelectedContactL(
|
|
626 |
const MVPbkContactLink& /*aContactLink*/,
|
|
627 |
TBool /*aSelected*/ )
|
|
628 |
{
|
|
629 |
// Do nothing
|
|
630 |
}
|
|
631 |
|
|
632 |
// --------------------------------------------------------------------------
|
|
633 |
// CPbk2NamesListEmptyState::CommandItemCount
|
|
634 |
// --------------------------------------------------------------------------
|
|
635 |
//
|
|
636 |
TInt CPbk2NamesListEmptyState::CommandItemCount() const
|
|
637 |
{
|
|
638 |
// Some of the commands might be disabled. Don't count those.
|
|
639 |
TInt enabledCommandCount = 0;
|
|
640 |
for ( TInt n = 0; n < iCommandItems.Count(); ++n )
|
|
641 |
{
|
|
642 |
if ( iCommandItems[ n ]->IsEnabled() )
|
|
643 |
{
|
|
644 |
enabledCommandCount++;
|
|
645 |
}
|
|
646 |
}
|
|
647 |
return enabledCommandCount;
|
|
648 |
}
|
|
649 |
|
|
650 |
// --------------------------------------------------------------------------
|
|
651 |
// CPbk2NamesListEmptyState::CommandItemAt
|
|
652 |
// --------------------------------------------------------------------------
|
|
653 |
//
|
|
654 |
const MPbk2UiControlCmdItem&
|
|
655 |
CPbk2NamesListEmptyState::CommandItemAt( TInt aIndex ) const
|
|
656 |
{
|
|
657 |
// Some of the commands might be disabled. Skip those.
|
|
658 |
TInt enabledCount = 0;
|
|
659 |
TInt indexOfResult = KErrNotFound;
|
|
660 |
for ( TInt n = 0; n < iCommandItems.Count()&& indexOfResult == KErrNotFound; ++n )
|
|
661 |
|
|
662 |
{
|
|
663 |
if ( iCommandItems[ n ]->IsEnabled() )
|
|
664 |
{
|
|
665 |
enabledCount++;
|
|
666 |
if ( enabledCount-1 == aIndex )
|
|
667 |
{
|
|
668 |
indexOfResult = n;
|
|
669 |
}
|
|
670 |
}
|
|
671 |
}
|
|
672 |
return *iCommandItems[ indexOfResult ];
|
|
673 |
}
|
|
674 |
|
|
675 |
// --------------------------------------------------------------------------
|
|
676 |
// CPbk2NamesListEmptyState::FocusedCommandItem
|
|
677 |
// --------------------------------------------------------------------------
|
|
678 |
//
|
|
679 |
const MPbk2UiControlCmdItem*
|
|
680 |
CPbk2NamesListEmptyState::FocusedCommandItem() const
|
|
681 |
{
|
|
682 |
const MPbk2UiControlCmdItem* cmdItem = NULL;
|
|
683 |
// Is the focus on a command item:
|
|
684 |
TInt focusListIndex = iListBox.CurrentItemIndex();
|
|
685 |
const TInt commandItemCount = CommandItemCount();
|
|
686 |
if ( focusListIndex != KErrNotFound && focusListIndex < commandItemCount )
|
|
687 |
{
|
|
688 |
// Yes it's a command item.
|
|
689 |
cmdItem = &CommandItemAt(focusListIndex);
|
|
690 |
}
|
|
691 |
return cmdItem;
|
|
692 |
}
|
|
693 |
|
|
694 |
// --------------------------------------------------------------------------
|
|
695 |
// CPbk2NamesListEmptyState::DeleteCommandItemL
|
|
696 |
// --------------------------------------------------------------------------
|
|
697 |
//
|
|
698 |
void CPbk2NamesListEmptyState::DeleteCommandItemL( TInt /*aIndex*/ )
|
|
699 |
{
|
|
700 |
// ownership & management of iCommandItems is wasted in names list
|
|
701 |
// control. Do nothing here
|
|
702 |
}
|
|
703 |
|
|
704 |
// --------------------------------------------------------------------------
|
|
705 |
// CPbk2NamesListEmptyState::AddCommandItemL
|
|
706 |
// --------------------------------------------------------------------------
|
|
707 |
//
|
|
708 |
void CPbk2NamesListEmptyState::AddCommandItemL(MPbk2UiControlCmdItem* /*aCommand*/, TInt /*aIndex*/)
|
|
709 |
{
|
|
710 |
// ownership & management of iCommandItems is wasted in names list
|
|
711 |
// control. Do nothing here
|
|
712 |
}
|
|
713 |
|
|
714 |
// --------------------------------------------------------------------------
|
|
715 |
// CPbk2NamesListEmptyState::DynInitMenuPaneL
|
|
716 |
// --------------------------------------------------------------------------
|
|
717 |
//
|
|
718 |
void CPbk2NamesListEmptyState::DynInitMenuPaneL(
|
|
719 |
TInt aResourceId, CEikMenuPane* aMenuPane) const
|
|
720 |
{
|
|
721 |
AknSelectionService::HandleMarkableListDynInitMenuPane
|
|
722 |
(aResourceId, aMenuPane, &iListBox);
|
|
723 |
|
|
724 |
//No contacts visible in this state
|
|
725 |
TInt pos; // Stores the position of the searched menu item.
|
|
726 |
// This position is not needed or used anywhere
|
|
727 |
|
|
728 |
if ( aMenuPane->MenuItemExists ( EAknCmdMarkingModeEnter, pos ) )
|
|
729 |
{
|
|
730 |
aMenuPane->SetItemDimmed( EAknCmdMarkingModeEnter, ETrue );
|
|
731 |
}
|
|
732 |
}
|
|
733 |
|
|
734 |
// --------------------------------------------------------------------------
|
|
735 |
// CPbk2NamesListEmptyState::ProcessCommandL
|
|
736 |
// --------------------------------------------------------------------------
|
|
737 |
//
|
|
738 |
void CPbk2NamesListEmptyState::ProcessCommandL
|
|
739 |
( TInt /*aCommandId*/ ) const
|
|
740 |
{
|
|
741 |
// Do nothing
|
|
742 |
}
|
|
743 |
|
|
744 |
// --------------------------------------------------------------------------
|
|
745 |
// CPbk2NamesListEmptyState::UpdateAfterCommandExecution
|
|
746 |
// --------------------------------------------------------------------------
|
|
747 |
//
|
|
748 |
void CPbk2NamesListEmptyState::UpdateAfterCommandExecution()
|
|
749 |
{
|
|
750 |
// Do nothing
|
|
751 |
}
|
|
752 |
|
|
753 |
// --------------------------------------------------------------------------
|
|
754 |
// CPbk2NamesListEmptyState::GetMenuFilteringFlagsL
|
|
755 |
// --------------------------------------------------------------------------
|
|
756 |
//
|
|
757 |
TInt CPbk2NamesListEmptyState::GetMenuFilteringFlagsL() const
|
|
758 |
{
|
|
759 |
return KPbk2MenuFilteringFlagsNone | KPbk2ListContainsNoMarkedItems;
|
|
760 |
}
|
|
761 |
|
|
762 |
|
|
763 |
// --------------------------------------------------------------------------
|
|
764 |
// CPbk2NamesListEmptyState::ControlStateL
|
|
765 |
// --------------------------------------------------------------------------
|
|
766 |
//
|
|
767 |
CPbk2ViewState* CPbk2NamesListEmptyState::ControlStateL() const
|
|
768 |
{
|
|
769 |
// State objects do not handle control state changes
|
|
770 |
return NULL;
|
|
771 |
}
|
|
772 |
|
|
773 |
// --------------------------------------------------------------------------
|
|
774 |
// CPbk2NamesListEmptyState::RestoreControlStateL
|
|
775 |
// --------------------------------------------------------------------------
|
|
776 |
//
|
|
777 |
void CPbk2NamesListEmptyState::RestoreControlStateL
|
|
778 |
( CPbk2ViewState* /*aState*/ )
|
|
779 |
{
|
|
780 |
// State objects do not handle control state changes
|
|
781 |
}
|
|
782 |
|
|
783 |
// --------------------------------------------------------------------------
|
|
784 |
// CPbk2NamesListEmptyState::FindTextL
|
|
785 |
// --------------------------------------------------------------------------
|
|
786 |
//
|
|
787 |
const TDesC& CPbk2NamesListEmptyState::FindTextL()
|
|
788 |
{
|
|
789 |
return KNullDesC;
|
|
790 |
}
|
|
791 |
|
|
792 |
// --------------------------------------------------------------------------
|
|
793 |
// CPbk2NamesListEmptyState::ResetFindL
|
|
794 |
// --------------------------------------------------------------------------
|
|
795 |
//
|
|
796 |
void CPbk2NamesListEmptyState::ResetFindL()
|
|
797 |
{
|
|
798 |
// Do nothing
|
|
799 |
}
|
|
800 |
|
|
801 |
// --------------------------------------------------------------------------
|
|
802 |
// CPbk2NamesListEmptyState::HideThumbnail
|
|
803 |
// --------------------------------------------------------------------------
|
|
804 |
//
|
|
805 |
void CPbk2NamesListEmptyState::HideThumbnail()
|
|
806 |
{
|
|
807 |
// Do nothing
|
|
808 |
}
|
|
809 |
|
|
810 |
// --------------------------------------------------------------------------
|
|
811 |
// CPbk2NamesListEmptyState::ShowThumbnail
|
|
812 |
// --------------------------------------------------------------------------
|
|
813 |
//
|
|
814 |
void CPbk2NamesListEmptyState::ShowThumbnail()
|
|
815 |
{
|
|
816 |
// Do nothing
|
|
817 |
}
|
|
818 |
|
|
819 |
// --------------------------------------------------------------------------
|
|
820 |
// CPbk2NamesListEmptyState::SetBlank
|
|
821 |
// --------------------------------------------------------------------------
|
|
822 |
//
|
|
823 |
void CPbk2NamesListEmptyState::SetBlank( TBool aBlank )
|
|
824 |
{
|
|
825 |
if (!aBlank)
|
|
826 |
{
|
|
827 |
// Redraw
|
|
828 |
iParent.DrawDeferred();
|
|
829 |
TRAPD( error, iListBox.UpdateScrollBarsL() );
|
|
830 |
if ( error != KErrNone )
|
|
831 |
{
|
|
832 |
CCoeEnv::Static()->HandleError( error );
|
|
833 |
}
|
|
834 |
}
|
|
835 |
}
|
|
836 |
|
|
837 |
// --------------------------------------------------------------------------
|
|
838 |
// CPbk2NamesListEmptyState::RegisterCommand
|
|
839 |
// --------------------------------------------------------------------------
|
|
840 |
//
|
|
841 |
void CPbk2NamesListEmptyState::RegisterCommand(
|
|
842 |
MPbk2Command* /*aCommand*/)
|
|
843 |
{
|
|
844 |
// Do nothing
|
|
845 |
}
|
|
846 |
|
|
847 |
// --------------------------------------------------------------------------
|
|
848 |
// CPbk2NamesListEmptyState::SetTextL
|
|
849 |
// --------------------------------------------------------------------------
|
|
850 |
//
|
|
851 |
void CPbk2NamesListEmptyState::SetTextL( const TDesC& aText )
|
|
852 |
{
|
|
853 |
iListBox.View()->SetListEmptyTextL( aText );
|
|
854 |
}
|
|
855 |
|
|
856 |
// --------------------------------------------------------------------------
|
|
857 |
// CPbk2NamesListEmptyState::ContactUiControlExtension
|
|
858 |
// --------------------------------------------------------------------------
|
|
859 |
//
|
|
860 |
TAny* CPbk2NamesListEmptyState::ContactUiControlExtension(TUid aExtensionUid )
|
|
861 |
{
|
|
862 |
if( aExtensionUid == KMPbk2ContactUiControlExtension2Uid )
|
|
863 |
{
|
|
864 |
return static_cast<MPbk2ContactUiControl2*>( this );
|
|
865 |
}
|
|
866 |
|
|
867 |
return NULL;
|
|
868 |
}
|
|
869 |
// --------------------------------------------------------------------------
|
|
870 |
// CPbk2NamesListEmptyState::FocusedItemPointed
|
|
871 |
// --------------------------------------------------------------------------
|
|
872 |
//
|
|
873 |
TBool CPbk2NamesListEmptyState::FocusedItemPointed()
|
|
874 |
{
|
|
875 |
return iListBox.FocusedItemPointed();
|
|
876 |
}
|
|
877 |
|
|
878 |
// --------------------------------------------------------------------------
|
|
879 |
// CPbk2NamesListEmptyState::FocusableItemPointed
|
|
880 |
// --------------------------------------------------------------------------
|
|
881 |
//
|
|
882 |
TBool CPbk2NamesListEmptyState::FocusableItemPointed()
|
|
883 |
{
|
|
884 |
return iListBox.FocusableItemPointed();
|
|
885 |
}
|
|
886 |
|
|
887 |
// --------------------------------------------------------------------------
|
|
888 |
// CPbk2NamesListEmptyState::SearchFieldPointed
|
|
889 |
// --------------------------------------------------------------------------
|
|
890 |
//
|
|
891 |
TBool CPbk2NamesListEmptyState::SearchFieldPointed()
|
|
892 |
{
|
|
893 |
return EFalse;
|
|
894 |
}
|
|
895 |
|
|
896 |
// --------------------------------------------------------------------------
|
|
897 |
// CPbk2NamesListEmptyState::TopViewChangedL
|
|
898 |
// --------------------------------------------------------------------------
|
|
899 |
//
|
|
900 |
void CPbk2NamesListEmptyState::TopViewChangedL(
|
|
901 |
MVPbkContactViewBase& /*aOldView*/ )
|
|
902 |
{
|
|
903 |
// Do nothing
|
|
904 |
}
|
|
905 |
|
|
906 |
// --------------------------------------------------------------------------
|
|
907 |
// CPbk2NamesListEmptyState::TopViewUpdatedL
|
|
908 |
// --------------------------------------------------------------------------
|
|
909 |
//
|
|
910 |
void CPbk2NamesListEmptyState::TopViewUpdatedL()
|
|
911 |
{
|
|
912 |
// Do nothing
|
|
913 |
}
|
|
914 |
|
|
915 |
// --------------------------------------------------------------------------
|
|
916 |
// CPbk2NamesListEmptyState::BaseViewChangedL
|
|
917 |
// --------------------------------------------------------------------------
|
|
918 |
//
|
|
919 |
void CPbk2NamesListEmptyState::BaseViewChangedL()
|
|
920 |
{
|
|
921 |
// Do nothing
|
|
922 |
}
|
|
923 |
|
|
924 |
// --------------------------------------------------------------------------
|
|
925 |
// CPbk2NamesListEmptyState::ViewStackError
|
|
926 |
// --------------------------------------------------------------------------
|
|
927 |
//
|
|
928 |
void CPbk2NamesListEmptyState::ViewStackError( TInt /*aError*/ )
|
|
929 |
{
|
|
930 |
// Do nothing
|
|
931 |
}
|
|
932 |
|
|
933 |
// --------------------------------------------------------------------------
|
|
934 |
// CPbk2NamesListEmptyState::ContactAddedToBaseView
|
|
935 |
// --------------------------------------------------------------------------
|
|
936 |
//
|
|
937 |
void CPbk2NamesListEmptyState::ContactAddedToBaseView(
|
|
938 |
MVPbkContactViewBase& /*aBaseView*/,
|
|
939 |
TInt /*aIndex*/,
|
|
940 |
const MVPbkContactLink& /*aContactLink*/ )
|
|
941 |
{
|
|
942 |
// Do nothing
|
|
943 |
}
|
|
944 |
|
|
945 |
// --------------------------------------------------------------------------
|
|
946 |
// CPbk2NamesListEmptyState::IsContactAtListboxIndex
|
|
947 |
// Tells whether the listbox line contains a contact or not.
|
|
948 |
// Does not check that the aListboxIndex is within range of listbox.
|
|
949 |
// --------------------------------------------------------------------------
|
|
950 |
//
|
|
951 |
TBool CPbk2NamesListEmptyState::IsContactAtListboxIndex( TInt aListboxIndex ) const
|
|
952 |
{
|
|
953 |
// There can be command items at the top of the list.
|
|
954 |
// The command items are not contacts.
|
|
955 |
const TInt enabledCommandCount = CommandItemCount();
|
|
956 |
return aListboxIndex >= enabledCommandCount;
|
|
957 |
}
|
|
958 |
|
|
959 |
// --------------------------------------------------------------------------
|
|
960 |
// CPbk2NamesListEmptyState::AllowCommandsToShowThemselves
|
|
961 |
// --------------------------------------------------------------------------
|
|
962 |
//
|
|
963 |
void CPbk2NamesListEmptyState::AllowCommandsToShowThemselves( TBool aVisible )
|
|
964 |
{
|
|
965 |
if ( aVisible )
|
|
966 |
{
|
|
967 |
// ownership not transferred
|
|
968 |
iListBox.SetListCommands( &iCommandItems );
|
|
969 |
SubscribeCmdItemsVisibility();
|
|
970 |
UpdateCommandEnabled( EPbk2CmdRcl, ETrue );
|
|
971 |
UpdateCommandEnabled( EPbk2CmdAddFavourites, EFalse );
|
|
972 |
//MyCard is stored separately and may also contain data
|
|
973 |
UpdateCommandEnabled( EPbk2CmdOpenMyCard, ETrue );
|
|
974 |
}
|
|
975 |
else
|
|
976 |
{
|
|
977 |
UnsubscribeCmdItemsVisibility();
|
|
978 |
iListBox.SetListCommands( NULL );
|
|
979 |
}
|
|
980 |
}
|
|
981 |
// --------------------------------------------------------------------------
|
|
982 |
// CPbk2NamesListEmptyState::CmdItemVisibilityChanged
|
|
983 |
// --------------------------------------------------------------------------
|
|
984 |
//
|
|
985 |
void CPbk2NamesListEmptyState::CmdItemVisibilityChanged( TInt aCmdItemId, TBool aVisible )
|
|
986 |
{
|
|
987 |
TInt cmdItemIndex = FindCommand(aCmdItemId);
|
|
988 |
TRAP_IGNORE(
|
|
989 |
// If command item is changed to be visible, set its hidden selection to ETrue.
|
|
990 |
if( aVisible )
|
|
991 |
{
|
|
992 |
TInt enableCmdCount = EnabledCommandCount();
|
|
993 |
TListItemProperties prop( iListBox.ItemDrawer()->Properties(enableCmdCount) );
|
|
994 |
prop.SetHiddenSelection(aVisible);
|
|
995 |
iListBox.ItemDrawer()->SetPropertiesL(enableCmdCount-1, prop);
|
|
996 |
}
|
|
997 |
|
|
998 |
HandleCommandEventL(
|
|
999 |
(aVisible ? EItemAdded : EItemRemoved),
|
|
1000 |
cmdItemIndex);
|
|
1001 |
);
|
|
1002 |
}
|
|
1003 |
|
|
1004 |
// --------------------------------------------------------------------------
|
|
1005 |
// CPbk2NamesListEmptyState::UpdateCommandEnabled
|
|
1006 |
// --------------------------------------------------------------------------
|
|
1007 |
//
|
|
1008 |
void CPbk2NamesListEmptyState::UpdateCommandEnabled( TInt aCommandId, TBool aEnabled )
|
|
1009 |
{
|
|
1010 |
for ( TInt i = 0; i < iCommandItems.Count(); i++ )
|
|
1011 |
{
|
|
1012 |
if ( iCommandItems[i]->CommandId() == aCommandId )
|
|
1013 |
{
|
|
1014 |
iCommandItems[i]->SetEnabled( aEnabled );
|
|
1015 |
break;
|
|
1016 |
}
|
|
1017 |
}
|
|
1018 |
}
|
|
1019 |
// --------------------------------------------------------------------------
|
|
1020 |
// CPbk2NamesListEmptyState::IsCommandEnabled
|
|
1021 |
// --------------------------------------------------------------------------
|
|
1022 |
//
|
|
1023 |
TBool CPbk2NamesListEmptyState::IsCommandEnabled(TInt aCommandId) const
|
|
1024 |
{
|
|
1025 |
TBool res = EFalse;
|
|
1026 |
for ( TInt i = 0; i < iCommandItems.Count(); i++ )
|
|
1027 |
{
|
|
1028 |
if ( iCommandItems[i]->CommandId() == aCommandId )
|
|
1029 |
{
|
|
1030 |
res = iCommandItems[i]->IsEnabled();
|
|
1031 |
break;
|
|
1032 |
}
|
|
1033 |
}
|
|
1034 |
return res;
|
|
1035 |
}
|
|
1036 |
|
|
1037 |
// --------------------------------------------------------------------------
|
|
1038 |
// CPbk2NamesListEmptyState::FindCommand
|
|
1039 |
// Search for a command in iCommandItems and returns its index
|
|
1040 |
// --------------------------------------------------------------------------
|
|
1041 |
//
|
|
1042 |
TInt CPbk2NamesListEmptyState::FindCommand(TInt aCommandId) const
|
|
1043 |
{
|
|
1044 |
TInt result = KErrNotFound;
|
|
1045 |
for ( TInt i = 0; i < iCommandItems.Count(); ++i )
|
|
1046 |
{
|
|
1047 |
if ( iCommandItems[i]->CommandId() == aCommandId )
|
|
1048 |
{
|
|
1049 |
result = i;
|
|
1050 |
break;
|
|
1051 |
}
|
|
1052 |
|
|
1053 |
}
|
|
1054 |
return result;
|
|
1055 |
}
|
|
1056 |
|
|
1057 |
// --------------------------------------------------------------------------
|
|
1058 |
// CPbk2NamesListEmptyState::CalculateListboxIndex
|
|
1059 |
// --------------------------------------------------------------------------
|
|
1060 |
//
|
|
1061 |
TInt CPbk2NamesListEmptyState::CalculateListboxIndex(TInt aCommandIndex) const
|
|
1062 |
{
|
|
1063 |
TInt num(KErrNotFound);
|
|
1064 |
for ( TInt i = 0; i < aCommandIndex; ++i )
|
|
1065 |
{
|
|
1066 |
if(iCommandItems[i]->IsEnabled())
|
|
1067 |
{
|
|
1068 |
++num;
|
|
1069 |
}
|
|
1070 |
}
|
|
1071 |
return num;
|
|
1072 |
}
|
|
1073 |
|
|
1074 |
// --------------------------------------------------------------------------
|
|
1075 |
// CPbk2NamesListEmptyState::UnmarkCommands
|
|
1076 |
// --------------------------------------------------------------------------
|
|
1077 |
//
|
|
1078 |
void CPbk2NamesListEmptyState::UnmarkCommands() const
|
|
1079 |
{
|
|
1080 |
for ( TInt i = 0; i < CommandItemCount(); i++ )
|
|
1081 |
{
|
|
1082 |
iListBox.View()->DeselectItem( i );
|
|
1083 |
}
|
|
1084 |
}
|
|
1085 |
|
|
1086 |
// --------------------------------------------------------------------------
|
|
1087 |
// CPbk2NamesListEmptyState::EnabledCommandCount
|
|
1088 |
// --------------------------------------------------------------------------
|
|
1089 |
//
|
|
1090 |
TInt CPbk2NamesListEmptyState::EnabledCommandCount() const
|
|
1091 |
{
|
|
1092 |
TInt result = 0;
|
|
1093 |
for ( TInt i = 0; i < iCommandItems.Count(); ++i )
|
|
1094 |
{
|
|
1095 |
if(iCommandItems[i]->IsEnabled())
|
|
1096 |
{
|
|
1097 |
result++;
|
|
1098 |
}
|
|
1099 |
}
|
|
1100 |
return result;
|
|
1101 |
}
|
|
1102 |
|
|
1103 |
// End of File
|