24
|
1 |
/*
|
|
2 |
* Copyright (c) 2003-2009 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:
|
|
15 |
* Handles commands given through the UI for maintaining information
|
|
16 |
* of single policy server.
|
|
17 |
*
|
|
18 |
*/
|
|
19 |
|
|
20 |
// INCLUDE FILES
|
|
21 |
#include <AknQueryDialog.h>
|
|
22 |
#include <aknnotewrappers.h>
|
|
23 |
#include <vpnmanagementuirsc.rsg>
|
|
24 |
#include <ErrorUI.h>
|
|
25 |
#include <sysutil.h>
|
|
26 |
#include "vpnuiloader.h"
|
|
27 |
#include "vpnmanagementuiserversettingsview.h"
|
|
28 |
#include "vpnmanagementuiserversettingscontainer.h"
|
|
29 |
#include "vpnmanagementui.hrh"
|
|
30 |
|
|
31 |
#ifdef __SERIES60_HELP
|
|
32 |
#include <hlplch.h> // For HlpLauncher
|
|
33 |
#endif //__SERIES60_HELP
|
|
34 |
|
|
35 |
/** MSK control Id. */
|
|
36 |
const TInt KVpnMSKControlId = 3;
|
|
37 |
|
|
38 |
// ================= MEMBER FUNCTIONS =======================
|
|
39 |
|
|
40 |
// ---------------------------------------------------------
|
|
41 |
// CServerSettingsView::CServerSettingsView(CVpnUiLoader& aLoader)
|
|
42 |
// Constructor
|
|
43 |
// ---------------------------------------------------------
|
|
44 |
//
|
|
45 |
CServerSettingsView::CServerSettingsView( CVpnUiLoader& aLoader )
|
|
46 |
: iLoader( aLoader )
|
|
47 |
{
|
|
48 |
}
|
|
49 |
|
|
50 |
// ---------------------------------------------------------
|
|
51 |
// CServerSettingsView::~CServerSettingsView()
|
|
52 |
// Destructor
|
|
53 |
// ---------------------------------------------------------
|
|
54 |
//
|
|
55 |
CServerSettingsView::~CServerSettingsView()
|
|
56 |
{
|
|
57 |
if ( iContainer )
|
|
58 |
{
|
|
59 |
AppUi()->RemoveFromViewStack( *this, iContainer );
|
|
60 |
delete iContainer;
|
|
61 |
}
|
|
62 |
}
|
|
63 |
|
|
64 |
// ---------------------------------------------------------
|
|
65 |
// CServerSettingsView* CServerSettingsView::NewL(const TRect& /*aRect*/,
|
|
66 |
// CVpnUiLoader& aLoader)
|
|
67 |
// ---------------------------------------------------------
|
|
68 |
//
|
|
69 |
CServerSettingsView* CServerSettingsView::NewL(
|
|
70 |
const TRect& /*aRect*/, CVpnUiLoader& aLoader)
|
|
71 |
{
|
|
72 |
CServerSettingsView* self = new (ELeave) CServerSettingsView(aLoader);
|
|
73 |
CleanupStack::PushL(self);
|
|
74 |
self->ConstructL();
|
|
75 |
CleanupStack::Pop();
|
|
76 |
return self;
|
|
77 |
}
|
|
78 |
|
|
79 |
// ---------------------------------------------------------
|
|
80 |
// CServerSettingsView* CServerSettingsView::NewLC(const TRect& /*aRect*/,
|
|
81 |
// CVpnUiLoader& aLoader)
|
|
82 |
// ---------------------------------------------------------
|
|
83 |
//
|
|
84 |
CServerSettingsView* CServerSettingsView::NewLC(const TRect& /*aRect*/,
|
|
85 |
CVpnUiLoader& aLoader)
|
|
86 |
{
|
|
87 |
CServerSettingsView* self = new (ELeave) CServerSettingsView(aLoader);
|
|
88 |
CleanupStack::PushL( self );
|
|
89 |
self->ConstructL();
|
|
90 |
return self;
|
|
91 |
}
|
|
92 |
|
|
93 |
// ---------------------------------------------------------
|
|
94 |
// CServerSettingsView::ConstructL()
|
|
95 |
// EPOC two-phased constructor
|
|
96 |
// ---------------------------------------------------------
|
|
97 |
//
|
|
98 |
void CServerSettingsView::ConstructL()
|
|
99 |
{
|
|
100 |
BaseConstructL( R_VPNMANAGEMENTUI_SERVER_PARAMETERS_VIEW );
|
|
101 |
}
|
|
102 |
|
|
103 |
|
|
104 |
// ---------------------------------------------------------
|
|
105 |
// CServerSettingsView::Id() const
|
|
106 |
// Returns Trust view id
|
|
107 |
// ---------------------------------------------------------
|
|
108 |
//
|
|
109 |
TUid CServerSettingsView::Id() const
|
|
110 |
{
|
|
111 |
return KVpnManagementUiParametersViewId;
|
|
112 |
}
|
|
113 |
|
|
114 |
// ---------------------------------------------------------
|
|
115 |
// CServerSettingsView::HandleCommandL(TInt aCommand)
|
|
116 |
// Handles Softkey and Options list commands
|
|
117 |
// ---------------------------------------------------------
|
|
118 |
//
|
|
119 |
void CServerSettingsView::HandleCommandL( TInt aCommand)
|
|
120 |
{
|
|
121 |
|
|
122 |
TBool ffs(EFalse);
|
|
123 |
switch ( aCommand )
|
|
124 |
{
|
|
125 |
case EAknSoftkeyBack:
|
|
126 |
{
|
|
127 |
//GET CURRENT ADDRESS
|
|
128 |
ASSERT( iContainer );
|
|
129 |
|
|
130 |
const TAgileProvisionApiServerSettings& serverDetails = iContainer->ServerDetailsL();
|
|
131 |
|
|
132 |
ffs = iLoader.FFSSpaceBelowCriticalLevelL( ETrue, 0 );
|
|
133 |
if (ffs)
|
|
134 |
{
|
|
135 |
iLoader.iBackFromServerDefinition = ETrue;
|
|
136 |
iLoader.ChangeViewL( KChangeViewPrevious );
|
|
137 |
}
|
|
138 |
else if(serverDetails.iServerUrl.Length()==0 || serverDetails.iSelection.iId==0)
|
|
139 |
{
|
|
140 |
TInt ret = CompleteSettingsL();
|
|
141 |
if (ret)
|
|
142 |
{
|
|
143 |
iLoader.iShowDefineQuery = EFalse;
|
|
144 |
iLoader.iBackFromServerDefinition = ETrue;
|
|
145 |
iLoader.ChangeViewL( KChangeViewPrevious );
|
|
146 |
}
|
|
147 |
}
|
|
148 |
else
|
|
149 |
{
|
|
150 |
|
|
151 |
int aResult = iLoader.VpnApiWrapperL().CreateServer(serverDetails);
|
|
152 |
if (aResult == KErrNone)
|
|
153 |
{
|
|
154 |
|
|
155 |
|
|
156 |
iLoader.iNewServerDefinition = ETrue;
|
|
157 |
}
|
|
158 |
else
|
|
159 |
{
|
|
160 |
iLoader.iShowDefineQuery = EFalse;
|
|
161 |
iLoader.iBackFromServerDefinition = ETrue;
|
|
162 |
iLoader.iNewServerDefinition = EFalse;
|
|
163 |
|
|
164 |
CErrorUI* errorUi = CErrorUI::NewLC( *(CCoeEnv::Static()) );
|
|
165 |
errorUi->ShowGlobalErrorNoteL( aResult );
|
|
166 |
CleanupStack::PopAndDestroy(); // errorUi
|
|
167 |
}
|
|
168 |
|
|
169 |
}
|
|
170 |
|
|
171 |
iLoader.ChangeViewL( KChangeViewPrevious );
|
|
172 |
break;
|
|
173 |
}
|
|
174 |
case EAknCmdExit:
|
|
175 |
{
|
|
176 |
((CAknViewAppUi*)iAvkonAppUi)->HandleCommandL( EAknCmdExit );
|
|
177 |
break;
|
|
178 |
}
|
|
179 |
case EVpnUiCmdChange:
|
|
180 |
{
|
|
181 |
ASSERT(iContainer);
|
|
182 |
iContainer->ChangeSettingValueL();
|
|
183 |
break;
|
|
184 |
}
|
|
185 |
#ifdef __SERIES60_HELP
|
|
186 |
case EAknCmdHelp:
|
|
187 |
{
|
|
188 |
HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(),
|
|
189 |
AppUi()->AppHelpContextL() );
|
|
190 |
break;
|
|
191 |
}
|
|
192 |
#endif //__SERIES60_HELP
|
|
193 |
|
|
194 |
default:
|
|
195 |
{
|
|
196 |
AppUi()->HandleCommandL( aCommand );
|
|
197 |
break;
|
|
198 |
}
|
|
199 |
}
|
|
200 |
}
|
|
201 |
|
|
202 |
// ---------------------------------------------------------
|
|
203 |
// CServerSettingsView::HandleClientRectChange()
|
|
204 |
// ---------------------------------------------------------
|
|
205 |
//
|
|
206 |
void CServerSettingsView::HandleClientRectChange()
|
|
207 |
{
|
|
208 |
if ( iContainer )
|
|
209 |
{
|
|
210 |
iContainer->SetRect( ClientRect() );
|
|
211 |
}
|
|
212 |
}
|
|
213 |
|
|
214 |
// ---------------------------------------------------------
|
|
215 |
// CServerSettingsView::DoActivateL()
|
|
216 |
// Updates the view when opening it
|
|
217 |
// ---------------------------------------------------------
|
|
218 |
//
|
|
219 |
void CServerSettingsView::DoActivateL(const TVwsViewId& /*aPrevViewId*/,
|
|
220 |
TUid aCustomMessageId, const TDesC8& /*aCustomMessage*/)
|
|
221 |
{
|
|
222 |
__ASSERT_DEBUG(iContainer == NULL, User::Invariant());
|
|
223 |
|
|
224 |
// aCustomMessageId contains index of the policy servers listbox
|
|
225 |
iContainer = CServerSettingsContainer::NewL( iLoader,
|
|
226 |
static_cast<TInt> ( aCustomMessageId.iUid ) );
|
|
227 |
iContainer->SetMopParent( this );
|
|
228 |
|
|
229 |
iLoader.PushDefaultNaviPaneL();
|
|
230 |
|
|
231 |
((CAknViewAppUi*)iAvkonAppUi)->AddToStackL( *this, iContainer );
|
|
232 |
|
|
233 |
// Add MiddleSoftKey
|
|
234 |
CEikButtonGroupContainer* cbaGroup = Cba();
|
|
235 |
if (cbaGroup)
|
|
236 |
{
|
|
237 |
HBufC* text = StringLoader::LoadLC(R_MSK_CHANGE);
|
|
238 |
cbaGroup->AddCommandToStackL(KVpnMSKControlId, EVpnUiCmdChange, text->Des());
|
|
239 |
CleanupStack::PopAndDestroy(text);
|
|
240 |
}
|
|
241 |
iContainer->ActivateL();
|
|
242 |
}
|
|
243 |
|
|
244 |
// ---------------------------------------------------------
|
|
245 |
// CServerSettingsView::DoDeactivate()
|
|
246 |
// ---------------------------------------------------------
|
|
247 |
//
|
|
248 |
void CServerSettingsView::DoDeactivate()
|
|
249 |
{
|
|
250 |
if ( iContainer )
|
|
251 |
{
|
|
252 |
((CAknViewAppUi*)iAvkonAppUi)->RemoveFromViewStack( *this, iContainer );
|
|
253 |
|
|
254 |
delete iContainer;
|
|
255 |
iContainer = NULL;
|
|
256 |
}
|
|
257 |
}
|
|
258 |
|
|
259 |
|
|
260 |
TInt CServerSettingsView::CompleteSettingsL()
|
|
261 |
{
|
|
262 |
// compulsory field is empty, confirmation query
|
|
263 |
HBufC* temp;
|
|
264 |
temp = StringLoader::LoadLC( R_VPN_QUEST_INCOMPLETE_SERVER_DEF_DELETE );
|
|
265 |
CAknQueryDialog* query = CAknQueryDialog::NewL( CAknQueryDialog::EConfirmationTone );
|
|
266 |
TInt retval = query->ExecuteLD( R_CONFIRMATION_QUERY, *temp );
|
|
267 |
CleanupStack::PopAndDestroy(); // temp
|
|
268 |
return retval;
|
|
269 |
}
|
|
270 |
|
|
271 |
// End of File
|
|
272 |
|