30
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 - 2010 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: MCS settings plug-in main class.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#include <ecom/implementationproxy.h>
|
|
19 |
#include <eikmenup.h>
|
|
20 |
#include <eikbtgpc.h>
|
|
21 |
#include <gsfwviewuids.h>
|
|
22 |
#include <gsprivatepluginproviderids.h>
|
|
23 |
#include <pathinfo.h>
|
|
24 |
#include <featmgr.h>
|
|
25 |
|
|
26 |
#include <mcspluginsettingsres.rsg>
|
|
27 |
#include <aisystemuids.hrh>
|
|
28 |
|
|
29 |
#include "mcspluginsettings.hrh"
|
|
30 |
#include "mcspluginsettings.h"
|
|
31 |
#include "mcspluginsettingscontainer.h"
|
|
32 |
#include "mcspluginsettingsmodel.h"
|
|
33 |
#include "mcspluginuids.hrh"
|
|
34 |
|
|
35 |
const TUid KUidScutSettingsPlugin =
|
|
36 |
{
|
|
37 |
AI_UID_ECOM_IMPLEMENTATION_SETTINGS_MCSPLUGIN
|
|
38 |
};
|
|
39 |
|
|
40 |
_LIT(KMCSSettingsResourceFileName, "mcspluginsettingsres.rsc");
|
|
41 |
|
|
42 |
/** Implementation table for MCS settings plug-in */
|
|
43 |
const TImplementationProxy KMCSPluginSettingsImplementationTable[] =
|
|
44 |
{
|
|
45 |
IMPLEMENTATION_PROXY_ENTRY(
|
|
46 |
AI_UID_ECOM_IMPLEMENTATION_SETTINGS_MCSPLUGIN, CMCSPluginSettings::NewL)
|
|
47 |
};
|
|
48 |
|
|
49 |
|
|
50 |
// ---------------------------------------------------------------------------
|
|
51 |
// Gate/factory function.
|
|
52 |
// ---------------------------------------------------------------------------
|
|
53 |
//
|
|
54 |
EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
|
|
55 |
{
|
|
56 |
aTableCount =
|
|
57 |
sizeof(KMCSPluginSettingsImplementationTable) /
|
|
58 |
sizeof(TImplementationProxy);
|
|
59 |
return KMCSPluginSettingsImplementationTable;
|
|
60 |
}
|
|
61 |
|
|
62 |
// ======== MEMBER FUNCTIONS ========
|
|
63 |
|
|
64 |
// ---------------------------------------------------------------------------
|
|
65 |
// First phase construction
|
|
66 |
// ---------------------------------------------------------------------------
|
|
67 |
//
|
|
68 |
CMCSPluginSettings::CMCSPluginSettings()
|
|
69 |
{
|
|
70 |
}
|
|
71 |
|
|
72 |
// ---------------------------------------------------------------------------
|
|
73 |
// Second phase construction
|
|
74 |
// ---------------------------------------------------------------------------
|
|
75 |
//
|
|
76 |
void CMCSPluginSettings::ConstructL()
|
|
77 |
{
|
|
78 |
FeatureManager::InitializeLibL();
|
|
79 |
|
|
80 |
TParsePtrC driveParse(PathInfo::RomRootPath());
|
|
81 |
TFileName resourceName(driveParse.Drive());
|
|
82 |
// Find the resource file.
|
|
83 |
TParse parse;
|
|
84 |
parse.Set(KMCSSettingsResourceFileName, &KDC_RESOURCE_FILES_DIR, NULL);
|
|
85 |
resourceName.Append(parse.FullName());
|
|
86 |
// Open resource file.
|
|
87 |
iResourceLoader.OpenL(resourceName);
|
|
88 |
|
|
89 |
iModel = CMCSPluginSettingsModel::NewL(*this, iCoeEnv);
|
|
90 |
|
|
91 |
BaseConstructL(R_AI_MCS_SETTINGS_VIEW);
|
|
92 |
}
|
|
93 |
|
|
94 |
// ---------------------------------------------------------------------------
|
|
95 |
// Two-phased constructor
|
|
96 |
// ---------------------------------------------------------------------------
|
|
97 |
//
|
|
98 |
CMCSPluginSettings* CMCSPluginSettings::NewL( TAny* /*aInitParams*/ )
|
|
99 |
{
|
|
100 |
CMCSPluginSettings* self = new (ELeave) CMCSPluginSettings;
|
|
101 |
CleanupStack::PushL(self);
|
|
102 |
self->ConstructL();
|
|
103 |
CleanupStack::Pop(self);
|
|
104 |
return self;
|
|
105 |
}
|
|
106 |
|
|
107 |
// ---------------------------------------------------------------------------
|
|
108 |
// Destructor
|
|
109 |
// ---------------------------------------------------------------------------
|
|
110 |
//
|
|
111 |
CMCSPluginSettings::~CMCSPluginSettings()
|
|
112 |
{
|
|
113 |
FeatureManager::UnInitializeLib();
|
|
114 |
iResourceLoader.Close();
|
|
115 |
delete iModel;
|
|
116 |
}
|
|
117 |
|
|
118 |
// ---------------------------------------------------------------------------
|
|
119 |
// From CAknView
|
|
120 |
// Returns view id.
|
|
121 |
// ---------------------------------------------------------------------------
|
|
122 |
//
|
|
123 |
TUid CMCSPluginSettings::Id() const
|
|
124 |
{
|
|
125 |
return KUidScutSettingsPlugin;
|
|
126 |
}
|
|
127 |
|
|
128 |
// ---------------------------------------------------------------------------
|
|
129 |
// From CAknView
|
|
130 |
// Handles commands.
|
|
131 |
// ---------------------------------------------------------------------------
|
|
132 |
//
|
|
133 |
void CMCSPluginSettings::HandleCommandL(TInt aCommand)
|
|
134 |
{
|
|
135 |
switch (aCommand)
|
|
136 |
{
|
|
137 |
case EAiScutSettingsCmdChange:
|
|
138 |
Container()->HandleChangeCommandL();
|
|
139 |
break;
|
|
140 |
|
|
141 |
case EAknCmdHelp:
|
|
142 |
Container()->HandleHelpCommandL();
|
|
143 |
break;
|
|
144 |
|
|
145 |
case EAknSoftkeyBack:
|
|
146 |
case EAknSoftkeyExit:
|
|
147 |
iAppUi->HandleCommandL(EAknCmdExit);
|
|
148 |
break;
|
|
149 |
|
|
150 |
default:
|
|
151 |
iAppUi->HandleCommandL(aCommand);
|
|
152 |
break;
|
|
153 |
}
|
|
154 |
}
|
|
155 |
|
|
156 |
// ----------------------------------------------------------------------------
|
|
157 |
// From CAknView
|
|
158 |
// First method called by the Avkon framwork
|
|
159 |
// ----------------------------------------------------------------------------
|
|
160 |
//
|
|
161 |
void CMCSPluginSettings::DoActivateL(const TVwsViewId& aPrevViewId, TUid aCustomMessageId, const TDesC8& aCustomMessage)
|
|
162 |
{
|
|
163 |
iModel->SetPluginIdL( aCustomMessage );
|
|
164 |
iModel->UpdateAppListL( EFalse );
|
|
165 |
iModel->UpdateBkmListL( EFalse );
|
|
166 |
iModel->UpdateSettingsL();
|
|
167 |
CGSBaseView::DoActivateL( aPrevViewId, aCustomMessageId, aCustomMessage );
|
|
168 |
}
|
|
169 |
|
|
170 |
// ----------------------------------------------------------------------------
|
|
171 |
// From CAknView
|
|
172 |
// Called by the Avkon view framework when closing.
|
|
173 |
// ----------------------------------------------------------------------------
|
|
174 |
//
|
|
175 |
void CMCSPluginSettings::DoDeactivate()
|
|
176 |
{
|
|
177 |
CGSBaseView::DoDeactivate();
|
|
178 |
}
|
|
179 |
|
|
180 |
// ----------------------------------------------------------------------------
|
|
181 |
// From MEikMenuObserver
|
|
182 |
// ----------------------------------------------------------------------------
|
|
183 |
//
|
|
184 |
void CMCSPluginSettings::DynInitMenuPaneL(
|
|
185 |
TInt aResourceId, CEikMenuPane* aMenuPane)
|
|
186 |
{
|
|
187 |
if (aMenuPane && aResourceId == R_AI_MCS_SETTINGS_MENUPANE)
|
|
188 |
{
|
|
189 |
if (!FeatureManager::FeatureSupported(KFeatureIdHelp))
|
|
190 |
{
|
|
191 |
// Disable help if not supported
|
|
192 |
aMenuPane->SetItemDimmed(EAknCmdHelp, ETrue);
|
|
193 |
}
|
|
194 |
if (iModel->MdcaCount() == 0)
|
|
195 |
{
|
|
196 |
aMenuPane->SetItemDimmed(EAiScutSettingsCmdChange, ETrue);
|
|
197 |
}
|
|
198 |
}
|
|
199 |
}
|
|
200 |
|
|
201 |
// ---------------------------------------------------------------------------
|
|
202 |
// From CGSPluginInterface
|
|
203 |
// ---------------------------------------------------------------------------
|
|
204 |
//
|
|
205 |
void CMCSPluginSettings::GetCaptionL(TDes& aCaption) const
|
|
206 |
{
|
|
207 |
iCoeEnv->ReadResourceL(aCaption, R_AI_MCS_SETTINGS_VIEW_CAPTION);
|
|
208 |
}
|
|
209 |
|
|
210 |
// ---------------------------------------------------------------------------
|
|
211 |
// From CGSPluginInterface
|
|
212 |
// ---------------------------------------------------------------------------
|
|
213 |
//
|
|
214 |
TInt CMCSPluginSettings::PluginProviderCategory() const
|
|
215 |
{
|
|
216 |
return KGSPluginProviderInternal;
|
|
217 |
}
|
|
218 |
|
|
219 |
// ---------------------------------------------------------------------------
|
|
220 |
// From CGSPluginInterface
|
|
221 |
// ---------------------------------------------------------------------------
|
|
222 |
//
|
|
223 |
TBool CMCSPluginSettings::Visible() const
|
|
224 |
{
|
|
225 |
return EFalse;
|
|
226 |
}
|
|
227 |
|
|
228 |
// ---------------------------------------------------------------------------
|
|
229 |
// From CGSBaseView
|
|
230 |
// Returns view id.
|
|
231 |
// ---------------------------------------------------------------------------
|
|
232 |
//
|
|
233 |
CMCSPluginSettingsContainer* CMCSPluginSettings::Container()
|
|
234 |
{
|
|
235 |
return static_cast<CMCSPluginSettingsContainer*>(iContainer);
|
|
236 |
}
|
|
237 |
|
|
238 |
// ---------------------------------------------------------------------------
|
|
239 |
// From CGSBaseView
|
|
240 |
// ---------------------------------------------------------------------------
|
|
241 |
//
|
|
242 |
void CMCSPluginSettings::NewContainerL()
|
|
243 |
{
|
|
244 |
delete iContainer;
|
|
245 |
iContainer = NULL;
|
|
246 |
|
|
247 |
iContainer = new (ELeave) CMCSPluginSettingsContainer();
|
|
248 |
Container()->SetModel(iModel);
|
|
249 |
iModel->SetContainer(Container());
|
|
250 |
}
|
|
251 |
|
|
252 |
// ---------------------------------------------------------------------------
|
|
253 |
// From CGSBaseView
|
|
254 |
// ---------------------------------------------------------------------------
|
|
255 |
//
|
|
256 |
void CMCSPluginSettings::HandleListBoxSelectionL()
|
|
257 |
{
|
|
258 |
Container()->HandleChangeCommandL();
|
|
259 |
}
|
|
260 |
|
|
261 |
// End of File.
|