58
|
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 |
{
|
|
127 |
Cancel(); // Cancel any request, just to be sure
|
|
128 |
iBearerType = 0;
|
|
129 |
delete iConnectionName;
|
|
130 |
iConnectionName = NULL;
|
|
131 |
iPopupFlags = KAknDiscreetPopupDurationLong;
|
|
132 |
|
|
133 |
RCmConnectionMethod plugin;
|
|
134 |
CleanupClosePushL(plugin);
|
|
135 |
if (aIapId)
|
|
136 |
{
|
|
137 |
plugin = icmManager.ConnectionMethodL(aIapId);
|
|
138 |
iBearerType = plugin.GetIntAttributeL(CMManager::ECmBearerType);
|
|
139 |
TUint32 easyWLANIapId = icmManager.EasyWlanIdL();
|
|
140 |
if (easyWLANIapId != aIapId)
|
|
141 |
{
|
|
142 |
iConnectionName = plugin.GetStringAttributeL(CMManager::ECmName);
|
|
143 |
}
|
|
144 |
else
|
|
145 |
{
|
|
146 |
iConnectionName = plugin.GetStringAttributeL(CMManager::EWlanUsedSSID);
|
|
147 |
}
|
|
148 |
}
|
|
149 |
CleanupStack::PopAndDestroy(&plugin);
|
|
150 |
|
|
151 |
SetActive(); // Tell scheduler a request is active
|
|
152 |
iClientStatus = &iStatus;
|
|
153 |
User::RequestComplete(iClientStatus, KErrNone);
|
|
154 |
|
|
155 |
// Complete client request before launching dialog
|
|
156 |
iNotif->SetCancelledFlag(ETrue);
|
|
157 |
iNotif->CompleteL(KErrNone);
|
|
158 |
}
|
|
159 |
|
|
160 |
// ---------------------------------------------------------
|
|
161 |
// CConnectingViaDiscreetPopup::RunL
|
|
162 |
// ---------------------------------------------------------
|
|
163 |
//
|
|
164 |
void CConnectingViaDiscreetPopup::RunL()
|
|
165 |
{
|
|
166 |
if (iStatus == KErrNone)
|
|
167 |
{
|
|
168 |
TUint bitmapId = 0;
|
|
169 |
TUint maskId = 0;
|
|
170 |
if (iBearerType == KUidWlanBearerType)
|
|
171 |
{
|
|
172 |
bitmapId = EMbmConnectionuiutilitiesQgn_prop_wlan_bearer;
|
|
173 |
maskId = EMbmConnectionuiutilitiesQgn_prop_wlan_bearer_mask;
|
|
174 |
}
|
|
175 |
else
|
|
176 |
{
|
|
177 |
bitmapId = EMbmConnectionuiutilitiesQgn_prop_wml_gprs;
|
|
178 |
maskId = EMbmConnectionuiutilitiesQgn_prop_wml_gprs_mask;
|
|
179 |
}
|
|
180 |
|
|
181 |
// Load strings from resources
|
|
182 |
HBufC* stringText1 = StringLoader::LoadLC(
|
|
183 |
R_QTN_OCC_CONNECTING_DISCREET_POPUP_TEXT1);
|
|
184 |
|
|
185 |
HBufC* stringText2 = NULL;
|
|
186 |
if (iConnectionName)
|
|
187 |
{
|
|
188 |
stringText2 = iConnectionName;
|
|
189 |
}
|
|
190 |
else
|
|
191 |
{
|
|
192 |
stringText2 = KNullDesC().AllocLC();
|
|
193 |
}
|
|
194 |
|
|
195 |
CAknDiscreetPopup::ShowGlobalPopupL(*stringText1, // first text row
|
|
196 |
*stringText2, // second text row
|
|
197 |
KAknsIIDDefault, // icon skin id
|
|
198 |
KIconFileName, // bitmap file path
|
|
199 |
bitmapId, // bitmap id
|
|
200 |
maskId, // mask id
|
|
201 |
iPopupFlags, // flags
|
|
202 |
0, // command id
|
|
203 |
NULL, // command observer
|
|
204 |
KDiscreetPopupUid, // application to be launched
|
|
205 |
KDiscreetPopupViewUid); // view to be activated
|
|
206 |
|
|
207 |
if (!iConnectionName)
|
|
208 |
{
|
|
209 |
CleanupStack::PopAndDestroy( stringText2 );
|
|
210 |
}
|
|
211 |
|
|
212 |
CleanupStack::PopAndDestroy( stringText1 );
|
|
213 |
}
|
|
214 |
|
|
215 |
// Cleanup
|
|
216 |
iNotif->Cancel();
|
|
217 |
}
|
|
218 |
|
|
219 |
// ---------------------------------------------------------
|
|
220 |
// CConnectingViaDiscreetPopup::RunError
|
|
221 |
// ---------------------------------------------------------
|
|
222 |
//
|
|
223 |
TInt CConnectingViaDiscreetPopup::RunError(TInt aError)
|
|
224 |
{
|
|
225 |
return aError;
|
|
226 |
}
|