photosgallery/viewframework/plugins/listviewpluginbase/src/glxlistviewpluginbase.cpp
changeset 0 4e91876724a2
child 25 191387a8b767
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 
       
    23 //  CLASS HEADER
       
    24 #include "glxlistviewpluginbase.h"
       
    25 
       
    26 //  EXTERNAL INCLUDES
       
    27 #include <data_caging_path_literals.hrh>
       
    28 
       
    29 //  INTERNAL INCLUDES
       
    30 #include <glxlistview.h>
       
    31 #include <glxcommandhandlerslideshow.h>
       
    32 #include <glxcommandhandlerback.h>
       
    33 #include <glxcommandhandlershowviaupnp.h>		// Command Handlers Stop Showing(upnp)
       
    34 #include <glxresourceutilities.h>               // for GetResourceFilenameL
       
    35 
       
    36 
       
    37 namespace
       
    38     {
       
    39     _LIT(KGlxListViewPluginResource, "glxlistviewplugin.rsc");
       
    40     }
       
    41 
       
    42 // ---------------------------------------------------------------------------
       
    43 // C++ default constructor can NOT contain any code, that
       
    44 // might leave.
       
    45 // ---------------------------------------------------------------------------
       
    46 //
       
    47 EXPORT_C CGlxListViewPluginBase::CGlxListViewPluginBase()
       
    48     {
       
    49     }
       
    50 
       
    51 // ---------------------------------------------------------------------------
       
    52 // Destructor
       
    53 // ---------------------------------------------------------------------------
       
    54 //
       
    55 EXPORT_C CGlxListViewPluginBase::~CGlxListViewPluginBase()
       
    56     {
       
    57     if ( iResourceOffset )
       
    58         {
       
    59         CCoeEnv::Static()->DeleteResourceFile(iResourceOffset);
       
    60         }
       
    61     }
       
    62 
       
    63 // ---------------------------------------------------------------------------
       
    64 // From CMPXAknViewPlugin
       
    65 // Construct Avkon view.
       
    66 // ---------------------------------------------------------------------------
       
    67 //
       
    68 EXPORT_C CAknView* CGlxListViewPluginBase::ConstructViewLC()
       
    69     {
       
    70     TFileName resFile;
       
    71     GetResourceFilenameL(resFile);
       
    72 
       
    73     if(resFile.Length() > 0)
       
    74         {
       
    75         iResourceOffset = CCoeEnv::Static()->AddResourceFileL(resFile);
       
    76         }
       
    77 
       
    78     CGlxListView* listView = ConstructListViewLC(this);
       
    79 
       
    80     iListView = listView;
       
    81 
       
    82     AddCommandHandlersL();
       
    83 
       
    84     // Return on cleanup stack with ownership passed
       
    85     return listView;
       
    86     }
       
    87 
       
    88 
       
    89 // ---------------------------------------------------------------------------
       
    90 // AddCommandHandlersL
       
    91 // ---------------------------------------------------------------------------
       
    92 //
       
    93 EXPORT_C void CGlxListViewPluginBase::AddCommandHandlersL()
       
    94     {
       
    95     // we dont want to step back in path for slide show in this case
       
    96     
       
    97     iListView->AddCommandHandlerL(
       
    98                               CGlxCommandHandlerBack::NewBackCommandHandlerL());
       
    99     iListView->AddCommandHandlerL(
       
   100                               CGlxCommandHandlerShowViaUpnp::NewL(iListView, EFalse));
       
   101     }
       
   102 
       
   103 
       
   104 // ---------------------------------------------------------------------------
       
   105 // GetResourceFilenameL
       
   106 // ---------------------------------------------------------------------------
       
   107 //
       
   108 EXPORT_C void CGlxListViewPluginBase::GetResourceFilenameL(TFileName& aResFile)
       
   109     {
       
   110     TParse parse;
       
   111     parse.Set(KGlxListViewPluginResource, &KDC_APP_RESOURCE_DIR, NULL);
       
   112     aResFile.Append(parse.FullName()); 
       
   113 
       
   114     CGlxResourceUtilities::GetResourceFilenameL(aResFile);
       
   115     }
       
   116 
       
   117 //  End of File