commonappservices/alarmserver/Server/Include/ASSrvEnvironmentChangeManager.h
changeset 0 2e3d3ce01487
equal deleted inserted replaced
-1:000000000000 0:2e3d3ce01487
       
     1 // Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifndef __ASSRVENVIRONMENTCHANGEMANAGER_H__
       
    17 #define __ASSRVENVIRONMENTCHANGEMANAGER_H__
       
    18 
       
    19 // System includes
       
    20 #include <bacntf.h>
       
    21 
       
    22 // Classes referenced
       
    23 class CASSrvServerWideData;
       
    24 class MASSrvEnvironmentChangeObserver;
       
    25 
       
    26 //
       
    27 // ----> CASSrvEnvironmentChangeManager (header)
       
    28 //
       
    29 /**
       
    30  * Implements environment (locale) change handling
       
    31  */
       
    32 class CASSrvEnvironmentChangeManager : public CBase
       
    33 	{
       
    34 //
       
    35 public:										// STATIC CONSTRUCT / DESTRUCT
       
    36 //
       
    37 	static CASSrvEnvironmentChangeManager*	NewL(CASSrvServerWideData& aServerWideData);
       
    38 	~CASSrvEnvironmentChangeManager();
       
    39 
       
    40 //
       
    41 private:									// INTERNAL CONSTRUCT
       
    42 //
       
    43 	CASSrvEnvironmentChangeManager(CASSrvServerWideData& aServerWideData);
       
    44 	void									ConstructL();
       
    45 
       
    46 //
       
    47 public:										// ACCESS
       
    48 //
       
    49 
       
    50 	void									RequestEnvironmentChangesL(MASSrvEnvironmentChangeObserver& aObserver);
       
    51 
       
    52 	void									RequestEnvironmentChangesCancel(MASSrvEnvironmentChangeObserver& aObserver);
       
    53 
       
    54 	/**
       
    55 	 * Return the workdays for the current locale
       
    56 	 */
       
    57 	inline TUint							CachedWorkDays() const { return iCachedWorkDays; }
       
    58 
       
    59 #ifdef _DEBUG
       
    60 	void									SetEnvironmentChangesHandling(TBool aValue) {iEnvChgHandling = aValue;}
       
    61 	TBool									EnvironmentChangeHandling() {return iEnvChgHandling;}
       
    62 #endif
       
    63 	
       
    64 
       
    65 //
       
    66 public:										// INTERNAL
       
    67 //
       
    68 
       
    69 	static TBool							EnvironmentChangeCallBack(TAny* aSelf);
       
    70 
       
    71 //
       
    72 private:									// INTERNAL
       
    73 //
       
    74 
       
    75 	/**
       
    76 	 * Access the server wide data
       
    77 	 */
       
    78 	inline CASSrvServerWideData&			ServerData() const { return iServerWideData; }
       
    79 
       
    80 	/**
       
    81 	 * Return the cached workdays
       
    82 	 */
       
    83 	inline TUint&							CachedWorkDays() { return iCachedWorkDays; }
       
    84 
       
    85 	void									HandleEnvironmentChange();
       
    86 
       
    87 //
       
    88 private:									// MEMBER DATA
       
    89 //
       
    90 
       
    91 	/**
       
    92 	 * The change notifier always reports that everything has changed when it is
       
    93 	 * first initialized. We deliberately ignore this phantom event because it
       
    94 	 * causes problems with alarms which expire immedaitely when the device starts
       
    95 	 * up (they are deleted immediately, when in reality we want them to expire
       
    96 	 * immedately).
       
    97 	 */
       
    98 	TBool									iHaveAbsorbedFirstChange;
       
    99 
       
   100 	/**
       
   101 	 * The server wide data 
       
   102 	 */
       
   103 	CASSrvServerWideData&					iServerWideData;
       
   104 
       
   105 	/**
       
   106 	 * The underlying environment change notifier
       
   107 	 */
       
   108 	CEnvironmentChangeNotifier*				iChangeNotifier;
       
   109 
       
   110 	/**
       
   111 	 * A cached copy of the System-Wide work days
       
   112 	 */
       
   113 	TUint									iCachedWorkDays;
       
   114 
       
   115 	/**
       
   116 	 * Observers who are interested in being informed when
       
   117 	 * an environment change event occurs.
       
   118 	 */
       
   119 	RPointerArray<MASSrvEnvironmentChangeObserver> iObservers;
       
   120 	
       
   121 #ifdef _DEBUG
       
   122 	TBool iEnvChgHandling;
       
   123 #endif
       
   124 	};
       
   125 
       
   126 #endif