controlpanelui/src/tonefetcher/tonefetcherengine/private/CToneSelection.cpp
changeset 40 593f946f4fec
parent 22 a5692c68d772
child 41 ab0490982943
equal deleted inserted replaced
22:a5692c68d772 40:593f946f4fec
    26 #include <QString>
    26 #include <QString>
    27 
    27 
    28 //refresh interval, 2 seconds.
    28 //refresh interval, 2 seconds.
    29 const TInt KTimerInterval = 2 * 1000 * 1000;
    29 const TInt KTimerInterval = 2 * 1000 * 1000;
    30 const TInt KObserverCallStep = 100;
    30 const TInt KObserverCallStep = 100;
       
    31 const TInt KOneKiloByte = 1024;
    31 // CONSTANTS
    32 // CONSTANTS
    32 _LIT( KMimeMp3, "mp3" );
    33 _LIT( KMimeMp3, "mp3" );
    33 
    34 
    34 CMFActiveCaller* CMFActiveCaller::NewL( CToneSelection* aObserver )
    35 CMFActiveCaller* CMFActiveCaller::NewL( CToneSelection* aObserver )
    35     {
    36     {
   170                                                TInt /*aNewItemCount*/ )
   171                                                TInt /*aNewItemCount*/ )
   171     {
   172     {
   172     }
   173     }
   173 
   174 
   174 void CToneSelection::HandleObjectNotification( CMdESession& /*aSession*/, 
   175 void CToneSelection::HandleObjectNotification( CMdESession& /*aSession*/, 
   175                                         TObserverNotificationType aType,
   176                                         TObserverNotificationType /*aType*/,
   176                                         const RArray<TItemId>& aObjectIdArray )
   177                                         const RArray<TItemId>& /*aObjectIdArray*/ )
   177     {   
   178     {   
   178     /*if ( aObjectIdArray.Count() > 0 && ( aType == ENotifyAdd || aType == ENotifyModify || aType == ENotifyRemove ) )
   179     /*if ( aObjectIdArray.Count() > 0 && ( aType == ENotifyAdd || aType == ENotifyModify || aType == ENotifyRemove ) )
   179         {
   180         {
   180         QString str("CToneSelection::HandleObjectNotification " + QString::number(aObjectIdArray.Count()) + " " + QString::number(aType));
   181         QString str("CToneSelection::HandleObjectNotification " + QString::number(aObjectIdArray.Count()) + " " + QString::number(aType));
   181         TF_LOG(str);        
   182         TF_LOG(str);        
   298 CMdEPropertyDef& CToneSelection::PropertyDefL( TInt aAttr )
   299 CMdEPropertyDef& CToneSelection::PropertyDefL( TInt aAttr )
   299     {
   300     {
   300     return PropertyDefL( iSession, aAttr );
   301     return PropertyDefL( iSession, aAttr );
   301     }
   302     }
   302 
   303 
   303 CMdEPropertyDef& CToneSelection::PropertyDefL( CMdESession* aSession, TInt aAttr )
   304 CMdEPropertyDef& CToneSelection::PropertyDefL( CMdESession* /*aSession*/, TInt aAttr )
   304     {
   305     {
   305     CMdEObjectDef& objectDef = 
   306     CMdEObjectDef& objectDef = 
   306             iDefNS->GetObjectDefL( MdeConstants::Audio::KAudioObject );
   307             iDefNS->GetObjectDefL( MdeConstants::Audio::KAudioObject );
   307    
   308    
   308     if ( aAttr == EAttrFileSize )
   309     if ( aAttr == EAttrFileSize )
   335         }
   336         }
   336     else
   337     else
   337         {
   338         {
   338         User::Leave( KErrNotSupported );
   339         User::Leave( KErrNotSupported );
   339         }
   340         }
       
   341 	//avoid critical warning
       
   342     return objectDef.GetPropertyDefL( MdeConstants::Audio::KAudioObject );
   340     }
   343     }
   341 
   344 
   342 void CToneSelection::ExcludeMusicPropertiesL( CMdELogicCondition& aCondition )
   345 void CToneSelection::ExcludeMusicPropertiesL( CMdELogicCondition& aCondition )
   343     {
   346     {
   344     TInt sizeLimitKB = 0;
   347     TInt sizeLimitKB = 0;
   355     CMdEPropertyDef& genreTypeDef = PropertyDefL( EAttrGenre );
   358     CMdEPropertyDef& genreTypeDef = PropertyDefL( EAttrGenre );
   356     CMdEPropertyDef& composerTypeDef = PropertyDefL( EAttrComposer );
   359     CMdEPropertyDef& composerTypeDef = PropertyDefL( EAttrComposer );
   357     
   360     
   358     CMdELogicCondition& condition = 
   361     CMdELogicCondition& condition = 
   359                         aCondition.AddLogicConditionL( ELogicConditionOperatorAnd );
   362                         aCondition.AddLogicConditionL( ELogicConditionOperatorAnd );
   360     condition.AddPropertyConditionL( sizeTypeDef, TMdEIntRange(0, iMaxFileSize, EMdERangeTypeBetween) );
   363     condition.AddPropertyConditionL( sizeTypeDef, TMdEIntRange(0, iMaxFileSize * KOneKiloByte, EMdERangeTypeNotBetween) );
   361     condition.AddPropertyConditionL( mimeTypeDef, 
   364     condition.AddPropertyConditionL( mimeTypeDef, 
   362             ETextPropertyConditionCompareContains, KMimeMp3 );
   365             ETextPropertyConditionCompareContains, KMimeMp3 );
   363     condition.AddPropertyConditionL( artistTypeDef );
   366     condition.AddPropertyConditionL( artistTypeDef );
   364     condition.AddPropertyConditionL( albumTypeDef );
   367     condition.AddPropertyConditionL( albumTypeDef );
   365     condition.AddPropertyConditionL( genreTypeDef );
   368     condition.AddPropertyConditionL( genreTypeDef );