emailuis/nmailuiengine/src/nmuiengine.cpp
changeset 72 64e38f08e49c
parent 65 478bc57ad291
child 68 83cc6bae1de8
equal deleted inserted replaced
65:478bc57ad291 72:64e38f08e49c
    64             QObject::connect(plugin,
    64             QObject::connect(plugin,
    65                 SIGNAL(connectionEvent(NmConnectState, const NmId &, const int)),
    65                 SIGNAL(connectionEvent(NmConnectState, const NmId &, const int)),
    66                 this,
    66                 this,
    67                 SLOT(handleConnectEvent(NmConnectState, const NmId &, const int)),
    67                 SLOT(handleConnectEvent(NmConnectState, const NmId &, const int)),
    68                 Qt::UniqueConnection);
    68                 Qt::UniqueConnection);
       
    69             // connect folder events            
       
    70             QObject::connect(plugin,
       
    71                 SIGNAL(folderEvent(NmFolderEvent, const QList<NmId> &, const NmId &)),
       
    72                 this, SLOT(handleFolderEvent(NmFolderEvent, const QList<NmId> &, const NmId &)),
       
    73                 Qt::UniqueConnection);           
       
    74 
    69             // do the subscriptions also
    75             // do the subscriptions also
    70             NmDataPluginInterface *pluginInterface = mPluginFactory->interfaceInstance(plugin);
    76             NmDataPluginInterface *pluginInterface = mPluginFactory->interfaceInstance(plugin);
    71             if (pluginInterface) {
    77             if (pluginInterface) {
    72                 QList<NmId> mailboxIdList;
    78                 QList<NmId> mailboxIdList;
    73                 pluginInterface->listMailboxIds(mailboxIdList);
    79                 pluginInterface->listMailboxIds(mailboxIdList);
   900 {
   906 {
   901     NM_FUNCTION;
   907     NM_FUNCTION;
   902 
   908 
   903     const NmMessage *message = NULL;
   909     const NmMessage *message = NULL;
   904 
   910 
   905     if (mSendOperation != NULL) {
   911     if (mSendOperation) {
   906         message = mSendOperation->getMessage();
   912         message = mSendOperation->getMessage();
   907     }
   913     }
   908 
   914 
   909     return message;
   915     return message;
   910 }
   916 }
  1224         default:
  1230         default:
  1225         break;
  1231         break;
  1226     }
  1232     }
  1227 }
  1233 }
  1228 
  1234 
       
  1235 /*!
       
  1236     Emits signals based on folder deletion or creation from plugins.
       
  1237     \param event folder event type
       
  1238     \param folderIds Ids of folder having the action       
       
  1239     \param mailboxId Id of active mailbox, 0 if application is closed.
       
  1240 */
       
  1241 void NmUiEngine::handleFolderEvent(NmFolderEvent event, 
       
  1242         const QList<NmId> &folderIds, const NmId &mailboxId)
       
  1243 {
       
  1244     NM_FUNCTION;
       
  1245 
       
  1246     switch (event) {
       
  1247         case NmFolderIsDeleted:
       
  1248             handleFolderDeletedEvent(folderIds, mailboxId);
       
  1249             break;
       
  1250         case NmFolderIsCreated:
       
  1251         default:
       
  1252             handleFolderCreatedEvent(folderIds, mailboxId);            
       
  1253             break;            
       
  1254     };
       
  1255 }
       
  1256 
       
  1257 /*!
       
  1258     Handles folder deletion from plugins.
       
  1259 */
       
  1260 void NmUiEngine::handleFolderDeletedEvent(const QList<NmId> &folderIds,
       
  1261                                           const NmId &mailboxId)
       
  1262 {
       
  1263     NM_FUNCTION;
       
  1264 
       
  1265     NmId folderId(0); 
       
  1266 
       
  1267     for (int i(0); i < folderIds.count(); i++) {
       
  1268         folderId = folderIds[i];
       
  1269         if (mInboxListModel){
       
  1270             mInboxListModel->handleFolderDeletedEvent(folderId, mailboxId);
       
  1271         }
       
  1272         if (mMessageListModel){
       
  1273             mMessageListModel->handleFolderDeletedEvent(folderId, mailboxId);
       
  1274         }
       
  1275     }
       
  1276 }
       
  1277 
       
  1278 /*!
       
  1279     Emits signals based on folder creation from plugins.
       
  1280 */
       
  1281 void NmUiEngine::handleFolderCreatedEvent(const QList<NmId> &folderIds,
       
  1282                                           const NmId &mailboxId)
       
  1283 {
       
  1284     NM_FUNCTION;
       
  1285     Q_UNUSED(folderIds);
       
  1286     Q_UNUSED(mailboxId);
       
  1287 }
       
  1288 
  1229 
  1289 
  1230 /*!
  1290 /*!
  1231     Adds the found message into the search model.
  1291     Adds the found message into the search model.
  1232 
  1292 
  1233     \param messageId The ID of the found message.
  1293     \param messageId The ID of the found message.