mobilemessaging/mmsui/settingsinc/MmsSettingsDialog.h
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 /*
       
     2 * Copyright (c) 2002-2004 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:  
       
    15 *           Implements MMS service and sending settings dialogs
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 #ifndef MMSSETTINGSDIALOG_H
       
    22 #define MMSSETTINGSDIALOG_H
       
    23 
       
    24 //  INCLUDES
       
    25 
       
    26 #include <AknForm.h>
       
    27 #include <msvapi.h> //for MMsvSessionObserver
       
    28 #include <eiklbo.h> // MEikListBoxObserver
       
    29 #include <ConeResLoader.h>              // ResLoader
       
    30 
       
    31 #include <mmsconst.h> // MmsMessageDeliveryReport
       
    32 
       
    33 // CONSTANTS
       
    34 
       
    35 const TUint KColumnListSpace = ' ';//For getting the line on the listbox
       
    36 const TInt KMmsSettingsSendRetryCount = 3;
       
    37 const TInt KMmsSettingsSendRetryInterval = 600;
       
    38 const TInt KSettingsGranularity = 4;
       
    39 const TInt KMmsUiLongestSettingLength = 100;
       
    40 
       
    41 // MACROS
       
    42 
       
    43 // DATA TYPES
       
    44 typedef TBuf<KMmsUiLongestSettingLength> TMmsSettingsText;
       
    45 
       
    46 // Enumerations for service settings listbox
       
    47 enum
       
    48     {
       
    49     EMmsSettingsImageSize = 0,
       
    50     EMmsSettingsCreationMode,
       
    51     EMmsSettingsAccessPoint,
       
    52     EMmsSettingsReceivingMode,
       
    53     EMmsSettingsReceivingAnonymous,
       
    54     EMmsSettingsReceivingAds,
       
    55     EMmsSettingsReceiveReport,
       
    56 // This value is used for denying read report, too. 
       
    57 // CMmsSettingsDialog handles that their values go hand in hand ( both have either EFalse or ETrue )
       
    58 // in CMmsSettings object.
       
    59     EMmsSettingsDenyDeliveryReport,
       
    60     EMmsSettingsValidityPeriod
       
    61     };
       
    62     
       
    63 // MMS receiving - When enabled
       
    64 enum
       
    65     {
       
    66     EMmsSettingsWhenEnabledFetch = 0,
       
    67     EMmsSettingsWhenEnabledPostpone,
       
    68     EMmsSettingsWhenEnabledReject
       
    69     };
       
    70 
       
    71 // MMS receiving settings. Used both for in & outside home network
       
    72 enum
       
    73     {
       
    74     EMmsSettingsReceivingAutomaticAlways = 0,
       
    75     EMmsSettingsReceivingAutomaticHome,
       
    76     EMmsSettingsReceivingManualAlways,
       
    77     EMmsSettingsReceivingDisabledAlways
       
    78     };
       
    79 
       
    80 enum
       
    81     {
       
    82     EMmsSettingsYes = 0,
       
    83     EMmsSettingsNo
       
    84     };
       
    85 
       
    86 // MMS read reports settings values
       
    87 enum TMmsSettingsReceiveReportValues
       
    88     {
       
    89     EMmsSettingsReceiveReportBoth = 0,
       
    90     EMmsSettingsReceiveReportDelivery,
       
    91     EMmsSettingsReceiveReportNone,
       
    92     };
       
    93     
       
    94 enum
       
    95     {
       
    96     EMmsSettingsValidityPeriod1h = 0,
       
    97     EMmsSettingsValidityPeriod6h,
       
    98     EMmsSettingsValidityPeriod24h,
       
    99     EMmsSettingsValidityPeriod3d,
       
   100     EMmsSettingsValidityPeriodWeek,
       
   101     EMmsSettingsValidityPeriodMaximum
       
   102     };
       
   103 
       
   104 // MMS priority settings per mms
       
   105 enum
       
   106 	{
       
   107     	EMmsSettingsPriorityHigh = 0,
       
   108     	EMmsSettingsPriorityNormal,
       
   109     	EMmsSettingsPriorityLow
       
   110 	};
       
   111 	
       
   112 // Image size options. Normally 2 options:
       
   113 //  First:  large  (0)
       
   114 //  Second: small  (1)
       
   115 //
       
   116 //  If the image is small:
       
   117 //  First:  small  (0)
       
   118 //  Second: <not_available>
       
   119 
       
   120 enum
       
   121     {
       
   122     EMmsSettingsImageSmall = 0,
       
   123     EMmsSettingsImageLarge
       
   124     };
       
   125 
       
   126 // Type of creation mode setting
       
   127 enum TMmsUiSettingsCreationMode
       
   128     {
       
   129     EMmsSettingsCreationModeRestricted = 0,
       
   130     EMmsSettingsCreationModeGuided,
       
   131     EMmsSettingsCreationModeFree
       
   132     };
       
   133 
       
   134 // FORWARD DECLARATIONS
       
   135 class CClientMtmRegistry;
       
   136 class CAknNavigationControlContainer;
       
   137 class CAknTitlePane;
       
   138 class CMmsSettings;
       
   139 class CCommsDatabase;
       
   140 class CApUtils;
       
   141 class CEikTextListBox;
       
   142 class CMuiuSettingsArray;
       
   143 
       
   144 // CLASS DECLARATIONS
       
   145 
       
   146 /**
       
   147  * Class CMmsSettingsDialog
       
   148  * Creates a dialog for editing mms settings. Values are from loc
       
   149  * files. The actual setting values come from MmsClientMtm and then
       
   150  * a corresponding value from localisation is shown to the user.
       
   151  *
       
   152  * Note: It is expected that the context is set to MMS service
       
   153  * object before calling!
       
   154  *
       
   155  * @since 0.9
       
   156  */
       
   157 
       
   158 class CMmsSettingsDialog : public CAknDialog, public MEikListBoxObserver
       
   159     {
       
   160     public:
       
   161         enum TMmsExitCode
       
   162             {
       
   163             EMmsExit = 0,
       
   164             EMmsBack,
       
   165             EMmsExternalInterrupt,
       
   166             EMmsExitWithSave
       
   167             };
       
   168             
       
   169     public:
       
   170         /**
       
   171          * Constructor
       
   172          * @param aClientMtm - client mtm instance. Note: context must be set 
       
   173          *                     to MMS service & LoadMessageL() called!
       
   174          * @param aExitCode out - which command closed the dialog
       
   175          */
       
   176         CMmsSettingsDialog(
       
   177             CMmsSettings* aMmsSettings,
       
   178             TMmsExitCode& aExitCode );
       
   179             
       
   180         /**
       
   181         *
       
   182         */
       
   183         //void ConstructL();
       
   184             
       
   185         /**
       
   186          * Destructor
       
   187          */
       
   188         ~CMmsSettingsDialog();
       
   189 
       
   190     protected:
       
   191         
       
   192         /**
       
   193          * From CAknDialog
       
   194          */
       
   195         void ProcessCommandL( TInt aCommandId ) ;   
       
   196         
       
   197         /** 
       
   198         * From CEikDialog
       
   199         */
       
   200         TBool OkToExitL( TInt aKeyCode );
       
   201 
       
   202         /** 
       
   203          * From CEikDialog
       
   204          */
       
   205         TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
       
   206 
       
   207         /**
       
   208          * From MEikListBoxObserver 
       
   209          */
       
   210         void HandleListBoxEventL( CEikListBox* aListBox, TListBoxEvent aEventType );
       
   211 
       
   212     private:
       
   213         
       
   214         /** 
       
   215          * From CEikDialog
       
   216          * Sets the layout for the dialog. Called just before the dialog
       
   217          * is activated
       
   218          */
       
   219         void PreLayoutDynInitL();
       
   220 
       
   221         /**
       
   222         * From CEikDialog
       
   223         * Initializes items on the menu
       
   224         */
       
   225         void DynInitMenuPaneL(TInt aMenuId, CEikMenuPane* aMenuPane);
       
   226 
       
   227         /**
       
   228          * Gets the values for the mms service settings and store to listbox.
       
   229          */
       
   230         void GetServiceSettingsValuesL();
       
   231 
       
   232         /**
       
   233          * Maps creation mode value from engine to SettingsDialog values
       
   234          */
       
   235         TInt32 GetCreationMode();
       
   236 
       
   237         /**
       
   238          * Sets one listbox item to settings array.
       
   239          * @param aIndex - index of the item
       
   240          * @param aCurrentNumber - value of the item
       
   241          */
       
   242         void SetArrayItem( TInt aIndex, TInt aCurrentNumber );
       
   243 
       
   244         /**
       
   245          * Sets one listbox item to settings array.
       
   246          * @param aIndex - index of the item
       
   247          * @param aCurrentNumber - value of the item
       
   248          * @param aUserText - formatted UI text
       
   249          */
       
   250         void SetArrayItem( TInt aIndex, TInt aCurrentNumber, const TDesC& aUserText );
       
   251 
       
   252 
       
   253         /**
       
   254          * Handles which settings is selected
       
   255          * @param aIndex - index of the item
       
   256          * @param aEnterPressed
       
   257          */
       
   258         void HandleEditRequestL( TInt aIndex, TBool aEnterPressed );
       
   259 
       
   260         /**
       
   261          * Edits the values of the mms receiving mode
       
   262          */
       
   263         void EditReceivingModeL();
       
   264 
       
   265         /**
       
   266          * Edits the values of the receiving anonymous messages setting
       
   267          * @param aEnterPressed
       
   268          */
       
   269         void EditReceivingAnonymousL( TBool aEnterPressed );
       
   270 
       
   271         /**
       
   272          * Edits the values of the receiving adds setting
       
   273          * @param aEnterPressed
       
   274          */
       
   275         void EditReceivingAdsL( TBool aEnterPressed );
       
   276         
       
   277         /**
       
   278          * Edits the values of the receiving reports setting
       
   279          */ 
       
   280         void EditReceiveReportsL( );
       
   281 
       
   282         /**
       
   283          * Store the receive report setting.
       
   284          * @param aReceiveReport - receive report setting
       
   285          */ 
       
   286         void SetReceiveReportSetting( TMmsSettingsReceiveReportValues aReceiveReport );
       
   287         
       
   288         /**
       
   289          * Edits the values of the sending delivery reports setting
       
   290          * @param aEnterPressed
       
   291          */ 
       
   292         void EditDenySendingDeliveryReportsL( TBool aEnterPressed );
       
   293         
       
   294         /**
       
   295          * Edits the values of the validity period setting
       
   296          */ 
       
   297         void EditValidityPeriodL();
       
   298 
       
   299         /**
       
   300          * Store the validity period setting .
       
   301          * @param aValidityPeriod validity period time
       
   302          */ 
       
   303         void SetValidityPeriodSetting( TInt32 aValidityPeriod );
       
   304        
       
   305         /**
       
   306          * Edits the values of the Access Point
       
   307          * @return ETrue if exit was requested from Access point dialog
       
   308          *         EFalse otherwise
       
   309          */
       
   310         TBool EditAccessPointL();
       
   311 
       
   312         /**
       
   313          * Gets a name for the access point
       
   314          * @param aId ID of the access point
       
   315          * @param aName caller allocated buffer for access point,
       
   316          *              size KCommsDbSvrMaxFieldLength
       
   317          */
       
   318         void GetNameForApL( TUint32 aId, TDes& aName );
       
   319 
       
   320         /**
       
   321          * Edits the values of the image size setting
       
   322          * @param aEnterPressed
       
   323          */ 
       
   324         void EditImageSizeL( TBool aEnterPressed );
       
   325 
       
   326         /**
       
   327          * Edits the values of the creation mode setting
       
   328          * @param aEnterPressed
       
   329          */ 
       
   330         void EditCreationModeL( TBool aEnterPressed );
       
   331 
       
   332         /**
       
   333          * Sets the title text
       
   334          */
       
   335         void SetTitleTextL();
       
   336         
       
   337         /**
       
   338          * Checks the access point as a part of closing dialog (back / exit).
       
   339          * @return ETrue if closing with errors i.e. AP does not exist
       
   340          *               and exit was selected at some point.
       
   341          *         EFalse if AP is ok.
       
   342          */
       
   343         TBool CheckAndCorrectAccessPointL();
       
   344 
       
   345         /**
       
   346          * Checks whether or not the access point exists
       
   347          * @param aUtils utility class 
       
   348          * @param aAP access point id
       
   349          * @return ETrue access point exists
       
   350          *         EFalse access point does not exist (got "not found" leave)
       
   351          */
       
   352         TBool ApExistsL( CApUtils* aUtils, TInt32 aAP ) const;
       
   353         
       
   354         /**
       
   355          * Finishing operations when closing the dialog.
       
   356          * @return ETrue if save is not wanted
       
   357          *         EFalse if OK to save settings
       
   358          */
       
   359         TBool ClosingDialogL();
       
   360 
       
   361         /**
       
   362          * Does the exit operation for all
       
   363          */
       
   364         void ExitDialogL();
       
   365  
       
   366         /**
       
   367          * Sets the selection item's ui side and return true if selected value is accepted.
       
   368          * @param TInt aCurrentItem The value which is chosen by the user.
       
   369          * @param TInt aList What list is to be read from the resource file.        
       
   370          * @param TInt aItem Which setting item is to changed
       
   371          * @return TBool ETrue if selected value is accepted
       
   372          *               EFalse otherwise.
       
   373          */
       
   374         TBool SetAndGetSettingItemL( TInt& aCurrentItem, TInt aList, TInt aItem );
       
   375 
       
   376         /**
       
   377          * Shows query "settings not ok. exit anyway)
       
   378          * @return ETrue if exit wanted, EFalse otherwise
       
   379          */
       
   380         TBool ShowExitAnywayQueryL() const;
       
   381 
       
   382         /**
       
   383          * From CCoeControl, returns help context
       
   384          */
       
   385         void GetHelpContext( TCoeHelpContext& aContext ) const; 
       
   386         
       
   387         /** 
       
   388          * Launches help application
       
   389          */
       
   390         void LaunchHelpL();
       
   391 
       
   392         /** 
       
   393          * Show information note
       
   394          */
       
   395         void ShowInformationNoteL( TInt aResourceId );
       
   396 
       
   397     private:
       
   398 
       
   399         enum TSettingsDialogFlags
       
   400             {
       
   401             EShouldExit                    = 0x0001,
       
   402             EGoingToExit                   = 0x0002,
       
   403             EExitSelected                  = 0x0004,
       
   404             ESwitchToExit                  = 0x0008,
       
   405             EHelpFeatureSupported          = 0x0010,
       
   406             ECSDEnabled                    = 0x0020,
       
   407             EDefaultNaviPane               = 0x0040,
       
   408             ECreationModeChangeEnabled     = 0x0080,
       
   409             EManualFetchFeatureSupported   = 0x0100,
       
   410             EReceivingOffDisabled          = 0x0200,
       
   411             EReceivingAlwaysManualDisabled = 0x0400,
       
   412             EReceivingAutomaticHomeDisabled= 0x0800
       
   413             };
       
   414 
       
   415         CAknNavigationControlContainer* iNaviPane; //not owned
       
   416         CMuiuSettingsArray*             iItems;
       
   417         //CMmsClientMtm*                  iMmsClient;
       
   418         CMmsSettings*                   iMmsSettings;
       
   419         HBufC*                          iPreviousTitleText;
       
   420         CAknTitlePane*                  iTitlePane;
       
   421         TMmsExitCode&                   iExitCode;  // pass exit code to caller
       
   422         CCommsDatabase*                 iCommsDb;
       
   423         CEikTextListBox*                iListbox;
       
   424         TInt                            iSettingsFlags;
       
   425     };
       
   426 
       
   427 #endif    //MMSSETTINGSDIALOG_H
       
   428             
       
   429 // End of File