omads/omadsappui/AspSyncUtil/inc/AspProfileWizard.h
changeset 0 dab8a81a92de
equal deleted inserted replaced
-1:000000000000 0:dab8a81a92de
       
     1 /*
       
     2 * Copyright (c) 2005 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: Used to save setting entered by user in profile creation wizard 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef ASPPROFILEWIZARD_H
       
    20 #define ASPPROFILEWIZARD_H
       
    21 
       
    22 
       
    23 //  INCLUDES
       
    24 #include "AspDialogUtil.h"
       
    25 
       
    26 
       
    27 // CONSTANTS
       
    28 
       
    29 
       
    30 
       
    31 
       
    32 /**
       
    33 * CAspWizardItem
       
    34 * 
       
    35 * CAspWizardItem contains one setting item data.
       
    36 */
       
    37 NONSHARABLE_CLASS (CAspWizardItem) : public CBase
       
    38 	{
       
    39     public:
       
    40 	enum TSettingType
       
    41 		{
       
    42 	    ETypeStart,
       
    43 	    ETypeProfileName,
       
    44 	    ETypeProtocolVersion,
       
    45 	    ETypeHostAddress,
       
    46 	    ETypeServerId,
       
    47 	    ETypeBearerType,
       
    48 	    ETypeUserName,
       
    49 		ETypePassword,
       
    50 		ETypeSyncType,
       
    51 		ETypeContentSelection,
       
    52 		ETypeSyncContent,
       
    53 		ETypeSyncContentLocalDatabase,
       
    54 		ETypeEnd
       
    55 		};
       
    56 
       
    57     public:
       
    58         /**
       
    59         * Two-phased constructor.
       
    60         */
       
    61         static CAspWizardItem* NewL();
       
    62         
       
    63         /**
       
    64         * Destructor.
       
    65         */
       
    66         ~CAspWizardItem();
       
    67         
       
    68     private:
       
    69         /**
       
    70         * C++ default constructor.
       
    71         */
       
    72         CAspWizardItem();
       
    73         
       
    74         /**
       
    75         * By default Symbian 2nd phase constructor is private.
       
    76         */
       
    77         void ConstructL();
       
    78 	
       
    79 	
       
    80 	public:
       
    81         /**
       
    82         * Set string type value.
       
    83         * @param aTex.
       
    84         * @return None.
       
    85         */
       
    86         void SetValueL(const TDesC& aText);
       
    87 
       
    88         /**
       
    89         * Get string type value.
       
    90         * @param None. 
       
    91         * @return String type value.
       
    92         */
       
    93 		const TDesC& Value();
       
    94 
       
    95         /**
       
    96         * Set content name.
       
    97         * @param aTex.
       
    98         * @return None.
       
    99         */
       
   100         void SetContentNameL(const TDesC& aText);
       
   101 
       
   102         /**
       
   103         * Get content name.
       
   104         * @param None. 
       
   105         * @return Content name.
       
   106         */
       
   107 		const TDesC& ContentName();
       
   108 
       
   109         /**
       
   110         * Set header.
       
   111         * @param aTex.
       
   112         * @return None.
       
   113         */
       
   114         void SetHeaderL(const TDesC& aText);
       
   115 
       
   116         /**
       
   117         * Set header.
       
   118         * @param aResourceId.
       
   119         * @return None.
       
   120         */
       
   121         void SetHeaderL(TInt aResourceId);
       
   122 
       
   123         /**
       
   124         * Get header.
       
   125         * @param None. 
       
   126         * @return Content name.
       
   127         */
       
   128 		const TDesC& Header();
       
   129 
       
   130         /**
       
   131         * Initalizes setting item.
       
   132         * @param None. 
       
   133         * @return None.
       
   134         */
       
   135 		void InitL();
       
   136 	
       
   137 	public:
       
   138     	// setting type
       
   139 		TInt  iSettingType;
       
   140 		
       
   141 		// identifies settings that have same setting type
       
   142 		TInt  iSettingId;
       
   143 
       
   144     	// setting editor title resource id
       
   145 		TInt iResourceId;
       
   146 		
       
   147     	// popup note resource id
       
   148 		TInt iPopupNoteResourceId;
       
   149 
       
   150     	// error note resource id
       
   151 		TInt iErrorNoteResourceId;
       
   152 
       
   153 		// is this setting included in sync wizard
       
   154 		TBool iEnabled;
       
   155 
       
   156 		// max text length
       
   157 		TInt iMaxLength;
       
   158 
       
   159 		// is setting mandatory
       
   160 		TBool iMandatory;
       
   161 		
       
   162 		// are only western characters allowed
       
   163 		TInt iLatinInput;
       
   164 		
       
   165 		// integer type value
       
   166 		TInt iNumber;
       
   167 		
       
   168     private:
       
   169 		// string type setting value
       
   170 	    HBufC* iValue;
       
   171 	
       
   172    		// content display name
       
   173 	    HBufC* iContentName;
       
   174 
       
   175    		// editor header
       
   176 	    HBufC* iHeader;
       
   177     };
       
   178 
       
   179 
       
   180 
       
   181 
       
   182 /**
       
   183 * CAspProfileWizard
       
   184 *  
       
   185 * CAspProfileWizard creates new profile.
       
   186 */
       
   187 NONSHARABLE_CLASS (CAspProfileWizard) : public CBase
       
   188     {
       
   189 
       
   190 	public:// Constructors and destructor
       
   191 
       
   192         /**
       
   193         * Two-phased constructor.
       
   194         */
       
   195         static CAspProfileWizard* NewL(TAspParam& aParam);
       
   196         
       
   197         /**
       
   198         * Destructor.
       
   199         */
       
   200         virtual ~CAspProfileWizard();
       
   201     
       
   202     private:
       
   203 
       
   204         /**
       
   205         * C++ default constructor.
       
   206         */
       
   207         CAspProfileWizard(TAspParam& aParam);
       
   208 	
       
   209         /**
       
   210         * By default Symbian OS constructor is private.
       
   211         */
       
   212         void ConstructL();
       
   213 
       
   214 	private:
       
   215 	    /**
       
   216         * Creates setting item list.
       
   217 		* @param None.
       
   218         * @return None.
       
   219         */
       
   220 	    void CreateSettingListL();
       
   221 
       
   222     public:
       
   223         void GetContentSelectionL(CSelectionItemList* aList);
       
   224         void SetContentSelectionL(CSelectionItemList* aList);
       
   225         void SetContentEnabled(const TDesC& aText, TBool aEnabled);
       
   226         void SetContentEnabled(TInt aApplicationId);
       
   227         void SetEnabled(TInt aSettingType, TBool aEnabled);
       
   228         void SetContentLocalDatabaseEnabled(TInt aDataproviderId, TBool aEnabled);
       
   229         void SetContentEnabled(TInt aDataproviderId, TBool aEnabled);
       
   230         TBool ContentEnabled(TInt aDataproviderId);
       
   231         
       
   232         void SetContentEnabled(RArray<TInt>& aDataProviderArray);
       
   233         void GetContentEnabled(RArray<TInt>& aDataProviderArray);
       
   234         void GetContentName(TDes& aText);
       
   235         TInt ContentId(const TDesC& aText);
       
   236     
       
   237     public:
       
   238         CAspWizardItem* CurrentItem();
       
   239         void CreateProfileL();
       
   240         void DeleteProfile();
       
   241         void MoveToNext();
       
   242         void MoveToPrevious();
       
   243         void MoveToStart();
       
   244         TInt CurrentItemType();
       
   245         TInt NumOfCurrentItem(CAspWizardItem* aItem);
       
   246         TInt NumOfEnabledItems();
       
   247         TInt NumOfEnabledContentItems();
       
   248         TInt NumOfContentItems();
       
   249         void SetStringValueL(const TDesC& aValue, TInt aSettingType, TInt aSettingId);
       
   250         void SetStringValueL(const TDesC& aValue, TInt aSettingType);
       
   251         void SetNumberValue(TInt& aValue, TInt aSettingType);
       
   252         TInt CreatedProfileId(void);
       
   253         TInt NumberValue(TInt aSettingType);
       
   254         CDesCArray* LocalDatabaseList(const TInt aDataproviderId);
       
   255 
       
   256         
       
   257     private:
       
   258         void GetStringValue(TDes& aValue, TInt aSettingType);
       
   259         void GetStringValue(TDes& aValue, TInt aSettingType, TInt aSettingId);
       
   260         void GetNumberValue(TInt& aValue, TInt aSettingType);
       
   261         TInt IncreaseCurrentIndex(const TInt aIndex);
       
   262         TInt DecreaseCurrentIndex(const TInt aIndex);
       
   263         TBool CheckHostAddress(const TDesC& aText);
       
   264         TInt ContentPopupNoteResourceId(TInt aDataProviderId);
       
   265         //TInt ContentHeaderResourceId(TInt aDataProviderId);
       
   266        
       
   267     private:
       
   268         //TInt ShowTextEditorL(TInt aResourceId, TDes& aText, const TDesC& aTitle, TBool aMandatory, TBool aLatinInput, TInt aMaxLength);
       
   269         
       
   270 	private:
       
   271    		// dialog parameter for returning value to caller
       
   272 		TAspParam* iDialogParam;
       
   273 
       
   274 		// id of the calling application
       
   275 		TInt iApplicationId;
       
   276 		
       
   277 		// id of the created profile
       
   278 		TInt iProfileId;
       
   279 	
       
   280     	// session with sync server
       
   281 		RSyncMLSession* iSyncSession;
       
   282 	
       
   283    		// list that contains all contents (applications)
       
   284 		CAspContentList* iContentList;
       
   285 
       
   286         // for string handling
       
   287 		TBuf<KBufSize255> iBuf;
       
   288 		
       
   289 		// list index of current profile setting
       
   290 		TInt iCurrentItemIndex;
       
   291 		
       
   292     private:
       
   293 	
       
   294 		// names of all available local data stores
       
   295 		CDesCArray* iLocalDataStores;
       
   296 		
       
   297 		// list of sync contents
       
   298 		RPointerArray<CAspWizardItem> iSettingList;
       
   299 	};
       
   300 
       
   301 
       
   302 
       
   303 
       
   304 
       
   305 
       
   306 #endif      // ASPPROFILEWIZARD_h
       
   307             
       
   308 // End of File