ImagePrint/ImagePrintUI/imgpprintdll/src/imgpprintapputil.cpp
branchRCL_3
changeset 20 159fc2f68139
parent 17 26673e532f65
child 21 d59c248c9d36
equal deleted inserted replaced
17:26673e532f65 20:159fc2f68139
     1 /*
       
     2 * Copyright (c) 2004-2007 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:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <e32std.h>
       
    20 #include <StringLoader.h>
       
    21 #include <aknnotewrappers.h>
       
    22 #include <ErrorUI.h>
       
    23 #include <eikappui.h>
       
    24 #include <eikapp.h>
       
    25 #include <eikenv.h>
       
    26 #include <obex.h>
       
    27 #include <bluetooth/hci/hcierrors.h>
       
    28 #include <imageprintapp.rsg>
       
    29 
       
    30 #include "clog.h"
       
    31 #include "imgpprintapputil.h"
       
    32 #include "printmessagecodes.h"
       
    33 #include "cimgpprintutils.h"
       
    34 
       
    35 const TInt KClientErrorForbidden = 1025;
       
    36 
       
    37 // Displays the error note
       
    38 void IMGPPrintAppUtil::ShowErrorNoteL(
       
    39     TInt aResourceId )
       
    40     {
       
    41     HBufC* str = StringLoader::LoadLC( aResourceId );
       
    42     CAknErrorNote* note = new ( ELeave ) CAknErrorNote;
       
    43     note->ExecuteLD( *str );
       
    44     CleanupStack::PopAndDestroy();  // str
       
    45     }
       
    46 
       
    47 // Displays the information note
       
    48 void IMGPPrintAppUtil::ShowInfoNoteL(
       
    49     TInt aResourceId )
       
    50     {
       
    51     HBufC* str = StringLoader::LoadLC( aResourceId );
       
    52     CAknInformationNote* note = new ( ELeave ) CAknInformationNote;
       
    53     note->ExecuteLD( *str );
       
    54     CleanupStack::PopAndDestroy();  // str
       
    55     }
       
    56 
       
    57 // Displays error message based on the error code
       
    58 void IMGPPrintAppUtil::ShowErrorMsgL(
       
    59     TInt aErrCode, TInt aErrorStringCode )
       
    60     {
       
    61     if ( aErrCode == KErrNoMemory )
       
    62         {
       
    63         CCoeEnv::Static()->HandleError( aErrCode );
       
    64         }
       
    65     else if ( aErrCode != KErrNone )
       
    66         {
       
    67         HBufC* str = IMGPPrintAppUtil::PrintErrorMsgLC( aErrCode, aErrorStringCode );
       
    68         CAknErrorNote* note = new ( ELeave ) CAknErrorNote;
       
    69         note->ExecuteLD( *str );
       
    70         CleanupStack::PopAndDestroy();  // str
       
    71         }
       
    72     }
       
    73 
       
    74 //  Loads printer application specific error message
       
    75 HBufC* IMGPPrintAppUtil::PrintErrorMsgLC(
       
    76     TInt aErrCode, TInt aErrorStringCode )
       
    77     {
       
    78     HBufC* errStr = 0;
       
    79     TInt resourceId( 0 );
       
    80     TInt finalErrCode( 0 );
       
    81 
       
    82     if ( aErrorStringCode )
       
    83         {        
       
    84         HandleByStringCodeL( aErrCode, aErrorStringCode, resourceId );
       
    85         }
       
    86 
       
    87     if ( resourceId == 0 )
       
    88         {
       
    89         HandleByErrorCodeL( resourceId, finalErrCode, aErrCode );
       
    90         }
       
    91     else
       
    92       	{
       
    93       	finalErrCode = aErrorStringCode;
       
    94        	}
       
    95 
       
    96     errStr = StringLoader::LoadLC( resourceId );
       
    97     
       
    98 // Add error code to message only when debug build is created.
       
    99 #ifdef _DEBUG	    
       
   100     if ( finalErrCode != 0 )
       
   101     	{
       
   102     	// append error code to message
       
   103 	    _LIT( KErrTmp, ": %d" );
       
   104 	    TBuf<32> errCodeMsg;
       
   105 	    errCodeMsg.Format( KErrTmp, finalErrCode );
       
   106 	    errStr = errStr->ReAllocL( errStr->Length() + 32 );
       
   107 	    CleanupStack::Pop(); // errStr before realloc
       
   108 	    CleanupStack::PushL( errStr );
       
   109 	    TPtr p( errStr->Des() );
       
   110 	    p += errCodeMsg;
       
   111     	}
       
   112 #endif // _DEBUG   
       
   113     return errStr;
       
   114     }
       
   115 
       
   116 void IMGPPrintAppUtil::HandleByStringCodeL( TInt aErrCode, TInt aErrorStringCode, TInt& aResourceId  )
       
   117 	{    
       
   118 	TBool matchOne = ETrue;	
       
   119 	TBool matchTwo = ETrue;	
       
   120 	TBool matchThree = ETrue;	
       
   121     StringCodeInkL( aErrorStringCode, aResourceId, matchOne );    
       
   122     StringCodeHwL( aErrorStringCode, aResourceId, matchTwo );        
       
   123     StringCodePaperL( aErrorStringCode, aResourceId, matchThree );
       
   124 	
       
   125 	if ( !matchOne && !matchTwo && !matchThree)
       
   126 		{	
       
   127 		switch ( aErrorStringCode )
       
   128 	        {
       
   129 	        case EObexConnectError: //-3000
       
   130 	            {
       
   131 	            if ( aErrCode == KHCIErrorBase-EPageTimedOut ) //-6004
       
   132 	                {
       
   133 	                aResourceId = R_NOTE_CONNECT_PRINT_ERROR;
       
   134 	                }
       
   135 	            else if ( aErrCode == KHCIErrorBase-EHostResourceRejection ) //-6013
       
   136 	                {
       
   137 	                aResourceId = R_NOTE_SEND_PRINT_ERROR;
       
   138 	                }
       
   139 	            else
       
   140 	                {
       
   141 	                aResourceId = R_NOTE_CONNECT_PRINT_ERROR;
       
   142 	                }           
       
   143 	            }
       
   144                 break;
       
   145 	            
       
   146 	        case KErrL2CAPRequestTimeout:
       
   147 	            aResourceId = R_NOTE_SEND_PRINT_ERROR;
       
   148 	            break;
       
   149 	      
       
   150 	        case KErrDisconnected:
       
   151 	            // If aError check is needed, it is in one case -6305.
       
   152 	            aResourceId = R_NOTE_DISCONNECT_PRINT_ERROR;
       
   153 	            break;
       
   154 	
       
   155 	        case EObexGeneralError:
       
   156 	            aResourceId = R_NOTE_GENERAL_PRINT_ERROR;
       
   157 	            break;
       
   158 	        
       
   159 	       	case EPbStatusErrorReasonFileFileDecode:
       
   160 	       		aResourceId = R_NOTE_IMAGEPRINT_ERROR_FILE_DECODE;
       
   161 	       		break;
       
   162 	        	        	
       
   163 	        case EPbStatusErrorReasonFile:
       
   164 	        	aResourceId = R_NOTE_IMAGEPRINT_ERROR_FILE;
       
   165 	        	break; 
       
   166 	        	
       
   167 	        case EPbStatusErrorReasonWarning:
       
   168 	        	aResourceId = R_NOTE_PRINT_STATUS_ERROR;
       
   169 	        	break;
       
   170 	        
       
   171 	        case EPbStatusErrorReasonNoReason:
       
   172 	            aResourceId  = R_NOTE_PRINT_STATUS_ERROR;
       
   173 	            break;
       
   174 	
       
   175 	        case EPbOutOfPaper:
       
   176 	            aResourceId = R_NOTE_IMAGEPRINT_ERROR_PAPER_OUT;
       
   177 	            break;
       
   178 	            
       
   179 	        case EPrintReasonPaused:
       
   180 	        	aResourceId = R_NOTE_IMAGEPRINT_ERROR_PRINTER_PAUSED;
       
   181 	        	break;
       
   182 	        
       
   183 	        case EPrintReasonOutputAreaAlmostFull:
       
   184 	        	aResourceId = R_NOTE_IMAGEPRINT_ERROR_OUTPUT_AREA_ALMOST_FULL;
       
   185 	        	break;
       
   186 	
       
   187 	        case EPrintReasonOutputAreaFull:
       
   188 	        	aResourceId = R_NOTE_IMAGEPRINT_ERROR_OUTPUT_AREA_FULL;
       
   189 	        	break;
       
   190 	
       
   191 	        case EPrintReasonMarkerFailure:
       
   192 	        	aResourceId = R_NOTE_IMAGEPRINT_ERROR_MARKER_FAILURE;
       
   193 	        	break;
       
   194 	        	
       
   195 	        default:           
       
   196 	            break;
       
   197 	        } 
       
   198 		}
       
   199 	}
       
   200 void IMGPPrintAppUtil::StringCodeInkL( TInt aErrorStringCode, TInt& aResourceId, TBool& aMatch  )
       
   201 	{
       
   202 	 switch ( aErrorStringCode )
       
   203 	        {            
       
   204 	        case EPbStatusErrorReasonInkLow:
       
   205 	        	aResourceId = R_NOTE_IMAGEPRINT_ERROR_INK_LOW;
       
   206 	        	break;
       
   207 	         	        	        	        
       
   208 	        case EPbStatusErrorReasonInkWaste:
       
   209 	        	aResourceId = R_NOTE_IMAGEPRINT_ERROR_INK_WASTE;
       
   210 	        	break;
       
   211 	        	
       
   212 	        case EPbStatusErrorReasonInk:
       
   213 	        	aResourceId = R_NOTE_IMAGEPRINT_ERROR_INK;
       
   214 	        	break; 
       
   215 	        	
       
   216 	        case EPbStatusErrorReasonInkEmpty:
       
   217 	        	aResourceId = R_NOTE_IMAGEPRINT_ERROR_INK_OUT;
       
   218 	        	break;
       
   219 	        	
       
   220 	        case EPrintReasonMarkerSupplyLow:
       
   221                	aResourceId = R_NOTE_IMAGEPRINT_ERROR_MARKER_SUPPLY_LOW;
       
   222                	break;
       
   223 
       
   224             case EPrintReasonMarkerSupplyEmpty:
       
   225                	aResourceId = R_NOTE_IMAGEPRINT_ERROR_MARKER_SUPPLY_EMPTY;
       
   226                	break;
       
   227 
       
   228        	    default:
       
   229            	    aMatch = EFalse;
       
   230            	    break;
       
   231 	        }
       
   232 	}
       
   233 
       
   234 void IMGPPrintAppUtil::StringCodeHwL( TInt aErrorStringCode, TInt& aResourceId, TBool& aMatch  )
       
   235 	{
       
   236 	 switch ( aErrorStringCode )
       
   237 	        {
       
   238 		 	case EPbStatusErrorReasonHardwareCoverOpen:
       
   239 	         	aResourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE_COVER_OPEN;
       
   240 	         	break;
       
   241 	         	
       
   242 	         case EPbStatusErrorReasonHardwareFatal:
       
   243 	         	aResourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE_FATAL;
       
   244 	         	break;
       
   245 	         	
       
   246 	         case EPbStatusErrorReasonHardwareServiceCall:
       
   247             	aResourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE_SERVICECALL;
       
   248             	break;
       
   249                 	
       
   250             case EPbStatusErrorReasonHardwarePrinterUnavailable:
       
   251             	aResourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE_PRINTER_UNAVAILABLE;
       
   252             	break;
       
   253             
       
   254             case EPbStatusErrorReasonHardwarePrinterBusy:
       
   255             	aResourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE_PRINTER_BUSY;
       
   256             	break;
       
   257             	
       
   258             case EPbStatusErrorReasonHardwareLever:
       
   259             	aResourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE_LEVER;
       
   260             	break;
       
   261             	
       
   262             case EPbStatusErrorReasonHardwareNoMarkingAgent:
       
   263             	aResourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE_NO_MARKING_AGENT;
       
   264             	break;
       
   265             
       
   266             case EPbStatusErrorReasonHardwareInkCoverOpen:
       
   267             	aResourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE_INK_COVER_OPEN;
       
   268             	break;
       
   269             
       
   270             case EPbStatusErrorReasonHardwareNoInkCartridge:
       
   271             	aResourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE_NO_INK_CARTRIDGE;
       
   272             	break;
       
   273             	
       
   274             case EPbStatusErrorReasonHardware:
       
   275             	aResourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE;
       
   276             	break; 
       
   277 
       
   278     	    default:
       
   279         	    aMatch = EFalse;
       
   280         	    break;
       
   281 	        }
       
   282 	}
       
   283 
       
   284 void IMGPPrintAppUtil::StringCodePaperL( TInt aErrorStringCode, TInt& aResourceId, TBool& aMatch  )
       
   285 	{
       
   286 	 switch ( aErrorStringCode )
       
   287 	        {	        
       
   288 			case EPbStatusErrorReasonPaperLoad:
       
   289 		       	aResourceId = R_NOTE_IMAGEPRINT_ERROR_PAPER_LOAD;
       
   290 		       	break;
       
   291 	       	
       
   292 	       	case EPbStatusErrorReasonPaperEmpty:
       
   293 		       	aResourceId = R_NOTE_IMAGEPRINT_ERROR_PAPER_OUT;
       
   294 		       	break;        
       
   295 	
       
   296 	       	case EPbStatusErrorReasonPaperEject:
       
   297 		       	aResourceId = R_NOTE_IMAGEPRINT_ERROR_PAPER_EJECT;
       
   298 		       	break;
       
   299 	
       
   300 	       	case EPbStatusErrorReasonPaperJam:
       
   301 		       	aResourceId = R_NOTE_IMAGEPRINT_ERROR_PAPER_JAM;
       
   302 		       	break;
       
   303 	
       
   304 	       	case EPbStatusErrorReasonPaperMedia:
       
   305 		       	aResourceId = R_NOTE_IMAGEPRINT_ERROR_PAPER_MEDIA;
       
   306 		       	break;
       
   307 	
       
   308 	       	case EPbStatusErrorReasonPaperNearlyEmpty:
       
   309 	       		aResourceId = R_NOTE_IMAGEPRINT_ERROR_PAPER_LOW;
       
   310 	       		break;
       
   311 	       	
       
   312 	       	case EPbStatusErrorReasonPaperCombination:
       
   313 	       		aResourceId = R_NOTE_IMAGEPRINT_ERROR_PAPER_COMBINATION;
       
   314 	       		break;
       
   315 	       
       
   316 	       	case EPbStatusErrorReasonPaper:
       
   317 	       		aResourceId = R_NOTE_IMAGEPRINT_ERROR_PAPER;
       
   318 	       		break;  
       
   319 
       
   320 		    default:
       
   321 	    	    aMatch = EFalse;
       
   322 	    	    break;
       
   323 	        }
       
   324 	}
       
   325 
       
   326 void IMGPPrintAppUtil::HandleByErrorCodeL( TInt& aResourceId, TInt& aFinalErrCode, TInt aErrCode  )
       
   327 	{	
       
   328 	aFinalErrCode = aErrCode;
       
   329 	
       
   330 	TBool matchOne   = ETrue;  
       
   331 	TBool matchTwo   = ETrue;
       
   332 	TBool matchThree = ETrue;	
       
   333 	ErrorCodeInkL( aResourceId, aErrCode, matchOne );    
       
   334 	ErrorCodeHwL( aResourceId, aErrCode, matchTwo );
       
   335 	ErrorCodePaperL( aResourceId, aErrCode,matchThree );
       
   336 	
       
   337 	if ( !matchOne && !matchTwo && !matchThree)
       
   338 		{
       
   339 		switch ( aErrCode )
       
   340 	    {
       
   341 		    case KClientErrorForbidden:
       
   342 		    	aResourceId = R_NOTE_DISCONNECT_PRINT_ERROR;
       
   343 		        break;	
       
   344 		   
       
   345 		    case KErrDisconnected:
       
   346 		    	aResourceId = R_NOTE_DISCONNECT_PRINT_ERROR;
       
   347 		        break;
       
   348 		
       
   349 		    case EObexGeneralError:
       
   350 		    	aResourceId = R_NOTE_GENERAL_PRINT_ERROR;
       
   351 		        break;
       
   352 		  
       
   353 		   	case EPbStatusErrorReasonFileFileDecode:
       
   354 		   		aResourceId = R_NOTE_IMAGEPRINT_ERROR_FILE_DECODE;
       
   355 		   		break;
       
   356 		    	        	
       
   357 		    case EPbStatusErrorReasonFile:
       
   358 		    	aResourceId = R_NOTE_IMAGEPRINT_ERROR_FILE;
       
   359 		    	break;        
       
   360 		          
       
   361 		    case EPbStatusErrorReasonNoReason:
       
   362 		    	aResourceId  = R_NOTE_PRINT_STATUS_ERROR;
       
   363 		        break;
       
   364 			
       
   365 		    case KErrCorrupt: // Only corrupted images selected:
       
   366 		    	aResourceId =  R_QTN_PRINT_SELECTNEW_NOTE;
       
   367 		        break;
       
   368 		        
       
   369 		    case EPrintReasonPaused:
       
   370 		    	aResourceId = R_NOTE_IMAGEPRINT_ERROR_PRINTER_PAUSED;
       
   371 		    	break;
       
   372 		    
       
   373 		    case EPrintReasonOutputAreaAlmostFull:
       
   374 		    	aResourceId = R_NOTE_IMAGEPRINT_ERROR_OUTPUT_AREA_ALMOST_FULL;
       
   375 		    	break;
       
   376 		
       
   377 		    case EPrintReasonOutputAreaFull:
       
   378 		    	aResourceId = R_NOTE_IMAGEPRINT_ERROR_OUTPUT_AREA_FULL;
       
   379 		    	break;
       
   380 		 
       
   381 		    case EPrintReasonMarkerFailure:
       
   382 		    	aResourceId = R_NOTE_IMAGEPRINT_ERROR_MARKER_FAILURE;
       
   383 		    	break;
       
   384 		    	
       
   385 		    case KErrHostUnreach:
       
   386 		    	aResourceId = R_NOTE_DISCONNECT_PRINT_ERROR;
       
   387 		    	break;	
       
   388 		    	
       
   389 		    case ( KHCIErrorBase-EHostResourceRejection ):
       
   390 		    	aResourceId = R_NOTE_SEND_PRINT_ERROR;
       
   391 				break;
       
   392 			
       
   393 		    case ( KHCIErrorBase-ERemoteHostTimeout ):
       
   394 		    	aResourceId = R_NOTE_SEND_PRINT_ERROR;
       
   395 		    	break;	  
       
   396 		    	
       
   397 		    case ( KHCIErrorBase-EPageTimedOut ):
       
   398 		    	aResourceId = R_NOTE_CONNECT_PRINT_ERROR;
       
   399 		        break;
       
   400 				
       
   401 			case KErrHCILinkDisconnection:
       
   402 				aResourceId = R_NOTE_DISCONNECT_PRINT_ERROR;
       
   403 				break;
       
   404 		        
       
   405 		    default:	  
       
   406 				aResourceId = R_NOTE_GENERAL_PRINT_ERROR;
       
   407 				break;
       
   408 		    }
       
   409 		}
       
   410 	}
       
   411 
       
   412 void IMGPPrintAppUtil::ErrorCodeInkL( TInt& aResourceId, TInt aErrCode, TBool& aMatch )
       
   413 	{
       
   414 	switch ( aErrCode )
       
   415 	    {	  	
       
   416 	    case EPbStatusErrorReasonInkLow:
       
   417 	    	aResourceId = R_NOTE_IMAGEPRINT_ERROR_INK_LOW;
       
   418 	    	break;
       
   419 	      	        	        	        	        
       
   420 	    case EPbStatusErrorReasonInkWaste:
       
   421 	    	aResourceId = R_NOTE_IMAGEPRINT_ERROR_INK_WASTE;
       
   422 	    	break;
       
   423 	    	
       
   424 	    case EPbStatusErrorReasonInk:
       
   425 	    	aResourceId = R_NOTE_IMAGEPRINT_ERROR_INK;
       
   426 	    	break; 
       
   427 	    	
       
   428 	    case EPrintReasonMarkerSupplyLow:
       
   429  	    	aResourceId = R_NOTE_IMAGEPRINT_ERROR_MARKER_SUPPLY_LOW;
       
   430  	    	break;
       
   431  	
       
   432     	case EPrintReasonMarkerSupplyEmpty:
       
   433  	    	aResourceId = R_NOTE_IMAGEPRINT_ERROR_MARKER_SUPPLY_EMPTY;
       
   434  	    	break; 	    
       
   435  	    	
       
   436     	case EPbStatusErrorReasonInkEmpty:
       
   437  	       	aResourceId = R_NOTE_IMAGEPRINT_ERROR_INK_OUT;
       
   438  	        break;
       
   439 
       
   440  		default:
       
   441  	    	aMatch = EFalse;
       
   442  	    	break;
       
   443 	    }
       
   444 	}
       
   445 
       
   446 void IMGPPrintAppUtil::ErrorCodeHwL( TInt& aResourceId, TInt aErrCode, TBool& aMatch )
       
   447 	{
       
   448 	switch ( aErrCode )
       
   449 	    {
       
   450 		case EPbStatusErrorReasonHardwareCoverOpen:
       
   451 	    	aResourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE_COVER_OPEN;
       
   452 	    	break;
       
   453 		    	
       
   454 		    case EPbStatusErrorReasonHardwareFatal:
       
   455 		    	aResourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE_FATAL;
       
   456 		    	break;
       
   457 		    	
       
   458 		    case EPbStatusErrorReasonHardwareServiceCall:
       
   459 		    	aResourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE_SERVICECALL;
       
   460 		    	break;
       
   461 		    	
       
   462 		    case EPbStatusErrorReasonHardwarePrinterUnavailable:
       
   463 		    	aResourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE_PRINTER_UNAVAILABLE;
       
   464 		    	break;
       
   465 		    
       
   466 		    case EPbStatusErrorReasonHardwarePrinterBusy:
       
   467 		    	aResourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE_PRINTER_BUSY;
       
   468 		    	break;
       
   469 		    	
       
   470 		    case EPbStatusErrorReasonHardwareLever:
       
   471 		    	aResourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE_LEVER;
       
   472 		    	break;
       
   473 		    	
       
   474 		    case EPbStatusErrorReasonHardwareNoMarkingAgent:
       
   475 		    	aResourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE_NO_MARKING_AGENT;
       
   476 		    	break;
       
   477 		    
       
   478 		    case EPbStatusErrorReasonHardwareInkCoverOpen:
       
   479 		    	aResourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE_INK_COVER_OPEN;
       
   480 		    	break;
       
   481 		    
       
   482 		    case EPbStatusErrorReasonHardwareNoInkCartridge:
       
   483 		    	aResourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE_NO_INK_CARTRIDGE;
       
   484 		    	break;
       
   485 		    	
       
   486 		    case EPbStatusErrorReasonHardware:
       
   487 		    	aResourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE;
       
   488 		    	break; 
       
   489 		    	
       
   490 		    default:
       
   491 	    	    aMatch = EFalse;
       
   492 	    	    break;
       
   493 	    }
       
   494 	}
       
   495 
       
   496 void IMGPPrintAppUtil::ErrorCodePaperL( TInt& aResourceId, TInt aErrCode, TBool& aMatch )
       
   497 	{
       
   498 	switch ( aErrCode )
       
   499 	    {
       
   500 		case EPbStatusErrorReasonPaperLoad:
       
   501    	    	aResourceId = R_NOTE_IMAGEPRINT_ERROR_PAPER_LOAD;
       
   502    	    	break; 
       
   503 	   	    	
       
   504 	    case EPbStatusErrorReasonPaperEmpty:
       
   505 	    	aResourceId = R_NOTE_IMAGEPRINT_ERROR_PAPER_OUT;
       
   506 	    	break;        
       
   507 	
       
   508 	    case EPbStatusErrorReasonPaperEject:
       
   509 	    	aResourceId = R_NOTE_IMAGEPRINT_ERROR_PAPER_EJECT;
       
   510 	    	break;
       
   511 	
       
   512 	    case EPbStatusErrorReasonPaperJam:
       
   513 	    	aResourceId = R_NOTE_IMAGEPRINT_ERROR_PAPER_JAM;
       
   514 	    	break;
       
   515 	
       
   516 	    case EPbStatusErrorReasonPaperMedia:
       
   517 	    	aResourceId = R_NOTE_IMAGEPRINT_ERROR_PAPER_MEDIA;
       
   518 	    	break;
       
   519 	
       
   520 	    case EPbStatusErrorReasonPaperNearlyEmpty:
       
   521 	    	aResourceId = R_NOTE_IMAGEPRINT_ERROR_PAPER_LOW;
       
   522 	    	break;
       
   523 	    	
       
   524 	    case EPbStatusErrorReasonPaperCombination:
       
   525 	    	aResourceId = R_NOTE_IMAGEPRINT_ERROR_PAPER_COMBINATION;
       
   526 	    	break;
       
   527 	    
       
   528 	    case EPbStatusErrorReasonPaper:
       
   529 	    	aResourceId = R_NOTE_IMAGEPRINT_ERROR_PAPER;
       
   530 	    	break;
       
   531 	    	
       
   532 	    case EPbOutOfPaper:
       
   533 	    	aResourceId = R_NOTE_IMAGEPRINT_ERROR_PAPER_OUT;
       
   534 	        break;
       
   535 	    	
       
   536 	    default:
       
   537     	    aMatch = EFalse;
       
   538     	    break;
       
   539 	    }	
       
   540 	}
       
   541 
       
   542 //  Adds application path
       
   543 TFileName IMGPPrintAppUtil::AddApplicationPath(
       
   544     const TDesC& aFileName )
       
   545     {
       
   546     CEikonEnv* eikonEnv = CEikonEnv::Static();
       
   547     CEikAppUi* appUi = static_cast<CEikAppUi*>( eikonEnv->AppUi() );
       
   548     TFileName fullFilePath = appUi->Application()->AppFullName();
       
   549     delete eikonEnv; eikonEnv = NULL;
       
   550     
       
   551     TParse parse;
       
   552     parse.Set( fullFilePath, NULL, NULL );
       
   553     fullFilePath = parse.DriveAndPath();
       
   554     fullFilePath.Append( aFileName );
       
   555     return fullFilePath;
       
   556     }
       
   557 
       
   558 //  End of File