|
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 "Search from Remote". |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "CPbk2CmdItemRemoteContactLookup.h" |
|
20 |
|
21 // Pbk2 |
|
22 #include "CPbk2RemoteContactLookupVisibility.h" |
|
23 #include <Pbk2Commands.hrh> |
|
24 #include <MPbk2AppUi.h> |
|
25 #include <Pbk2ExNamesListRes.rsg> |
|
26 |
|
27 // General |
|
28 #include <StringLoader.h> |
|
29 |
|
30 CPbk2CmdItemRemoteContactLookup* CPbk2CmdItemRemoteContactLookup::NewLC() |
|
31 { |
|
32 CPbk2CmdItemRemoteContactLookup* self = new (ELeave) CPbk2CmdItemRemoteContactLookup; |
|
33 CleanupStack::PushL( self ); |
|
34 self->ConstructL(); |
|
35 return self; |
|
36 } |
|
37 |
|
38 void CPbk2CmdItemRemoteContactLookup::ConstructL() |
|
39 { |
|
40 iRemoteContactLookupVisibility = |
|
41 CPbk2RemoteContactLookupVisibility::NewL(CommandId(), |
|
42 Phonebook2::Pbk2AppUi()->ApplicationServices()); |
|
43 |
|
44 // Formatting is automatically done by LoadL |
|
45 iText = StringLoader::LoadL( R_QTN_PHOB_SEARCH_FROM_REMOTE ); |
|
46 } |
|
47 |
|
48 CPbk2CmdItemRemoteContactLookup::CPbk2CmdItemRemoteContactLookup() |
|
49 { |
|
50 } |
|
51 |
|
52 CPbk2CmdItemRemoteContactLookup::~CPbk2CmdItemRemoteContactLookup() |
|
53 { |
|
54 delete iText; |
|
55 delete iRemoteContactLookupVisibility; |
|
56 } |
|
57 |
|
58 TPtrC CPbk2CmdItemRemoteContactLookup::NameForUi() const |
|
59 { |
|
60 return iText->Des(); |
|
61 } |
|
62 |
|
63 TBool CPbk2CmdItemRemoteContactLookup::IsEnabled() const |
|
64 { |
|
65 if(iRemoteContactLookupVisibility) |
|
66 { |
|
67 return iRemoteContactLookupVisibility->Visibility(); |
|
68 } |
|
69 else |
|
70 { |
|
71 return EFalse; |
|
72 } |
|
73 } |
|
74 |
|
75 void CPbk2CmdItemRemoteContactLookup::SetEnabled( TBool aEnabled ) |
|
76 { |
|
77 if(iRemoteContactLookupVisibility) |
|
78 { |
|
79 iRemoteContactLookupVisibility->SetVisibility( aEnabled ); |
|
80 } |
|
81 } |
|
82 |
|
83 TInt CPbk2CmdItemRemoteContactLookup::CommandId() const |
|
84 { |
|
85 return EPbk2CmdRcl; |
|
86 } |
|
87 |
|
88 void CPbk2CmdItemRemoteContactLookup::SetVisibilityObserver(MPbk2CmdItemVisibilityObserver* aObserver) |
|
89 { |
|
90 // iRemoteContactLookupVisibility can have only 1 observer |
|
91 // setting an observer again would panic |
|
92 if(iRemoteContactLookupVisibility) |
|
93 { |
|
94 iRemoteContactLookupVisibility->SetVisibilityObserver(aObserver); |
|
95 } |
|
96 } |
|
97 // end of file |