homesync/contentmanager/mediaservant/src/msstoresettingsview.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:  CMSStoreSettingsView class implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <mediaservant.rsg>
       
    20 #include <hlplch.h>
       
    21 
       
    22 #include "msstoresettingslist.h"
       
    23 #include "msstorelistcontroller.h"
       
    24 #include "msengine.h"
       
    25 #include "msstoresettingsview.h"
       
    26 #include "msappui.h"
       
    27 #include "msconstants.h"
       
    28 #include "msdebug.h"
       
    29 
       
    30 // --------------------------------------------------------------------------
       
    31 // CMSStoreSettingsView::CMSStoreSettingsView()
       
    32 // --------------------------------------------------------------------------
       
    33 //
       
    34 CMSStoreSettingsView::CMSStoreSettingsView( CMSAppUi& aAppUi ) :
       
    35     iAppUi( aAppUi )
       
    36     {
       
    37     }
       
    38 
       
    39 // --------------------------------------------------------------------------
       
    40 // CMSStoreSettingsView::ConstructL()
       
    41 // --------------------------------------------------------------------------
       
    42 //
       
    43 void CMSStoreSettingsView::ConstructL()
       
    44     {
       
    45     LOG(_L("[MediaServant]\t CMSStoreSettingsView::ConstructL"));
       
    46 
       
    47     BaseConstructL( R_MS_STORE_SETTINGS_VIEW );
       
    48     }
       
    49 
       
    50 // --------------------------------------------------------------------------
       
    51 // CMSStoreSettingsView::~CMSStoreSettingsView()
       
    52 // --------------------------------------------------------------------------
       
    53 //
       
    54 CMSStoreSettingsView::~CMSStoreSettingsView()
       
    55     {
       
    56     LOG(_L("[MediaServant]\t CMSStoreSettingsView::~CMSFillRuleEditView"));
       
    57 
       
    58     DoDeactivate();
       
    59     }
       
    60 
       
    61 // --------------------------------------------------------------------------
       
    62 // TUid CMSStoreSettingsView::Id()
       
    63 // --------------------------------------------------------------------------
       
    64 //
       
    65 TUid CMSStoreSettingsView::Id() const
       
    66     {
       
    67     LOG(_L("[MediaServant]\t CMSStoreSettingsView::Id"));
       
    68 
       
    69     return KMSStoreSettingsViewId;
       
    70     }
       
    71 
       
    72 
       
    73 // --------------------------------------------------------------------------
       
    74 // CMSStoreSettingsView::HandleCommandL(TInt aCommand)
       
    75 // --------------------------------------------------------------------------
       
    76 //
       
    77 void CMSStoreSettingsView::HandleCommandL(TInt aCommand)
       
    78     {
       
    79     LOG(_L("[MediaServant]\t CMSStoreSettingsView::HandleCommandL"));
       
    80 
       
    81     switch (aCommand)
       
    82         {
       
    83         case EAknCmdOpen:
       
    84             {
       
    85             iContainer->OpenSelectedListboxItemL();
       
    86             break;
       
    87             }
       
    88         case EAknSoftkeyDone:
       
    89             {
       
    90             // getting data not yet finished so we must cancel the operation
       
    91             TCmServerState state;
       
    92             iAppUi.MSEngine()->ServerState( state );
       
    93             if ( state == ECmServerStateGettingStoreFields )
       
    94                 {
       
    95                 LOG( _L( "[MediaServant]\t CMSFillRuleEditList::\
       
    96                 ~CMSFillRuleEditList cancel operation" ) );
       
    97                 iAppUi.MSEngine()->StopOperation();
       
    98                 ClearCurrentNaviPaneText();
       
    99                 }
       
   100 
       
   101             // Get store list container
       
   102             CCmStoreRuleContainer* storeRuleContainer =                                            
       
   103                         iAppUi.StoreListController()->StoreListContainer();
       
   104 
       
   105             // Set rules to server
       
   106             iAppUi.MSEngine()->SetStoreRulesL( storeRuleContainer );
       
   107 
       
   108             iAppUi.ChangeViewL( KMSStoreSettingsViewId, KMSStoreListViewId );
       
   109             break;
       
   110             }
       
   111         case EAknCmdHelp :
       
   112             {
       
   113             TRAP_IGNORE( HlpLauncher::LaunchHelpApplicationL(
       
   114                         iEikonEnv->WsSession(),
       
   115             iEikonEnv->EikAppUi()->AppHelpContextL() ));
       
   116             break;
       
   117             }
       
   118         default:
       
   119             {
       
   120             AppUi()->HandleCommandL(aCommand);
       
   121             break;
       
   122             }
       
   123         }
       
   124     }
       
   125 
       
   126 
       
   127 // --------------------------------------------------------------------------
       
   128 // CMSStoreSettingsView::DoActivateL()
       
   129 // --------------------------------------------------------------------------
       
   130 //
       
   131 void CMSStoreSettingsView::DoActivateL(
       
   132    const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
       
   133    const TDesC8& /*aCustomMessage*/)
       
   134     {
       
   135     LOG(_L("[MediaServant]\t CMSStoreSettingsView::DoActivateL"));
       
   136 
       
   137     if ( !iContainer )
       
   138         {
       
   139         // create settings screen
       
   140         iContainer = CMSStoreSettingsList::NewL( R_MS_STORE_SETTINGS_LIST,
       
   141                                                  iAppUi,
       
   142                                                  *this );
       
   143         iContainer->SetMopParent( this );
       
   144 
       
   145         // now control receives keyboard events
       
   146         iAppUi.AddToStackL( *this, iContainer );
       
   147         iContainer->ActivateL();
       
   148         }
       
   149    }
       
   150 
       
   151 // --------------------------------------------------------------------------
       
   152 // CMSStoreSettingsView::DoDeactivate()
       
   153 // --------------------------------------------------------------------------
       
   154 //
       
   155 void CMSStoreSettingsView::DoDeactivate()
       
   156     {
       
   157     LOG(_L("[MediaServant]\t CMSStoreSettingsView::DoDeactivate"));
       
   158 
       
   159     if ( iContainer )
       
   160         {
       
   161         AppUi()->RemoveFromStack( iContainer );
       
   162         }
       
   163 
       
   164     delete iContainer; // Deletes the container class object.
       
   165     iContainer = NULL;
       
   166     }
       
   167 
       
   168 // End of File
       
   169