mpx/viewframework/baseviewplugins/src/mpxakndialogplugin.cpp
changeset 0 a2952bb97e68
equal deleted inserted replaced
-1:000000000000 0:a2952bb97e68
       
     1 /*
       
     2 * Copyright (c) 2006 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:  MPX Avkon dialog plugin definition.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include <AknDialog.h>
       
    22 #include <mpxcustomcommandobserver.h>
       
    23 #include <mpxviewutilitycommanddef.h>
       
    24 
       
    25 #include "mpxakndialogplugin.h"
       
    26 
       
    27 
       
    28 // ======== MEMBER FUNCTIONS ========
       
    29 
       
    30 // ---------------------------------------------------------------------------
       
    31 // Destructor
       
    32 // ---------------------------------------------------------------------------
       
    33 //
       
    34 EXPORT_C CMPXAknDialogPlugin::~CMPXAknDialogPlugin()
       
    35     {
       
    36     delete iDialog;
       
    37     }
       
    38 
       
    39 // ---------------------------------------------------------------------------
       
    40 // From CMPXViewPlugin
       
    41 // Interface method to create view.
       
    42 // ---------------------------------------------------------------------------
       
    43 //
       
    44 EXPORT_C void CMPXAknDialogPlugin::CreateViewL()
       
    45     {
       
    46     // no need to create again if view already exist
       
    47     if ( !iDialog )
       
    48         {
       
    49         iDialog = ConstructDialogL();
       
    50         }    
       
    51     }
       
    52 
       
    53 // ---------------------------------------------------------------------------
       
    54 // From CMPXViewPlugin
       
    55 // Interface method to destroy view.
       
    56 // ---------------------------------------------------------------------------
       
    57 //
       
    58 EXPORT_C void CMPXAknDialogPlugin::DestroyView()
       
    59     {
       
    60     delete iDialog;
       
    61     iDialog = NULL;
       
    62     }
       
    63 
       
    64 // ---------------------------------------------------------------------------
       
    65 // From CMPXViewPlugin
       
    66 // Interface method to activate view.
       
    67 // ---------------------------------------------------------------------------
       
    68 //
       
    69 EXPORT_C void CMPXAknDialogPlugin::ActivateViewL( 
       
    70     const TDesC* /* aParam */ )
       
    71     {
       
    72     if ( !iDialog )
       
    73         {
       
    74         CreateViewL();
       
    75         }    
       
    76     iDialog->ExecuteLD( ResourceId() );
       
    77     if ( iCommandObserver )
       
    78         {
       
    79         TPckgC<TInt> selfPtr( reinterpret_cast<TInt>( this ) );    
       
    80         iCommandObserver->HandleCustomCommand( 
       
    81             TUid::Uid( KMPXViewUtilityCustomCommand ), 
       
    82             EMPXViewUtilCmdViewDeActivated,
       
    83             selfPtr );
       
    84         }    
       
    85     iDialog = NULL;
       
    86     }
       
    87 
       
    88 // ---------------------------------------------------------------------------
       
    89 // From CMPXViewPlugin
       
    90 // Interface method to activate as default view, will not bring to foreground
       
    91 // ---------------------------------------------------------------------------
       
    92 //
       
    93 EXPORT_C void CMPXAknDialogPlugin::SetAsDefaultViewL()
       
    94     {
       
    95     User::Leave( KErrNotSupported );
       
    96     }
       
    97 
       
    98 // ---------------------------------------------------------------------------
       
    99 // From CMPXViewPlugin
       
   100 // Interface method to deactivate view.
       
   101 // ---------------------------------------------------------------------------
       
   102 //
       
   103 EXPORT_C void CMPXAknDialogPlugin::DeactivateView()
       
   104     {
       
   105     if ( iCommandObserver )
       
   106         {
       
   107         TPckgC<TInt> selfPtr( reinterpret_cast<TInt>( this ) );    
       
   108         iCommandObserver->HandleCustomCommand( 
       
   109             TUid::Uid( KMPXViewUtilityCustomCommand ), 
       
   110             EMPXViewUtilCmdViewDeActivated,
       
   111             selfPtr );
       
   112         }
       
   113     }
       
   114 
       
   115 // End of File