connectionutilities/ConnectionDialogs/ConnectionUiUtilities/NotifSrc/ConfirmationQuery.cpp
changeset 0 5a93021fdf25
child 1 40cb640ef159
equal deleted inserted replaced
-1:000000000000 0:5a93021fdf25
       
     1 /*
       
     2 * Copyright (c) 2006 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:  Implementation of class CConfirmationQuery.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "ConfirmationQuery.h"
       
    21 #include "ConfirmationQueryNotif.h"
       
    22 #include "ConnectionUiUtilitiesCommon.h"
       
    23 #include "ConnectionDialogsLogger.h"
       
    24 #include "ExpiryTimer.h"
       
    25 
       
    26 #include <uikon/eiksrvui.h>
       
    27 #include <StringLoader.h>
       
    28 #include <ConnUiUtilsNotif.rsg>
       
    29 
       
    30 
       
    31 
       
    32 // CONSTANTS
       
    33 #if defined(_DEBUG)
       
    34 _LIT( KErrNullPointer, "NULL pointer" );
       
    35 #endif
       
    36 
       
    37 
       
    38 // ================= MEMBER FUNCTIONS =======================
       
    39 //
       
    40 // ---------------------------------------------------------
       
    41 // CConfirmationQuery::CConfirmationQuery
       
    42 // ---------------------------------------------------------
       
    43 //
       
    44 CConfirmationQuery::CConfirmationQuery( CConfirmationQueryNotif* aNotif )
       
    45 : CAknListQueryDialog( &iDummy ),
       
    46   iNotif( aNotif ),
       
    47   iButtonGroupPreviouslyChanged( EFalse )
       
    48    {
       
    49    }
       
    50     
       
    51     
       
    52 // ---------------------------------------------------------
       
    53 // CConfirmationQuery::~CConfirmationQuery
       
    54 // ---------------------------------------------------------
       
    55 //
       
    56 CConfirmationQuery::~CConfirmationQuery()
       
    57     {
       
    58     STATIC_CAST( CEikServAppUi*, 
       
    59                  CCoeEnv::Static()->AppUi() )->SuppressAppSwitching( EFalse );
       
    60     delete iExpiryTimer;
       
    61     }
       
    62 
       
    63 
       
    64 
       
    65 // ---------------------------------------------------------
       
    66 // CConfirmationQuery::OkToExitL
       
    67 // ---------------------------------------------------------
       
    68 //
       
    69 TBool CConfirmationQuery::OkToExitL( TInt aButtonId )
       
    70     {
       
    71     CLOG_ENTERFN( "CConfirmationQuery::OkToExitL" );
       
    72     TBool result( EFalse );
       
    73     TInt status = KErrCancel;
       
    74     if ( aButtonId == EAknSoftkeySelect || 
       
    75          aButtonId == EAknSoftkeyDone || aButtonId == EAknSoftkeyOk )
       
    76         {
       
    77         iNotif->SetSelectedChoiceL( iChoiceIds[ListBox()->CurrentItemIndex()] );
       
    78         result = ETrue;
       
    79         status = KErrNone;
       
    80         }
       
    81     else if ( aButtonId == EAknSoftkeyCancel )
       
    82         {
       
    83         status = KErrCancel;
       
    84         result = ETrue;
       
    85         }
       
    86 
       
    87     if ( result )
       
    88         {
       
    89         CLOG_WRITEF( _L( "aButtonId = %d" ), aButtonId );
       
    90         __ASSERT_DEBUG( iNotif, User::Panic( KErrNullPointer, KErrNone ) );
       
    91         iNotif->CompleteL( status );
       
    92         }
       
    93 
       
    94     CLOG_LEAVEFN( "CConfirmationQuery::OkToExitL" );
       
    95 
       
    96     return result;  
       
    97     }
       
    98     
       
    99     
       
   100 // ---------------------------------------------------------
       
   101 // CConfirmationQuery::PreLayoutDynInitL()
       
   102 // ---------------------------------------------------------
       
   103 //
       
   104 void CConfirmationQuery::PreLayoutDynInitL()
       
   105     {      
       
   106     CAknListQueryDialog::PreLayoutDynInitL();
       
   107 
       
   108     STATIC_CAST( CEikServAppUi*, 
       
   109                 CCoeEnv::Static()->AppUi() )->SuppressAppSwitching( ETrue );
       
   110 
       
   111     iExpiryTimer = CExpiryTimer::NewL( *this );
       
   112     iExpiryTimer->Start();
       
   113     }
       
   114 
       
   115 
       
   116 // ---------------------------------------------------------
       
   117 // CConfirmationQuery::TryExitL()
       
   118 // ---------------------------------------------------------
       
   119 //
       
   120 void CConfirmationQuery::TryExitL( TInt aButtonId )
       
   121     {
       
   122     CLOG_ENTERFN( "CConfirmationQuery::TryExitL" );
       
   123     CAknListQueryDialog::TryExitL( aButtonId );
       
   124     CLOG_LEAVEFN( "CConfirmationQuery::TryExitL" );
       
   125     }
       
   126 
       
   127 // ---------------------------------------------------------
       
   128 // CConfirmationQuery::NeedToDismissQueryL
       
   129 // ---------------------------------------------------------
       
   130 //
       
   131 TBool CConfirmationQuery::NeedToDismissQueryL(const TKeyEvent& aKeyEvent)
       
   132     {
       
   133     if (aKeyEvent.iCode == EKeyPhoneSend)
       
   134         {
       
   135         TryExitL(EEikBidCancel);
       
   136         return ETrue;
       
   137         }
       
   138         
       
   139     return EFalse;
       
   140     }
       
   141 
       
   142 
       
   143 // ---------------------------------------------------------
       
   144 // CConfirmationQuery::SetChoices
       
   145 // ---------------------------------------------------------
       
   146 //
       
   147 void CConfirmationQuery::SetChoices( RArray<TMsgQueryLinkedResults> aChoices )
       
   148     {
       
   149     iChoiceIds = aChoices;
       
   150     }
       
   151 
       
   152 void CConfirmationQuery::HandleTimedOut()
       
   153     {
       
   154     TRAP_IGNORE( TryExitL(EAknSoftkeyCancel) );
       
   155     }
       
   156 
       
   157 
       
   158 // End of File