epoc32/include/fepbconfig.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
     1.1 --- a/epoc32/include/fepbconfig.h	Tue Nov 24 13:55:44 2009 +0000
     1.2 +++ b/epoc32/include/fepbconfig.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -1,1 +1,226 @@
     1.4 -fepbconfig.h
     1.5 +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +// All rights reserved.
     1.7 +// This component and the accompanying materials are made available
     1.8 +// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     1.9 +// which accompanies this distribution, and is available
    1.10 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.11 +//
    1.12 +// Initial Contributors:
    1.13 +// Nokia Corporation - initial contribution.
    1.14 +//
    1.15 +// Contributors:
    1.16 +//
    1.17 +// Description:
    1.18 +//
    1.19 +
    1.20 +#ifndef __FEPBCONFIG_H__
    1.21 +#define __FEPBCONFIG_H__
    1.22 +
    1.23 +#include <e32base.h>
    1.24 +#include <coemain.h>	// class CCoeEnv
    1.25 +
    1.26 +class CRepository;
    1.27 +
    1.28 +/** Specifies the maximum size of a FEP attribute in bytes.
    1.29 +
    1.30 +@publishedAll
    1.31 +@released */
    1.32 +const TInt KCoeFepMaxAttribDataSize = 200;
    1.33 +
    1.34 +
    1.35 +/** On or off key data for FEPs. 
    1.36 +
    1.37 +The CCoeFep class uses instances of this class to specify the key combination which 
    1.38 +is used to turn the FEP on and off. These values are initialised during construction 
    1.39 +of the FEP (see CCoeFep::BaseConstructL()).
    1.40 +
    1.41 +The class consists of three TUints. They represent: 
    1.42 +
    1.43 +- the character code of the key combination
    1.44 +
    1.45 +- a modifier mask which indicates which modifiers are relevant to the key combination
    1.46 +
    1.47 +- the modifier values which indicate which of the modifiers specified in the 
    1.48 +modifier mask must be on and which must be off
    1.49 +
    1.50 +For example, if the key combination to turn the FEP off is Fn+Enter, where 
    1.51 +the Shift modifier must not be down (and the state of all other modifiers 
    1.52 +is irrelevant), the TFepOnOrOffKeyData object would be constructed as follows:
    1.53 +
    1.54 +@code
    1.55 +TFepOnOrOffKeyData(EKeyEnter, EModifierFunc|EModifierShift, EModifierFunc) 
    1.56 +@endcode
    1.57 +
    1.58 +Note that modifiers should not be set in the values if they are not also set 
    1.59 +in the mask. 
    1.60 +
    1.61 +@publishedAll 
    1.62 +@released */
    1.63 +class TFepOnOrOffKeyData
    1.64 +	{
    1.65 +public:
    1.66 +	inline TFepOnOrOffKeyData(TUint aCharacterCodeForFoldedMatch, TUint aModifierMask, TUint aModifierValues) :iCharacterCodeForFoldedMatch(aCharacterCodeForFoldedMatch), iModifierMask(aModifierMask), iModifierValues(aModifierValues) 
    1.67 +	/** The C++ constructor is used to construct the key data object with the character 
    1.68 +	code, the modifier mask and the modifier values.
    1.69 +	
    1.70 +	@param aCharacterCodeForFoldedMatch The character code.
    1.71 +	@param aModifierMask The modifier mask.
    1.72 +	@param aModifierValues The modifier values. */
    1.73 +		{}
    1.74 +
    1.75 +	inline TUint CharacterCodeForFoldedMatch() const 
    1.76 +	/** Gets the character code.
    1.77 +	
    1.78 +	@return The character code. */
    1.79 +		{return iCharacterCodeForFoldedMatch;}
    1.80 +	inline TUint ModifierMask() const 
    1.81 +	/** Gets the modifier mask.
    1.82 +	
    1.83 +	@return The modifier mask. */
    1.84 +		{return iModifierMask;}
    1.85 +	inline TUint ModifierValues() const 
    1.86 +	/** Gets the modifier values.
    1.87 +	
    1.88 +	@return The modifier values. */
    1.89 +		{return iModifierValues;}
    1.90 +	/**
    1.91 +	Checks if 2 TFepOnOrOffKeyData objects have the same values.
    1.92 +
    1.93 +	returns Etrue if the 2 objects have the same values, EFalse otherwise
    1.94 +	*/
    1.95 +	IMPORT_C TBool operator==(const TFepOnOrOffKeyData& aAnother) const;
    1.96 +	
    1.97 +	
    1.98 +	/**
    1.99 +	Checks if 2 TFepOnOrOffKeyData objects do not have the the same values.
   1.100 +	
   1.101 +	returns Etrue if the 2 objects have the same values, EFalse otherwise
   1.102 +	*/
   1.103 +	IMPORT_C TBool operator!=(const TFepOnOrOffKeyData& aAnother) const;
   1.104 +private:
   1.105 +	TUint iCharacterCodeForFoldedMatch;
   1.106 +	TUint iModifierMask;
   1.107 +	TUint iModifierValues;
   1.108 +	};
   1.109 +
   1.110 +class CDictionaryStore;
   1.111 +class RWriteStream;
   1.112 +class RReadStream;
   1.113 +
   1.114 +
   1.115 +/** Reads and writes generic FEP settings.
   1.116 +
   1.117 +Used by the CCoeFep class. The generic FEP settings are whether the FEP is 
   1.118 +on or off and what key combinations should turn the FEP on or off. Also used 
   1.119 +to synchronise these settings across all running instances of the FEP. These 
   1.120 +settings are generic, unlike FEP attributes which are FEP-specific. FEP attributes 
   1.121 +are stored, restored and synchronised using class MFepAttributeStorer. Generic 
   1.122 +FEP settings are changed locally using the Set...() member functions. Then, 
   1.123 +to store these as the system settings and to apply them globally, call StoreChangesAndBroadcastL().
   1.124 +
   1.125 +Class CCoeFep initialises its generic FEP settings from the global system 
   1.126 +settings during construction. Its generic FEP settings are updated when the 
   1.127 +settings are changed by a call to StoreChangesAndBroadcastL() by another running 
   1.128 +instance of the FEP. 
   1.129 +
   1.130 +@publishedAll
   1.131 +@released */
   1.132 +class CFepGenericGlobalSettings : public CBase
   1.133 +	{
   1.134 +public:
   1.135 +	IMPORT_C static CFepGenericGlobalSettings* NewL(CCoeEnv& aConeEnvironment, const TFepOnOrOffKeyData& aDefaultOnKeyData, const TFepOnOrOffKeyData& aDefaultOffKeyData, TBool aDefaultIsOn);
   1.136 +	IMPORT_C static CFepGenericGlobalSettings* NewLC(CCoeEnv& aConeEnvironment, const TFepOnOrOffKeyData& aDefaultOnKeyData, const TFepOnOrOffKeyData& aDefaultOffKeyData, TBool aDefaultIsOn);
   1.137 +	IMPORT_C static CFepGenericGlobalSettings* NewL();
   1.138 +	IMPORT_C static CFepGenericGlobalSettings* NewLC();
   1.139 +	IMPORT_C TFepOnOrOffKeyData OnKeyData() const;
   1.140 +	IMPORT_C void SetOnKeyData(const TFepOnOrOffKeyData& aOnKeyData);
   1.141 +	IMPORT_C TFepOnOrOffKeyData OffKeyData() const;
   1.142 +	IMPORT_C void SetOffKeyData(const TFepOnOrOffKeyData& aOffKeyData);
   1.143 +	IMPORT_C TBool IsOn() const;
   1.144 +	IMPORT_C void SetIsOn(TBool aIsOn);
   1.145 +	IMPORT_C void StoreChangesAndBroadcastL();
   1.146 +	IMPORT_C void RefreshL();
   1.147 +public: // not for external use
   1.148 +	IMPORT_C static void ReadOnState(CRepository& aRepository, TBool& aOnState, TInt* aError=NULL);
   1.149 +	IMPORT_C static void ReadOnOrOffKeyData(CRepository& aRepository, TFepOnOrOffKeyData& aOnOrOffKeyData, TUint32 aRepositoryKeyMask_OnOrOff, TInt* aError=NULL);
   1.150 +	IMPORT_C static void WriteOnStateAndBroadcastL(CRepository& aRepository, TBool aOnState, TUint32 aRepositoryKeyMask_DefaultOrDynamic);
   1.151 +	IMPORT_C static void WriteOnOrOffKeyDataAndBroadcastL(CRepository& aRepository, const TFepOnOrOffKeyData& aOnOrOffKeyData, TUint32 aRepositoryKey);
   1.152 +private:
   1.153 +	CFepGenericGlobalSettings();
   1.154 +	void ConstructL();
   1.155 +private:
   1.156 +	enum
   1.157 +		{
   1.158 +		EFlagIsOn				=0x00000001,
   1.159 +		// the EFlagStoreXxx flags below indicate whether this object has had any SetXxx functions called on it, which can be used to optimize what work StoreChangesAndBroadcastL has to do
   1.160 +		EFlagStoreIsOn			=0x00000002,
   1.161 +		EFlagStoreOnKeyData		=0x00000004,
   1.162 +		EFlagStoreOffKeyData	=0x00000008
   1.163 +		};
   1.164 +private:
   1.165 +	TUint iFlags;
   1.166 +	TFepOnOrOffKeyData iOnKeyData;
   1.167 +	TFepOnOrOffKeyData iOffKeyData;
   1.168 +	};
   1.169 +
   1.170 +
   1.171 +/** Protocol for storing, restoring and synchronising FEP attributes. 
   1.172 +
   1.173 +An abstract base class for CCoeFep, so FEPs must implement the pure virtual 
   1.174 +functions declared in this class.
   1.175 +
   1.176 +Rather than using a single device-wide instance of a FEP, each application 
   1.177 +has its own instance of the FEP. MFepAttributeStorer provides a framework 
   1.178 +for synchronising FEP attributes across each running instance of the same 
   1.179 +FEP. For this to happen, the FEP must implement MFepAttributeStorer::WriteAttributeDataToStreamL() 
   1.180 +and MFepAttributeStorer::ReadAttributeDataFromStreamL().
   1.181 +
   1.182 +Attributes are FEP-specific, and are identified by a UID which can be accessed 
   1.183 +using AttributeAtIndex(). An example of a FEP attribute might be whether inline 
   1.184 +editing is enabled or disabled. 
   1.185 +
   1.186 +@publishedAll 
   1.187 +@released */
   1.188 +class MFepAttributeStorer
   1.189 +	{
   1.190 +public:
   1.191 +	IMPORT_C void ReadAllAttributesL(CCoeEnv& aConeEnvironment);
   1.192 +	IMPORT_C void WriteAttributeDataAndBroadcastL(CCoeEnv& aConeEnvironment, TUid aAttributeUid);
   1.193 +	IMPORT_C void WriteAttributeDataAndBroadcastL(CCoeEnv& aConeEnvironment, const TArray<TUid>& aAttributeUids);
   1.194 +	/** Returns the total number of FEP attributes.
   1.195 +	
   1.196 +	@return The number of FEP attributes. */
   1.197 +	virtual TInt NumberOfAttributes() const=0;
   1.198 +	/** Returns the UID of the FEP attribute at the index specified.
   1.199 +	
   1.200 +	@param aIndex An array index.
   1.201 +	@return The UID of the FEP attribute at aIndex. */
   1.202 +	virtual TUid AttributeAtIndex(TInt aIndex) const=0;
   1.203 +	/** Writes the value of the attribute specified to the specified write stream.
   1.204 +	
   1.205 +	Called by MFepAttributeStorer::WriteAttributeDataAndBroadcastL() for each 
   1.206 +	attribute passed to it.
   1.207 +	
   1.208 +	@param aAttributeUid UID of the attribute to write to the stream.
   1.209 +	@param aStream The stream to which to write the attribute. */
   1.210 +	virtual void WriteAttributeDataToStreamL(TUid aAttributeUid, RWriteStream& aStream) const=0;
   1.211 +	/** Reads the value of the attribute identified by the UID specified in aAttributeUid 
   1.212 +	from the specified read stream.
   1.213 +	
   1.214 +	You should take appropriate action if the attribute has changed, e.g. 
   1.215 +	if inline editing has been disabled, you might cancel the current transaction.
   1.216 +	
   1.217 +	This function is called by MFepAttributeStorer::ReadAllAttributesL() for all 
   1.218 +	attributes. It is also called when the FEP receives a message that an attribute 
   1.219 +	has been changed by another running instance of the FEP (using WriteAttributeDataAndBroadcastL()).
   1.220 +	
   1.221 +	@param aAttributeUid Identifies the attribute whose value should be read.
   1.222 +	@param aStream Read stream from which to read the attribute's value. */
   1.223 +	virtual void ReadAttributeDataFromStreamL(TUid aAttributeUid, RReadStream& aStream)=0;
   1.224 +private:
   1.225 +	IMPORT_C virtual void MFepAttributeStorer_Reserved_1();
   1.226 +	IMPORT_C virtual void MFepAttributeStorer_Reserved_2();
   1.227 +	TInt NumberOfOccurrencesOfAttributeUid(TUid aAttributeUid) const;
   1.228 +	};
   1.229 +
   1.230 +#endif	// __FEPBCONFIG_H__