idlefw/plugins/mcsplugin/publisher/src/mcsplugindata.cpp
changeset 1 844b978f8d5e
parent 0 79c6a41cd166
child 8 d0529222e3f0
equal deleted inserted replaced
0:79c6a41cd166 1:844b978f8d5e
    30 _LIT8( KProperNameType, "type" );
    30 _LIT8( KProperNameType, "type" );
    31 _LIT8( KProperNameParam, "param" );
    31 _LIT8( KProperNameParam, "param" );
    32 _LIT8( KProperNameUid, "uid" );
    32 _LIT8( KProperNameUid, "uid" );
    33 _LIT8( KProperNameView, "view" );
    33 _LIT8( KProperNameView, "view" );
    34 _LIT8( KProperValueFolder, "folder" );
    34 _LIT8( KProperValueFolder, "folder" );
    35 _LIT8( KProperValueSuite, "suite" );
       
    36 _LIT8( KProperValueBookmark, "bookmark" );
    35 _LIT8( KProperValueBookmark, "bookmark" );
    37 _LIT8( KProperValueAppl, "application" );
    36 _LIT8( KProperValueAppl, "application" );
    38 _LIT( KMCSPlugin, "MCSPlugin" );
       
    39 _LIT( KSuiteName, "suite_name" );
       
    40 
    37 
    41 // ======== LOCAL FUNCTIONS ========
    38 // ======== LOCAL FUNCTIONS ========
    42 
    39 
    43 static void ItemMapArrayCleanupFunc( TAny* aPointerArray )
    40 static void ItemMapArrayCleanupFunc( TAny* aPointerArray )
    44     {
    41     {
   183     // Exclude 'view' and 'param' attributes from search criteria by default
   180     // Exclude 'view' and 'param' attributes from search criteria by default
   184     // Criterias will be added to filter if setting defines them
   181     // Criterias will be added to filter if setting defines them
   185     filter->DoNotHaveAttributeL( KMenuAttrView );
   182     filter->DoNotHaveAttributeL( KMenuAttrView );
   186     filter->DoNotHaveAttributeL( KMenuAttrParam );
   183     filter->DoNotHaveAttributeL( KMenuAttrParam );
   187     TBool isFolder = EFalse;
   184     TBool isFolder = EFalse;
   188     TBool isSuite = EFalse;
   185     
   189     
   186     // first, we need to check if the item is folder
   190     // first, we need to check if the item is folder or suite
       
   191     for ( TInt i = 0; i < aProperties.Count(); i++ )
   187     for ( TInt i = 0; i < aProperties.Count(); i++ )
   192         {
   188         {
   193         if ( aProperties[i]->Name() == KProperNameType )
   189         if ( aProperties[i]->Name() == KProperNameType )
   194             {
   190             {
   195             if ( aProperties[i]->Value() == KProperValueFolder )
   191             if ( aProperties[i]->Value() == KProperValueFolder )
   196                 {
   192                 {
   197                 isFolder = ETrue;
   193                 isFolder = ETrue;
   198                 }
   194                 }
   199 
       
   200             if ( aProperties[i]->Value() == KProperValueSuite )
       
   201                 {
       
   202                 isSuite = ETrue;
       
   203                 }
       
   204 
       
   205             break;
   195             break;
   206             }
   196             }
   207         }
   197         }
   208 
   198 
   209     // then add all property/value pairs to the filter
   199     // then add all property/value pairs to the filter
   223         value = AiUtility::CopyToBufferL( value, aProperties[i]->Value() );
   213         value = AiUtility::CopyToBufferL( value, aProperties[i]->Value() );
   224         CleanupStack::PushL( value );
   214         CleanupStack::PushL( value );
   225 
   215 
   226         if ( value->Length() != 0 )
   216         if ( value->Length() != 0 )
   227             {
   217             {
   228             // in case of folder/suite, we just have to extract 
   218             // in case of folder, we just have to extract 
   229             // id from param attribute and return item with this id
   219             // id from param attribute and return item with this id
   230             if ( aProperties[i]->Name() ==  KProperNameParam && ( isFolder || isSuite ) )
   220             if ( aProperties[i]->Name() ==  KProperNameParam && isFolder )
   231                 {
   221                 {
   232                 
       
   233                 TMenuItem item;
   222                 TMenuItem item;
   234 
   223                 // convert id to integer
   235                 // set the type
   224                 TInt id;
   236                 if ( isFolder )
   225                 TLex16 lextmp( value->Ptr() );
   237                     {
   226                 lextmp.Val( id );
   238                     // convert id to integer
   227                 item.SetType( KMenuTypeFolder );
   239                     TInt id;
   228                 item.SetId( id );
   240                     TLex16 lextmp( value->Ptr() );
       
   241                     lextmp.Val( id );
       
   242                     item.SetType( KMenuTypeFolder );
       
   243                     item.SetId( id );
       
   244                     }
       
   245                     
       
   246                 if ( isSuite )
       
   247                     {
       
   248                     CMenuFilter* suitefilter = CMenuFilter::NewLC();
       
   249                     // Exclude 'view' and 'param' attributes from search criteria by default
       
   250                     // Criterias will be added to filter if setting defines them
       
   251                     suitefilter->DoNotHaveAttributeL( KMenuAttrView );
       
   252                     suitefilter->DoNotHaveAttributeL( KMenuAttrParam );
       
   253                     suitefilter->HaveAttributeL( KSuiteName, *value );
       
   254                     // locked property excluded from search pattern 
       
   255                     suitefilter->DoNotHaveAttributeL( KMenuAttrLocked );
       
   256                     item = iEngine.FindMenuItemL( *suitefilter );
       
   257                     CleanupStack::PopAndDestroy( suitefilter );
       
   258 
       
   259                     }
       
   260 
   229 
   261                 CleanupStack::PopAndDestroy( value );
   230                 CleanupStack::PopAndDestroy( value );
   262                 CleanupStack::PopAndDestroy( name );
   231                 CleanupStack::PopAndDestroy( name );
   263                 CleanupStack::PopAndDestroy( filter );
   232                 CleanupStack::PopAndDestroy( filter );
   264 
   233