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