1 errorui.h |
1 /* |
|
2 * Copyright (c) 2002-2005 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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #if !defined ERROR_UI_H |
|
20 #define ERROR_UI_H |
|
21 |
|
22 #include <coemain.h> // CCoeEnv |
|
23 #include <textresolver.h> |
|
24 |
|
25 /** |
|
26 * Utility class to display error notes by applications. |
|
27 * This is the default error display class to be used by |
|
28 * applications. |
|
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 |
|
34 * |
|
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); |
|
40 * |
|
41 */ |
|
42 |
|
43 class CErrorUI : public CBase |
|
44 { |
|
45 public: |
|
46 |
|
47 public: |
|
48 |
|
49 /** |
|
50 * This constructor method should be used by servers, does not put the created object into CleanupStack |
|
51 */ |
|
52 IMPORT_C static CErrorUI* NewL(); |
|
53 |
|
54 /** |
|
55 * This constructor method should be used by servers, puts the created object into CleanupStack |
|
56 */ |
|
57 IMPORT_C static CErrorUI* NewLC(); |
|
58 |
|
59 /** |
|
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 |
|
62 */ |
|
63 IMPORT_C static CErrorUI* NewL(CCoeEnv& aEnv); |
|
64 |
|
65 /** |
|
66 * This constructor method should be used by applications, puts the created object into CleanupStack |
|
67 * @param aEnv Reference to caller's control environment |
|
68 */ |
|
69 IMPORT_C static CErrorUI* NewLC(CCoeEnv& aEnv); |
|
70 |
|
71 |
|
72 /** |
|
73 * Destructor |
|
74 */ |
|
75 IMPORT_C ~CErrorUI(); |
|
76 |
|
77 /** |
|
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 |
|
83 * error. |
|
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. |
|
87 */ |
|
88 IMPORT_C TBool ShowGlobalErrorNoteL( |
|
89 TInt aError, |
|
90 CTextResolver::TErrorContext aContext = CTextResolver::ECtxAutomatic |
|
91 ); |
|
92 |
|
93 /** |
|
94 * Offers a reference to internal TextResolver instance |
|
95 * @return reference to ErrorUI's internal TextResolver instance |
|
96 */ |
|
97 inline CTextResolver& TextResolver(){ return *iTextResolver; } |
|
98 |
|
99 /** |
|
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 |
|
105 * error. |
|
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. |
|
109 */ |
|
110 IMPORT_C TBool ShowGlobalErrorQueryL( |
|
111 TInt aError, |
|
112 CTextResolver::TErrorContext aContext = CTextResolver::ECtxAutomatic |
|
113 ); |
|
114 |
|
115 private: |
|
116 |
|
117 void ConstructL(); |
|
118 static CErrorUI* ConstructLC(); |
|
119 |
|
120 private: |
|
121 |
|
122 // Text resolver used by this module |
|
123 CTextResolver* iTextResolver; |
|
124 }; |
|
125 |
|
126 #endif // ERROR_UI_H |
|
127 |
|
128 // End of File |