cellular/PsetNotesUi/Src/PsuiQueryDialog.cpp
author Pat Downey <patd@symbian.org>
Wed, 01 Sep 2010 12:15:03 +0100
branchRCL_3
changeset 20 987c9837762f
parent 19 7d48bed6ce0c
permissions -rw-r--r--
Revert incorrect RCL_3 drop: Revision: 201033 Kit: 201035
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     1
/*
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     2
* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). 
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     3
* All rights reserved.
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     8
*
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     9
* Initial Contributors:
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    11
*
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    12
* Contributors:
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    13
*
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    14
* Description:  Query dialog for handling key events.
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    15
*
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    16
*/
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    17
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    18
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    19
// INCLUDE FILES
20
987c9837762f Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 19
diff changeset
    20
#include "PsuiQueryDialog.h"
0
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    21
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    22
// ================= MEMBER FUNCTIONS =======================
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    23
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    24
// C++ default constructor can NOT contain any code, that
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    25
// might leave.
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    26
//
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    27
CPsuiQueryDialog::CPsuiQueryDialog( CAknQueryDialog::TTone aTone ) :
20
987c9837762f Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 19
diff changeset
    28
	CAknQueryDialog( aTone ) 
0
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    29
    {
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    30
    }
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    31
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    32
// ---------------------------------------------------------------------------
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    33
// Symbian OS two-phased constructor.
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    34
// ---------------------------------------------------------------------------
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    35
CPsuiQueryDialog* CPsuiQueryDialog::NewL( CAknQueryDialog::TTone aTone )
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    36
    {  
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    37
    CPsuiQueryDialog* self = new( ELeave )CPsuiQueryDialog( aTone );
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    38
    return self;
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    39
    }
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    40
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    41
// ---------------------------------------------------------------------------
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    42
// Destructor
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    43
// ---------------------------------------------------------------------------
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    44
// 
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    45
CPsuiQueryDialog::~CPsuiQueryDialog()
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    46
    {
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    47
    }
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    48
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    49
// ---------------------------------------------------------------------------
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    50
// CPsuiQueryDialog::OfferKeyEventL
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    51
// ---------------------------------------------------------------------------
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    52
//
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    53
TKeyResponse CPsuiQueryDialog::OfferKeyEventL( const TKeyEvent& aKeyEvent,
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    54
    TEventCode aType )
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    55
    {
20
987c9837762f Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 19
diff changeset
    56
    const TBool noKeyReleased = 
987c9837762f Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 19
diff changeset
    57
        ( aKeyEvent.iScanCode == EStdKeyNo || aKeyEvent.iCode == EKeyNo  ) &&
987c9837762f Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 19
diff changeset
    58
          aType == EEventKeyUp;    
987c9837762f Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 19
diff changeset
    59
    const TBool escPressed = aKeyEvent.iCode == EKeyEscape;
987c9837762f Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 19
diff changeset
    60
    
987c9837762f Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 19
diff changeset
    61
    // AknDialogShutter sends esc keys so dismiss dialog 
987c9837762f Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 19
diff changeset
    62
	if ( noKeyReleased || escPressed )
987c9837762f Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 19
diff changeset
    63
		{
987c9837762f Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 19
diff changeset
    64
		// End -key was pressed, so exit this query dialog
987c9837762f Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 19
diff changeset
    65
		TryExitL( EKeyNo ); 
987c9837762f Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 19
diff changeset
    66
		RDebug::Printf("PSETNOTESUI: exiting dialog");
987c9837762f Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 19
diff changeset
    67
		return EKeyWasConsumed;
987c9837762f Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 19
diff changeset
    68
		}
0
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    69
20
987c9837762f Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 19
diff changeset
    70
	return EKeyWasNotConsumed;
0
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    71
    }
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    72
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    73
// ---------------------------------------------------------------------------
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    74
// CPsuiQueryDialog::OkToExitL
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    75
// ---------------------------------------------------------------------------
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    76
//
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    77
TBool CPsuiQueryDialog::OkToExitL( TInt /*aCommand*/ )
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    78
    {
20
987c9837762f Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents: 19
diff changeset
    79
	// Dismiss query
0
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    80
    return ETrue;
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    81
    }
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    82
ff3b6d0fd310 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    83
// End of File