messagingapp/msgui/msgaudiofetcher/src/msgaudioselectionengine.cpp
changeset 52 12db4185673b
parent 43 35b64624a9e7
child 62 fdbe8253b596
equal deleted inserted replaced
44:36f374c67aa8 52:12db4185673b
    27 #include "msgaudioselectionengine.h"
    27 #include "msgaudioselectionengine.h"
    28 
    28 
    29 // CONSTANTS
    29 // CONSTANTS
    30 _LIT( KAmrMime, "audio/amr" );
    30 _LIT( KAmrMime, "audio/amr" );
    31 
    31 
    32 MsgAudioSelectionEngine::MsgAudioSelectionEngine()
    32 MsgAudioSelectionEngine::MsgAudioSelectionEngine():iQuery(NULL)
    33     {
    33     {
    34 
    34 
    35     }
    35     }
    36 
    36 
    37 MsgAudioSelectionEngine::~MsgAudioSelectionEngine()
    37 MsgAudioSelectionEngine::~MsgAudioSelectionEngine()
    41     }
    41     }
    42 
    42 
    43 
    43 
    44 void MsgAudioSelectionEngine::CreateMetaDataSession()
    44 void MsgAudioSelectionEngine::CreateMetaDataSession()
    45 {
    45 {
    46     TRAP_IGNORE(iSession = CMdESession::NewL(*this));
    46     QT_TRAP_THROWING(iSession = CMdESession::NewL(*this));
    47 }
    47 }
    48 
    48 
    49 
    49 
    50 void MsgAudioSelectionEngine::HandleSessionOpened(CMdESession& /*aSession*/,
    50 void MsgAudioSelectionEngine::HandleSessionOpened(CMdESession& /*aSession*/,
    51         TInt aError)
    51         TInt aError)
    98 void MsgAudioSelectionEngine::AddObjectObserverL()
    98 void MsgAudioSelectionEngine::AddObjectObserverL()
    99     {
    99     {
   100     if (iSessionOpen)
   100     if (iSessionOpen)
   101         {
   101         {
   102         TUint32 notificationType = ENotifyAdd | ENotifyModify | ENotifyRemove;
   102         TUint32 notificationType = ENotifyAdd | ENotifyModify | ENotifyRemove;
   103         User::LeaveIfNull(iSession);
   103         q_check_ptr(iSession);
   104         CMdENamespaceDef& defNS = iSession->GetDefaultNamespaceDefL();
   104         CMdENamespaceDef& defNS = iSession->GetDefaultNamespaceDefL();
   105         iSession->AddObjectObserverL(*this, 0, notificationType, &defNS);
   105         iSession->AddObjectObserverL(*this, 0, notificationType, &defNS);
   106         iSession->AddObjectPresentObserverL(*this);
   106         iSession->AddObjectPresentObserverL(*this);
   107         }
   107         }
   108     }
   108     }
   199 
   199 
   200 void MsgAudioSelectionEngine::LeaveIfSessionClosedL()
   200 void MsgAudioSelectionEngine::LeaveIfSessionClosedL()
   201     {
   201     {
   202     if (!iSession || !iSessionOpen)
   202     if (!iSession || !iSessionOpen)
   203         {
   203         {
   204         User::Leave(KErrDisconnected);
   204         qt_symbian_throwIfError (KErrDisconnected);
   205         }
   205         }
   206     }
   206     }
   207 
   207 
   208 CMdEPropertyDef& MsgAudioSelectionEngine::PropertyDefL(TInt aAttr)
   208 CMdEPropertyDef& MsgAudioSelectionEngine::PropertyDefL(TInt aAttr)
   209     {
   209     {
   210     User::LeaveIfNull(iSession);
   210     q_check_ptr(iSession);
   211     return PropertyDefL(iSession, aAttr);
   211     return PropertyDefL(iSession, aAttr);
   212     }
   212     }
   213 
   213 
   214 CMdEPropertyDef& MsgAudioSelectionEngine::PropertyDefL(CMdESession* aSession,
   214 CMdEPropertyDef& MsgAudioSelectionEngine::PropertyDefL(CMdESession* aSession,
   215         TInt aAttr)
   215         TInt aAttr)
   251         return objectDef.GetPropertyDefL(
   251         return objectDef.GetPropertyDefL(
   252                 MdeConstants::Audio::KComposerProperty);
   252                 MdeConstants::Audio::KComposerProperty);
   253         }
   253         }
   254     else
   254     else
   255         {
   255         {
   256         User::Leave(KErrNotSupported);
   256         qt_symbian_throwIfError(KErrNotSupported);
   257         }
   257         }
   258 
   258 
   259     return objectDef.GetPropertyDefL(MdeConstants::Object::KTitleProperty);
   259     return objectDef.GetPropertyDefL(MdeConstants::Object::KTitleProperty);
   260     }
   260     }
   261 
   261