commonui/inc/glxerrorposter.h
changeset 23 74c9f037fd5d
equal deleted inserted replaced
5:f7f0874bfe7d 23:74c9f037fd5d
       
     1 /*
       
     2 * Copyright (c) 2008-2009 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 "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".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:   Singleton that posts errors to the framework
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef GLXERRORPOSTER_H_
       
    21 #define GLXERRORPOSTER_H_
       
    22 
       
    23 #include <e32base.h>
       
    24 
       
    25 /**
       
    26  * CGlxErrorPoster
       
    27  * Posts errors to the framework.
       
    28  * (Causes a Leave() to occur from a RunL())
       
    29  *
       
    30  * @author Alex Birkett
       
    31  */
       
    32 NONSHARABLE_CLASS(CGlxErrorPoster) : public CActive
       
    33     {
       
    34 public:
       
    35     /**
       
    36      * Provides instance of error poster and increments ref count
       
    37      */
       
    38     IMPORT_C static CGlxErrorPoster* InstanceL();
       
    39 
       
    40     /**
       
    41      * Removes instance of error poster and decrements ref count
       
    42      */
       
    43     IMPORT_C void Close();
       
    44 
       
    45     /**
       
    46      * Post an error
       
    47      * The error is stored in a member variable and providing the
       
    48      * active object is not already active, a call back to RunL()
       
    49      * is requested. When called by the active scheduler RunL()
       
    50      * leaves with the error code stored in the member variable. 
       
    51      * This causes a dialog displaying an error note to be invoked
       
    52      * by the framework.
       
    53      *
       
    54      * @param aError Error to post
       
    55      */
       
    56     IMPORT_C void PostError(TInt aError);
       
    57 
       
    58 public: // from CActive
       
    59     /** See @ref CActive::RunL */
       
    60     void RunL();
       
    61 
       
    62     /** See @ref CActive::DoCancel */
       
    63     void DoCancel();
       
    64 
       
    65 private:
       
    66     /**
       
    67      * Two phase constructor
       
    68      */
       
    69     static CGlxErrorPoster* NewL();
       
    70 
       
    71     /**
       
    72      * Constructor
       
    73      */
       
    74     CGlxErrorPoster();
       
    75 
       
    76     /**
       
    77      * Destructor
       
    78      */
       
    79   	~CGlxErrorPoster();
       
    80 
       
    81     /**
       
    82      * 2nd phase constructor
       
    83      */
       
    84     void ConstructL();
       
    85 
       
    86 private:
       
    87     /**
       
    88      * latest error
       
    89      */
       
    90     TInt iLatestError;
       
    91     };
       
    92 
       
    93 #endif /*GLXERRORPOSTER_H_*/