harvesterplugins/media/mediautils/src/cpixdocfetcher.cpp
changeset 9 4a2987baf8f7
parent 5 3bc31ad99ee7
child 16 e918432ddd92
equal deleted inserted replaced
8:2f67eb14d003 9:4a2987baf8f7
   124         
   124         
   125         TPtrC name = GetUri().Mid( (slashpos+1) );
   125         TPtrC name = GetUri().Mid( (slashpos+1) );
   126         //Uri is our Document ID
   126         //Uri is our Document ID
   127         AddFiledtoDocumentL(*index_item,
   127         AddFiledtoDocumentL(*index_item,
   128                                KNameField, //URI as Name field
   128                                KNameField, //URI as Name field
   129                                name);
   129                                name,
       
   130                                CDocumentField::EStoreYes | CDocumentField::EIndexTokenized | CDocumentField::EIndexFreeText);
   130         //Store media ID for client to generate path and launch corresponding Item
   131         //Store media ID for client to generate path and launch corresponding Item
   131         TBuf<KMaxMediaLength> mediaBuf;        
   132         TBuf<KMaxMediaLength> mediaBuf;        
   132         
   133         
   133         //As the MDS database is storing incorrect MediaIds, fetch the uniqueid from the 
   134         //As the MDS database is storing incorrect MediaIds, fetch the uniqueid from the 
   134         //file system.If the issue is fixed in 10.1 then Ids from MDS can be directly used
   135         //file system.If the issue is fixed in 10.1 then Ids from MDS can be directly used
   141         CPIXLOGSTRING("CCPIXDocFetcher::GetCpixDocumentL Standard Property URI, Media ID Added");
   142         CPIXLOGSTRING("CCPIXDocFetcher::GetCpixDocumentL Standard Property URI, Media ID Added");
   142         
   143         
   143         //Get the media file extension and store
   144         //Get the media file extension and store
   144         TBuf<KMaxExtLength> extension;        
   145         TBuf<KMaxExtLength> extension;        
   145         GetExtension(aObject.Uri(),extension);
   146         GetExtension(aObject.Uri(),extension);
   146         AddFiledtoDocumentL( *index_item, KExtensionField, extension );
   147         AddFiledtoDocumentL( *index_item, KExtensionField, extension,
       
   148                 CDocumentField::EStoreYes | CDocumentField::EIndexTokenized | CDocumentField::EIndexFreeText);
   147         
   149         
   148         CMdEProperty* property(NULL);
   150         CMdEProperty* property(NULL);
   149         CMdEPropertyDef& titlePropDef = aObjectDef.GetPropertyDefL(MdeConstants::Object::KTitleProperty );
   151         CMdEPropertyDef& titlePropDef = aObjectDef.GetPropertyDefL(MdeConstants::Object::KTitleProperty );
   150         /*Requirement Excerpt should have all item specific field in priority order so has to be handled
   152         /*Requirement Excerpt should have all item specific field in priority order so has to be handled
   151          *at plugin specific document handler
   153          *at plugin specific document handler
   152          */
   154          */
   153         if(aObject.Property( titlePropDef, property ) != KErrNotFound)
   155         if(aObject.Property( titlePropDef, property ) != KErrNotFound)
   154            {
   156            {
   155            //Add field to document
   157            //Add field to document
   156            CMdETextProperty* textProperty = ( CMdETextProperty* ) property;
   158            CMdETextProperty* textProperty = static_cast< CMdETextProperty* > (property );
   157            if(textProperty->Value() != KNullDesC)
   159            if(textProperty->Value() != KNullDesC)
   158                {
   160                {
   159                AddFiledtoDocumentL(*index_item,
   161                AddFiledtoDocumentL(*index_item,
   160                                      MdeConstants::Object::KTitleProperty,
   162                                      MdeConstants::Object::KTitleProperty,
   161                                      textProperty->Value());
   163                                      textProperty->Value(),
       
   164                                      CDocumentField::EStoreYes | CDocumentField::EIndexTokenized | CDocumentField::EIndexFreeText);
   162                }
   165                }
   163            }
   166            }
       
   167         
   164         //Item type as MIME type
   168         //Item type as MIME type
   165         CMdEPropertyDef& mimeTypePropDef = aObjectDef.GetPropertyDefL(MdeConstants::Object::KItemTypeProperty);
   169         CMdEPropertyDef& mimeTypePropDef = aObjectDef.GetPropertyDefL(MdeConstants::Object::KItemTypeProperty);
   166         if(aObject.Property( mimeTypePropDef, property )!= KErrNotFound)
   170         if(aObject.Property( mimeTypePropDef, property )!= KErrNotFound)
   167            {
   171            {
   168            //Add field to document
   172            //Add field to document
   169            CMdETextProperty* textProperty = ( CMdETextProperty* ) property;
   173            CMdETextProperty* textProperty = static_cast< CMdETextProperty* > (property );
   170            AddFiledtoDocumentL(*index_item,
   174            AddFiledtoDocumentL(*index_item,
   171                                _L(CPIX_MIMETYPE_FIELD),
   175                                _L(CPIX_MIMETYPE_FIELD),
   172                                textProperty->Value(),
   176                                textProperty->Value(),
   173                                CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
   177                                CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
       
   178            }
       
   179         //Get ratings field
       
   180         CMdEPropertyDef& ratingsPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KRatingProperty );
       
   181         if(aObject.Property( ratingsPropDef, property )!= KErrNotFound)
       
   182            {
       
   183            //Add field to document
       
   184            if( property->Def().PropertyType() == EPropertyInt32 )
       
   185                {
       
   186                CMdEInt32Property& ratingProperty = static_cast < CMdEInt32Property& > (*property );               
       
   187                TBuf<32> buf;
       
   188                buf.Format(_L("%d"), ratingProperty.Value());
       
   189                AddFiledtoDocumentL(*index_item,
       
   190                                   MdeConstants::MediaObject::KRatingProperty,
       
   191                                   buf );
       
   192                }
   174            }
   193            }
   175         CleanupStack::Pop(index_item);//pop up
   194         CleanupStack::Pop(index_item);//pop up
   176         }    
   195         }    
   177     CPIXLOGSTRING("END CCPIXDocFetcher::GetCpixDocumentL");
   196     CPIXLOGSTRING("END CCPIXDocFetcher::GetCpixDocumentL");
   178     return index_item;
   197     return index_item;