omadm/omadmappui/inc/NSmlDMSyncDocument.h
changeset 0 3ce708148e4d
equal deleted inserted replaced
-1:000000000000 0:3ce708148e4d
       
     1 /*
       
     2 * Copyright (c) 2002-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:  Header file for CNSmlDMSyncDocument
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef NSMLDMSYNCDOCUMENT_H
       
    21 #define NSMLDMSYNCDOCUMENT_H
       
    22 
       
    23 // INCLUDES
       
    24 #include <aknapp.h>
       
    25 #include <AknDoc.h>
       
    26 
       
    27 #include "NSmlDMSyncUi.hrh"
       
    28 #include "NSmlDMDlgProfileView.h"
       
    29 #include "NSmlDMUIDefines.h"
       
    30 #include "NSmlDMDbNotifier.h"
       
    31 
       
    32 // FORWARD DECLARATIONS
       
    33 class CEikAppUi;
       
    34 class CEikonEnv;
       
    35 class CNSmlDMSyncAppEngine;
       
    36 class CNSmlDMSyncProfileList;
       
    37 class CNSmlDMFotaModel;
       
    38 
       
    39 // CLASS DECLARATION
       
    40 
       
    41 
       
    42 /**
       
    43 *  TNSmlDMProfileItem helper class
       
    44 */
       
    45 NONSHARABLE_CLASS (TNSmlDMProfileItem)
       
    46 	{
       
    47 	public:
       
    48 		TBuf<KNSmlMaxProfileNameLength> iProfileName;	
       
    49 		TInt     iProfileId;
       
    50 		TBool	 iSynced;
       
    51 		TTime	 iLastSync;
       
    52 		TInt	 iBearer;
       
    53 		TInt	 iActive;
       
    54 		TTime    iLastSuccessSync;
       
    55 		TBool    iDeleteAllowed;
       
    56 		TBool    iProfileLocked; 
       
    57 	};
       
    58 
       
    59 /**
       
    60 *  CNSmlDMSyncDocument application class.
       
    61 */
       
    62 NONSHARABLE_CLASS (CNSmlDMSyncDocument) : public CAknDocument,
       
    63                                           public MNSmlDMDbEventHandler
       
    64     {
       
    65     enum TSanSupport
       
    66 			{
       
    67 			EOff,					
       
    68 	        EOn
       
    69 			};	
       
    70     public: // Constructors and destructor
       
    71 
       
    72         /**
       
    73         * Two-phased constructor.
       
    74         */
       
    75         static CNSmlDMSyncDocument* NewL( CAknApplication& aApp );
       
    76 
       
    77         /**
       
    78         * Destructor.
       
    79         */
       
    80         virtual ~CNSmlDMSyncDocument();
       
    81 
       
    82     public: // New functions
       
    83 
       
    84 		/**
       
    85 		* Returns the pointer to the appengine
       
    86         * @param -
       
    87 		* @return Pointer to appEngine
       
    88         */
       
    89 		inline CNSmlDMSyncAppEngine* AppEngine() const { return iAppEngine; }
       
    90 
       
    91 		/**
       
    92 		* Returns the id of the recently accessed profile
       
    93         * @param -
       
    94 		* @return - old profile id
       
    95         */
       
    96 		inline TInt OldProfileID() const { return iOldProfileId; }
       
    97 
       
    98 		/**
       
    99 		* Return the number of items
       
   100 		* @param -
       
   101 		* @return Profile item count
       
   102 		*/
       
   103 		inline TInt ProfileCount() const { return iProfileList->Count(); }
       
   104 
       
   105         /**
       
   106         * Returns the pointer to the fota model.
       
   107         * @since Series 60 3.1
       
   108         * @param None.
       
   109         * @return Pointer to the fota model instance.
       
   110         */
       
   111         CNSmlDMFotaModel* FotaModel() const;
       
   112         
       
   113         /**
       
   114         * Saves the current state of update packages.
       
   115         * @param None.
       
   116         * @return None.
       
   117         */
       
   118         void MarkFwUpdChangesStartL();
       
   119 
       
   120         /**
       
   121         * Checks if the state of update packages has changed since the saved
       
   122         * situation.
       
   123         * @param None.
       
   124         * @return True if there are differences in pcakage identifiers or states.
       
   125         */
       
   126         TBool FwUpdStatesChangedL();
       
   127 
       
   128 		/**
       
   129 		* Return the pointer to the profileitem list
       
   130         * @param aIndex Sets current index on the caller
       
   131 		* @return Pointer to the profileitem list
       
   132         */
       
   133 		CArrayFixFlat< TNSmlDMProfileItem >* ProfileList( TInt& aIndex );
       
   134 
       
   135 		/**
       
   136 		* Set current index
       
   137         * @param aIndex - new index value
       
   138 		* @return -
       
   139         */
       
   140 		void SetCurrentIndex(TInt aIndex);
       
   141 
       
   142 		/**
       
   143 		* Reads profiles again from the database and fills the profilelist
       
   144         * @param -
       
   145 		* @return -
       
   146         */
       
   147 		inline void RefreshProfileListL() { ReadProfileListL(); }
       
   148 		
       
   149 		/**
       
   150 		* Reads profiles again from the database and fills the profilelist
       
   151         * @param aIncludeHidden Should hidden profile be included
       
   152 		* @return -
       
   153         */
       
   154 		inline void RefreshProfileListL( TBool aIncludeHidden ) { ReadProfileListL( aIncludeHidden ); }
       
   155 
       
   156 		/**
       
   157 		* Deletes selected profile and updates new index
       
   158         * @param  aIndex Set new index
       
   159 		* @return (1 the deleted profile was default one /
       
   160 		* 0 deleted was other than default or there was only one left)
       
   161         */
       
   162 		TInt DeleteProfile( TInt& aIndex );
       
   163 
       
   164 		/**
       
   165 		* Return the current profile item
       
   166 		* @param -
       
   167 		* @return Pointer to the current TProfileItem profile item
       
   168 		*/
       
   169 		TNSmlDMProfileItem* ProfileItem() const;
       
   170 
       
   171 		/**
       
   172 		* Return the current profile item
       
   173 		* @param -
       
   174 		* @return Pointer to the indexed TProfileItem profile item
       
   175 		*/
       
   176 		TNSmlDMProfileItem* ProfileItemAt( TInt aIndex ) const;
       
   177 
       
   178 		/**
       
   179 		* Return the pointer to the CEikAppUi class
       
   180 		* @param -
       
   181 		* @return Pointer to the CEikAppUi
       
   182 		*/
       
   183 		CEikAppUi* AppUi() const { return iAppUi; }
       
   184 
       
   185 		/**
       
   186 		* Moves the index on the main view to the profile
       
   187 		* with specified profile Id
       
   188 		* @param aProfileId profile id
       
   189 		* @return -
       
   190 		*/
       
   191 		void MoveIndexToProfile( TInt aProfileId );
       
   192 
       
   193 		/**
       
   194 		* Copies an existing profile settings to a new id
       
   195 		* @param  aProfileId profile id
       
   196 		* @return -
       
   197 		*/
       
   198 		void GetCopyProfileL( TInt& aProfileId );
       
   199 
       
   200 		/**
       
   201 		* Return next available default profile name
       
   202 		* @param -
       
   203 		* @return - new default profile name
       
   204 		*/
       
   205 		HBufC* GetNextProfileNameLC();
       
   206 
       
   207         /**
       
   208 		* Disables DB events
       
   209 		* @param aEvent 
       
   210 		* @return None
       
   211 		*/
       
   212         void DisableDbNotifications( TBool aEvent );
       
   213         
       
   214 		/**
       
   215 		* Handles DB events
       
   216 		* @param aEvent DB event
       
   217 		* @return None
       
   218 		*/
       
   219         void HandleDbEventL( TNSmlDMDbEvent aEvent );
       
   220         
       
   221         /**
       
   222         * Utility function.
       
   223         * @param -
       
   224         * @return None.
       
   225         */                                
       
   226         TBool IsServerAlertSync();
       
   227   
       
   228         /**
       
   229         * Utility function.
       
   230         * @param -
       
   231         * @return None.
       
   232         */           
       
   233         void StartServerL();
       
   234         
       
   235         /**
       
   236         * ServerAlert Support function
       
   237         * @param -
       
   238         * @return TBool.
       
   239         */
       
   240         TBool SANSupport();
       
   241         
       
   242         /**
       
   243         * ServerAlert type return function
       
   244         * @param -
       
   245         * @return TBool.
       
   246         */
       
   247         TBool SilentSession();
       
   248         
       
   249          /**
       
   250         * ServerAlert type variable reset function
       
   251         * @param -
       
   252         * @return None.
       
   253         */
       
   254         void ResetSession();
       
   255         
       
   256         /**
       
   257         * Server profiles view current index
       
   258         * @param -
       
   259         * @return index of the current focussed profile.
       
   260         */
       
   261         TInt CurrentIndex();
       
   262         
       
   263         /**
       
   264          * FOTA set DL active P&S key defined by DM or not
       
   265          * @param None
       
   266          * @return ETrue or EFalse.
       
   267          */
       
   268          TBool DMDefinesFotaDLKey();
       
   269         
       
   270     private:
       
   271         /**
       
   272         * C++ default constructor.
       
   273         */
       
   274         CNSmlDMSyncDocument(CEikApplication& aApp): CAknDocument(aApp) { }
       
   275 
       
   276         /**
       
   277         * By default Symbian 2nd phase constructor is private.
       
   278         */
       
   279         void ConstructL();
       
   280 
       
   281 		/**
       
   282 		* Read settings from the database
       
   283         * @param -
       
   284 		* @return -
       
   285         */
       
   286 		void ReadProfileListL();
       
   287 
       
   288 		/**
       
   289 		* Read settings from the database
       
   290         * @param aIncludeHidden Should hidden profile be included
       
   291 		* @return -
       
   292         */
       
   293 		void ReadProfileListL( TBool aIncludeHidden );
       
   294 
       
   295 		/**
       
   296         * From CEikDocument, create CNSmlDMSyncAppUi "App UI" object.
       
   297         */
       
   298         CEikAppUi* CreateAppUiL();
       
   299         
       
   300 		/**
       
   301 		* Restore
       
   302         * @param aStore Stream  store
       
   303         * @param aStreamDic Dictionary
       
   304 		* @return None
       
   305         */
       
   306         void RestoreL( const CStreamStore& aStore, 
       
   307                        const CStreamDictionary& aStreamDic );
       
   308 		
       
   309     private:
       
   310         //Application engine
       
   311 		CNSmlDMSyncAppEngine*               iAppEngine;
       
   312 		// Profile list
       
   313 		CNSmlDMSyncProfileList*             iSyncProfileList;
       
   314 		// DB notifier
       
   315 		CNSmlDMDbNotifier*                  iDbNotifier;
       
   316 		//Profile list array
       
   317 		CArrayFixFlat<TNSmlDMProfileItem>*  iProfileList;
       
   318 		// Current index
       
   319 		TInt                                iCurrentIndex;	
       
   320 		// Eikon environment
       
   321 		CEikonEnv*                          iEikEnv;
       
   322 		// Old profile id
       
   323 		TInt                                iOldProfileId;	
       
   324 		// Blocks db events
       
   325 		TBool                               iDbEventsBlocked;
       
   326 		
       
   327 		CApaAppServer*                      iServer;
       
   328 		//Server alert support
       
   329 		TInt  								iSanSupport;
       
   330 		//Silent session or not
       
   331 		TBool								iSilent;
       
   332 		//FOTA DL Active P&S key defined by DM or not
       
   333 		TBool 							iDMDefinesFotaDLKey;
       
   334     };
       
   335 
       
   336 #endif // NSMLDMSYNCDOCUMENT_H
       
   337 
       
   338 // End of File