omadm/omadmappui/inc/NSmlDMDlgProfileView.h
changeset 0 3ce708148e4d
equal deleted inserted replaced
-1:000000000000 0:3ce708148e4d
       
     1 /*
       
     2 * Copyright (c) 2005-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:  Header file for Server Profile settings dialog
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef NSMLDMDLGPROFILEVIEW_H
       
    20 #define NSMLDMDLGPROFILEVIEW_H
       
    21 
       
    22 // INCLUDES
       
    23 
       
    24 #include <AknDialog.h>  //CAknDialog
       
    25 #include <eiklbo.h>     //MEikListBoxObserver
       
    26 #include <akntextsettingpage.h>
       
    27 #include "NSmlDMdef.h"
       
    28 
       
    29 // FORWARD DECLARATIONS
       
    30 class CNSmlDMSyncDocument;
       
    31 class CEikListBox;
       
    32 class CEikTextListBox;
       
    33 class CAknSettingStyleListBox;
       
    34 class CAknNavigationDecorator;
       
    35 class CAknTabGroup;
       
    36 class CNSmlDMSyncAppUi;
       
    37 class CNSmlDMSyncProfile;
       
    38 class CNSmlDMSyncAppEngine;
       
    39 class CNSmlDMProfileData;
       
    40 class CAknNavigationControlContainer;
       
    41 
       
    42 typedef CArrayPtr<CNSmlDMProfileData> CNSmlDMSettingItemList;
       
    43 
       
    44 // CLASS DECLARATION
       
    45 /**
       
    46 *  CNSmlDMDlgProfileView
       
    47 *
       
    48 *  PRofile view
       
    49 */
       
    50 NONSHARABLE_CLASS (CNSmlDMDlgProfileView) : public CAknDialog, 
       
    51                                             public MEikListBoxObserver
       
    52     {
       
    53     public:
       
    54     	enum TNSmlProfile
       
    55     		{
       
    56     		ENSmlProfileName = 0,
       
    57     		ENSmlServerId,
       
    58     		ENSmlProfileDMServerPassword,
       
    59     		ENSmlConnType,
       
    60     		ENSmlAccessPoint,
       
    61     		ENSmlProfileURL,
       
    62     		ENSmlProfilePort,
       
    63     		ENSmlUsername,
       
    64     		ENSmlPassword,
       
    65     		ENSmlServerAlertAllowed,
       
    66     		ENSmlServerAccept,
       
    67     		ENSmlHttpsUsed,
       
    68     		ENSmlHttpsUsername,
       
    69     		ENSmlHttpsPassword
       
    70     		};
       
    71 
       
    72     public:// Constructors and destructor			
       
    73         /**
       
    74         * Two-phased constructor.
       
    75 		* @param aDoc       - pointer to document instance
       
    76 		* @param aMode      - edit, new or copy profile mode
       
    77 		* @param aProfileId - profile id
       
    78         */
       
    79 		static CNSmlDMDlgProfileView* NewL( CNSmlDMSyncDocument* aDoc,
       
    80 		                                    TNSmlEditMode aMode,
       
    81 		                                    TInt aProfileId );
       
    82 
       
    83 		/**
       
    84 		* Destructor
       
    85 		*/
       
    86 	    virtual ~CNSmlDMDlgProfileView();
       
    87 	    
       
    88     private:
       
    89 
       
    90 		/**
       
    91 		* C++ default constructor.
       
    92 		* @param aDoc       - pointer to document instance
       
    93 		* @param aMode      - edit, new or copy profile mode
       
    94 		* @param aProfileId - profile id
       
    95 		* @return None.
       
    96 		*/
       
    97 		CNSmlDMDlgProfileView( CNSmlDMSyncDocument* aDoc,
       
    98 		                       TNSmlEditMode aMode,
       
    99 		                       TInt aProfileId );
       
   100 	  
       
   101     public:
       
   102 		/**
       
   103 		* From the base class
       
   104         * @param aKeyEvent
       
   105 		* @param aType
       
   106         * @return -
       
   107         */
       
   108 		TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent,
       
   109 		                                   TEventCode aType );
       
   110 
       
   111 		/**
       
   112 		* From base class
       
   113 		* @param CDesCArray* aArray - array of the contacts 
       
   114 		*                             items on the smlcontact
       
   115 		* @return -
       
   116 		*/
       
   117 		virtual void ProcessCommandL( TInt aCommandId );
       
   118 		
       
   119 		/**
       
   120 		* Called before menu is shown
       
   121         * @param TInt aResourceId Menu resource id
       
   122 		* @param CEikMenuPane* aMenuPane Pointer to the menu
       
   123         * @return -
       
   124         */
       
   125 		void DynInitMenuPaneL( TInt aResourceID, CEikMenuPane* aMenuPane );
       
   126 
       
   127 		/**
       
   128 		* Handle selection key presses
       
   129 		* @param -
       
   130 		* @return -
       
   131 		*/
       
   132 		void HandleOKL();
       
   133 
       
   134         /**
       
   135         * Add setting items to listbox
       
   136         * @param aListBox - pointer to listbox
       
   137         * @param aItemList - pointer to setting item array
       
   138         * @return -
       
   139 		*/
       
   140 		void AddProfileListItemL( CEikTextListBox* aListBox,
       
   141 		                          CNSmlDMSettingItemList* aItemList );
       
   142 
       
   143 		/**
       
   144 		* Loads setting dialog title from resource
       
   145 		* @param -
       
   146 		* @return -
       
   147 		*/
       
   148 		void SetSettingTitleL();
       
   149 	
       
   150 		/**
       
   151 		* Checks the type of the setting item
       
   152 		* @param CNSmlDMProfileData& aItem - reference to setting item
       
   153 		* @return ETrue if changed, EFalse otherwise
       
   154 		*/
       
   155 		TBool PrepareToEditSettingItemL( CNSmlDMProfileData& aItem );
       
   156 
       
   157 		/**
       
   158 		* Exit application when selected from Options menu
       
   159 		* @param -
       
   160 		* @return -
       
   161 		*/
       
   162 		void DoExitFromMenuL();
       
   163 
       
   164 		/**
       
   165 		* Return pointer to CNSmlDMSyncDocument
       
   166 		* @param -
       
   167 		* @return CNSmlDMSyncDocument*
       
   168 		*/
       
   169 		CNSmlDMSyncDocument* Document() const { return iDoc; }
       
   170 
       
   171 		/**
       
   172 		* Method to get context sensitive help topic
       
   173         * @param TCoeHelpContext& aContext - Help topic to open
       
   174 		* @return -
       
   175         */
       
   176 		void GetHelpContext( TCoeHelpContext& aContext ) const;
       
   177 
       
   178 	private:
       
   179 	
       
   180 		/**
       
   181         * From CEikDialog OkToExitL( TInt aButtonId );
       
   182 		* Called by framework before exiting the dialog
       
   183         * @param TInt aButtonId - id of the pressed button
       
   184 		* @return TBool (ETrue to exit\ EFalse to not to exit yet
       
   185         */
       
   186 		TBool OkToExitL( TInt aButtonId );
       
   187 	
       
   188 		/**
       
   189         * From CEikDialog PreLayoutDynInitL()
       
   190 		* Called by framework before the dialog is shown
       
   191         * @param -
       
   192 		* @return -
       
   193         */
       
   194 		void PreLayoutDynInitL();
       
   195 
       
   196 		/**
       
   197         * HandleListBoxEventL MEikListBoxObserver
       
   198         * @param aListBox Pointer to used listbox
       
   199 		* @param aEventType Event type
       
   200         * @return -
       
   201         */
       
   202 		void HandleListBoxEventL( CEikListBox* aListBox,
       
   203 		                          TListBoxEvent aEventType );
       
   204 	
       
   205 		/**
       
   206 		* Build list items
       
   207 		* @param -
       
   208 		* @return -
       
   209 		*/
       
   210 		void CreateProfileSettingsListL();
       
   211 
       
   212 		/**
       
   213 		* Launch access point dialog
       
   214 		* @param aItem Profile item
       
   215 		* @return Boolean
       
   216 		*/
       
   217 		TBool EditSettingItemAccessPointL( CNSmlDMProfileData& aItem );
       
   218 
       
   219 		/**
       
   220 		* Check access point
       
   221 		* @param TUint aId - id of the access point
       
   222 		* @return -
       
   223 		*/
       
   224 		void SetAccessPointInfoL( TUint aId );
       
   225 		
       
   226 		/**
       
   227 		* Get access point info
       
   228 		* @param TUint aId - id of the access point
       
   229 		* @return -
       
   230 		*/		
       
   231 		void GetAccessPointInfoL( TInt aId );
       
   232 	
       
   233 		/**
       
   234 		* Handle text type setting items
       
   235 		* @param aItem - reference to setting item
       
   236 		* @return ETrue if changed, EFalse otherwise
       
   237 		*/
       
   238 		TBool EditSettingItemTextL( CNSmlDMProfileData& aItem );
       
   239 
       
   240 		/**
       
   241 		* Handle password type setting items
       
   242 		* @param aItem - reference to setting item
       
   243 		* @return ETrue if changed, EFalse otherwise
       
   244 		*/
       
   245 		TBool EditSettingItemSecretL(CNSmlDMProfileData& aItem);
       
   246 
       
   247 		/**
       
   248 		* Handle number type setting items
       
   249 		* @param aItem - reference to setting item
       
   250 		* @return ETrue if changed, EFalse otherwise
       
   251 		*/
       
   252 		TBool EditSettingItemNumberL(CNSmlDMProfileData& aItem);
       
   253 
       
   254 		/**
       
   255 		* Handle list type setting items
       
   256 		* @param aItem - reference to setting item
       
   257 		* @return ETrue if changed, EFalse otherwise
       
   258 		*/
       
   259 		TBool EditSettingItemListL(CNSmlDMProfileData& aItem);
       
   260 
       
   261 		/**
       
   262 		* Handle boolean type setting items
       
   263 		* @param aItem - reference to setting item
       
   264 		* @return ETrue to refresh list
       
   265 		*/
       
   266 		TBool EditSettingItemListYesNoL(CNSmlDMProfileData& aItem);
       
   267 		
       
   268 		/**
       
   269 		* Handle boolean type setting items
       
   270 		* @param aItem - reference to setting item
       
   271 		* @return ETrue to refresh list
       
   272 		*/
       
   273 		TBool EditHttpSettingItemListYesNoL(CNSmlDMProfileData& aItem);		
       
   274 
       
   275 		/**
       
   276 		* Saves profile
       
   277 		* @param -
       
   278 		* @return -
       
   279 		*/
       
   280 		void SaveProfileL();
       
   281 
       
   282 		/**
       
   283 		* Sets default values for new profile
       
   284 		* @param -
       
   285 		* @return -
       
   286 		*/
       
   287 		void FillProfileWithDefaultsL();
       
   288 
       
   289 		/**
       
   290 		* Check that mandatory fields are filled correctly
       
   291 		* @param -
       
   292 		* @return Index of the invalid setting item, -1 if ok.
       
   293 		*/
       
   294 		TInt CheckMandatoryFieldsL();
       
   295 
       
   296 		/**
       
   297 		* Check that mandatory fields are filled correctly
       
   298 		* @param -
       
   299 		* @return Index of the invalid setting item, -1 if ok.
       
   300 		*/
       
   301 		TInt CheckUniqueFieldsL();
       
   302 
       
   303 		/**
       
   304 		* Launch Confirmation note
       
   305 		* @param aResource - resource id
       
   306 		* @return ETrue if accepted, otherwise EFalse
       
   307 		*/
       
   308 		TBool ShowConfirmationNoteL(TInt aResource);
       
   309 
       
   310 		/**
       
   311 		* Is edited profile just edited
       
   312 		* @param -
       
   313 		* @return ETrue if Edit mode
       
   314 		*/
       
   315 		inline TBool EditMode() { return iEditMode == ESmlEditProfile; }
       
   316 		
       
   317 		/**
       
   318 		* Is edited profile copied
       
   319 		* @param -
       
   320 		* @return ETrue if Copy profile
       
   321 		*/
       
   322 		inline TBool CopyMode() { return iEditMode == ESmlCopyProfile; }
       
   323 
       
   324 		/**
       
   325 		* Show confirmation note to user before editing setting item
       
   326 		* @param -
       
   327 		* @return - return prompt id if warning needed, 0 otherwise
       
   328 		*/
       
   329 		TInt WarnUserOfChangeL();
       
   330 
       
   331 		/**
       
   332 		* Get item for current index
       
   333 		* @param aIndex index of item
       
   334 		* @return ProfileData from item list
       
   335 		*/
       
   336         CNSmlDMProfileData* Item( TInt aItemId );
       
   337 		
       
   338 		/**
       
   339 		* Get item for current index
       
   340 		* @param aIndex index of item
       
   341 		* @return ProfileData from item list
       
   342 		*/        
       
   343         CNSmlDMProfileData* IndexItem( TInt aItemId );
       
   344 		
       
   345 		/**
       
   346 		* Get item for current index
       
   347 		* @param aIndex index of item
       
   348 		* @return ProfileData from item list
       
   349 		*/        
       
   350         CNSmlDMProfileData* GetItemForIndex( TInt aIndex );
       
   351 
       
   352 		/**
       
   353 		* Utility function
       
   354 		* @param aHeaders
       
   355 		* @return None
       
   356 		*/
       
   357         void BuildHeaders( CDesCArray* aHeaders );
       
   358 
       
   359 		/**
       
   360 		* Utility function
       
   361 		* @param None
       
   362 		* @return None
       
   363 		*/        
       
   364         void BuildItemIds();
       
   365 
       
   366 		/**
       
   367 		* Utility function
       
   368 		* @param None
       
   369 		* @return None
       
   370 		*/        
       
   371         void BuildProfileNameItemL();
       
   372 
       
   373 		/**
       
   374 		* Utility function
       
   375 		* @param None
       
   376 		* @return None
       
   377 		*/        
       
   378         void BuildProfileServerIdItemL();
       
   379         
       
   380 		/**
       
   381 		* Utility function
       
   382 		* @param None
       
   383 		* @return None
       
   384 		*/
       
   385         void BuildProfileServerPasswordItemL();
       
   386 
       
   387 		/**
       
   388 		* Utility function
       
   389 		* @param None
       
   390 		* @return None
       
   391 		*/        
       
   392         void BuildProfileConnectionTypeItemL();
       
   393 
       
   394 		/**
       
   395 		* Utility function
       
   396 		* @param None
       
   397 		* @return None
       
   398 		*/        
       
   399         void BuildProfileAccessPointItemL();
       
   400 
       
   401 		/**
       
   402 		* Utility function
       
   403 		* @param None
       
   404 		* @return None
       
   405 		*/        
       
   406         void BuildProfileUrlItemL();
       
   407 
       
   408 		/**
       
   409 		* Utility function
       
   410 		* @param None
       
   411 		* @return None
       
   412 		*/        
       
   413         void BuildProfilePortItemL();
       
   414 
       
   415 		/**
       
   416 		* Utility function
       
   417 		* @param None
       
   418 		* @return None
       
   419 		*/        
       
   420         void BuildProfileUserNameandPassWordItemL();
       
   421 
       
   422 		/**
       
   423 		* Utility function
       
   424 		* @param None
       
   425 		* @return None
       
   426 		*/        
       
   427         void BuildProfileActiveAcceptedItemL();
       
   428 
       
   429 		/**
       
   430 		* Utility function
       
   431 		* @param None
       
   432 		* @return None
       
   433 		*/        
       
   434         void BuildProfileHttpsUsedItemL();
       
   435 
       
   436 		/**
       
   437 		* Utility function
       
   438 		* @param None
       
   439 		* @return None
       
   440 		*/        
       
   441         void BuildProfileHttpsUserNameAndPasswordItemL();
       
   442         
       
   443         /**
       
   444          * Handle connection setting item selection
       
   445          * @param aItem - reference to setting item
       
   446          * @return boolean to refresh list
       
   447          */
       
   448         TBool EditConnectionSettingItemL(CNSmlDMProfileData& aItem );
       
   449 
       
   450 	private:
       
   451 		// Non owned data members
       
   452         CNSmlDMSyncAppEngine*       iSyncAppEngine;
       
   453 		CNSmlDMSyncDocument*        iDoc;
       
   454 		CNSmlDMSettingItemList*     iProfileList;
       
   455 		CNSmlDMSyncProfile*         iProfile;
       
   456 		CAknSettingStyleListBox*    iProfileListBox;
       
   457 		CAknNavigationDecorator*    iNaviDecorator;
       
   458 		CAknTabGroup*               iTabGroup;
       
   459 		TNSmlEditMode               iEditMode;
       
   460 		TInt                        iProfileId;
       
   461 		TInt                        iOldProfileId;
       
   462 		TBool                       iServerIdChanged;
       
   463 		TBuf<KBufSize256>           iBuf;
       
   464 		CAknNavigationControlContainer* iNaviPane;
       
   465 		TInt iResourceOffset;
       
   466 		TInt iConnUtilResourceOffset;
       
   467     };
       
   468 
       
   469 // CLASS DECLARATION
       
   470 /**
       
   471 *  CNSmlDMTextEditor
       
   472 *
       
   473 *  For Handling Enter keys in Editors
       
   474 */
       
   475 
       
   476 NONSHARABLE_CLASS (CNSmlDMTextEditor) : public CAknTextSettingPage
       
   477 	{
       
   478     public:
       
   479     
       
   480     /**
       
   481 		* Constructor
       
   482 		* @param resource id
       
   483 		* @param text
       
   484 		* @param flag
       
   485 		*/ 
       
   486         CNSmlDMTextEditor(TInt aResourceID,TDes& aText,TInt aTextSettingPageFlags);                                                    
       
   487          
       
   488    /**
       
   489 		* Destructor
       
   490 		*/                                            
       
   491         ~CNSmlDMTextEditor();   
       
   492         
       
   493     /**
       
   494      * From the base class
       
   495      * @param aKeyEvent
       
   496      * @param aType
       
   497      * @return -Key response
       
   498      */             
       
   499         
       
   500 	    TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);
       
   501 	};
       
   502 
       
   503 
       
   504 
       
   505                                             
       
   506 #endif //NSMLDMDLGPROFILEVIEW_H
       
   507 
       
   508 // End of File