messagingapp/shareui/src/shareuiprivate.cpp
changeset 51 3507212d340e
parent 48 4f501b74aeb1
child 62 fdbe8253b596
equal deleted inserted replaced
49:2a272ef608c4 51:3507212d340e
    84     foreach(XQAiwRequest* request,mAiwRequestList)
    84     foreach(XQAiwRequest* request,mAiwRequestList)
    85     {
    85     {
    86         delete request;
    86         delete request;
    87     }
    87     }
    88     mAiwRequestList.clear();
    88     mAiwRequestList.clear();
    89     mServiceInterfaceMap.clear();
       
    90     }
    89     }
    91 
    90 
    92 /**
    91 /**
    93  * Initialize and start the dialog
    92  * Initialize and start the dialog
    94  * 
    93  * 
   151         SHARE_OP);
   150         SHARE_OP);
   152 
   151 
   153     if (serviceDescriptorList.size() > 0) {
   152     if (serviceDescriptorList.size() > 0) {
   154         initializeUi();
   153         initializeUi();
   155         //sorting the services based on service names,
   154         //sorting the services based on service names,
   156         //reinserting sorted list into serviceDescriptorList
   155         QMap<QString,XQAiwInterfaceDescriptor > serviceInterfaceMap;
   157         for (int i = 0; i < serviceDescriptorList.count(); i++) {
   156         for (int i = 0; i < serviceDescriptorList.count(); i++) {
   158             mServiceInterfaceMap.insert(serviceDescriptorList[i].serviceName(),
   157             serviceInterfaceMap.insert(serviceDescriptorList[i].serviceName(),
   159                 serviceDescriptorList[i]);
   158                 serviceDescriptorList[i]);
   160         }
   159         }
   161         QStringList serviceNames = mServiceInterfaceMap.keys();
   160         QStringList serviceNames = serviceInterfaceMap.keys();
   162         serviceNames.sort();
       
   163         serviceDescriptorList.clear();
   161         serviceDescriptorList.clear();
       
   162         
   164         for (int i = 0; i < serviceNames.count(); i++) {
   163         for (int i = 0; i < serviceNames.count(); i++) {
   165             serviceDescriptorList.append(mServiceInterfaceMap.value(serviceNames.at(i)));
       
   166         }
       
   167         for (int i = 0; i < serviceDescriptorList.count(); i++) {
       
   168 #ifdef __SHAREUI_MIME_HANDLING__          
   164 #ifdef __SHAREUI_MIME_HANDLING__          
   169             // Filter services based on content type
   165             // Filter services based on content type
   170             QString allowedTypes = serviceDescriptorList[i].customProperty(QString(
   166             QString allowedTypes = serviceInterfaceMap[serviceNames.at(i)].customProperty(QString(
   171                 "allowed_mime_types"));
   167                 "allowed_mime_types"));
   172             QString blockedTypes = serviceDescriptorList[i].customProperty(QString(
   168             QString blockedTypes = serviceInterfaceMap[serviceNames.at(i)].customProperty(QString(
   173                 "blocked_mime_types"));
   169                 "blocked_mime_types"));
   174 
   170 
   175             // Check against MIME filters
   171             // Check against MIME filters
   176             if (!isContentAllowed(filteredMimeList, allowedTypes))
   172             if (!isContentAllowed(filteredMimeList, allowedTypes))
   177                 continue;
   173                 continue;
   178 
   174 
   179             if (isContentBlocked(filteredMimeList, blockedTypes))
   175             if (isContentBlocked(filteredMimeList, blockedTypes))
   180                 continue;
   176                 continue;
   181 #endif            
   177 #endif            
   182             HbAction* action = fetchServiceAction(serviceDescriptorList[i]);
   178             HbAction* action = fetchServiceAction(serviceInterfaceMap[serviceNames.at(i)]);
   183             QString iconName = serviceDescriptorList[i].customProperty(QString("aiw_action_icon"));
   179             QString iconName = serviceInterfaceMap[serviceNames.at(i)].customProperty(QString("aiw_action_icon"));
   184             if (action) {
   180             if (action) {
   185                 updateShareUiDialogList(action, iconName);
   181                 updateShareUiDialogList(action, iconName);
   186             }
   182             }
   187         }
   183         }
       
   184         serviceInterfaceMap.clear();
   188         if (mContentItemModel->rowCount() == 0) {
   185         if (mContentItemModel->rowCount() == 0) {
   189             showNote(LOC_NO_SERVICES);
   186             showNote(LOC_NO_SERVICES);
   190             return true;
   187             return true;
   191         }
   188         }
   192 
   189