ImagePrint/ImagePrintUI/imgpprintdll/src/imgpprintapputil.cpp
changeset 0 d11fb78c4374
child 2 acc370d7f2f6
equal deleted inserted replaced
-1:000000000000 0:d11fb78c4374
       
     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 	            
       
   145 	        case KErrL2CAPRequestTimeout:
       
   146 	            aResourceId = R_NOTE_SEND_PRINT_ERROR;
       
   147 	            break;
       
   148 	      
       
   149 	        case KErrDisconnected:
       
   150 	            // If aError check is needed, it is in one case -6305.
       
   151 	            aResourceId = R_NOTE_DISCONNECT_PRINT_ERROR;
       
   152 	            break;
       
   153 	
       
   154 	        case EObexGeneralError:
       
   155 	            aResourceId = R_NOTE_GENERAL_PRINT_ERROR;
       
   156 	            break;
       
   157 	        
       
   158 	       	case EPbStatusErrorReasonFileFileDecode:
       
   159 	       		aResourceId = R_NOTE_IMAGEPRINT_ERROR_FILE_DECODE;
       
   160 	       		break;
       
   161 	        	        	
       
   162 	        case EPbStatusErrorReasonFile:
       
   163 	        	aResourceId = R_NOTE_IMAGEPRINT_ERROR_FILE;
       
   164 	        	break; 
       
   165 	        	
       
   166 	        case EPbStatusErrorReasonWarning:
       
   167 	        	aResourceId = R_NOTE_PRINT_STATUS_ERROR;
       
   168 	        	break;
       
   169 	        
       
   170 	        case EPbStatusErrorReasonNoReason:
       
   171 	            aResourceId  = R_NOTE_PRINT_STATUS_ERROR;
       
   172 	            break;
       
   173 	
       
   174 	        case EPbOutOfPaper:
       
   175 	            aResourceId = R_NOTE_IMAGEPRINT_ERROR_PAPER_OUT;
       
   176 	            break;
       
   177 	            
       
   178 	        case EPrintReasonPaused:
       
   179 	        	aResourceId = R_NOTE_IMAGEPRINT_ERROR_PRINTER_PAUSED;
       
   180 	        	break;
       
   181 	        
       
   182 	        case EPrintReasonOutputAreaAlmostFull:
       
   183 	        	aResourceId = R_NOTE_IMAGEPRINT_ERROR_OUTPUT_AREA_ALMOST_FULL;
       
   184 	        	break;
       
   185 	
       
   186 	        case EPrintReasonOutputAreaFull:
       
   187 	        	aResourceId = R_NOTE_IMAGEPRINT_ERROR_OUTPUT_AREA_FULL;
       
   188 	        	break;
       
   189 	
       
   190 	        case EPrintReasonMarkerFailure:
       
   191 	        	aResourceId = R_NOTE_IMAGEPRINT_ERROR_MARKER_FAILURE;
       
   192 	        	break;
       
   193 	        	
       
   194 	        default:           
       
   195 	            break;
       
   196 	        } 
       
   197 		}
       
   198 	}
       
   199 void IMGPPrintAppUtil::StringCodeInkL( TInt aErrorStringCode, TInt& aResourceId, TBool& aMatch  )
       
   200 	{
       
   201 	 switch ( aErrorStringCode )
       
   202 	        {            
       
   203 	        case EPbStatusErrorReasonInkLow:
       
   204 	        	aResourceId = R_NOTE_IMAGEPRINT_ERROR_INK_LOW;
       
   205 	        	break;
       
   206 	         	        	        	        
       
   207 	        case EPbStatusErrorReasonInkWaste:
       
   208 	        	aResourceId = R_NOTE_IMAGEPRINT_ERROR_INK_WASTE;
       
   209 	        	break;
       
   210 	        	
       
   211 	        case EPbStatusErrorReasonInk:
       
   212 	        	aResourceId = R_NOTE_IMAGEPRINT_ERROR_INK;
       
   213 	        	break; 
       
   214 	        	
       
   215 	        case EPbStatusErrorReasonInkEmpty:
       
   216 	        	aResourceId = R_NOTE_IMAGEPRINT_ERROR_INK_OUT;
       
   217 	        	break;
       
   218 	        	
       
   219 	        case EPrintReasonMarkerSupplyLow:
       
   220                	aResourceId = R_NOTE_IMAGEPRINT_ERROR_MARKER_SUPPLY_LOW;
       
   221                	break;
       
   222 
       
   223             case EPrintReasonMarkerSupplyEmpty:
       
   224                	aResourceId = R_NOTE_IMAGEPRINT_ERROR_MARKER_SUPPLY_EMPTY;
       
   225                	break;
       
   226 
       
   227        	    default:
       
   228            	    aMatch = EFalse;
       
   229            	    break;
       
   230 	        }
       
   231 	}
       
   232 
       
   233 void IMGPPrintAppUtil::StringCodeHwL( TInt aErrorStringCode, TInt& aResourceId, TBool& aMatch  )
       
   234 	{
       
   235 	 switch ( aErrorStringCode )
       
   236 	        {
       
   237 		 	case EPbStatusErrorReasonHardwareCoverOpen:
       
   238 	         	aResourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE_COVER_OPEN;
       
   239 	         	break;
       
   240 	         	
       
   241 	         case EPbStatusErrorReasonHardwareFatal:
       
   242 	         	aResourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE_FATAL;
       
   243 	         	break;
       
   244 	         	
       
   245 	         case EPbStatusErrorReasonHardwareServiceCall:
       
   246             	aResourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE_SERVICECALL;
       
   247             	break;
       
   248                 	
       
   249             case EPbStatusErrorReasonHardwarePrinterUnavailable:
       
   250             	aResourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE_PRINTER_UNAVAILABLE;
       
   251             	break;
       
   252             
       
   253             case EPbStatusErrorReasonHardwarePrinterBusy:
       
   254             	aResourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE_PRINTER_BUSY;
       
   255             	break;
       
   256             	
       
   257             case EPbStatusErrorReasonHardwareLever:
       
   258             	aResourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE_LEVER;
       
   259             	break;
       
   260             	
       
   261             case EPbStatusErrorReasonHardwareNoMarkingAgent:
       
   262             	aResourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE_NO_MARKING_AGENT;
       
   263             	break;
       
   264             
       
   265             case EPbStatusErrorReasonHardwareInkCoverOpen:
       
   266             	aResourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE_INK_COVER_OPEN;
       
   267             	break;
       
   268             
       
   269             case EPbStatusErrorReasonHardwareNoInkCartridge:
       
   270             	aResourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE_NO_INK_CARTRIDGE;
       
   271             	break;
       
   272             	
       
   273             case EPbStatusErrorReasonHardware:
       
   274             	aResourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE;
       
   275             	break; 
       
   276 
       
   277     	    default:
       
   278         	    aMatch = EFalse;
       
   279         	    break;
       
   280 	        }
       
   281 	}
       
   282 
       
   283 void IMGPPrintAppUtil::StringCodePaperL( TInt aErrorStringCode, TInt& aResourceId, TBool& aMatch  )
       
   284 	{
       
   285 	 switch ( aErrorStringCode )
       
   286 	        {	        
       
   287 			case EPbStatusErrorReasonPaperLoad:
       
   288 		       	aResourceId = R_NOTE_IMAGEPRINT_ERROR_PAPER_LOAD;
       
   289 		       	break;
       
   290 	       	
       
   291 	       	case EPbStatusErrorReasonPaperEmpty:
       
   292 		       	aResourceId = R_NOTE_IMAGEPRINT_ERROR_PAPER_OUT;
       
   293 		       	break;        
       
   294 	
       
   295 	       	case EPbStatusErrorReasonPaperEject:
       
   296 		       	aResourceId = R_NOTE_IMAGEPRINT_ERROR_PAPER_EJECT;
       
   297 		       	break;
       
   298 	
       
   299 	       	case EPbStatusErrorReasonPaperJam:
       
   300 		       	aResourceId = R_NOTE_IMAGEPRINT_ERROR_PAPER_JAM;
       
   301 		       	break;
       
   302 	
       
   303 	       	case EPbStatusErrorReasonPaperMedia:
       
   304 		       	aResourceId = R_NOTE_IMAGEPRINT_ERROR_PAPER_MEDIA;
       
   305 		       	break;
       
   306 	
       
   307 	       	case EPbStatusErrorReasonPaperNearlyEmpty:
       
   308 	       		aResourceId = R_NOTE_IMAGEPRINT_ERROR_PAPER_LOW;
       
   309 	       		break;
       
   310 	       	
       
   311 	       	case EPbStatusErrorReasonPaperCombination:
       
   312 	       		aResourceId = R_NOTE_IMAGEPRINT_ERROR_PAPER_COMBINATION;
       
   313 	       		break;
       
   314 	       
       
   315 	       	case EPbStatusErrorReasonPaper:
       
   316 	       		aResourceId = R_NOTE_IMAGEPRINT_ERROR_PAPER;
       
   317 	       		break;  
       
   318 
       
   319 		    default:
       
   320 	    	    aMatch = EFalse;
       
   321 	    	    break;
       
   322 	        }
       
   323 	}
       
   324 
       
   325 void IMGPPrintAppUtil::HandleByErrorCodeL( TInt& aResourceId, TInt& aFinalErrCode, TInt aErrCode  )
       
   326 	{	
       
   327 	aFinalErrCode = aErrCode;
       
   328 	
       
   329 	TBool matchOne   = ETrue;  
       
   330 	TBool matchTwo   = ETrue;
       
   331 	TBool matchThree = ETrue;	
       
   332 	ErrorCodeInkL( aResourceId, aErrCode, matchOne );    
       
   333 	ErrorCodeHwL( aResourceId, aErrCode, matchTwo );
       
   334 	ErrorCodePaperL( aResourceId, aErrCode,matchThree );
       
   335 	
       
   336 	if ( !matchOne && !matchTwo && !matchThree)
       
   337 		{
       
   338 		switch ( aErrCode )
       
   339 	    {
       
   340 		    case KClientErrorForbidden:
       
   341 		    	aResourceId = R_NOTE_DISCONNECT_PRINT_ERROR;
       
   342 		        break;	
       
   343 		   
       
   344 		    case KErrDisconnected:
       
   345 		    	aResourceId = R_NOTE_DISCONNECT_PRINT_ERROR;
       
   346 		        break;
       
   347 		
       
   348 		    case EObexGeneralError:
       
   349 		    	aResourceId = R_NOTE_GENERAL_PRINT_ERROR;
       
   350 		        break;
       
   351 		  
       
   352 		   	case EPbStatusErrorReasonFileFileDecode:
       
   353 		   		aResourceId = R_NOTE_IMAGEPRINT_ERROR_FILE_DECODE;
       
   354 		   		break;
       
   355 		    	        	
       
   356 		    case EPbStatusErrorReasonFile:
       
   357 		    	aResourceId = R_NOTE_IMAGEPRINT_ERROR_FILE;
       
   358 		    	break;        
       
   359 		          
       
   360 		    case EPbStatusErrorReasonNoReason:
       
   361 		    	aResourceId  = R_NOTE_PRINT_STATUS_ERROR;
       
   362 		        break;
       
   363 			
       
   364 		    case KErrCorrupt: // Only corrupted images selected:
       
   365 		    	aResourceId =  R_QTN_PRINT_SELECTNEW_NOTE;
       
   366 		        break;
       
   367 		        
       
   368 		    case EPrintReasonPaused:
       
   369 		    	aResourceId = R_NOTE_IMAGEPRINT_ERROR_PRINTER_PAUSED;
       
   370 		    	break;
       
   371 		    
       
   372 		    case EPrintReasonOutputAreaAlmostFull:
       
   373 		    	aResourceId = R_NOTE_IMAGEPRINT_ERROR_OUTPUT_AREA_ALMOST_FULL;
       
   374 		    	break;
       
   375 		
       
   376 		    case EPrintReasonOutputAreaFull:
       
   377 		    	aResourceId = R_NOTE_IMAGEPRINT_ERROR_OUTPUT_AREA_FULL;
       
   378 		    	break;
       
   379 		 
       
   380 		    case EPrintReasonMarkerFailure:
       
   381 		    	aResourceId = R_NOTE_IMAGEPRINT_ERROR_MARKER_FAILURE;
       
   382 		    	break;
       
   383 		    	
       
   384 		    case KErrHostUnreach:
       
   385 		    	aResourceId = R_NOTE_DISCONNECT_PRINT_ERROR;
       
   386 		    	break;	
       
   387 		    	
       
   388 		    case ( KHCIErrorBase-EHostResourceRejection ):
       
   389 		    	aResourceId = R_NOTE_SEND_PRINT_ERROR;
       
   390 				break;
       
   391 			
       
   392 		    case ( KHCIErrorBase-ERemoteHostTimeout ):
       
   393 		    	aResourceId = R_NOTE_SEND_PRINT_ERROR;
       
   394 		    	break;	  
       
   395 		    	
       
   396 		    case ( KHCIErrorBase-EPageTimedOut ):
       
   397 		    	aResourceId = R_NOTE_CONNECT_PRINT_ERROR;
       
   398 		        break;
       
   399 				
       
   400 			case KErrHCILinkDisconnection:
       
   401 				aResourceId = R_NOTE_DISCONNECT_PRINT_ERROR;
       
   402 				break;
       
   403 		        
       
   404 		    default:	  
       
   405 				aResourceId = R_NOTE_GENERAL_PRINT_ERROR;
       
   406 				break;
       
   407 		    }
       
   408 		}
       
   409 	}
       
   410 
       
   411 void IMGPPrintAppUtil::ErrorCodeInkL( TInt& aResourceId, TInt aErrCode, TBool& aMatch )
       
   412 	{
       
   413 	switch ( aErrCode )
       
   414 	    {	  	
       
   415 	    case EPbStatusErrorReasonInkLow:
       
   416 	    	aResourceId = R_NOTE_IMAGEPRINT_ERROR_INK_LOW;
       
   417 	    	break;
       
   418 	      	        	        	        	        
       
   419 	    case EPbStatusErrorReasonInkWaste:
       
   420 	    	aResourceId = R_NOTE_IMAGEPRINT_ERROR_INK_WASTE;
       
   421 	    	break;
       
   422 	    	
       
   423 	    case EPbStatusErrorReasonInk:
       
   424 	    	aResourceId = R_NOTE_IMAGEPRINT_ERROR_INK;
       
   425 	    	break; 
       
   426 	    	
       
   427 	    case EPrintReasonMarkerSupplyLow:
       
   428  	    	aResourceId = R_NOTE_IMAGEPRINT_ERROR_MARKER_SUPPLY_LOW;
       
   429  	    	break;
       
   430  	
       
   431     	case EPrintReasonMarkerSupplyEmpty:
       
   432  	    	aResourceId = R_NOTE_IMAGEPRINT_ERROR_MARKER_SUPPLY_EMPTY;
       
   433  	    	break; 	    
       
   434  	    	
       
   435     	case EPbStatusErrorReasonInkEmpty:
       
   436  	       	aResourceId = R_NOTE_IMAGEPRINT_ERROR_INK_OUT;
       
   437  	        break;
       
   438 
       
   439  		default:
       
   440  	    	aMatch = EFalse;
       
   441  	    	break;
       
   442 	    }
       
   443 	}
       
   444 
       
   445 void IMGPPrintAppUtil::ErrorCodeHwL( TInt& aResourceId, TInt aErrCode, TBool& aMatch )
       
   446 	{
       
   447 	switch ( aErrCode )
       
   448 	    {
       
   449 		case EPbStatusErrorReasonHardwareCoverOpen:
       
   450 	    	aResourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE_COVER_OPEN;
       
   451 	    	break;
       
   452 		    	
       
   453 		    case EPbStatusErrorReasonHardwareFatal:
       
   454 		    	aResourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE_FATAL;
       
   455 		    	break;
       
   456 		    	
       
   457 		    case EPbStatusErrorReasonHardwareServiceCall:
       
   458 		    	aResourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE_SERVICECALL;
       
   459 		    	break;
       
   460 		    	
       
   461 		    case EPbStatusErrorReasonHardwarePrinterUnavailable:
       
   462 		    	aResourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE_PRINTER_UNAVAILABLE;
       
   463 		    	break;
       
   464 		    
       
   465 		    case EPbStatusErrorReasonHardwarePrinterBusy:
       
   466 		    	aResourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE_PRINTER_BUSY;
       
   467 		    	break;
       
   468 		    	
       
   469 		    case EPbStatusErrorReasonHardwareLever:
       
   470 		    	aResourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE_LEVER;
       
   471 		    	break;
       
   472 		    	
       
   473 		    case EPbStatusErrorReasonHardwareNoMarkingAgent:
       
   474 		    	aResourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE_NO_MARKING_AGENT;
       
   475 		    	break;
       
   476 		    
       
   477 		    case EPbStatusErrorReasonHardwareInkCoverOpen:
       
   478 		    	aResourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE_INK_COVER_OPEN;
       
   479 		    	break;
       
   480 		    
       
   481 		    case EPbStatusErrorReasonHardwareNoInkCartridge:
       
   482 		    	aResourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE_NO_INK_CARTRIDGE;
       
   483 		    	break;
       
   484 		    	
       
   485 		    case EPbStatusErrorReasonHardware:
       
   486 		    	aResourceId = R_NOTE_IMAGEPRINT_ERROR_HARDWARE;
       
   487 		    	break; 
       
   488 		    	
       
   489 		    default:
       
   490 	    	    aMatch = EFalse;
       
   491 	    	    break;
       
   492 	    }
       
   493 	}
       
   494 
       
   495 void IMGPPrintAppUtil::ErrorCodePaperL( TInt& aResourceId, TInt aErrCode, TBool& aMatch )
       
   496 	{
       
   497 	switch ( aErrCode )
       
   498 	    {
       
   499 		case EPbStatusErrorReasonPaperLoad:
       
   500    	    	aResourceId = R_NOTE_IMAGEPRINT_ERROR_PAPER_LOAD;
       
   501    	    	break; 
       
   502 	   	    	
       
   503 	    case EPbStatusErrorReasonPaperEmpty:
       
   504 	    	aResourceId = R_NOTE_IMAGEPRINT_ERROR_PAPER_OUT;
       
   505 	    	break;        
       
   506 	
       
   507 	    case EPbStatusErrorReasonPaperEject:
       
   508 	    	aResourceId = R_NOTE_IMAGEPRINT_ERROR_PAPER_EJECT;
       
   509 	    	break;
       
   510 	
       
   511 	    case EPbStatusErrorReasonPaperJam:
       
   512 	    	aResourceId = R_NOTE_IMAGEPRINT_ERROR_PAPER_JAM;
       
   513 	    	break;
       
   514 	
       
   515 	    case EPbStatusErrorReasonPaperMedia:
       
   516 	    	aResourceId = R_NOTE_IMAGEPRINT_ERROR_PAPER_MEDIA;
       
   517 	    	break;
       
   518 	
       
   519 	    case EPbStatusErrorReasonPaperNearlyEmpty:
       
   520 	    	aResourceId = R_NOTE_IMAGEPRINT_ERROR_PAPER_LOW;
       
   521 	    	break;
       
   522 	    	
       
   523 	    case EPbStatusErrorReasonPaperCombination:
       
   524 	    	aResourceId = R_NOTE_IMAGEPRINT_ERROR_PAPER_COMBINATION;
       
   525 	    	break;
       
   526 	    
       
   527 	    case EPbStatusErrorReasonPaper:
       
   528 	    	aResourceId = R_NOTE_IMAGEPRINT_ERROR_PAPER;
       
   529 	    	break;
       
   530 	    	
       
   531 	    case EPbOutOfPaper:
       
   532 	    	aResourceId = R_NOTE_IMAGEPRINT_ERROR_PAPER_OUT;
       
   533 	        break;
       
   534 	    	
       
   535 	    default:
       
   536     	    aMatch = EFalse;
       
   537     	    break;
       
   538 	    }	
       
   539 	}
       
   540 
       
   541 //  Adds application path
       
   542 TFileName IMGPPrintAppUtil::AddApplicationPath(
       
   543     const TDesC& aFileName )
       
   544     {
       
   545     CEikonEnv* eikonEnv = CEikonEnv::Static();
       
   546     CEikAppUi* appUi = static_cast<CEikAppUi*>( eikonEnv->AppUi() );
       
   547     TFileName fullFilePath = appUi->Application()->AppFullName();
       
   548     delete eikonEnv; eikonEnv = NULL;
       
   549     
       
   550     TParse parse;
       
   551     parse.Set( fullFilePath, NULL, NULL );
       
   552     fullFilePath = parse.DriveAndPath();
       
   553     fullFilePath.Append( aFileName );
       
   554     return fullFilePath;
       
   555     }
       
   556 
       
   557 //  End of File