diff -r 10eaf342f539 -r 00c7ae862740 emailuis/nmhswidget/src/nmhswidgetemailengine.cpp --- a/emailuis/nmhswidget/src/nmhswidgetemailengine.cpp Tue Jun 29 17:12:28 2010 +0300 +++ b/emailuis/nmhswidget/src/nmhswidgetemailengine.cpp Fri Jul 02 15:55:16 2010 +0300 @@ -43,7 +43,8 @@ mAccountEventReceivedWhenSuspended(false), mMessageEventReceivedWhenSuspended(false), mSuspended(false), - mUpdateTimer(0) + mUpdateTimer(0), + mAiwRequest(0) { NM_FUNCTION; } @@ -409,19 +410,24 @@ NM_FUNCTION; QT_TRY{ - XQApplicationManager appManager; - XQAiwRequest* request = appManager.create( - XQI_EMAIL_INBOX_VIEW, XQOP_EMAIL_INBOX_VIEW, - false); - - if (request) { - QList list; - list.append(QVariant(mMailboxId.id())); - - request->setSynchronous(true); - request->setArguments(list); - request->send(); - delete request; + if (!mAiwRequest) { + XQApplicationManager appManager; + mAiwRequest = appManager.create( + XQI_EMAIL_INBOX_VIEW, XQOP_EMAIL_INBOX_VIEW, + false); + + if (mAiwRequest) { + connect(mAiwRequest, SIGNAL( requestError(int, const QString&) ), + this, SLOT( aiwRequestError(int, const QString&) )); + connect(mAiwRequest, SIGNAL( requestOk(const QVariant&) ), + this, SLOT( aiwRequestOk(const QVariant&) )); + QList list; + list.append(QVariant(mMailboxId.id())); + + mAiwRequest->setSynchronous(false); + mAiwRequest->setArguments(list); + mAiwRequest->send(); + } } } QT_CATCH(...){ @@ -441,21 +447,26 @@ NM_FUNCTION; QT_TRY{ - XQApplicationManager appManager; - XQAiwRequest* request = appManager.create( - XQI_EMAIL_MESSAGE_VIEW, XQOP_EMAIL_MESSAGE_VIEW, - false); - - if (request) { - QList list; - list.append(QVariant(mMailboxId.id())); - list.append(QVariant(mFolderId.id())); - list.append(QVariant(messageId.id())); - - request->setSynchronous(true); - request->setArguments(list); - request->send(); - delete request; + if (!mAiwRequest) { + XQApplicationManager appManager; + mAiwRequest = appManager.create( + XQI_EMAIL_MESSAGE_VIEW, XQOP_EMAIL_MESSAGE_VIEW, + false); + + if (mAiwRequest) { + connect(mAiwRequest, SIGNAL( requestError(int, const QString&) ), + this, SLOT( aiwRequestError(int, const QString&) )); + connect(mAiwRequest, SIGNAL( requestOk(const QVariant&) ), + this, SLOT( aiwRequestOk(const QVariant&) )); + QList list; + list.append(QVariant(mMailboxId.id())); + list.append(QVariant(mFolderId.id())); + list.append(QVariant(messageId.id())); + + mAiwRequest->setSynchronous(false); + mAiwRequest->setArguments(list); + mAiwRequest->send(); + } } } QT_CATCH(...){ @@ -464,3 +475,40 @@ // creation raise exception. } } + +/*! + aiwRequestOk slot. + */ +void NmHsWidgetEmailEngine::aiwRequestOk(const QVariant& result) +{ + NM_FUNCTION; + + Q_UNUSED(result); + + deleteAiwRequest(); +} + +/*! + aiwRequestError slot. + */ +void NmHsWidgetEmailEngine::aiwRequestError(int errorCode, const QString& errorMessage) +{ + NM_FUNCTION; + + Q_UNUSED(errorCode); + Q_UNUSED(errorMessage); + + deleteAiwRequest(); +} + +/*! + deleteAiwRequest function. + */ +void NmHsWidgetEmailEngine::deleteAiwRequest() +{ + NM_FUNCTION; + + delete mAiwRequest; + mAiwRequest = NULL; +} +