homesync/contentmanager/mediaservant/src/msbrowsecontainer.cpp
branchIOP_Improvements
changeset 40 08b5eae9f9ff
parent 39 6369bfd1b60d
child 41 b4d83ea1d6e2
equal deleted inserted replaced
39:6369bfd1b60d 40:08b5eae9f9ff
     1 /*
       
     2 * Copyright (c) 2008 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:  CMSBrowseContainer class implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <mediaservant.rsg>
       
    20 #include <StringLoader.h>
       
    21 #include "upnpstring.h"
       
    22 
       
    23 #include "mserv.hlp.hrh"
       
    24 #include "cmstorerulecontainer.h"
       
    25 #include "cmstorerule.h"
       
    26 #include "msappui.h"
       
    27 #include "msstorelistcontroller.h"
       
    28 #include "msbrowseview.h"
       
    29 #include "msbrowsecontainer.h"
       
    30 #include "msengine.h"
       
    31 #include "mediaservantuid.h"
       
    32 
       
    33 #include "msdebug.h"
       
    34 
       
    35 
       
    36 // --------------------------------------------------------------------------
       
    37 // CMSBrowseContainer::CMSBrowseContainer()
       
    38 // --------------------------------------------------------------------------
       
    39 //
       
    40 CMSBrowseContainer::CMSBrowseContainer( CMSAppUi& aAppUi,
       
    41                                         CMSBrowseView& aView )
       
    42     {
       
    43     LOG(_L("[MediaServant]\t CMSBrowseContainer::CMSBrowseContainer"));
       
    44 
       
    45     iAppUi = &aAppUi;
       
    46     iView = &aView;    
       
    47     }
       
    48 
       
    49 // --------------------------------------------------------------------------
       
    50 // CMSBrowseContainer::~CMSBrowseContainer()
       
    51 // --------------------------------------------------------------------------
       
    52 //
       
    53 CMSBrowseContainer::~CMSBrowseContainer()
       
    54     {
       
    55     LOG(_L("[MediaServant]\t CMSBrowseContainer::~CMSBrowseContainer"));
       
    56 
       
    57     delete iListBox; // Deletes listbox object.
       
    58     }
       
    59 
       
    60 // --------------------------------------------------------------------------
       
    61 // CMSBrowseContainer::GetBrowseDataL()
       
    62 // Gets file information from engine
       
    63 // --------------------------------------------------------------------------
       
    64 //
       
    65 void CMSBrowseContainer::GetBrowseDataL()
       
    66     {
       
    67     LOG(_L("[MediaServant]\t CMSBrowseContainer::GetBrowseDataL"));
       
    68 
       
    69     CMSParameterAgent* parameterAgent = iAppUi->ParameterAgent();
       
    70 
       
    71     TInt selected = iAppUi->ParameterAgent()->StoreViewFocusIndex();
       
    72 
       
    73     // get list container
       
    74     CCmStoreRuleContainer* storeRuleContainer =
       
    75                 iAppUi->StoreListController()->StoreListContainer();
       
    76 
       
    77     // get rule
       
    78     CCmStoreRule* storeRule = storeRuleContainer->StoreRule( selected );
       
    79 
       
    80     // read media type
       
    81     storeRule->StoreRule(0, &iMediaType);
       
    82 
       
    83     iView->SetTitlePaneTextL( iMediaType );
       
    84 
       
    85     // get items covered by rule
       
    86     iItemArray = iAppUi->MSEngine()->GetStoreListItemsL( storeRule->Name() );
       
    87 
       
    88     HBufC* naviText = NULL;
       
    89 
       
    90     switch ( iItemArray->Count() )
       
    91         {
       
    92         case 0: // 0 items
       
    93             {
       
    94             naviText = StringLoader::LoadLC(
       
    95                                 R_MS_STORE_BROWSE_NAVI_0_ITEMS );
       
    96             break;
       
    97             }
       
    98         case 1: // 1 item
       
    99             {
       
   100             naviText = StringLoader::LoadLC(
       
   101                                 R_MS_STORE_BROWSE_NAVI_1_ITEM );
       
   102             break;
       
   103             }
       
   104         default: // many items
       
   105             {
       
   106             naviText = StringLoader::LoadLC(
       
   107                                 R_MS_STORE_BROWSE_NAVI_ITEMS,
       
   108                                 iItemArray->Count() );
       
   109             // do number conversion
       
   110             TPtr ptr = naviText->Des();
       
   111             AknTextUtils::DisplayTextLanguageSpecificNumberConversion( ptr );
       
   112 
       
   113             break;
       
   114             }
       
   115         }
       
   116 
       
   117     iView->SetNavigationPaneTextL( *naviText );
       
   118     CleanupStack::PopAndDestroy( naviText );
       
   119     }
       
   120 
       
   121 // --------------------------------------------------------------------------
       
   122 // CMSBrowseContainer::HandleResourceChange
       
   123 // Handles layout change
       
   124 // --------------------------------------------------------------------------
       
   125 //
       
   126 void CMSBrowseContainer::HandleResourceChange( TInt aType )
       
   127     {
       
   128     LOG(_L("[MediaServant]\t CMSBrowseContainer::HandleResourceChange"));
       
   129 
       
   130     if ( aType == KEikDynamicLayoutVariantSwitch )
       
   131         {
       
   132         SetRect( iView->ClientRect() );
       
   133         }
       
   134 
       
   135     CCoeControl::HandleResourceChange( aType );
       
   136     }
       
   137 
       
   138 // ---------------------------------------------------------------------------
       
   139 // CMSBrowseContainer::GetHelpContext
       
   140 // ---------------------------------------------------------------------------
       
   141 //
       
   142 void CMSBrowseContainer::GetHelpContext( TCoeHelpContext& aContext ) const
       
   143     {
       
   144     LOG(_L("[MediaServant]\t CMSBrowseContainer::GetHelpContext"));
       
   145 
       
   146     aContext.iMajor = TUid::Uid(KMediaServantUID3);
       
   147     aContext.iContext = KMSERV_HLP_FILE_BROWSE;
       
   148     }
       
   149 
       
   150 // End of File
       
   151