diff -r d0529222e3f0 -r bd874ee5e5e2 idlefw/plugins/mcsplugin/settings/src/mcspluginsettingsmodel.cpp --- a/idlefw/plugins/mcsplugin/settings/src/mcspluginsettingsmodel.cpp Fri Feb 19 23:07:29 2010 +0200 +++ b/idlefw/plugins/mcsplugin/settings/src/mcspluginsettingsmodel.cpp Fri Mar 12 15:43:54 2010 +0200 @@ -52,8 +52,6 @@ _LIT8( KProperValueBookmark, "bookmark" ); _LIT8( KProperValueAppl, "application" ); - - using namespace HSPluginSettingsIf; // ----------------------------------------------------------------------------- @@ -136,10 +134,12 @@ { delete iAppList; delete iBkmList; - iSettings.Reset(); - delete iPluginSettings; + iSettings.Reset(); delete iPluginId; delete iListBoxLine; + + CHomescreenSettings::UnInitialize(); + iPluginSettings = NULL; } // --------------------------------------------------------------------------- @@ -148,6 +148,14 @@ // void CMCSPluginSettingsModel::ConstructL() { + CHomescreenSettings::InitializeL( KAppUid ); + + iPluginSettings = CHomescreenSettings::Instance(); + if( iPluginSettings == NULL ) + { + User::Leave( KErrUnknown ); + } + iAppList = CMCSPluginSettingsAppList::NewL(); iAppList->StartL(); iBkmList = CMCSPluginSettingsBkmList::NewL(); @@ -164,13 +172,46 @@ { return; } - if( !iPluginSettings ) + + if( iPluginId ) + { + delete iPluginId; + iPluginId = NULL; + } + iPluginId = aPluginId.AllocL(); + + iSettings.Reset(); + RPointerArray settingItems; + CleanupClosePushL( settingItems ); + + iPluginSettings->GetSettingsL( *iPluginId, settingItems ); + + TInt count = settingItems.Count(); + for ( TInt i = 0; i < count; i++ ) { - // AILaunch uid in decimal format - iPluginSettings = CHomescreenSettings::NewL( KAppUid, aPluginId, this ); - iPluginId = aPluginId.AllocL(); + CItemMap* itemMap = settingItems[i]; + RPointerArray properties; + properties = itemMap->Properties(); + TSettingItem item = ItemL( properties ); + iSettings.AppendL( item ); } + CleanupStack::Pop( &settingItems ); + settingItems.ResetAndDestroy(); + } +// --------------------------------------------------------------------------- +// Gets the latest settings from HSPS and updates +// --------------------------------------------------------------------------- +// +void CMCSPluginSettingsModel::UpdateSettingModelL( const TDesC8& aPluginId ) + { + if( iPluginId ) + { + delete iPluginId; + iPluginId = NULL; + } + iPluginId = aPluginId.AllocL(); + iSettings.Reset(); RPointerArray settingItems; CleanupClosePushL( settingItems ); @@ -274,12 +315,12 @@ // void CMCSPluginSettingsModel::SaveSettingsL( const TInt& aIndex, CMenuItem& aMenuItem ) - { - - if ( !iPluginSettings ) + { + if( !iPluginId ) { return; } + RPointerArray settingItems; CleanupClosePushL( settingItems ); iPluginSettings->GetSettingsL( *iPluginId, settingItems ); @@ -426,18 +467,6 @@ } // --------------------------------------------------------------------------- -// From MHomeScreenSettingsObserver - handler for HSPS setting change -// --------------------------------------------------------------------------- -// -TInt CMCSPluginSettingsModel::SettingsChangedL( const TDesC8& /*aEvent*/, - const TDesC8& /*aPluginName*/, - const TDesC8& /*aPluginUid*/, - const TDesC8& /*aPluginId*/ ) - { - return KErrNone; - } - -// --------------------------------------------------------------------------- // From MDesCArray // Returns the number of descriptor elements in a descriptor array. // ---------------------------------------------------------------------------