harvester/server/inc/restorewatcher.h
changeset 0 c53acadfccc6
child 7 3cebc1a84278
equal deleted inserted replaced
-1:000000000000 0:c53acadfccc6
       
     1 /*
       
     2 * Copyright (c) 2008-2009 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:  Definition of CRestoreWatcher class. Observers restore changes.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef RESTOREWATCHER_H
       
    20 #define RESTOREWATCHER_H
       
    21 
       
    22 // SYSTEM INCLUDE
       
    23 #include <e32base.h>
       
    24 #include <e32cmn.h>
       
    25 #include <e32property.h>
       
    26 
       
    27 // USER INCLUDE
       
    28 #include "mpropertyobserver.h"
       
    29 
       
    30 // FORWARD DECLERAATIONS
       
    31 class CPropertyWatcher;
       
    32 
       
    33 // CLASS DECLARATION
       
    34 /**
       
    35  *  An instance of the CRestoreWatcher object.
       
    36  *  Controls harvesterAO and message monitor behaviour when
       
    37  *  user restoring data.
       
    38  *
       
    39  *  @code
       
    40  *   
       
    41  * 
       
    42  * @endcode
       
    43  *
       
    44  *  @lib -
       
    45  *  @since -
       
    46  */
       
    47 NONSHARABLE_CLASS( CRestoreWatcher ) : public CBase, public MKeyObserver
       
    48 	{	
       
    49 
       
    50 public: 
       
    51     
       
    52 	/**
       
    53      * Factory method NewL
       
    54      */
       
    55 	static CRestoreWatcher* NewL();
       
    56 
       
    57 	/**
       
    58 	 * Destructor
       
    59 	 */
       
    60 	virtual ~CRestoreWatcher();
       
    61 
       
    62 public:	
       
    63 	/**
       
    64      * Method Register.
       
    65      */
       
    66 	TBool Register();
       
    67 
       
    68 	/**
       
    69      * Method UnregisterL.
       
    70      */
       
    71 	void UnregisterL();
       
    72 	
       
    73 public:	 // From MKeyObserver.
       
    74 
       
    75 	/**
       
    76 	 * Method NotifyKeyL from MKeyObserver get notifications when
       
    77 	 * property key has changed.
       
    78 	 */
       
    79 	void NotifyKeyL( 
       
    80 			const TInt aKeyValue,
       
    81 			const TUid aPropertyCategory,
       
    82 			const TUint aKey ); 
       
    83 
       
    84 private: // Construction 
       
    85 
       
    86 	/**
       
    87 	 * Constructor
       
    88 	 */
       
    89 	CRestoreWatcher();
       
    90 
       
    91 	/**
       
    92 	 * Symbian 2nd phase constructor.
       
    93 	 */
       
    94 	void ConstructL();
       
    95 		
       
    96 private:
       
    97 
       
    98 	/**
       
    99 	 * Method HandleBackupRestoreKeyActionL.
       
   100 	 * If user make full restore sets restore flag on.
       
   101 	 */
       
   102 	void HandleBackupRestoreKeyActionL( const TUint aKeyValue );
       
   103 	
       
   104 	/**
       
   105 	 * Method HandleClientsKeyActionL.
       
   106 	 * Unregister and register message clients. 	
       
   107 	 */
       
   108 	void HandleClientsKeyActionL( const TUint aKeyValue );
       
   109 	
       
   110 	/**
       
   111 	 * Method SetRestoreFlagL.
       
   112 	 */
       
   113 	void SetRestoreFlagL( TBool aRestoreDone );
       
   114 	
       
   115 	/**
       
   116 	 * Method CheckRestoreL.
       
   117 	 */
       
   118 	void CheckRestoreL();
       
   119 	
       
   120 	/**
       
   121 	 * Method CreateFileNameL.
       
   122 	 * Creates file name in variable iFileName.
       
   123 	 */
       
   124 	void CreateFileNameL(); 
       
   125 
       
   126 private:
       
   127 	
       
   128 	/*iRegisteredClients - registered clients for this observer.*/
       
   129 	static TInt iRegisteredClients;
       
   130 	
       
   131 	/*iPartialRestoreDone - indicates if restore is executed.*/
       
   132 	static TBool iRestoreDone;
       
   133 	
       
   134 	/*iPropertyWatcher - constains observed key's, owned by this class*/
       
   135 	CPropertyWatcher* iPropertyWatcher;
       
   136     
       
   137 	/*iClients - messageclients count.*/
       
   138 	TInt iClients;
       
   139 	
       
   140 	/*iFileName - File used for restore flag.*/
       
   141 	TFileName iFileName;
       
   142 	};
       
   143 
       
   144 #endif  // RESTOREWATCHER_H