iaupdate/IAD/ui/inc/iaupdatesettingdialog.h
branchRCL_3
changeset 25 7333d7932ef7
parent 9 51c0f5edf5ef
child 26 8b7f4e561641
equal deleted inserted replaced
24:5cc91383ab1e 25:7333d7932ef7
     1 /*
     1 /*
     2 * Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2010-2011 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     9 * Initial Contributors:
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    10 * Nokia Corporation - initial contribution.
    11 *
    11 *
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description:   Header file of CIAUpdateSettingDialog class
    14 * Description:   CIAUpdateSettingDialog
    15 *
    15 *
    16 */
    16 */
    17 
    17 
       
    18 #ifndef ACTION_H_
       
    19 #define ACTION_H_
    18 
    20 
       
    21 #include <hbview.h>
       
    22 #include <hblineedit.h>
       
    23 #include <hblistwidget.h>
       
    24 #include <hblabel.h>
       
    25 #include <hbdataform.h>
       
    26 #include <hbdataformmodel.h>
    19 
    27 
       
    28 // Access point selection
       
    29 #include <cmmanager.h>
    20 
    30 
    21 #ifndef IAUPDATESETTINGDIALOG_H
    31 // Destination query dialog
    22 #define IAUPDATESETTINGDIALOG_H
    32 #include "cmapplsettingsui.h"
    23 
    33 
       
    34 class CIAUpdateSettingDialog : public HbView
       
    35 {
       
    36     Q_OBJECT
    24 
    37 
    25 //  INCLUDES
    38 public:
    26 #include "iaupdatedialogutil.h"
    39     explicit CIAUpdateSettingDialog(QGraphicsItem *parent=0);
       
    40     virtual ~CIAUpdateSettingDialog();
       
    41     
       
    42 public slots:
       
    43     
       
    44 private slots:
       
    45      void toggleChange(QModelIndex startIn, QModelIndex endIn);
       
    46      void showResults(uint retval);
       
    47      void showPreviousView(); 
       
    48      void activated(const QModelIndex& index);
       
    49      
       
    50 signals:
       
    51          void toMainView();
       
    52     
       
    53 private:
       
    54      
       
    55      void queryDestination();
       
    56      
       
    57      void saveSettingsL();
       
    58      
       
    59      void initializeView();
       
    60      
       
    61      uint getInternetSnapIdL();
       
    62      
       
    63      void getDestinationNameL( uint aItemUid, QString& aItemName );
       
    64      
       
    65      void initializeFieldsL();
       
    66      
       
    67     // Form & model    
       
    68     HbDataForm* mSettingsForm;
       
    69     HbDataFormModel *mModel;
       
    70     
       
    71     
       
    72     // settings ui
       
    73     CmApplSettingsUi* mApplSett;
       
    74     CmApplSettingsUi::SettingSelection mSelection;
    27 
    75 
    28 #include <e32base.h>
    76     // Form items
    29 #include <AknDialog.h>
    77     HbDataFormModelItem *mAutoUpdateItem;
    30 #include <aknsettingitemlist.h>
    78     HbDataFormModelItem *mDestinationItem;
       
    79     
       
    80     // currently selected destination
       
    81     QString mCurrentDest;
       
    82     
       
    83     // NW connection flags
       
    84     bool mSetByNwQuery; // destination set by query / user
       
    85     bool mConnected;    // already connected to query ?
       
    86     bool mInitialized;  // connection initialized ?
       
    87     
       
    88     //TInt mAccessPointId;
       
    89     
       
    90     // Connection manager
       
    91     RCmManager mCmManager;
       
    92     
       
    93     // for back key catching
       
    94     HbAction*                   mBackKey;
       
    95     
       
    96     
    31 
    97 
       
    98 };
    32 
    99 
    33 // FORWARD DECLARATIONS
   100 #endif /* ACTION_H_ */
    34 class CAknSettingItemList;
       
    35 class CIAUpdateSettingItemList;
       
    36 class CIAUpdateAccessPointHandler;
       
    37 class CIAUpdateStatusPaneHandler;
       
    38 
       
    39 
       
    40 // CLASS DECLARATION
       
    41 
       
    42 /**
       
    43 * CIAUpdateSettingDialog
       
    44 *
       
    45 * CIAUpdateSettingDialog is used for editing IA Update settings.
       
    46 */
       
    47 class CIAUpdateSettingDialog : public CAknDialog, public MEikListBoxObserver
       
    48     {
       
    49     public:
       
    50     enum TAttributeKeys
       
    51         {
       
    52         EAccessPoint = 0,
       
    53         EAutoUpdateCheck
       
    54         };
       
    55     
       
    56 	public:
       
    57 	
       
    58 	    /**
       
    59         * Launches dialog.
       
    60         * @param aParam Class that contains dialog parameters.
       
    61         * @return Completion code.
       
    62         */
       
    63 		static TBool ShowDialogL();
       
    64 		
       
    65 		
       
    66 	public:// Constructors and destructor
       
    67 
       
    68         /**
       
    69         * Two-phased constructor.
       
    70         */
       
    71 		static CIAUpdateSettingDialog* NewL();
       
    72         
       
    73         /**
       
    74         * Destructor.
       
    75         */
       
    76         virtual ~CIAUpdateSettingDialog();
       
    77     
       
    78     private:
       
    79 
       
    80         /**
       
    81         * C++ default constructor.
       
    82         */
       
    83         CIAUpdateSettingDialog();
       
    84 	
       
    85         /**
       
    86         * By default Symbian OS constructor is private.
       
    87         */
       
    88         void ConstructL();
       
    89 
       
    90 	private:
       
    91 	    SEikControlInfo CreateCustomControlL( TInt aControlType );
       
    92 	    
       
    93         /**
       
    94         * From MEikListBoxObserver, called by framework.
       
    95         * @param aListBox.
       
    96         * @param aEventType.
       
    97 		* @return None
       
    98         */
       
    99 		void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType);
       
   100 
       
   101         /**
       
   102         * From the base class.
       
   103 		* Called by framework before the dialog is shown.
       
   104         * @param None
       
   105 		* @return None
       
   106         */
       
   107         void PreLayoutDynInitL();
       
   108 
       
   109         /**
       
   110         * From the base class.
       
   111 		* Called by framework before exiting the dialog.
       
   112         * @param aButtonId Button id.
       
   113 		* @return ETrue to exit\ EFalse to not to exit.
       
   114         */
       
   115         TBool OkToExitL(TInt aButtonId);
       
   116 
       
   117         /**
       
   118         * From the base class.
       
   119 		* Called by framework for key event handling.
       
   120         * @param aKeyEvent.
       
   121 		* @param aType.
       
   122 		* @return Return code.
       
   123         */
       
   124 		TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
       
   125 
       
   126         /**
       
   127         * From the base class.
       
   128 		* Called by framework when dialog is activated.
       
   129         * @param None.
       
   130 		* @return None.
       
   131         */
       
   132 		void ActivateL();
       
   133 		
       
   134 		/**
       
   135 		* Method to get context sensitive help topic.
       
   136         * @param aContext Help topic to open.
       
   137 		* @return None.
       
   138         */
       
   139 		void GetHelpContext(TCoeHelpContext& aContext) const;
       
   140 
       
   141 		/**
       
   142         * From the base class.
       
   143 		* Called by framework before menu is shown.
       
   144         * @param aResourceId Menu resource id.
       
   145 		* @param aMenuPane Pointer to the menu.
       
   146         * @return None.
       
   147         */
       
   148 		void DynInitMenuPaneL(TInt aResourceID, CEikMenuPane* aMenuPane);
       
   149 
       
   150 		/**
       
   151 		* From the base class.
       
   152 		* Handles menu events.
       
   153 		* @param  aCommandId Command id.
       
   154 		* @return None.
       
   155 		*/
       
   156 		void ProcessCommandL(TInt aCommandId);
       
   157 		
       
   158 		/**
       
   159 		* From base class.
       
   160 		* Called when UI layout changes. 
       
   161 		* @param aType.
       
   162     	* @return None.
       
   163 		*/
       
   164         void HandleResourceChange(TInt aType);
       
   165 
       
   166 
       
   167     private:
       
   168 		/**
       
   169 		* Save settings to CR.
       
   170 		*/
       
   171 		void SaveSettingsL();
       
   172 
       
   173 		/**
       
   174 		* Read settings from CR.
       
   175 		*/
       
   176         void ReadSettingsL();
       
   177      
       
   178 	private:
       
   179 		/**
       
   180         * Opens setting editor.
       
   181         */
       
   182 		void EditItemL();
       
   183 
       
   184 		/**
       
   185         * Set setting item visibility (normal/readonly/hidden).
       
   186         * @param None.
       
   187 		* @return None.
       
   188         */
       
   189 		void SetVisibility();
       
   190 		
       
   191         /**
       
   192         * Set all settings to read-only state.
       
   193         * @param None.
       
   194 		* @return None.
       
   195         */
       
   196 		void SetAllReadOnly();
       
   197 		
       
   198 
       
   199 	private:
       
   200 		CIAUpdateSettingItemList* iList;
       
   201 
       
   202 		// for title and icon handling
       
   203 		CIAUpdateStatusPaneHandler* iStatusPaneHandler;
       
   204 
       
   205 		// dialog edit mode
       
   206 		TInt iEditMode;
       
   207 
       
   208     };
       
   209 
       
   210 
       
   211 /**
       
   212 * CIAUpdateSettingItemList
       
   213 *
       
   214 * Customized setting item list.
       
   215 */
       
   216 class CIAUpdateSettingItemList : public CAknSettingItemList
       
   217     {
       
   218     public:
       
   219         TInt Attribute( TInt aKey );
       
   220         void CheckSettings();
       
   221         
       
   222         
       
   223     public:  // from CAknSettingItemList
       
   224         /**
       
   225         * Load settings.
       
   226         */
       
   227         void LoadSettingsL();
       
   228         
       
   229     	/**
       
   230     	* Launches the setting page for the current item by calling EditItemL on it
       
   231     	* @param aIndex	- current item's (Visible) index in the list
       
   232     	* @param aCalledFromMenu- ignored in most classes; may alter the behaviour
       
   233     	* of the setting page
       
   234     	*/
       
   235     	void EditItemL( TInt aIndex, TBool aCalledFromMenu );
       
   236 
       
   237         /**
       
   238         * Create setting item.
       
   239         * @param aSettingId Setting id.
       
   240         * @return Setting item.
       
   241         */
       
   242         CAknSettingItem* CreateSettingItemL( TInt aSettingId );
       
   243 
       
   244 	private:
       
   245 	    TInt iAccessPoint;
       
   246         TInt iAutoUpdateCheck;
       
   247         };
       
   248 
       
   249 
       
   250 class CIAUpdateAccessPointSettingItem : public CAknSettingItem
       
   251 	{
       
   252 	public:
       
   253         static CIAUpdateAccessPointSettingItem* 
       
   254         CIAUpdateAccessPointSettingItem::NewL( TInt aSettingId, TInt& aAccessPointId );
       
   255 	    ~CIAUpdateAccessPointSettingItem();
       
   256 	private:
       
   257 	    CIAUpdateAccessPointSettingItem ( TInt aSettingId, TInt& aAccessPointId );
       
   258 	    void ConstructL();
       
   259 	    
       
   260 
       
   261 	public:	// from CAknSettingItem
       
   262 		void EditItemL( TBool aCalledFromMenu );
       
   263 		const TDesC& SettingTextL();
       
   264 	
       
   265 	private:
       
   266 	    TBool EditAccessPointItemL();
       
   267 
       
   268     private:
       
   269         HBufC* iSettingText;
       
   270         
       
   271         TInt& iAccessPointId;
       
   272         
       
   273    		// for access point selection
       
   274 		CIAUpdateAccessPointHandler* iApHandler;
       
   275 	};
       
   276 
       
   277 
       
   278 
       
   279 #endif      // IAUPDATESETTINGDIALOG_H
       
   280             
       
   281 // End of File