emailuis/nmframeworkadapter/src/nmfwacheckoutboxoperation.cpp
changeset 30 759dc5235cdb
parent 27 9ba4404ef423
child 46 1aa3b69b573c
child 53 bf7eb7911fc5
--- a/emailuis/nmframeworkadapter/src/nmfwacheckoutboxoperation.cpp	Thu May 27 12:43:55 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,115 +0,0 @@
-/*
- * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Nokia Corporation - initial contribution.
- *
- * Contributors:
- *
- * Description:
- *
- */
-
-#include "nmframeworkadapterheaders.h"
-
-NmFwaCheckOutboxOperation::NmFwaCheckOutboxOperation(
-    const NmId &mailboxId,
-    CFSMailClient &mailClient) :
-        mMailboxId(mailboxId),
-        mMailClient(mailClient),
-        mFound(false),
-        mMessageId(0)
-{
-}
-
-NmFwaCheckOutboxOperation::~NmFwaCheckOutboxOperation()
-{
-}
-
-void NmFwaCheckOutboxOperation::doRunAsyncOperation()
-{
-    TRAPD(err, doRunAsyncOperationL());
-    
-    if (err) {
-        completeOperation(NmGeneralError);
-    }
-}
-
-/*!
-    Gets the id of the message with index '0' in the Outbox .
-
-    \return true if there is a message in Outbox.
- */
-bool NmFwaCheckOutboxOperation::getMessageId(NmId &messageId) const
-{
-    messageId = mMessageId;
-    return mFound;
-}
-
-void NmFwaCheckOutboxOperation::doRunAsyncOperationL()
-{
-    int err = NmNotFoundError;
-
-    TFSMailMsgId mailboxId(mMailboxId.pluginId32(), mMailboxId.id32());
-    
-    CFSMailBox *mailbox = mMailClient.GetMailBoxByUidL(mailboxId);
-    
-    if (mailbox) {
-        CleanupStack::PushL(mailbox);
-    
-        TFSMailMsgId folderId = mailbox->GetStandardFolderId(EFSOutbox);
-
-        CFSMailFolder *folder =
-            mMailClient.GetFolderByUidL(mailboxId, folderId);
-
-        if (folder) {
-            CleanupStack::PushL(folder);
-
-            TFSMailSortCriteria sortCriteria;
-            sortCriteria.iField = EFSMailSortByDate;
-            sortCriteria.iOrder = EFSMailDescending;
-            
-            RArray<TFSMailSortCriteria> sortArray;
-            CleanupClosePushL(sortArray);
-            sortArray.AppendL(sortCriteria);
-            
-            MFSMailIterator *iter = folder->ListMessagesL(
-                EFSMsgDataIdOnly, sortArray);
-            
-            CleanupStack::PopAndDestroy(); // sortArray
-
-            if (iter) {
-                CleanupDeletePushL(iter);
-
-                TFSMailMsgId nullId;
-                TInt numberOfItems = 1;
-                RPointerArray<CFSMailMessage> messages;
-
-                CleanupClosePushL(messages);
-                TBool unused = iter->NextL(nullId, numberOfItems, messages);
-
-                if (messages.Count() > 0) {
-                    mMessageId = messages[0]->GetMessageId().GetNmId();
-                    mFound = true;
-                }
-
-                messages.ResetAndDestroy();
-                CleanupStack::PopAndDestroy(); // messages
-
-                CleanupStack::PopAndDestroy(iter);
-                
-                err = NmNoError;
-            }
-            CleanupStack::PopAndDestroy(folder);
-        }
-        CleanupStack::PopAndDestroy(mailbox);
-    }
-
-    completeOperation(err);
-}
-