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 "aiwtestappappui.h" |
|
21 #include "aiwtestappcontainer.h" |
|
22 #include "musmanager.h" |
|
23 #include <mustestapp.rsg> |
|
24 #include "aiwtestapp.hrh" |
|
25 #include "musresourceproperties.h" |
|
26 #include "musavainterface.h" |
|
27 #include "muscallmonitor.h" |
|
28 |
|
29 #include <e32property.h> |
|
30 #include <flogger.h> |
|
31 #include <e32math.h> |
|
32 |
|
33 #include <avkon.hrh> |
|
34 #include <aknutils.h> |
|
35 |
|
36 #include <aknmessagequerydialog.h> |
|
37 #include <aknquerydialog.h> |
|
38 |
|
39 #include <aiwservicehandler.h> |
|
40 |
|
41 // ================= MEMBER FUNCTIONS ======================= |
|
42 // |
|
43 // ---------------------------------------------------------- |
|
44 // CAiwTestAppUi::ConstructL() |
|
45 // |
|
46 // ---------------------------------------------------------- |
|
47 // |
|
48 void CAiwTestAppUi::ConstructL() |
|
49 { |
|
50 BaseConstructL(); |
|
51 |
|
52 iPlugin = NULL; |
|
53 |
|
54 // Creates a container object and adds it to the application's control stack. |
|
55 iAppContainer = new (ELeave) CAiwTestContainer; |
|
56 iAppContainer->SetMopParent( this ); |
|
57 iAppContainer->ConstructL( ClientRect() ); |
|
58 AddToStackL( iAppContainer ); |
|
59 |
|
60 // Create service handler instance. |
|
61 iServiceHandler = CAiwServiceHandler::NewL(); |
|
62 |
|
63 // Attach menu service interests to AIW framework. |
|
64 iServiceHandler->AttachMenuL(R_AIWTEST_MENU, R_AIWTESTAPP_INTEREST); |
|
65 //iServiceHandler->AttachMenuL(R_UMASETTINGS_MAIN_MENU, R_UMASETTINGSUI_INTEREST); |
|
66 |
|
67 // Attach base service interests to AIW framework. |
|
68 iServiceHandler->AttachL(R_AIWTESTAPP_BASEINTEREST); |
|
69 |
|
70 iManager = CMusManager::NewL(); |
|
71 |
|
72 RProperty::Define( NMusResourceApi::KCategoryUid, |
|
73 NMusResourceApi::KCameraAvailability, |
|
74 RProperty::EInt); |
|
75 |
|
76 // 2. keypad property |
|
77 RProperty::Define( NMusResourceApi::KCategoryUid, |
|
78 NMusResourceApi::KKeypadAvailability, |
|
79 RProperty::EInt ); |
|
80 |
|
81 // 3. video player property |
|
82 RProperty::Define( NMusResourceApi::KCategoryUid, |
|
83 NMusResourceApi::KVideoPlayerAvailability, |
|
84 RProperty::EInt |
|
85 ); |
|
86 |
|
87 RProperty::Set( NMusResourceApi::KCategoryUid, |
|
88 NMusResourceApi::KCameraAvailability, |
|
89 ( TInt ) NMusResourceApi::EAvailable ); |
|
90 |
|
91 // 2. keypad property |
|
92 RProperty::Set( NMusResourceApi::KCategoryUid, |
|
93 NMusResourceApi::KKeypadAvailability, |
|
94 ( TInt ) NMusResourceApi::EAvailable ); |
|
95 |
|
96 // 3. video player property |
|
97 RProperty::Set( NMusResourceApi::KCategoryUid, |
|
98 NMusResourceApi::KVideoPlayerAvailability, |
|
99 ( TInt ) NMusResourceApi::EAvailable ); |
|
100 |
|
101 // Next line is an example of how to use base service commands. |
|
102 //iServiceHandler->ExecuteServiceCmdL(4, iServiceHandler->InParamListL(), |
|
103 // iServiceHandler->OutParamListL()); |
|
104 } |
|
105 |
|
106 // ---------------------------------------------------- |
|
107 // CAiwTestAppUi::~CAiwTestAppUi() |
|
108 // Destructor |
|
109 // Frees reserved resources |
|
110 // ---------------------------------------------------- |
|
111 // |
|
112 CAiwTestAppUi::~CAiwTestAppUi() |
|
113 { |
|
114 delete iServiceHandler; |
|
115 |
|
116 if (iAppContainer) |
|
117 { |
|
118 RemoveFromStack( iAppContainer ); |
|
119 delete iAppContainer; |
|
120 } |
|
121 |
|
122 if ( iPlugin ) |
|
123 { |
|
124 iPlugin->StopL(); |
|
125 delete iPlugin; |
|
126 } |
|
127 |
|
128 iManager->StopApplicationL(); |
|
129 |
|
130 delete iManager; |
|
131 } |
|
132 |
|
133 // ------------------------------------------------------------------------------ |
|
134 // CAiwTestAppUi::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane) |
|
135 // This function is called by the EIKON framework just before it displays |
|
136 // a menu pane. Its default implementation is empty, and by overriding it, |
|
137 // the application can set the state of menu items dynamically according |
|
138 // to the state of application data. |
|
139 // ------------------------------------------------------------------------------ |
|
140 // |
|
141 void CAiwTestAppUi::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane) |
|
142 { |
|
143 if (iServiceHandler->HandleSubmenuL(*aMenuPane)) |
|
144 { |
|
145 return; |
|
146 } |
|
147 |
|
148 if (iServiceHandler->IsAiwMenu(aResourceId)) |
|
149 { |
|
150 TFileName filename(_L("image.jpg")); // This is just an axample of how to fill param list. |
|
151 TAiwVariant variant(filename); |
|
152 TAiwGenericParam param(EGenericParamFile, variant); |
|
153 CAiwGenericParamList& inList = iServiceHandler->InParamListL(); |
|
154 inList.AppendL(param); |
|
155 |
|
156 iServiceHandler->InitializeMenuPaneL(*aMenuPane, aResourceId, 5000, |
|
157 iServiceHandler->InParamListL()); |
|
158 } |
|
159 } |
|
160 |
|
161 // ---------------------------------------------------- |
|
162 // CAiwTestAppUi::HandleKeyEventL(const TKeyEvent& aKeyEvent, |
|
163 // TEventCode aType) |
|
164 // Takes care of key event handling. |
|
165 // ---------------------------------------------------- |
|
166 // |
|
167 TKeyResponse CAiwTestAppUi::HandleKeyEventL(const TKeyEvent& /*aKeyEvent*/, |
|
168 TEventCode /*aType*/) |
|
169 { |
|
170 return EKeyWasNotConsumed; |
|
171 } |
|
172 |
|
173 // ---------------------------------------------------- |
|
174 // CAiwTestAppUi::HandleCommandL(TInt aCommand) |
|
175 // Takes care of command handling. |
|
176 // ---------------------------------------------------- |
|
177 // |
|
178 void CAiwTestAppUi::HandleCommandL(TInt aCommand) |
|
179 { |
|
180 switch ( aCommand ) |
|
181 { |
|
182 case EAknSoftkeyBack: // fallthrough |
|
183 case EEikCmdExit: |
|
184 { |
|
185 RDebug::Print(_L("This is a debug message - Exit")); |
|
186 Exit(); |
|
187 break; |
|
188 } |
|
189 case EAiwTestAppCmdBATTest: |
|
190 { |
|
191 break; |
|
192 } |
|
193 case EAiwTestAppCmdCoreInfo: |
|
194 { |
|
195 break; |
|
196 } |
|
197 case EAiwTestAppCmdEngineInfo: |
|
198 { |
|
199 break; |
|
200 } |
|
201 case 1000: // 'Testi' menu item. |
|
202 { |
|
203 |
|
204 iManager->ExamineAvailabilityL(); |
|
205 } |
|
206 break; |
|
207 |
|
208 |
|
209 |
|
210 case 1001: |
|
211 { |
|
212 |
|
213 iManager->StartApplicationL( MultimediaSharing::EMusLiveVideo ); |
|
214 |
|
215 } |
|
216 break; |
|
217 case 1002: |
|
218 { |
|
219 iPlugin = CMusAvaInterface::NewL(); |
|
220 iPlugin->SetObserver( *this ); |
|
221 |
|
222 iPlugin->StartL(); |
|
223 //iCallMonitor = CMusCallMonitor::NewL( *this ); |
|
224 //iCallMonitor->StartMonitoringL(); |
|
225 |
|
226 |
|
227 |
|
228 } |
|
229 break; |
|
230 default: |
|
231 { |
|
232 |
|
233 |
|
234 CAiwGenericParamList& in = iServiceHandler->InParamListL(); |
|
235 // in.AppendL(param); |
|
236 |
|
237 // Executes menu service command. |
|
238 iServiceHandler->ExecuteMenuCmdL(aCommand, in, iServiceHandler->OutParamListL()); |
|
239 |
|
240 //CleanupStack::PopAndDestroy(2); |
|
241 } |
|
242 break; |
|
243 } |
|
244 } |
|
245 |
|
246 void CAiwTestAppUi::AvailabilityState( TAvailabilityState aState, |
|
247 TAvailabilityStatus aStatus, |
|
248 TAvailabilityName aName ) |
|
249 { |
|
250 if( aState == EMusAvaMinimum ) |
|
251 iMinimumStatus = aStatus; |
|
252 else if( aState == EMusAvaMandatory ) |
|
253 iMandatoryStatus = aStatus; |
|
254 else if( aState == EMusAvaExtension ) |
|
255 iExtensionStatus = aStatus; |
|
256 } |
|
257 |
|
258 |
|
259 void CAiwTestAppUi::StopComplete() |
|
260 { |
|
261 |
|
262 } |
|
263 |
|
264 |
|
265 // End of File |
|