|
1 /* |
|
2 * Copyright (c) 2008 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: Global list message query dialog implementation. |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <uikon.hrh> // EKeyOk |
|
19 #include "AknListMsgQueryNotificationDialog.h" |
|
20 #include "AknNotifyPlugin.hrh" |
|
21 #include "avkon.hrh" |
|
22 |
|
23 CAknListMsgQueryNotificationDialog::CAknListMsgQueryNotificationDialog( |
|
24 TInt* aIndex, |
|
25 MAknListQueryNotificationCallback* aCallBack, |
|
26 CAknListMsgQueryNotificationDialog** aSelfPtr, |
|
27 TInt aAcceptKeyId, |
|
28 TInt aCancelKeyId) |
|
29 : CAknListQueryDialog(aIndex), |
|
30 iCallBack(aCallBack), |
|
31 iSelfPtr(aSelfPtr), |
|
32 iAcceptKeyId(aAcceptKeyId), |
|
33 iCancelKeyId(aCancelKeyId) |
|
34 { |
|
35 } |
|
36 |
|
37 CAknListMsgQueryNotificationDialog::~CAknListMsgQueryNotificationDialog() |
|
38 { |
|
39 if (iSelfPtr) |
|
40 { |
|
41 *iSelfPtr = NULL; |
|
42 } |
|
43 } |
|
44 |
|
45 TKeyResponse CAknListMsgQueryNotificationDialog::OfferKeyEventL( |
|
46 const TKeyEvent& aKeyEvent, |
|
47 TEventCode aType) |
|
48 { |
|
49 |
|
50 if (aKeyEvent.iScanCode == EStdKeyYes) |
|
51 { |
|
52 return EKeyWasConsumed; |
|
53 } |
|
54 |
|
55 if (aType != EEventKey) |
|
56 { |
|
57 return EKeyWasNotConsumed; |
|
58 } |
|
59 |
|
60 TInt code = aKeyEvent.iCode; |
|
61 |
|
62 switch (code) |
|
63 { |
|
64 case EKeyOK: |
|
65 TryExitL(EAknSoftkeyOk); |
|
66 return EKeyWasConsumed; |
|
67 case EKeyEscape: |
|
68 TryExitL(EAknSoftkeyCancel); |
|
69 return EKeyWasConsumed; |
|
70 default: |
|
71 break; |
|
72 } |
|
73 |
|
74 return CAknListQueryDialog::OfferKeyEventL(aKeyEvent,aType); |
|
75 } |
|
76 |
|
77 TBool CAknListMsgQueryNotificationDialog::OkToExitL(TInt aButtonId) |
|
78 { |
|
79 TInt ret = -1; |
|
80 |
|
81 // Get the current item index only if the command is an accept command. |
|
82 if (aButtonId == EAknSoftkeyOk || (iAcceptKeyId && aButtonId == iAcceptKeyId)) |
|
83 { |
|
84 ret = ListBox()->CurrentItemIndex(); |
|
85 } |
|
86 |
|
87 iCallBack->QueryDismissedL(ret); |
|
88 |
|
89 if (aButtonId == EAknSoftkeyCancel || |
|
90 aButtonId == EAknSoftkeyOk || |
|
91 (iCancelKeyId && (aButtonId == iCancelKeyId)) || |
|
92 (iAcceptKeyId && (aButtonId == iAcceptKeyId))) |
|
93 { |
|
94 return ETrue; |
|
95 } |
|
96 |
|
97 return EFalse; |
|
98 } |
|
99 |
|
100 // End of file |