|
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 |
|
19 // INCLUDE FILES |
|
20 #include <StringLoader.h> |
|
21 #include <connuiutilsnotif.rsg> |
|
22 #include <hb/hbcore/hbsymbianvariant.h> |
|
23 #include "ConnectionDialogsLogger.h" |
|
24 #include "cellulardataconfirmation.h" |
|
25 #include "ConnectionDialogsNotifBase.h" |
|
26 #include "ConnectionDialogsUidDefs.h" |
|
27 #include "devicedialogobserver.h" |
|
28 |
|
29 |
|
30 // CONSTANTS |
|
31 _LIT( KHomenetwork, "homenetwork" ); |
|
32 _LIT( KType, "com.nokia.ipconnmgmt.promptdialog/1.0" ); |
|
33 |
|
34 // --------------------------------------------------------- |
|
35 // CCellularDataConfirmation::CCellularDataConfirmation() |
|
36 // --------------------------------------------------------- |
|
37 // |
|
38 CCellularDataConfirmation::CCellularDataConfirmation(): |
|
39 iDialog( NULL ), iObserver( NULL ), iCompleted( EFalse ), |
|
40 iStatus( NULL ), iResult( NULL ) |
|
41 { |
|
42 } |
|
43 |
|
44 // --------------------------------------------------------- |
|
45 // CCellularDataConfirmation::~CCellularDataConfirmation() |
|
46 // --------------------------------------------------------- |
|
47 // |
|
48 CCellularDataConfirmation::~CCellularDataConfirmation() |
|
49 { |
|
50 CLOG_ENTERFN( "CCellularDataConfirmation::~CCellularDataConfirmation" ); |
|
51 delete iDialog; |
|
52 delete iObserver; |
|
53 CLOG_LEAVEFN( "CCellularDataConfirmation::~CCellularDataConfirmation" ); |
|
54 } |
|
55 |
|
56 // --------------------------------------------------------- |
|
57 // CCellularDataConfirmation* CCellularDataConfirmation::NewL |
|
58 // --------------------------------------------------------- |
|
59 // |
|
60 CCellularDataConfirmation* CCellularDataConfirmation::NewL( ) |
|
61 { |
|
62 CLOG_ENTERFN( "CCellularDataConfirmation::NewL" ); |
|
63 CCellularDataConfirmation* self = new ( ELeave ) CCellularDataConfirmation(); |
|
64 CleanupStack::PushL( self ); |
|
65 self->ConstructL( ); |
|
66 CleanupStack::Pop(); |
|
67 CLOG_LEAVEFN( "CCellularDataConfirmation::NewL" ); |
|
68 return self; |
|
69 } |
|
70 |
|
71 void CCellularDataConfirmation::ConstructL() |
|
72 { |
|
73 } |
|
74 |
|
75 // --------------------------------------------------------- |
|
76 // void CCellularDataConfirmation::StartL |
|
77 // --------------------------------------------------------- |
|
78 // |
|
79 void CCellularDataConfirmation::StartL( TMsgQueryLinkedResults& aResult, |
|
80 const TBool aHomeNetwork, |
|
81 TRequestStatus& aStatus ) |
|
82 { |
|
83 CLOG_ENTERFN( "CCellularDataConfirmation::StartL" ); |
|
84 aResult = EMsgQueryCancelled; |
|
85 iResult = &aResult; |
|
86 aStatus = KRequestPending; |
|
87 iStatus = &aStatus; |
|
88 |
|
89 // Create the list box items |
|
90 RArray<TMsgQueryLinkedResults> choices; |
|
91 |
|
92 // The variant map is needed to construct the dialog correctly, |
|
93 // information whether we are in home network is needed |
|
94 if ( aHomeNetwork ) |
|
95 { |
|
96 choices.Append( EMsgQueryAutomatically ); |
|
97 choices.Append( EMsgQueryThisTime ); |
|
98 choices.Append( EMsgQueryCancelled ); |
|
99 } |
|
100 else |
|
101 { |
|
102 choices.Append( EMsgQueryThisTime ); |
|
103 choices.Append( EMsgQueryAutomatically ); |
|
104 choices.Append( EMsgQueryCancelled ); |
|
105 } |
|
106 |
|
107 // Observer is needed in order to get the user inputs |
|
108 iObserver = CDeviceDialogObserver::NewL( this ); |
|
109 iDialog = CHbDeviceDialogSymbian::NewL(); |
|
110 |
|
111 // Set the choice order for the observer so that it knows which button press |
|
112 // means which choice |
|
113 iObserver->SetChoices( choices ); |
|
114 |
|
115 // Create the variant data information for the plugin |
|
116 CHbSymbianVariantMap* map = CHbSymbianVariantMap::NewL(); |
|
117 CleanupStack::PushL( map ); |
|
118 CHbSymbianVariant *variant |
|
119 = CHbSymbianVariant::NewL( &aHomeNetwork, CHbSymbianVariant::EBool ); |
|
120 CleanupStack::PushL( variant ); |
|
121 User::LeaveIfError( map->Add( KHomenetwork, variant ) ); |
|
122 CleanupStack::Pop( variant ); // map's cleanup sequence handles variant. |
|
123 |
|
124 // Show the dialog. |
|
125 User::LeaveIfError( iDialog->Show( KType, *map, iObserver ) ); |
|
126 |
|
127 CleanupStack::PopAndDestroy( map ); |
|
128 CLOG_LEAVEFN( "CCellularDataConfirmation::StartL" ); |
|
129 } |
|
130 |
|
131 // --------------------------------------------------------- |
|
132 // void CConfirmationQueryNotif::CompleteL( TInt aStatus ) |
|
133 // --------------------------------------------------------- |
|
134 // |
|
135 void CCellularDataConfirmation::CompleteL( TInt aStatus ) |
|
136 { |
|
137 CLOG_ENTERFN( "CCellularDataConfirmation::CompleteL" ); |
|
138 if ( !iCompleted ) |
|
139 { |
|
140 iCompleted = ETrue; |
|
141 User::RequestComplete( iStatus, aStatus ); |
|
142 } |
|
143 CLOG_LEAVEFN( "CCellularDataConfirmation::CompleteL" ); |
|
144 } |
|
145 |
|
146 // --------------------------------------------------------------- |
|
147 // void CConfirmationQueryNotif::SetSelectedChoiceL( TInt aChoice ) |
|
148 // ---------------------------------------------------------------- |
|
149 // |
|
150 void CCellularDataConfirmation::SetSelectedChoice ( TInt aChoice ) |
|
151 { |
|
152 CLOG_ENTERFN( "CCellularDataConfirmation::SetSelectedChoice" ); |
|
153 *iResult = (TMsgQueryLinkedResults)aChoice; |
|
154 CLOG_LEAVEFN( "CCellularDataConfirmation::SetSelectedChoice" ); |
|
155 } |
|
156 |
|
157 // --------------------------------------------------------------- |
|
158 // void CCellularDataConfirmation::Cancel() |
|
159 // ---------------------------------------------------------------- |
|
160 // |
|
161 void CCellularDataConfirmation::Cancel() |
|
162 { |
|
163 CLOG_ENTERFN( "CCellularDataConfirmation::Cancel" ); |
|
164 if ( !iCompleted ) |
|
165 { |
|
166 iDialog->Cancel(); |
|
167 User::RequestComplete( iStatus, KErrCancel ); |
|
168 } |
|
169 CLOG_LEAVEFN( "CCellularDataConfirmation::Cancel" ); |
|
170 } |
|
171 |