contentpublishingsrv/contentharvester/factorysettingsplugin/inc/chdbstatehandler.h
changeset 0 79c6a41cd166
equal deleted inserted replaced
-1:000000000000 0:79c6a41cd166
       
     1 /*
       
     2 * Copyright (c) 2008 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:  Central Repository about DB state change information observer
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_CHDBSTATEHANDLER_H
       
    20 #define C_CHDBSTATEHANDLER_H
       
    21 
       
    22 #include <e32base.h>	// For CActive, link against: euser.lib
       
    23 
       
    24 class CRepository;
       
    25 class CCHFactorySettings;
       
    26 
       
    27 class CCHDbStateHandler :
       
    28 	public CActive
       
    29 	{
       
    30 public:
       
    31 	/*
       
    32 	 * Destructor.
       
    33 	 */
       
    34 	~CCHDbStateHandler();
       
    35 
       
    36 	/**
       
    37 	 * Two-phased constructor.
       
    38 	 */
       
    39 	static CCHDbStateHandler* NewL( CCHFactorySettings* aCallback );
       
    40 
       
    41 private:
       
    42 	/**
       
    43 	* Simply constructor.
       
    44 	*/
       
    45 	CCHDbStateHandler( CCHFactorySettings* aCallback );
       
    46 
       
    47 	/**
       
    48 	* 2nd phase constructor.
       
    49 	*/
       
    50 	void ConstructL();
       
    51 
       
    52 private:
       
    53 	/**
       
    54 	* From CActive.
       
    55 	* Invoke when asynchronous request will be completed.
       
    56 	*
       
    57 	* @since S60 S60 v3.1
       
    58 	*/
       
    59 	void RunL();
       
    60 
       
    61 	/**
       
    62 	* From CActive.
       
    63 	* Invoke for canceling asynchronous request.
       
    64 	*
       
    65 	* @since S60 S60 v3.1
       
    66 	*/	
       
    67 	void DoCancel();
       
    68 
       
    69 	/**
       
    70 	 * Override to handle leaves from RunL(). Default implementation causes
       
    71 	 * the active scheduler to panic.
       
    72 	 * 
       
    73 	 * @since S60 S60 v3.1
       
    74 	 */
       
    75 	TInt RunError(TInt aError);
       
    76 
       
    77 private:
       
    78 	/**
       
    79 	 */
       
    80 	void ConstructFactorySettingsPathL();
       
    81 	
       
    82 	/**
       
    83 	 * Removes parsed Factory Settings files
       
    84 	 */
       
    85 	void RemoveFactorySettingsParsedFilesL();
       
    86 	
       
    87 	/**
       
    88 	 * Handle repository db state.
       
    89 	 * If KSQLDBStateRestored state match then calls HandleRestoredDbStateL
       
    90 	 * remove repository db state KSQLDBStateRestored, add KSQLDBStateNormal.
       
    91 	 */
       
    92 	void HandleDbStateL();
       
    93 	
       
    94 	/**
       
    95 	 * Handle restored db state.
       
    96 	 * Calls RemoveFactorySettingsParsedFilesL and call UpdateL on iCallback
       
    97 	 * member.
       
    98 	 */
       
    99 	void HandleRestoredDbStateL();
       
   100 
       
   101 private:
       
   102 
       
   103 	/**
       
   104 	 * Pointer to repository.
       
   105 	 * Own.
       
   106 	 */
       
   107     CRepository* iRepository;
       
   108     
       
   109     /**
       
   110      * Interface for notifying need of update after DB restore.
       
   111      * Not own.
       
   112      */
       
   113     CCHFactorySettings* iCallback;
       
   114     
       
   115     /**
       
   116      * File server session.
       
   117      */
       
   118     RFs iFs;
       
   119 
       
   120     /**
       
   121      * Path of parsed Factory Settings
       
   122      */
       
   123     TFileName iFSPath;
       
   124 	};
       
   125 
       
   126 #endif // C_CHDBSTATEHANDLER_H