williamr@2: /* williamr@2: * Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). williamr@2: * All rights reserved. williamr@2: * This component and the accompanying materials are made available williamr@2: * 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 williamr@2: * which accompanies this distribution, and is available williamr@2: * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". williamr@2: * williamr@2: * Initial Contributors: williamr@2: * Nokia Corporation - initial contribution. williamr@2: * williamr@2: * Contributors: williamr@2: * williamr@2: * Description: williamr@2: * williamr@2: */ williamr@2: williamr@2: williamr@2: #if !defined ERROR_UI_H williamr@2: #define ERROR_UI_H williamr@2: williamr@2: #include // CCoeEnv williamr@2: #include williamr@2: williamr@2: /** williamr@2: * Utility class to display error notes by applications. williamr@2: * This is the default error display class to be used by williamr@2: * applications. williamr@2: * The features of the class are: williamr@2: * - maps given error to error text to be displayed williamr@2: * - displays error note using timed, global note williamr@2: * - does not display error if it is already "on" williamr@2: * - offers a reference to internal TextResolver instance williamr@2: * williamr@2: * Usage (typically as instance variable) williamr@2: * iErrorUI = CErrorUI::NewL(); // iCoeEnv can be given as argument, no need to that though williamr@2: * ... some code causing an error ... williamr@2: * if ( err != KErrNone ) williamr@2: * iErrorUI->ShowGlobalErrorNoteL(err); williamr@2: * williamr@2: */ williamr@2: williamr@2: class CErrorUI : public CBase williamr@2: { williamr@2: public: williamr@2: williamr@2: public: williamr@2: williamr@2: /** williamr@2: * This constructor method should be used by servers, does not put the created object into CleanupStack williamr@2: */ williamr@2: IMPORT_C static CErrorUI* NewL(); williamr@2: williamr@2: /** williamr@2: * This constructor method should be used by servers, puts the created object into CleanupStack williamr@2: */ williamr@2: IMPORT_C static CErrorUI* NewLC(); williamr@2: williamr@2: /** williamr@2: * This constructor method should be used by applications, does not put the created object into CleanupStack williamr@2: * @param aEnv Reference to caller's control environment williamr@2: */ williamr@2: IMPORT_C static CErrorUI* NewL(CCoeEnv& aEnv); williamr@2: williamr@2: /** williamr@2: * This constructor method should be used by applications, puts the created object into CleanupStack williamr@2: * @param aEnv Reference to caller's control environment williamr@2: */ williamr@2: IMPORT_C static CErrorUI* NewLC(CCoeEnv& aEnv); williamr@2: williamr@2: williamr@2: /** williamr@2: * Destructor williamr@2: */ williamr@2: IMPORT_C ~CErrorUI(); williamr@2: williamr@2: /** williamr@2: * Shows a global error note which is created by williamr@2: * resolving to a display text from the given error code. williamr@2: * The is the default method to be called by applications to williamr@2: * display error messages. williamr@2: * @param aError Any error code, for example ETel error or Email williamr@2: * error. williamr@2: * @param aContext The context of the error, needed in special cases williamr@2: * such as WAP errors, usually (and by default) ECtxAutomatic williamr@2: * @return ETrue if error was displayed, EFalse otherwise. williamr@2: */ williamr@2: IMPORT_C TBool ShowGlobalErrorNoteL( williamr@2: TInt aError, williamr@2: CTextResolver::TErrorContext aContext = CTextResolver::ECtxAutomatic williamr@2: ); williamr@2: williamr@2: /** williamr@2: * Offers a reference to internal TextResolver instance williamr@2: * @return reference to ErrorUI's internal TextResolver instance williamr@2: */ williamr@2: inline CTextResolver& TextResolver(){ return *iTextResolver; } williamr@2: williamr@2: /** williamr@2: * Shows a global error query with OK key, which is created by williamr@2: * resolving to a display text from the given error code. williamr@2: * The is the default method to be called by applications to williamr@2: * display error queries. williamr@2: * @param aError Any error code, for example ETel error or Email williamr@2: * error. williamr@2: * @param aContext The context of the error, needed in special cases williamr@2: * such as WAP errors, usually (and by default) ECtxAutomatic williamr@2: * @return ETrue if error was displayed, EFalse otherwise. williamr@2: */ williamr@2: IMPORT_C TBool ShowGlobalErrorQueryL( williamr@2: TInt aError, williamr@2: CTextResolver::TErrorContext aContext = CTextResolver::ECtxAutomatic williamr@2: ); williamr@2: williamr@2: private: williamr@2: williamr@2: void ConstructL(); williamr@2: static CErrorUI* ConstructLC(); williamr@2: williamr@2: private: williamr@2: williamr@2: // Text resolver used by this module williamr@2: CTextResolver* iTextResolver; williamr@2: }; williamr@2: williamr@2: #endif // ERROR_UI_H williamr@2: williamr@2: // End of File