|
1 /* |
|
2 * Copyright (c) 2008-2009 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: Implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 #include "glxfullscreenviewpluginbase.h" |
|
23 |
|
24 #include <glxcommandhandleraddtocontainer.h> |
|
25 #include <glxcommandhandleraiwassign.h> |
|
26 #include <glxcommandhandleraiwedit.h> |
|
27 #include <glxcommandhandlersave.h> |
|
28 #include <glxcommandhandleraiwprintpreview.h> |
|
29 #include <glxcommandhandleraiwshowmap.h> |
|
30 #include <glxcommandhandleraiwshareonovi.h> |
|
31 #include <glxcommandhandlerback.h> |
|
32 #include <glxcommandhandlerdelete.h> |
|
33 #include <glxcommandhandlerdetails.h> |
|
34 #include <glxcommandhandlerremovefrom.h> |
|
35 #include <glxcommandhandlerrotate.h> |
|
36 #include <glxcommandhandlerhideui.h> |
|
37 #include <glxcommandhandlerslideshow.h> |
|
38 #include <glxcommandhandlermarking.h> |
|
39 #include <glxcommandhandlerback.h> |
|
40 #include <mpxmediageneraldefs.h> |
|
41 #include <mpxcollectionutility.h> |
|
42 #include <mpxcollectionpath.h> |
|
43 #include <glxcommandhandlervideoplayback.h> |
|
44 #include <glxcommandhandlerupload.h> |
|
45 #include <glxcommandhandlermoreinfo.h> |
|
46 #include <glxtracer.h> |
|
47 #include <glxlog.h> |
|
48 #include <mpxcollectionpath.h> |
|
49 #include <mpxcollectionutility.h> |
|
50 #include <mpxmediageneraldefs.h> |
|
51 #include <glxcommandhandlersend.h> |
|
52 #include <glxcommandhandlershowviaupnp.h> //Command Handlers Upnp |
|
53 #include <glxcommandhandlerhelp.h> |
|
54 #include <glxcommandhandleraiwshowonmaphardkey.h> |
|
55 |
|
56 #include "glxfullscreenview.h" |
|
57 |
|
58 /** |
|
59 * Start Delay for the periodic timer, in microseconds |
|
60 */ |
|
61 const TInt KPeriodicStartDelay = 500000; |
|
62 |
|
63 // --------------------------------------------------------------------------- |
|
64 // C++ default constructor can NOT contain any code, that |
|
65 // might leave. |
|
66 // --------------------------------------------------------------------------- |
|
67 // |
|
68 EXPORT_C CGlxFullScreenViewPluginBase::CGlxFullScreenViewPluginBase() |
|
69 { |
|
70 TRACER("CGlxFullScreenViewPluginBase::CGlxFullScreenViewPluginBase()"); |
|
71 } |
|
72 |
|
73 // --------------------------------------------------------------------------- |
|
74 // Destructor |
|
75 // --------------------------------------------------------------------------- |
|
76 // |
|
77 EXPORT_C CGlxFullScreenViewPluginBase::~CGlxFullScreenViewPluginBase() |
|
78 { |
|
79 TRACER("CGlxFullScreenViewPluginBase::~CGlxFullScreenViewPluginBase()"); |
|
80 // Do nothing |
|
81 if ( iResourceOffset ) |
|
82 { |
|
83 CCoeEnv::Static()->DeleteResourceFile(iResourceOffset); |
|
84 } |
|
85 |
|
86 if (iPeriodic) |
|
87 { |
|
88 iPeriodic->Cancel(); |
|
89 delete iPeriodic; |
|
90 } |
|
91 } |
|
92 // ----------------------------------------------------------------------------- |
|
93 // Callback from periodic timer |
|
94 // ----------------------------------------------------------------------------- |
|
95 // |
|
96 TInt CGlxFullScreenViewPluginBase::PeriodicCallback(TAny* aPtr ) |
|
97 { |
|
98 //GLX_ASSERT_DEBUG( aPtr != NULL, Panic( EGlxPanicLogicError ), |
|
99 // "Received null pointer for garbage collector" ); |
|
100 |
|
101 // get "this" pointer |
|
102 static_cast< CGlxFullScreenViewPluginBase* >( aPtr )->PeriodicCallback(); |
|
103 |
|
104 return KErrNone; |
|
105 } |
|
106 |
|
107 // ----------------------------------------------------------------------------- |
|
108 // Callback from periodic timer, non-static |
|
109 // ----------------------------------------------------------------------------- |
|
110 // |
|
111 |
|
112 inline void CGlxFullScreenViewPluginBase::PeriodicCallback() |
|
113 { |
|
114 TRAP_IGNORE(AddCommandHandlersL()); |
|
115 iPeriodic->Cancel(); |
|
116 } |
|
117 |
|
118 // --------------------------------------------------------------------------- |
|
119 // From CMPXAknViewPlugin |
|
120 // Construct Avkon view. |
|
121 // --------------------------------------------------------------------------- |
|
122 // |
|
123 EXPORT_C CAknView* CGlxFullScreenViewPluginBase::ConstructViewLC() |
|
124 { |
|
125 GLX_LOG_INFO("=>CGlxFullScreenViewPluginBase::ConstructViewLC"); |
|
126 |
|
127 TFileName resFile; |
|
128 GetResourceFilenameL(resFile); |
|
129 |
|
130 if(resFile.Length() > 0) |
|
131 { |
|
132 iResourceOffset = CCoeEnv::Static()->AddResourceFileL(resFile); |
|
133 } |
|
134 |
|
135 CGlxFullScreenView* fullScreenView = CGlxFullScreenView::NewLC(this, |
|
136 iResourceIds, iViewUID); |
|
137 |
|
138 iFullScreenView = fullScreenView; |
|
139 |
|
140 //AddCommandHandlersL(); |
|
141 GLX_LOG_INFO("Adding CGlxCommandHandlerBack"); |
|
142 iFullScreenView->AddCommandHandlerL( |
|
143 CGlxCommandHandlerBack::NewPreviousViewCommandHandlerL()); |
|
144 |
|
145 if(!iPeriodic) |
|
146 { |
|
147 iPeriodic = CPeriodic::NewL(CActive::EPriorityStandard); |
|
148 } |
|
149 |
|
150 if ( !iPeriodic->IsActive() ) |
|
151 { |
|
152 iPeriodic->Start( KPeriodicStartDelay, KMaxTInt, TCallBack( &PeriodicCallback, |
|
153 static_cast<TAny*>( this ) ) ); |
|
154 } |
|
155 |
|
156 GLX_LOG_INFO("<=CGlxFullScreenViewPluginBase::ConstructViewLC"); |
|
157 // Return on cleanup stack with ownership passed |
|
158 return fullScreenView; |
|
159 } |
|
160 |
|
161 // --------------------------------------------------------------------------- |
|
162 // Add the command handlers |
|
163 // --------------------------------------------------------------------------- |
|
164 // |
|
165 EXPORT_C void CGlxFullScreenViewPluginBase::AddCommandHandlersL() |
|
166 { |
|
167 TRACER("CGlxFullScreenViewPluginBase::AddCommandHandlersL()"); |
|
168 |
|
169 // Note that the order in which the command handlers are added determines |
|
170 // the order in which the toolbar displays the icons |
|
171 |
|
172 GLX_LOG_INFO( "Adding CGlxCommandHandlerSave" ); |
|
173 iFullScreenView->AddCommandHandlerL( |
|
174 CGlxCommandHandlerSave::NewL( iFullScreenView, ETrue ) ); |
|
175 |
|
176 GLX_LOG_INFO( "Adding CGlxCommandHandlerSlideshow" ); |
|
177 iFullScreenView->AddCommandHandlerL( |
|
178 CGlxCommandHandlerSlideshow::NewL( iFullScreenView, ETrue , ETrue ) ); |
|
179 |
|
180 GLX_LOG_INFO("Adding CGlxCommandHandlerDetails"); |
|
181 iFullScreenView->AddCommandHandlerL(CGlxCommandHandlerDetails:: |
|
182 NewL(iFullScreenView)); |
|
183 |
|
184 // GLX_LOG_INFO("Adding CGlxCommandHandlerRotate"); |
|
185 // iFullScreenView->AddCommandHandlerL( |
|
186 // CGlxCommandHandlerRotate::NewL( iFullScreenView ) ); |
|
187 |
|
188 GLX_LOG_INFO("Adding CGlxCommandHandlerAddToContainer"); |
|
189 iFullScreenView->AddCommandHandlerL(CGlxCommandHandlerAddToContainer:: |
|
190 NewAddToAlbumCommandHandlerL(iFullScreenView, EFalse)); |
|
191 |
|
192 GLX_LOG_INFO("Adding CGlxCommandHandlerAddToContainer"); |
|
193 iFullScreenView->AddCommandHandlerL(CGlxCommandHandlerAddToContainer:: |
|
194 NewAddToFavCommandHandlerL(iFullScreenView, EFalse)); |
|
195 |
|
196 GLX_LOG_INFO("Adding CGlxCommandHandlerDetails"); |
|
197 iFullScreenView->AddCommandHandlerL(CGlxCommandHandlerDetails:: |
|
198 NewL(iFullScreenView)); |
|
199 |
|
200 GLX_LOG_INFO("Adding CGlxCommandHandlerAddToContainer"); |
|
201 iFullScreenView->AddCommandHandlerL(CGlxCommandHandlerAddToContainer:: |
|
202 NewAddToTagCommandHandlerL(iFullScreenView, EFalse)); |
|
203 // The AIW service handlers |
|
204 // ShowMap must be the first one |
|
205 GLX_LOG_INFO("Adding CGlxCommandHandlerAiwShowMap"); |
|
206 iFullScreenView->AddCommandHandlerL(CGlxCommandHandlerAiwShowMap:: |
|
207 NewL(iFullScreenView, iResourceIds.iMenuId)); |
|
208 // Assign must be the second one |
|
209 GLX_LOG_INFO("Adding CGlxCommandHandlerAiwAssign"); |
|
210 iFullScreenView->AddCommandHandlerL(CGlxCommandHandlerAiwAssign:: |
|
211 NewL(iFullScreenView, iResourceIds.iMenuId)); |
|
212 GLX_LOG_INFO("Adding CGlxCommandHandlerAiwEdit"); |
|
213 iFullScreenView->AddCommandHandlerL(CGlxCommandHandlerAiwEdit:: |
|
214 NewL(iFullScreenView, iResourceIds.iMenuId)); |
|
215 GLX_LOG_INFO("Adding CGlxCommandHandlerAiwPrintPreview"); |
|
216 iFullScreenView->AddCommandHandlerL(CGlxCommandHandlerAiwPrintPreview:: |
|
217 NewL(iFullScreenView, iResourceIds.iMenuId)); |
|
218 GLX_LOG_INFO("Adding CGlxCommandHandlerAiwShareOnOvi"); |
|
219 iFullScreenView->AddCommandHandlerL(CGlxCommandHandlerAiwShareOnOvi:: |
|
220 NewL(iFullScreenView, iResourceIds.iMenuId)); |
|
221 // End of AIW service handlers |
|
222 |
|
223 GLX_LOG_INFO("Adding CGlxCommandHandlerMoreInfo"); |
|
224 iFullScreenView->AddCommandHandlerL(CGlxCommandHandlerMoreInfo:: |
|
225 NewL(iFullScreenView,EFalse)); |
|
226 GLX_LOG_INFO("Adding CGlxCommandHandlerHideUi"); |
|
227 iFullScreenView->AddCommandHandlerL(CGlxCommandHandlerHideUi::NewL()); |
|
228 |
|
229 //Fix for error ID EVTY-7M87LF |
|
230 //@ Registration of Video Playback Command handler has to before UPnP. |
|
231 //@ else UPnP will not get play command once video playback command is consumed. |
|
232 GLX_LOG_INFO("Adding CGlxCommandHandlerVideoPlayback"); |
|
233 iFullScreenView->AddCommandHandlerL( |
|
234 CGlxCommandHandlerVideoPlayback::NewL( iFullScreenView ) ); |
|
235 |
|
236 //Fix for error ID EVTY-7M87LF |
|
237 //@ Registration of UPnP Command handler has to be after video play back command |
|
238 //@ priorty of command handling is last registered in first server basis. |
|
239 //@ UPnP will get play command first everytime, where it'll check for UPnP active. |
|
240 //@ if UPnP is active it'll consume the event, else it'll allow other registered command to execute it. |
|
241 |
|
242 GLX_LOG_INFO("Adding CGlxCommandHandlerShowVisUpnp"); |
|
243 iFullScreenView->AddCommandHandlerL(CGlxCommandHandlerShowViaUpnp::NewL( |
|
244 iFullScreenView,EFalse)); |
|
245 |
|
246 //Toolbar commands for all Fullscreen views. May also be present in Options menu. |
|
247 GLX_LOG_INFO("Adding CGlxCommandHandlerSend"); |
|
248 iFullScreenView->AddCommandHandlerL(CGlxCommandHandlerSend::NewL( |
|
249 iFullScreenView, ETrue)); |
|
250 GLX_LOG_INFO("Adding CGlxCommandHandlerDelete"); |
|
251 iFullScreenView->AddCommandHandlerL(CGlxCommandHandlerDelete:: |
|
252 NewL(iFullScreenView, EFalse, ETrue)); |
|
253 GLX_LOG_INFO("Adding CGlxCommandHandlerUpload"); |
|
254 iFullScreenView->AddCommandHandlerL(CGlxCommandHandlerUpload::NewL( |
|
255 iFullScreenView, ETrue)); |
|
256 |
|
257 GLX_LOG_INFO("Adding CGlxCommandHandlerAiwShowMapHardKey"); |
|
258 iFullScreenView->AddCommandHandlerL(CGlxCommandHandlerAiwShowMapHardKey::NewL( |
|
259 iFullScreenView, ETrue)); |
|
260 |
|
261 GLX_LOG_INFO("Adding CGlxCommandHandlerRemoveFrom"); |
|
262 iFullScreenView->AddCommandHandlerL(CGlxCommandHandlerRemoveFrom:: |
|
263 NewL(iFullScreenView, EMPXTag)); |
|
264 |
|
265 GLX_LOG_INFO("Adding CGlxCommandHandlerRemoveFromFavourites"); |
|
266 iFullScreenView->AddCommandHandlerL(CGlxCommandHandlerRemoveFrom:: |
|
267 NewRemFromFavCommandHandlerL(iFullScreenView )); |
|
268 |
|
269 } |
|
270 |
|
271 // --------------------------------------------------------------------------- |
|
272 // GetResourceFilenameL |
|
273 // --------------------------------------------------------------------------- |
|
274 // |
|
275 EXPORT_C void CGlxFullScreenViewPluginBase::GetResourceFilenameL(TFileName& aResFile) |
|
276 { |
|
277 TRACER("CGlxFullScreenViewPluginBase::GetResourceFilenameL()"); |
|
278 |
|
279 aResFile = KNullDesC; |
|
280 } |
|
281 |
|
282 // End of File |