idlefw/plugins/mcsplugin/settings/src/mcspluginsettingsmodel.cpp
branchRCL_3
changeset 9 d0529222e3f0
parent 1 844b978f8d5e
child 18 bd874ee5e5e2
equal deleted inserted replaced
4:1a2a00e78665 9:d0529222e3f0
    82 
    82 
    83    // Format (" \t%S\t\t%S") without %S characters.
    83    // Format (" \t%S\t\t%S") without %S characters.
    84    TInt formatLength = KSettingListboxLineFormat().Length();
    84    TInt formatLength = KSettingListboxLineFormat().Length();
    85 
    85 
    86    HBufC* listBoxLine =
    86    HBufC* listBoxLine =
    87        HBufC::NewLC(title->Length() + caption.Length() + formatLength);
    87        HBufC::NewLC( title->Length() + 
       
    88                      caption.Length() + 
       
    89                      formatLength );
    88 
    90 
    89    TPtr ptr = listBoxLine->Des();
    91    TPtr ptr = listBoxLine->Des();
    90    ptr.Format(KSettingListboxLineFormat, title, &caption);
    92    ptr.Format(KSettingListboxLineFormat, title, &caption);
    91 
    93 
    92    delete iListBoxLine;
    94    delete iListBoxLine;
   196                  RPointerArray<HSPluginSettingsIf::CPropertyMap>& aProperties )
   198                  RPointerArray<HSPluginSettingsIf::CPropertyMap>& aProperties )
   197     {
   199     {
   198     TSettingItem setting = { KErrNotFound, EApplication , EFalse };
   200     TSettingItem setting = { KErrNotFound, EApplication , EFalse };
   199 
   201 
   200     TSettingType type = SettingTypeL( aProperties );
   202     TSettingType type = SettingTypeL( aProperties );
   201     if( type == EApplication )
   203     if ( type == EApplication )
   202         {
   204         {
   203         setting = iAppList->FindItemL( aProperties );
   205         setting = iAppList->FindItemL( aProperties );
   204         }
   206         }
   205     else if( type == EBookmark )
   207     else if ( type == EBookmark )
   206         {
   208         {
   207         setting = iBkmList->FindItemL( aProperties );
   209         setting = iBkmList->FindItemL( aProperties );
   208         }
   210         }
   209     
   211     
   210     setting.locked = SettingLockedL( aProperties );
   212     setting.locked = SettingLockedL( aProperties );
   392                     properties[i]->SetValueL( KNullDesC8 );
   394                     properties[i]->SetValueL( KNullDesC8 );
   393                     }
   395                     }
   394                 }
   396                 }
   395             }
   397             }
   396         }
   398         }
   397  // ETrue tells that modified settings are stored also to plugin reference
   399     // ETrue tells that modified settings are stored also to plugin reference
   398     iPluginSettings->SetSettingsL( *iPluginId, settingItems, ETrue );
   400     iPluginSettings->SetSettingsL( *iPluginId, settingItems, ETrue );
   399     CleanupStack::Pop( &settingItems );
   401     CleanupStack::Pop( &settingItems );
   400     settingItems.ResetAndDestroy();
   402     settingItems.ResetAndDestroy();
   401 
   403 
   402     }
   404     }
   457         TPtrC ret(KNullDesC);
   459         TPtrC ret(KNullDesC);
   458         return ret;
   460         return ret;
   459     }
   461     }
   460     if ( iSettings[aIndex].type == EApplication )
   462     if ( iSettings[aIndex].type == EApplication )
   461         {
   463         {
   462         const TDesC& caption = iAppList->MdcaPoint( iSettings[aIndex].id );
   464         // first, we need to check if the item is missing 
   463         TPtrC line; 
   465         // (application unistaled or mmc card removed)
   464         TRAP_IGNORE( line.Set( ListBoxLineL( caption, aIndex ) ) )
   466         // If it is, we return "Undefined" application name instead
   465         return line; 
   467         if ( iSettings[ aIndex ].id == KErrNotFound )
       
   468             {
       
   469             const TDesC& caption = iAppList->iUndefinedText->Des();
       
   470             TPtrC line; 
       
   471             TRAP_IGNORE( line.Set( ListBoxLineL( caption, aIndex ) ) )
       
   472             return line; 
       
   473             }
       
   474         else
       
   475             {
       
   476             const TDesC& caption = iAppList->MdcaPoint( iSettings[ aIndex ].id );
       
   477             TPtrC line; 
       
   478             TRAP_IGNORE( line.Set( ListBoxLineL( caption, aIndex ) ) )
       
   479             return line; 
       
   480             }
   466         }
   481         }
   467     else
   482     else
   468         {
   483         {
   469         const TDesC& caption = iBkmList->MdcaPoint( iSettings[aIndex].id );
   484         const TDesC& caption = iBkmList->MdcaPoint( iSettings[aIndex].id );
   470         TPtrC line;
   485         TPtrC line;