diff -r 478bc57ad291 -r 64e38f08e49c emailuis/nmailuiengine/src/nmuiengine.cpp --- a/emailuis/nmailuiengine/src/nmuiengine.cpp Thu Sep 02 20:15:00 2010 +0300 +++ b/emailuis/nmailuiengine/src/nmuiengine.cpp Fri Sep 17 08:27:21 2010 +0300 @@ -66,6 +66,12 @@ this, SLOT(handleConnectEvent(NmConnectState, const NmId &, const int)), Qt::UniqueConnection); + // connect folder events + QObject::connect(plugin, + SIGNAL(folderEvent(NmFolderEvent, const QList &, const NmId &)), + this, SLOT(handleFolderEvent(NmFolderEvent, const QList &, const NmId &)), + Qt::UniqueConnection); + // do the subscriptions also NmDataPluginInterface *pluginInterface = mPluginFactory->interfaceInstance(plugin); if (pluginInterface) { @@ -902,7 +908,7 @@ const NmMessage *message = NULL; - if (mSendOperation != NULL) { + if (mSendOperation) { message = mSendOperation->getMessage(); } @@ -1226,6 +1232,60 @@ } } +/*! + Emits signals based on folder deletion or creation from plugins. + \param event folder event type + \param folderIds Ids of folder having the action + \param mailboxId Id of active mailbox, 0 if application is closed. +*/ +void NmUiEngine::handleFolderEvent(NmFolderEvent event, + const QList &folderIds, const NmId &mailboxId) +{ + NM_FUNCTION; + + switch (event) { + case NmFolderIsDeleted: + handleFolderDeletedEvent(folderIds, mailboxId); + break; + case NmFolderIsCreated: + default: + handleFolderCreatedEvent(folderIds, mailboxId); + break; + }; +} + +/*! + Handles folder deletion from plugins. +*/ +void NmUiEngine::handleFolderDeletedEvent(const QList &folderIds, + const NmId &mailboxId) +{ + NM_FUNCTION; + + NmId folderId(0); + + for (int i(0); i < folderIds.count(); i++) { + folderId = folderIds[i]; + if (mInboxListModel){ + mInboxListModel->handleFolderDeletedEvent(folderId, mailboxId); + } + if (mMessageListModel){ + mMessageListModel->handleFolderDeletedEvent(folderId, mailboxId); + } + } +} + +/*! + Emits signals based on folder creation from plugins. +*/ +void NmUiEngine::handleFolderCreatedEvent(const QList &folderIds, + const NmId &mailboxId) +{ + NM_FUNCTION; + Q_UNUSED(folderIds); + Q_UNUSED(mailboxId); +} + /*! Adds the found message into the search model.