tsrc/CenrepEditor/Src/cenrepeditorview3.cpp
changeset 0 f0cf47e981f9
equal deleted inserted replaced
-1:000000000000 0:f0cf47e981f9
       
     1 /*
       
     2 * Copyright (c) 2005 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:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <aknmessagequerydialog.h>
       
    21 #include <aknquerydialog.h>
       
    22 #include <aknnotewrappers.h>
       
    23 #include  <aknviewappui.h>
       
    24 #include  <avkon.hrh>
       
    25 #include  <cenrepeditor.rsg>
       
    26 #include "cenrepeditorappui.h"
       
    27 #include  "cenrepeditordocument.h"
       
    28 #include  "cenrepeditormodel.h"
       
    29 #include  "cenrepeditorview3.h"
       
    30 #include  "cenrepeditorview3container.h" 
       
    31 
       
    32 // ================= MEMBER FUNCTIONS =======================
       
    33 
       
    34 // ---------------------------------------------------------
       
    35 // CCenrepEditorView3::ConstructL(const TRect& aRect)
       
    36 // EPOC two-phased constructor
       
    37 // ---------------------------------------------------------
       
    38 //
       
    39 void CCenrepEditorView3::ConstructL()
       
    40     {
       
    41     BaseConstructL( R_CENREPEDITOR_VIEW3 );
       
    42     }
       
    43 
       
    44 // ---------------------------------------------------------
       
    45 // CCenrepEditorView3::~CCenrepEditorView3()
       
    46 // destructor
       
    47 // ---------------------------------------------------------
       
    48 //
       
    49 CCenrepEditorView3::~CCenrepEditorView3()
       
    50     {
       
    51     if ( iContainer )
       
    52         {
       
    53         AppUi()->RemoveFromViewStack( *this, iContainer );
       
    54         }
       
    55 
       
    56     delete iContainer;
       
    57     }
       
    58 
       
    59 // ---------------------------------------------------------
       
    60 // TUid CCenrepEditorView3::Id()
       
    61 //
       
    62 // ---------------------------------------------------------
       
    63 //
       
    64 TUid CCenrepEditorView3::Id() const
       
    65     {
       
    66     return KViewId3;
       
    67     }
       
    68 
       
    69 // ---------------------------------------------------------
       
    70 // CCenrepEditorView3::HandleCommandL(TInt aCommand)
       
    71 // takes care of view command handling
       
    72 // ---------------------------------------------------------
       
    73 //
       
    74 void CCenrepEditorView3::HandleCommandL(TInt aCommand)
       
    75     {   
       
    76     switch ( aCommand )
       
    77         {
       
    78         case EAknSoftKeyStart: 
       
    79             {  
       
    80             iContainer->StoreSettingsL();
       
    81             CCenrepEditorAppUi* appUI= static_cast<CCenrepEditorAppUi*>(iEikonEnv->EikAppUi());  
       
    82             CMusApplication* musApplication=appUI->MusApplication();  
       
    83             if(!musApplication-> AvailabilityInfo())/*break*/; // Mus Not available to start.Dont care            
       
    84             TBool result=musApplication->Start(musApplication->iUseCase);
       
    85             if(result)
       
    86                 {
       
    87                 Cba()->SetCommandSetL(R_CENREPEDITOR_SOFTKEYS_STOP_EXIT);        
       
    88                 Cba()->MakeVisible(ETrue);
       
    89                 Cba()->DrawDeferred();   
       
    90                 musApplication->MusUseCaseInfo(ETrue);
       
    91                 }            
       
    92             musApplication->MusUseCaseInfo(ETrue);
       
    93             break;
       
    94             }
       
    95         case EAknSoftKeyStop: 
       
    96             {
       
    97             iContainer->StoreSettingsL();
       
    98             CCenrepEditorAppUi* appUI= static_cast<CCenrepEditorAppUi*>(iEikonEnv->EikAppUi());  
       
    99             CMusApplication* musApplication=appUI->MusApplication();                
       
   100             TBool result=musApplication->Stop();
       
   101             if(result)
       
   102                 {
       
   103                 Cba()->SetCommandSetL(R_CENREPEDITOR_SOFTKEYS_START_EXIT);        
       
   104                 Cba()->MakeVisible(ETrue);
       
   105                 Cba()->DrawDeferred();           
       
   106                 musApplication->MusUseCaseInfo(EFalse);    
       
   107                 }
       
   108              musApplication->MusUseCaseInfo(EFalse);
       
   109              break;
       
   110              }
       
   111         default:
       
   112             {
       
   113             
       
   114             
       
   115             AppUi()->HandleCommandL( aCommand );
       
   116             break;
       
   117             }
       
   118         }
       
   119     }
       
   120 
       
   121 // ---------------------------------------------------------
       
   122 // CCenrepEditorView3::HandleClientRectChange()
       
   123 // ---------------------------------------------------------
       
   124 //
       
   125 void CCenrepEditorView3::HandleClientRectChange()
       
   126     {
       
   127     if ( iContainer )
       
   128         {
       
   129         iContainer->SetRect( ClientRect() );
       
   130         }
       
   131     }
       
   132 
       
   133 // ---------------------------------------------------------
       
   134 // CCenrepEditorView3::DoActivateL(...)
       
   135 // 
       
   136 // ---------------------------------------------------------
       
   137 //
       
   138 void CCenrepEditorView3::DoActivateL(
       
   139    const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
       
   140    const TDesC8& /*aCustomMessage*/)
       
   141     {    
       
   142      CCenrepEditorAppUi* appUI= static_cast<CCenrepEditorAppUi*>(iEikonEnv->EikAppUi());  
       
   143      CMusApplication* musApplication=appUI->MusApplication();   
       
   144     if (!iContainer)
       
   145         {
       
   146         iContainer = new (ELeave) CCenrepEditorView3Container;
       
   147         iContainer->SetMopParent(this);
       
   148         iContainer->ConstructL( ClientRect(),R_CENREPEDITOR_START_STOP_SETTINGS_LIST,musApplication);
       
   149         AppUi()->AddToViewStackL( *this, iContainer );        
       
   150         iContainer->MakeVisible( ETrue ); 
       
   151         }  
       
   152                  
       
   153     iContainer->DrawNow();
       
   154    }
       
   155 
       
   156 // ---------------------------------------------------------
       
   157 // CCenrepEditorView3::DoDeactivate()
       
   158 // 
       
   159 // ---------------------------------------------------------
       
   160 //
       
   161 void CCenrepEditorView3::DoDeactivate()
       
   162     {    
       
   163 
       
   164     if ( iContainer )
       
   165         {
       
   166         AppUi()->RemoveFromViewStack( *this, iContainer );
       
   167         }
       
   168     
       
   169     delete iContainer;
       
   170     iContainer = NULL;
       
   171     }
       
   172 
       
   173 
       
   174 // End of File
       
   175