79
|
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 |
if ( iSettingsLock )
|
|
174 |
{
|
|
175 |
// Settings lock cleaned up
|
|
176 |
iSettingsLock->Release();
|
|
177 |
delete iSettingsLock;
|
|
178 |
iSettingsLock = NULL;
|
|
179 |
}
|
|
180 |
|
|
181 |
// iLocalScreenClearer cleaned up
|
|
182 |
if ( iLocalScreenClearer )
|
|
183 |
{
|
|
184 |
delete iLocalScreenClearer;
|
|
185 |
iLocalScreenClearer = NULL;
|
|
186 |
}
|
|
187 |
CGSBaseView::DoDeactivate();
|
|
188 |
}
|
|
189 |
|
|
190 |
|
|
191 |
// ---------------------------------------------------------------------------
|
|
192 |
// CMceSettingsGSPlugin::HandleViewDeactivation()
|
|
193 |
// See header for details.
|
|
194 |
// ---------------------------------------------------------------------------
|
|
195 |
//
|
|
196 |
void CMceSettingsGSPlugin::HandleViewDeactivation(
|
|
197 |
const TVwsViewId& /*aViewIdToBeDeactivated*/,
|
|
198 |
const TVwsViewId& /*aNewlyActivatedViewId*/)
|
|
199 |
{
|
|
200 |
|
|
201 |
}
|
|
202 |
|
|
203 |
|
|
204 |
// ---------------------------------------------------------------------------
|
|
205 |
// CMceSettingsGSPlugin::HandleCommandL()
|
|
206 |
// See header for details.
|
|
207 |
// ---------------------------------------------------------------------------
|
|
208 |
//
|
|
209 |
void CMceSettingsGSPlugin::HandleCommandL( TInt aCommand )
|
|
210 |
{
|
|
211 |
switch ( aCommand )
|
|
212 |
{
|
|
213 |
case EMceSettingsCmdEdit:
|
|
214 |
{
|
|
215 |
static_cast<CMceSettingsGSPluginContainer*>(iContainer)->EditSubSettingsL();
|
|
216 |
break;
|
|
217 |
}
|
|
218 |
|
|
219 |
case EAknSoftkeyBack:
|
|
220 |
{
|
|
221 |
iAppUi->ActivateLocalViewL( KGSAppsPluginUid );
|
|
222 |
break;
|
|
223 |
}
|
|
224 |
case EMceSettingsGSHelp:
|
|
225 |
case EAknCmdHelp:
|
|
226 |
{
|
|
227 |
if( FeatureManager::FeatureSupported( KFeatureIdHelp ) )
|
|
228 |
{
|
|
229 |
HlpLauncher::LaunchHelpApplicationL(
|
|
230 |
iEikonEnv->WsSession(), iAppUi->AppHelpContextL() );
|
|
231 |
}
|
|
232 |
break;
|
|
233 |
}
|
|
234 |
default:
|
|
235 |
{
|
|
236 |
iAppUi->HandleCommandL( aCommand );
|
|
237 |
break;
|
|
238 |
}
|
|
239 |
}
|
|
240 |
}
|
|
241 |
|
|
242 |
|
|
243 |
// ---------------------------------------------------------------------------
|
|
244 |
// CMceSettingsGSPlugin::GetCaptionL
|
|
245 |
// Caption text for view to be displayed in NaviPane.
|
|
246 |
// ---------------------------------------------------------------------------
|
|
247 |
//
|
|
248 |
void CMceSettingsGSPlugin::GetCaptionL( TDes& aCaption ) const
|
|
249 |
{
|
|
250 |
// the resource file is already opened.
|
|
251 |
HBufC* result = StringLoader::LoadL( R_QTN_SET_FOLDER_MESSAGING, iEikonEnv );
|
|
252 |
aCaption.Copy( *result );
|
|
253 |
delete result;
|
|
254 |
}
|
|
255 |
|
|
256 |
|
|
257 |
// ---------------------------------------------------------------------------
|
|
258 |
// CPSUIGSPlugin::PluginProviderCategory()
|
|
259 |
// See header for details.
|
|
260 |
// ---------------------------------------------------------------------------
|
|
261 |
//
|
|
262 |
TInt CMceSettingsGSPlugin::PluginProviderCategory() const
|
|
263 |
{
|
|
264 |
return KGSPluginProviderInternal;
|
|
265 |
}
|
|
266 |
|
|
267 |
|
|
268 |
// ---------------------------------------------------------------------------
|
|
269 |
// CMceSettingsGSPlugin::CreateIconL()
|
|
270 |
// See header for details.
|
|
271 |
// ---------------------------------------------------------------------------
|
|
272 |
//
|
|
273 |
CGulIcon* CMceSettingsGSPlugin::CreateIconL( const TUid aIconType )
|
|
274 |
{
|
|
275 |
CGulIcon* icon;
|
|
276 |
|
|
277 |
TParse parse;
|
|
278 |
parse.Set(KMceSetGSPluginMbmFile, &KDC_BITMAP_DIR, NULL);
|
|
279 |
TPtrC iconFile = parse.FullName();
|
|
280 |
|
|
281 |
if( aIconType == KGSIconTypeLbxItem )
|
|
282 |
{
|
|
283 |
icon = AknsUtils::CreateGulIconL(
|
|
284 |
AknsUtils::SkinInstance(),
|
|
285 |
KAknsIIDQgnPropSetAppsMce,
|
|
286 |
iconFile,
|
|
287 |
EMbmMcesettingsgspluginiconsQgn_prop_set_apps_mce,
|
|
288 |
EMbmMcesettingsgspluginiconsQgn_prop_set_apps_mce_mask );
|
|
289 |
|
|
290 |
}
|
|
291 |
else
|
|
292 |
{
|
|
293 |
icon = CGSPluginInterface::CreateIconL( aIconType );
|
|
294 |
}
|
|
295 |
|
|
296 |
return icon;
|
|
297 |
}
|
|
298 |
|
|
299 |
|
|
300 |
// ---------------------------------------------------------------------------
|
|
301 |
// CMceSettingsGSPlugin::HandleListBoxSelectionL
|
|
302 |
// Handle any user actions while in the list view.
|
|
303 |
// ---------------------------------------------------------------------------
|
|
304 |
//
|
|
305 |
void CMceSettingsGSPlugin::HandleListBoxSelectionL()
|
|
306 |
{
|
|
307 |
}
|
|
308 |
|
|
309 |
|
|
310 |
// ---------------------------------------------------------------------------
|
|
311 |
// CMceSettingsGSPlugin::DynInitMenuPaneL()
|
|
312 |
// See header for details.
|
|
313 |
// ---------------------------------------------------------------------------
|
|
314 |
//
|
|
315 |
void CMceSettingsGSPlugin::DynInitMenuPaneL( TInt /* aResourceId */, CEikMenuPane* /* aMenuPane */)
|
|
316 |
{
|
|
317 |
}
|
|
318 |
|
|
319 |
|
|
320 |
// ---------------------------------------------------------------------------
|
|
321 |
// CMceSettingsGSPlugin::HandleListBoxEventL()
|
|
322 |
// See header for details.
|
|
323 |
// ---------------------------------------------------------------------------
|
|
324 |
//
|
|
325 |
void CMceSettingsGSPlugin::HandleListBoxEventL(CEikListBox* /*aListBox*/, TListBoxEvent aEventType )
|
|
326 |
{
|
|
327 |
switch(aEventType)
|
|
328 |
{
|
|
329 |
case EEventEnterKeyPressed:
|
|
330 |
case EEventItemSingleClicked:
|
|
331 |
HandleCommandL( EMceSettingsCmdEdit );
|
|
332 |
break;
|
|
333 |
default:
|
|
334 |
break;
|
|
335 |
}
|
|
336 |
}
|
|
337 |
|
|
338 |
// End of file
|