harvesterplugins/applications/src/applicationsplugin.cpp
changeset 5 3bc31ad99ee7
parent 3 6832643895f7
child 9 4a2987baf8f7
equal deleted inserted replaced
3:6832643895f7 5:3bc31ad99ee7
   135     OstTraceExt1( TRACE_NORMAL, CAPPLICATIONSPLUGIN_ADDWIDGETINFOL, "CApplicationsPlugin::AddWidgetInfoL;PATH=%S", &temp );
   135     OstTraceExt1( TRACE_NORMAL, CAPPLICATIONSPLUGIN_ADDWIDGETINFOL, "CApplicationsPlugin::AddWidgetInfoL;PATH=%S", &temp );
   136 
   136 
   137     //GetWidgetPropertyValueL returns CWidgetPropertyValue* which in turn has an operator to convert to TDesC
   137     //GetWidgetPropertyValueL returns CWidgetPropertyValue* which in turn has an operator to convert to TDesC
   138     aDocument->AddFieldL(KApplicationFieldCaption, *(iWidgetRegistry.GetWidgetPropertyValueL( aUid, EBundleDisplayName )),  CDocumentField::EStoreYes | CDocumentField::EIndexTokenized );
   138     aDocument->AddFieldL(KApplicationFieldCaption, *(iWidgetRegistry.GetWidgetPropertyValueL( aUid, EBundleDisplayName )),  CDocumentField::EStoreYes | CDocumentField::EIndexTokenized );
   139 
   139 
   140     iWidgetRegistry.GetWidgetBundleName( aUid, temp );
   140     //For applications, no content to go into exceprt field.
   141     aDocument->AddExcerptL( temp );
   141     //For more info, check the appclass-hierarchy.txt
       
   142     //iWidgetRegistry.GetWidgetBundleName( aUid, temp );
       
   143     //aDocument->AddExcerptL( temp );
       
   144     aDocument->AddExcerptL( KNullDesC );
       
   145     
   142     OstTraceExt1( TRACE_NORMAL, DUP1_CAPPLICATIONSPLUGIN_ADDWIDGETINFOL, "CApplicationsPlugin::AddWidgetInfoL;DisplayName=%S", &temp );
   146     OstTraceExt1( TRACE_NORMAL, DUP1_CAPPLICATIONSPLUGIN_ADDWIDGETINFOL, "CApplicationsPlugin::AddWidgetInfoL;DisplayName=%S", &temp );
   143     CPIXLOGSTRING2("AddApplicationInfo(): DisplayName = %S ", &temp );
   147     CPIXLOGSTRING2("AddApplicationInfo(): DisplayName = %S ", &temp );
   144     }
   148     }
   145 
   149 
   146 // -----------------------------------------------------------------------------
   150 // -----------------------------------------------------------------------------
   148 void AddApplicationInfoL( CSearchDocument* aDocument, TApaAppInfo& aAppInfo )
   152 void AddApplicationInfoL( CSearchDocument* aDocument, TApaAppInfo& aAppInfo )
   149     {
   153     {
   150     TBuf<KMaxFileName> docidString = aAppInfo.iUid.Name(); //This returns stuff in the form "[UID]". So remove the brackets.
   154     TBuf<KMaxFileName> docidString = aAppInfo.iUid.Name(); //This returns stuff in the form "[UID]". So remove the brackets.
   151     docidString = docidString.Mid( KUidStartIndex, KUidEndIndex );
   155     docidString = docidString.Mid( KUidStartIndex, KUidEndIndex );
   152     
   156     
   153     aDocument->AddFieldL(KApplicationFieldCaption, aAppInfo.iShortCaption, CDocumentField::EStoreYes | CDocumentField::EIndexTokenized );
   157     //We index the exe name (without extension), only if the title is not present.
   154     aDocument->AddFieldL(KApplicationFieldAbsolutePath, aAppInfo.iFullName, CDocumentField::EStoreYes | CDocumentField::EIndexTokenized );
   158     if( aAppInfo.iShortCaption.Compare(KNullDesC) )
   155     aDocument->AddExcerptL( aAppInfo.iCaption );
   159         {
       
   160         aDocument->AddFieldL(KApplicationFieldCaption, aAppInfo.iShortCaption, CDocumentField::EStoreYes | CDocumentField::EIndexTokenized );
       
   161         }
       
   162     else
       
   163         {
       
   164         //Find the *last* location of '\' and remove the .exe to get just the filename.
       
   165         TInt location = aAppInfo.iFullName.LocateReverse('\\');
       
   166         if( location > 0 )
       
   167             {
       
   168             TInt lengthOfNameWithoutExtention = aAppInfo.iFullName.Length() -location -1; //-1 to increment one past '\'.
       
   169             TPtrC appName = aAppInfo.iFullName.Right( lengthOfNameWithoutExtention );
       
   170             aDocument->AddFieldL(KApplicationFieldAbsolutePath, appName.Left( appName.Length() -4 /*remove ".exe"*/), CDocumentField::EStoreYes | CDocumentField::EIndexTokenized );
       
   171             }
       
   172         }
       
   173     //For applications, no content to go into exceprt field, for more info, check the appclass-hierarchy.txt
       
   174     //aDocument->AddExcerptL( aAppInfo.iCaption );
       
   175     aDocument->AddExcerptL( KNullDesC );
       
   176     
   156     OstTraceExt2( TRACE_NORMAL, _ADDAPPLICATIONINFOL, "::AddApplicationInfoL;UID=%S;PATH=%S", &docidString, &aAppInfo.iFullName );
   177     OstTraceExt2( TRACE_NORMAL, _ADDAPPLICATIONINFOL, "::AddApplicationInfoL;UID=%S;PATH=%S", &docidString, &aAppInfo.iFullName );
   157     OstTraceExt2( TRACE_NORMAL, DUP1__ADDAPPLICATIONINFOL, "::AddApplicationInfoL;Excerpt=%S;Caption=%S", &aAppInfo.iCaption, &aAppInfo.iShortCaption );
   178     OstTraceExt2( TRACE_NORMAL, DUP1__ADDAPPLICATIONINFOL, "::AddApplicationInfoL;Excerpt=%S;Caption=%S", &aAppInfo.iCaption, &aAppInfo.iShortCaption );
   158     
   179     
   159     CPIXLOGSTRING3("AddApplicationInfo(): UID = %S, PATH = %S ", &docidString, &aAppInfo.iFullName );
   180     CPIXLOGSTRING3("AddApplicationInfo(): UID = %S, PATH = %S ", &docidString, &aAppInfo.iFullName );
   160     CPIXLOGSTRING3("AddApplicationInfo():  Excerpt = %S, Caption = %S ", &aAppInfo.iCaption, &aAppInfo.iShortCaption );
   181     CPIXLOGSTRING3("AddApplicationInfo():  Excerpt = %S, Caption = %S ", &aAppInfo.iCaption, &aAppInfo.iShortCaption );
   174     
   195     
   175         CPIXLOGSTRING("CApplicationsPlugin::IsAppHidden(): GetCapability returned KErrNone");
   196         CPIXLOGSTRING("CApplicationsPlugin::IsAppHidden(): GetCapability returned KErrNone");
   176         ret = cap().iAppIsHidden;
   197         ret = cap().iAppIsHidden;
   177         }
   198         }
   178 
   199 
       
   200     //This commented code is left here as the following functionality may need to be 
       
   201     //returned if and when this or similar APIs are available for 10.1
       
   202     
   179     //Application should not be listed hidden in application shell.
   203     //Application should not be listed hidden in application shell.
   180 //    TBuf<NCentralRepositoryConstants::KMaxUnicodeStringLength> uidResult;
   204 //    TBuf<NCentralRepositoryConstants::KMaxUnicodeStringLength> uidResult;
   181 //    if( iHiddenApplicationsRepository->Get( KMenuHideApplication, uidResult ) == KErrNone )
   205 //    if( iHiddenApplicationsRepository->Get( KMenuHideApplication, uidResult ) == KErrNone )
   182 //        {
   206 //        {
   183 //        CPIXLOGSTRING2("CApplicationsPlugin::CreateApplicationsIndexItemL(): Hidden UIDs = %S", &uidResult );
   207 //        CPIXLOGSTRING2("CApplicationsPlugin::CreateApplicationsIndexItemL(): Hidden UIDs = %S", &uidResult );