photosgallery/viewframework/plugins/gridviewpluginbase/src/glxgridviewpluginbase.cpp
changeset 0 4e91876724a2
child 3 9a9c174934f5
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:    Implementation 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 // INCLUDE FILES
       
    22 #include "glxgridviewpluginbase.h"
       
    23 
       
    24 #include <bldvariant.hrh>
       
    25 #include <glxcommandhandleraddtocontainer.h>
       
    26 #include <glxcommandhandleraiwassign.h>
       
    27 #include <glxcommandhandleraiwedit.h>
       
    28 #include <glxcommandhandleraiwprintpreview.h>
       
    29 #include <glxcommandhandleraiwshowmap.h>
       
    30 #include <glxcommandhandleraiwshareonovi.h>
       
    31 #include <glxcommandhandlerback.h>
       
    32 #include <glxcommandhandlersend.h>
       
    33 #include <glxcommandhandlercopytohomenetwork.h>
       
    34 #include <glxcommandhandlerdelete.h>
       
    35 #include <glxcommandhandlerhelp.h>
       
    36 #include <glxcommandhandlerhideui.h>
       
    37 #include <glxcommandhandlermarking.h>
       
    38 #include <glxcommandhandlermoreinfo.h>
       
    39 #include <glxcommandhandlerdetails.h>
       
    40 #include <glxcommandhandlerremovefrom.h>
       
    41 #include <glxcommandhandlershowviaupnp.h>				//Command Handlers Upnp
       
    42 #include <glxcommandhandlerslideshow.h>
       
    43 #include <glxcommandhandlerupload.h>
       
    44 #include <glxcommandhandlervideoplayback.h>
       
    45 #include <glxcommandhandleropen.h>
       
    46 #include <glxtracer.h>
       
    47 #include <mpxcollectionpath.h>
       
    48 #include <mpxcollectionutility.h>
       
    49 #include <mpxmediageneraldefs.h>
       
    50 #include <glxcommandhandlerfilterimagesorvideos.h> // CGlxCommandHandlerFilterImagesOrVideos
       
    51 #include <glxlog.h>
       
    52 #include "glxgridview.h"
       
    53 
       
    54 /**
       
    55  * @internal reviewed 08/02/2008 by Rhodri Byles
       
    56  */
       
    57 
       
    58 // ---------------------------------------------------------------------------
       
    59 // C++ default constructor can NOT contain any code, that
       
    60 // might leave.
       
    61 // ---------------------------------------------------------------------------
       
    62 //
       
    63 EXPORT_C CGlxGridViewPluginBase::CGlxGridViewPluginBase()
       
    64     {
       
    65     TRACER("CGlxGridViewPluginBase::CGlxGridViewPluginBase()");
       
    66     }
       
    67 
       
    68 // ---------------------------------------------------------------------------
       
    69 // Destructor
       
    70 // ---------------------------------------------------------------------------
       
    71 //
       
    72 EXPORT_C CGlxGridViewPluginBase::~CGlxGridViewPluginBase()
       
    73     {
       
    74     TRACER("CGlxGridViewPluginBase::~CGlxGridViewPluginBase()");
       
    75     // Do nothing
       
    76     if ( iResourceOffset )
       
    77         {
       
    78         CCoeEnv::Static()->DeleteResourceFile(iResourceOffset);
       
    79         }
       
    80     }
       
    81 
       
    82 // ---------------------------------------------------------------------------
       
    83 // From CMPXAknViewPlugin
       
    84 // Construct Avkon view.
       
    85 // ---------------------------------------------------------------------------
       
    86 //
       
    87 EXPORT_C CAknView* CGlxGridViewPluginBase::ConstructViewLC()
       
    88     {
       
    89     GLX_LOG_INFO("=>CGlxGridViewPluginBase::ConstructViewLC");
       
    90     
       
    91     TFileName resFile;
       
    92     GetResourceFilenameL(resFile);
       
    93     
       
    94     if(resFile.Length() > 0)
       
    95         {
       
    96         iResourceOffset = CCoeEnv::Static()->AddResourceFileL(resFile);
       
    97         }
       
    98 
       
    99     CGlxGridView* gridView = CGlxGridView::NewLC(this, iResourceIds, iViewUID);
       
   100     
       
   101     iGridView = gridView;
       
   102     
       
   103     AddCommandHandlersL();
       
   104     
       
   105     GLX_LOG_INFO("<=CGlxGridViewPluginBase::ConstructViewLC");
       
   106     // Return on cleanup stack with ownership passed
       
   107     return gridView;
       
   108     }
       
   109 
       
   110 // ---------------------------------------------------------------------------
       
   111 // Add the command handlers
       
   112 // ---------------------------------------------------------------------------
       
   113 //
       
   114 EXPORT_C void CGlxGridViewPluginBase::AddCommandHandlersL()
       
   115     {
       
   116     TRACER("CGlxGridViewPluginBase::AddCommandHandlersL()");
       
   117         
       
   118     GLX_LOG_INFO( "Adding CGlxCommandHandlerSlideshow" );
       
   119     
       
   120     iGridView->AddCommandHandlerL(
       
   121                         CGlxCommandHandlerSlideshow::NewL( iGridView, ETrue , EFalse ) );
       
   122     
       
   123 
       
   124     GLX_LOG_INFO("Adding CGlxCommandHandlerSend");
       
   125                 iGridView->AddCommandHandlerL(CGlxCommandHandlerSend::NewL(iGridView, ETrue));
       
   126         
       
   127     
       
   128     GLX_LOG_INFO("Adding CGlxCommandHandlerAddToContainer");
       
   129     iGridView->AddCommandHandlerL(CGlxCommandHandlerAddToContainer::
       
   130                                 NewAddToAlbumCommandHandlerL(iGridView, EFalse));                             
       
   131     GLX_LOG_INFO("Adding CGlxCommandHandlerDetails");
       
   132     iGridView->AddCommandHandlerL(CGlxCommandHandlerDetails::
       
   133                                 NewL(iGridView));
       
   134                                 
       
   135     GLX_LOG_INFO("Adding CGlxCommandHandlerOpen");
       
   136     iGridView->AddCommandHandlerL(CGlxCommandHandlerOpen::
       
   137                                  NewL(iGridView));
       
   138                             
       
   139     GLX_LOG_INFO("Adding CGlxCommandHandlerDelete");
       
   140     iGridView->AddCommandHandlerL(CGlxCommandHandlerDelete::
       
   141                                 NewL(iGridView, EFalse, EFalse));
       
   142                                 
       
   143     GLX_LOG_INFO("Adding CGlxCommandHandlerAddToContainer");
       
   144     iGridView->AddCommandHandlerL(CGlxCommandHandlerAddToContainer::
       
   145                                 NewAddToTagCommandHandlerL(iGridView, EFalse));
       
   146     // The AIW service handlers 
       
   147     // ShowMap must be the first one                           
       
   148     GLX_LOG_INFO("Adding CGlxCommandHandlerAiwShowMap");
       
   149     iGridView->AddCommandHandlerL(CGlxCommandHandlerAiwShowMap::
       
   150                                 NewL(iGridView, iResourceIds.iMenuId));
       
   151     // Assign must be the second one
       
   152     GLX_LOG_INFO("Adding CGlxCommandHandlerAiwAssign");
       
   153     iGridView->AddCommandHandlerL(CGlxCommandHandlerAiwAssign::
       
   154                                 NewL(iGridView, iResourceIds.iMenuId));
       
   155     GLX_LOG_INFO("Adding CGlxCommandHandlerAiwEdit");
       
   156     iGridView->AddCommandHandlerL(CGlxCommandHandlerAiwEdit::
       
   157                                 NewL(iGridView, iResourceIds.iMenuId));
       
   158     GLX_LOG_INFO("Adding CGlxCommandHandlerAiwPrintPreview");
       
   159     iGridView->AddCommandHandlerL(CGlxCommandHandlerAiwPrintPreview::
       
   160                                 NewL(iGridView, iResourceIds.iMenuId));
       
   161     GLX_LOG_INFO("Adding CGlxCommandHandlerAiwShareOnOvi");
       
   162     iGridView->AddCommandHandlerL(CGlxCommandHandlerAiwShareOnOvi::
       
   163                                 NewL(iGridView, iResourceIds.iMenuId));    
       
   164     // End of AIW service handlers                            
       
   165     
       
   166     GLX_LOG_INFO("Adding CGlxCommandHandlerMarking");
       
   167     iGridView->AddCommandHandlerL( CGlxCommandHandlerMarking::NewL(
       
   168                                             iGridView, ETrue ) );
       
   169                                                             
       
   170     GLX_LOG_INFO("Adding CGlxCommandHandlerBack");
       
   171     iGridView->AddCommandHandlerL(
       
   172                     CGlxCommandHandlerBack::NewBackCommandHandlerL());
       
   173     
       
   174     GLX_LOG_INFO("Adding CGlxCommandHandlerMoreInfo");
       
   175     iGridView->AddCommandHandlerL(CGlxCommandHandlerMoreInfo::
       
   176                                 NewL(iGridView,EFalse));    				
       
   177     GLX_LOG_INFO("Adding CGlxCommandHandlerHideUi");
       
   178     iGridView->AddCommandHandlerL(CGlxCommandHandlerHideUi::NewL());
       
   179 
       
   180 #ifdef GLX_GRID_VIEW_IMAGES_OR_VIDEOS_ONLY_FILTERING
       
   181     iGridView->AddCommandHandlerL( CGlxCommandHandlerFilterImagesOrVideos::NewL( iGridView ) );
       
   182 #endif
       
   183     GLX_LOG_INFO("Adding CGlxCommandHandlerCopyToHomeNetwork");
       
   184     iGridView->AddCommandHandlerL(CGlxCommandHandlerCopyToHomeNetwork::NewL(*iGridView));
       
   185     
       
   186     //GLX_LOG_INFO("Adding CGlxCommandHandlerMarking");
       
   187     //iGridView->AddCommandHandlerL( CGlxCommandHandlerMarking::NewL(iGridView/*, *iGridView, ETrue*/ ) );
       
   188     GLX_LOG_INFO("Adding CGlxCommandHandlerUpload");
       
   189     iGridView->AddCommandHandlerL(CGlxCommandHandlerUpload::NewL(iGridView, ETrue));    
       
   190     
       
   191 	//Fix for error ID EVTY-7M87LF
       
   192 	//@ Registration of Video Playback Command handler has to before UPnP.
       
   193 	//@ else UPnP will not get play command once video playback command is consumed.
       
   194 	GLX_LOG_INFO("Adding CGlxCommandHandlerVideoPlayback");
       
   195     iGridView->AddCommandHandlerL(
       
   196                         CGlxCommandHandlerVideoPlayback::NewL( iGridView ) );
       
   197 
       
   198 	//Fix for error ID EVTY-7M87LF
       
   199 	//@ Registration of UPnP Command handler has to be after video play back command
       
   200 	//@ priorty of command handling is last registered in first server basis.
       
   201 	//@ UPnP will get play command first everytime, where it'll check for UPnP active.
       
   202 	//@ if UPnP is active it'll consume the event, else it'll allow other registered command to execute it.
       
   203     GLX_LOG_INFO("Adding CGlxCommandHandlerShowVisUpnp");
       
   204     iGridView->AddCommandHandlerL(CGlxCommandHandlerShowViaUpnp::NewL(iGridView, ETrue));
       
   205 
       
   206     }
       
   207 
       
   208 // ---------------------------------------------------------------------------
       
   209 // GetResourceFilenameL
       
   210 // ---------------------------------------------------------------------------
       
   211 //
       
   212 EXPORT_C void CGlxGridViewPluginBase::GetResourceFilenameL(TFileName& aResFile)
       
   213     {
       
   214     TRACER("CGlxGridViewPluginBase::GetResourceFilenameL()");
       
   215     
       
   216     aResFile = KNullDesC;
       
   217     }
       
   218 
       
   219 //  End of File