|
1 /* |
|
2 * Copyright (c) 2006 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: CVideoServicesAppUi implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 |
|
21 #include "VideoServicesAppUi.h" |
|
22 #include "VideoServicesContainer.h" |
|
23 |
|
24 // CONSTANTS |
|
25 _LIT(KUrlLaunchParameter, "4 "); |
|
26 const TInt KUrlLaunchParamLength = 2; |
|
27 |
|
28 |
|
29 // ================= MEMBER FUNCTIONS ======================= |
|
30 // |
|
31 |
|
32 // ---------------------------------------------------------- |
|
33 // CVideoServicesAppUi::CVideoServicesAppUi() |
|
34 // ---------------------------------------------------------- |
|
35 // |
|
36 CVideoServicesAppUi::CVideoServicesAppUi() |
|
37 { |
|
38 } |
|
39 |
|
40 // ---------------------------------------------------------- |
|
41 // CVideoServicesAppUi::ConstructL() |
|
42 // ---------------------------------------------------------- |
|
43 // |
|
44 void CVideoServicesAppUi::ConstructL() |
|
45 { |
|
46 BaseConstructL( ENonStandardResourceFile | EAknEnableSkin /*| ENoScreenFurniture | ENoAppResourceFile*/ ); |
|
47 iAppContainer = CVideoServicesContainer::NewL( ClientRect() ); |
|
48 AddToStackL( iAppContainer ); |
|
49 |
|
50 // Connect to VideoServices central repository, leave if we don't have |
|
51 // a VideoServices CR present |
|
52 iVideoServicesRepository = CRepository::NewL( KCrUidVideoServices ); |
|
53 |
|
54 LaunchBrowserL(); |
|
55 } |
|
56 |
|
57 // ---------------------------------------------------- |
|
58 // CVideoServicesAppUi::~CVideoServicesAppUi() |
|
59 // ---------------------------------------------------- |
|
60 // |
|
61 CVideoServicesAppUi::~CVideoServicesAppUi() |
|
62 { |
|
63 if ( iAppContainer ) |
|
64 { |
|
65 RemoveFromStack( iAppContainer ); |
|
66 delete iAppContainer; |
|
67 iAppContainer = NULL; |
|
68 } |
|
69 |
|
70 delete iVideoServicesRepository; |
|
71 } |
|
72 |
|
73 // ---------------------------------------------------- |
|
74 // CVideoServicesAppUi::HandleKeyEventL( |
|
75 // ---------------------------------------------------- |
|
76 // |
|
77 TKeyResponse CVideoServicesAppUi::HandleKeyEventL( |
|
78 const TKeyEvent& /*aKeyEvent*/,TEventCode /*aType*/ ) |
|
79 { |
|
80 return EKeyWasNotConsumed; |
|
81 } |
|
82 |
|
83 // ---------------------------------------------------- |
|
84 // CVideoServicesAppUi::HandleCommandL(TInt aCommand) |
|
85 // ---------------------------------------------------- |
|
86 // |
|
87 void CVideoServicesAppUi::HandleCommandL( TInt aCommand ) |
|
88 { |
|
89 switch ( aCommand ) |
|
90 { |
|
91 case EAknSoftkeyBack: |
|
92 case EAknSoftkeyExit: |
|
93 case EEikCmdExit: |
|
94 case EAknCmdExit: |
|
95 { |
|
96 Exit(); |
|
97 break; |
|
98 } |
|
99 default: |
|
100 break; |
|
101 } |
|
102 } |
|
103 |
|
104 // ---------------------------------------------------- |
|
105 // CVideoServicesAppUi::HandleContentL |
|
106 // Handles the content coming from the embedded browser. |
|
107 // Returns EFalse: content will be passed on to framework |
|
108 // ---------------------------------------------------- |
|
109 // |
|
110 TBool CVideoServicesAppUi::HandleContentL( const TDesC& /*aFileName*/, const CAiwGenericParamList& /*aParamList*/, TBool& aContinue ) |
|
111 { |
|
112 aContinue = EFalse; |
|
113 return EFalse; |
|
114 } |
|
115 |
|
116 // ---------------------------------------------------- |
|
117 // CVideoServicesAppUi::DownloadedContentHandlerReserved1 |
|
118 // ( Reserved for future use ) |
|
119 // ---------------------------------------------------- |
|
120 // |
|
121 TAny* CVideoServicesAppUi::DownloadedContentHandlerReserved1( TAny* /*aAnyParam*/ ) |
|
122 { |
|
123 // Empty implementation. |
|
124 return NULL; |
|
125 } |
|
126 |
|
127 // ---------------------------------------------------- |
|
128 // CVideoServicesAppUi::LaunchBrowserL() |
|
129 // ---------------------------------------------------- |
|
130 // |
|
131 void CVideoServicesAppUi::LaunchBrowserL() |
|
132 { |
|
133 // Read the video URL from Video Services central repository |
|
134 if ( KErrNone == iVideoServicesRepository->Get( KVideoServicesUrl, iUrl ) ) |
|
135 { |
|
136 if ( iUrl.Length() ) |
|
137 { |
|
138 LaunchBrowserEmbeddedWithVideoUrlL(); |
|
139 } |
|
140 } |
|
141 Exit(); |
|
142 } |
|
143 |
|
144 // ---------------------------------------------------- |
|
145 // CVideoServicesAppUi::LaunchBrowserEmbeddedWithVideoUrlL |
|
146 // ---------------------------------------------------- |
|
147 // |
|
148 void CVideoServicesAppUi::LaunchBrowserEmbeddedWithVideoUrlL() |
|
149 { |
|
150 // Pass the specified video url to browser (read from Central Repository) |
|
151 HBufC* url = NULL; |
|
152 url = HBufC::NewLC( iUrl.Length() + KUrlLaunchParamLength ); |
|
153 url->Des().Append( KUrlLaunchParameter ); |
|
154 url->Des().Append( iUrl ); |
|
155 |
|
156 CBrowserLauncher* launcher = CBrowserLauncher::NewLC(); |
|
157 launcher->LaunchBrowserSyncEmbeddedL( url->Des(), this ); |
|
158 |
|
159 CleanupStack::PopAndDestroy(); // launcher |
|
160 CleanupStack::PopAndDestroy(); // url |
|
161 } |
|
162 |
|
163 // ---------------------------------------------------- |
|
164 // CVideoServicesAppUi::NotifyExit |
|
165 // ---------------------------------------------------- |
|
166 // |
|
167 void CVideoServicesAppUi::NotifyExit(TExitMode /*aMode*/) |
|
168 { |
|
169 } |
|
170 |
|
171 // ---------------------------------------------------- |
|
172 // CVideoServicesAppUi::HandleStatusPaneSizeChange |
|
173 // ---------------------------------------------------- |
|
174 // |
|
175 void CVideoServicesAppUi::HandleStatusPaneSizeChange() |
|
176 { |
|
177 iAppContainer->SetRect( ClientRect() ); |
|
178 } |
|
179 |
|
180 // End of File |