harvesterplugins/media/mediautils/src/cpixdocfetcher.cpp
changeset 11 773be20e0a25
parent 5 3bc31ad99ee7
child 12 993ab30e92fc
equal deleted inserted replaced
7:51d10d255e92 11:773be20e0a25
    36 _LIT(KFormat, "%u");
    36 _LIT(KFormat, "%u");
    37 _LIT(KNameField, "Name");
    37 _LIT(KNameField, "Name");
    38 _LIT(KMediaIdField, "MediaId");
    38 _LIT(KMediaIdField, "MediaId");
    39 _LIT(KExtensionField, "Extension");
    39 _LIT(KExtensionField, "Extension");
    40 _LIT(KExcerptDelimiter, " ");
    40 _LIT(KExcerptDelimiter, " ");
       
    41 _LIT(KFormatDateTime, "%04d %02d %02d %02d %02d");    // yyyy mm dd hh mm
    41 
    42 
    42 // -----------------------------------------------------------------------------
    43 // -----------------------------------------------------------------------------
    43 // CCPIXDocFetcher::NewL()
    44 // CCPIXDocFetcher::NewL()
    44 // -----------------------------------------------------------------------------
    45 // -----------------------------------------------------------------------------
    45 //
    46 //
   124         
   125         
   125         TPtrC name = GetUri().Mid( (slashpos+1) );
   126         TPtrC name = GetUri().Mid( (slashpos+1) );
   126         //Uri is our Document ID
   127         //Uri is our Document ID
   127         AddFiledtoDocumentL(*index_item,
   128         AddFiledtoDocumentL(*index_item,
   128                                KNameField, //URI as Name field
   129                                KNameField, //URI as Name field
   129                                name);
   130                                name,
       
   131                                CDocumentField::EStoreYes | CDocumentField::EIndexTokenized | CDocumentField::EIndexFreeText);
   130         //Store media ID for client to generate path and launch corresponding Item
   132         //Store media ID for client to generate path and launch corresponding Item
   131         TBuf<KMaxMediaLength> mediaBuf;        
   133         TBuf<KMaxMediaLength> mediaBuf;        
   132         
   134         
   133         //As the MDS database is storing incorrect MediaIds, fetch the uniqueid from the 
   135         //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
   136         //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");
   143         CPIXLOGSTRING("CCPIXDocFetcher::GetCpixDocumentL Standard Property URI, Media ID Added");
   142         
   144         
   143         //Get the media file extension and store
   145         //Get the media file extension and store
   144         TBuf<KMaxExtLength> extension;        
   146         TBuf<KMaxExtLength> extension;        
   145         GetExtension(aObject.Uri(),extension);
   147         GetExtension(aObject.Uri(),extension);
   146         AddFiledtoDocumentL( *index_item, KExtensionField, extension );
   148         AddFiledtoDocumentL( *index_item, KExtensionField, extension,
       
   149                 CDocumentField::EStoreYes | CDocumentField::EIndexTokenized | CDocumentField::EIndexFreeText);
   147         
   150         
   148         CMdEProperty* property(NULL);
   151         CMdEProperty* property(NULL);
   149         CMdEPropertyDef& titlePropDef = aObjectDef.GetPropertyDefL(MdeConstants::Object::KTitleProperty );
   152         CMdEPropertyDef& titlePropDef = aObjectDef.GetPropertyDefL(MdeConstants::Object::KTitleProperty );
   150         /*Requirement Excerpt should have all item specific field in priority order so has to be handled
   153         /*Requirement Excerpt should have all item specific field in priority order so has to be handled
   151          *at plugin specific document handler
   154          *at plugin specific document handler
   152          */
   155          */
   153         if(aObject.Property( titlePropDef, property ) != KErrNotFound)
   156         if(aObject.Property( titlePropDef, property ) != KErrNotFound)
   154            {
   157            {
   155            //Add field to document
   158            //Add field to document
   156            CMdETextProperty* textProperty = ( CMdETextProperty* ) property;
   159            CMdETextProperty* textProperty = static_cast< CMdETextProperty* > (property );
   157            if(textProperty->Value() != KNullDesC)
   160            if(textProperty->Value() != KNullDesC)
   158                {
   161                {
   159                AddFiledtoDocumentL(*index_item,
   162                AddFiledtoDocumentL(*index_item,
   160                                      MdeConstants::Object::KTitleProperty,
   163                                      MdeConstants::Object::KTitleProperty,
   161                                      textProperty->Value());
   164                                      textProperty->Value(),
       
   165                                      CDocumentField::EStoreYes | CDocumentField::EIndexTokenized | CDocumentField::EIndexFreeText);
   162                }
   166                }
   163            }
   167            }
       
   168         
   164         //Item type as MIME type
   169         //Item type as MIME type
   165         CMdEPropertyDef& mimeTypePropDef = aObjectDef.GetPropertyDefL(MdeConstants::Object::KItemTypeProperty);
   170         CMdEPropertyDef& mimeTypePropDef = aObjectDef.GetPropertyDefL(MdeConstants::Object::KItemTypeProperty);
   166         if(aObject.Property( mimeTypePropDef, property )!= KErrNotFound)
   171         if(aObject.Property( mimeTypePropDef, property )!= KErrNotFound)
   167            {
   172            {
   168            //Add field to document
   173            //Add field to document
   169            CMdETextProperty* textProperty = ( CMdETextProperty* ) property;
   174            CMdETextProperty* textProperty = static_cast< CMdETextProperty* > (property );
   170            AddFiledtoDocumentL(*index_item,
   175            AddFiledtoDocumentL(*index_item,
   171                                _L(CPIX_MIMETYPE_FIELD),
   176                                _L(CPIX_MIMETYPE_FIELD),
   172                                textProperty->Value(),
   177                                textProperty->Value(),
   173                                CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
   178                                CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
       
   179            }
       
   180         //Get ratings field
       
   181         CMdEPropertyDef& ratingsPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KRatingProperty );
       
   182         if(aObject.Property( ratingsPropDef, property )!= KErrNotFound)
       
   183            {
       
   184            //Add field to document
       
   185            if( property->Def().PropertyType() == EPropertyInt32 )
       
   186                {
       
   187                CMdEInt32Property& ratingProperty = static_cast < CMdEInt32Property& > (*property );               
       
   188                TBuf<32> buf;
       
   189                buf.Format(_L("%d"), ratingProperty.Value());
       
   190                AddFiledtoDocumentL(*index_item,
       
   191                                   MdeConstants::MediaObject::KRatingProperty,
       
   192                                   buf );
       
   193                }
   174            }
   194            }
   175         CleanupStack::Pop(index_item);//pop up
   195         CleanupStack::Pop(index_item);//pop up
   176         }    
   196         }    
   177     CPIXLOGSTRING("END CCPIXDocFetcher::GetCpixDocumentL");
   197     CPIXLOGSTRING("END CCPIXDocFetcher::GetCpixDocumentL");
   178     return index_item;
   198     return index_item;