|
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: glximgvwrmetadatadialog.cpp |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "glximgvwrmetadatadialog.h" |
|
20 |
|
21 //system includes |
|
22 #include <AknUtils.h> //for AknUtils |
|
23 #include <lbsposition.h> |
|
24 #include <akntitle.h> |
|
25 #include <coeaui.h> |
|
26 #include <data_caging_path_literals.hrh>// KDC_APP_RESOURCE_DIR |
|
27 #include <eikmenub.h> // for CEikMenuBar |
|
28 #include <StringLoader.h> |
|
29 #include <akntoolbar.h> |
|
30 #include <glxcommandhandleraddtocontainer.h> // For CGlxCommandHandlerAddToContainer |
|
31 |
|
32 //User includes |
|
33 #include <glxmetadatadialog.rsg> |
|
34 #include <glxresourceutilities.h> |
|
35 #include <glxlog.h> |
|
36 #include <glxtracer.h> |
|
37 #include <glxcollectionpluginall.hrh> |
|
38 #include <glxfilterfactory.h> // for TGlxFilterFactory |
|
39 #include <glxuiutility.h> |
|
40 #include <glxcommandhandlers.hrh> |
|
41 #include <hlplch.h> // for HlpLauncher |
|
42 #include <photos.hlp.hrh> |
|
43 #include <glxgallery.hrh> |
|
44 #include <glxdetailsboundcommand.hrh> |
|
45 #include <glxscreenfurniture.h> |
|
46 #include <glxuiutilities.rsg> |
|
47 #include <glxpanic.h> // For Panics |
|
48 #include "glxmetadatacommandhandler.h" |
|
49 |
|
50 #define GetAppUi() (dynamic_cast<CAknAppUi*>(iEikonEnv->EikAppUi())) |
|
51 |
|
52 |
|
53 // ============================ MEMBER FUNCTIONS =============================== |
|
54 |
|
55 // ----------------------------------------------------------------------------- |
|
56 // NewL |
|
57 // ----------------------------------------------------------------------------- |
|
58 // |
|
59 EXPORT_C CGlxImgVwrMetadataDialog* CGlxImgVwrMetadataDialog::NewL( const TDesC& aUri ) |
|
60 { |
|
61 TRACER("CGlxImgVwrMetadataDialog::NewL"); |
|
62 |
|
63 CGlxImgVwrMetadataDialog* self = new(ELeave) CGlxImgVwrMetadataDialog(aUri ); |
|
64 CleanupStack::PushL( self ); |
|
65 self->ConstructL(); |
|
66 CleanupStack::Pop( self ); |
|
67 return self; |
|
68 } |
|
69 |
|
70 CGlxImgVwrMetadataDialog::CGlxImgVwrMetadataDialog(const TDesC& aUri):iUri(aUri) |
|
71 { |
|
72 |
|
73 } |
|
74 // ----------------------------------------------------------------------------- |
|
75 // ConstructL |
|
76 // ----------------------------------------------------------------------------- |
|
77 // |
|
78 void CGlxImgVwrMetadataDialog::ConstructL() |
|
79 { |
|
80 TRACER("CGlxImgVwrMetadataDialog::ConstructL"); |
|
81 |
|
82 // Load dialog's resource file |
|
83 InitResourceL(); |
|
84 |
|
85 // make the toolbar disabled |
|
86 SetDetailsDlgToolbarVisibility(EFalse); |
|
87 |
|
88 iStatusPaneAvailable = EFalse; |
|
89 // set the title to the dialog, Note that avkon dialogs do not support |
|
90 // setting the title in the status pane so we need to do it the hard way |
|
91 // get status pane |
|
92 CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane(); |
|
93 |
|
94 if(statusPane && statusPane->IsVisible()) |
|
95 { |
|
96 iStatusPaneAvailable = ETrue; |
|
97 } |
|
98 |
|
99 // make the toolbar disabled |
|
100 SetDetailsDlgToolbarVisibility(EFalse); |
|
101 |
|
102 // do we have status pane |
|
103 if( statusPane ) |
|
104 { |
|
105 GLX_LOG_INFO1("GLX_UMP::CGlxImgVwrMetadataDialog::ConstructL::STATUS PANE = %d",statusPane->IsVisible()); |
|
106 // load the title text |
|
107 HBufC* text = StringLoader::LoadL(R_GLX_METADATA_VIEW_TITLE_DETAILS, iEikonEnv ); |
|
108 SetTitleL( *text ); |
|
109 if( text) |
|
110 { |
|
111 delete text; |
|
112 } |
|
113 GetAppUi()->StatusPane()->MakeVisible(ETrue); |
|
114 } |
|
115 |
|
116 iUiUtility = CGlxUiUtility::UtilityL(); |
|
117 |
|
118 // Call the base class' two-phased constructor |
|
119 CAknDialog::ConstructL( R_METADATA_MENUBAR ); |
|
120 |
|
121 } |
|
122 |
|
123 // ----------------------------------------------------------------------------- |
|
124 // ~CGlxImgVwrMetadataDialog |
|
125 // ----------------------------------------------------------------------------- |
|
126 // |
|
127 CGlxImgVwrMetadataDialog::~CGlxImgVwrMetadataDialog() |
|
128 { |
|
129 |
|
130 TRACER("CGlxImgVwrMetadataDialog::~CGlxImgVwrMetadataDialog"); |
|
131 |
|
132 |
|
133 //To Disable the status pane if the dialog is launched from fullscreenview |
|
134 if(!iStatusPaneAvailable) |
|
135 { |
|
136 GetAppUi()->StatusPane()->MakeVisible(EFalse); |
|
137 } |
|
138 |
|
139 TRAP_IGNORE(SetPreviousTitleL()); |
|
140 |
|
141 delete iPreviousTitle; |
|
142 |
|
143 // Restore the Toolbar as it was in the Calling application |
|
144 SetDetailsDlgToolbarVisibility(ETrue); |
|
145 |
|
146 // If details launched from FullScreen View, while moving back, |
|
147 // all the UI components should be hidden. Hence processing this command here. |
|
148 TRAP_IGNORE(GetAppUi()->ProcessCommandL(EGlxCmdResetView)); |
|
149 |
|
150 if( iUiUtility ) |
|
151 { |
|
152 iUiUtility->Close(); |
|
153 } |
|
154 |
|
155 if (iResourceOffset) |
|
156 { |
|
157 CCoeEnv::Static()->DeleteResourceFile(iResourceOffset); |
|
158 } |
|
159 } |
|
160 |
|
161 // --------------------------------------------------------------------------- |
|
162 // SetDetailsDlgToolbarVisibility() |
|
163 // --------------------------------------------------------------------------- |
|
164 void CGlxImgVwrMetadataDialog::SetDetailsDlgToolbarVisibility(TBool aVisible) |
|
165 { |
|
166 TRACER("CGlxImgVwrMetadataDialog::SetDetailsDlgToolbarVisibility"); |
|
167 CAknAppUi* appUi = GetAppUi(); |
|
168 __ASSERT_DEBUG(appUi, Panic(EGlxPanicNullPointer)); |
|
169 |
|
170 HandleToolbarResetting(aVisible); |
|
171 CAknToolbar* currentPopupToolbar = appUi->CurrentPopupToolbar(); |
|
172 if(currentPopupToolbar) |
|
173 { |
|
174 currentPopupToolbar->SetToolbarVisibility(aVisible); |
|
175 currentPopupToolbar->MakeVisible( aVisible ); |
|
176 } |
|
177 } |
|
178 |
|
179 // ----------------------------------------------------------------------------- |
|
180 // ExecuteLD |
|
181 // ----------------------------------------------------------------------------- |
|
182 // |
|
183 EXPORT_C TInt CGlxImgVwrMetadataDialog::ExecuteLD() |
|
184 { |
|
185 TRACER("CGlxImgVwrMetadataDialog::ExecuteLD"); |
|
186 return CAknDialog::ExecuteLD( R_IMG_VIEWER_METADATA_DIALOG ); |
|
187 } |
|
188 // ----------------------------------------------------------------------------- |
|
189 // ProcessCommandL |
|
190 // ----------------------------------------------------------------------------- |
|
191 // |
|
192 void CGlxImgVwrMetadataDialog::ProcessCommandL( TInt aCommandId ) |
|
193 {} |
|
194 //----------------------------------------------------------------------------- |
|
195 // CGlxImgVwrMetadataDialog::CreateCustomControlL |
|
196 //----------------------------------------------------------------------------- |
|
197 SEikControlInfo CGlxImgVwrMetadataDialog::CreateCustomControlL(TInt |
|
198 aControlType) |
|
199 { |
|
200 GLX_LOG_INFO("CShwSlideshowSettingsDialog::CreateCustomControlL"); |
|
201 |
|
202 // create control info, no flags or trailer text set |
|
203 SEikControlInfo controlInfo; |
|
204 controlInfo.iControl = NULL; |
|
205 controlInfo.iTrailerTextId = 0; |
|
206 controlInfo.iFlags = 0; |
|
207 if (aControlType == EMetaDataDialogListBox) |
|
208 { |
|
209 iContainer = CGlxImgVwrMetadataContainer::NewL(GetAppUi()->ClientRect(),iUri); |
|
210 controlInfo.iControl = iContainer; // giving ownership |
|
211 } |
|
212 return controlInfo; // returns ownership of ItemList |
|
213 } |
|
214 |
|
215 // ----------------------------------------------------------------------------- |
|
216 // CGlxImgVwrMetadataDialog::DynInitMenuPaneL |
|
217 // ----------------------------------------------------------------------------- |
|
218 // |
|
219 void CGlxImgVwrMetadataDialog::DynInitMenuPaneL( TInt aMenuId, CEikMenuPane* aMenuPane ) |
|
220 { |
|
221 //no implementation |
|
222 } |
|
223 |
|
224 //----------------------------------------------------------------------------- |
|
225 // CGlxImgVwrMetadataDialog::SizeChanged |
|
226 //----------------------------------------------------------------------------- |
|
227 void CGlxImgVwrMetadataDialog::SizeChanged() |
|
228 { |
|
229 TRACER("CGlxImgVwrMetadataDialog::SizeChanged"); |
|
230 CAknDialog::SizeChanged(); |
|
231 } |
|
232 // ----------------------------------------------------------------------------- |
|
233 // CGlxImgVwrMetadataDialog::InitResourceL |
|
234 // ----------------------------------------------------------------------------- |
|
235 // |
|
236 void CGlxImgVwrMetadataDialog::InitResourceL() |
|
237 { |
|
238 TRACER("CGlxImgVwrMetadataDialog::InitResourceL"); |
|
239 |
|
240 _LIT(KGlxMetadataDialogResource,"glxmetadatadialog.rsc"); |
|
241 //add resource file |
|
242 TParse parse; |
|
243 parse.Set(KGlxMetadataDialogResource, &KDC_APP_RESOURCE_DIR, NULL); |
|
244 TFileName resourceFile; |
|
245 resourceFile.Append(parse.FullName()); |
|
246 CGlxResourceUtilities::GetResourceFilenameL(resourceFile); |
|
247 iResourceOffset = CCoeEnv::Static()->AddResourceFileL(resourceFile); |
|
248 } |
|
249 |
|
250 |
|
251 // ----------------------------------------------------------------------------- |
|
252 // CGlxImgVwrMetadataDialog::HandleViewCommandL |
|
253 // ----------------------------------------------------------------------------- |
|
254 // |
|
255 TBool CGlxImgVwrMetadataDialog::HandleViewCommandL( TInt /*aCommand*/ ) |
|
256 { |
|
257 TRACER("CGlxImgVwrMetadataDialog::HandleViewCommandL"); |
|
258 return EFalse; |
|
259 } |
|
260 // --------------------------------------------------------------------------- |
|
261 // CGlxImgVwrMetadataDialog::PreLayoutDynInitL |
|
262 // --------------------------------------------------------------------------- |
|
263 // |
|
264 void CGlxImgVwrMetadataDialog::PreLayoutDynInitL() |
|
265 { |
|
266 // No Implementation |
|
267 } |
|
268 |
|
269 //----------------------------------------------------------------------------- |
|
270 // CGlxImgVwrMetadataDialog::PostLayoutDynInitL |
|
271 //----------------------------------------------------------------------------- |
|
272 // |
|
273 void CGlxImgVwrMetadataDialog::PostLayoutDynInitL() |
|
274 {} |
|
275 |
|
276 //----------------------------------------------------------------------------- |
|
277 // CGlxImgVwrMetadataDialog::Draw |
|
278 //----------------------------------------------------------------------------- |
|
279 // |
|
280 void CGlxImgVwrMetadataDialog::Draw( const TRect& /*aRect*/ ) const |
|
281 { |
|
282 TRACER("CGlxImgVwrMetadataDialog::Draw"); |
|
283 TRect rect; |
|
284 AknLayoutUtils::LayoutMetricsRect (AknLayoutUtils::EMainPane, rect); |
|
285 |
|
286 // Get the standard graphics context |
|
287 CWindowGc& gc = SystemGc(); |
|
288 gc.SetBrushColor(KRgbWhite); |
|
289 gc.DrawRect(rect); |
|
290 } |
|
291 |
|
292 //----------------------------------------------------------------------------- |
|
293 // CGlxImgVwrMetadataDialog::HandlePointerEventL |
|
294 //----------------------------------------------------------------------------- |
|
295 // |
|
296 void CGlxImgVwrMetadataDialog::HandlePointerEventL( |
|
297 const TPointerEvent& aPointerEvent) |
|
298 { |
|
299 TRACER("CGlxImgVwrMetadataDialog::HandlePointerEventL"); |
|
300 CCoeControl::HandlePointerEventL( aPointerEvent ); |
|
301 } |
|
302 |
|
303 // --------------------------------------------------------------------------- |
|
304 // CGlxImgVwrMetadataDialog::SetTitleL() |
|
305 // --------------------------------------------------------------------------- |
|
306 void CGlxImgVwrMetadataDialog::SetTitleL(const TDesC& aTitleText) |
|
307 { |
|
308 TRACER("CGlxFetcherContainer::SetTitleL"); |
|
309 CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane(); |
|
310 CleanupStack::PushL(statusPane); |
|
311 // get pointer to the default title pane control |
|
312 CAknTitlePane* titlePane = ( CAknTitlePane* )statusPane->ControlL( |
|
313 TUid::Uid( EEikStatusPaneUidTitle )); |
|
314 CleanupStack::PushL(titlePane); |
|
315 // set the title if we got the title pane control |
|
316 if( titlePane ) |
|
317 { |
|
318 GLX_LOG_INFO("GLX_UMP::CGlxImgVwrMetadataDialog::ConstructL::INSIDE titlePane"); |
|
319 iPreviousTitle = titlePane->Text()->AllocL(); |
|
320 // Set the required Title |
|
321 titlePane->SetTextL( aTitleText ); |
|
322 } |
|
323 CleanupStack::Pop(titlePane); |
|
324 CleanupStack::Pop(statusPane); |
|
325 } |
|
326 |
|
327 // --------------------------------------------------------------------------- |
|
328 // CGlxImgVwrMetadataDialog::SetPreviousTitleL |
|
329 // --------------------------------------------------------------------------- |
|
330 void CGlxImgVwrMetadataDialog::SetPreviousTitleL() |
|
331 { |
|
332 TRACER("CGlxFetcherContainer::SetPreviousTitleL"); |
|
333 CEikStatusPane* prevStatusPane = iEikonEnv->AppUiFactory()->StatusPane(); |
|
334 CleanupStack::PushL(prevStatusPane); |
|
335 CAknTitlePane* prevTitlePane = ( CAknTitlePane* )prevStatusPane->ControlL( |
|
336 TUid::Uid( EEikStatusPaneUidTitle )); |
|
337 CleanupStack::PushL(prevTitlePane); |
|
338 if( prevTitlePane ) |
|
339 { |
|
340 // Restore the Title back of the Calling Application |
|
341 prevTitlePane->SetTextL( *iPreviousTitle ); |
|
342 } |
|
343 CleanupStack::Pop(prevTitlePane); |
|
344 CleanupStack::Pop(prevStatusPane); |
|
345 } |
|
346 // ----------------------------------------------------------------------------- |
|
347 // CGlxImgVwrMetadataDialog::HandleResourceChange |
|
348 // ----------------------------------------------------------------------------- |
|
349 // |
|
350 void CGlxImgVwrMetadataDialog::HandleResourceChange( TInt aType ) |
|
351 { |
|
352 TRACER("CGlxImgVwrMetadataDialog::HandleResourceChange"); |
|
353 //Handle global resource changes, such as scalable UI or skin events and orientation change (override) |
|
354 CAknDialog::HandleResourceChange( aType ); |
|
355 } |
|
356 // ----------------------------------------------------------------------------- |
|
357 // CGlxImgVwrMetadataDialog::HandleToolbarResetting |
|
358 // ----------------------------------------------------------------------------- |
|
359 // |
|
360 void CGlxImgVwrMetadataDialog::HandleToolbarResetting(TBool aVisible) |
|
361 { |
|
362 TRACER("CGlxImgVwrMetadataDialog::HandleToolbarResetting"); |
|
363 CAknAppUi* appUi = GetAppUi(); |
|
364 __ASSERT_DEBUG(appUi, Panic(EGlxPanicNullPointer)); |
|
365 |
|
366 CAknToolbar* popupToolbar = appUi->PopupToolbar(); |
|
367 if(popupToolbar) |
|
368 { |
|
369 popupToolbar->SetToolbarVisibility( !aVisible ); |
|
370 popupToolbar->MakeVisible( !aVisible ); |
|
371 if(!aVisible) |
|
372 { |
|
373 popupToolbar->DrawNow(); |
|
374 } |
|
375 } |
|
376 CAknToolbar* toolbar = appUi->CurrentFixedToolbar(); |
|
377 if(toolbar) |
|
378 { |
|
379 toolbar->HideItemsAndDrawOnlyBackground(!aVisible); |
|
380 toolbar->SetToolbarVisibility(aVisible); |
|
381 toolbar->MakeVisible( aVisible ); |
|
382 } |
|
383 } |
|
384 |
|
385 // End of File |
|
386 |