60
|
1 |
/*
|
|
2 |
* Copyright (c) 2007 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 of Slideshow Settings Dialog
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
// CLASS HEADER
|
|
22 |
#include "shwslideshowsettingsdialog.h"
|
|
23 |
|
|
24 |
// EXTERNAL INCLUDES
|
|
25 |
#include <hlplch.h> // for HlpLauncher
|
|
26 |
#include <eikdialg.h> // for CEikDialog
|
|
27 |
#include <aknappui.h> // for CAknAppUi
|
|
28 |
#include <akntitle.h> // for CAknTitlePane
|
|
29 |
#include <StringLoader.h> // for StringLoader
|
|
30 |
#include <bautils.h> // for BaflUtils
|
|
31 |
#include <data_caging_path_literals.hrh>// for KDC_APP_RESOURCE_DIR
|
|
32 |
#include <coeutils.h> // for ConeUitls
|
|
33 |
#include <eikon.hrh> // for Navi-scroll key events
|
|
34 |
#include <akntoolbar.h>
|
|
35 |
|
|
36 |
// INTERNAL INCLUDES
|
|
37 |
#include <glxlog.h>
|
|
38 |
#include <glxtracer.h>
|
|
39 |
#include <glxpanic.h> // For Panics
|
|
40 |
#include <shwsettingsdialog.rsg>
|
|
41 |
#include <glxresourceutilities.h> // for CGlxResourceUtilities
|
|
42 |
#include "shwslideshowsettings.hrh"
|
|
43 |
#include "shwslideshowengine.h" // for CShwSlideshowEngine
|
|
44 |
#include "shwslideshowsettings.hrh" // for Command Ids and Control Ids
|
|
45 |
#include "shwsettingsmodel.h" // for CShwSettingsModel
|
|
46 |
#include "shwslideshowsettingslist.h" // for CShwSlideshowSettingsList
|
|
47 |
|
|
48 |
//CONSTANTS
|
|
49 |
namespace
|
|
50 |
{
|
|
51 |
// uid and id from doc/help_parameters_for_photos.xls
|
|
52 |
const TInt KShwHelpUID = 0x2000A778;
|
|
53 |
_LIT( KSHW_HLP_SLIDESHOW_SETTINGS, "LGAL_HLP_SLIDESHOW_SETTINGS" );
|
|
54 |
}
|
|
55 |
|
|
56 |
//-----------------------------------------------------------------------------
|
|
57 |
// C++ default constructor.
|
|
58 |
//-----------------------------------------------------------------------------
|
|
59 |
inline CShwSlideshowSettingsDialog::CShwSlideshowSettingsDialog()
|
|
60 |
{
|
|
61 |
// No implementation required
|
|
62 |
}
|
|
63 |
|
|
64 |
//-----------------------------------------------------------------------------
|
|
65 |
// Two-phased constructor.
|
|
66 |
//-----------------------------------------------------------------------------
|
|
67 |
CShwSlideshowSettingsDialog* CShwSlideshowSettingsDialog::NewL()
|
|
68 |
{
|
|
69 |
TRACER("CShwSlideshowSettingsDialog::NewL");
|
|
70 |
GLX_LOG_INFO("CShwSlideshowSettingsDialog::NewL");
|
|
71 |
CShwSlideshowSettingsDialog* self=new(ELeave)CShwSlideshowSettingsDialog();
|
|
72 |
CleanupStack::PushL(self);
|
|
73 |
self->ConstructL();
|
|
74 |
CleanupStack::Pop(self);
|
|
75 |
return self;
|
|
76 |
}
|
|
77 |
|
|
78 |
|
|
79 |
|
|
80 |
//-----------------------------------------------------------------------------
|
|
81 |
// Destructor
|
|
82 |
//-----------------------------------------------------------------------------
|
|
83 |
CShwSlideshowSettingsDialog::~CShwSlideshowSettingsDialog()
|
|
84 |
{
|
|
85 |
TRACER("CShwSlideshowSettingsDialog::~CShwSlideshowSettingsDialog");
|
|
86 |
GLX_LOG_INFO("CShwSlideshowSettingsDialog::~CShwSlideshowSettingsDialog");
|
|
87 |
|
|
88 |
// Draw the toolbar
|
|
89 |
SetSlShwToolbarVisibility(ETrue);
|
|
90 |
|
|
91 |
delete iShwSettings;
|
|
92 |
// Delete resource file
|
|
93 |
if (iResourceOffset)
|
|
94 |
{
|
|
95 |
iEikonEnv->DeleteResourceFile( iResourceOffset );
|
|
96 |
iResourceOffset = NULL;
|
|
97 |
}
|
|
98 |
// If the status pane was enabled , set it to not visbible.
|
|
99 |
// used in FS view
|
|
100 |
if (iStatusPaneChanged)
|
|
101 |
{
|
|
102 |
iStatusPane->MakeVisible(EFalse);
|
|
103 |
}
|
|
104 |
if (iPreviousTitle)
|
|
105 |
{
|
|
106 |
delete iPreviousTitle;
|
|
107 |
}
|
|
108 |
}
|
|
109 |
|
|
110 |
//-----------------------------------------------------------------------------
|
|
111 |
// Symbian 2nd phase constructor can leave.
|
|
112 |
//-----------------------------------------------------------------------------
|
|
113 |
void CShwSlideshowSettingsDialog::ConstructL()
|
|
114 |
{
|
|
115 |
TRACER("CShwSlideshowSettingsDialog::ConstructL");
|
|
116 |
GLX_LOG_INFO("CShwSlideshowSettingsDialog::ConstructL");
|
|
117 |
|
|
118 |
// hide toolbar.
|
|
119 |
SetSlShwToolbarVisibility(EFalse);
|
|
120 |
iStatusPaneChanged = EFalse;
|
|
121 |
iStatusPane = iAvkonAppUi->StatusPane();
|
|
122 |
iTitlePane = ( CAknTitlePane* )iStatusPane->ControlL(
|
|
123 |
TUid::Uid( EEikStatusPaneUidTitle ));
|
|
124 |
// If Status pane not visible, then make it visible.
|
|
125 |
// Set the status pane flag as True, to be used in destructor, if
|
|
126 |
// status pane is made visible.
|
|
127 |
// This is used in Fullscreen.
|
|
128 |
if(!iStatusPane->IsVisible())
|
|
129 |
{
|
|
130 |
iStatusPane->MakeVisible(ETrue);
|
|
131 |
iStatusPaneChanged = ETrue;
|
|
132 |
}
|
|
133 |
// Load the dialog resource file
|
|
134 |
_LIT(KShwSettingDlgResource,"shwsettingsdialog.rsc");
|
|
135 |
TFileName resourceFile(KDC_APP_RESOURCE_DIR);
|
|
136 |
resourceFile.Append(KShwSettingDlgResource);
|
|
137 |
CGlxResourceUtilities::GetResourceFilenameL( resourceFile );
|
|
138 |
iResourceOffset = iCoeEnv->AddResourceFileL( resourceFile );
|
|
139 |
|
|
140 |
iShwSettings = CShwSettingsModel::NewL();
|
|
141 |
|
|
142 |
// CAknDialog takes the menu resource as constructor parameter
|
|
143 |
CAknDialog::ConstructL( R_SHW_SETTINGSLIST_MENU_BAR );
|
|
144 |
|
|
145 |
// set the title to the dialog, Note that avkon dialogs do not support
|
|
146 |
// setting the title in the status pane so we need to do it the hard way
|
|
147 |
// get status pane
|
|
148 |
SetTitleL();
|
|
149 |
}
|
|
150 |
|
|
151 |
// ---------------------------------------------------------------------------
|
|
152 |
// SetSlShwToolbarVisibility()
|
|
153 |
// ---------------------------------------------------------------------------
|
|
154 |
void CShwSlideshowSettingsDialog::SetSlShwToolbarVisibility(TBool aVisible)
|
|
155 |
{
|
|
156 |
TRACER("CShwSlideshowSettingsDialog::SetSlShwToolbarVisibility");
|
|
157 |
CAknAppUi* appUi = iAvkonAppUi;
|
|
158 |
__ASSERT_DEBUG(appUi, Panic(EGlxPanicNullPointer));
|
|
159 |
if (!appUi)
|
|
160 |
{
|
|
161 |
return;
|
|
162 |
}
|
|
163 |
CAknToolbar* popupToolbar = appUi->PopupToolbar();
|
|
164 |
if(popupToolbar)
|
|
165 |
{
|
|
166 |
popupToolbar->SetToolbarVisibility( !aVisible );
|
|
167 |
popupToolbar->MakeVisible( !aVisible );
|
|
168 |
if(!aVisible)
|
|
169 |
{
|
|
170 |
popupToolbar->DrawNow();
|
|
171 |
}
|
|
172 |
}
|
|
173 |
|
|
174 |
CAknToolbar* toolbar = appUi->CurrentFixedToolbar();
|
|
175 |
if(toolbar)
|
|
176 |
{
|
|
177 |
toolbar->SetToolbarVisibility(aVisible);
|
|
178 |
toolbar->MakeVisible( aVisible );
|
|
179 |
}
|
|
180 |
|
|
181 |
CAknToolbar* currentPopupToolbar = appUi->CurrentPopupToolbar();
|
|
182 |
if(currentPopupToolbar)
|
|
183 |
{
|
|
184 |
currentPopupToolbar->SetToolbarVisibility(aVisible);
|
|
185 |
currentPopupToolbar->MakeVisible( aVisible );
|
|
186 |
}
|
|
187 |
}
|
|
188 |
|
|
189 |
// ---------------------------------------------------------------------------
|
|
190 |
// SetTitleL()
|
|
191 |
// ---------------------------------------------------------------------------
|
|
192 |
void CShwSlideshowSettingsDialog::SetTitleL()
|
|
193 |
{
|
|
194 |
TRACER("CShwSlideshowSettingsDialog::SetTitleL");
|
|
195 |
GLX_LOG_INFO("CShwSlideshowSettingsDialog::SetTitleL");
|
|
196 |
// Stores the previous Title
|
|
197 |
iPreviousTitle = iTitlePane->Text()->AllocL();
|
|
198 |
HBufC* aTitleText = StringLoader::LoadLC(
|
|
199 |
R_SHW_SETTINGSLIST_TITLE_PANE_TXT, iEikonEnv );
|
|
200 |
|
|
201 |
iTitlePane->SetTextL( *aTitleText );
|
|
202 |
CleanupStack::PopAndDestroy( aTitleText );
|
|
203 |
}
|
|
204 |
|
|
205 |
// -----------------------------------------------------------------------------
|
|
206 |
// SetPreviousTitleL - Restores back the previous title, used in Slideshow Settings only
|
|
207 |
// -----------------------------------------------------------------------------
|
|
208 |
//
|
|
209 |
void CShwSlideshowSettingsDialog::SetPreviousTitleL()
|
|
210 |
{
|
|
211 |
TRACER("CShwSlideshowSettingsDialog::SetPreviousTitleL");
|
|
212 |
GLX_LOG_INFO("CShwSlideshowSettingsDialog::SetPreviousTitleL");
|
|
213 |
// Restore the Title back of the Calling View
|
|
214 |
iTitlePane->SetTextL( *iPreviousTitle );
|
|
215 |
}
|
|
216 |
|
|
217 |
//-----------------------------------------------------------------------------
|
|
218 |
// CShwSlideshowSettingsDialog::ProcessCommandL
|
|
219 |
//-----------------------------------------------------------------------------
|
|
220 |
void CShwSlideshowSettingsDialog::ProcessCommandL(TInt aCommandId)
|
|
221 |
{
|
|
222 |
TRACER("CShwSlideshowSettingsDialog::ProcessCommandL");
|
|
223 |
GLX_LOG_INFO("CShwSlideshowSettingsDialog::ProcessCommandL");
|
|
224 |
switch (aCommandId)
|
|
225 |
{
|
|
226 |
case EShwCmdHelp:
|
|
227 |
{
|
|
228 |
TCoeHelpContext helpContext;
|
|
229 |
helpContext.iMajor = TUid::Uid( KShwHelpUID );
|
|
230 |
helpContext.iContext.Copy( KSHW_HLP_SLIDESHOW_SETTINGS );
|
|
231 |
|
|
232 |
const TInt KListSz = 1;
|
|
233 |
CArrayFix<TCoeHelpContext>* contextList =
|
|
234 |
new (ELeave) CArrayFixFlat<TCoeHelpContext>( KListSz );
|
|
235 |
CleanupStack::PushL(contextList);
|
|
236 |
contextList->AppendL(helpContext);
|
|
237 |
|
|
238 |
HlpLauncher::LaunchHelpApplicationL(
|
|
239 |
iEikonEnv->WsSession(), contextList );
|
|
240 |
CleanupStack::Pop( contextList );
|
|
241 |
break;
|
|
242 |
}
|
|
243 |
case EShwCmdExit:
|
|
244 |
{
|
|
245 |
TryExitL(EShwCmdExit);
|
|
246 |
break;
|
|
247 |
}
|
|
248 |
default:
|
|
249 |
{
|
|
250 |
CAknDialog::ProcessCommandL(aCommandId);
|
|
251 |
break;
|
|
252 |
}
|
|
253 |
};
|
|
254 |
}
|
|
255 |
|
|
256 |
|
|
257 |
//-----------------------------------------------------------------------------
|
|
258 |
// CShwSlideshowSettingsDialog::CreateCustomControlL
|
|
259 |
//-----------------------------------------------------------------------------
|
|
260 |
SEikControlInfo CShwSlideshowSettingsDialog::CreateCustomControlL(TInt
|
|
261 |
aControlType)
|
|
262 |
{
|
|
263 |
TRACER("CShwSlideshowSettingsDialog::CreateCustomControlL");
|
|
264 |
GLX_LOG_INFO("CShwSlideshowSettingsDialog::CreateCustomControlL");
|
|
265 |
// create control info, no flags or trailer text set
|
|
266 |
SEikControlInfo controlInfo;
|
|
267 |
controlInfo.iControl = NULL;
|
|
268 |
controlInfo.iTrailerTextId = 0;
|
|
269 |
controlInfo.iFlags = 0;
|
|
270 |
|
|
271 |
if (aControlType == EShwCtSettingListBox)
|
|
272 |
{
|
|
273 |
iItemList = CShwSlideShowSettingsList::NewL(*iShwSettings);
|
|
274 |
controlInfo.iControl = iItemList; // giving ownership
|
|
275 |
}
|
|
276 |
return controlInfo; // returns ownership of ItemList
|
|
277 |
}
|
|
278 |
|
|
279 |
//-----------------------------------------------------------------------------
|
|
280 |
// CShwSlideshowSettingsDialog::OkToExitL
|
|
281 |
//-----------------------------------------------------------------------------
|
|
282 |
TBool CShwSlideshowSettingsDialog::OkToExitL(TInt aKeycode)
|
|
283 |
{
|
|
284 |
TRACER("CShwSlideshowSettingsDialog::OkToExitL");
|
|
285 |
GLX_LOG_INFO("CShwSlideshowSettingsDialog::OkToExitL");
|
|
286 |
TBool retVal = EFalse;
|
|
287 |
switch (aKeycode)
|
|
288 |
{
|
|
289 |
case EAknSoftkeyChange:
|
|
290 |
{
|
|
291 |
iItemList->UpdateListBoxL(iItemList->ListBox()->CurrentItemIndex(), ETrue);
|
|
292 |
break;
|
|
293 |
}
|
|
294 |
case EAknSoftkeyOptions: // display menu only
|
|
295 |
{
|
|
296 |
DisplayMenuL();
|
|
297 |
break;
|
|
298 |
}
|
|
299 |
case EAknSoftkeyBack: // exit dialog
|
|
300 |
case EEikCmdExit:
|
|
301 |
case EAknCmdExit:
|
|
302 |
case EShwCmdExit:
|
|
303 |
{
|
|
304 |
SetPreviousTitleL();
|
|
305 |
retVal = ETrue;
|
|
306 |
break;
|
|
307 |
}
|
|
308 |
}
|
|
309 |
return retVal;
|
|
310 |
}
|
|
311 |
|
|
312 |
//-----------------------------------------------------------------------------
|
|
313 |
// CShwSlideshowSettingsDialog::SizeChanged
|
|
314 |
//-----------------------------------------------------------------------------
|
|
315 |
void CShwSlideshowSettingsDialog::SizeChanged()
|
|
316 |
{
|
|
317 |
TRACER("CShwSlideshowSettingsDialog::SizeChanged");
|
|
318 |
GLX_LOG_INFO("CShwSlideshowSettingsDialog::SizeChanged");
|
|
319 |
if(iItemList)
|
|
320 |
{
|
|
321 |
iItemList->ListBox()->SetRect(Rect());
|
|
322 |
}
|
|
323 |
CAknDialog::SizeChanged();
|
|
324 |
}
|
|
325 |
|
|
326 |
//-----------------------------------------------------------------------------
|
|
327 |
// CShwSlideshowSettingsDialog::OfferKeyEventL
|
|
328 |
//-----------------------------------------------------------------------------
|
|
329 |
TKeyResponse CShwSlideshowSettingsDialog::OfferKeyEventL(
|
|
330 |
const TKeyEvent& aKeyEvent, TEventCode aType)
|
|
331 |
{
|
|
332 |
TRACER("CShwSlideshowSettingsDialog::OfferKeyEventL");
|
|
333 |
GLX_LOG_INFO("CShwSlideshowSettingsDialog::OfferKeyEventL");
|
|
334 |
// Fix for EEBD-79UL8Q - "No Naviscroll support in Slideshow settings
|
|
335 |
// options menu"
|
|
336 |
TKeyEvent localKeyEvent = aKeyEvent;
|
|
337 |
if ( aType == EEventKey )
|
|
338 |
{
|
|
339 |
switch ( aKeyEvent.iCode )
|
|
340 |
{
|
|
341 |
// Handle the previous and next navi-scroll events and modify the
|
|
342 |
// key code to the corresponding values used by the dialog
|
|
343 |
case EKeyPrevious:
|
|
344 |
localKeyEvent.iCode = EKeyUpArrow;
|
|
345 |
break;
|
|
346 |
case EKeyNext:
|
|
347 |
localKeyEvent.iCode = EKeyDownArrow;
|
|
348 |
break;
|
|
349 |
default:
|
|
350 |
// nothing to change
|
|
351 |
break;
|
|
352 |
}
|
|
353 |
}
|
|
354 |
|
|
355 |
// pass the key event up to the parent to handle
|
|
356 |
return CAknDialog::OfferKeyEventL( localKeyEvent, aType );
|
|
357 |
}
|
|
358 |
//-----------------------------------------------------------------------------
|
|
359 |
// CShwSlideshowSettingsDialog::FocusChanged
|
|
360 |
//-----------------------------------------------------------------------------
|
|
361 |
void CShwSlideshowSettingsDialog::FocusChanged(TDrawNow aDrawNow)
|
|
362 |
{
|
|
363 |
TRACER("CShwSlideshowSettingsDialog::FocusChanged");
|
|
364 |
GLX_LOG_INFO("CShwSlideshowSettingsDialog::FocusChanged");
|
|
365 |
// hide toolbar.
|
|
366 |
if(aDrawNow == EDrawNow )
|
|
367 |
{
|
|
368 |
SetSlShwToolbarVisibility(EFalse);
|
|
369 |
}
|
|
370 |
}
|
|
371 |
|
|
372 |
// End of File
|