widgets/widgetapp/src/WidgetUiWindowView.cpp
changeset 10 a359256acfc6
parent 0 dd21522fd290
child 11 c8a366e56285
equal deleted inserted replaced
5:10e98eab6f85 10:a359256acfc6
    42 #include <LayoutMetaData.cdl.h> // For Layout_Meta_Data landscape/portrait status
    42 #include <LayoutMetaData.cdl.h> // For Layout_Meta_Data landscape/portrait status
    43 #include <akntoolbar.h>
    43 #include <akntoolbar.h>
    44 #endif
    44 #endif
    45 
    45 
    46 // CONSTANTS
    46 // CONSTANTS
    47     const TInt KRightSoftkeyPosition = 2;
       
    48     const TInt KLeftSoftkeyPosition = 0;
       
    49 
    47 
    50 // EXTERNAL DATA STRUCTURES
    48 // EXTERNAL DATA STRUCTURES
    51 
    49 
    52 // EXTERNAL FUNCTION PROTOTYPES
    50 // EXTERNAL FUNCTION PROTOTYPES
    53 
    51 
   100     if (iPenEnabled && AppUi()->CurrentFixedToolbar())
    98     if (iPenEnabled && AppUi()->CurrentFixedToolbar())
   101         {
    99         {
   102         AppUi()->CurrentFixedToolbar()->SetToolbarVisibility(EFalse);
   100         AppUi()->CurrentFixedToolbar()->SetToolbarVisibility(EFalse);
   103         }
   101         }
   104 #endif
   102 #endif
   105     ShowActivatedObject(EFalse);
   103     UpdateStatusPane(EFalse);
   106 
   104 
   107     // Navipane
   105     // Navipane
   108     iNaviCont = (CAknNavigationControlContainer*)StatusPane()->ControlL(
   106     iNaviCont = (CAknNavigationControlContainer*)StatusPane()->ControlL(
   109         TUid::Uid( EEikStatusPaneUidNavi ) );
   107         TUid::Uid( EEikStatusPaneUidNavi ) );
   110     iNaviDecorator = iNaviCont->CreateEditorIndicatorContainerL();
   108     iNaviDecorator = iNaviCont->CreateEditorIndicatorContainerL();
   198     switch( aCommand )
   196     switch( aCommand )
   199         {
   197         {
   200         case EAknCmdExit:
   198         case EAknCmdExit:
   201         case EEikCmdExit: // Options->Exit
   199         case EEikCmdExit: // Options->Exit
   202         case EAknSoftkeyExit: // Right Softkey (Exit or JS defined)
   200         case EAknSoftkeyExit: // Right Softkey (Exit or JS defined)
   203             ShowActivatedObject(EFalse); // deactivates any open edit boxes
   201         	UpdateStatusPane(EFalse); // deactivates any open edit boxes
   204             iWindowManager.Exit( aCommand, iWindowManager.ActiveWindow()->Uid());
   202             iWindowManager.Exit( aCommand, iWindowManager.ActiveWindow()->Uid());
   205             break;
   203             break;
   206         case EAknSoftkeyCancel:
   204         case EAknSoftkeyCancel:
   207             // cancel must be handled before hiding status pane
   205             // cancel must be handled before hiding status pane
   208             iContainer->HandleCommandL( (TInt)TBrCtlDefs::ECommandCancel + (TInt)TBrCtlDefs::ECommandIdBase );
   206             iContainer->HandleCommandL( (TInt)TBrCtlDefs::ECommandCancel + (TInt)TBrCtlDefs::ECommandIdBase );
   209             ShowActivatedObject(EFalse); // deactivates any open edit boxes
   207             UpdateStatusPane(EFalse); // deactivates any open edit boxes
   210         	break;
   208         	break;
   211         case EAknSoftkeyDone:
   209         case EAknSoftkeyDone:
   212             // accept must be handled before hiding status pane
   210             // accept must be handled before hiding status pane
   213             iContainer->HandleCommandL( (TInt)TBrCtlDefs::ECommandAccept + (TInt)TBrCtlDefs::ECommandIdBase );
   211             iContainer->HandleCommandL( (TInt)TBrCtlDefs::ECommandAccept + (TInt)TBrCtlDefs::ECommandIdBase );
   214             ShowActivatedObject(EFalse); // deactivates any open edit boxes
   212             UpdateStatusPane(EFalse); // deactivates any open edit boxes
   215         	break;
   213         	break;
   216         case ECmdMsk:
   214         case ECmdMsk:
   217             if (editing)
   215             if (editing)
   218                 {
   216                 {
   219                 break; // ignore MSK if editing
   217                 break; // ignore MSK if editing
   250 //
   248 //
   251 void CWidgetUiWindowView::DoActivateL( const TVwsViewId& /*aPrevViewId*/,
   249 void CWidgetUiWindowView::DoActivateL( const TVwsViewId& /*aPrevViewId*/,
   252                                     TUid /*aCustomMessageId*/,
   250                                     TUid /*aCustomMessageId*/,
   253                                     const TDesC8& /*aCustomMessage*/ )
   251                                     const TDesC8& /*aCustomMessage*/ )
   254     {
   252     {
   255     StatusPane()->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_SMALL);
   253     //StatusPane()->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_SMALL);
   256 
   254 
   257     //Cba()->MakeVisible(EFalse);
   255     //Cba()->MakeVisible(EFalse);
   258 
   256 
   259     iContainer->ActivateL();
   257     iContainer->ActivateL();
   260     AppUi()->AddToStackL( *this, iContainer );
   258     AppUi()->AddToStackL( *this, iContainer );
   287         {
   285         {
   288         Redraw();
   286         Redraw();
   289         }
   287         }
   290     }
   288     }
   291 
   289 
   292 // ---------------------------------------------------------------------------
       
   293 // CWidgetUiContentView::ShowActivatedObject
       
   294 // Show the StatusPane and Softkeys - needed for text boxes
       
   295 // Or just Softkeys for flash etc...
       
   296 //
       
   297 // ---------------------------------------------------------------------------
       
   298 //
       
   299 void CWidgetUiWindowView::ShowActivatedObject(TBool aVisible, TBool aShowStatusPane)
       
   300     {
       
   301     if (iActivatedObjectVisible == aVisible)
       
   302         {
       
   303         return;
       
   304         }
       
   305     iActivatedObjectVisible = aVisible;
       
   306     iStatusPaneVisible = (aVisible && aShowStatusPane);
       
   307 
       
   308     if ( iWindowManager.ActiveWindow() )
       
   309         {
       
   310         // Override Right Softkey with Cancel when editing
       
   311         if (iActivatedObjectVisible)
       
   312             {
       
   313             iCbaVisible = Cba()->IsVisible();// hold state
       
   314             TRAPD(err,Cba()->AddCommandToStackL(KRightSoftkeyPosition,R_WIDGETUI_WINDOW_VIEW_SOFTKEYS_CANCEL));
       
   315             if (err == KErrNone)
       
   316                 {
       
   317                 TRAP(err,Cba()->AddCommandToStackL(KLeftSoftkeyPosition,R_WIDGETUI_WINDOW_VIEW_SOFTKEYS_DONE));
       
   318                 }
       
   319             iWindowManager.ActiveWindow()->SetSoftkeysVisible(ETrue);
       
   320             }
       
   321         else
       
   322             {
       
   323             // remove the cancel softkey and hide softkeys if they were previously hidden
       
   324             Cba()->RemoveCommandFromStack(KRightSoftkeyPosition,EAknSoftkeyCancel);
       
   325             Cba()->RemoveCommandFromStack(KLeftSoftkeyPosition,EAknSoftkeyDone);
       
   326 
       
   327             iWindowManager.ActiveWindow()->SetSoftkeysVisible(iCbaVisible);
       
   328             }
       
   329         }
       
   330     UpdateStatusPane();
       
   331     }
       
   332 
   290 
   333 // ---------------------------------------------------------------------------
   291 // ---------------------------------------------------------------------------
   334 // CWidgetUiContentView::UpdateStatusPane
   292 // CWidgetUiContentView::UpdateStatusPane
   335 // Show the StatusPane if needed
   293 // Show the StatusPane if needed
   336 //
   294 //
   337 // ---------------------------------------------------------------------------
   295 // ---------------------------------------------------------------------------
   338 //
   296 //
   339 void CWidgetUiWindowView::UpdateStatusPane()
   297 void CWidgetUiWindowView::UpdateStatusPane( TBool aVisible )
   340     {
   298     {
       
   299     iStatusPaneVisible = aVisible;
   341 #ifdef RD_SCALABLE_UI_V2
   300 #ifdef RD_SCALABLE_UI_V2
   342     // no need for the status pane on touch phones
   301     // no need for the status pane on touch phones
   343     if (PenEnabled())
   302     if (PenEnabled())
   344         {
   303         {
   345         TInt resId = StatusPane()->CurrentLayoutResId();
   304         TInt resId = StatusPane()->CurrentLayoutResId();
   441 void CWidgetUiWindowView::DeActivateOptionsMenu()
   400 void CWidgetUiWindowView::DeActivateOptionsMenu()
   442  	{
   401  	{
   443  	iIsOptionsMenuActivated = EFalse;
   402  	iIsOptionsMenuActivated = EFalse;
   444  	}
   403  	}
   445 
   404 
       
   405 // ---------------------------------------------------------------------------
       
   406 // CWidgetUiWindowView::UpdateToolbar
       
   407 // ---------------------------------------------------------------------------
       
   408 //
       
   409 void CWidgetUiWindowView::UpdateToolbar(TBool aShow)
       
   410     {
       
   411 #ifdef RD_SCALABLE_UI_V2    
       
   412     if(Layout_Meta_Data::IsLandscapeOrientation() && aShow)
       
   413     	AppUi()->CurrentFixedToolbar()->SetToolbarVisibility(ETrue);
       
   414     else
       
   415         AppUi()->CurrentFixedToolbar()->SetToolbarVisibility(EFalse);
       
   416 #endif
       
   417     }
   446 // End of File
   418 // End of File