1 /* |
|
2 * Copyright (c) 2002-2005 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "cenrepeditorappui.h" |
|
21 #include "cenrepeditorview1.h" |
|
22 #include "cenrepeditorview2.h" |
|
23 #include "cenrepeditorview3.h" |
|
24 #include <cenrepeditor.rsg> |
|
25 #include "cenrepeditor.hrh" |
|
26 #include <flogger.h> |
|
27 #include <e32math.h> |
|
28 |
|
29 #include <avkon.hrh> |
|
30 #include <aknutils.h> |
|
31 |
|
32 #include <aknmessagequerydialog.h> |
|
33 #include <aknquerydialog.h> |
|
34 #include <aknnotewrappers.h> |
|
35 #include "musmanagercommon.h" |
|
36 #include <aiwservicehandler.h> |
|
37 |
|
38 // ================= MEMBER FUNCTIONS ======================= |
|
39 // |
|
40 // ---------------------------------------------------------- |
|
41 // CCenrepEditorAppUi::ConstructL() |
|
42 // |
|
43 // ---------------------------------------------------------- |
|
44 // |
|
45 void CCenrepEditorAppUi::ConstructL() |
|
46 { |
|
47 BaseConstructL(EAknEnableSkin); |
|
48 |
|
49 // Show tabs for main views from resources |
|
50 CEikStatusPane* sp = StatusPane(); |
|
51 sp->MakeVisible(ETrue); |
|
52 // Fetch pointer to the default navi pane control |
|
53 iNaviPane = (CAknNavigationControlContainer*)sp->ControlL( |
|
54 TUid::Uid(EEikStatusPaneUidNavi)); |
|
55 iNaviPane->MakeVisible(ETrue); |
|
56 |
|
57 // Tabgroup has been read from resource and it were pushed to the navi pane. |
|
58 // Get pointer to the navigation decorator with the ResourceDecorator() function. |
|
59 // Application owns the decorator and it has responsibility to delete the object. |
|
60 iDecoratedTabGroup = iNaviPane->ResourceDecorator(); |
|
61 iDecoratedTabGroup->MakeVisible(ETrue); |
|
62 if (iDecoratedTabGroup) |
|
63 { |
|
64 iTabGroup = (CAknTabGroup*) iDecoratedTabGroup->DecoratedControl(); |
|
65 } |
|
66 iPhoneResources = CPhoneResources::NewL(); |
|
67 iPhoneResources->ReadL(); |
|
68 |
|
69 CCenrepEditorView1* view1 = new (ELeave) CCenrepEditorView1; |
|
70 CleanupStack::PushL( view1 ); |
|
71 view1->ConstructL(); |
|
72 AddViewL( view1 ); // transfer ownership to CAknViewAppUi |
|
73 CleanupStack::Pop(); // view1 |
|
74 |
|
75 iOtherResources = COtherResources::NewL(); |
|
76 iOtherResources->ReadL(); |
|
77 |
|
78 CCenrepEditorView2* view2 = new (ELeave) CCenrepEditorView2; |
|
79 CleanupStack::PushL( view2 ); |
|
80 view2->ConstructL(); |
|
81 AddViewL( view2 ); // transfer ownership to CAknViewAppUi |
|
82 CleanupStack::Pop(); // view1 |
|
83 |
|
84 iMusApplication = CMusApplication::NewL(); |
|
85 CCenrepEditorView3* view3 = new (ELeave) CCenrepEditorView3; |
|
86 CleanupStack::PushL( view3 ); |
|
87 view3->ConstructL(); |
|
88 AddViewL( view3 ); // transfer ownership to CAknViewAppUi |
|
89 CleanupStack::Pop(); // view1 |
|
90 SetDefaultViewL(*view1); |
|
91 iTabGroup->SetActiveTabByIndex( 0); |
|
92 |
|
93 |
|
94 } |
|
95 |
|
96 // ---------------------------------------------------- |
|
97 // CCenrepEditorAppUi::~CCenrepEditorAppUi() |
|
98 // Destructor |
|
99 // Frees reserved resources |
|
100 // ---------------------------------------------------- |
|
101 // |
|
102 CCenrepEditorAppUi::~CCenrepEditorAppUi() |
|
103 { |
|
104 delete iPhoneResources; |
|
105 delete iOtherResources; |
|
106 delete iMusApplication; |
|
107 delete iDecoratedTabGroup; |
|
108 |
|
109 iDecoratedTabGroup=NULL; |
|
110 iNaviPane=NULL ; // not owned |
|
111 iTabGroup = NULL ; // not owned |
|
112 |
|
113 } |
|
114 |
|
115 // ------------------------------------------------------------------------------ |
|
116 // CCenrepEditorAppUi::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane) |
|
117 // This function is called by the EIKON framework just before it displays |
|
118 // a menu pane. Its default implementation is empty, and by overriding it, |
|
119 // the application can set the state of menu items dynamically according |
|
120 // to the state of application data. |
|
121 // ------------------------------------------------------------------------------ |
|
122 // |
|
123 void CCenrepEditorAppUi::DynInitMenuPaneL(TInt /*aResourceId*/, CEikMenuPane* /*aMenuPane*/) |
|
124 { |
|
125 |
|
126 } |
|
127 |
|
128 // ---------------------------------------------------- |
|
129 // CCenrepEditorAppUi::HandleKeyEventL(const TKeyEvent& aKeyEvent, |
|
130 // TEventCode aType) |
|
131 // Takes care of key event handling. |
|
132 // ---------------------------------------------------- |
|
133 // |
|
134 TKeyResponse CCenrepEditorAppUi::HandleKeyEventL(const TKeyEvent& aKeyEvent, |
|
135 TEventCode /*aType*/) |
|
136 { |
|
137 if ( iTabGroup == NULL ) |
|
138 { |
|
139 return EKeyWasNotConsumed; |
|
140 } |
|
141 |
|
142 TInt active = iTabGroup->ActiveTabIndex(); |
|
143 |
|
144 switch ( aKeyEvent.iCode ) |
|
145 { |
|
146 case EKeyLeftArrow: |
|
147 if ( active == 1 ) |
|
148 { |
|
149 iTabGroup->SetActiveTabByIndex( 0); |
|
150 ActivateLocalViewL(KViewId1); |
|
151 } |
|
152 else if ( active == 2 ) |
|
153 { |
|
154 iTabGroup->SetActiveTabByIndex( 1); |
|
155 ActivateLocalViewL(KViewId2); |
|
156 } |
|
157 break; |
|
158 case EKeyRightArrow: |
|
159 if( active == 0 ) |
|
160 { |
|
161 iTabGroup->SetActiveTabByIndex( 1 ); |
|
162 ActivateLocalViewL(KViewId2); |
|
163 } |
|
164 else if( active == 1 ) |
|
165 { |
|
166 iTabGroup->SetActiveTabByIndex( 2 ); |
|
167 ActivateLocalViewL(KViewId3); |
|
168 } |
|
169 break; |
|
170 default: |
|
171 return EKeyWasNotConsumed; |
|
172 } |
|
173 |
|
174 return EKeyWasConsumed; |
|
175 |
|
176 } |
|
177 |
|
178 // ---------------------------------------------------- |
|
179 // CCenrepEditorAppUi::HandleCommandL(TInt aCommand) |
|
180 // Takes care of command handling. |
|
181 // ---------------------------------------------------- |
|
182 // |
|
183 void CCenrepEditorAppUi::HandleCommandL(TInt aCommand) |
|
184 { |
|
185 switch ( aCommand ) |
|
186 { |
|
187 case EAknSoftKeyExit: // fallthrough |
|
188 case EEikCmdExit: |
|
189 { |
|
190 |
|
191 Exit(); |
|
192 break; |
|
193 } |
|
194 default: |
|
195 break; |
|
196 } |
|
197 } |
|
198 |
|
199 // ---------------------------------------------------- |
|
200 // CCenrepEditorAppUi::PhoneResouces() |
|
201 // Takes care of command handling. |
|
202 // ---------------------------------------------------- |
|
203 // |
|
204 CPhoneResources* CCenrepEditorAppUi::PhoneResouces() |
|
205 { |
|
206 return iPhoneResources; |
|
207 } |
|
208 |
|
209 // ---------------------------------------------------- |
|
210 // CCenrepEditorAppUi::OtherResouces() |
|
211 // Takes care of command handling. |
|
212 // ---------------------------------------------------- |
|
213 // |
|
214 COtherResources* CCenrepEditorAppUi::OtherResouces() |
|
215 { |
|
216 return iOtherResources; |
|
217 } |
|
218 |
|
219 // ---------------------------------------------------- |
|
220 // CCenrepEditorAppUi::MusApplication() |
|
221 // Takes care of command handling. |
|
222 // ---------------------------------------------------- |
|
223 // |
|
224 CMusApplication* CCenrepEditorAppUi::MusApplication() |
|
225 { |
|
226 return iMusApplication; |
|
227 } |
|
228 |
|
229 |
|
230 // End of File |
|