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