imstutils/imconversationview/imcvuiapp/src/imcvuiappnotemapper.cpp
changeset 0 5e5d6b214f4f
equal deleted inserted replaced
-1:000000000000 0:5e5d6b214f4f
       
     1 /*
       
     2 * Copyright (c) 2008 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:  note mapper class implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "imcvuiappnotemapper.h"
       
    21 
       
    22 #include <StringLoader.h>
       
    23 #include <imcvuiapp.rsg>
       
    24 #include <aknnotedialog.h>
       
    25 #include <AknQueryDialog.h> 
       
    26 #include <aknnotewrappers.h> 
       
    27 // global errors
       
    28 #include<imerrors.hrh>
       
    29 #include "imcvlogger.h"
       
    30 // ---------------------------------------------------------
       
    31 // IMCVUiAppNoteMapper::ShowNoteL
       
    32 // (other items were commented in a header).
       
    33 // ---------------------------------------------------------
       
    34 //
       
    35 void IMCVUiAppNoteMapper::ShowNoteL( const TInt aErrorCode , const TDesC& aAdditionalData )
       
    36 	{
       
    37 	IM_CV_LOGS(TXT("IMCVUiAppNoteMapper::ShowNoteL start") );
       
    38 	TInt resourceId( 0 );
       
    39 	TBool aditionalInfo = EFalse;
       
    40 	
       
    41 	switch( aErrorCode )
       
    42 		{	
       
    43 		case KErrNoMemory:
       
    44 			{
       
    45 			resourceId = R_CHAT_CEDITOR_MEMLO;
       
    46          	break;
       
    47 			}
       
    48 		case KErrDiskFull:
       
    49 			{
       
    50 			resourceId = R_CHAT_CEDITOR_MEMFULL;
       
    51        		break;
       
    52 			}
       
    53              // flowthrough
       
    54         case KImApiErrSenderBlocked :
       
    55 		case KImErrServiceRequestTypeNotSupported: // Service not supported
       
    56 			{
       
    57 			resourceId = R_CHAT_ERROR_SERVICE_ERR;
       
    58            	break;
       
    59 			}
       
    60 		// flowthrough
       
    61 		case KImApiErrRecipientNotLogged: // Message recipient not logged in
       
    62 			{
       
    63 			aditionalInfo = ETrue;
       
    64 			resourceId = R_CHAT_ERROR_NOT_REACH;
       
    65 			break;
       
    66 			}
       
    67 			// flowthrough
       
    68 		case KImErrServiceForceClosedSession: // force logged out
       
    69 			{
       
    70 			resourceId = R_CHAT_ERROR_DISCONNECT_ERROR;
       
    71 			break;
       
    72 			}		
       
    73 		
       
    74 		case KErrNone:
       
    75 			{
       
    76 			resourceId = 0;
       
    77 			break;	
       
    78 			}
       
    79         case KImErrServiceGeneralError:   // flowthrough
       
    80 		default: // Unknown error -> show general note
       
    81 			{
       
    82 		   	resourceId = R_CHAT_ERROR_GEN_ERROR;
       
    83 			break;
       
    84 			}
       
    85 		}
       
    86 
       
    87 	if( resourceId != 0 )
       
    88 		{
       
    89 		HBufC* prompt = NULL;
       
    90 		
       
    91 		if( aditionalInfo && aAdditionalData != KNullDesC )
       
    92 			{
       
    93 			prompt = StringLoader::LoadLC( resourceId, aAdditionalData );	
       
    94 			}
       
    95 		else
       
    96 			{
       
    97 			prompt = StringLoader::LoadLC( resourceId );	
       
    98 			}
       
    99 		
       
   100 		CAknErrorNote* errorNote = new (ELeave) CAknErrorNote;
       
   101 		errorNote->ExecuteLD(*prompt);
       
   102 		 
       
   103 		CleanupStack::PopAndDestroy( prompt );   
       
   104 
       
   105 		}
       
   106 	IM_CV_LOGS(TXT("IMCVUiAppNoteMapper::ShowNoteL End") );	
       
   107 	}
       
   108 
       
   109 // ---------------------------------------------------------
       
   110 // IMCVUiAppNoteMapper::DisplayQueryDialogL
       
   111 // (other items were commented in a header).
       
   112 // ---------------------------------------------------------
       
   113 //
       
   114 TInt IMCVUiAppNoteMapper::DisplayQueryDialogL( TInt aDialogResourceId, 
       
   115             const TDesC& aPrompt )
       
   116 	{
       
   117 	CAknQueryDialog* dlg = new (ELeave) CAknQueryDialog(
       
   118 											CAknQueryDialog::ENoTone );
       
   119 	if( aPrompt != KNullDesC )
       
   120 		{
       
   121 		CleanupStack::PushL( dlg );
       
   122 		dlg->SetPromptL( aPrompt );
       
   123 		CleanupStack::Pop( dlg );
       
   124 		}
       
   125 	
       
   126 	return dlg->ExecuteLD( aDialogResourceId );
       
   127 	}	
       
   128 	
       
   129 //  End of File