|
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 change view command. |
|
15 * |
|
16 */ |
|
17 |
|
18 // INCLUDE FILES |
|
19 #include "cpbk2activatecntinfoviewcmd.h" |
|
20 |
|
21 // Phonebook 2 |
|
22 #include <MPbk2ContactUiControl.h> |
|
23 #include <MPbk2ViewExplorer.h> |
|
24 #include <MPbk2CommandObserver.h> |
|
25 #include <CPbk2AppUiBase.h> |
|
26 #include <CPbk2ViewState.h> |
|
27 #include <CPbk2AppViewBase.h> |
|
28 |
|
29 // System includes |
|
30 #include <e32base.h> |
|
31 |
|
32 // -------------------------------------------------------------------------- |
|
33 // CPbk2ActivateCntInfoViewCmd::CPbk2ActivateCntInfoViewCmd |
|
34 // -------------------------------------------------------------------------- |
|
35 // |
|
36 inline CPbk2ActivateCntInfoViewCmd::CPbk2ActivateCntInfoViewCmd( |
|
37 MPbk2ContactUiControl& aUiControl ) |
|
38 { |
|
39 iControl = &aUiControl; |
|
40 } |
|
41 |
|
42 // -------------------------------------------------------------------------- |
|
43 // CPbk2ActivateCntInfoViewCmd::~CPbk2ActivateCntInfoViewCmd |
|
44 // -------------------------------------------------------------------------- |
|
45 // |
|
46 CPbk2ActivateCntInfoViewCmd::~CPbk2ActivateCntInfoViewCmd() |
|
47 { |
|
48 } |
|
49 |
|
50 // -------------------------------------------------------------------------- |
|
51 // CPbk2ActivateCntInfoViewCmd::NewL |
|
52 // -------------------------------------------------------------------------- |
|
53 // |
|
54 CPbk2ActivateCntInfoViewCmd* CPbk2ActivateCntInfoViewCmd::NewL( |
|
55 MPbk2ContactUiControl& aUiControl ) |
|
56 { |
|
57 CPbk2ActivateCntInfoViewCmd* self = |
|
58 new (ELeave) CPbk2ActivateCntInfoViewCmd( |
|
59 aUiControl ); |
|
60 CleanupStack::PushL(self); |
|
61 self->ConstructL(); |
|
62 CleanupStack::Pop(self); |
|
63 return self; |
|
64 } |
|
65 |
|
66 // -------------------------------------------------------------------------- |
|
67 // CPbk2ActivateCntInfoViewCmd::ConstructL |
|
68 // -------------------------------------------------------------------------- |
|
69 // |
|
70 void CPbk2ActivateCntInfoViewCmd::ConstructL() |
|
71 { |
|
72 iViewExplorer = Phonebook2::Pbk2AppUi()->Pbk2ViewExplorer(); |
|
73 } |
|
74 |
|
75 // -------------------------------------------------------------------------- |
|
76 // CPbk2ActivateCntInfoViewCmd::ExecuteLD |
|
77 // -------------------------------------------------------------------------- |
|
78 // |
|
79 void CPbk2ActivateCntInfoViewCmd::ExecuteLD() |
|
80 { |
|
81 CleanupStack::PushL(this); |
|
82 if ( iControl && !iControl->ContactsMarked()) |
|
83 { |
|
84 CPbk2ViewState* state = |
|
85 Phonebook2::Pbk2AppUi()->ActiveView()->ViewStateLC(); |
|
86 iViewExplorer->ActivatePhonebook2ViewL |
|
87 (Phonebook2::KPbk2ContactInfoViewUid, state); |
|
88 CleanupStack::PopAndDestroy(state); |
|
89 iControl->UpdateAfterCommandExecution(); |
|
90 } |
|
91 |
|
92 if (iCommandObserver) |
|
93 { |
|
94 iCommandObserver->CommandFinished(*this); |
|
95 } |
|
96 CleanupStack::Pop(); // this |
|
97 } |
|
98 |
|
99 // -------------------------------------------------------------------------- |
|
100 // CPbk2ActivateCntInfoViewCmd::AddObserver |
|
101 // -------------------------------------------------------------------------- |
|
102 // |
|
103 void CPbk2ActivateCntInfoViewCmd::AddObserver( MPbk2CommandObserver& aObserver ) |
|
104 { |
|
105 iCommandObserver = &aObserver; |
|
106 } |
|
107 |
|
108 // -------------------------------------------------------------------------- |
|
109 // CPbk2ActivateCntInfoViewCmd::ResetUiControl |
|
110 // -------------------------------------------------------------------------- |
|
111 // |
|
112 void CPbk2ActivateCntInfoViewCmd::ResetUiControl(MPbk2ContactUiControl& aUiControl) |
|
113 { |
|
114 if (iControl == &aUiControl) |
|
115 { |
|
116 iControl = NULL; |
|
117 } |
|
118 } |
|
119 |
|
120 // End of File |