void NmFwaReplyMessageCreationOperation::doRunAsyncOperation()
{
    NM_FUNCTION;
    
    const TFSMailMsgId mailMsgId(mMailboxId.pluginId32(), mMailboxId.id32());

    CFSMailBox *mailBox(NULL);
    TRAP_IGNORE(mailBox = mMailClient.GetMailBoxByUidL(mailMsgId));
    if (mailBox) {
        TRAPD(err, mRequestId = mailBox->CreateReplyMessageL(mOriginalMessageId, mReplyAll, *this));
        if (err == KErrFSMailPluginNotSupported) {
            CFSMailMessage *fsMessage = mailBox->CreateReplyMessage(mOriginalMessageId, mReplyAll);
            mMessage = fsMessage->GetNmMessage();
            
            delete fsMessage;
            fsMessage = NULL;
            
            completeOperation(NmNoError);
        }
        else if (err != KErrNone) {
            completeOperation(NmGeneralError);
        }
        
        delete mailBox;
        mailBox = NULL;
    }
    else {
        completeOperation(NmNotFoundError);
    }
}
/**
 * asynchronous request response message
 *
 * @param aEvent plugin event description
 * @param aRequestId request id of asyncronous operation
 */
void NmFwaStoreEnvelopesOperation::RequestResponseL(TFSProgress aEvent, TInt aRequestId)
{
    NM_FUNCTION;
    
    if (aRequestId == mRequestId) {
        if (aEvent.iProgressStatus == TFSProgress::EFSStatus_RequestComplete && aEvent.iParam) {
            completeOperation(NmNoError);
        }
        else if (aEvent.iProgressStatus == TFSProgress::EFSStatus_RequestCancelled) {
            completeOperation(NmCancelError);
        }
        else {
            completeOperation(NmGeneralError);
        }
    }
}
void NmFwaStoreMessageOperation::doRunAsyncOperation()
{
    NM_FUNCTION;
    
    TInt err = KErrNone;

    if (mMessage) {
        switch (mStatus) {
            case EStoreHeader: {
                TRAP(err, mRequestId = mMessage->SaveMessageL(*this));
                if (err != KErrNone) {
                    completeOperation(NmGeneralError);
                }
                mStatus = EStoreSubParts;
                break;
            }
            case EStoreSubParts: {
                TRAP(err, mRequestId = mMessage->SaveMessagePartsL(*this));
                if (err != KErrNone) {
                    completeOperation(NmGeneralError);
                }
                mStatus = EComplete;
                break;
            }
            case EComplete: {
                completeOperation(NmNoError);
                break;
            }

            default: {
                completeOperation(NmNotFoundError);
                break;
            }
        }
    } else {
        completeOperation(NmGeneralError);
    }
}
/**
 * asynchronous request response message
 *
 * @param aEvent plugin event description
 * @param aRequestId request id of asyncronous operation
 */
void NmFwaStoreMessageOperation::RequestResponseL(TFSProgress aEvent,
                                                     TInt aRequestId)
{
    NM_FUNCTION;
    
    if (aRequestId == mRequestId) {
        if (aEvent.iProgressStatus ==
                TFSProgress::EFSStatus_RequestComplete) {
            if(mStatus != EComplete) {
                doRunAsyncOperation();
            } else {
                completeOperation(NmNoError);
            }
        }
        else if (aEvent.iProgressStatus ==
                TFSProgress::EFSStatus_RequestCancelled) {
            completeOperation(NmCancelError);
        }
        else {
            completeOperation(NmGeneralError);
        }
    }
}
void NmFwaStoreEnvelopesOperation::doRunAsyncOperation()
{
    NM_FUNCTION;
    
    const TFSMailMsgId mailboxId(mMailboxId.pluginId32(), mMailboxId.id32());
    CFSMailBox *mailbox(NULL);
    TRAP_IGNORE( mailbox = mMailClient.GetMailBoxByUidL(mailboxId) );
    // no possibility to leave; no need for CleanupStack
    if ( mailbox && mMessages.Count() ) {
        TRAPD(err, mRequestId = mailbox->UpdateMessageFlagsL( mailboxId, mMessages, *this ));
        if (err != KErrNone) {
            completeOperation(NmGeneralError);
        }
    }
    else {
        completeOperation(NmNotFoundError);
    }
    // cleanup
    if (mailbox) {
        delete mailbox;
        mailbox = NULL;
    }
}
void IDBConnectionToServer::didIterateCursor(const IDBResultData& resultData)
{
    LOG(IndexedDB, "IDBConnectionToServer::didIterateCursor");
    completeOperation(resultData);
}
void IDBConnectionToServer::didDeleteRecord(const IDBResultData& resultData)
{
    LOG(IndexedDB, "IDBConnectionToServer::didDeleteRecord");
    completeOperation(resultData);
}
void IDBConnectionToServer::didGetCount(const IDBResultData& resultData)
{
    LOG(IndexedDB, "IDBConnectionToServer::didGetCount");
    completeOperation(resultData);
}
void IDBConnectionToServer::didCreateIndex(const IDBResultData& resultData)
{
    LOG(IndexedDB, "IDBConnectionToServer::didCreateIndex");
    completeOperation(resultData);
}
void IDBConnectionToServer::didClearObjectStore(const IDBResultData& resultData)
{
    LOG(IndexedDB, "IDBConnectionToServer::didClearObjectStore");
    completeOperation(resultData);
}