messagingappbase/msgavkon/muiu_internal/servicesinternal/src/MuiuSendKeyAcceptingQueryDialog.cpp
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 /*
       
     2 * Copyright (c) 2002 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: MuiuSendKeyAcceptingQueryDialog implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 // INCLUDE FILES
       
    22 #include <StringLoader.h>
       
    23 #include <muiu_internal.rsg>
       
    24 #include <AknPhoneNumberGrouping.h>       //CAknPhoneNumberGrouping
       
    25 #include <data_caging_path_literals.hrh> // KDC_RESOURCE_FILES_DIR
       
    26 #include "MuiuSendKeyAcceptingQueryDialog.h"
       
    27 
       
    28 // CONSTANTS
       
    29 const TUint KMuiuLREMarker = 0x202A;  // Start of phone number. Arabic lanquage need this
       
    30 const TUint KMuiuPDFMarker = 0x202C;  // End of phone number.   Arabic lanquage need this
       
    31 const TInt KLREandPDFMarkSize = 2;   // Size LRE mark and PDF mark need.
       
    32 const TInt KStringsArrayGranularity = 2;
       
    33 _LIT( KDirAndMuiuResFileName,"muiu_internal.rsc" );
       
    34 
       
    35 
       
    36 
       
    37 // ========== MEMBER FUNCTIONS =============================
       
    38 
       
    39 
       
    40 
       
    41 // ---------------------------------------------------------
       
    42 // CMuiuSendKeyAcceptingQueryDialog::NewL
       
    43 //
       
    44 // 
       
    45 // ---------------------------------------------------------
       
    46 CMuiuSendKeyAcceptingQueryDialog* CMuiuSendKeyAcceptingQueryDialog::NewL( const TDesC& aNumber,
       
    47                                                                           const TDesC& aName, 
       
    48                                                                           const TTone& aTone )
       
    49     {
       
    50     CMuiuSendKeyAcceptingQueryDialog* self = 
       
    51                                       new ( ELeave ) CMuiuSendKeyAcceptingQueryDialog( aTone );
       
    52     CleanupStack::PushL( self );
       
    53     self->ConstructL( aNumber, aName );
       
    54     CleanupStack::Pop( self );
       
    55     return self;
       
    56     }
       
    57 
       
    58 // ---------------------------------------------------------
       
    59 // CMuiuSendKeyAcceptingQueryDialog::CMuiuSendKeyAcceptingQueryDialog
       
    60 //
       
    61 //
       
    62 // ---------------------------------------------------------
       
    63 CMuiuSendKeyAcceptingQueryDialog::CMuiuSendKeyAcceptingQueryDialog( const TTone aTone )
       
    64     : CAknQueryDialog( aTone ), iResources( *CCoeEnv::Static() )
       
    65     {
       
    66     }
       
    67 
       
    68 // ---------------------------------------------------------
       
    69 // CMuiuSendKeyAcceptingQueryDialog::~CMuiuSendKeyAcceptingQueryDialog
       
    70 //
       
    71 //
       
    72 // ---------------------------------------------------------
       
    73 CMuiuSendKeyAcceptingQueryDialog::~CMuiuSendKeyAcceptingQueryDialog()
       
    74     {
       
    75     iResources.Close();
       
    76     }
       
    77 
       
    78 // ---------------------------------------------------------
       
    79 // CMuiuSendKeyAcceptingQueryDialog::OfferKeyEventL
       
    80 //
       
    81 //
       
    82 // ---------------------------------------------------------
       
    83 TKeyResponse CMuiuSendKeyAcceptingQueryDialog::OfferKeyEventL( const TKeyEvent& aKeyEvent, 
       
    84                                                                TEventCode aType )
       
    85     {
       
    86     if ( aType == EEventKey && aKeyEvent.iCode == EKeyYes )
       
    87         {
       
    88         TryExitL( EKeyYes );
       
    89         return EKeyWasConsumed;
       
    90         }
       
    91     else
       
    92         {
       
    93         return CAknDialog::OfferKeyEventL( aKeyEvent, aType );
       
    94         }
       
    95     }
       
    96 
       
    97 // ---------------------------------------------------------
       
    98 // CMuiuSendKeyAcceptingQueryDialog::OkToExitL
       
    99 //
       
   100 //
       
   101 // ---------------------------------------------------------
       
   102 TBool CMuiuSendKeyAcceptingQueryDialog::OkToExitL( TInt aButtonId )
       
   103     {
       
   104     if ( EKeyYes == aButtonId )
       
   105         {
       
   106         return ETrue;
       
   107         }
       
   108     else
       
   109         {
       
   110         TBool retValue( CAknDialog::OkToExitL( aButtonId ) );
       
   111         return retValue;
       
   112         }
       
   113     }
       
   114 
       
   115 // ---------------------------------------------------------
       
   116 // CMuiuSendKeyAcceptingQueryDialog::MappedCommandId
       
   117 //
       
   118 //
       
   119 // ---------------------------------------------------------
       
   120 TInt CMuiuSendKeyAcceptingQueryDialog::MappedCommandId( TInt aButtonId )
       
   121     {
       
   122     switch( aButtonId )
       
   123         {
       
   124         case EKeyYes:
       
   125             return EKeyYes;
       
   126         default :
       
   127             return CEikDialog::MappedCommandId( aButtonId );
       
   128         }
       
   129     }
       
   130 
       
   131 
       
   132 // ---------------------------------------------------------
       
   133 // CMuiuSendKeyAcceptingQueryDialog::ConstructL
       
   134 //
       
   135 // Symbian OS default constructor can leave.
       
   136 // ---------------------------------------------------------
       
   137 void CMuiuSendKeyAcceptingQueryDialog::ConstructL( const TDesC& aNumber, const TDesC& aName )
       
   138     {
       
   139     TParse parse;
       
   140     parse.Set( KDirAndMuiuResFileName, &KDC_RESOURCE_FILES_DIR, NULL ); 
       
   141     TFileName fileName( parse.FullName() );
       
   142     CDesCArrayFlat* strings = new ( ELeave ) CDesCArrayFlat( KStringsArrayGranularity );
       
   143     CleanupStack::PushL( strings );
       
   144     strings->AppendL( aName );  // %0U
       
   145     HBufC* bufNumber = CAknPhoneNumberGrouping::CreateGroupedPhoneNumberL( aNumber ); 
       
   146     CleanupStack::PushL( bufNumber );
       
   147     TPtr   bufNumberPtr = bufNumber->Des();
       
   148     AknTextUtils::DisplayTextLanguageSpecificNumberConversion( bufNumberPtr );
       
   149 
       
   150     // LRE and PDF mark is needed for successful Arabic/Hebrew number conversion
       
   151     HBufC* bufLREandPDF = HBufC::NewLC( bufNumberPtr.Length() + KLREandPDFMarkSize );
       
   152     TPtr   bufLREandPDFPtr = bufLREandPDF->Des();
       
   153     bufLREandPDFPtr.Append( KMuiuLREMarker );
       
   154     bufLREandPDFPtr.Append( bufNumberPtr );
       
   155     bufLREandPDFPtr.Append( KMuiuPDFMarker );
       
   156 
       
   157     strings->AppendL( bufLREandPDFPtr ); // %1U
       
   158     iResources.OpenL( fileName );
       
   159     
       
   160     HBufC* prompt = NULL;
       
   161     if( aName.Length() > 0 )
       
   162         {
       
   163         // definition of qtn_muiu_quest_call is "Call to:\n%0U\n%1U"
       
   164         prompt = StringLoader::LoadLC( R_QTN_MUIU_QUEST_CALL, *strings );
       
   165         }
       
   166     else
       
   167         {
       
   168         // definition of qtn_quest_call is "Call to:\n%U"
       
   169         prompt = StringLoader::LoadLC( R_QTN_QUEST_CALL, *bufLREandPDF );
       
   170         }
       
   171     SetPromptL(*prompt);
       
   172     CleanupStack::PopAndDestroy( 4, strings ); // strings,bufNumber,bufLREandPDF,prompt,
       
   173     }
       
   174 
       
   175 //  End of File