photosgallery/controllers/fetcher/src/glxfetchercommandhandler.cpp
changeset 0 4e91876724a2
equal deleted inserted replaced
-1:000000000000 0:4e91876724a2
       
     1 /*
       
     2 * Copyright (c) 2008-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:    CCommandhandler that requests the marking commandhandler to 
       
    15 *                mark items onto the medialist during multiple selection
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 #include <glxfetcherdialog.rsg>           // FOR GETTING VIEW ID AND RESOURCE ID        
       
    23 #include <eikappui.h>                     // To get AppUi instance
       
    24 #include <eikenv.h>                       // To get AppUi instance  
       
    25 #include <glxtracer.h>                    // For Tracer Logs
       
    26 #include "glxfetchercommandhandler.h"
       
    27 
       
    28 
       
    29 //-----------------------------------------------------------------------------
       
    30 // C++ default constructor.
       
    31 //-----------------------------------------------------------------------------
       
    32 CGlxFetcherCommandHandler::CGlxFetcherCommandHandler( 
       
    33         MGlxMediaListProvider* aMediaListProvider,
       
    34         MGlxTitleObserver* aTitleObserver )
       
    35     : CGlxMediaListCommandHandler( aMediaListProvider ),
       
    36     iTitleObserver( aTitleObserver )
       
    37     {
       
    38     TRACER("CGlxFetcherCommandHandler::CGlxFetcherCommandHandler()");
       
    39     
       
    40     iMediaListProvider = aMediaListProvider;
       
    41     }
       
    42 
       
    43 //-----------------------------------------------------------------------------
       
    44 // Two-phased constructor.
       
    45 //-----------------------------------------------------------------------------
       
    46 CGlxFetcherCommandHandler* CGlxFetcherCommandHandler::NewL(
       
    47         MGlxMediaListProvider* aMediaListProvider,
       
    48         MGlxTitleObserver* aTitleObserver ) 
       
    49     {
       
    50     TRACER("CGlxFetcherCommandHandler::NewL()");
       
    51     
       
    52     CGlxFetcherCommandHandler* self = new( ELeave ) 
       
    53         CGlxFetcherCommandHandler( aMediaListProvider, aTitleObserver );
       
    54     CleanupStack::PushL( self );
       
    55     self->ConstructL();
       
    56     CleanupStack::Pop( self );
       
    57     return self;
       
    58     }
       
    59 
       
    60 // ---------------------------------------------------------------------------
       
    61 // ConstructL()
       
    62 // ---------------------------------------------------------------------------
       
    63 void CGlxFetcherCommandHandler::ConstructL()
       
    64     {
       
    65     TRACER("CGlxFetcherCommandHandler::ConstructL()");
       
    66     
       
    67     iCommandhandlerMarking = CGlxCommandHandlerMarking::NewL(iMediaListProvider,EFalse);
       
    68     
       
    69     // Get AppUi instance
       
    70     // This class does not have access to a CEikonEnv and hence 
       
    71     // pls ignore the code scanner warning - Using CEikonEnv::Static
       
    72     CEikAppUi* appUi = CEikonEnv::Static()->EikAppUi();
       
    73 
       
    74     // Make sure the active view is our view, in case the view 
       
    75     // activation failed
       
    76     TVwsViewId activeViewId;
       
    77     appUi->GetActiveViewId( activeViewId );
       
    78 
       
    79     // Specify to the commandhandler about the active viewid
       
    80     iCommandhandlerMarking->ActivateL( activeViewId.iViewUid.iUid );
       
    81      
       
    82     }
       
    83 
       
    84 //-----------------------------------------------------------------------------
       
    85 // Destructor
       
    86 //-----------------------------------------------------------------------------
       
    87 CGlxFetcherCommandHandler::~CGlxFetcherCommandHandler()
       
    88     {   
       
    89     TRACER("CGlxFetcherCommandHandler::~CGlxFetcherCommandHandler()");
       
    90     
       
    91     if (iCommandhandlerMarking)
       
    92         {
       
    93         // Deactivate the commandhandler before deleting it.
       
    94         iCommandhandlerMarking->Deactivate();
       
    95         delete iCommandhandlerMarking;  
       
    96         }
       
    97     }
       
    98 
       
    99 //-----------------------------------------------------------------------------
       
   100 // DoExecuteL
       
   101 //-----------------------------------------------------------------------------
       
   102 TBool CGlxFetcherCommandHandler::DoExecuteL(TInt aCommandId, MGlxMediaList& /*aList*/)
       
   103    {
       
   104    TRACER("CGlxFetcherCommandHandler::DoExecuteL()");
       
   105    
       
   106    return iCommandhandlerMarking->ExecuteL( aCommandId );
       
   107    }
       
   108 
       
   109 // ---------------------------------------------------------------------------
       
   110 // DoIsDisabled
       
   111 // ---------------------------------------------------------------------------
       
   112 TBool CGlxFetcherCommandHandler::DoIsDisabled(TInt /*aCommandId*/, 
       
   113                                                 MGlxMediaList& /*aList*/) const
       
   114     {    
       
   115     TRACER("CGlxFetcherCommandHandler::DoIsDisabled()");
       
   116     
       
   117     return EFalse;
       
   118     }  
       
   119     
       
   120 // END OF FILE
       
   121