usbuis/usbui/USBClassChangeUIPlugin/inc/USBClassChangeUIPluginView.h
branchRCL_3
changeset 24 e02eb84a14d2
equal deleted inserted replaced
23:25fce757be94 24:e02eb84a14d2
       
     1 /*
       
     2 * Copyright (c) 2005-2009 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:  Declares container control for application.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef USBCLASSCHANGEUIPLUGINVIEW_H
       
    20 #define USBCLASSCHANGEUIPLUGINVIEW_H
       
    21 
       
    22 // INCLUDES
       
    23 
       
    24 #include <aknview.h>            // AVKON components
       
    25 #include <AknQueryDialog.h>     // AVKON component
       
    26 #include <eikmenup.h>           // Menu pane definitions
       
    27 #include <gsplugininterface.h>  // General Settings plugin
       
    28 #include <ConeResLoader.h>
       
    29 #include <data_caging_path_literals.hrh> 
       
    30 
       
    31 #include "USBClassChangeUIPluginModel.h"   
       
    32 #include "USBClassChangeUIPluginInterface.h"
       
    33 
       
    34 // CONSTANTS
       
    35 /** implementation uid */
       
    36 const TUid KGsUSBUIPluginUid = { 0x1020E472 };
       
    37 
       
    38 _LIT(KFileDrive,"z:");
       
    39 _LIT(KResourceFileName, "USBClassChangeUIPlugin.rsc");
       
    40 _LIT(KUSBUIconFileName, "usbui.mif");
       
    41 
       
    42 /** USB modes are listed in the setting page */
       
    43 const TInt KSettingPageItemsGranularity = 3;
       
    44 
       
    45 // FORWARD DECLARATIONS
       
    46 class CUSBClassChangeUIPluginContainer;
       
    47 
       
    48 // CLASS DECLARATION
       
    49  
       
    50 /**
       
    51 * Main view of the application. Handles view activation, 
       
    52 * deactivation, commands and dynamic options menus.
       
    53 */
       
    54 class CUSBClassChangeUIPluginView :
       
    55     public CUSBClassChangeUIPluginInterface,
       
    56     public MUSBUIObserver
       
    57     {
       
    58     public: // Constructors and destructor
       
    59         	
       
    60         /**
       
    61         * Entry point for General Settings
       
    62         */	
       
    63         static CUSBClassChangeUIPluginView* NewPluginL();
       
    64         
       
    65         /**
       
    66         * Entry point for USBClassChangeUIAppUi
       
    67         */	
       
    68         static CUSBClassChangeUIPluginView* NewL();
       
    69         
       
    70     	/**
       
    71         * Symbian 2nd phase constructor.
       
    72         */
       
    73         void ConstructL();
       
    74 
       
    75 		/**
       
    76         * Destructor.
       
    77         */
       
    78         virtual ~CUSBClassChangeUIPluginView();
       
    79         
       
    80     public: // Functions from base classes
       
    81 
       
    82         /**
       
    83         * From CAknView Returns view id.
       
    84         * @param None.
       
    85         * @return View id.
       
    86         */
       
    87         TUid Id() const;
       
    88 		
       
    89 		/**
       
    90         * From CAknView Handles user commands.
       
    91         * @param aCommand A command id.        
       
    92         * @return None.
       
    93         */
       
    94         void HandleCommandL( TInt aCommand );
       
    95         
       
    96         /**
       
    97         * From CGSPluginInterface
       
    98         * Method for getting caption of this plugin. This should be the 
       
    99         * localized name of the settings view to be shown in parent view.
       
   100         *
       
   101         * @param aCaption pointer to Caption variable
       
   102         */
       
   103         void GetCaptionL( TDes& aCaption ) const;
       
   104         
       
   105         /**
       
   106         * From CGSPluginInterface.
       
   107         * Function for getting plugin's value for a certain key.
       
   108         *
       
   109         * @param aKey Key for the value to be retrieved.
       
   110         * @parem aValue Value for the given gey in TDes format.
       
   111         */
       
   112         void GetValue(const TGSPluginValueKeys aKey, TDes& aValue );
       
   113 
       
   114         /**
       
   115         * From CGSPluginInterface
       
   116         * Creates a new icon of desired type.
       
   117         *
       
   118         * @param  aIconType UID Icon type UID of the icon to be created.
       
   119         * @return Pointer of the icon. NOTE: Ownership of this icon is
       
   120         *         transferred to the caller.
       
   121         */
       
   122         CGulIcon* CreateIconL( const TUid aIconType );
       
   123    
       
   124         /**
       
   125         * Initialize options menu.
       
   126         * Remove help option, if the feature is not supported.
       
   127         * @param aResId Resource Id
       
   128         * @param aMenu The menu pane.
       
   129         */
       
   130         void DynInitMenuPaneL( TInt aResId, CEikMenuPane* aMenu );
       
   131         
       
   132         /**
       
   133         * From MUSBUIObserver.
       
   134         * Informs the observer that a setting has been changed. 
       
   135         */
       
   136         void SettingChanged();
       
   137 
       
   138         /**
       
   139          * From MUSBUIObserver/MUSBDeviceStateObserver.
       
   140          * Informs the observer that USB device state has changed.
       
   141          * @param aState current device state.
       
   142          */
       
   143         void DeviceStateChanged(TUsbDeviceState aPrevState,
       
   144                                 TUsbDeviceState aState);
       
   145 
       
   146         /**
       
   147          * From MUSBUIObserver/MUSBOtgHostStateObserver.
       
   148          * @see MUSBOtgHostStateObserver::OtgHostIdPinStateChanged
       
   149          */
       
   150         void OtgHostIdPinStateChanged(TBool aIsIdPinOn);
       
   151 
       
   152         /**
       
   153          * From MUSBOtgHostStateObserver
       
   154          * @see MUSBOtgHostStateObserver::OtgHostIdPinStateChanged
       
   155          */
       
   156         void HostEventNotify(TDeviceEventInformation aEventInfo);
       
   157         
       
   158         // New functions
       
   159         
       
   160         /**
       
   161         * Gets the USB mode (from model)
       
   162         * @param None.
       
   163         * @return the value of the personality ID
       
   164         */
       
   165         TInt USBMode() const;
       
   166         
       
   167         /**
       
   168         * Sets the USB mode (through model)
       
   169         * @param The value of the personality ID.
       
   170         * @return None.
       
   171         */
       
   172         void SetUSBModeL( TInt );
       
   173                           
       
   174         /**
       
   175          * Checks whether USB device is connected.
       
   176          */
       
   177         TBool IsUSBDeviceConnected();
       
   178 
       
   179      private: 
       
   180      
       
   181         
       
   182          /**
       
   183          * Updates parent view if we are loaded by GS plugin.
       
   184          */
       
   185         void UpdateParentView();
       
   186 
       
   187         /**
       
   188         * Handle change command for USB mode
       
   189         * @param aMode usb mode id
       
   190         */
       
   191         void HandleCmdChangeUSBModeL(TInt aMode);
       
   192         
       
   193      private: // Functions from base classes
       
   194 
       
   195         /**
       
   196         * From CAknView Activates view.
       
   197         * @param aPrevViewId Id of previous view.
       
   198         * @param aCustomMessageId Custom message id.
       
   199         * @param aCustomMessage Custom message.
       
   200         * @return None.
       
   201         */
       
   202         void DoActivateL( const TVwsViewId& aPrevViewId,
       
   203                                 TUid aCustomMessageId,
       
   204                           const TDesC8& aCustomMessage );		
       
   205 
       
   206         /**
       
   207         * From CAknView Deactivates view.        
       
   208         * @param None.
       
   209         * @return None.
       
   210         */
       
   211         void DoDeactivate();
       
   212 
       
   213     private: // Data
       
   214         //Reference to the UI container
       
   215         //owned by this class
       
   216         CUSBClassChangeUIPluginContainer*   iContainer;
       
   217         
       
   218         //reference to the AppUI
       
   219         //not owned
       
   220         CAknViewAppUi*              		iAppUIRef;
       
   221         
       
   222         //Reference to the Model
       
   223         //owned by this class
       
   224         CUSBClassChangeUIPluginModel*	    iModelRef;	
       
   225         
       
   226         // Flag used if it is needed to load 
       
   227         // the UI plugin 
       
   228         TBool                       		iLoadAsGSPlugin;
       
   229         
       
   230         CEikonEnv*                          iEikEnv;
       
   231         // Flag for eikon env.
       
   232         TInt                                iResourceFileFlag; 
       
   233         // Previous view of GS ap
       
   234         TVwsViewId 				    		iPrevViewId; 	   
       
   235        
       
   236         TBool                               iHelpSupported;
       
   237 
       
   238     };
       
   239 
       
   240 #endif  // USBCLASSCHANGEUIPLUGINVIEW_H
       
   241 
       
   242 // End of File