epoc32/include/mw/errorui.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
williamr@2
     1
/*
williamr@2
     2
* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     3
* All rights reserved.
williamr@2
     4
* This component and the accompanying materials are made available
williamr@4
     5
* under the terms of "Eclipse Public License v1.0"
williamr@2
     6
* which accompanies this distribution, and is available
williamr@4
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
williamr@2
     8
*
williamr@2
     9
* Initial Contributors:
williamr@2
    10
* Nokia Corporation - initial contribution.
williamr@2
    11
*
williamr@2
    12
* Contributors:
williamr@2
    13
*
williamr@2
    14
* Description:    
williamr@2
    15
*
williamr@2
    16
*/
williamr@2
    17
williamr@2
    18
williamr@2
    19
#if !defined ERROR_UI_H
williamr@2
    20
#define ERROR_UI_H
williamr@2
    21
williamr@2
    22
#include <coemain.h>    //  CCoeEnv
williamr@2
    23
#include <textresolver.h>
williamr@2
    24
williamr@2
    25
/**
williamr@2
    26
* Utility class to display error notes by applications.
williamr@2
    27
* This is the default error display class to be used by
williamr@2
    28
* applications.
williamr@2
    29
* The features of the class are:
williamr@2
    30
*   - maps given error to error text to be displayed
williamr@2
    31
*   - displays error note using timed, global note
williamr@2
    32
*   - does not display error if it is already "on"
williamr@2
    33
*   - offers a reference to internal TextResolver instance
williamr@2
    34
*
williamr@2
    35
* Usage (typically as instance variable)
williamr@2
    36
*   iErrorUI = CErrorUI::NewL(); // iCoeEnv can be given as argument, no need to that though 
williamr@2
    37
*   ... some code causing an error  ...
williamr@2
    38
*   if ( err != KErrNone )
williamr@2
    39
*       iErrorUI->ShowGlobalErrorNoteL(err);
williamr@2
    40
*
williamr@2
    41
*/
williamr@2
    42
williamr@2
    43
class CErrorUI : public CBase
williamr@2
    44
{
williamr@2
    45
public:
williamr@2
    46
williamr@2
    47
public:
williamr@2
    48
    
williamr@2
    49
    /**
williamr@2
    50
     * This constructor method should be used by servers, does not put the created object into CleanupStack
williamr@2
    51
     */
williamr@2
    52
    IMPORT_C static CErrorUI* NewL();
williamr@2
    53
    
williamr@2
    54
    /**
williamr@2
    55
     * This constructor method should be used by servers, puts the created object into CleanupStack
williamr@2
    56
     */
williamr@2
    57
    IMPORT_C static CErrorUI* NewLC();
williamr@2
    58
williamr@2
    59
    /**
williamr@2
    60
     * This constructor method should be used by applications, does not put the created object into CleanupStack
williamr@2
    61
     * @param aEnv Reference to caller's control environment    
williamr@2
    62
     */
williamr@2
    63
    IMPORT_C static CErrorUI* NewL(CCoeEnv& aEnv);
williamr@2
    64
    
williamr@2
    65
    /**
williamr@2
    66
     * This constructor method should be used by applications, puts the created object into CleanupStack
williamr@2
    67
     * @param aEnv Reference to caller's control environment
williamr@2
    68
     */
williamr@2
    69
    IMPORT_C static CErrorUI* NewLC(CCoeEnv& aEnv);
williamr@2
    70
williamr@2
    71
    
williamr@2
    72
    /** 
williamr@2
    73
     * Destructor 
williamr@2
    74
     */
williamr@2
    75
    IMPORT_C ~CErrorUI();
williamr@2
    76
williamr@2
    77
    /**
williamr@2
    78
     * Shows a global error note which is created by
williamr@2
    79
     * resolving to a display text from the given error code.
williamr@2
    80
     * The is the default method to be called by applications to
williamr@2
    81
     * display error messages.     
williamr@2
    82
     * @param aError    Any error code, for example ETel error or Email
williamr@2
    83
     *                  error.
williamr@2
    84
     * @param aContext  The context of the error, needed in special cases 
williamr@2
    85
     *                  such as WAP errors, usually (and by default) ECtxAutomatic 
williamr@2
    86
     * @return ETrue if error was displayed, EFalse otherwise.
williamr@2
    87
     */
williamr@2
    88
    IMPORT_C TBool ShowGlobalErrorNoteL(
williamr@2
    89
         TInt aError,
williamr@2
    90
         CTextResolver::TErrorContext aContext = CTextResolver::ECtxAutomatic
williamr@2
    91
         );
williamr@2
    92
williamr@2
    93
    /**
williamr@2
    94
     * Offers a reference to internal TextResolver instance
williamr@2
    95
     * @return reference to ErrorUI's internal TextResolver instance   
williamr@2
    96
     */
williamr@2
    97
    inline CTextResolver& TextResolver(){ return *iTextResolver; } 
williamr@2
    98
williamr@2
    99
    /**
williamr@2
   100
     * Shows a global error query with OK key, which is created by
williamr@2
   101
     * resolving to a display text from the given error code.
williamr@2
   102
     * The is the default method to be called by applications to
williamr@2
   103
     * display error queries.
williamr@2
   104
     * @param aError    Any error code, for example ETel error or Email
williamr@2
   105
     *                  error.
williamr@2
   106
     * @param aContext  The context of the error, needed in special cases 
williamr@2
   107
     *                  such as WAP errors, usually (and by default) ECtxAutomatic 
williamr@2
   108
     * @return ETrue if error was displayed, EFalse otherwise.
williamr@2
   109
     */
williamr@2
   110
    IMPORT_C TBool ShowGlobalErrorQueryL(
williamr@2
   111
         TInt aError,
williamr@2
   112
         CTextResolver::TErrorContext aContext = CTextResolver::ECtxAutomatic
williamr@2
   113
         );
williamr@2
   114
williamr@2
   115
private:
williamr@2
   116
    
williamr@2
   117
    void ConstructL();
williamr@2
   118
    static CErrorUI* ConstructLC(); 
williamr@2
   119
williamr@2
   120
private:
williamr@2
   121
williamr@2
   122
    // Text resolver used by this module
williamr@2
   123
    CTextResolver*  iTextResolver;    
williamr@2
   124
};
williamr@2
   125
williamr@2
   126
#endif      // ERROR_UI_H  
williamr@2
   127
            
williamr@2
   128
// End of File