2 * Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
19 #if !defined ERROR_UI_H
22 #include <coemain.h> // CCoeEnv
23 #include <textresolver.h>
26 * Utility class to display error notes by applications.
27 * This is the default error display class to be used by
29 * The features of the class are:
30 * - maps given error to error text to be displayed
31 * - displays error note using timed, global note
32 * - does not display error if it is already "on"
33 * - offers a reference to internal TextResolver instance
35 * Usage (typically as instance variable)
36 * iErrorUI = CErrorUI::NewL(); // iCoeEnv can be given as argument, no need to that though
37 * ... some code causing an error ...
38 * if ( err != KErrNone )
39 * iErrorUI->ShowGlobalErrorNoteL(err);
43 class CErrorUI : public CBase
50 * This constructor method should be used by servers, does not put the created object into CleanupStack
52 IMPORT_C static CErrorUI* NewL();
55 * This constructor method should be used by servers, puts the created object into CleanupStack
57 IMPORT_C static CErrorUI* NewLC();
60 * This constructor method should be used by applications, does not put the created object into CleanupStack
61 * @param aEnv Reference to caller's control environment
63 IMPORT_C static CErrorUI* NewL(CCoeEnv& aEnv);
66 * This constructor method should be used by applications, puts the created object into CleanupStack
67 * @param aEnv Reference to caller's control environment
69 IMPORT_C static CErrorUI* NewLC(CCoeEnv& aEnv);
78 * Shows a global error note which is created by
79 * resolving to a display text from the given error code.
80 * The is the default method to be called by applications to
81 * display error messages.
82 * @param aError Any error code, for example ETel error or Email
84 * @param aContext The context of the error, needed in special cases
85 * such as WAP errors, usually (and by default) ECtxAutomatic
86 * @return ETrue if error was displayed, EFalse otherwise.
88 IMPORT_C TBool ShowGlobalErrorNoteL(
90 CTextResolver::TErrorContext aContext = CTextResolver::ECtxAutomatic
94 * Offers a reference to internal TextResolver instance
95 * @return reference to ErrorUI's internal TextResolver instance
97 inline CTextResolver& TextResolver(){ return *iTextResolver; }
100 * Shows a global error query with OK key, which is created by
101 * resolving to a display text from the given error code.
102 * The is the default method to be called by applications to
103 * display error queries.
104 * @param aError Any error code, for example ETel error or Email
106 * @param aContext The context of the error, needed in special cases
107 * such as WAP errors, usually (and by default) ECtxAutomatic
108 * @return ETrue if error was displayed, EFalse otherwise.
110 IMPORT_C TBool ShowGlobalErrorQueryL(
112 CTextResolver::TErrorContext aContext = CTextResolver::ECtxAutomatic
118 static CErrorUI* ConstructLC();
122 // Text resolver used by this module
123 CTextResolver* iTextResolver;