|
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: Implementation of Messaging Settings GS Plugin |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <aknnotedialog.h> // Popup note |
|
22 #include <bautils.h> // BaflUtils |
|
23 #include <gsprivatepluginproviderids.h> // KGSPluginProviderInternal |
|
24 #include <gsplugininterface.h> |
|
25 #include <gsfwviewuids.h> // KGSAppsPluginUid |
|
26 #include <ecom/implementationproxy.h> |
|
27 #include <featmgr.h> // Featuremanager |
|
28 #include <MceSettingsDialog.h> |
|
29 #include <MceSettingsArrays.h> |
|
30 #include <hlplch.h> // HlpLauncher |
|
31 #include <muiulock.h> // CMuiuLock to lock settings |
|
32 #include <ConeResLoader.h> |
|
33 #include <StringLoader.h> // StringLoader |
|
34 |
|
35 #include <mcesettingsgspluginicons.mbg> // own bitmaps |
|
36 #include <MceSettingsGSPluginRsc.rsg> // own resources |
|
37 #include <aknclearer.h> // CAknLocalScreenClearer |
|
38 #include "MceSettingsGSPlugin.hrh" |
|
39 #include "MceSettingsGSPlugin.h" // own header |
|
40 #include "MceSettingsGSPluginContainer.h" |
|
41 |
|
42 // CONSTANTS |
|
43 _LIT( KMceSettingsGSPluginRscFile, "mcesettingsgspluginrsc.rsc" ); |
|
44 _LIT( KMceSetGSPluginMbmFile, "mcesettingsgspluginicons.mif"); |
|
45 |
|
46 |
|
47 |
|
48 // ========================= MEMBER FUNCTIONS ================================ |
|
49 |
|
50 // --------------------------------------------------------------------------- |
|
51 // CMceSettingsGSPlugin::CMceSettingsGSPlugin() |
|
52 // C++ default constructor can NOT contain any code, that |
|
53 // might leave. |
|
54 // --------------------------------------------------------------------------- |
|
55 // |
|
56 CMceSettingsGSPlugin::CMceSettingsGSPlugin() |
|
57 { |
|
58 } |
|
59 |
|
60 |
|
61 // --------------------------------------------------------------------------- |
|
62 // CMceSettingsGSPlugin::~CMceSettingsGSPlugin() |
|
63 // Destructor |
|
64 // --------------------------------------------------------------------------- |
|
65 // |
|
66 CMceSettingsGSPlugin::~CMceSettingsGSPlugin() |
|
67 { |
|
68 FeatureManager::UnInitializeLib(); |
|
69 delete iSettingsLock; |
|
70 delete iContainer; |
|
71 delete iLocalScreenClearer; |
|
72 } |
|
73 |
|
74 |
|
75 // --------------------------------------------------------------------------- |
|
76 // CMceSettingsGSPlugin::ConstructL |
|
77 // Symbian 2nd phase constructor can leave. |
|
78 // --------------------------------------------------------------------------- |
|
79 // |
|
80 void CMceSettingsGSPlugin::ConstructL() |
|
81 { |
|
82 // preparing resources for use |
|
83 TParse parse; |
|
84 parse.Set(KMceSettingsGSPluginRscFile, &KDC_RESOURCE_FILES_DIR, NULL); |
|
85 TFileName fileName = parse.FullName(); |
|
86 BaflUtils::NearestLanguageFile( iCoeEnv->FsSession(), fileName ); |
|
87 iResourceLoader.OpenL( fileName ); |
|
88 // base construct (base needs the resources to be loaded 1st) |
|
89 BaseConstructL( R_MCEUI_MAIN_VIEW ); |
|
90 FeatureManager::InitializeLibL(); |
|
91 } |
|
92 |
|
93 |
|
94 // --------------------------------------------------------------------------- |
|
95 // CMceSettingsGSPlugin::NewL() |
|
96 // Two-phased constructor. |
|
97 // --------------------------------------------------------------------------- |
|
98 // |
|
99 CMceSettingsGSPlugin* CMceSettingsGSPlugin::NewL( TAny* /*aAppUi*/ ) |
|
100 { |
|
101 CMceSettingsGSPlugin* self = new( ELeave ) CMceSettingsGSPlugin(); |
|
102 CleanupStack::PushL( self ); |
|
103 self->ConstructL(); |
|
104 CleanupStack::Pop( self ); |
|
105 return self; |
|
106 } |
|
107 |
|
108 |
|
109 // --------------------------------------------------------------------------- |
|
110 // CMceSettingsGSPlugin::Id() |
|
111 // See header for details. |
|
112 // --------------------------------------------------------------------------- |
|
113 // |
|
114 TUid CMceSettingsGSPlugin::Id() const |
|
115 { |
|
116 return KGSMceSettingsGSPluginUid; |
|
117 } |
|
118 |
|
119 |
|
120 // --------------------------------------------------------------------------- |
|
121 // CMceSettingsGSPlugin::NewContainerL |
|
122 // Creates new iContainer. |
|
123 // --------------------------------------------------------------------------- |
|
124 // |
|
125 void CMceSettingsGSPlugin::NewContainerL() |
|
126 { |
|
127 iContainer = new( ELeave ) CMceSettingsGSPluginContainer; |
|
128 } |
|
129 |
|
130 |
|
131 // --------------------------------------------------------------------------- |
|
132 // CMceSettingsGSPlugin::DoActivate |
|
133 // Activate this view |
|
134 // --------------------------------------------------------------------------- |
|
135 // |
|
136 void CMceSettingsGSPlugin::DoActivateL( |
|
137 const TVwsViewId& aPrevViewId, |
|
138 TUid aCustomMessageId, |
|
139 const TDesC8& aCustomMessage ) |
|
140 { |
|
141 iAppUi->AddViewDeactivationObserverL( this ); |
|
142 |
|
143 iSettingsLock = CMuiuLock::NewL( KMuiuLockSettings); |
|
144 |
|
145 // Reserve settings |
|
146 TInt err = iSettingsLock->Reserve(); |
|
147 if ( !err ) |
|
148 { |
|
149 CGSBaseView::DoActivateL( aPrevViewId, aCustomMessageId, aCustomMessage ); |
|
150 } |
|
151 else |
|
152 { |
|
153 // Show information note: MCE has settings opened |
|
154 CAknNoteDialog* dlg = new (ELeave) CAknNoteDialog( |
|
155 CAknNoteDialog::ENoTone, CAknNoteDialog::ELongTimeout); |
|
156 CleanupStack::PushL( dlg ); |
|
157 dlg->ExecuteLD(R_MCE_NOTE_SETTINGS_OPEN_MCE); |
|
158 CleanupStack::Pop(); // dlg |
|
159 iLocalScreenClearer = CAknLocalScreenClearer::NewL( EFalse ); |
|
160 iAppUi->ActivateLocalViewL( KGSAppsPluginUid ); |
|
161 } |
|
162 } |
|
163 |
|
164 |
|
165 // --------------------------------------------------------------------------- |
|
166 // CMceSettingsGSPlugin::DoDeactivate |
|
167 // Deactivate this view |
|
168 // --------------------------------------------------------------------------- |
|
169 // |
|
170 void CMceSettingsGSPlugin::DoDeactivate() |
|
171 { |
|
172 // Release repository |
|
173 iSettingsLock->Release(); |
|
174 |
|
175 CGSBaseView::DoDeactivate(); |
|
176 } |
|
177 |
|
178 |
|
179 // --------------------------------------------------------------------------- |
|
180 // CMceSettingsGSPlugin::HandleViewDeactivation() |
|
181 // See header for details. |
|
182 // --------------------------------------------------------------------------- |
|
183 // |
|
184 void CMceSettingsGSPlugin::HandleViewDeactivation( |
|
185 const TVwsViewId& /*aViewIdToBeDeactivated*/, |
|
186 const TVwsViewId& /*aNewlyActivatedViewId*/) |
|
187 { |
|
188 |
|
189 } |
|
190 |
|
191 |
|
192 // --------------------------------------------------------------------------- |
|
193 // CMceSettingsGSPlugin::HandleCommandL() |
|
194 // See header for details. |
|
195 // --------------------------------------------------------------------------- |
|
196 // |
|
197 void CMceSettingsGSPlugin::HandleCommandL( TInt aCommand ) |
|
198 { |
|
199 switch ( aCommand ) |
|
200 { |
|
201 case EMceSettingsCmdEdit: |
|
202 { |
|
203 static_cast<CMceSettingsGSPluginContainer*>(iContainer)->EditSubSettingsL(); |
|
204 break; |
|
205 } |
|
206 |
|
207 case EAknSoftkeyBack: |
|
208 { |
|
209 iAppUi->ActivateLocalViewL( KGSAppsPluginUid ); |
|
210 break; |
|
211 } |
|
212 case EMceSettingsGSHelp: |
|
213 case EAknCmdHelp: |
|
214 { |
|
215 if( FeatureManager::FeatureSupported( KFeatureIdHelp ) ) |
|
216 { |
|
217 HlpLauncher::LaunchHelpApplicationL( |
|
218 iEikonEnv->WsSession(), iAppUi->AppHelpContextL() ); |
|
219 } |
|
220 break; |
|
221 } |
|
222 default: |
|
223 { |
|
224 iAppUi->HandleCommandL( aCommand ); |
|
225 break; |
|
226 } |
|
227 } |
|
228 } |
|
229 |
|
230 |
|
231 // --------------------------------------------------------------------------- |
|
232 // CMceSettingsGSPlugin::GetCaptionL |
|
233 // Caption text for view to be displayed in NaviPane. |
|
234 // --------------------------------------------------------------------------- |
|
235 // |
|
236 void CMceSettingsGSPlugin::GetCaptionL( TDes& aCaption ) const |
|
237 { |
|
238 // the resource file is already opened. |
|
239 HBufC* result = StringLoader::LoadL( R_QTN_SET_FOLDER_MESSAGING, iEikonEnv ); |
|
240 aCaption.Copy( *result ); |
|
241 delete result; |
|
242 } |
|
243 |
|
244 |
|
245 // --------------------------------------------------------------------------- |
|
246 // CPSUIGSPlugin::PluginProviderCategory() |
|
247 // See header for details. |
|
248 // --------------------------------------------------------------------------- |
|
249 // |
|
250 TInt CMceSettingsGSPlugin::PluginProviderCategory() const |
|
251 { |
|
252 return KGSPluginProviderInternal; |
|
253 } |
|
254 |
|
255 |
|
256 // --------------------------------------------------------------------------- |
|
257 // CMceSettingsGSPlugin::CreateIconL() |
|
258 // See header for details. |
|
259 // --------------------------------------------------------------------------- |
|
260 // |
|
261 CGulIcon* CMceSettingsGSPlugin::CreateIconL( const TUid aIconType ) |
|
262 { |
|
263 CGulIcon* icon; |
|
264 |
|
265 TParse parse; |
|
266 parse.Set(KMceSetGSPluginMbmFile, &KDC_BITMAP_DIR, NULL); |
|
267 TPtrC iconFile = parse.FullName(); |
|
268 |
|
269 if( aIconType == KGSIconTypeLbxItem ) |
|
270 { |
|
271 icon = AknsUtils::CreateGulIconL( |
|
272 AknsUtils::SkinInstance(), |
|
273 KAknsIIDQgnPropSetAppsMce, |
|
274 iconFile, |
|
275 EMbmMcesettingsgspluginiconsQgn_prop_set_apps_mce, |
|
276 EMbmMcesettingsgspluginiconsQgn_prop_set_apps_mce_mask ); |
|
277 |
|
278 } |
|
279 else |
|
280 { |
|
281 icon = CGSPluginInterface::CreateIconL( aIconType ); |
|
282 } |
|
283 |
|
284 return icon; |
|
285 } |
|
286 |
|
287 |
|
288 // --------------------------------------------------------------------------- |
|
289 // CMceSettingsGSPlugin::HandleListBoxSelectionL |
|
290 // Handle any user actions while in the list view. |
|
291 // --------------------------------------------------------------------------- |
|
292 // |
|
293 void CMceSettingsGSPlugin::HandleListBoxSelectionL() |
|
294 { |
|
295 } |
|
296 |
|
297 |
|
298 // --------------------------------------------------------------------------- |
|
299 // CMceSettingsGSPlugin::DynInitMenuPaneL() |
|
300 // See header for details. |
|
301 // --------------------------------------------------------------------------- |
|
302 // |
|
303 void CMceSettingsGSPlugin::DynInitMenuPaneL( TInt /* aResourceId */, CEikMenuPane* /* aMenuPane */) |
|
304 { |
|
305 } |
|
306 |
|
307 |
|
308 // --------------------------------------------------------------------------- |
|
309 // CMceSettingsGSPlugin::HandleListBoxEventL() |
|
310 // See header for details. |
|
311 // --------------------------------------------------------------------------- |
|
312 // |
|
313 void CMceSettingsGSPlugin::HandleListBoxEventL(CEikListBox* /*aListBox*/, TListBoxEvent aEventType ) |
|
314 { |
|
315 switch(aEventType) |
|
316 { |
|
317 case EEventEnterKeyPressed: |
|
318 case EEventItemSingleClicked: |
|
319 HandleCommandL( EMceSettingsCmdEdit ); |
|
320 break; |
|
321 default: |
|
322 break; |
|
323 } |
|
324 } |
|
325 |
|
326 // End of file |