|
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: SearchSettingsPlugin.cpp //GSAppsPlugin source code. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 // Includes |
|
24 #include <AknViewAppUi.h> |
|
25 #include <ConeResLoader.h> |
|
26 #include <SearchSettingsPluginRsc.rsg> |
|
27 #include <GSFWViewUIDs.h> |
|
28 #include <GSMainView.h> |
|
29 #include <GSPrivatePluginProviderIds.h> |
|
30 #include <GSTabHelper.h> |
|
31 #include <GSTabbedViewOwner.h> |
|
32 #include <StringLoader.h> |
|
33 #include <barsread.h> |
|
34 #include <akntitle.h> |
|
35 #include <hlplch.h> |
|
36 #include <set.hlp.hrh> |
|
37 |
|
38 #include <ImplementationInformation.h> |
|
39 //#include <srchuisettingsplugininterface.h> |
|
40 |
|
41 #include "SearchSettingsPlugin.h" |
|
42 #include "SearchSettingsContainer.h" |
|
43 #include <srchuisettingsview.h> |
|
44 |
|
45 // ========================= MEMBER FUNCTIONS ================================ |
|
46 |
|
47 // --------------------------------------------------------------------------- |
|
48 // CSearchSettingsPlugin::NewL |
|
49 // Static constructor |
|
50 // |
|
51 // --------------------------------------------------------------------------- |
|
52 // |
|
53 CSearchSettingsPlugin* CSearchSettingsPlugin::NewL( TAny* /*aInitParams*/ ) |
|
54 { |
|
55 CSearchSettingsPlugin* self = new(ELeave) CSearchSettingsPlugin(); |
|
56 CleanupStack::PushL( self ); |
|
57 self->ConstructL(); |
|
58 CleanupStack::Pop( self ); |
|
59 return self; |
|
60 } |
|
61 |
|
62 // --------------------------------------------------------------------------- |
|
63 // CSearchSettingsPlugin::~CSearchSettingsPlugin |
|
64 // Destructor |
|
65 // |
|
66 // --------------------------------------------------------------------------- |
|
67 // |
|
68 CSearchSettingsPlugin::~CSearchSettingsPlugin() |
|
69 { |
|
70 iResources.Close(); |
|
71 } |
|
72 |
|
73 // ----------------------------------------------------------------------------- |
|
74 // CSearchSettingsPlugin::Id |
|
75 // |
|
76 // |
|
77 // ----------------------------------------------------------------------------- |
|
78 // |
|
79 TUid CSearchSettingsPlugin::Id() const |
|
80 { |
|
81 return KGSSearchSettingsPluginUid ; //KGSAppsPluginUid; |
|
82 } |
|
83 |
|
84 |
|
85 // ----------------------------------------------------------------------------- |
|
86 // CSearchSettingsPlugin::DoActivateL |
|
87 // |
|
88 // |
|
89 // ----------------------------------------------------------------------------- |
|
90 // |
|
91 |
|
92 void CSearchSettingsPlugin::DoActivateL( const TVwsViewId& aPrevViewId, |
|
93 TUid aCustomMessageId, |
|
94 const TDesC8& aCustomMessage ) |
|
95 { |
|
96 |
|
97 iPrevViewId = aPrevViewId; |
|
98 CGSParentPlugin::DoActivateL( aPrevViewId, |
|
99 aCustomMessageId, |
|
100 aCustomMessage ); |
|
101 |
|
102 if( iContainer ) |
|
103 { |
|
104 AppUi()->RemoveFromViewStack( *this, iContainer ); |
|
105 delete iContainer; |
|
106 iContainer = NULL; |
|
107 } |
|
108 |
|
109 } |
|
110 |
|
111 |
|
112 // ----------------------------------------------------------------------------- |
|
113 // CSearchSettingsPlugin::DoDeactivate |
|
114 // |
|
115 // |
|
116 // ----------------------------------------------------------------------------- |
|
117 // |
|
118 void CSearchSettingsPlugin::DoDeactivate() |
|
119 { |
|
120 |
|
121 CGSParentPlugin::DoDeactivate(); |
|
122 } |
|
123 |
|
124 |
|
125 // ========================= From CGSParentPlugin ===================== |
|
126 |
|
127 |
|
128 // ----------------------------------------------------------------------------- |
|
129 // CSearchSettingsPlugin::UpperLevelViewUid |
|
130 // |
|
131 // |
|
132 // ----------------------------------------------------------------------------- |
|
133 // |
|
134 TUid CSearchSettingsPlugin::UpperLevelViewUid() |
|
135 { |
|
136 return KGSAppsPluginUid ; |
|
137 } |
|
138 |
|
139 // ----------------------------------------------------------------------------- |
|
140 // CSearchSettingsPlugin::GetHelpContext |
|
141 // |
|
142 // |
|
143 // ----------------------------------------------------------------------------- |
|
144 // |
|
145 void CSearchSettingsPlugin::GetHelpContext( TCoeHelpContext& aContext ) |
|
146 { |
|
147 aContext.iMajor = KUidGS; |
|
148 aContext.iContext = KSET_HLP_APPLICATIONS_LIST; |
|
149 } |
|
150 |
|
151 // ----------------------------------------------------------------------------- |
|
152 // CSearchSettingsPlugin::HandleCommandL |
|
153 // Handles user commands. |
|
154 // |
|
155 // ----------------------------------------------------------------------------- |
|
156 // |
|
157 void CSearchSettingsPlugin::HandleCommandL( TInt aCommand ) |
|
158 { |
|
159 switch ( aCommand ) |
|
160 { |
|
161 case EAknSoftkeyOpen: |
|
162 case EAknSoftkeyOk: |
|
163 case EAknSoftkeySelect: |
|
164 case 504: |
|
165 case 1001: |
|
166 { |
|
167 CGSParentPlugin::HandleCommandL(aCommand); |
|
168 break; |
|
169 } |
|
170 case EAknSoftkeyBack: |
|
171 { |
|
172 AppUi()->ActivateLocalViewL( iPrevViewId.iViewUid ); |
|
173 break; |
|
174 } |
|
175 case EAknSoftkeyExit: |
|
176 { |
|
177 static_cast<MEikCommandObserver*>( AppUi() )->ProcessCommandL( EAknCmdExit ); |
|
178 break; |
|
179 } |
|
180 case EAknCmdHelp: |
|
181 case EEikCmdHelpContents: |
|
182 { |
|
183 } |
|
184 default: |
|
185 { |
|
186 AppUi()->HandleCommandL( aCommand ); |
|
187 break; |
|
188 } |
|
189 } |
|
190 |
|
191 } |
|
192 |
|
193 // --------------------------------------------------------------------------- |
|
194 // CSearchSettingsPlugin::HandleListBoxEventL |
|
195 // Handles events of the ListBox. |
|
196 // |
|
197 // --------------------------------------------------------------------------- |
|
198 // |
|
199 void CSearchSettingsPlugin::HandleListBoxEventL( CEikListBox* /*aListBox*/ , |
|
200 TListBoxEvent aEventType ) |
|
201 { |
|
202 switch ( aEventType ) |
|
203 { |
|
204 case EEventEnterKeyPressed: |
|
205 case EEventItemDoubleClicked: |
|
206 HandleListBoxSelectionL(); |
|
207 break; |
|
208 default: |
|
209 break; |
|
210 } |
|
211 |
|
212 } |
|
213 // ----------------------------------------------------------------------------- |
|
214 // CSearchSettingsPlugin::GetCaptionL |
|
215 // |
|
216 // |
|
217 // ----------------------------------------------------------------------------- |
|
218 // |
|
219 void CSearchSettingsPlugin::GetCaptionL( TDes& aCaption ) const |
|
220 { |
|
221 // The resource file is already opened. |
|
222 HBufC* result = StringLoader::LoadL( R_GS_SEARCH_VIEW_CAPTION ); |
|
223 aCaption.Copy( *result ); |
|
224 delete result; |
|
225 } |
|
226 |
|
227 |
|
228 // ----------------------------------------------------------------------------- |
|
229 // CSearchSettingsPlugin::CreateIconL |
|
230 // creates the icon of the view. |
|
231 // |
|
232 // ----------------------------------------------------------------------------- |
|
233 // |
|
234 CGulIcon* CSearchSettingsPlugin::CreateIconL( const TUid aIconType ) |
|
235 { |
|
236 CGulIcon* icon; |
|
237 TParse* fp = new( ELeave ) TParse(); |
|
238 CleanupStack::PushL( fp ); |
|
239 fp->Set( KGSAppsPluginIconDirAndName, &KDC_BITMAP_DIR, NULL ); |
|
240 icon = CGSPluginInterface::CreateIconL( aIconType ); |
|
241 CleanupStack::PopAndDestroy( fp ); |
|
242 |
|
243 return icon; |
|
244 } |
|
245 |
|
246 // ----------------------------------------------------------------------------- |
|
247 // CSearchSettingsPlugin::PluginProviderCategory |
|
248 // |
|
249 // |
|
250 // ----------------------------------------------------------------------------- |
|
251 // |
|
252 TInt CSearchSettingsPlugin::PluginProviderCategory() const |
|
253 { |
|
254 return KGSPluginProviderInternal; |
|
255 } |
|
256 |
|
257 // --------------------------------------------------------------------------- |
|
258 // CSearchSettingsPlugin::HandleForegroundEventL |
|
259 // Handles changes to the application when it switches to or from the foreground |
|
260 // |
|
261 // --------------------------------------------------------------------------- |
|
262 // |
|
263 void CSearchSettingsPlugin::HandleForegroundEventL( TBool /* Foreground */ ) |
|
264 { |
|
265 } |
|
266 |
|
267 // --------------------------------------------------------------------------- |
|
268 // CSearchSettingsPlugin::CSearchSettingsPlugin |
|
269 // Constructor |
|
270 // |
|
271 // --------------------------------------------------------------------------- |
|
272 // |
|
273 CSearchSettingsPlugin::CSearchSettingsPlugin() |
|
274 : CGSParentPlugin(), iResources( *iCoeEnv ) |
|
275 { |
|
276 } |
|
277 |
|
278 // --------------------------------------------------------------------------- |
|
279 // CSearchSettingsPlugin::ConstructL |
|
280 // Symbian OS two-phased constructor |
|
281 // |
|
282 // --------------------------------------------------------------------------- |
|
283 // |
|
284 |
|
285 void CSearchSettingsPlugin::ConstructL() |
|
286 { |
|
287 TFileName resourceFileName; |
|
288 TPtrC driveLetter = TParsePtrC( RProcess().FileName() ).Drive(); |
|
289 _LIT( KResoureFileName, "searchSettingsPluginRsc.rsc" ); |
|
290 |
|
291 resourceFileName.Copy( driveLetter ); |
|
292 resourceFileName.Append( KDC_ECOM_RESOURCE_DIR ); |
|
293 resourceFileName.Append( KResoureFileName ); |
|
294 |
|
295 OpenLocalizedResourceFileL( resourceFileName, iResources ); |
|
296 BaseConstructL( R_GS_APPLICATIONS_VIEW, R_GS_SEARCH_VIEW_TITLE ); |
|
297 } |
|
298 |
|
299 // --------------------------------------------------------------------------- |
|
300 // CSearchSettingsPlugin::HandleListBoxSelectionL |
|
301 // Handles selection of the ListBox items. |
|
302 // |
|
303 // --------------------------------------------------------------------------- |
|
304 // |
|
305 void CSearchSettingsPlugin::HandleListBoxSelectionL() |
|
306 { |
|
307 } |
|
308 |
|
309 // End of File |
|
310 |