meetingrequest/mrguicommon/src/cesmrguilistquery.cpp
author Pat Downey <patd@symbian.org>
Wed, 01 Sep 2010 12:28:57 +0100
branchRCL_3
changeset 25 3533d4323edc
parent 12 4ce476e64c59
permissions -rw-r--r--
Revert incorrect RCL_3 drop: Revision: 201033 Kit: 201035

/*
* Copyright (c) 2002-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:  Class is responsible of showing list queries
*
*/

// INCLUDE FILES
#include "emailtrace.h"
#include "cesmrguilistquery.h"
#include "esmrhelper.h"

#include <aknlistquerydialog.h>
#include <bautils.h>
#include <esmrgui.rsg>
#include <eikenv.h>
#include <avkon.rsg>
#include <data_caging_path_literals.hrh>

// Unnamed namespace for local definitions
namespace {

// Resource file definitions
_LIT(KResourceFileName,"esmrgui.rsc");

} // namespace

// ======== MEMBER FUNCTIONS ========

// -----------------------------------------------------------------------------
// CESMRGUIListQuery::CESMRConfirmationQuery
// C++ default constructor can NOT contain any code, that
// might leave.
// -----------------------------------------------------------------------------
//
inline CESMRGUIListQuery::CESMRGUIListQuery(
        TESMRListQueryType aType) :
    iType(aType)
    {
    FUNC_LOG;
    // Do nothing
    }

// -----------------------------------------------------------------------------
// CESMRGUIListQuery::~CESMRConfirmationQuery
// -----------------------------------------------------------------------------
//
CESMRGUIListQuery::~CESMRGUIListQuery()
    {
    FUNC_LOG;
    iEnv->DeleteResourceFile(iResourceOffset);
    }

// -----------------------------------------------------------------------------
// CESMRGUIListQuery::ConstructL
// -----------------------------------------------------------------------------
//
void CESMRGUIListQuery::ConstructL()
    {
    FUNC_LOG;
    TFileName filename;
   
    iEnv = CEikonEnv::Static(); // codescanner::eikonenvstatic

    ESMRHelper::LocateResourceFile(
            KResourceFileName,
            KDC_RESOURCE_FILES_DIR,
            filename,
            &iEnv->FsSession() );

    //for localization
    BaflUtils::NearestLanguageFile(iEnv->FsSession(),filename);
    iResourceOffset = iEnv->AddResourceFileL(filename);
    }

// -----------------------------------------------------------------------------
// CESMRGUIListQuery::ExecuteLD
// -----------------------------------------------------------------------------
//
TInt CESMRGUIListQuery::ExecuteLD()
    {
    FUNC_LOG;
    TInt resourceId( KErrNotFound );

    switch ( iType )
        {
        case EESMRSendUpdateToAllQuery:
            {
            resourceId = R_MEET_REQ_SEND_UPDATE_QUERY;
            break;
            }
        default:
            {
            User::Leave( KErrArgument );
            break;
            }            
        }

    TInt response( KErrCancel );
    CAknListQueryDialog* dlg = new (ELeave) CAknListQueryDialog( &response );
    if( !dlg->ExecuteLD(resourceId ) )
        {
        response = KErrCancel;
        }
    dlg = NULL;

    delete this;
    return response;
    }

// -----------------------------------------------------------------------------
// CESMRGUIListQuery::ExecuteL
// -----------------------------------------------------------------------------
//
EXPORT_C TInt CESMRGUIListQuery::ExecuteL(
        TESMRListQueryType aType)
    {
    FUNC_LOG;
    CESMRGUIListQuery* query =
            new (ELeave) CESMRGUIListQuery(aType);

    CleanupStack::PushL( query );
    query->ConstructL( );

    TInt ret = query->ExecuteLD();

    CleanupStack::Pop( query );

    return ret;
    }

//  End of File