|
1 /* |
|
2 * Copyright (c) 2006-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: Screensaver slide set settings dialog. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // General |
|
20 #include <e32std.h> |
|
21 #include <StringLoader.h> |
|
22 #include <e32property.h> |
|
23 #include <csxhelp/skins.hlp.hrh> |
|
24 |
|
25 // From AVKON |
|
26 #include <avkon.hrh> |
|
27 #include <aknappui.h> |
|
28 #include <aknslidersettingpage.h> |
|
29 #include <AknsSrvClient.h> |
|
30 |
|
31 // Screensaver PS keys. |
|
32 #include <ScreensaverInternalPSKeys.h> |
|
33 |
|
34 // Psln Slide set specific. |
|
35 #include "pslnslidesetscreensaverdialog.h" |
|
36 #include "pslnslidesetdialog.hrh" |
|
37 #include "pslnslidesetmodel.h" |
|
38 #include "pslnslidesetconst.h" |
|
39 |
|
40 // Resources |
|
41 #include <pslnslidesetdialogrsc.rsg> |
|
42 |
|
43 // ============================ MEMBER FUNCTIONS =============================== |
|
44 |
|
45 // ----------------------------------------------------------------------------- |
|
46 // C++ default constructor can NOT contain any code, that might leave. |
|
47 // ----------------------------------------------------------------------------- |
|
48 // |
|
49 CPslnSlidesetScreensaverDialog::CPslnSlidesetScreensaverDialog() |
|
50 { |
|
51 } |
|
52 |
|
53 // ----------------------------------------------------------------------------- |
|
54 // Symbian 2nd phase constructor can leave. |
|
55 // ----------------------------------------------------------------------------- |
|
56 // |
|
57 void CPslnSlidesetScreensaverDialog::ConstructL() |
|
58 { |
|
59 #ifndef RD_SLIDESHOW_SCREENSAVER |
|
60 User::Leave( KErrNotSupported ); |
|
61 #endif // RD_SLIDESHOW_SCREENSAVER |
|
62 BaseConstructL( |
|
63 GetDialogFlag( CPslnSlidesetDialogInterface::EPslnDialogType ) ); |
|
64 |
|
65 iSlideSetTypeItems = iCoeEnv->ReadDesC16ArrayResourceL( |
|
66 R_PSLN_SLIDESET_TYPE_SS_SETTING_PAGE_LBX ); |
|
67 } |
|
68 |
|
69 // ----------------------------------------------------------------------------- |
|
70 // Two-phased constructor. |
|
71 // ----------------------------------------------------------------------------- |
|
72 // |
|
73 CPslnSlidesetScreensaverDialog* CPslnSlidesetScreensaverDialog::NewL() |
|
74 { |
|
75 CPslnSlidesetScreensaverDialog* self = NewLC(); |
|
76 CleanupStack::Pop(); // Self |
|
77 return self; |
|
78 } |
|
79 |
|
80 // ----------------------------------------------------------------------------- |
|
81 // Two-phased constructor. |
|
82 // ----------------------------------------------------------------------------- |
|
83 // |
|
84 CPslnSlidesetScreensaverDialog* CPslnSlidesetScreensaverDialog::NewLC() |
|
85 { |
|
86 CPslnSlidesetScreensaverDialog* self = |
|
87 new ( ELeave ) CPslnSlidesetScreensaverDialog(); |
|
88 CleanupStack::PushL( self ); |
|
89 self->ConstructL(); |
|
90 return self; |
|
91 } |
|
92 |
|
93 // Destructor |
|
94 CPslnSlidesetScreensaverDialog::~CPslnSlidesetScreensaverDialog() |
|
95 { |
|
96 } |
|
97 |
|
98 // ----------------------------------------------------------------------------- |
|
99 // Executes dialog. |
|
100 // ----------------------------------------------------------------------------- |
|
101 // |
|
102 TInt CPslnSlidesetScreensaverDialog::ExecuteDialogLD() |
|
103 { |
|
104 return CAknDialog::ExecuteLD( R_PSLN_SETTINGS_DIALOG ); |
|
105 } |
|
106 |
|
107 // ----------------------------------------------------------------------------- |
|
108 // Configures dialog. |
|
109 // ----------------------------------------------------------------------------- |
|
110 // |
|
111 void CPslnSlidesetScreensaverDialog::SetDialogFlag( |
|
112 const TInt aFlag, const TInt aValue ) |
|
113 { |
|
114 switch( aFlag ) |
|
115 { |
|
116 case CPslnSlidesetDialogInterface::EPslnConfigurability: |
|
117 case CPslnSlidesetDialogInterface::EPslnDialogType: |
|
118 // Cannot be changed dynamically. |
|
119 break; |
|
120 case CPslnSlidesetDialogInterface::EPslnLaunchMode: |
|
121 if ( aValue == CPslnSlidesetDialogInterface::EPslnNormal || |
|
122 aValue == CPslnSlidesetDialogInterface::EPslnConfigureOnly ) |
|
123 { |
|
124 iLaunchMode = aValue; |
|
125 } |
|
126 break; |
|
127 default: |
|
128 break; |
|
129 } |
|
130 } |
|
131 |
|
132 // ----------------------------------------------------------------------------- |
|
133 // Queries for dialog parameter. |
|
134 // ----------------------------------------------------------------------------- |
|
135 // |
|
136 TInt CPslnSlidesetScreensaverDialog::GetDialogFlag( const TInt aFlag ) |
|
137 { |
|
138 TInt flagValue = KErrNotFound; |
|
139 switch( aFlag ) |
|
140 { |
|
141 case CPslnSlidesetDialogInterface::EPslnDialogType: |
|
142 flagValue = EPslnScreensaverDialog; |
|
143 break; |
|
144 case CPslnSlidesetDialogInterface::EPslnLaunchMode: |
|
145 // Configuring Screensaver is handled using screensaver framework. |
|
146 flagValue = iLaunchMode; |
|
147 break; |
|
148 case CPslnSlidesetDialogInterface::EPslnConfigurability: |
|
149 // Activation is handled by screensaver framework and Psln application. |
|
150 flagValue = CPslnSlidesetDialogInterface::EPslnUnknown; |
|
151 break; |
|
152 default: |
|
153 break; |
|
154 } |
|
155 return flagValue; |
|
156 } |
|
157 |
|
158 // ----------------------------------------------------------------------------- |
|
159 // Layouts dialog before showing it. |
|
160 // ----------------------------------------------------------------------------- |
|
161 // |
|
162 void CPslnSlidesetScreensaverDialog::PreLayoutDynInitL() |
|
163 { |
|
164 // Set title pane text. |
|
165 SetTitlePaneL( R_PSLN_SLIDESET_SCREENSAVER_DIALOG_TITLE ); |
|
166 // Set middle softkey as Change. |
|
167 CPslnSlidesetDialog::SetMiddleSoftKeyLabelL( |
|
168 R_PSLN_MSK_CHANGE, |
|
169 EPslnCmdAppSetScreenSaver ); |
|
170 CPslnSlidesetDialog::PreLayoutDynInitL(); |
|
171 } |
|
172 |
|
173 // ----------------------------------------------------------------------------- |
|
174 // Reimplements CAknDialog::OkToExitL inorder to indicate to the |
|
175 // screensaver that new settings have been defined. |
|
176 // ----------------------------------------------------------------------------- |
|
177 // |
|
178 TBool CPslnSlidesetScreensaverDialog::OkToExitL( TInt aButtonId ) |
|
179 { |
|
180 // Check if model indicates that setting values have been updated. |
|
181 if ( iModel->HasDialogUpdatedValues() ) |
|
182 { |
|
183 TInt psValue = KErrNotFound; |
|
184 User::LeaveIfError( |
|
185 RProperty::Get( |
|
186 KPSUidScreenSaver, |
|
187 KScreenSaverPluginSettingsChanged, |
|
188 psValue ) ); |
|
189 |
|
190 // If so, check P&S key. |
|
191 if ( psValue == EScreenSaverPluginSettingsChanging ) |
|
192 { |
|
193 // If P&S key indicates that setting changes need to be |
|
194 // informed, do so. |
|
195 User::LeaveIfError( |
|
196 RProperty::Set( |
|
197 KPSUidScreenSaver, |
|
198 KScreenSaverPluginSettingsChanged, |
|
199 EScreenSaverPluginSettingsChanged ) ); |
|
200 } |
|
201 } |
|
202 return CPslnSlidesetDialog::OkToExitL( aButtonId ); |
|
203 } |
|
204 |
|
205 // ----------------------------------------------------------------------------- |
|
206 // Adds setting list items to listbox. |
|
207 // ----------------------------------------------------------------------------- |
|
208 // |
|
209 void CPslnSlidesetScreensaverDialog::CreateListBoxItemsL() |
|
210 { |
|
211 iItems = iCoeEnv->ReadDesC16ArrayResourceL( |
|
212 R_PSLN_SCREENSAVER_SLIDE_SETTING_LBX_ITEMS ); |
|
213 CPslnSlidesetDialog::MakeItemL( EPslnSlideSetImagesId ); |
|
214 CPslnSlidesetDialog::MakeItemL( EPslnSlideSetDurationId ); |
|
215 |
|
216 if ( !IsFeatureSupported( EPslnSlideSetBacklightRemoved ) ) |
|
217 { |
|
218 CPslnSlidesetDialog::MakeItemL( EPslnSlideSetBacklightId ); |
|
219 } |
|
220 } |
|
221 |
|
222 // --------------------------------------------------------------------------- |
|
223 // Gets help context for Help application. |
|
224 // --------------------------------------------------------------------------- |
|
225 // |
|
226 void CPslnSlidesetScreensaverDialog::GetHelpContext( |
|
227 TCoeHelpContext& aContext ) const |
|
228 { |
|
229 aContext.iMajor = KUidPsln; |
|
230 aContext.iContext = KSKINS_HLP_SCREENS_SETTINGS; |
|
231 } |
|
232 |
|
233 // --------------------------------------------------------------------------- |
|
234 // Shows duration slider setting page. |
|
235 // --------------------------------------------------------------------------- |
|
236 // |
|
237 void CPslnSlidesetScreensaverDialog::ShowDurationSliderL() |
|
238 { |
|
239 TInt currentValue = iModel->GetSlideSetDuration(); |
|
240 |
|
241 // Retrieve title txt. |
|
242 HBufC* sliderTitle = StringLoader::LoadLC( R_PSLN_DURATION_SLIDE_PAGE_TITLE ); |
|
243 |
|
244 // Instantiate setting page. |
|
245 CAknSliderSettingPage* dlg = new( ELeave ) CAknSliderSettingPage( |
|
246 sliderTitle, |
|
247 EAknSettingPageNoOrdinalDisplayed, |
|
248 EAknCtSlider, |
|
249 R_PSLN_DURATION_SLIDER, |
|
250 R_PSLN_IMAGE_SELECTION_SETTING_PAGE, |
|
251 currentValue ); |
|
252 |
|
253 dlg->SetSettingId( EPslnSlideSetDurationId ); |
|
254 dlg->SetSettingPageObserver( this ); |
|
255 dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ); |
|
256 // New value is stored in base class to CenRep. |
|
257 |
|
258 CleanupStack::PopAndDestroy( sliderTitle ); |
|
259 } |
|
260 |
|
261 // --------------------------------------------------------------------------- |
|
262 // Shows backlight slider setting page. |
|
263 // --------------------------------------------------------------------------- |
|
264 // |
|
265 void CPslnSlidesetScreensaverDialog::ShowBacklightSliderL() |
|
266 { |
|
267 // Empty implementation to be overloaded. |
|
268 TInt currentValue = iModel->GetSlideSetBacklight(); |
|
269 |
|
270 // Retrieve title txt. |
|
271 HBufC* sliderTitle = StringLoader::LoadLC( R_PSLN_BACKLIGHT_SLIDE_PAGE_TITLE ); |
|
272 |
|
273 CAknSliderSettingPage* dlg = new( ELeave ) CAknSliderSettingPage( |
|
274 sliderTitle, |
|
275 EAknSettingPageNoOrdinalDisplayed, |
|
276 EAknCtSlider, |
|
277 R_PSLN_BACKLIGHT_SLIDER, |
|
278 R_PSLN_IMAGE_SELECTION_SETTING_PAGE, |
|
279 currentValue ); |
|
280 |
|
281 dlg->SetSettingId( EPslnSlideSetBacklightId ); |
|
282 dlg->SetSettingPageObserver( this ); |
|
283 dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ); |
|
284 // New value is stored in base class to CenRep. |
|
285 |
|
286 CleanupStack::PopAndDestroy( sliderTitle ); |
|
287 } |
|
288 |
|
289 // End of File |