|
1 /* |
|
2 * Copyright (c) 2008 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 the License "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: My Videos UI main view.* |
|
15 */ |
|
16 |
|
17 |
|
18 // Version : %version: 49 % |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <bldvariant.hrh> |
|
22 #include <aknViewAppUi.h> |
|
23 #include <avkon.hrh> |
|
24 #include <StringLoader.h> |
|
25 #include <coeaui.h> |
|
26 #include <aknnotewrappers.h> |
|
27 #include <hlplch.h> |
|
28 #include <apgcli.h> // RApaLsSession |
|
29 #include <apacmdln.h> // CApaCommandLine |
|
30 |
|
31 #include <AknsBasicBackgroundControlContext.h> |
|
32 #include <ganes/HgDoubleTextList.h> |
|
33 #include <ganes/HgDoubleGraphicList.h> |
|
34 |
|
35 #include "IptvDebug.h" |
|
36 #include "CIptvResourceLoader.h" |
|
37 #include <vcxhgmyvideos.rsg> |
|
38 |
|
39 #include "vcxhgmyvideosmodel.h" |
|
40 #include "vcxhgmyvideosmainview.h" |
|
41 #include "vcxhgmyvideosmainviewcontainer.h" |
|
42 #include "vcxhgmyvideoscategorylistimpl.h" |
|
43 #include "vcxhgmyvideosvideolistimpl.h" |
|
44 #include "vcxhgmyvideosvideomodelhandler.h" |
|
45 #include "vcxhgmyvideos.hrh" |
|
46 #include "vcxhgmyvideosmemorystatus.h" |
|
47 #include "vcxhgmyvideosvideodetailsdialog.h" |
|
48 #include "vcxhgmyvideosupnpinterface.h" |
|
49 |
|
50 // CONSTANTS |
|
51 _LIT( KVcxHgMyVideosMainViewResFile, "\\resource\\apps\\vcxhgmyvideos." ); |
|
52 |
|
53 const TUint32 KVcxHgMyVideosViewUid = 0x20021191; |
|
54 const TUid KMediaSettingsAppUid = { 0x10005A3F }; |
|
55 const TUid KBrowserAppUid = { 0x10008D39 }; |
|
56 |
|
57 const TInt KVcxHgMyVideosUrlMaxLen = 1024; |
|
58 |
|
59 _LIT( KBrowserProtocol, "4 " ); |
|
60 |
|
61 // URL to Ovi Store videos. If Ovi Store Launcher is not installed, this |
|
62 // address will be opened to web browser. |
|
63 _LIT( KOviVideoStoreURL, "http://lr.ovi.mobi/store/video" ); |
|
64 |
|
65 // ============================ MEMBER FUNCTIONS =============================== |
|
66 |
|
67 // ----------------------------------------------------------------------------- |
|
68 // CVcxHgMyVideosMainView::CVcxHgMyVideosMainView() |
|
69 // ----------------------------------------------------------------------------- |
|
70 // |
|
71 CVcxHgMyVideosMainView::CVcxHgMyVideosMainView() |
|
72 { |
|
73 IPTVLOGSTRING_LOW_LEVEL( |
|
74 "MPX My Videos UI # ----------- MPX My Videos UI starting -----------" ); |
|
75 } |
|
76 |
|
77 // ----------------------------------------------------------------------------- |
|
78 // CVcxHgMyVideosMainView::NewL() |
|
79 // ----------------------------------------------------------------------------- |
|
80 // |
|
81 EXPORT_C CVcxHgMyVideosMainView* CVcxHgMyVideosMainView::NewL() |
|
82 { |
|
83 CVcxHgMyVideosMainView* self = |
|
84 CVcxHgMyVideosMainView::NewLC(); |
|
85 CleanupStack::Pop( self ); |
|
86 return self; |
|
87 } |
|
88 |
|
89 // ----------------------------------------------------------------------------- |
|
90 // CVcxHgMyVideosMainView::NewLC() |
|
91 // ----------------------------------------------------------------------------- |
|
92 // |
|
93 EXPORT_C CVcxHgMyVideosMainView* CVcxHgMyVideosMainView::NewLC() |
|
94 { |
|
95 CVcxHgMyVideosMainView* self = |
|
96 new (ELeave) CVcxHgMyVideosMainView(); |
|
97 CleanupStack::PushL( self ); |
|
98 self->ConstructL(); |
|
99 return self; |
|
100 } |
|
101 |
|
102 // ----------------------------------------------------------------------------- |
|
103 // CVcxHgMyVideosMainView::ConstructL() |
|
104 // ----------------------------------------------------------------------------- |
|
105 // |
|
106 void CVcxHgMyVideosMainView::ConstructL() |
|
107 { |
|
108 IPTVLOGSTRING_LOW_LEVEL( |
|
109 "MPX My Videos UI # CVcxHgMyVideosMainView::ConstructL: Entered." ); |
|
110 |
|
111 iResourceLoader = CIptvResourceLoader::NewL( *iCoeEnv ); |
|
112 iResourceLoader->AddResourceL( KVcxHgMyVideosMainViewResFile ); |
|
113 |
|
114 BaseConstructL( R_VCXHGMYVIDEOS_MAINVIEW ); |
|
115 |
|
116 // Create component model. |
|
117 iModel = CVcxHgMyVideosModel::NewL(); |
|
118 |
|
119 // Create background context. |
|
120 iBgContext = CAknsBasicBackgroundControlContext::NewL( KAknsIIDQsnBgAreaMain, |
|
121 ClientRect(), |
|
122 ETrue ); |
|
123 IPTVLOGSTRING_LOW_LEVEL( |
|
124 "MPX My Videos UI # CVcxHgMyVideosMainView::ConstructL: Exited." ); |
|
125 } |
|
126 |
|
127 // ----------------------------------------------------------------------------- |
|
128 // CVcxHgMyVideosMainView::~CVcxHgMyVideosMainView() |
|
129 // ----------------------------------------------------------------------------- |
|
130 // |
|
131 EXPORT_C CVcxHgMyVideosMainView::~CVcxHgMyVideosMainView() |
|
132 { |
|
133 IPTVLOGSTRING_LOW_LEVEL( |
|
134 "MPX My Videos UI # ----------- MPX My Videos UI stopping -----------" ); |
|
135 |
|
136 delete iCategoryList; |
|
137 delete iVideoList; |
|
138 delete iModel; |
|
139 delete iBgContext; |
|
140 delete iResourceLoader; |
|
141 |
|
142 if ( iContainer ) |
|
143 { |
|
144 AppUi()->RemoveFromStack( iContainer ); |
|
145 delete iContainer; |
|
146 iContainer = NULL; |
|
147 } |
|
148 } |
|
149 |
|
150 // ----------------------------------------------------------------------------- |
|
151 // CVcxHgMyVideosMainView::CategoryListL() |
|
152 // ----------------------------------------------------------------------------- |
|
153 // |
|
154 CVcxHgMyVideosCategoryListImpl* CVcxHgMyVideosMainView::CategoryListL() |
|
155 { |
|
156 if ( !iCategoryList ) |
|
157 { |
|
158 IPTVLOGSTRING_LOW_LEVEL( |
|
159 "MPX My Videos UI # CVcxHgMyVideosMainView::CategoryListL: Creating category list." ); |
|
160 // Create category list control. |
|
161 CHgDoubleGraphicList* hgCategoryList = |
|
162 CHgDoubleGraphicList::NewL( ClientRect(), 0 ); |
|
163 CleanupStack::PushL( hgCategoryList ); |
|
164 |
|
165 // Create list implementations. |
|
166 // Ownership of list control is transferred. |
|
167 iCategoryList = CVcxHgMyVideosCategoryListImpl::NewL( *iModel, |
|
168 *this, |
|
169 *hgCategoryList ); |
|
170 CleanupStack::Pop( hgCategoryList ); |
|
171 } |
|
172 |
|
173 return iCategoryList; |
|
174 } |
|
175 |
|
176 // ----------------------------------------------------------------------------- |
|
177 // CVcxHgMyVideosMainView::VideoListL() |
|
178 // ----------------------------------------------------------------------------- |
|
179 // |
|
180 CVcxHgMyVideosVideoListImpl* CVcxHgMyVideosMainView::VideoListL() |
|
181 { |
|
182 if ( !iVideoList ) |
|
183 { |
|
184 IPTVLOGSTRING_LOW_LEVEL( |
|
185 "MPX My Videos UI # CVcxHgMyVideosMainView::VideoListL: Creating video list." ); |
|
186 |
|
187 // Create video list control. |
|
188 CHgDoubleGraphicList* hgVideoList = |
|
189 CHgDoubleGraphicList::NewL( ClientRect(), 0 ); |
|
190 CleanupStack::PushL( hgVideoList ); |
|
191 |
|
192 // Create list implementation. |
|
193 // Ownership of list control is transferred. |
|
194 iVideoList = CVcxHgMyVideosVideoListImpl::NewL( *iModel, |
|
195 *this, |
|
196 *hgVideoList ); |
|
197 CleanupStack::Pop( hgVideoList ); |
|
198 } |
|
199 |
|
200 return iVideoList; |
|
201 } |
|
202 |
|
203 // ----------------------------------------------------------------------------- |
|
204 // CVcxHgMyVideosMainView::Cba() |
|
205 // ----------------------------------------------------------------------------- |
|
206 // |
|
207 CEikButtonGroupContainer* CVcxHgMyVideosMainView::Cba() |
|
208 { |
|
209 return CAknView::Cba(); |
|
210 } |
|
211 |
|
212 // ----------------------------------------------------------------------------- |
|
213 // CVcxHgMyVideosMainView::Id() |
|
214 // ----------------------------------------------------------------------------- |
|
215 // |
|
216 TUid CVcxHgMyVideosMainView::Id() const |
|
217 { |
|
218 return TUid::Uid( KVcxHgMyVideosViewUid ); |
|
219 } |
|
220 |
|
221 // ----------------------------------------------------------------------------- |
|
222 // CVcxHgMyVideosMainView::MopSupplyObject() |
|
223 // ----------------------------------------------------------------------------- |
|
224 // |
|
225 TTypeUid::Ptr CVcxHgMyVideosMainView::MopSupplyObject( TTypeUid aId ) |
|
226 { |
|
227 if ( iBgContext && aId.iUid == MAknsControlContext::ETypeId ) |
|
228 { |
|
229 return MAknsControlContext::SupplyMopObject( aId, iBgContext ); |
|
230 } |
|
231 return CAknView::MopSupplyObject( aId ); |
|
232 } |
|
233 |
|
234 // ----------------------------------------------------------------------------- |
|
235 // CVcxHgMyVideosMainView::HandleStatusPaneSizeChange() |
|
236 // |
|
237 // Called by the framework when the application status pane |
|
238 // size is changed. |
|
239 // ----------------------------------------------------------------------------- |
|
240 // |
|
241 void CVcxHgMyVideosMainView::HandleStatusPaneSizeChange() |
|
242 { |
|
243 if ( iContainer ) // If view is active |
|
244 { |
|
245 UpdateLayout(); |
|
246 } |
|
247 } |
|
248 |
|
249 // ----------------------------------------------------------------------------- |
|
250 // CVcxHgMyVideosMainView::TitlePaneL() |
|
251 // ----------------------------------------------------------------------------- |
|
252 // |
|
253 CAknTitlePane* CVcxHgMyVideosMainView::TitlePaneL() |
|
254 { |
|
255 CAknTitlePane* titlePane = static_cast<CAknTitlePane*>( |
|
256 StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); |
|
257 |
|
258 return titlePane; |
|
259 } |
|
260 |
|
261 // ----------------------------------------------------------------------------- |
|
262 // CVcxHgMyVideosMainView::DoActivateL() |
|
263 // ----------------------------------------------------------------------------- |
|
264 // |
|
265 void CVcxHgMyVideosMainView::DoActivateL( const TVwsViewId& /*aPrevViewId*/, |
|
266 TUid /*aCustomMessageId*/, |
|
267 const TDesC8& /*aCustomMessage*/ ) |
|
268 { |
|
269 if ( ! iContainer ) |
|
270 { |
|
271 iContainer = CVcxHgMyVideosMainViewContainer::NewL( *this ); |
|
272 AppUi()->AddToStackL( *this, iContainer ); |
|
273 } |
|
274 |
|
275 CVcxHgMyVideosModel::TVcxMyVideosAppState appState = iModel->AppState(); |
|
276 if ( ( appState == CVcxHgMyVideosModel::EVcxMyVideosAppStateUnknown ) || |
|
277 ( appState == CVcxHgMyVideosModel::EVcxMyVideosAppStateCategoryIdle ) || |
|
278 ( appState == CVcxHgMyVideosModel::EVcxMyVideosAppStatePlayer && |
|
279 iModel->PreviousAppState() == CVcxHgMyVideosModel::EVcxMyVideosAppStateCategoryIdle ) ) |
|
280 { |
|
281 ActivateCategoryListL(); |
|
282 } |
|
283 else |
|
284 { |
|
285 ActivateVideoListL( KErrNotFound ); // Try to activate old list. |
|
286 } |
|
287 UpdateLayout(); |
|
288 } |
|
289 |
|
290 // ----------------------------------------------------------------------------- |
|
291 // CVcxHgMyVideosMainView::DoDeactivate() |
|
292 // ----------------------------------------------------------------------------- |
|
293 // |
|
294 void CVcxHgMyVideosMainView::DoDeactivate() |
|
295 { |
|
296 if ( iCategoryList ) |
|
297 { |
|
298 TRAP_IGNORE( CategoryListL()->DoListDeactivate() ); |
|
299 } |
|
300 |
|
301 if ( iVideoList ) |
|
302 { |
|
303 TRAP_IGNORE( VideoListL()->DoListDeactivate() ); |
|
304 } |
|
305 |
|
306 if ( iContainer ) |
|
307 { |
|
308 AppUi()->RemoveFromStack( iContainer ); |
|
309 delete iContainer; |
|
310 iContainer = NULL; |
|
311 } |
|
312 } |
|
313 |
|
314 // ----------------------------------------------------------------------------- |
|
315 // CVcxHgMyVideosMainView::ActivateCategoryListL() |
|
316 // ----------------------------------------------------------------------------- |
|
317 // |
|
318 void CVcxHgMyVideosMainView::ActivateCategoryListL() |
|
319 { |
|
320 iModel->SetAppState( CVcxHgMyVideosModel::EVcxMyVideosAppStateCategoryBusy ); |
|
321 |
|
322 CategoryListL()->DoListActivateL(); |
|
323 |
|
324 if ( iVideoList ) |
|
325 { |
|
326 VideoListL()->DoListDeactivate(); |
|
327 } |
|
328 |
|
329 iModel->SetAppState( CVcxHgMyVideosModel::EVcxMyVideosAppStateCategoryIdle ); |
|
330 DynInitMskL(); |
|
331 DynInitRskL(); |
|
332 } |
|
333 |
|
334 // ----------------------------------------------------------------------------- |
|
335 // CVcxHgMyVideosMainView::ActivateVideoListL() |
|
336 // ----------------------------------------------------------------------------- |
|
337 // |
|
338 void CVcxHgMyVideosMainView::ActivateVideoListL( TInt aIndex ) |
|
339 { |
|
340 iModel->SetAppState( CVcxHgMyVideosModel::EVcxMyVideosAppStateVideoBusy ); |
|
341 |
|
342 VideoListL()->DoListActivateL( aIndex ); |
|
343 |
|
344 if ( iCategoryList ) |
|
345 { |
|
346 CategoryListL()->DoListDeactivate(); |
|
347 } |
|
348 |
|
349 iModel->SetAppState( CVcxHgMyVideosModel::EVcxMyVideosAppStateVideoIdle ); |
|
350 DynInitMskL(); |
|
351 DynInitRskL(); |
|
352 } |
|
353 |
|
354 // ----------------------------------------------------------------------------- |
|
355 // CVcxHgMyVideosMainView::HandleCommandL() |
|
356 // ----------------------------------------------------------------------------- |
|
357 // |
|
358 void CVcxHgMyVideosMainView::HandleCommandL( TInt aCommand ) |
|
359 { |
|
360 switch ( aCommand ) |
|
361 { |
|
362 case EAknSoftkeyCancel: |
|
363 { |
|
364 HandleCancelL(); |
|
365 break; |
|
366 } |
|
367 case EVcxHgMyVideosCmdPlay: |
|
368 { |
|
369 VideoListL()->PlayCurrentVideoL(); |
|
370 } |
|
371 break; |
|
372 case EVcxHgMyVideosCmdOpen: |
|
373 case EAknSoftkeyOpen: // MSK |
|
374 { |
|
375 TInt highlight = CategoryListL()->Highlight(); |
|
376 |
|
377 if ( highlight >= 0 ) |
|
378 { |
|
379 CategoryListL()->HandleOpenL( highlight ); |
|
380 } |
|
381 } |
|
382 break; |
|
383 case EVcxHgMyVideosCmdDelete: |
|
384 { |
|
385 if ( iModel->AppState() == CVcxHgMyVideosModel::EVcxMyVideosAppStateVideoIdle ) |
|
386 { |
|
387 VideoListL()->DeleteVideosL(); |
|
388 } |
|
389 } |
|
390 break; |
|
391 case EVcxHgMyVideosCmdVideoDetails: |
|
392 { |
|
393 VideoListL()->VideoModel().ShowVideoDetailsDialogL(); |
|
394 } |
|
395 break; |
|
396 case EVcxHgMyVideosCmdShowViaHomenet: |
|
397 { |
|
398 if ( ! VideoListL()->UPnPInterface().IsStarted() ) |
|
399 { |
|
400 if ( VideoListL()->UPnPInterface().Start() != KErrNone ) |
|
401 { |
|
402 break; |
|
403 } |
|
404 } |
|
405 VideoListL()->PlayCurrentVideoL(); |
|
406 } |
|
407 break; |
|
408 case EVcxHgMyVideosCmdStopShowViaHomenet: |
|
409 { |
|
410 VideoListL()->UPnPInterface().Stop(); |
|
411 } |
|
412 break; |
|
413 case EVcxHgMyVideosCmdMemoryStatus: |
|
414 { |
|
415 iMemoryStatus->ShowMemoryStatusDialogL( *iModel ); |
|
416 } |
|
417 break; |
|
418 case EVcxHgMyVideosCmdSortByDate: |
|
419 case EVcxHgMyVideosCmdSortByName: |
|
420 case EVcxHgMyVideosCmdSortBySize: |
|
421 { |
|
422 if ( iModel->AppState() == CVcxHgMyVideosModel::EVcxMyVideosAppStateVideoIdle ) |
|
423 { |
|
424 VideoListL()->HandleSortCommandL( aCommand ); |
|
425 } |
|
426 } |
|
427 break; |
|
428 case EVcxHgMyVideosCmdCopy: |
|
429 case EVcxHgMyVideosCmdMove: |
|
430 { |
|
431 if ( iModel->AppState() == CVcxHgMyVideosModel::EVcxMyVideosAppStateVideoIdle ) |
|
432 { |
|
433 VideoListL()->HandleMoveOrCopyCommandL( aCommand == EVcxHgMyVideosCmdCopy ? |
|
434 ETrue : EFalse ); |
|
435 } |
|
436 } |
|
437 break; |
|
438 case EVcxHgMyVideosCmdSend: |
|
439 { |
|
440 Cba()->DrawDeferred(); |
|
441 VideoListL()->HandleSendL(); |
|
442 break; |
|
443 } |
|
444 case EVcxHgMyVideosCmdMark: |
|
445 case EVcxHgMyVideosCmdUnmark: |
|
446 case EVcxHgMyVideosCmdMarkAll: |
|
447 case EVcxHgMyVideosCmdUnmarkAll: |
|
448 case EVcxHgMyVideosCmdToggleMultipleMarking: |
|
449 case EVcxHgMyVideosCmdMarkContext: |
|
450 { |
|
451 VideoListL()->HandleMarkCommandL( aCommand ); |
|
452 } |
|
453 break; |
|
454 case EVcxHgMyVideosCmdOpenSettings: |
|
455 { |
|
456 // Open MediaSettings application |
|
457 LaunchAppL( KMediaSettingsAppUid ); |
|
458 } |
|
459 break; |
|
460 case EVcxHgMyVideosCmdHelp: |
|
461 { |
|
462 HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(), |
|
463 AppUi()->AppHelpContextL() ); |
|
464 } |
|
465 break; |
|
466 case EAknSoftkeySelect: // Select button / MSK. |
|
467 { |
|
468 if ( iModel->AppState() == CVcxHgMyVideosModel::EVcxMyVideosAppStateCategoryIdle ) |
|
469 { |
|
470 HandleCommandL( EVcxHgMyVideosCmdOpen ); |
|
471 } |
|
472 else if ( iModel->AppState() == CVcxHgMyVideosModel::EVcxMyVideosAppStateVideoIdle ) |
|
473 { |
|
474 RArray<TInt> markedVideos; |
|
475 CleanupClosePushL( markedVideos ); |
|
476 |
|
477 VideoListL()->VideoModel().MarkedVideosL( markedVideos ); |
|
478 if ( markedVideos.Count() <= 0 ) |
|
479 { |
|
480 HandleCommandL( EVcxHgMyVideosCmdPlay ); |
|
481 } |
|
482 CleanupStack::PopAndDestroy( &markedVideos ); |
|
483 } |
|
484 } |
|
485 break; |
|
486 case EAknSoftkeyBack: |
|
487 { |
|
488 if ( iModel->AppState() == CVcxHgMyVideosModel::EVcxMyVideosAppStateVideoIdle ) |
|
489 { |
|
490 VideoListL()->HandleMarkCommandL( EVcxHgMyVideosCmdUnmarkAll ); |
|
491 ActivateCategoryListL(); |
|
492 } |
|
493 else if ( iModel->AppState() == CVcxHgMyVideosModel::EVcxMyVideosAppStateCategoryIdle ) |
|
494 { |
|
495 AppUi()->HandleCommandL( aCommand ); |
|
496 } |
|
497 } |
|
498 break; |
|
499 case EVcxHgMyVideosCmdExit: |
|
500 case EAknSoftkeyExit: |
|
501 case EEikCmdExit: |
|
502 case EAknCmdExit: |
|
503 { |
|
504 // Pass command to app ui for handling. |
|
505 AppUi()->HandleCommandL( EAknCmdExit ); |
|
506 } |
|
507 break; |
|
508 case EVcxHgMyVideosCmdNothing: |
|
509 default: |
|
510 { |
|
511 #ifdef RD_VIDEO_AS_RINGING_TONE |
|
512 // The command could be an AIW command, offer it |
|
513 // to AIW command handler |
|
514 VideoListL()->TryHandleAiwCommandL( aCommand ); |
|
515 #endif |
|
516 } |
|
517 break; |
|
518 } |
|
519 |
|
520 DynInitMskL(); |
|
521 DynInitRskL(); |
|
522 } |
|
523 |
|
524 // ------------------------------------------------------------------------------ |
|
525 // CVcxHgMyVideosMainView::HandleKeyEventL() |
|
526 // ------------------------------------------------------------------------------ |
|
527 // |
|
528 TKeyResponse CVcxHgMyVideosMainView::HandleKeyEventL( const TKeyEvent& aKeyEvent, |
|
529 TEventCode aType ) |
|
530 { |
|
531 TKeyResponse response( EKeyWasNotConsumed ); |
|
532 |
|
533 // Clear and Delete keys perform 'Delete'. |
|
534 if ( ( aKeyEvent.iScanCode == EStdKeyBackspace || |
|
535 aKeyEvent.iScanCode == EStdKeyDelete ) && |
|
536 aType == EEventKey ) |
|
537 { |
|
538 if ( iModel->AppState() == CVcxHgMyVideosModel::EVcxMyVideosAppStateVideoIdle ) |
|
539 { |
|
540 HandleCommandL( EVcxHgMyVideosCmdDelete ); |
|
541 |
|
542 response = EKeyWasConsumed; |
|
543 } |
|
544 } |
|
545 |
|
546 // Enter key should work the same way as selection key. |
|
547 else if ( ( aKeyEvent.iScanCode == EStdKeyEnter || aKeyEvent.iScanCode == EStdKeyDevice3 ) |
|
548 && aType == EEventKey ) |
|
549 { |
|
550 HandleCommandL( EAknSoftkeySelect ); |
|
551 response = EKeyWasConsumed; |
|
552 } |
|
553 |
|
554 return response; |
|
555 } |
|
556 |
|
557 // ------------------------------------------------------------------------------ |
|
558 // CVcxHgMyVideosMainView::UpdateLayout() |
|
559 // ------------------------------------------------------------------------------ |
|
560 // |
|
561 void CVcxHgMyVideosMainView::UpdateLayout() |
|
562 { |
|
563 TRect rect( ClientRect() ); |
|
564 |
|
565 if ( iVideoList ) |
|
566 { |
|
567 iVideoList->UpdateLayout( rect ); |
|
568 } |
|
569 if ( iCategoryList ) |
|
570 { |
|
571 iCategoryList->UpdateLayout( rect ); |
|
572 } |
|
573 if ( iBgContext ) |
|
574 { |
|
575 iBgContext->SetRect( rect ); |
|
576 } |
|
577 } |
|
578 |
|
579 // ------------------------------------------------------------------------------ |
|
580 // CVcxHgMyVideosMainView::DynInitMenuPaneL() |
|
581 // ------------------------------------------------------------------------------ |
|
582 // |
|
583 void CVcxHgMyVideosMainView::DynInitMenuPaneL( TInt aResourceId, |
|
584 CEikMenuPane* aMenuPane ) |
|
585 { |
|
586 |
|
587 if ( aResourceId == R_VCXHGMYVIDEOS_MAINVIEW_MENU ) |
|
588 { |
|
589 aMenuPane->SetItemDimmed( EVcxHgMyVideosCmdDelete, ETrue ); |
|
590 aMenuPane->SetItemDimmed( EVcxHgMyVideosCmdSortSubMenu, ETrue ); |
|
591 aMenuPane->SetItemDimmed( EVcxHgMyVideosCmdVideoDetails, ETrue ); |
|
592 aMenuPane->SetItemDimmed( EVcxHgMyVideosCmdStopShowViaHomenet, ETrue ); |
|
593 aMenuPane->SetItemDimmed( EVcxHgMyVideosCmdShowViaHomenet, ETrue ); |
|
594 #ifdef RD_VIDEO_AS_RINGING_TONE |
|
595 aMenuPane->SetItemDimmed( EVcxHgMyVideosCmdAiwAssign, ETrue ); |
|
596 #endif |
|
597 aMenuPane->SetItemDimmed( EVcxHgMyVideosCmdOpen, ETrue ); |
|
598 aMenuPane->SetItemDimmed( EVcxHgMyVideosCmdPlay, ETrue ); |
|
599 aMenuPane->SetItemDimmed( EVcxHgMyVideosCmdMemoryStatus, ETrue ); |
|
600 aMenuPane->SetItemDimmed( EVcxHgMyVideosCmdCopy, ETrue ); |
|
601 aMenuPane->SetItemDimmed( EVcxHgMyVideosCmdMove, ETrue ); |
|
602 aMenuPane->SetItemDimmed( EVcxHgMyVideosCmdMarkUnmarkSubMenu, ETrue); |
|
603 |
|
604 if ( iModel->AppState() == CVcxHgMyVideosModel::EVcxMyVideosAppStateCategoryIdle ) |
|
605 { |
|
606 aMenuPane->SetItemDimmed( EVcxHgMyVideosCmdOpen, EFalse ); |
|
607 aMenuPane->SetItemDimmed( EVcxHgMyVideosCmdMemoryStatus, EFalse ); |
|
608 } |
|
609 else if ( iModel->AppState() == CVcxHgMyVideosModel::EVcxMyVideosAppStateVideoIdle ) |
|
610 { |
|
611 aMenuPane->SetItemDimmed( EVcxHgMyVideosCmdPlay, EFalse ); |
|
612 aMenuPane->SetItemDimmed( EVcxHgMyVideosCmdMemoryStatus, EFalse ); |
|
613 aMenuPane->SetItemDimmed( EVcxHgMyVideosCmdSortSubMenu, EFalse ); |
|
614 |
|
615 // Video list handles initialisation of menu items specific to it. |
|
616 VideoListL()->DynInitMenuPaneL( aResourceId, aMenuPane ); |
|
617 } |
|
618 |
|
619 aMenuPane->SetItemDimmed( EVcxHgMyVideosCmdHelp, EFalse ); |
|
620 aMenuPane->SetItemDimmed( EVcxHgMyVideosCmdExit, EFalse ); |
|
621 } |
|
622 else if ( aResourceId == R_VCXHGMYVIDEOS_SORT_SUBMENU ) |
|
623 { |
|
624 if ( iModel->AppState() == CVcxHgMyVideosModel::EVcxMyVideosAppStateCategoryIdle ) |
|
625 { |
|
626 return; |
|
627 } |
|
628 |
|
629 switch ( iModel->VideolistSortOrderL() ) |
|
630 { |
|
631 case EVcxMyVideosSortingCreationDate: |
|
632 { |
|
633 aMenuPane->SetItemButtonState( EVcxHgMyVideosCmdSortByDate, |
|
634 EEikMenuItemSymbolOn ); |
|
635 break; |
|
636 } |
|
637 case EVcxMyVideosSortingName: |
|
638 { |
|
639 aMenuPane->SetItemButtonState( EVcxHgMyVideosCmdSortByName, |
|
640 EEikMenuItemSymbolOn ); |
|
641 break; |
|
642 } |
|
643 case EVcxMyVideosSortingSize: |
|
644 { |
|
645 aMenuPane->SetItemButtonState( EVcxHgMyVideosCmdSortBySize, |
|
646 EEikMenuItemSymbolOn ); |
|
647 break; |
|
648 } |
|
649 default: |
|
650 { |
|
651 break; |
|
652 } |
|
653 } |
|
654 } |
|
655 #ifdef RD_VIDEO_AS_RINGING_TONE |
|
656 else if ( aResourceId == R_VCXHGMYVIDEOS_USE_AS_SUBMENU ) |
|
657 { |
|
658 if ( iModel->AppState() == CVcxHgMyVideosModel::EVcxMyVideosAppStateCategoryIdle ) |
|
659 { |
|
660 return; |
|
661 } |
|
662 |
|
663 // Let video list handle AIW menu |
|
664 VideoListL()->DynInitMenuPaneL( aResourceId, aMenuPane ); |
|
665 } |
|
666 #endif |
|
667 else if ( aResourceId == R_VCXHGMYVIDEOS_MARK_SUBMENU ) |
|
668 { |
|
669 if ( iModel->AppState() == CVcxHgMyVideosModel::EVcxMyVideosAppStateCategoryIdle ) |
|
670 { |
|
671 return; |
|
672 } |
|
673 TBool showMarkSubmenu = EFalse; |
|
674 TBool showStartMarking = EFalse; |
|
675 TBool showEndmarking = EFalse; |
|
676 TBool showMarkAll = EFalse; |
|
677 TBool showUnmarkAll = EFalse; |
|
678 |
|
679 VideoListL()->ShowMarkMenuItemsL( |
|
680 showMarkSubmenu, |
|
681 showStartMarking, |
|
682 showEndmarking, |
|
683 showMarkAll, |
|
684 showUnmarkAll ); |
|
685 |
|
686 #ifndef RD_VIDEO_AS_RINGING_TONE |
|
687 aMenuPane->SetItemDimmed( EVcxHgMyVideosCmdMarkContext, ! showStartMarking ); |
|
688 #endif |
|
689 aMenuPane->SetItemDimmed( EVcxHgMyVideosCmdToggleMultipleMarking, ! showStartMarking ); |
|
690 aMenuPane->SetItemDimmed( EVcxHgMyVideosCmdMarkAll, ! showMarkAll ); |
|
691 aMenuPane->SetItemDimmed( EVcxHgMyVideosCmdUnmarkAll, ! showUnmarkAll ); |
|
692 } |
|
693 } |
|
694 |
|
695 // ------------------------------------------------------------------------------ |
|
696 // CVcxHgMyVideosMainView::DynInitMskL() |
|
697 // ------------------------------------------------------------------------------ |
|
698 // |
|
699 void CVcxHgMyVideosMainView::DynInitMskL() |
|
700 { |
|
701 TInt mskToSet( 0 ); |
|
702 |
|
703 if ( iModel->AppState() == CVcxHgMyVideosModel::EVcxMyVideosAppStateCategoryBusy || |
|
704 iModel->AppState() == CVcxHgMyVideosModel::EVcxMyVideosAppStateCategoryIdle ) |
|
705 { |
|
706 mskToSet = R_VCXHGMYVIDEOS_MSK_OPEN; |
|
707 } |
|
708 else if ( iModel->AppState() == CVcxHgMyVideosModel::EVcxMyVideosAppStateVideoIdle ) |
|
709 { |
|
710 mskToSet = VideoListL()->GetMskResourceL(); |
|
711 } |
|
712 else |
|
713 { |
|
714 mskToSet = R_VCXHGMYVIDEOS_MSK_NOTHING; |
|
715 } |
|
716 |
|
717 if ( mskToSet != iCurrentMskResource ) |
|
718 { |
|
719 iCurrentMskResource = mskToSet; |
|
720 |
|
721 if ( Cba() ) |
|
722 { |
|
723 Cba()->SetCommandL( CEikButtonGroupContainer::EMiddleSoftkeyPosition, |
|
724 iCurrentMskResource ); |
|
725 Cba()->DrawDeferred(); |
|
726 } |
|
727 } |
|
728 } |
|
729 |
|
730 // ------------------------------------------------------------------------------ |
|
731 // CVcxHgMyVideosMainView::DynInitRskL() |
|
732 // ------------------------------------------------------------------------------ |
|
733 // |
|
734 void CVcxHgMyVideosMainView::DynInitRskL() |
|
735 { |
|
736 TInt rskToSet( 0 ); |
|
737 |
|
738 if ( iVideoList && iVideoList->IsMarking() ) |
|
739 { |
|
740 rskToSet = R_VCXHGMYVIDEOS_RSK_CANCEL; |
|
741 } |
|
742 else |
|
743 { |
|
744 if ( iModel->AppState() == CVcxHgMyVideosModel::EVcxMyVideosAppStateCategoryIdle || |
|
745 iModel->AppState() == CVcxHgMyVideosModel::EVcxMyVideosAppStateCategoryBusy ) |
|
746 { |
|
747 rskToSet = R_VCXHGMYVIDEOS_RSK_EXIT; |
|
748 } |
|
749 else |
|
750 { |
|
751 rskToSet = R_VCXHGMYVIDEOS_RSK_BACK; |
|
752 } |
|
753 } |
|
754 |
|
755 if ( rskToSet != iCurrentRskResource ) |
|
756 { |
|
757 iCurrentRskResource = rskToSet; |
|
758 |
|
759 if ( Cba() ) |
|
760 { |
|
761 Cba()->SetCommandL( CEikButtonGroupContainer::ERightSoftkeyPosition, |
|
762 iCurrentRskResource ); |
|
763 Cba()->DrawDeferred(); |
|
764 } |
|
765 } |
|
766 } |
|
767 |
|
768 // ------------------------------------------------------------------------------ |
|
769 // CVcxHgMyVideosMainView::HandleCancelL() |
|
770 // ------------------------------------------------------------------------------ |
|
771 // |
|
772 void CVcxHgMyVideosMainView::HandleCancelL() |
|
773 { |
|
774 if ( VideoListL()->IsMarking() ) |
|
775 { |
|
776 VideoListL()->HandleMarkCommandL( EVcxHgMyVideosCmdStopMarking ); |
|
777 } |
|
778 } |
|
779 |
|
780 // ------------------------------------------------------------------------------ |
|
781 // CVcxHgMyVideosMainView::LaunchAppL() |
|
782 // ------------------------------------------------------------------------------ |
|
783 // |
|
784 void CVcxHgMyVideosMainView::LaunchAppL( const TUid aAppUid, const TDesC& aMsg ) |
|
785 { |
|
786 RWsSession wsSession; |
|
787 User::LeaveIfError( wsSession.Connect() ); |
|
788 CleanupClosePushL<RWsSession>( wsSession ); |
|
789 TApaTaskList taskList( wsSession ); |
|
790 TApaTask task = taskList.FindApp( aAppUid ); |
|
791 TInt msgLen = aMsg.Length(); |
|
792 |
|
793 if ( task.Exists() ) |
|
794 { |
|
795 if ( msgLen > 0 ) |
|
796 { |
|
797 // Send message |
|
798 HBufC8* param8 = HBufC8::NewLC( msgLen ); |
|
799 param8->Des().Append( aMsg ); |
|
800 task.SendMessage( TUid::Uid( 0 ), *param8 ); |
|
801 CleanupStack::PopAndDestroy( param8 ); |
|
802 } |
|
803 else |
|
804 { |
|
805 task.BringToForeground(); |
|
806 } |
|
807 } |
|
808 else // Task didn't exist |
|
809 { |
|
810 RApaLsSession appArcSession; |
|
811 User::LeaveIfError( appArcSession.Connect() ); |
|
812 CleanupClosePushL<RApaLsSession>( appArcSession ); |
|
813 |
|
814 if ( msgLen > 0 ) |
|
815 { |
|
816 TThreadId id; |
|
817 appArcSession.StartDocument( aMsg, aAppUid , id ); |
|
818 } |
|
819 else |
|
820 { |
|
821 TApaAppInfo appInfo; |
|
822 TInt retVal = appArcSession.GetAppInfo( appInfo, aAppUid ); |
|
823 if ( retVal == KErrNone ) |
|
824 { |
|
825 CApaCommandLine* cmdLine = CApaCommandLine::NewLC(); |
|
826 cmdLine->SetExecutableNameL( appInfo.iFullName ); |
|
827 cmdLine->SetCommandL( EApaCommandRun ); |
|
828 User::LeaveIfError( appArcSession.StartApp( *cmdLine ) ); |
|
829 CleanupStack::PopAndDestroy( cmdLine ); |
|
830 } |
|
831 else |
|
832 { |
|
833 IPTVLOGSTRING_LOW_LEVEL( |
|
834 "MPX My Videos UI # CVcxHgMyVideosMainView::LaunchAppL - Application not found!" ); |
|
835 } |
|
836 } |
|
837 CleanupStack::PopAndDestroy(); // appArcSession |
|
838 } |
|
839 CleanupStack::PopAndDestroy(); // wsSession |
|
840 } |
|
841 |
|
842 // ------------------------------------------------------------------------------ |
|
843 // CVcxHgMyVideosMainView::LaunchBrowserL() |
|
844 // ------------------------------------------------------------------------------ |
|
845 // |
|
846 void CVcxHgMyVideosMainView::LaunchBrowserL( const TDesC& aUrl ) |
|
847 { |
|
848 HBufC* param = HBufC::NewLC( KVcxHgMyVideosUrlMaxLen ); |
|
849 param->Des().Copy( KBrowserProtocol() ); |
|
850 param->Des().Append( aUrl ); |
|
851 |
|
852 LaunchAppL( KBrowserAppUid, *param ); |
|
853 |
|
854 CleanupStack::PopAndDestroy( param ); |
|
855 } |
|
856 |
|
857 // ------------------------------------------------------------------------------ |
|
858 // CVcxHgMyVideosMainView::LaunchOviStoreL() |
|
859 // ------------------------------------------------------------------------------ |
|
860 // |
|
861 void CVcxHgMyVideosMainView::LaunchOviStoreL( const TUid aAppUid, const TDesC& aArgs ) |
|
862 { |
|
863 IPTVLOGSTRING_LOW_LEVEL( "CVcxHgMyVideosMainView::LaunchOviStoreL() enter" ); |
|
864 RApaLsSession appArcSession; |
|
865 User::LeaveIfError( appArcSession.Connect() ); |
|
866 CleanupClosePushL<RApaLsSession>( appArcSession ); |
|
867 |
|
868 TApaAppInfo appInfo; |
|
869 TInt err = appArcSession.GetAppInfo( appInfo, aAppUid ); |
|
870 IPTVLOGSTRING2_LOW_LEVEL( "CVcxHgMyVideosMainView::LaunchOviStoreL() GetAppInfo() error = %d", err ); |
|
871 |
|
872 if ( KErrNone == err ) |
|
873 { |
|
874 IPTVLOGSTRING3_LOW_LEVEL( "CVcxHgMyVideosMainView::LaunchOviStoreL() launch '%S' with arguments '%S'", &appInfo.iFullName, &aArgs ); |
|
875 RProcess process; |
|
876 User::LeaveIfError( process.Create( appInfo.iFullName, aArgs ) ); |
|
877 process.Resume(); |
|
878 process.Close(); |
|
879 } |
|
880 else |
|
881 { |
|
882 // Launcher not found, use browser until launcher is available |
|
883 IPTVLOGSTRING_LOW_LEVEL( "CVcxHgMyVideosMainView::LaunchOviStoreL() launcher not found, launch browser" ); |
|
884 LaunchBrowserL( KOviVideoStoreURL ); |
|
885 } |
|
886 |
|
887 CleanupStack::PopAndDestroy( &appArcSession ); |
|
888 } |