meetingrequest/mrguicommon/src/cesmrguilistquery.cpp
branchRCL_3
changeset 12 4ce476e64c59
equal deleted inserted replaced
11:0396474f30f5 12:4ce476e64c59
       
     1 /*
       
     2 * Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Class is responsible of showing list queries
       
    15 *
       
    16 */
       
    17 
       
    18 // INCLUDE FILES
       
    19 #include "emailtrace.h"
       
    20 #include "cesmrguilistquery.h"
       
    21 #include "esmrhelper.h"
       
    22 
       
    23 #include <aknlistquerydialog.h>
       
    24 #include <bautils.h>
       
    25 #include <esmrgui.rsg>
       
    26 #include <eikenv.h>
       
    27 #include <avkon.rsg>
       
    28 #include <data_caging_path_literals.hrh>
       
    29 
       
    30 // Unnamed namespace for local definitions
       
    31 namespace {
       
    32 
       
    33 // Resource file definitions
       
    34 _LIT(KResourceFileName,"esmrgui.rsc");
       
    35 
       
    36 } // namespace
       
    37 
       
    38 // ======== MEMBER FUNCTIONS ========
       
    39 
       
    40 // -----------------------------------------------------------------------------
       
    41 // CESMRGUIListQuery::CESMRConfirmationQuery
       
    42 // C++ default constructor can NOT contain any code, that
       
    43 // might leave.
       
    44 // -----------------------------------------------------------------------------
       
    45 //
       
    46 inline CESMRGUIListQuery::CESMRGUIListQuery(
       
    47         TESMRListQueryType aType) :
       
    48     iType(aType)
       
    49     {
       
    50     FUNC_LOG;
       
    51     // Do nothing
       
    52     }
       
    53 
       
    54 // -----------------------------------------------------------------------------
       
    55 // CESMRGUIListQuery::~CESMRConfirmationQuery
       
    56 // -----------------------------------------------------------------------------
       
    57 //
       
    58 CESMRGUIListQuery::~CESMRGUIListQuery()
       
    59     {
       
    60     FUNC_LOG;
       
    61     iEnv->DeleteResourceFile(iResourceOffset);
       
    62     }
       
    63 
       
    64 // -----------------------------------------------------------------------------
       
    65 // CESMRGUIListQuery::ConstructL
       
    66 // -----------------------------------------------------------------------------
       
    67 //
       
    68 void CESMRGUIListQuery::ConstructL()
       
    69     {
       
    70     FUNC_LOG;
       
    71     TFileName filename;
       
    72    
       
    73     iEnv = CEikonEnv::Static(); // codescanner::eikonenvstatic
       
    74 
       
    75     ESMRHelper::LocateResourceFile(
       
    76             KResourceFileName,
       
    77             KDC_RESOURCE_FILES_DIR,
       
    78             filename,
       
    79             &iEnv->FsSession() );
       
    80 
       
    81     //for localization
       
    82     BaflUtils::NearestLanguageFile(iEnv->FsSession(),filename);
       
    83     iResourceOffset = iEnv->AddResourceFileL(filename);
       
    84     }
       
    85 
       
    86 // -----------------------------------------------------------------------------
       
    87 // CESMRGUIListQuery::ExecuteLD
       
    88 // -----------------------------------------------------------------------------
       
    89 //
       
    90 TInt CESMRGUIListQuery::ExecuteLD()
       
    91     {
       
    92     FUNC_LOG;
       
    93     TInt resourceId( KErrNotFound );
       
    94 
       
    95     switch ( iType )
       
    96         {
       
    97         case EESMRSendUpdateToAllQuery:
       
    98             {
       
    99             resourceId = R_MEET_REQ_SEND_UPDATE_QUERY;
       
   100             break;
       
   101             }
       
   102         default:
       
   103             {
       
   104             User::Leave( KErrArgument );
       
   105             break;
       
   106             }            
       
   107         }
       
   108 
       
   109     TInt response( KErrCancel );
       
   110     CAknListQueryDialog* dlg = new (ELeave) CAknListQueryDialog( &response );
       
   111     if( !dlg->ExecuteLD(resourceId ) )
       
   112         {
       
   113         response = KErrCancel;
       
   114         }
       
   115     dlg = NULL;
       
   116 
       
   117     delete this;
       
   118     return response;
       
   119     }
       
   120 
       
   121 // -----------------------------------------------------------------------------
       
   122 // CESMRGUIListQuery::ExecuteL
       
   123 // -----------------------------------------------------------------------------
       
   124 //
       
   125 EXPORT_C TInt CESMRGUIListQuery::ExecuteL(
       
   126         TESMRListQueryType aType)
       
   127     {
       
   128     FUNC_LOG;
       
   129     CESMRGUIListQuery* query =
       
   130             new (ELeave) CESMRGUIListQuery(aType);
       
   131 
       
   132     CleanupStack::PushL( query );
       
   133     query->ConstructL( );
       
   134 
       
   135     TInt ret = query->ExecuteLD();
       
   136 
       
   137     CleanupStack::Pop( query );
       
   138 
       
   139     return ret;
       
   140     }
       
   141 
       
   142 //  End of File
       
   143