|
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: UI control Command item for "Add to Top". |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "CPbk2CmdItemAddTop.h" |
|
20 |
|
21 // Pbk2 |
|
22 #include "CPbk2AddFavoritesVisibility.h" |
|
23 #include <Pbk2Commands.hrh> |
|
24 #include <MPbk2AppUi.h> |
|
25 #include <Pbk2InternalUID.h> |
|
26 #include "Pbk2NamesListExUID.h" |
|
27 #include <Pbk2ExNamesListRes.rsg> |
|
28 #include <TPbk2IconId.h> |
|
29 #include "pbk2nameslistexiconid.hrh" |
|
30 #include "pbk2contactuicontroldoublelistboxextension.h" |
|
31 |
|
32 // General |
|
33 #include <StringLoader.h> |
|
34 |
|
35 CPbk2CmdItemAddTop* CPbk2CmdItemAddTop::NewLC() |
|
36 { |
|
37 CPbk2CmdItemAddTop* self = new (ELeave) CPbk2CmdItemAddTop; |
|
38 CleanupStack::PushL( self ); |
|
39 self->ConstructL(); |
|
40 return self; |
|
41 } |
|
42 |
|
43 void CPbk2CmdItemAddTop::ConstructL() |
|
44 { |
|
45 iAddFavoritesVisibility = |
|
46 CPbk2AddFavoritesVisibility::NewL(CommandId(), |
|
47 Phonebook2::Pbk2AppUi()->ApplicationServices()); |
|
48 |
|
49 // Formatting is automatically done by LoadL |
|
50 iText = StringLoader::LoadL( R_QTN_PHOB_ADD_TOP_CONTACTS ); |
|
51 } |
|
52 |
|
53 CPbk2CmdItemAddTop::CPbk2CmdItemAddTop() |
|
54 { |
|
55 } |
|
56 |
|
57 CPbk2CmdItemAddTop::~CPbk2CmdItemAddTop() |
|
58 { |
|
59 delete iText; // Fix ETKI-7NADZC |
|
60 delete iAddFavoritesVisibility; |
|
61 } |
|
62 |
|
63 TPtrC CPbk2CmdItemAddTop::NameForUi() const |
|
64 { |
|
65 return iText->Des(); |
|
66 } |
|
67 |
|
68 TAny* CPbk2CmdItemAddTop::ControlCmdItemExtension( TUid aExtensionUid ) |
|
69 { |
|
70 if( aExtensionUid == TUid::Uid( KPbk2ControlCmdItemExtensionUID ) ) |
|
71 { |
|
72 return static_cast<MPbk2DoubleListboxCmdItemExtension*>( this ); |
|
73 } |
|
74 return NULL; |
|
75 } |
|
76 |
|
77 void CPbk2CmdItemAddTop::FormatDataL( MPbk2DoubleListboxDataElement& aDataElement ) |
|
78 { |
|
79 TPbk2IconId iconId ( TUid::Uid( KPbk2NamesListExtPluginUID2 ), |
|
80 EPbk2EceAddToFovoritesThumbnailIconId ); |
|
81 aDataElement.SetIconId( MPbk2DoubleListboxDataElement::EThumbnail, iconId ); |
|
82 } |
|
83 |
|
84 const MVPbkContactLink* CPbk2CmdItemAddTop::Link() |
|
85 { |
|
86 return NULL; |
|
87 } |
|
88 |
|
89 TBool CPbk2CmdItemAddTop::IsEnabled() const |
|
90 { |
|
91 return iAddFavoritesVisibility->Visibility(); |
|
92 } |
|
93 |
|
94 void CPbk2CmdItemAddTop::SetEnabled( TBool aEnabled ) |
|
95 { |
|
96 iAddFavoritesVisibility->SetVisibility( aEnabled ); |
|
97 } |
|
98 |
|
99 TInt CPbk2CmdItemAddTop::CommandId() const |
|
100 { |
|
101 return EPbk2CmdAddFavourites; |
|
102 } |
|
103 |
|
104 void CPbk2CmdItemAddTop::SetVisibilityObserver(MPbk2CmdItemVisibilityObserver* aObserver) |
|
105 { |
|
106 // iAddFavoritesVisibility can have only 1 observer |
|
107 // setting an observer again would panic |
|
108 iAddFavoritesVisibility->SetVisibilityObserver(aObserver); |
|
109 } |
|
110 // end of file |