omads/omadsappui/AspSyncUtil/inc/AspSyncUtil.h
branchRCL_3
changeset 52 4f0867e42d62
parent 0 dab8a81a92de
equal deleted inserted replaced
51:8e7494275d3a 52:4f0867e42d62
       
     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: Utility methods 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef ASPSYNCUTIL_H
       
    20 #define ASPSYNCUTIL_H
       
    21 
       
    22 
       
    23 // INCLUDES
       
    24 #include <e32base.h>
       
    25 #include "AspSyncHandler.h"
       
    26 #include "AspSettingDialog.h"
       
    27 
       
    28 
       
    29 
       
    30 // CLASS DECLARATION
       
    31 
       
    32 
       
    33 /**
       
    34 * CAspSyncUtil class
       
    35 *
       
    36 * CAspSyncUtil implements functionality that is exported in CSyncUtilApi. 
       
    37 */
       
    38 NONSHARABLE_CLASS(CAspSyncUtil) : public CBase 
       
    39 	{
       
    40 
       
    41     public:
       
    42         /**
       
    43         * Two-phased constructor.
       
    44         */
       
    45 	    static CAspSyncUtil* NewL();
       
    46 
       
    47 	    /**
       
    48         * Destructor.
       
    49         */
       
    50 	    virtual ~CAspSyncUtil();
       
    51 
       
    52     private:
       
    53 	    /**
       
    54         * By default Symbian 2nd phase constructor is private.
       
    55         */
       
    56 	    void ConstructL();
       
    57 
       
    58 	    /**
       
    59         * C++ default constructor.
       
    60         */
       
    61 	    CAspSyncUtil();
       
    62 
       
    63 	
       
    64 	public:
       
    65 		
       
    66         /**
       
    67         * Performs automatic (scheduled) data synchronization. Does not create 
       
    68         * any UI.Gets synchronization data from central repository.
       
    69         * @param aScheduleTaskFile File that contains sync scheduling task. 
       
    70 	    * @return None.
       
    71         */
       
    72         void SynchronizeL(RFile& aScheduleTaskFile);        
       
    73         
       
    74         /**
       
    75         * Performs synchronization.
       
    76 		* @param aApplicationId Id of calling application.
       
    77 		* @param aInfo1.
       
    78 		* @param aInfo2.
       
    79         * @return None
       
    80         */
       
    81 		void DoSynchronizeL(TInt aApplicationId, TInt aInfo1, const TDesC& aInfo2);
       
    82 		
       
    83         /**
       
    84         * Performs synchronization. Creates necessary UI.
       
    85         * @param aApplicationId Calling application id from AiwGenericParam.hrh. 
       
    86         * @param aJobId Sync task id, KErrNotFound if not used. 
       
    87         * @param aInfo1 Extra information, KErrNotFound if not used. 
       
    88         * @param aInfo2 Extra information, KNullDesC if not used. 
       
    89 	    * @return None.
       
    90         */
       
    91 		void SynchronizeL(TInt aApplicationId, TInt aJobId, TInt aInfo1, TDes& aInfo2);
       
    92 
       
    93         /**
       
    94         * Performs synchronization. Creates necessary UI.
       
    95         * @param aApplicationId Calling application id from AiwGenericParam.hrh. 
       
    96         * @param aJobId Sync task id, KErrNotFound if not used. 
       
    97         * @param aInfo1 Extra information, KErrNotFound if not used. 
       
    98         * @param aInfo2 Extra information, KNullDesC if not used. 
       
    99 	    * @return None.
       
   100         */
       
   101 		void DoSynchronizeL(TInt aApplicationId, TInt aJobId, TInt aInfo1, TDes& aInfo2);
       
   102 
       
   103         /**
       
   104         * Shows settings dialog for changing sync settings.
       
   105 		* @param aApplicationId Calling application id.
       
   106 		* @param aProfileId Profile id.
       
   107 		* @param aDialogMode Dialog mode.
       
   108         * @return None.
       
   109         */
       
   110 		void ShowSettingsDialogL(TInt aApplicationId, TInt aProfileId, TInt aDialogMode);
       
   111 		
       
   112         /**
       
   113         * Shows settings dialog for changing sync settings.
       
   114 		* @param aApplicationId Calling application id.
       
   115         * @return None.
       
   116         */
       
   117 		void ShowProfileDialogL(TInt aApplicationId);
       
   118 		
       
   119         /**
       
   120         * Shows UI for editing synchronization settings.
       
   121         * @param aApplicationId Calling application id from AiwGenericParam.hrh.
       
   122         * @param aInfo1 Extra information, KErrNotFound if not used. 
       
   123         * @param aInfo2 Extra information, KNullDesC if not used.
       
   124 	    * @return None.
       
   125         */
       
   126 		void ShowSettingsL(TInt aApplicationId, TInt aInfo1, TDes& aInfo2);
       
   127  		
       
   128         /**
       
   129         * Shows UI for editing synchronization profile.
       
   130         * @param aApplicationId Calling application id from AiwGenericParam.hrh.
       
   131   	    * @return None.
       
   132         */
       
   133 		void EditProfileL(TInt aApplicationId);
       
   134 		
       
   135         /**
       
   136         * Shows UI for editing synchronization profile.
       
   137         * @param aApplicationId Calling application id from AiwGenericParam.hrh.
       
   138         * @param aProfileId.
       
   139   	    * @return None.
       
   140         */
       
   141 		void DoEditProfileL(TInt aAplicationId, TInt aProfileId, TInt aDialogMode);
       
   142 
       
   143         /**
       
   144         * Shows UI for editing synchronization profile.
       
   145         * @param aApplicationId Calling application id from AiwGenericParam.hrh.
       
   146         * @param aProfileId.
       
   147   	    * @return None.
       
   148         */
       
   149 		void DoEditReadOnlyProfileL(TInt aAplicationId, TInt aProfileId, 
       
   150 		                            TInt aDialogMode);
       
   151 
       
   152     private:
       
   153 
       
   154 		/**
       
   155         * Checks profile mandatory fields.
       
   156         * @param aProfileId.
       
   157     	* @return ETrue if mandatory fields are ok, EFalse otherwise.
       
   158         */
       
   159 		TBool CheckMandatoryL(TInt aProfileId);
       
   160 		
       
   161 		/**
       
   162         * Checks already selected profile for mandatory content and correct protocol version
       
   163         * @param aProfileId 
       
   164         * @param aLocalDatabase SyncML mail details name for Email app ,KNullDesC otherwise
       
   165   	    * @return ETrue if task exists and correct protocol selected, EFalse otherwise.
       
   166         */
       
   167 		
       
   168 		TBool CheckTaskAndProtocolL(TInt aProfileId ,const TDesC& aLocalDatabase);
       
   169 
       
   170 		/**
       
   171         * Find out whether sync data provider exists.
       
   172         * @param aApplicationId.
       
   173     	* @return ETrue if provider exists, EFalse otherwise.
       
   174         */
       
   175 		TBool DataProviderExist(TInt aApplicationId);
       
   176 		
       
   177 		/**
       
   178         * Checks that app id is valid and data provider exists.
       
   179         * @param aApplicationId.
       
   180     	* @return None.
       
   181         */
       
   182 		void CheckAppAndProviderL(TInt aApplicationId);
       
   183 		
       
   184 		/**
       
   185         * Opens session with sync server.
       
   186         * @param None.
       
   187     	* @return None.
       
   188         */
       
   189 		void OpenSyncSessionL();
       
   190 
       
   191 		/**
       
   192         * Closes session with sync server.
       
   193         * @param None.
       
   194     	* @return None.
       
   195         */
       
   196 		void CloseSyncSession();
       
   197 		
       
   198 		/**
       
   199         * Creates contentlist.
       
   200         * @param None.
       
   201     	* @return None.
       
   202         */
       
   203 		void CreateContentListL();
       
   204 		
       
   205 		/**
       
   206         * Selects profile.
       
   207         * @param aProfileId.
       
   208         * @param aTaskId.
       
   209     	* @param aResourceId.
       
   210     	* @param aLocalDatabase
       
   211     	* @param aCheckId 
       
   212     	* @return None.
       
   213         */
       
   214         TBool SelectProfileL(TInt& aProfileId, TInt& aTaskId, 
       
   215                              TInt aResourceId, const TDesC& aLocalDatabase,TBool aCheckId);
       
   216 
       
   217     private:
       
   218 		// id of the calling application
       
   219 		TInt iApplicationId;
       
   220 
       
   221    		// sync session
       
   222 		RSyncMLSession iSyncSession;
       
   223 		
       
   224 		// is sync session open
       
   225 		TBool iSyncSessionOpen;
       
   226 		
       
   227 		// performs sync operation, uses CNSmlAppEngine
       
   228 		CAspSyncHandler* iSyncHandler;
       
   229 
       
   230 		// sync data provider list
       
   231 		CAspContentList* iContentList;
       
   232 		
       
   233 		// settings dialog
       
   234 		CAspSettingDialog* iSettingDialog;
       
   235 		
       
   236     	// is setting database in read only state
       
   237 		TBool iSettingEnforcement;
       
   238 		
       
   239     	// resource handler
       
   240 		CAspResHandler* iResHandler;
       
   241     };
       
   242 
       
   243 
       
   244 
       
   245 #endif  // ASPSYNCUTIL_H
       
   246 
       
   247 
       
   248 // End of file