uiservicetab/vimpstutils/src/vimpstutilsnotemapper.cpp
changeset 0 5e5d6b214f4f
child 9 9fdee5e1da30
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:  Utils for IMUiServiceTab modules.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "vimpstutilsnotemapper.h"
       
    21 #include "vimpstutilsdialog.h"
       
    22 #include "vimpstallerrors.h"
       
    23 #include <vimpstuires.rsg>
       
    24 #include <StringLoader.h>
       
    25 #include <eikenv.h>
       
    26 
       
    27 
       
    28 
       
    29 // ---------------------------------------------------------
       
    30 // VIMPSTUtilsNoteMapper::ShowNoteL
       
    31 // (other items were commented in a header).
       
    32 // ---------------------------------------------------------
       
    33 //
       
    34 EXPORT_C void VIMPSTUtilsNoteMapper::ShowNoteL( const TInt aErrorCode, const TDesC& aAdditionalData )
       
    35 	{
       
    36 	TBool ignoreAdditionalData( EFalse ); // Some logical strings are without parameters...
       
    37 	TBool errorNote( ETrue );
       
    38 	TBool defaultNote( EFalse );
       
    39 	TInt resourceID( 0 );
       
    40 	TBool confirmationNote( EFalse );
       
    41 	TBool softkeyOk( EFalse );
       
    42 
       
    43   	switch( aErrorCode )
       
    44 		{	
       
    45 		case EVIMPSTWrongUserIdPassword:// Invalid password or userid
       
    46 			{
       
    47 			defaultNote = ETrue;
       
    48 			errorNote = ETrue;
       
    49 			resourceID = R_IM_LOGIN_PASSER_NOTE;
       
    50             ignoreAdditionalData = ETrue;
       
    51 			break;
       
    52 			}
       
    53 		case EVIMPSTSessionExpired:
       
    54 		case EVIMPSTNotSupported:
       
    55 			{
       
    56 			defaultNote = ETrue;
       
    57 			errorNote = ETrue;
       
    58             ignoreAdditionalData = ETrue;
       
    59 			resourceID = R_IM_ERROR_SERVICE_ERR;
       
    60 			break;
       
    61 			}
       
    62         case EVIMPSTMultipleErrors:   // flowthrough
       
    63 	   	default: // Unknown error -> show general note
       
    64 			{
       
    65 			defaultNote = ETrue;
       
    66 			errorNote = ETrue;
       
    67             ignoreAdditionalData = ETrue;
       
    68 			resourceID = R_IM_ERROR_GEN_ERROR;
       
    69 			break;
       
    70 			}
       
    71 		}
       
    72  
       
    73 	if( resourceID != 0 )
       
    74 		{
       
    75 		if( confirmationNote )
       
    76 		    {
       
    77 		    VIMPSTUtilsDialog::DisplayQueryDialogL( resourceID );
       
    78 		    }
       
    79 		else
       
    80 		    {
       
    81     		HBufC* prompt = NULL;
       
    82 
       
    83     		if( aAdditionalData == KNullDesC || defaultNote || ignoreAdditionalData )
       
    84     			{
       
    85     			prompt = CEikonEnv::Static()->AllocReadResourceLC( resourceID );
       
    86     			}
       
    87     		else
       
    88     			{
       
    89     			prompt = StringLoader::LoadLC( resourceID, aAdditionalData );
       
    90     			}
       
    91 
       
    92     		if( errorNote )
       
    93     			{
       
    94     			VIMPSTUtilsDialog::DisplayErrorNoteL( *prompt, softkeyOk );
       
    95     			}
       
    96     		else
       
    97     			{
       
    98     			VIMPSTUtilsDialog::DisplayNoteDialogL( *prompt );
       
    99     			}
       
   100 
       
   101     		CleanupStack::PopAndDestroy( prompt );
       
   102 		    }
       
   103 		}
       
   104 	}
       
   105 
       
   106 //  End of File