messagingapp/msgappfw/plugins/msgplugin/src/ccsmsg.cpp
author hgs
Fri, 25 Jun 2010 15:47:40 +0530
changeset 37 518b245aa84c
parent 23 messagingapp/msgappfw/plugin/src/ccsmsg.cpp@238255e8b033
permissions -rw-r--r--
201025

/*
* Copyright (c) 2007 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:  CS Message Plugin main class
 *
*/


// SYSTEM INCLUDES
#include <mcsplugineventobserver.h>

// USER INCLUDES
#include "ccsmsg.h"
#include "ccsmsghandler.h"

// ============================== MEMBER FUNCTIONS ============================
// ----------------------------------------------------------------------------
// CCsMsg::NewL
// Two Phase Construction
// ----------------------------------------------------------------------------
//
CCsMsg* CCsMsg::NewL(MCsPluginEventObserver* aObserver)
    {
    PRINT ( _L("Enter CCsMsg::NewL") );

    CCsMsg* self = new ( ELeave ) CCsMsg(aObserver);
    CleanupStack::PushL( self );
    self->ConstructL();
    CleanupStack::Pop( self );

    PRINT ( _L("End CCsMsg::NewL") );

    return self;
    }

// ----------------------------------------------------------------------------
// CCsMsg::CCsMsg
// Two Phase Construction
// ----------------------------------------------------------------------------
//
CCsMsg::CCsMsg(MCsPluginEventObserver* aObserver):iPluginEventObserver (aObserver)
            {
            }

// ----------------------------------------------------------------------------
// CCsMsg::ConstructL
// Two Phase Construction
// ----------------------------------------------------------------------------
//
void CCsMsg::ConstructL()
    {
    PRINT ( _L("Enter CCsMsg::ConstructL") );
    iMsgHandler=CCsMsgHandler::NewL(this);
    PRINT ( _L("Exit CCsMsg::ConstructL") );
    }
// ----------------------------------------------------------------------------
// CCsMsg::~CCsMsg
// Destructor
// ----------------------------------------------------------------------------
//
CCsMsg::~CCsMsg()
    {
    PRINT ( _L("Enter CCsMsg::~CCsMsg") );

    if(iMsgHandler)
        delete iMsgHandler;
    iMsgHandler = NULL;

    PRINT ( _L("End CCsMsg::~CCsMsg") );
    }

// -----------------------------------------------------------------------------
// CCsMsg::HandleReadCompleteL()
// Sends the CCsConversationEntry array to Conversation Server
// -----------------------------------------------------------------------------
//
void CCsMsg::HandleReadCompleteL( const RPointerArray<CCsConversationEntry>
*aConversationEntryLists)
    {
    iPluginEventObserver->AddConversations( *aConversationEntryLists );
    }

// -----------------------------------------------------------------------------
// CCsMsg::HandleUpdateCompleteL()
// Sends the CCsConversationEntry array to Conversation Server
// -----------------------------------------------------------------------------
//
void CCsMsg::HandleUpdateCompleteL( const RPointerArray<CCsConversationEntry>
*aConversationEntryLists)
    {
    iPluginEventObserver->ModifyConversations( *aConversationEntryLists );
    }

// -----------------------------------------------------------------------------
// CCsMsg::HandleDeleteCompleteL()
// Sends the CCsConversationEntry array to Conversation Server
// -----------------------------------------------------------------------------
//
void CCsMsg::HandleDeleteCompleteL( const RPointerArray<CCsConversationEntry>
*aConversationEntryLists)
    {
    iPluginEventObserver->DeleteConversations( *aConversationEntryLists );
    }

// -----------------------------------------------------------------------------
// CCsMsg::HandleCachingCompleted
// Sends the cache completed status to server
// -----------------------------------------------------------------------------
//
void CCsMsg::HandleCachingCompleted()
    {
    iPluginEventObserver->CachingCompleted();
    }

// -----------------------------------------------------------------------------
// CCsMsg::HandleCachingError
// Sends the error occured during the caching to server
// -----------------------------------------------------------------------------
//
void CCsMsg::HandleCachingError(const TInt aError)
    {
    iPluginEventObserver->CachingError(aError);
    }

// -----------------------------------------------------------------------------
// CCsMsg::GetConversationsL()
// This function starts the state machine to fetch msg data from msvserver
// -----------------------------------------------------------------------------
//
void CCsMsg::GetConversationsL()
    {
    PRINT ( _L("Enter CCsMsg::GetConversationsL") );
    //start handler
    iMsgHandler->StartL();
    }

// -----------------------------------------------------------------------------
// CCsMsg::HandleRefreshCompleteL
// Notify server to refresh conversations.
// -----------------------------------------------------------------------------
//
void CCsMsg::HandleRefreshCompleteL()
    {
    iPluginEventObserver->RefreshConversations();
    }

// End of file