phoneuis/Ussd/src/UssdNaviPane.cpp
branchRCL_3
changeset 5 2a26698d78ba
parent 0 5f000ab63145
equal deleted inserted replaced
4:24062c24fe38 5:2a26698d78ba
     1 /*
     1 /*
     2 * Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). 
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). 
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    22 #include    <aknnavide.h>               // CAknNavigationDecorator
    22 #include    <aknnavide.h>               // CAknNavigationDecorator
    23 #include    <aknEditStateIndicator.h>
    23 #include    <aknEditStateIndicator.h>
    24 #include    <AknIndicatorContainer.h>
    24 #include    <AknIndicatorContainer.h>
    25 #include    <aknnavilabel.h>
    25 #include    <aknnavilabel.h>
    26 #include    "UssdComms.h" 
    26 #include    "UssdComms.h" 
    27 
       
    28 #include    "UssdAppUi.h"
    27 #include    "UssdAppUi.h"
    29 #include    "UssdNaviPane.h"
    28 #include    "UssdNaviPane.h"
       
    29 #include    "UssdLogger.h"
    30  
    30  
    31 #include <AknUtils.h>
    31 #include <AknUtils.h>
    32 // CONSTANTS
    32 // CONSTANTS
    33 
    33 
    34 // Unicode char codes for GSM 03.38 7 bit ext table characters 
    34 // Unicode char codes for GSM 03.38 7 bit ext table characters 
    80 // Symbian 2nd phase constructor can leave.
    80 // Symbian 2nd phase constructor can leave.
    81 // -----------------------------------------------------------------------------
    81 // -----------------------------------------------------------------------------
    82 //
    82 //
    83 void CUssdNaviPane::ConstructL()
    83 void CUssdNaviPane::ConstructL()
    84     {
    84     {
       
    85     _LOGSTRING( "CUssdNaviPane::ConstructL =>" )
    85     
    86     
    86     CreateExtraNaviLabelL();
    87     CreateExtraNaviLabelL();
    87 
    88 
       
    89     User::LeaveIfError( iPeninputServer.Connect() );
    88     iCharacterSetConverter = CCnvCharacterSetConverter::NewL();
    90     iCharacterSetConverter = CCnvCharacterSetConverter::NewL();
    89 
    91 
    90     iCharacterSetConverter->PrepareToConvertToOrFromL(
    92     iCharacterSetConverter->PrepareToConvertToOrFromL(
    91         KCharacterSetIdentifierSms7Bit,
    93         KCharacterSetIdentifierSms7Bit,
    92         iCoeEnv->FsSession() );
    94         iCoeEnv->FsSession() );
    93 
    95 
    94     iCharacterSetConverter->SetDowngradeForExoticLineTerminatingCharacters(
    96     iCharacterSetConverter->SetDowngradeForExoticLineTerminatingCharacters(
    95         CCnvCharacterSetConverter::EDowngradeExoticLineTerminatingCharactersToJustLineFeed );
    97         CCnvCharacterSetConverter::EDowngradeExoticLineTerminatingCharactersToJustLineFeed );
    96 
    98     _LOGSTRING( "CUssdNaviPane::ConstructL <=" )
    97     }
    99     }
    98 
   100 
    99 // -----------------------------------------------------------------------------
   101 // -----------------------------------------------------------------------------
   100 // CUssdNaviPane::~CUssdNaviPane
   102 // CUssdNaviPane::~CUssdNaviPane
   101 // 
   103 // 
   102 // Destructor
   104 // Destructor
   103 // -----------------------------------------------------------------------------
   105 // -----------------------------------------------------------------------------
   104 //
   106 //
   105 CUssdNaviPane::~CUssdNaviPane()
   107 CUssdNaviPane::~CUssdNaviPane()
   106     {
   108     {
       
   109     _LOGSTRING( "CUssdNaviPane::~CUssdNaviPane =>" )
       
   110     iPeninputServer.Close();
   107     
   111     
   108     if ( iNaviPane && iNaviDecorator )
   112     if ( iNaviPane && iNaviDecorator )
   109         {
   113         {
   110         iNaviPane->Pop( iNaviDecorator );
   114         iNaviPane->Pop( iNaviDecorator );
   111         delete iNaviDecorator;
   115         delete iNaviDecorator;
   115     
   119     
   116     delete iCharacterSetConverter;
   120     delete iCharacterSetConverter;
   117     iCharacterSetConverter = NULL;
   121     iCharacterSetConverter = NULL;
   118 
   122 
   119     iNaviLabel = NULL;
   123     iNaviLabel = NULL;
   120 
   124     _LOGSTRING( "CUssdNaviPane::~CUssdNaviPane <=" )
   121     }
   125     }
   122   
   126   
   123 // ----------------------------------------------------
   127 // ----------------------------------------------------
   124 // CUssdNaviPane::CreateExtraNaviLabelL
   128 // CUssdNaviPane::CreateExtraNaviLabelL
   125 // Creates an extra navi label.
   129 // Creates an extra navi label.
   148 // ---------------------------------------------------------
   152 // ---------------------------------------------------------
   149 //
   153 //
   150 TInt CUssdNaviPane::UpdateMsgLengthL( const TDesC& aInputString, 
   154 TInt CUssdNaviPane::UpdateMsgLengthL( const TDesC& aInputString, 
   151                                              CCoeControl* aControl )
   155                                              CCoeControl* aControl )
   152     {
   156     {
       
   157     _LOGSTRING2( "CUssdNaviPane::UpdateMsgLengthL =>, aInputString=%S",
       
   158     &aInputString )
   153     TInt maxLen(0);
   159     TInt maxLen(0);
   154     const TInt txtLen = aInputString.Length();
   160     const TInt txtLen = aInputString.Length();
   155  
   161  
   156     HBufC* digitBuffer = HBufC::NewLC( EAknMaxIntegerDigits ); 
   162     HBufC* digitBuffer = HBufC::NewLC( EAknMaxIntegerDigits ); 
   157     TPtr bufPtr( digitBuffer->Des() );
   163     TPtr bufPtr( digitBuffer->Des() );
   194                 *digitBuffer );
   200                 *digitBuffer );
   195             }
   201             }
   196         }
   202         }
   197     
   203     
   198     iNaviLabel->SetTextL( *digitBuffer );
   204     iNaviLabel->SetTextL( *digitBuffer );
       
   205     _LOGSTRING(
       
   206     "CUssdNaviPane::UpdateMsgLengthL iPeninputServer.UpdateAppInfo" )
       
   207     iPeninputServer.UpdateAppInfo( *digitBuffer, EAppIndicatorMsg );
   199     CleanupStack::PopAndDestroy( digitBuffer );
   208     CleanupStack::PopAndDestroy( digitBuffer );
       
   209     _LOGSTRING2( "CUssdNaviPane::UpdateMsgLengthL <=, maxLen=%d",
       
   210     maxLen )
   200     
   211     
   201     return maxLen;
   212     return maxLen;
   202     }
   213     }
   203  
   214  
   204 
   215 
   208 // (other items were commented in a header).
   219 // (other items were commented in a header).
   209 // ---------------------------------------------------------
   220 // ---------------------------------------------------------
   210 //
   221 //
   211 TBool CUssdNaviPane::NeedsToBeSentAsUnicodeL( const TDesC& aInputString ) const
   222 TBool CUssdNaviPane::NeedsToBeSentAsUnicodeL( const TDesC& aInputString ) const
   212     {
   223     {
       
   224     _LOGSTRING2(
       
   225     "CUssdNaviPane::NeedsToBeSentAsUnicodeL =>, aInputString=%S",
       
   226     &aInputString )
   213     
   227     
   214     TBool needsToBeSentAsUnicode = EFalse;
   228     TBool needsToBeSentAsUnicode = EFalse;
   215       
   229       
   216     for ( TPtrC remainderOfInputString( aInputString ); 
   230     for ( TPtrC remainderOfInputString( aInputString ); 
   217           remainderOfInputString.Length()>0 ; )
   231           remainderOfInputString.Length()>0 ; )
   253             }
   267             }
   254         
   268         
   255         remainderOfInputString.Set( 
   269         remainderOfInputString.Set( 
   256             remainderOfInputString.Right( returnValue ) );
   270             remainderOfInputString.Right( returnValue ) );
   257         }
   271         }
       
   272     _LOGSTRING2(
       
   273     "CUssdNaviPane::NeedsToBeSentAsUnicodeL <=, needsToBeSentAsUnicode=%d",
       
   274     needsToBeSentAsUnicode )
   258     return needsToBeSentAsUnicode;
   275     return needsToBeSentAsUnicode;
   259     }
   276     }
   260 
   277 
   261 // ---------------------------------------------------------
   278 // ---------------------------------------------------------
   262 // CUssdNaviPane::CountExtendedTableChars
   279 // CUssdNaviPane::CountExtendedTableChars