Join Now
Quality Rating:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)
Expertise Level:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)

This page was last modified 09:50, 20 May 2008.

CS000965 - Using class CErrorUI to display error notes

From Forum Nokia Wiki


ID CS000965 Creation date May 20, 2008
Platform S60 3rd Edition, FP1 Tested on devices Nokia N93
Category Symbian C++ Subcategory Files/Data


Keywords (APIs, classes, methods, functions): CErrorUI, CErrorUI::NewL(), CErrorUI::ShowGlobalErrorNoteL(), CErrorUI::ShowGlobalErrorQueryL(), CErrorUI::TextResolver()

Overview

This code snippet shows how the class CErrorUi is used to display error notes ("context : error text"). The context of the error can be the application or the subsystem where the error has occurred. The caller can self-define the context or it is automatically selected. The class CErrorUi maps the given error to the error text to be displayed and contains a reference to the internal CTextResolver instance.

  • ShowGlobalErrorNoteL() shows a global error note
  • ShowGlobalErrorQueryL() shows a global error query with the OK key
  • TextResolver() offers a reference to the internal TextResolver instance


Note: In the target device the ErrRd file is required to enable error notes. The correct location for the ErrRd file is in the c:\resource directory. The Wiki page TSS000254 - How can I get extended information in error messages? shows how to create a SIS file to install the ErrRd file.

This snippet can be self-signed.

MMP file

The following libraries are required:

LIBRARY  commonui.lib


Header file

#ifndef __TESTERAPPUI_H__
#define __TESTERAPPUI_H__
 
// INCLUDES
#include <aknappui.h>
 
// FORWARD DECLARATIONS
class CErrorUI;
 
 
class CTesterAppView : public CCoeControl
    {
private:
  // Functions from base classes
  void HandleCommandL(TInt aCommand);
//...  
  void DoHandleCommandL(TInt aCommand);    
 //... 
private:    
    CErrorUI* iErrorUi;
    };
 
#endif // __TESTERAPPUI_H__

Source file

#include <errorui.h>
 
void CTesterAppUi::ConstructL()
  {
  //...  
   iErrorUi = CErrorUI::NewL();    
  }
  
CTesterAppUi::~CTesterAppUi()
  {
  //...
  delete iErrorUi;
  }
  
void CTesterAppUi::HandleCommandL(TInt aCommand)
  {  
  switch (aCommand)
    {
    case EEikCmdExit:
    case EAknSoftkeyExit:
      Exit();
      break;
      
    case ECommand1:
      {      
       TRAPD( errNote, DoHandleCommandL( aCommand ) );
       if ( errNote )
         {
         iErrorUi->ShowGlobalErrorNoteL( errNote );
         
         TPtrC errorMessage( iErrorUi->TextResolver().ResolveErrorString( errNote ) );
         // do something with the error message...   
         }
       else
          {
          // KErrNone, do something....
          }   
      }
      break;
  
    case ECommand2:
      {  
      TRAPD( errQuery, DoHandleCommandL( aCommand ) );
      if ( errQuery )
        {
        iErrorUi->ShowGlobalErrorQueryL( errQuery );
        
        TPtrC errorMessage( iErrorUi->TextResolver().ResolveErrorString( errQuery ) );
        // do something with the error message...
        } 
      else
        {
        // KErrNone, do something....
        }   
      }
      break;
      
    default:
      Panic(ETesterUi);
      break;
    }
  }
 
void CTesterAppUi::DoHandleCommandL(TInt aCommand)
  {
  //Do Something that might leave...
  User::Leave(KErrNotSupported );    
  }


Postconditions

The class CErrorUi shows a global error note or a global error query when the method called by the user leaves.

See also

CS000966 - Using class CTextResolver to resolve error texts

TSS000254 - How can I get extended information in error messages?

Related Discussions
Thread Thread Starter Forum Replies Last Post
How to match the EKeyOk = EAknSoftkeyOptions sriramadasu General Symbian C++ 4 2006-12-04 10:19
OMA DM Test Server source code rickmorris OMA DM/DS/CP 2 2007-12-07 20:34
printing debug messages vardhman General Symbian C++ 1 2004-10-29 07:46
Multiple Alerts jinesh_l Mobile Java General 5 2005-11-29 08:55
setCurrent(dynamic name) artemg Mobile Java General 4 2004-03-04 15:39
 
Powered by MediaWiki
     
     RDF Facets:
     
     
     qfnZtypeQUqfnTypeZCommunityContentQ
     qfnZtypeQUqfnTypeZWebpageQ
     qfnZtypeQUqfnTypeZWikiContentQ
     qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX