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: Prompt Dialog implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <hb/hbcore/hbsymbianvariant.h> |
|
19 #include "devicedialogobserver.h" |
|
20 |
|
21 _LIT(KButton, "button"); |
|
22 |
|
23 // --------------------------------------------------------- |
|
24 // CDeviceDialogObserver* CDeviceDialogObserver::NewL |
|
25 // --------------------------------------------------------- |
|
26 // |
|
27 CDeviceDialogObserver* CDeviceDialogObserver::NewL( CCellularDataConfirmation* aNotifier ) |
|
28 { |
|
29 CDeviceDialogObserver* self = new ( ELeave ) CDeviceDialogObserver( aNotifier ); |
|
30 return self; |
|
31 } |
|
32 |
|
33 // --------------------------------------------------------- |
|
34 // CDeviceDialogObserver::CDeviceDialogObserver |
|
35 // --------------------------------------------------------- |
|
36 // |
|
37 CDeviceDialogObserver::CDeviceDialogObserver( CCellularDataConfirmation* aNotifier ): |
|
38 iNotifier( aNotifier ) |
|
39 { |
|
40 |
|
41 } |
|
42 |
|
43 // --------------------------------------------------------- |
|
44 // CDeviceDialogObserver::~CDeviceDialogObserver() |
|
45 // --------------------------------------------------------- |
|
46 // |
|
47 CDeviceDialogObserver::~CDeviceDialogObserver() |
|
48 { |
|
49 |
|
50 } |
|
51 |
|
52 // --------------------------------------------------------- |
|
53 // void CConfirmationQuery::SetChoices |
|
54 // --------------------------------------------------------- |
|
55 // |
|
56 void CDeviceDialogObserver::SetChoices( RArray<TMsgQueryLinkedResults>& aChoices ) |
|
57 { |
|
58 iChoiceIds = aChoices; |
|
59 } |
|
60 |
|
61 // --------------------------------------------------------- |
|
62 // void CDeviceDialogObserver::DataReceived |
|
63 // --------------------------------------------------------- |
|
64 // |
|
65 void CDeviceDialogObserver::DataReceived( CHbSymbianVariantMap& aData ) |
|
66 { |
|
67 // The key that is returned by the promptdialog is "button", |
|
68 // meaning the id of the pressed button. |
|
69 TInt intData = *(TInt*)(aData.Get(KButton)->Data()); |
|
70 |
|
71 TInt status = KErrNone; |
|
72 |
|
73 iNotifier->SetSelectedChoice( iChoiceIds[intData-1] ); |
|
74 TRAP_IGNORE( iNotifier->CompleteL( status )); |
|
75 |
|
76 } |
|
77 |
|
78 // --------------------------------------------------------- |
|
79 // void CDeviceDialogObserver::DeviceDialogClosed |
|
80 // --------------------------------------------------------- |
|
81 // |
|
82 void CDeviceDialogObserver::DeviceDialogClosed( TInt /*aCompletionCode*/ ) |
|
83 { |
|
84 // Dialog was closed, let's complete with that error code |
|
85 TInt status = KErrCancel; |
|
86 iNotifier->SetSelectedChoice( EMsgQueryCancelled ); |
|
87 TRAP_IGNORE( iNotifier->CompleteL( status )); |
|
88 } |
|
89 |
|
90 |
|