|
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 <akntitle.h> |
|
24 #include <data_caging_path_literals.hrh>// KDC_APP_RESOURCE_DIR |
|
25 #include <StringLoader.h> |
|
26 #include <akntoolbar.h> |
|
27 |
|
28 //User includes |
|
29 #include <glxmetadatadialog.rsg> |
|
30 #include <glxresourceutilities.h> |
|
31 #include <glxlog.h> |
|
32 #include <glxtracer.h> |
|
33 #include <glxcommandhandlers.hrh> |
|
34 #include <glxdetailsboundcommand.hrh> |
|
35 #include "glxmetadatacommandhandler.h" |
|
36 |
|
37 // ============================ MEMBER FUNCTIONS =============================== |
|
38 |
|
39 // ----------------------------------------------------------------------------- |
|
40 // NewL |
|
41 // ----------------------------------------------------------------------------- |
|
42 // |
|
43 EXPORT_C CGlxImgVwrMetadataDialog* CGlxImgVwrMetadataDialog::NewL( const TDesC& aUri ) |
|
44 { |
|
45 TRACER("CGlxImgVwrMetadataDialog::NewL"); |
|
46 |
|
47 CGlxImgVwrMetadataDialog* self = new(ELeave) CGlxImgVwrMetadataDialog(aUri ); |
|
48 CleanupStack::PushL( self ); |
|
49 self->ConstructL(); |
|
50 CleanupStack::Pop( self ); |
|
51 return self; |
|
52 } |
|
53 |
|
54 // ----------------------------------------------------------------------------- |
|
55 // CGlxImgVwrMetadataDialog |
|
56 // ----------------------------------------------------------------------------- |
|
57 // |
|
58 CGlxImgVwrMetadataDialog::CGlxImgVwrMetadataDialog(const TDesC& aUri):iUri(aUri) |
|
59 { |
|
60 } |
|
61 |
|
62 // ----------------------------------------------------------------------------- |
|
63 // ConstructL |
|
64 // ----------------------------------------------------------------------------- |
|
65 // |
|
66 void CGlxImgVwrMetadataDialog::ConstructL() |
|
67 { |
|
68 TRACER("CGlxImgVwrMetadataDialog::ConstructL"); |
|
69 |
|
70 // Load dialog's resource file |
|
71 InitResourceL(); |
|
72 |
|
73 // make the toolbar disabled |
|
74 SetDetailsDlgToolbarVisibility(EFalse); |
|
75 |
|
76 iStatusPaneAvailable = EFalse; |
|
77 // set the title to the dialog, Note that avkon dialogs do not support |
|
78 // setting the title in the status pane so we need to do it the hard way |
|
79 // get status pane |
|
80 CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane(); |
|
81 |
|
82 if(statusPane && statusPane->IsVisible()) |
|
83 { |
|
84 iStatusPaneAvailable = ETrue; |
|
85 } |
|
86 |
|
87 // do we have status pane |
|
88 if( statusPane ) |
|
89 { |
|
90 GLX_LOG_INFO1("GLX_UMP::CGlxImgVwrMetadataDialog::ConstructL::STATUS PANE = %d", |
|
91 statusPane->IsVisible()); |
|
92 // load the title text |
|
93 HBufC* text = StringLoader::LoadL(R_GLX_METADATA_VIEW_TITLE_DETAILS, iEikonEnv ); |
|
94 SetTitleL( *text ); |
|
95 if( text) |
|
96 { |
|
97 delete text; |
|
98 } |
|
99 iAvkonAppUi->StatusPane()->MakeVisible(ETrue); |
|
100 } |
|
101 } |
|
102 |
|
103 // ----------------------------------------------------------------------------- |
|
104 // ~CGlxImgVwrMetadataDialog |
|
105 // ----------------------------------------------------------------------------- |
|
106 // |
|
107 CGlxImgVwrMetadataDialog::~CGlxImgVwrMetadataDialog() |
|
108 { |
|
109 TRACER("CGlxImgVwrMetadataDialog::~CGlxImgVwrMetadataDialog"); |
|
110 |
|
111 //To Disable the status pane if the dialog is launched from fullscreenview |
|
112 if (!iStatusPaneAvailable && iAvkonAppUi) |
|
113 { |
|
114 iAvkonAppUi->StatusPane()->MakeVisible(EFalse); |
|
115 } |
|
116 |
|
117 TRAP_IGNORE(SetPreviousTitleL()); |
|
118 delete iPreviousTitle; |
|
119 |
|
120 // Restore the Toolbar as it was in the Calling application |
|
121 SetDetailsDlgToolbarVisibility(ETrue); |
|
122 |
|
123 // If details launched from FullScreen View, while moving back, |
|
124 // all the UI components should be hidden. Hence processing this command here. |
|
125 if (iAvkonAppUi) |
|
126 { |
|
127 TRAP_IGNORE(iAvkonAppUi->ProcessCommandL(EGlxCmdResetView)); |
|
128 } |
|
129 |
|
130 if (iResourceOffset) |
|
131 { |
|
132 CCoeEnv::Static()->DeleteResourceFile(iResourceOffset); |
|
133 } |
|
134 } |
|
135 |
|
136 // --------------------------------------------------------------------------- |
|
137 // SetDetailsDlgToolbarVisibility() |
|
138 // --------------------------------------------------------------------------- |
|
139 void CGlxImgVwrMetadataDialog::SetDetailsDlgToolbarVisibility(TBool aVisible) |
|
140 { |
|
141 TRACER("CGlxImgVwrMetadataDialog::SetDetailsDlgToolbarVisibility"); |
|
142 |
|
143 HandleToolbarResetting(aVisible); |
|
144 CAknToolbar* currentPopupToolbar = iAvkonAppUi->CurrentPopupToolbar(); |
|
145 if(currentPopupToolbar) |
|
146 { |
|
147 currentPopupToolbar->SetToolbarVisibility(aVisible); |
|
148 currentPopupToolbar->MakeVisible( aVisible ); |
|
149 } |
|
150 } |
|
151 |
|
152 // ----------------------------------------------------------------------------- |
|
153 // ExecuteLD |
|
154 // ----------------------------------------------------------------------------- |
|
155 // |
|
156 EXPORT_C TInt CGlxImgVwrMetadataDialog::ExecuteLD() |
|
157 { |
|
158 TRACER("CGlxImgVwrMetadataDialog::ExecuteLD"); |
|
159 return CAknDialog::ExecuteLD( R_IMG_VIEWER_METADATA_DIALOG ); |
|
160 } |
|
161 |
|
162 // ----------------------------------------------------------------------------- |
|
163 // ProcessCommandL |
|
164 // ----------------------------------------------------------------------------- |
|
165 // |
|
166 void CGlxImgVwrMetadataDialog::ProcessCommandL(TInt /*aCommandId*/) |
|
167 { |
|
168 TRACER("CGlxImgVwrMetadataDialog::ProcessCommandL"); |
|
169 // hide menu bar |
|
170 iMenuBar->StopDisplayingMenuBar(); |
|
171 } |
|
172 |
|
173 //----------------------------------------------------------------------------- |
|
174 // CGlxImgVwrMetadataDialog::CreateCustomControlL |
|
175 //----------------------------------------------------------------------------- |
|
176 SEikControlInfo CGlxImgVwrMetadataDialog::CreateCustomControlL(TInt |
|
177 aControlType) |
|
178 { |
|
179 GLX_LOG_INFO("CGlxImgVwrMetadataDialog::CreateCustomControlL"); |
|
180 |
|
181 // create control info, no flags or trailer text set |
|
182 SEikControlInfo controlInfo; |
|
183 controlInfo.iControl = NULL; |
|
184 controlInfo.iTrailerTextId = 0; |
|
185 controlInfo.iFlags = 0; |
|
186 if (aControlType == EMetaDataDialogListBox) |
|
187 { |
|
188 iContainer = CGlxImgVwrMetadataContainer::NewL( |
|
189 iAvkonAppUi->ClientRect(), iUri); |
|
190 controlInfo.iControl = iContainer; // giving ownership |
|
191 } |
|
192 return controlInfo; // returns ownership of ItemList |
|
193 } |
|
194 |
|
195 // ----------------------------------------------------------------------------- |
|
196 // CGlxImgVwrMetadataDialog::InitResourceL |
|
197 // ----------------------------------------------------------------------------- |
|
198 // |
|
199 void CGlxImgVwrMetadataDialog::InitResourceL() |
|
200 { |
|
201 TRACER("CGlxImgVwrMetadataDialog::InitResourceL"); |
|
202 |
|
203 _LIT(KGlxMetadataDialogResource,"glxmetadatadialog.rsc"); |
|
204 //add resource file |
|
205 TParse parse; |
|
206 parse.Set(KGlxMetadataDialogResource, &KDC_APP_RESOURCE_DIR, NULL); |
|
207 TFileName resourceFile; |
|
208 resourceFile.Append(parse.FullName()); |
|
209 CGlxResourceUtilities::GetResourceFilenameL(resourceFile); |
|
210 iResourceOffset = CCoeEnv::Static()->AddResourceFileL(resourceFile); |
|
211 } |
|
212 |
|
213 // --------------------------------------------------------------------------- |
|
214 // CGlxImgVwrMetadataDialog::SetTitleL() |
|
215 // --------------------------------------------------------------------------- |
|
216 void CGlxImgVwrMetadataDialog::SetTitleL(const TDesC& aTitleText) |
|
217 { |
|
218 TRACER("CGlxImgVwrMetadataDialog::SetTitleL"); |
|
219 CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane(); |
|
220 CleanupStack::PushL(statusPane); |
|
221 // get pointer to the default title pane control |
|
222 CAknTitlePane* titlePane = ( CAknTitlePane* )statusPane->ControlL( |
|
223 TUid::Uid( EEikStatusPaneUidTitle )); |
|
224 CleanupStack::PushL(titlePane); |
|
225 // set the title if we got the title pane control |
|
226 if( titlePane ) |
|
227 { |
|
228 GLX_LOG_INFO("GLX_UMP::CGlxImgVwrMetadataDialog::ConstructL::INSIDE titlePane"); |
|
229 iPreviousTitle = titlePane->Text()->AllocL(); |
|
230 // Set the required Title |
|
231 titlePane->SetTextL( aTitleText ); |
|
232 } |
|
233 CleanupStack::Pop(titlePane); |
|
234 CleanupStack::Pop(statusPane); |
|
235 } |
|
236 |
|
237 // --------------------------------------------------------------------------- |
|
238 // CGlxImgVwrMetadataDialog::SetPreviousTitleL |
|
239 // --------------------------------------------------------------------------- |
|
240 void CGlxImgVwrMetadataDialog::SetPreviousTitleL() |
|
241 { |
|
242 TRACER("CGlxImgVwrMetadataDialog::SetPreviousTitleL"); |
|
243 CEikStatusPane* prevStatusPane = iEikonEnv->AppUiFactory()->StatusPane(); |
|
244 CleanupStack::PushL(prevStatusPane); |
|
245 CAknTitlePane* prevTitlePane = ( CAknTitlePane* )prevStatusPane->ControlL( |
|
246 TUid::Uid( EEikStatusPaneUidTitle )); |
|
247 CleanupStack::PushL(prevTitlePane); |
|
248 if( prevTitlePane ) |
|
249 { |
|
250 // Restore the Title back of the Calling Application |
|
251 prevTitlePane->SetTextL( *iPreviousTitle ); |
|
252 } |
|
253 CleanupStack::Pop(prevTitlePane); |
|
254 CleanupStack::Pop(prevStatusPane); |
|
255 } |
|
256 |
|
257 // ----------------------------------------------------------------------------- |
|
258 // CGlxImgVwrMetadataDialog::HandleToolbarResetting |
|
259 // ----------------------------------------------------------------------------- |
|
260 // |
|
261 void CGlxImgVwrMetadataDialog::HandleToolbarResetting(TBool aVisible) |
|
262 { |
|
263 TRACER("CGlxImgVwrMetadataDialog::HandleToolbarResetting"); |
|
264 |
|
265 CAknToolbar* popupToolbar = iAvkonAppUi->PopupToolbar(); |
|
266 if(popupToolbar) |
|
267 { |
|
268 popupToolbar->SetToolbarVisibility( !aVisible ); |
|
269 popupToolbar->MakeVisible( !aVisible ); |
|
270 if(!aVisible) |
|
271 { |
|
272 popupToolbar->DrawNow(); |
|
273 } |
|
274 } |
|
275 CAknToolbar* toolbar = iAvkonAppUi->CurrentFixedToolbar(); |
|
276 if(toolbar) |
|
277 { |
|
278 toolbar->HideItemsAndDrawOnlyBackground(!aVisible); |
|
279 toolbar->SetToolbarVisibility(aVisible); |
|
280 toolbar->MakeVisible( aVisible ); |
|
281 } |
|
282 } |
|
283 |
|
284 // End of File |
|
285 |