|
1 /* |
|
2 * Copyright (c) 2010 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: RuntimeUI QT to show error notes and security queries. |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "runtimeuiqt.h" |
|
19 |
|
20 #include <hbdevicemessageboxsymbian.h> |
|
21 #include <hbpopup.h> |
|
22 |
|
23 #include "logger.h" |
|
24 |
|
25 using namespace java::runtimeui; |
|
26 |
|
27 OS_EXPORT void RuntimeUiQt::errorL(const TDesC& /*aAppName*/, const TDesC& aShortMsg, const TDesC& aDetailedMsg) |
|
28 { |
|
29 CHbDeviceMessageBoxSymbian* messageBox |
|
30 = CHbDeviceMessageBoxSymbian::NewL(CHbDeviceMessageBoxSymbian::EWarning); |
|
31 CleanupStack::PushL(messageBox); |
|
32 |
|
33 messageBox->SetTextL(aShortMsg); |
|
34 messageBox->SetTimeoutL(HbPopup::NoTimeout); |
|
35 |
|
36 // Read localised versions instead of hard coded values. |
|
37 _LIT(KOkButtonText, "OK"); |
|
38 |
|
39 if (aDetailedMsg.Size() > 0) |
|
40 { |
|
41 _LIT(KDetailsButtonText, "Details"); |
|
42 |
|
43 messageBox->SetButtonTextL(CHbDeviceMessageBoxSymbian::EAcceptButton, KOkButtonText); |
|
44 messageBox->SetButtonL(CHbDeviceMessageBoxSymbian::EAcceptButton, ETrue); |
|
45 messageBox->SetButtonTextL(CHbDeviceMessageBoxSymbian::ERejectButton, KDetailsButtonText); |
|
46 messageBox->SetButtonL(CHbDeviceMessageBoxSymbian::ERejectButton, ETrue); |
|
47 |
|
48 if (messageBox->ExecL() == CHbDeviceMessageBoxSymbian::ERejectButton) |
|
49 { |
|
50 messageBox->SetButtonL(CHbDeviceMessageBoxSymbian::ERejectButton, EFalse); |
|
51 messageBox->SetTextL(aDetailedMsg); |
|
52 (void)messageBox->ExecL(); |
|
53 } |
|
54 } |
|
55 else |
|
56 { |
|
57 messageBox->SetButtonTextL(CHbDeviceMessageBoxSymbian::EAcceptButton, KOkButtonText); |
|
58 messageBox->SetButtonL(CHbDeviceMessageBoxSymbian::EAcceptButton, ETrue); |
|
59 (void)messageBox->ExecL(); |
|
60 } |
|
61 messageBox->Close(); |
|
62 CleanupStack::PopAndDestroy(messageBox); |
|
63 } |
|
64 |
|
65 OS_EXPORT int RuntimeUiQt::confirmL(const TDesC& /*aAppName*/, const TDesC& aQuestion) |
|
66 { |
|
67 CHbDeviceMessageBoxSymbian* messageBox |
|
68 = CHbDeviceMessageBoxSymbian::NewL(CHbDeviceMessageBoxSymbian::EWarning); |
|
69 CleanupStack::PushL(messageBox); |
|
70 |
|
71 messageBox->SetTextL(aQuestion); |
|
72 messageBox->SetTimeoutL(HbPopup::NoTimeout); |
|
73 |
|
74 // Read localised versions instead of hard coded values. |
|
75 _LIT(KAllowButtonText, "Allow"); |
|
76 _LIT(KDenyButtonText, "Deny"); |
|
77 |
|
78 messageBox->SetButtonTextL(CHbDeviceMessageBoxSymbian::EAcceptButton, KAllowButtonText); |
|
79 messageBox->SetButtonL(CHbDeviceMessageBoxSymbian::EAcceptButton, ETrue); |
|
80 messageBox->SetButtonTextL(CHbDeviceMessageBoxSymbian::ERejectButton, KDenyButtonText); |
|
81 messageBox->SetButtonL(CHbDeviceMessageBoxSymbian::ERejectButton, ETrue); |
|
82 |
|
83 // by default the answer is Allow |
|
84 int result = 0; |
|
85 if (messageBox->ExecL() == CHbDeviceMessageBoxSymbian::ERejectButton) |
|
86 { |
|
87 // change the answer to Deny |
|
88 result = 1; |
|
89 } |
|
90 |
|
91 messageBox->Close(); |
|
92 CleanupStack::PopAndDestroy(messageBox); |
|
93 return result; |
|
94 } |