pushmtm/MtmUiInc/PushSettingsDialog.h
changeset 51 48e827313edd
parent 37 481242ead638
child 53 f427d27b98d8
equal deleted inserted replaced
37:481242ead638 51:48e827313edd
     1 /*
       
     2 * Copyright (c) 2002 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 the License "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:  Class definition of CPushSettingsDialog.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef PUSHSETTINGSDIALOG_H
       
    21 #define PUSHSETTINGSDIALOG_H
       
    22 
       
    23 //  INCLUDES
       
    24 
       
    25 #include "PushMtmSettings.h"
       
    26 #include <AknForm.h>
       
    27 #include <eiklbo.h>
       
    28 #include <ConeResLoader.h>
       
    29 
       
    30 // FORWARD DECLARATIONS
       
    31 
       
    32 class CMsvSession;
       
    33 class CAknSettingStyleListBox;
       
    34 class CEikImage;
       
    35 
       
    36 // CLASS DECLARATION
       
    37 
       
    38 /**
       
    39 * Avkon environment is required.
       
    40 * Waiting dialog.
       
    41 * Usage.
       
    42 * #include "PushSettingsDialog.h"
       
    43 * CPushSettingsDialog* dlg = new (ELeave) CPushSettingsDialog;
       
    44 * dlg->ExecuteLD( msvSession );
       
    45 *
       
    46 * Note that we could use CMuiuSettingsArray defined in MuiuSettingsArray.h, 
       
    47 * but it seems that our PI list handling (Ignore services from) makes 
       
    48 * this dialog so complicated, that it is better not to use CMuiuSettingsArray, 
       
    49 * which would make the desing more complicated, because it does not support 
       
    50 * such functionality that PI list handling requires.
       
    51 */
       
    52 class CPushSettingsDialog : public CAknDialog, 
       
    53                             public MEikListBoxObserver
       
    54     {
       
    55     public: // Constructors
       
    56 
       
    57         /**
       
    58         * Constructor.
       
    59         * @param aMsvSession Message Server session.
       
    60         */
       
    61         CPushSettingsDialog( CMsvSession& aMsvSession );
       
    62     
       
    63     public: // New functions
       
    64 
       
    65         /**
       
    66         * Execute the dialog with this member.
       
    67         * @return None.
       
    68         */
       
    69         void ExecuteLD();
       
    70 
       
    71     private: // New data types
       
    72 
       
    73         enum TSettingType
       
    74             {
       
    75             EServiceReception, ///< On or Off
       
    76             EServiceLoadingType ///< Automatic or Manual
       
    77             };
       
    78 
       
    79     private: // Constructors and destructor
       
    80 
       
    81         /**
       
    82         * Symbian OS constructor.
       
    83         */
       
    84         void ConstructL();
       
    85 
       
    86         /**
       
    87         * Destructor.
       
    88         */
       
    89         ~CPushSettingsDialog();
       
    90 
       
    91     private: // New functions
       
    92         
       
    93         /**
       
    94         * Set up title text.
       
    95         * @return none
       
    96         */
       
    97         void SetUpStatusPaneL();
       
    98 
       
    99         /**
       
   100         * Restore the previous title text.
       
   101         * @return none
       
   102         */
       
   103         void RestoreStatusPaneL();
       
   104 
       
   105         /**
       
   106         * Construct model.
       
   107         * @return none
       
   108         */
       
   109         void ConstructModelL();
       
   110 
       
   111         /**
       
   112         * Update setting page model.
       
   113         * @return none
       
   114         */
       
   115         void UpdateSettingListBoxModelL();
       
   116 
       
   117         /**
       
   118         * Update setting page view.
       
   119         * @return none
       
   120         */
       
   121         void UpdateSettingListBoxViewL() const;
       
   122 
       
   123         /**
       
   124         * Apply changes of the model.
       
   125         * @return None.
       
   126         */
       
   127         void ApplyModelChangesL();
       
   128 
       
   129         /**
       
   130         * Show radio button setting page for all 
       
   131         * items except for EIgnoreServicesFrom.
       
   132         * @return none
       
   133         */
       
   134 		void ShowRadioButtonSettingPageL( const TSettingType aSettingType );
       
   135 
       
   136         /**
       
   137         * Show the confirmation dialog about the changing of the service loading 
       
   138         * type from 'manual' to 'automatic'.
       
   139         * @return ETrue if the user confirmed. EFalse otherwise.
       
   140         */
       
   141 		TBool ShowServiceLoadingTypeConfirmationL() const;
       
   142 
       
   143         /**
       
   144         * Change current setting. No setting page usage is preferred.
       
   145         * @return none
       
   146         */
       
   147         void ChangeCurrentSettingWithoutSettingPageL();
       
   148 
       
   149         /**
       
   150         * Change current setting with the usage of setting page.
       
   151         * @return none
       
   152         */
       
   153         void ChangeCurrentSettingL();
       
   154 
       
   155         /**
       
   156         * Append an item to the list box' item text array.
       
   157         * @param aSettingType Setting item type.
       
   158         * @param aTitleResId Title resource id. If it is KErrNotFound, 
       
   159         *        then aTitleText is used.
       
   160         * @param aValueResId Value resource id. If it is KErrNotFound, 
       
   161         *        then aValueText is used.
       
   162         * @param aTitleText See above.
       
   163         * @param aValueText See above.
       
   164         * @return none
       
   165         */
       
   166         void ConstructAndAppendItemTextL
       
   167             ( const TSettingType aSettingType, 
       
   168             const TInt aTitleResId, const TInt aValueResId, 
       
   169             const TDesC& aTitleText = KNullDesC(), 
       
   170             const TDesC& aValueText = KNullDesC() );
       
   171 
       
   172         /**
       
   173         * Construct the title text for a setting.
       
   174         * param aSettingType Type of the setting.
       
   175         * @return The constructed title text.
       
   176         */
       
   177         HBufC* ConstructSettingTitleL( const TSettingType aSettingType ) const;
       
   178 
       
   179         /**
       
   180         * Get the resource ids of those strings that a given binary setting can have.
       
   181         * Note. The following functions have strong relations: 
       
   182         * ConstructSettingValueArray, CurrentlySelectedSettingValueResId, 
       
   183         * ConstructSettingValueArrayL, UpdateSettingL!
       
   184         * param aSettingType Type of the setting.
       
   185         * param aVal1ResId The id of the first value string.
       
   186         * param aVal2ResId The id of the second value string.
       
   187         * @return None.
       
   188         */
       
   189         void ConstructSettingValueArray
       
   190             ( const TSettingType aSettingType, TInt& aVal1ResId, TInt& aVal2ResId ) const;
       
   191 
       
   192         /**
       
   193         * Get the resource ids of the currently set value string.
       
   194         * Note. The following functions have strong relations: 
       
   195         * ConstructSettingValueArray, CurrentlySelectedSettingValueResId, 
       
   196         * ConstructSettingValueArrayL, UpdateSettingL!
       
   197         * param aSettingType Type of the setting.
       
   198         * param aIndex The index of this currently selected value is also returned.
       
   199         * @return Resource id.
       
   200         */
       
   201         TInt CurrentlySelectedSettingValueResId
       
   202             ( const TSettingType aSettingType, TInt& aIndex ) const;
       
   203 
       
   204         /**
       
   205         * Get the value strings of those strings that a given binary setting can have.
       
   206         * Note. The following functions have strong relations: 
       
   207         * ConstructSettingValueArray, CurrentlySelectedSettingValueResId, 
       
   208         * ConstructSettingValueArrayL, UpdateSettingL!
       
   209         * param aSettingType Type of the setting.
       
   210         * param aIndex The index of this currently selected value is also returned.
       
   211         * @return The value array.
       
   212         */
       
   213         CDesCArrayFlat* ConstructSettingValueArrayL
       
   214             ( const TSettingType aSettingType, TInt& index ) const;
       
   215 
       
   216         /**
       
   217         * Set in the model the right setting value using the given index.
       
   218         * Note. The following functions have strong relations: 
       
   219         * ConstructSettingValueArray, CurrentlySelectedSettingValueResId, 
       
   220         * ConstructSettingValueArrayL, UpdateSettingL!
       
   221         * param aSettingType Type of the setting.
       
   222         * param aIndex The index of the selected value.
       
   223         * @return None.
       
   224         */
       
   225         void UpdateSettingL
       
   226             ( const TSettingType aSettingType, const TInt index ) const;
       
   227 
       
   228     private: // Functions from base classes
       
   229 
       
   230         TKeyResponse OfferKeyEventL
       
   231             ( const TKeyEvent& aKeyEvent, TEventCode aType );
       
   232 
       
   233         void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
       
   234 
       
   235        	void PreLayoutDynInitL();
       
   236 
       
   237         void ProcessCommandL( TInt aCommand );
       
   238 
       
   239         TBool OkToExitL( TInt aButtonId );
       
   240 
       
   241         void HandleListBoxEventL( CEikListBox* aListBox, TListBoxEvent aEventType );
       
   242 
       
   243 #ifdef __SERIES60_HELP
       
   244 
       
   245         void GetHelpContext( TCoeHelpContext& aContext ) const;
       
   246 
       
   247 #endif //__SERIES60_HELP
       
   248 
       
   249     private: // Data members
       
   250 
       
   251         CPushMtmSettings*   iModel;                         ///< Settings: the model. Has.
       
   252         CMsvSession&        iMsvSession;                    ///< Message Server session.
       
   253         RConeResourceLoader iResourceLoader;                ///< Resource file loader.
       
   254         TFileName iResourceFile;
       
   255         CAknSettingStyleListBox*        iSettingListBox;    ///< List box contained by the dialog. Uses.
       
   256         CDesCArrayFlat*     iSettingListBoxItemTextArray;   ///< List box' item text array. Uses.
       
   257         CArrayFixFlat<TSettingType>*    iSettingType;       /**< A given array item 
       
   258                                                             * determines the type of 
       
   259                                                             * the item of the list 
       
   260                                                             * with the same index. Has.
       
   261                                                             */
       
   262         TBool               iNewTitleTextUsed;              ///< Indicate if new title text is used.
       
   263         HBufC*              iPreviousTitleText;             ///< Restore it on termination. Has.
       
   264         TBool               iRestoreSP;     /**< EFalse, if it is not necessary 
       
   265                                             * to restore status pane. */
       
   266     };
       
   267 
       
   268 #endif // PUSHSETTINGSDIALOG_H
       
   269             
       
   270 // End of file.