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: MUSSettingsPlugin implementation. |
|
15 * Version : %version: 34 % << Don't touch! Updated by Synergy at check-out. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #include "mussettingsplugin.h" |
|
22 #include "mussettingscontainer.h" |
|
23 #include "mussettingsmodel.h" |
|
24 #include "mussettingsplugin.hrh" |
|
25 #include "mussipprofilemodel.h" |
|
26 #include "muslogger.h" |
|
27 #include "musresourcefinderutil.h" |
|
28 #include "mussesseioninformationapi.h" |
|
29 #include <gscommon.hrh> |
|
30 #include <mussettingsplugin.mbg> // Icons |
|
31 #include <mussettingsuirsc.rsg> // GUI Resource |
|
32 #include <gsprivatepluginproviderids.h> |
|
33 #include <aknnotewrappers.h> |
|
34 #include <aknradiobuttonsettingpage.h> |
|
35 #include <aknpopupsettingpage.h> |
|
36 #include <akntextsettingpage.h> |
|
37 #include <aknViewAppUi.h> |
|
38 #include <AknGlobalNote.h> |
|
39 #include <featmgr.h> |
|
40 #include <StringLoader.h> |
|
41 #include <hlplch.h> // HlpLauncher |
|
42 #include <pathinfo.h> |
|
43 |
|
44 #include <e32property.h> |
|
45 |
|
46 #include <CAknMemorySelectionDialogMultiDrive.h> |
|
47 #include <AknCommonDialogsDynMem.h> |
|
48 |
|
49 #include <CAknMemorySelectionDialog.h> |
|
50 |
|
51 // #include <CAknMemorySelectionDialog.h> |
|
52 |
|
53 |
|
54 |
|
55 // ======== MEMBER FUNCTIONS ======== |
|
56 |
|
57 |
|
58 // ----------------------------------------------------------------------------- |
|
59 // |
|
60 // ----------------------------------------------------------------------------- |
|
61 // |
|
62 CMusSettingsPlugin::CMusSettingsPlugin() |
|
63 : iResources( *iCoeEnv ) |
|
64 { |
|
65 MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::CMusSettingsPlugin()" ) |
|
66 } |
|
67 |
|
68 // ----------------------------------------------------------------------------- |
|
69 // |
|
70 // ----------------------------------------------------------------------------- |
|
71 // |
|
72 CMusSettingsPlugin::~CMusSettingsPlugin() |
|
73 { |
|
74 MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::~CMusSettingsPlugin()" ) |
|
75 FeatureManager::UnInitializeLib(); |
|
76 if( iContainer ) |
|
77 { |
|
78 AppUi()->RemoveFromViewStack( *this, iContainer ); |
|
79 delete iContainer; |
|
80 iContainer = NULL; |
|
81 } |
|
82 |
|
83 CloseResourceFile(); |
|
84 |
|
85 delete iModel; |
|
86 iModel = NULL; |
|
87 delete iHandler; |
|
88 iHandler = NULL; |
|
89 delete iDiskNotifyHandler; |
|
90 delete iCaption; |
|
91 MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::~CMusSettingsPlugin()" ) |
|
92 } |
|
93 |
|
94 // ----------------------------------------------------------------------------- |
|
95 // |
|
96 // |
|
97 // ----------------------------------------------------------------------------- |
|
98 // |
|
99 void CMusSettingsPlugin::ConstructL() |
|
100 { |
|
101 MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::ConstructL()" ) |
|
102 FeatureManager::InitializeLibL(); |
|
103 |
|
104 iResourceFileOpen = false; |
|
105 OpenResourceFileL(); |
|
106 |
|
107 MUS_LOG( "[MUSSET] Constructing the Base " ) |
|
108 BaseConstructL( R_GS_VS_VIEW ); |
|
109 iHandler = CMusSIPProfileModel::NewL(); |
|
110 MUS_LOG( "[MUSSET] CMusSettingsPlugin::ConstructL() 2" ) |
|
111 iModel = CMusSettingsModel::NewL( *iHandler ); |
|
112 iDiskNotifyHandler = CDiskNotifyHandler::NewL( *this, |
|
113 iEikonEnv->FsSession() ); |
|
114 User::LeaveIfError( iDiskNotifyHandler->NotifyDisk() ); // Subscribe disk notifications |
|
115 |
|
116 iCaption = StringLoader::LoadL( R_GS_VS_PLUGIN_CAPTION ); |
|
117 CloseResourceFile(); |
|
118 |
|
119 MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::ConstructL()" ) |
|
120 } |
|
121 |
|
122 // ----------------------------------------------------------------------------- |
|
123 // |
|
124 // |
|
125 // ----------------------------------------------------------------------------- |
|
126 // |
|
127 CMusSettingsPlugin* CMusSettingsPlugin::NewL( TAny* /*aInitParams*/ ) |
|
128 { |
|
129 MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::NewL()" ) |
|
130 CMusSettingsPlugin* self = new( ELeave ) CMusSettingsPlugin(); |
|
131 CleanupStack::PushL(self); |
|
132 self->ConstructL(); |
|
133 CleanupStack::Pop(self); |
|
134 MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::NewL()" ) |
|
135 return self; |
|
136 } |
|
137 |
|
138 // ----------------------------------------------------------------------------- |
|
139 // From class CAknView. |
|
140 // Returns UID of *this* settings plugin. |
|
141 // ----------------------------------------------------------------------------- |
|
142 // |
|
143 TUid CMusSettingsPlugin::Id() const |
|
144 { |
|
145 MUS_LOG1( "[MUSSET] <- CMusSettingsPlugin::Id()( %d )", |
|
146 KGSVSSettingsPluginUID.iUid ) |
|
147 return KGSVSSettingsPluginUID; |
|
148 } |
|
149 |
|
150 // ----------------------------------------------------------------------------- |
|
151 // Hides non-virtual member from base class CGSBaseView. |
|
152 // Handles a change in client rectangle size. |
|
153 // ----------------------------------------------------------------------------- |
|
154 // |
|
155 void CMusSettingsPlugin::HandleClientRectChange() |
|
156 { |
|
157 MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::HandleClientRectChange()" ) |
|
158 if ( iContainer && iContainer->iListBox ) |
|
159 { |
|
160 iContainer->SetRect( ClientRect() ); |
|
161 } |
|
162 MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::HandleClientRectChange()" ) |
|
163 } |
|
164 |
|
165 // ----------------------------------------------------------------------------- |
|
166 // From class CAknView. |
|
167 // Called by framework when *this* control is to be activated/focused. |
|
168 // ----------------------------------------------------------------------------- |
|
169 // |
|
170 void CMusSettingsPlugin::DoActivateL( |
|
171 const TVwsViewId& aPrevViewId, |
|
172 TUid aCustomMessageId, |
|
173 const TDesC8& aCustomMessage ) |
|
174 { |
|
175 MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::DoActivateL()" ) |
|
176 OpenResourceFileL(); |
|
177 CGSBaseView::DoActivateL( aPrevViewId, aCustomMessageId, aCustomMessage ); |
|
178 MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::DoActivateL()" ) |
|
179 } |
|
180 |
|
181 // ----------------------------------------------------------------------------- |
|
182 // From class CAknView. |
|
183 // Called by framework when *this* control is to be deactivated. |
|
184 // ----------------------------------------------------------------------------- |
|
185 // |
|
186 void CMusSettingsPlugin::DoDeactivate() |
|
187 { |
|
188 MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::DoDeactivate()" ) |
|
189 CGSBaseView::DoDeactivate(); |
|
190 CloseResourceFile(); |
|
191 MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::DoDeactivate()" ) |
|
192 } |
|
193 |
|
194 // ----------------------------------------------------------------------------- |
|
195 // From class CAknView. |
|
196 // Handles a user selected menu command. |
|
197 // ----------------------------------------------------------------------------- |
|
198 // |
|
199 void CMusSettingsPlugin::HandleCommandL( TInt aCommand ) |
|
200 { |
|
201 MUS_LOG1( "[MUSSET] -> CMusSettingsPlugin::HandleCommandL()( %d )", |
|
202 aCommand ) |
|
203 switch ( aCommand ) |
|
204 { |
|
205 case EGSMSKCmdAppChange: |
|
206 // case EGSCmdAppChange: |
|
207 { |
|
208 HandleListBoxSelectionL(); |
|
209 break; |
|
210 } |
|
211 |
|
212 case EAknSoftkeyBack: |
|
213 { |
|
214 AppUi()->ActivateLocalViewL( iPrevViewId.iViewUid ); |
|
215 break; |
|
216 } |
|
217 |
|
218 case EAknCmdHelp: |
|
219 { |
|
220 if( FeatureManager::FeatureSupported( KFeatureIdHelp ) ) |
|
221 { |
|
222 HlpLauncher::LaunchHelpApplicationL( |
|
223 iEikonEnv->WsSession(), AppUi()->AppHelpContextL()); |
|
224 } |
|
225 break; |
|
226 } |
|
227 |
|
228 default: |
|
229 { |
|
230 AppUi()->HandleCommandL( aCommand ); |
|
231 break; |
|
232 } |
|
233 } |
|
234 MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::HandleCommandL()" ) |
|
235 } |
|
236 |
|
237 // ----------------------------------------------------------------------------- |
|
238 // From class CGSPluginInterface. |
|
239 // Gets caption text of *this* plugin. |
|
240 // ----------------------------------------------------------------------------- |
|
241 // |
|
242 void CMusSettingsPlugin::GetCaptionL( TDes& aCaption ) const |
|
243 { |
|
244 MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::GetCaptionL()" ) |
|
245 if ( iCaption && iCaption->Length() <= aCaption.MaxLength() ) |
|
246 { |
|
247 aCaption.Copy( *iCaption ); |
|
248 } |
|
249 |
|
250 MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::GetCaptionL()" ) |
|
251 } |
|
252 |
|
253 // ----------------------------------------------------------------------------- |
|
254 // From class CGSPluginInterface. |
|
255 // Returns provider category of *this* plugin. |
|
256 // ----------------------------------------------------------------------------- |
|
257 // |
|
258 TInt CMusSettingsPlugin::PluginProviderCategory() const |
|
259 { |
|
260 MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::PluginProviderCategory()" ) |
|
261 return KGSPluginProviderInternal; |
|
262 } |
|
263 |
|
264 // ----------------------------------------------------------------------------- |
|
265 // From class MEikMenuObserver. |
|
266 // Called by framework before creating menus |
|
267 // ----------------------------------------------------------------------------- |
|
268 // |
|
269 void CMusSettingsPlugin::DynInitMenuPaneL( TInt aResourceId, |
|
270 CEikMenuPane* aMenuPane ) |
|
271 { |
|
272 // Delete Help item if feature is not supported |
|
273 if( aResourceId == R_VS_MENU_ITEM_EXIT ) |
|
274 { |
|
275 if( !FeatureManager::FeatureSupported( KFeatureIdHelp ) ) |
|
276 { |
|
277 aMenuPane->DeleteMenuItem( EAknCmdHelp ); |
|
278 } |
|
279 } |
|
280 } |
|
281 |
|
282 // ----------------------------------------------------------------------------- |
|
283 // From MDiskNotifyHandlerCallback |
|
284 // Called by framework When disk status changed |
|
285 // ----------------------------------------------------------------------------- |
|
286 // |
|
287 void CMusSettingsPlugin::HandleNotifyDisk( TInt /*aError*/, |
|
288 const TDiskEvent& /*aEvent*/ ) |
|
289 { |
|
290 MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::HandleNotifyDisk()" ) |
|
291 |
|
292 // Since the plugin is created immediately after opening GS but container |
|
293 // will be created only after opening the VS view, this function may be |
|
294 // called before the creation of container. In such a case we simply ignore |
|
295 // the notification. |
|
296 if ( Container() ) |
|
297 { |
|
298 TRAP_IGNORE( |
|
299 Container()->UpdateListBoxL( KGSSettIdRecordedVideoSaving ) ) |
|
300 } |
|
301 |
|
302 MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::HandleNotifyDisk()" ) |
|
303 } |
|
304 |
|
305 // ----------------------------------------------------------------------------- |
|
306 // From class CGSBaseView. |
|
307 // Called by GS framework to create a GS container for *this* plugin. |
|
308 // ----------------------------------------------------------------------------- |
|
309 // |
|
310 void CMusSettingsPlugin::NewContainerL() |
|
311 { |
|
312 MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::NewContainerL()" ) |
|
313 iContainer = new( ELeave ) CMusSettingsContainer( *iModel ); |
|
314 } |
|
315 |
|
316 // ----------------------------------------------------------------------------- |
|
317 // From class CGSBaseView. |
|
318 // Handles users "middle click" aka MSK on selected feature. |
|
319 // ----------------------------------------------------------------------------- |
|
320 // |
|
321 void CMusSettingsPlugin::HandleListBoxSelectionL() |
|
322 { |
|
323 MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::HandleListBoxSelectionL()" ) |
|
324 CMusSettingsContainer& container = |
|
325 *static_cast<CMusSettingsContainer*>( iContainer ); |
|
326 const TInt currentItem = container.CurrentFeatureId(); |
|
327 MUS_LOG1( "[MUSSET] Item selected: ", currentItem ) |
|
328 |
|
329 switch ( currentItem ) |
|
330 { |
|
331 case KGSSettIdVSActivation: |
|
332 { |
|
333 SwitchOnOffValueL( KGSSettIdVSActivation ); |
|
334 break; |
|
335 } |
|
336 case KGSSettIdSIPProfile: |
|
337 { |
|
338 ShowVSSettingsProfileSettingDialogL(); |
|
339 break; |
|
340 } |
|
341 case KGSSettIdAutoRecord: |
|
342 { |
|
343 SwitchOnOffValueL( KGSSettIdAutoRecord ); |
|
344 break; |
|
345 } |
|
346 case KGSSettIdRecordedVideoSaving: |
|
347 { |
|
348 ShowVSSettingsRecordedVideoSavingSettingDialogL(); |
|
349 break; |
|
350 } |
|
351 case KGSSettIdNote: |
|
352 { |
|
353 SwitchOnOffValueL( KGSSettIdNote ); |
|
354 break; |
|
355 } |
|
356 default: |
|
357 { |
|
358 break; |
|
359 } |
|
360 } |
|
361 MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::HandleListBoxSelectionL()" ) |
|
362 } |
|
363 |
|
364 // ----------------------------------------------------------------------------- |
|
365 // From class CGSBaseView. |
|
366 // Returns container class of *this* plugin. iContainer is always garanteed to |
|
367 // be of type CMusSettingsContainer*. |
|
368 // ----------------------------------------------------------------------------- |
|
369 // |
|
370 CMusSettingsContainer* CMusSettingsPlugin::Container() |
|
371 { |
|
372 MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::Container()" ) |
|
373 return static_cast<CMusSettingsContainer*>( iContainer ); |
|
374 } |
|
375 |
|
376 // ----------------------------------------------------------------------------- |
|
377 // Shows SIP profile setting dialog (i.e. "use default profile" or "select |
|
378 // profile from list"). If select profile from list is selected, a list of |
|
379 // SIP profiles is provided for user to choose wanted SIP profile. |
|
380 // ----------------------------------------------------------------------------- |
|
381 // |
|
382 void CMusSettingsPlugin::ShowVSSettingsProfileSettingDialogL() |
|
383 { |
|
384 MUS_LOG( |
|
385 "[MUSSET] -> CMusSettingsPlugin::ShowVSSettingsProfileSettingDialogL()" ) |
|
386 TInt cenRepValue = MultimediaSharingSettings::SipProfileSettingL(); |
|
387 TInt profileMode = CMusSettingsModel::KVsSipProfileDefault; |
|
388 if ( cenRepValue != CMusSettingsModel::KVsSipProfileDefault ) |
|
389 { |
|
390 profileMode = CMusSettingsModel::KVsSipProfileSelect; |
|
391 } |
|
392 TInt oldProfileMode( profileMode ); |
|
393 |
|
394 CDesCArrayFlat* items = iCoeEnv->ReadDesC16ArrayResourceL( |
|
395 R_SIP_PROFILE_SETTING_PAGE_LBX); |
|
396 CleanupStack::PushL( items ); |
|
397 items->Delete( CMusSettingsModel::KVsSipProfileSelectNone ); |
|
398 |
|
399 CAknRadioButtonSettingPage* dlg = new ( ELeave ) |
|
400 CAknRadioButtonSettingPage( R_VS_PROFILE_SETTING_PAGE, |
|
401 profileMode, |
|
402 items); |
|
403 |
|
404 if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) ) |
|
405 { |
|
406 if ( profileMode == CMusSettingsModel::KVsSipProfileDefault ) |
|
407 { |
|
408 if ( oldProfileMode != profileMode ) |
|
409 { |
|
410 MultimediaSharingSettings::SetSipProfileSettingL( |
|
411 CMusSettingsModel::KVsSipProfileDefault ); |
|
412 Container()->ShowNewProfileActiveAfterCallL(); |
|
413 Container()->UpdateListBoxL( KGSSettIdSIPProfile ); |
|
414 } |
|
415 } |
|
416 else |
|
417 { |
|
418 ShowVSSettingsSelectSipProfileDialogL(); |
|
419 } |
|
420 } |
|
421 CleanupStack::PopAndDestroy( items ); |
|
422 MUS_LOG( |
|
423 "[MUSSET] <- CMusSettingsPlugin::ShowVSSettingsProfileSettingDialogL()" ) |
|
424 } |
|
425 |
|
426 // ----------------------------------------------------------------------------- |
|
427 // Provides user a list of SIP profiles to select from. If no SIP profiles |
|
428 // exist an error note is displayed. |
|
429 // ----------------------------------------------------------------------------- |
|
430 // |
|
431 void CMusSettingsPlugin::ShowVSSettingsSelectSipProfileDialogL() |
|
432 { |
|
433 // Get the array of the profile names, ownership changes |
|
434 CDesCArray* array = iModel->ListOfProfileNamesL(); |
|
435 CleanupStack::PushL( array ); |
|
436 |
|
437 if ( array->Count() < 1 ) |
|
438 { |
|
439 ShowNoProfilesNotificationL(); |
|
440 } |
|
441 else |
|
442 { |
|
443 TInt selectedIndex = iModel->ProfileIndexByIdL( |
|
444 MultimediaSharingSettings::SipProfileSettingL() ); |
|
445 TInt currentIndex ( selectedIndex ); |
|
446 |
|
447 if ( selectedIndex == KErrNotFound ) |
|
448 { |
|
449 // first profile in the list |
|
450 selectedIndex = CMusSettingsModel::KVsSipProfileDefault; |
|
451 } |
|
452 |
|
453 // Create and display the pop-up list |
|
454 CAknRadioButtonSettingPage* defaultPopUp = |
|
455 new ( ELeave ) CAknRadioButtonSettingPage( |
|
456 R_VS_SIP_PROFILE_LIST_VIEW_SELECT_SETTING_PAGE, |
|
457 selectedIndex, |
|
458 array ); |
|
459 if ( defaultPopUp->ExecuteLD( |
|
460 CAknSettingPage::EUpdateWhenChanged ) ) |
|
461 { |
|
462 if ( selectedIndex != currentIndex ) |
|
463 { |
|
464 // User has changed the selected profile, set new |
|
465 // setting to persistent storage |
|
466 TUint newValue = iModel->ProfileIdByIndex( selectedIndex ); |
|
467 MultimediaSharingSettings::SetSipProfileSettingL( newValue ); |
|
468 Container()->ShowNewProfileActiveAfterCallL(); |
|
469 Container()->UpdateListBoxL( KGSSettIdSIPProfile ); |
|
470 } |
|
471 } |
|
472 } |
|
473 |
|
474 CleanupStack::PopAndDestroy( array ); // array |
|
475 } |
|
476 |
|
477 // ----------------------------------------------------------------------------- |
|
478 // Provides a dialog for user to choose saving location for recorderded video. |
|
479 // (locations are naturally phone memory or memory card). |
|
480 // ----------------------------------------------------------------------------- |
|
481 // |
|
482 void CMusSettingsPlugin::ShowVSSettingsRecordedVideoSavingSettingDialogL() |
|
483 { |
|
484 MUS_LOG( |
|
485 "[MUSSET] -> CMusSettingsPlugin::ShowVSSettingsRecordedVideoSavingSettingDialogL()" ) |
|
486 TDriveUnit phoneMemUnit( |
|
487 TParsePtrC( PathInfo::PhoneMemoryRootPath() ).Drive() ); |
|
488 TDriveUnit mmcUnit( TParsePtrC( PathInfo::MemoryCardRootPath() ).Drive() ); |
|
489 TInt currentValue = iModel->VSSettingsRecordedVideoSavingL(); |
|
490 |
|
491 CAknMemorySelectionDialogMultiDrive* dlg = |
|
492 iModel->MemorySelectionDialogLC(); |
|
493 |
|
494 TBool result( EFalse ); |
|
495 TDriveNumber driveNumber((TDriveNumber)currentValue); |
|
496 result = dlg->ExecuteL( driveNumber, NULL, NULL ); |
|
497 |
|
498 if ( result != CAknCommonDialogsBase::TReturnKey( |
|
499 CAknCommonDialogsBase::ERightSoftkey) ) |
|
500 { |
|
501 if ( /*( TInt )*/ driveNumber != currentValue ) |
|
502 { |
|
503 MultimediaSharingSettings::SetVideoLocationSettingL( ( TInt ) driveNumber ); |
|
504 } |
|
505 Container()->UpdateListBoxL( KGSSettIdRecordedVideoSaving ); |
|
506 } |
|
507 |
|
508 CleanupStack::PopAndDestroy(dlg); |
|
509 MUS_LOG( |
|
510 "[MUSSET] <- CMusSettingsPlugin::ShowVSSettingsRecordedVideoSavingSettingDialogL()" ) |
|
511 } |
|
512 |
|
513 // ----------------------------------------------------------------------------- |
|
514 // In standard variant provides user a "Capability auditory note" setting |
|
515 // dialog, and in operator variant provides user an "Alerts" setting dialog. |
|
516 // Note that in both variants the different dialogs toggle the same setting. |
|
517 // ----------------------------------------------------------------------------- |
|
518 // |
|
519 void CMusSettingsPlugin::ShowVSSettingsNoteSettingDialogL() |
|
520 { |
|
521 MUS_LOG( |
|
522 "[MUSSET] -> CMusSettingsPlugin::ShowVSSettingsNoteSettingDialogL()" ) |
|
523 MusSettingsKeys::TAuditoryNotification currentValue = |
|
524 MultimediaSharingSettings::AuditoryNotificationSettingL(); |
|
525 TInt intCurrentValue = static_cast<TInt>( currentValue ); |
|
526 |
|
527 CAknRadioButtonSettingPage* dlg; |
|
528 CDesCArrayFlat* items; |
|
529 |
|
530 if ( MultimediaSharingSettings::OperatorVariantSettingL() == |
|
531 MusSettingsKeys::EStandard ) |
|
532 { |
|
533 items = iCoeEnv->ReadDesC16ArrayResourceL( |
|
534 R_VS_AUDIO_SETTING_PAGE_LBX ); |
|
535 CleanupStack::PushL( items ); |
|
536 dlg = new ( ELeave ) CAknRadioButtonSettingPage( |
|
537 R_VS_AUDIO_SETTING_PAGE, |
|
538 intCurrentValue, |
|
539 items ); |
|
540 } |
|
541 else |
|
542 { |
|
543 items = iCoeEnv->ReadDesC16ArrayResourceL( |
|
544 R_VS_NOTE_SETTING_PAGE_LBX ); |
|
545 CleanupStack::PushL( items ); |
|
546 dlg = new ( ELeave ) CAknRadioButtonSettingPage( |
|
547 R_VS_NOTE_SETTING_PAGE, |
|
548 intCurrentValue, |
|
549 items ); |
|
550 } |
|
551 |
|
552 if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) ) |
|
553 { |
|
554 currentValue = |
|
555 static_cast<MusSettingsKeys::TAuditoryNotification>( intCurrentValue ); |
|
556 MultimediaSharingSettings::SetAuditoryNotificationSettingL( |
|
557 currentValue ); |
|
558 Container()->UpdateListBoxL( KGSSettIdNote ); |
|
559 } |
|
560 |
|
561 CleanupStack::PopAndDestroy( items ); |
|
562 MUS_LOG( |
|
563 "[MUSSET] <- CMusSettingsPlugin::ShowVSSettingsNoteSettingDialogL()" ) |
|
564 } |
|
565 |
|
566 // ----------------------------------------------------------------------------- |
|
567 // Shows a notifications that no SIP profiles exists. |
|
568 // ----------------------------------------------------------------------------- |
|
569 // |
|
570 void CMusSettingsPlugin::ShowNoProfilesNotificationL() |
|
571 { |
|
572 MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::ShowNoProfilesNotificationL()" ) |
|
573 HBufC* infoTxt = StringLoader::LoadLC( R_QTN_MSH_SET_PROFILE_EMPTY ); |
|
574 CAknInformationNote* note = new ( ELeave ) CAknInformationNote( ETrue ); |
|
575 note->ExecuteLD( infoTxt->Des() ); |
|
576 CleanupStack::PopAndDestroy( infoTxt ); |
|
577 MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::ShowNoProfilesNotificationL()" ) |
|
578 } |
|
579 |
|
580 // ----------------------------------------------------------------------------- |
|
581 // Switches between two possible values from one to another (i.e. toggles a |
|
582 // setting on/off). Toggled setting is passed in aValue parameter. |
|
583 // ----------------------------------------------------------------------------- |
|
584 // |
|
585 void CMusSettingsPlugin::SwitchOnOffValueL( TInt aValue ) |
|
586 { |
|
587 MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::SwitchOnOffValueL()" ) |
|
588 |
|
589 switch( aValue ) |
|
590 { |
|
591 case KGSSettIdVSActivation: |
|
592 { |
|
593 MusSettingsKeys::TOperatorVariant operatorVarValue = |
|
594 MultimediaSharingSettings::OperatorVariantSettingL(); |
|
595 |
|
596 if ( operatorVarValue == MusSettingsKeys::EOperatorSpecific ) |
|
597 { |
|
598 |
|
599 TInt aCallCount = 0; |
|
600 RProperty::Get( NMusSessionInformationApi::KCategoryUid, |
|
601 NMusSessionInformationApi::KMusCallCount, |
|
602 aCallCount ); |
|
603 MUS_LOG1( "CallCount ( %d )", aCallCount) |
|
604 if ( aCallCount == 0 ) |
|
605 { |
|
606 TBool enabled = EFalse; |
|
607 TRAPD( error, enabled = iHandler->ProfileEnabledL( )); |
|
608 if ( error != KErrNone ) |
|
609 { |
|
610 // Problems with re-reading profiles; use existing array |
|
611 MUS_LOG1("Error returned( %d )", error ) |
|
612 } |
|
613 else |
|
614 { |
|
615 if( enabled ) |
|
616 { |
|
617 TRAPD( error, iHandler->EnableProfileL() ); |
|
618 if ( error != KErrNone ) |
|
619 { |
|
620 // Problems with re-reading profiles; use existing array |
|
621 iModel->SetActivationItem( ETrue ); |
|
622 } |
|
623 iModel->SetActivationItem( EFalse ); |
|
624 } |
|
625 else |
|
626 { |
|
627 TRAP_IGNORE( iHandler->DisableProfileL() ); |
|
628 iModel->SetActivationItem( ETrue ); |
|
629 } |
|
630 } |
|
631 } |
|
632 } |
|
633 else |
|
634 { |
|
635 if ( MusSettingsKeys::EAlwaysActive == |
|
636 MultimediaSharingSettings::ActivationSettingL() ) |
|
637 { |
|
638 MUS_LOG( "[MUSSET] Activation setting set off" ) |
|
639 //MusSettingsKeys::ENever = 2 can not be used anymore |
|
640 //EActiveInHomeNetworks = 1 is used instead -> off |
|
641 MultimediaSharingSettings::SetActivationSettingL( |
|
642 MusSettingsKeys::EActiveInHomeNetworks ); |
|
643 } |
|
644 else |
|
645 { |
|
646 MUS_LOG( "[MUSSET] Activation setting set on" ) |
|
647 MultimediaSharingSettings::SetActivationSettingL( |
|
648 MusSettingsKeys::EAlwaysActive ); |
|
649 } |
|
650 } |
|
651 break; |
|
652 } |
|
653 case KGSSettIdAutoRecord: |
|
654 { |
|
655 if ( MusSettingsKeys::EAutoRecordOff == |
|
656 MultimediaSharingSettings::AutoRecordSettingL() ) |
|
657 { |
|
658 MultimediaSharingSettings::SetAutoRecordSettingL( |
|
659 MusSettingsKeys::EAutoRecordOn ); |
|
660 } |
|
661 else |
|
662 { |
|
663 MultimediaSharingSettings::SetAutoRecordSettingL( |
|
664 MusSettingsKeys::EAutoRecordOff ); |
|
665 } |
|
666 break; |
|
667 } |
|
668 case KGSSettIdNote: |
|
669 { |
|
670 if ( MusSettingsKeys::EAuditoryNotificationOn == |
|
671 MultimediaSharingSettings::AuditoryNotificationSettingL() ) |
|
672 { |
|
673 MultimediaSharingSettings::SetAuditoryNotificationSettingL( |
|
674 MusSettingsKeys::EAuditoryNotificationOff ); |
|
675 } |
|
676 else |
|
677 { |
|
678 MultimediaSharingSettings::SetAuditoryNotificationSettingL( |
|
679 MusSettingsKeys::EAuditoryNotificationOn ); |
|
680 } |
|
681 break; |
|
682 } |
|
683 |
|
684 default: |
|
685 { |
|
686 MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::SwitchOnOffValueL() - error unknown setting" ) |
|
687 User::Leave( KErrArgument ); |
|
688 } |
|
689 } |
|
690 |
|
691 Container()->UpdateListBoxL( aValue ); |
|
692 |
|
693 MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::SwitchOnOffValueL()" ) |
|
694 } |
|
695 |
|
696 // ----------------------------------------------------------------------------- |
|
697 // |
|
698 // ----------------------------------------------------------------------------- |
|
699 // |
|
700 void CMusSettingsPlugin::ShowGlobalInformationDialogL( TInt aResourceId ) |
|
701 { |
|
702 CAknGlobalNote* dlg = CAknGlobalNote::NewLC(); |
|
703 HBufC* dlgPrompt = StringLoader::LoadLC( aResourceId ); |
|
704 TRequestStatus status; |
|
705 dlg->ShowNoteL( status, EAknGlobalInformationNote, *dlgPrompt ); |
|
706 User::WaitForRequest( status ); |
|
707 CleanupStack::PopAndDestroy( dlgPrompt ); |
|
708 CleanupStack::PopAndDestroy( dlg ); |
|
709 } |
|
710 |
|
711 // ----------------------------------------------------------------------------- |
|
712 // From class CGSPluginInterface. |
|
713 // Creates a new icon of desired type. Overrided to provide custom icons. |
|
714 // Ownership of the created icon is transferred to the caller. |
|
715 // ----------------------------------------------------------------------------- |
|
716 // |
|
717 CGulIcon* CMusSettingsPlugin::CreateIconL( const TUid aIconType ) |
|
718 { |
|
719 MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::CreateIconL()" ) |
|
720 |
|
721 OpenResourceFileL(); |
|
722 |
|
723 CGulIcon* icon; |
|
724 |
|
725 if( aIconType == KGSIconTypeLbxItem ) |
|
726 { |
|
727 // Create a custom icon |
|
728 TParse* fp = new( ELeave ) TParse(); |
|
729 CleanupStack::PushL( fp ); |
|
730 HBufC* fileName = MusResourceFinderUtil::AppResourcePathL( |
|
731 KGSVSSettingsPluginIconDirAndName ); |
|
732 CleanupStack::PushL(fileName); |
|
733 fp->Set( *fileName , &KDC_BITMAP_DIR, NULL ); |
|
734 CleanupStack::PopAndDestroy( fileName ); |
|
735 |
|
736 icon = AknsUtils::CreateGulIconL( |
|
737 AknsUtils::SkinInstance(), |
|
738 KAknsIIDQgnPropSetVideoSharing, |
|
739 fp->FullName(), |
|
740 EMbmMussettingspluginQgn_prop_set_video_sharing, |
|
741 EMbmMussettingspluginQgn_prop_set_video_sharing_mask ); |
|
742 |
|
743 CleanupStack::PopAndDestroy( fp ); |
|
744 } |
|
745 else |
|
746 { |
|
747 // Use default icon from base class CGSPluginInterface. |
|
748 icon = CGSPluginInterface::CreateIconL( aIconType ); |
|
749 } |
|
750 |
|
751 MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::CreateIconL()" ) |
|
752 |
|
753 return icon; |
|
754 } |
|
755 |
|
756 // ----------------------------------------------------------------------------- |
|
757 // |
|
758 // ----------------------------------------------------------------------------- |
|
759 // |
|
760 void CMusSettingsPlugin::OpenResourceFileL() |
|
761 { |
|
762 MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::OpenResourceFileL()" ) |
|
763 |
|
764 if (!iResourceFileOpen) |
|
765 { |
|
766 HBufC* fileName = MusResourceFinderUtil::ResourcePathL( |
|
767 KVSSettingsResourceFileName ); |
|
768 TFileName fName(*fileName); |
|
769 delete fileName; |
|
770 MUS_LOG_TDESC( "[MUSSET] Resource FileName ",fName ) |
|
771 iResources.OpenL(fName); |
|
772 iResourceFileOpen = true; |
|
773 } |
|
774 |
|
775 MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::OpenResourceFileL()" ) |
|
776 } |
|
777 |
|
778 // ----------------------------------------------------------------------------- |
|
779 // |
|
780 // ----------------------------------------------------------------------------- |
|
781 // |
|
782 void CMusSettingsPlugin::CloseResourceFile() |
|
783 { |
|
784 MUS_LOG( "[MUSSET] -> CMusSettingsPlugin::CloseResourceFile()" ) |
|
785 iResources.Close(); |
|
786 iResourceFileOpen = false; |
|
787 MUS_LOG( "[MUSSET] <- CMusSettingsPlugin::CloseResourceFile()" ) |
|
788 } |
|
789 |
|