idlefw/plugins/mcsplugin/settings/src/mcspluginsettingsmodel.cpp
branchRCL_3
changeset 31 8baec10861af
parent 30 a5a39a295112
--- a/idlefw/plugins/mcsplugin/settings/src/mcspluginsettingsmodel.cpp	Wed Sep 01 12:22:09 2010 +0100
+++ b/idlefw/plugins/mcsplugin/settings/src/mcspluginsettingsmodel.cpp	Tue Sep 14 21:55:16 2010 +0300
@@ -49,6 +49,7 @@
 _LIT8( KProperValueAppl, "application" );
 _LIT8( KProperValueMailbox, "mailbox" );
 _LIT( KMenuTypeMailbox, "menu:mailbox" );
+_LIT8( KMenuAttrInvokeSettingsUid, "0x99999990" );
 
 using namespace HSPluginSettingsIf;
 
@@ -230,7 +231,7 @@
 TSettingItem CMCSPluginSettingsModel::ItemL( 
                  RPointerArray<HSPluginSettingsIf::CPropertyMap>& aProperties )
     {
-    TSettingItem setting = { KErrNotFound, EApplication , EFalse };
+    TSettingItem setting = { KErrNotFound, EApplication , EFalse, EFalse };
 
     TSettingType type = SettingTypeL( aProperties );
     if ( type == EApplication || type == EMailbox )
@@ -243,7 +244,8 @@
         }
     
     setting.locked = SettingLockedL( aProperties );
-
+    setting.empty = SettingEmptyL( aProperties );
+    
     return setting;
     }
 
@@ -301,6 +303,30 @@
     }
 
 // ---------------------------------------------------------------------------
+// Gets empty status of given HSPS entry
+// ---------------------------------------------------------------------------
+//
+TBool CMCSPluginSettingsModel::SettingEmptyL( 
+                RPointerArray<HSPluginSettingsIf::CPropertyMap>& aProperties )
+    {
+        
+    for( TInt i = 0; i <aProperties.Count(); i++ )
+        {
+        TPtrC8 name = aProperties[i]->Name();
+        if( name == KProperNameUid )
+            {
+            TPtrC8 value = aProperties[i]->Value();
+            if( value.Compare(KMenuAttrInvokeSettingsUid) == 0 )
+                {
+                return ETrue;
+                }
+            }
+        }   
+    
+    return EFalse;
+    }
+
+// ---------------------------------------------------------------------------
 // Saves menuitem to HSPS to the given shortcut index
 // ---------------------------------------------------------------------------
 //
@@ -402,7 +428,18 @@
                 }
             else if ( properties[ i ]->Name() == KProperNameView )
                 {
-                TPtrC view = aMenuItem.GetAttributeL( KMenuAttrView, exists );
+                TPtrC type = aMenuItem.Type();
+                TPtrC attr;
+                if ( type == KMenuTypeUrl )
+                    {
+                    // In case of bookmark type item, bookmark URL is stored to view property
+                    attr.Set( KMenuAttrUrl );
+                    }
+                else
+                    {
+                    attr.Set( KMenuAttrView );
+                    }
+                TPtrC view = aMenuItem.GetAttributeL( attr, exists );
                 if( exists && view.Length() > 0 )
                     {
                     HBufC8* view8( NULL );
@@ -470,8 +507,8 @@
             }
         }
 
-    // ETrue tells that modified settings are stored also to plugin reference
-    User::LeaveIfError( iPluginSettings->SetSettingsL( *iPluginId, settingItems, ETrue ) );
+    // EFalse tells that modified settings are not stored to plugin reference
+    User::LeaveIfError( iPluginSettings->SetSettingsL( *iPluginId, settingItems, EFalse ) );
     CleanupStack::PopAndDestroy(); // settingItems
     }
 
@@ -515,10 +552,19 @@
         // first, we need to check if the item is missing 
         // (application uninstalled or mmc card removed)
         // If it is, we return "Undefined" application name instead
+        // In case of empty item, it's own name is returned
         if ( iSettings[ aIndex ].id == KErrNotFound )
             {
-            const TDesC& caption = iAppList->UndefinedText();
-            TRAP_IGNORE( line.Set( ListBoxLineL( caption, aIndex ) ) )
+            if ( iSettings[ aIndex ].empty )
+                {
+                const TDesC& caption = iAppList->EmptyText();
+                TRAP_IGNORE( line.Set( ListBoxLineL( caption, aIndex ) ) )
+                }
+            else
+                {
+                const TDesC& caption = iAppList->UndefinedText();
+                TRAP_IGNORE( line.Set( ListBoxLineL( caption, aIndex ) ) )
+                }
             }
         else
             {
@@ -555,7 +601,7 @@
 //
 const TSettingItem CMCSPluginSettingsModel::Item( TInt aIndex ) const
     {
-    TSettingItem setting = { KErrNotFound, EApplication, EFalse };
+    TSettingItem setting = { KErrNotFound, EApplication, EFalse, EFalse };
 
     if ( aIndex >= 0 && aIndex < iSettings.Count() )
         {