|
1 /* |
|
2 * Copyright (c) 2006 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: Implementation of CConnectingViaDiscreetPopup. |
|
15 * |
|
16 */ |
|
17 |
|
18 // INCLUDE FILES |
|
19 #include <avkon.hrh> |
|
20 #include <akndiscreetpopup.h> |
|
21 #include <aknsconstants.hrh> |
|
22 #include <StringLoader.h> |
|
23 #include <utf.h> |
|
24 |
|
25 #include <cmmanagerext.h> |
|
26 #include <cmconnectionmethod.h> |
|
27 #include <cmconnectionmethodext.h> |
|
28 #include <cmpluginwlandef.h> |
|
29 |
|
30 #include <connectionuiutilities.mbg> |
|
31 #include <ConnUiUtilsNotif.rsg> |
|
32 |
|
33 #include "connectingviadiscreetpopup.h" |
|
34 |
|
35 // Connection Manager UIDs |
|
36 const TUid KDiscreetPopupUid = |
|
37 { |
|
38 0x101F84D0 |
|
39 }; |
|
40 const TUid KDiscreetPopupViewUid = |
|
41 { |
|
42 0x2 |
|
43 }; |
|
44 // Path of the app's iconfile |
|
45 _LIT( KIconFileName, "\\resource\\apps\\connectionuiutilities.mif" ); |
|
46 |
|
47 // ================= MEMBER FUNCTIONS ======================= |
|
48 |
|
49 // --------------------------------------------------------- |
|
50 // CConnectingViaDiscreetPopup::CConnectingViaDiscreetPopup |
|
51 // --------------------------------------------------------- |
|
52 // |
|
53 CConnectingViaDiscreetPopup::CConnectingViaDiscreetPopup( |
|
54 CConnectingViaDiscreetPopupNotif* aNotif) : |
|
55 CActive(EPriorityUserInput), // Standard priority |
|
56 iNotif(aNotif), iBearerType(0), |
|
57 iConnectionName(NULL), iPopupFlags(0) |
|
58 { |
|
59 } |
|
60 |
|
61 // --------------------------------------------------------- |
|
62 // CConnectingViaDiscreetPopup::NewLC |
|
63 // --------------------------------------------------------- |
|
64 // |
|
65 CConnectingViaDiscreetPopup* CConnectingViaDiscreetPopup::NewLC( |
|
66 CConnectingViaDiscreetPopupNotif* aNotif) |
|
67 { |
|
68 CConnectingViaDiscreetPopup* self = |
|
69 new (ELeave) CConnectingViaDiscreetPopup(aNotif); |
|
70 CleanupStack::PushL(self); |
|
71 self->ConstructL(); |
|
72 return self; |
|
73 } |
|
74 |
|
75 // --------------------------------------------------------- |
|
76 // CConnectingViaDiscreetPopup::NewL |
|
77 // --------------------------------------------------------- |
|
78 // |
|
79 CConnectingViaDiscreetPopup* CConnectingViaDiscreetPopup::NewL( |
|
80 CConnectingViaDiscreetPopupNotif* aNotif) |
|
81 { |
|
82 CConnectingViaDiscreetPopup* self = CConnectingViaDiscreetPopup::NewLC( |
|
83 aNotif); |
|
84 CleanupStack::Pop(); // self; |
|
85 return self; |
|
86 } |
|
87 |
|
88 // --------------------------------------------------------- |
|
89 // CConnectingViaDiscreetPopup::ConstructL |
|
90 // --------------------------------------------------------- |
|
91 // |
|
92 void CConnectingViaDiscreetPopup::ConstructL() |
|
93 { |
|
94 CActiveScheduler::Add(this); // Add to scheduler |
|
95 icmManager.OpenL(); |
|
96 } |
|
97 |
|
98 // --------------------------------------------------------- |
|
99 // CConnectingViaDiscreetPopup::~CConnectingViaDiscreetPopup |
|
100 // --------------------------------------------------------- |
|
101 // |
|
102 CConnectingViaDiscreetPopup::~CConnectingViaDiscreetPopup() |
|
103 { |
|
104 Cancel(); // Cancel any request, if outstanding |
|
105 icmManager.Close(); |
|
106 // Delete instance variables if any |
|
107 if (iConnectionName) |
|
108 { |
|
109 delete iConnectionName; |
|
110 } |
|
111 } |
|
112 |
|
113 // --------------------------------------------------------- |
|
114 // CConnectingViaDiscreetPopup::DoCancel |
|
115 // --------------------------------------------------------- |
|
116 // |
|
117 void CConnectingViaDiscreetPopup::DoCancel() |
|
118 { |
|
119 } |
|
120 |
|
121 // --------------------------------------------------------- |
|
122 // CConnectingViaDiscreetPopup::StartL |
|
123 // --------------------------------------------------------- |
|
124 // |
|
125 void CConnectingViaDiscreetPopup::StartL(TUint32 aIapId, |
|
126 TBool aConnectionAlreadyActive) |
|
127 { |
|
128 Cancel(); // Cancel any request, just to be sure |
|
129 iBearerType = 0; |
|
130 delete iConnectionName; |
|
131 iConnectionName = NULL; |
|
132 |
|
133 if (!aConnectionAlreadyActive) |
|
134 { |
|
135 iPopupFlags = KAknDiscreetPopupDurationLong; |
|
136 } |
|
137 |
|
138 RCmConnectionMethod plugin; |
|
139 CleanupClosePushL(plugin); |
|
140 if (aIapId) |
|
141 { |
|
142 plugin = icmManager.ConnectionMethodL(aIapId); |
|
143 iBearerType = plugin.GetIntAttributeL(CMManager::ECmBearerType); |
|
144 TUint32 easyWLANIapId = icmManager.EasyWlanIdL(); |
|
145 if (easyWLANIapId != aIapId) |
|
146 { |
|
147 iConnectionName = plugin.GetStringAttributeL(CMManager::ECmName); |
|
148 } |
|
149 else |
|
150 { |
|
151 iConnectionName = plugin.GetStringAttributeL(CMManager::EWlanUsedSSID); |
|
152 } |
|
153 } |
|
154 CleanupStack::PopAndDestroy(&plugin); |
|
155 |
|
156 SetActive(); // Tell scheduler a request is active |
|
157 iClientStatus = &iStatus; |
|
158 User::RequestComplete(iClientStatus, KErrNone); |
|
159 |
|
160 // Complete client request before launching dialog |
|
161 iNotif->SetCancelledFlag(ETrue); |
|
162 iNotif->CompleteL(KErrNone); |
|
163 } |
|
164 |
|
165 // --------------------------------------------------------- |
|
166 // CConnectingViaDiscreetPopup::RunL |
|
167 // --------------------------------------------------------- |
|
168 // |
|
169 void CConnectingViaDiscreetPopup::RunL() |
|
170 { |
|
171 if (iStatus == KErrNone) |
|
172 { |
|
173 TUint bitmapId = 0; |
|
174 TUint maskId = 0; |
|
175 if (iBearerType == KUidWlanBearerType) |
|
176 { |
|
177 bitmapId = EMbmConnectionuiutilitiesQgn_prop_wlan_bearer; |
|
178 maskId = EMbmConnectionuiutilitiesQgn_prop_wlan_bearer_mask; |
|
179 } |
|
180 else |
|
181 { |
|
182 bitmapId = EMbmConnectionuiutilitiesQgn_prop_wml_gprs; |
|
183 maskId = EMbmConnectionuiutilitiesQgn_prop_wml_gprs_mask; |
|
184 } |
|
185 |
|
186 // Load strings from resources |
|
187 HBufC* stringText1 = StringLoader::LoadLC( |
|
188 R_QTN_OCC_CONNECTING_DISCREET_POPUP_TEXT1); |
|
189 |
|
190 HBufC* stringText2 = NULL; |
|
191 if (iConnectionName) |
|
192 { |
|
193 stringText2 = StringLoader::LoadLC( |
|
194 R_QTN_OCC_CONNECTING_DISCREET_POPUP_TEXT2, |
|
195 *iConnectionName); |
|
196 } |
|
197 else |
|
198 { |
|
199 stringText2 = _L("''").AllocLC(); |
|
200 } |
|
201 |
|
202 CAknDiscreetPopup::ShowGlobalPopupL(*stringText1, // first text row |
|
203 *stringText2, // second text row |
|
204 KAknsIIDDefault, // icon skin id |
|
205 KIconFileName, // bitmap file path |
|
206 bitmapId, // bitmap id |
|
207 maskId, // mask id |
|
208 iPopupFlags, // flags |
|
209 0, // command id |
|
210 NULL, // command observer |
|
211 KDiscreetPopupUid, // application to be launched |
|
212 KDiscreetPopupViewUid); // view to be activated |
|
213 CleanupStack::PopAndDestroy(2); |
|
214 } |
|
215 |
|
216 // Cleanup |
|
217 iNotif->Cancel(); |
|
218 } |
|
219 |
|
220 // --------------------------------------------------------- |
|
221 // CConnectingViaDiscreetPopup::RunError |
|
222 // --------------------------------------------------------- |
|
223 // |
|
224 TInt CConnectingViaDiscreetPopup::RunError(TInt aError) |
|
225 { |
|
226 return aError; |
|
227 } |