messagingapp/msgui/msgaudiofetcher/src/msgaudioselectionengine.cpp
changeset 70 a15d9966050f
parent 52 12db4185673b
equal deleted inserted replaced
61:8ba0afbb4637 70:a15d9966050f
    20 #include <XQConversions>
    20 #include <XQConversions>
    21 #include <pathinfo.h>
    21 #include <pathinfo.h>
    22 #include <bautils.h>
    22 #include <bautils.h>
    23 #include <centralrepository.h>
    23 #include <centralrepository.h>
    24 #include <ProfileEngineDomainCRKeys.h>
    24 #include <ProfileEngineDomainCRKeys.h>
       
    25 #include <QMap>
    25 
    26 
    26 // USER INCLUDES
    27 // USER INCLUDES
    27 #include "msgaudioselectionengine.h"
    28 #include "msgaudioselectionengine.h"
    28 
    29 
    29 // CONSTANTS
    30 // CONSTANTS
   133         emit queryError(aError);
   134         emit queryError(aError);
   134         return;
   135         return;
   135         }
   136         }
   136     else
   137     else
   137         {
   138         {
       
   139         QMap<QString,QString> nameUriList;
   138         CMdEObjectQuery* query = static_cast<CMdEObjectQuery*> (&aQuery);
   140         CMdEObjectQuery* query = static_cast<CMdEObjectQuery*> (&aQuery);
   139         TInt count = query->Count();
   141         TInt count = query->Count();
   140         for (TInt i = 0; i < count; ++i)
   142         for (TInt i = 0; i < count; ++i)
   141             {
   143             {
   142             CMdEObject* object =
   144             CMdEObject* object =
   151                 {
   153                 {
   152                 QString songName(XQConversions::s60DescToQString(
   154                 QString songName(XQConversions::s60DescToQString(
   153                         property->TextValueL()));
   155                         property->TextValueL()));
   154                 QString uriValue(XQConversions::s60DescToQString(
   156                 QString uriValue(XQConversions::s60DescToQString(
   155                         object->Uri()));
   157                         object->Uri()));
   156                 iNameList.append(songName);
   158                 
   157                 iUriList.append(uriValue);
   159                 //insert into the map
       
   160                 nameUriList.insertMulti(uriValue, songName);
   158                 }
   161                 }
   159             CleanupStack::PopAndDestroy(object);
   162             CleanupStack::PopAndDestroy(object);
   160             }
   163             }
       
   164         
       
   165         //now get all the song names and sort them
       
   166         iNameList = nameUriList.values();
       
   167         iNameList.sort();
       
   168         
       
   169         // go through the song list and get the associated uri
       
   170         // insert into the uri list
       
   171         int nameListTotal = iNameList.count();
       
   172         for(int nameListCount = 0; 
       
   173                 nameListCount<nameListTotal;
       
   174                 nameListCount++)
       
   175             {
       
   176             QString key = nameUriList.key(iNameList.at(nameListCount));
       
   177             iUriList.append(key);
       
   178             nameUriList.remove(key);                        
       
   179             }
       
   180         
       
   181         // emit the list to the model
   161         emit queryComplete(iNameList, iUriList);
   182         emit queryComplete(iNameList, iUriList);
   162         }
   183         }
   163     }
   184     }
   164 
   185 
   165 void MsgAudioSelectionEngine::QueryTones()
   186 void MsgAudioSelectionEngine::QueryTones()