|
1 /* |
|
2 * Copyright (c) 2003 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: Dialog for defining new server |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "CWVSettingsUIDefineNewServerDialog.h" |
|
21 #include "CWVSettingsUIDefs.h" |
|
22 #include "CWVSettingsUI.hrh" |
|
23 #include "MWVSettingsObserverng.h" |
|
24 #include "CWVSettingsUINGDialog.h" |
|
25 #include "WVSettingsUIPanics.h" |
|
26 #include "CWVSettingsUIDialogTitlePaneHandler.h" |
|
27 #include "CWVSettingsUIDialogImp.h" |
|
28 #include "IMPSPresenceLoginDetailValidator.h" |
|
29 #include "cwvsettingsuseridsettingpage.h" |
|
30 |
|
31 #include <csxhelp/imng.hlp.hrh> |
|
32 |
|
33 #include <aknlists.h> |
|
34 #include <commdb.h> |
|
35 #include <ApSettingsHandlerUI.h> |
|
36 #include <aputils.h> |
|
37 #include <aknsettingitemlist.h> |
|
38 #include <aknsettingpage.h> |
|
39 #include <akntextsettingpage.h> |
|
40 #include <AknPopupSettingPage.h> |
|
41 #include <akntitle.h> |
|
42 #include <aknquerydialog.h> |
|
43 #include <e32math.h> |
|
44 #include <cimpssapsettingsstore.h> |
|
45 #include <cimpssapsettings.h> |
|
46 #include <cimpssapsettingslist.h> |
|
47 #include <aknnotewrappers.h> // branding |
|
48 #include <stringloader.h> |
|
49 #include <AknIconArray.h> |
|
50 #include <data_caging_path_literals.hrh> |
|
51 #include <apsettings.mbg> |
|
52 #include <AknsUtils.h> |
|
53 #include <AknsConstants.h> |
|
54 #include <pathinfo.h> |
|
55 #include <aknmessagequerydialog.h> |
|
56 |
|
57 #include <hlplch.h> |
|
58 #include <featmgr.h> |
|
59 #include <aknsettingpage.h> |
|
60 #include <aknpasswordsettingpage.h> |
|
61 #include <cimpspresenceconnectionuing.h> |
|
62 #include <impspresenceconnectionuiconstsng.h> |
|
63 |
|
64 #include <CPEngNWSessionSlotID2.h> |
|
65 |
|
66 #include <barsread.h> |
|
67 #include <bautils.h> |
|
68 #include <sysutil.h> |
|
69 |
|
70 #include <CWVSettingsUIng.rsg> |
|
71 #include <aknutils.h> |
|
72 |
|
73 #include "CAExternalInterface.h" |
|
74 |
|
75 // The Settings have been moved to Cenrep (also retained in the Resource file), |
|
76 // the enums for keys and central repository header is added here |
|
77 // New rss file added for 401-1815 Ease of Instant Messaging branding |
|
78 // These rss flags will be made available in ZCenrep also.. |
|
79 |
|
80 #include "VariantKeys.h" |
|
81 #include <centralrepository.h> |
|
82 |
|
83 // CONSTANTS |
|
84 |
|
85 const TUint KWhiteSpace16( ' ' ); |
|
86 |
|
87 |
|
88 // ================= MEMBER FUNCTIONS ======================= |
|
89 |
|
90 // ----------------------------------------------------------------------------- |
|
91 // CWVSettingsUIDefineNewServerDialog::CWVSettingsUIDefineNewServerDialog |
|
92 // C++ default constructor can NOT contain any code, that |
|
93 // might leave. |
|
94 // ----------------------------------------------------------------------------- |
|
95 // |
|
96 CWVSettingsUIDefineNewServerDialog::CWVSettingsUIDefineNewServerDialog( |
|
97 TInt& aExitReason, |
|
98 CIMPSSAPSettingsStore& aSAPSettingsStore, |
|
99 TEditMode aEditMode, |
|
100 MWVSettingsObserver& aObserver, |
|
101 CWVSettingsUIDialogTitlePaneHandler& aTitlePaneHandler, |
|
102 CWVSettingsUIDialogImp* aDialog, |
|
103 TUint32& aNewUid, |
|
104 CIMPSPresenceConnectionUi* aConnectionUI, |
|
105 CIMPSSAPSettings* aServer /* = NULL */ ): |
|
106 iExitReason( aExitReason ), |
|
107 iSAPSettingsStore( &aSAPSettingsStore ), |
|
108 iEditMode( aEditMode ), |
|
109 iSAP( aServer ), |
|
110 iIAPNamePtr( NULL, 0 ), |
|
111 iServerNamePtr( NULL, 0 ), |
|
112 iWVUserIdPtr( NULL, 0 ), |
|
113 iPasswordPtr( NULL, 0 ), |
|
114 iURLPtr( NULL, 0 ), |
|
115 iObserver( &aObserver ), |
|
116 iTitlePaneHandler ( &aTitlePaneHandler ), |
|
117 iDialog ( aDialog ), |
|
118 iStoreOldId ( ETrue ), |
|
119 iOldUserIdPtr( NULL, 0 ), |
|
120 iEdited ( EFalse ), |
|
121 iNewUid( aNewUid ), |
|
122 iProtected( EFalse ), |
|
123 iConnectionUI( aConnectionUI ), |
|
124 iIsDeleted( EFalse ), |
|
125 isDisplayedSubDialog ( EFalse ) |
|
126 { |
|
127 iCoeEnv = CCoeEnv::Static(); |
|
128 } |
|
129 |
|
130 // Destructor |
|
131 CWVSettingsUIDefineNewServerDialog::~CWVSettingsUIDefineNewServerDialog() |
|
132 { |
|
133 if ( iSettingItemArray ) |
|
134 { |
|
135 iSettingItemArray->ResetAndDestroy(); |
|
136 } |
|
137 |
|
138 if ( iConnectionUIOwned ) |
|
139 { |
|
140 delete iConnectionUI; |
|
141 } |
|
142 |
|
143 delete iOldServerName; |
|
144 |
|
145 delete iSettingItemArray; |
|
146 iSettingItemArray = NULL; |
|
147 delete iIAPName; |
|
148 delete iServerName; |
|
149 delete iWVUserId; |
|
150 delete iPassword; |
|
151 delete iURL; |
|
152 delete iAPUtils; |
|
153 delete iAPSettingsHandler; |
|
154 delete iCommsDb; |
|
155 delete iOldUserId; |
|
156 delete iSAP; |
|
157 delete iOldPassword; |
|
158 |
|
159 if( iDlgLauncher && iDlgLauncher->IsActive() ) |
|
160 { |
|
161 iDlgLauncher->Cancel(); |
|
162 } |
|
163 delete iDlgLauncher; |
|
164 } |
|
165 |
|
166 // ----------------------------------------------------------------------------- |
|
167 // CWVSettingsUIDefineNewServerDialog::EditSapSettingsL |
|
168 // |
|
169 // (other items were commented in a header). |
|
170 // ----------------------------------------------------------------------------- |
|
171 // |
|
172 TInt CWVSettingsUIDefineNewServerDialog::EditSapSettingsL() |
|
173 { |
|
174 |
|
175 TUint32 wapAp( 0 ); |
|
176 |
|
177 if ( iAPUtils->IAPExistsL( iIAP ) ) |
|
178 { |
|
179 wapAp = iAPUtils->WapIdFromIapIdL( iIAP ); |
|
180 } |
|
181 |
|
182 TUint32 previousAp( wapAp ); |
|
183 TInt returnFlags ( iAPSettingsHandler->RunSettingsL( wapAp, wapAp ) ); |
|
184 |
|
185 // was some item selected. Selecting with Pen doesn't cause |
|
186 // KApUiEventSelected event. |
|
187 TBool selected( returnFlags & KApUiEventSelected || wapAp != previousAp ); |
|
188 |
|
189 if ( selected ) |
|
190 { |
|
191 //got an new wap id - needs to be converted to IAP id |
|
192 iIAP = iAPUtils->IapIdFromWapIdL( wapAp ); |
|
193 iIAPHasValue = ETrue; |
|
194 } |
|
195 |
|
196 // check if access point has been edited, selected or deleted |
|
197 if ( ( selected ) || |
|
198 ( returnFlags & KApUiEventEdited ) || |
|
199 ( returnFlags & KApUiEventDeleted ) ) |
|
200 { |
|
201 iEdited = ETrue; |
|
202 |
|
203 //update IAP name field when selected, edited, or deleted |
|
204 //if current has been deleted -> NameL() leaves |
|
205 |
|
206 TRAPD( err, iAPUtils->NameL( wapAp, iIAPNamePtr ) ) |
|
207 |
|
208 if ( err == KErrNotFound ) |
|
209 { |
|
210 // this error happens, if access point has been deleted |
|
211 // we just empty the access point name |
|
212 iIAPNamePtr.Zero(); |
|
213 err = KErrNone; //ignore this error |
|
214 } |
|
215 else |
|
216 { |
|
217 //handle errors by leaving.. |
|
218 User::LeaveIfError( err ); |
|
219 } |
|
220 |
|
221 iSettingItemArray->At( ESAP )->LoadL(); |
|
222 iSettingItemArray->At( ESAP )->UpdateListBoxTextL(); |
|
223 } |
|
224 |
|
225 // it is checked later on if Exit was selected |
|
226 return returnFlags; |
|
227 } |
|
228 |
|
229 // ----------------------------------------------------------------------------- |
|
230 // CWVSettingsUIDefineNewServerDialog::StoreAllItemsL |
|
231 // |
|
232 // (other items were commented in a header). |
|
233 // ----------------------------------------------------------------------------- |
|
234 // |
|
235 |
|
236 void CWVSettingsUIDefineNewServerDialog::StoreAllItemsL() |
|
237 { |
|
238 |
|
239 if ( iSAP ) |
|
240 { |
|
241 if ( iSAP->Protection() == ESAPBrandProtection ) |
|
242 { |
|
243 iSAP->SetSAPUserIdL( *iWVUserId ); |
|
244 iSAP->SetSAPUserPasswordL( *iPassword ); |
|
245 iSAP->SetAccessPoint( iIAP ); |
|
246 } |
|
247 else |
|
248 { |
|
249 iSAP->SetSAPNameL( *iServerName ); |
|
250 iSAP->SetSAPAddressL( *iURL ); |
|
251 iSAP->SetSAPUserIdL( *iWVUserId ); |
|
252 iSAP->SetSAPUserPasswordL( *iPassword ); |
|
253 iSAP->SetAccessPoint( iIAP ); |
|
254 } |
|
255 |
|
256 if ( iEditMode == ENewServer ) |
|
257 { |
|
258 iNewUid = iSAPSettingsStore->StoreNewSAPL( iSAP, EIMPSIMAccessGroup ); |
|
259 } |
|
260 else // Edit-mode |
|
261 { |
|
262 iSAPSettingsStore->UpdateOldSAPL( iSAP, iSAP->Uid() ); |
|
263 } |
|
264 } |
|
265 } |
|
266 |
|
267 // ----------------------------------------------------------------------------- |
|
268 // CWVSettingsUIDefineNewServerDialog::AddItemL |
|
269 // |
|
270 // (other items were commented in a header). |
|
271 // ----------------------------------------------------------------------------- |
|
272 // |
|
273 void CWVSettingsUIDefineNewServerDialog::AddItemL( TDes& aBuffer, |
|
274 TInt aId, |
|
275 TInt aTitleResource, |
|
276 TInt aDlgResource, |
|
277 TBool aCompulsory /*= EFalse*/, |
|
278 TBool aIconNeeded, /* = EFalse */ |
|
279 TItemType aItemType /*= ETextItem*/ |
|
280 ) |
|
281 { |
|
282 CAknSettingItem* settingItem = NULL; |
|
283 TInt associatedResource( 0 ); |
|
284 |
|
285 switch ( aItemType ) |
|
286 { |
|
287 case ETextItem: |
|
288 { |
|
289 settingItem = new ( ELeave ) CAknTextSettingItem( aId, aBuffer ); |
|
290 associatedResource = EEikCtEdwin; |
|
291 break; |
|
292 } |
|
293 case EPasswordItem: |
|
294 { |
|
295 settingItem = new ( ELeave ) |
|
296 CAknPasswordSettingItem( aId, CAknPasswordSettingItem::EAlpha, aBuffer ); |
|
297 associatedResource = EEikCtSecretEd; |
|
298 break; |
|
299 } |
|
300 default: |
|
301 { |
|
302 User::Leave( EServerDialogUnknownItemType ); |
|
303 break; |
|
304 } |
|
305 } |
|
306 |
|
307 CleanupStack::PushL( settingItem ); |
|
308 |
|
309 HBufC* tempTitle = iEikonEnv->AllocReadResourceLC( aTitleResource ); |
|
310 TBuf< KWVSettingsServerNameMaxLength > title ( *tempTitle ); |
|
311 HBufC* itemTitle = title.AllocL(); |
|
312 CleanupStack::PopAndDestroy( tempTitle ); |
|
313 CleanupStack::PushL( itemTitle ); |
|
314 |
|
315 // Construct correct compulsory indicator string which might also include |
|
316 // the protected icon. |
|
317 HBufC* compulsory = HBufC::NewLC( KCompulsoryChar().Length() + |
|
318 KIMPSIconIndex().Length() ); |
|
319 TPtr compPtr( compulsory->Des() ); |
|
320 |
|
321 if ( aCompulsory ) |
|
322 { |
|
323 HBufC* text = CEikonEnv::Static()->AllocReadResourceLC( R_SELECT_SETTING_COMPULSORY ); |
|
324 settingItem->SetEmptyItemTextL( *text ); |
|
325 CleanupStack::PopAndDestroy( text ); |
|
326 compPtr.Append( KCompulsoryChar() ); |
|
327 settingItem->SetSettingPageFlags( CAknTextSettingPage::EZeroLengthNotOffered ); |
|
328 } |
|
329 else |
|
330 { |
|
331 settingItem->SetEmptyItemTextL( KEmptyDesC ); |
|
332 settingItem->SetSettingPageFlags( CAknTextSettingPage::EZeroLengthAllowed ); |
|
333 } |
|
334 |
|
335 settingItem->ConstructL( EFalse, iOrdinal, title, NULL, aDlgResource, associatedResource ); |
|
336 |
|
337 if ( iProtected && aIconNeeded ) |
|
338 { |
|
339 // this item needs the protected icon |
|
340 compPtr.Append( KIMPSIconIndex() ); |
|
341 } |
|
342 |
|
343 // This is used not only to set the compulsory icon, but also the |
|
344 // protected icon. |
|
345 settingItem->SetCompulsoryIndTextL( compPtr ); |
|
346 |
|
347 iSettingItemArray->AppendL( settingItem ); |
|
348 CleanupStack::PopAndDestroy( 2, itemTitle ); // compulsory, itemTitle |
|
349 CleanupStack::Pop( settingItem ); |
|
350 |
|
351 iOrdinal++; |
|
352 } |
|
353 |
|
354 |
|
355 // ----------------------------------------------------------------------------- |
|
356 // CWVSettingsUIDefineNewServerDialog::LoadExistingItemL |
|
357 // |
|
358 // (other items were commented in a header). |
|
359 // ----------------------------------------------------------------------------- |
|
360 // |
|
361 void CWVSettingsUIDefineNewServerDialog::LoadExistingItemL() |
|
362 { |
|
363 iServerNamePtr.Copy( iSAP->SAPName().Left( iServerNamePtr.MaxLength() ) ); |
|
364 iURLPtr.Copy( iSAP->SAPAddress().Left( iURLPtr.MaxLength() ) ); |
|
365 iWVUserIdPtr.Copy( iSAP->SAPUserId().Left( iWVUserIdPtr.MaxLength() ) ); |
|
366 iPasswordPtr.Copy( iSAP->SAPUserPassword().Left( iPasswordPtr.MaxLength() ) ); |
|
367 iIAP = iSAP->AccessPoint(); |
|
368 iIAPHasValue = ETrue; |
|
369 |
|
370 //update IAP name field when selected, edited, or deleted |
|
371 //if current has been deleted -> NameL() leaves |
|
372 TRAPD( err, iAPUtils->NameL( iAPUtils->WapIdFromIapIdL( iIAP ), |
|
373 iIAPNamePtr ) ); |
|
374 |
|
375 if ( ( err == KErrNotFound ) && ( iIAP != 0 ) ) |
|
376 { |
|
377 // iIAP has a value, but it's not found |
|
378 // so we can reset the value to zero |
|
379 iIAP = 0; |
|
380 } |
|
381 |
|
382 if ( ( err == KErrNoMemory ) || ( err == KErrDiskFull ) ) |
|
383 { |
|
384 User::Leave( err ); |
|
385 } |
|
386 } |
|
387 |
|
388 // ----------------------------------------------------------------------------- |
|
389 // CWVSettingsUIDefineNewServerDialog::CompulsoryItemsFilled |
|
390 // |
|
391 // (other items were commented in a header). |
|
392 // ----------------------------------------------------------------------------- |
|
393 // |
|
394 TBool CWVSettingsUIDefineNewServerDialog::CompulsoryItemsFilled() |
|
395 { |
|
396 TBool passed( ETrue ); |
|
397 iFailedFields = 0; |
|
398 |
|
399 TInt compValues = GetCompulsoryItems(); |
|
400 |
|
401 if ( compValues & EWVSettingsViewServerName ) |
|
402 { |
|
403 if ( iServerNamePtr.Length() == 0 ) |
|
404 { |
|
405 passed = EFalse; |
|
406 iFailedFields = iFailedFields | GenerateFlagValue( EServerName ); |
|
407 } |
|
408 } |
|
409 |
|
410 if ( compValues & EWVSettingsViewIAPName ) |
|
411 { |
|
412 if ( iIAPNamePtr.Length() == 0 ) |
|
413 { |
|
414 passed = EFalse; |
|
415 iFailedFields = iFailedFields | GenerateFlagValue( ESAP ); |
|
416 } |
|
417 } |
|
418 |
|
419 if ( compValues & EWVSettingsViewURL ) |
|
420 { |
|
421 if ( iURLPtr.Length() == 0 ) |
|
422 { |
|
423 passed = EFalse; |
|
424 iFailedFields = iFailedFields | GenerateFlagValue( EURL ); |
|
425 } |
|
426 } |
|
427 |
|
428 if ( compValues & EWVSettingsViewWVUserId ) |
|
429 { |
|
430 if ( iWVUserIdPtr.Length() == 0 ) |
|
431 { |
|
432 passed = EFalse; |
|
433 iFailedFields = iFailedFields | GenerateFlagValue ( EWVId ); |
|
434 } |
|
435 } |
|
436 |
|
437 if ( compValues & EWVSettingsViewPassword ) |
|
438 { |
|
439 if ( iPasswordPtr.Length() == 0 ) |
|
440 { |
|
441 passed = EFalse; |
|
442 iFailedFields = iFailedFields | GenerateFlagValue ( EPassword ); |
|
443 } |
|
444 } |
|
445 |
|
446 return passed; |
|
447 } |
|
448 |
|
449 // ----------------------------------------------------------------------------- |
|
450 // CWVSettingsUIDefineNewServerDialog::CompulGetCompulsoryItems |
|
451 // |
|
452 // (other items were commented in a header). |
|
453 // ----------------------------------------------------------------------------- |
|
454 // |
|
455 TInt CWVSettingsUIDefineNewServerDialog::GetCompulsoryItems ( ) const |
|
456 { |
|
457 return EWVSettingsViewServerName | EWVSettingsViewIAPName | EWVSettingsViewURL; |
|
458 } |
|
459 |
|
460 |
|
461 // ----------------------------------------------------------------------------- |
|
462 // CWVSettingsUIDefineNewServerDialog::SignalStoreLToAllL |
|
463 // |
|
464 // (other items were commented in a header). |
|
465 // ----------------------------------------------------------------------------- |
|
466 // |
|
467 void CWVSettingsUIDefineNewServerDialog::SignalStoreLToAllL() const |
|
468 { |
|
469 TInt itemCount( iSettingItemArray->Count() ); |
|
470 |
|
471 for ( TInt index = 0; index < itemCount; ++index ) |
|
472 { |
|
473 iSettingItemArray->At( index )->StoreL(); |
|
474 } |
|
475 } |
|
476 |
|
477 // ----------------------------------------------------------------------------- |
|
478 // CWVSettingsUIDefineNewServerDialog::FormUniqueServerNameL |
|
479 // |
|
480 // (other items were commented in a header). |
|
481 // ----------------------------------------------------------------------------- |
|
482 // |
|
483 TBool CWVSettingsUIDefineNewServerDialog::FormUniqueServerNameL() |
|
484 { |
|
485 HBufC* title = iEikonEnv->AllocReadResourceL( |
|
486 RSC_WVSETTINGSVIEW_DEFAULT_SERVERNAME ); |
|
487 iServerNamePtr.Copy( title->Left( iServerNamePtr.MaxLength() ) ); |
|
488 delete title; |
|
489 |
|
490 TBool retStatus( EFalse ); |
|
491 |
|
492 //get existing server names |
|
493 CDesCArrayFlat* serverNames = ServerListL(); |
|
494 if ( serverNames ) |
|
495 { |
|
496 CleanupStack::PushL( serverNames ); |
|
497 retStatus = FormUniqueNameL( *serverNames, iServerNamePtr ); |
|
498 CleanupStack::PopAndDestroy( serverNames ); |
|
499 } |
|
500 |
|
501 return retStatus; |
|
502 } |
|
503 |
|
504 // ----------------------------------------------------------------------------- |
|
505 // CWVSettingsUIDefineNewServerDialog::FormUniqueNameL |
|
506 // |
|
507 // (other items were commented in a header). |
|
508 // ----------------------------------------------------------------------------- |
|
509 // |
|
510 TBool CWVSettingsUIDefineNewServerDialog::FormUniqueNameL( const CDesCArray& aExistingNames, |
|
511 TDes& aNameToForm ) |
|
512 { |
|
513 //calculate trailer length |
|
514 TInt nameTrailerTotalLength = KWVSettingsViewServerNameTrailerDecorationStart().Length() + |
|
515 KWVSettingsViewServerNameTrailerNumberWidth + |
|
516 KWVSettingsViewServerNameTrailerDecorationEnd().Length(); |
|
517 TInt position( 0 ); |
|
518 TBool nameChanged( EFalse ); |
|
519 AknTextUtils::DisplayTextLanguageSpecificNumberConversion( aNameToForm ); |
|
520 if ( aExistingNames.Find( aNameToForm, position, ECmpFolded ) == 0 ) |
|
521 { |
|
522 //the name is found among the existing names |
|
523 //search for passfull trailer |
|
524 |
|
525 //initial trailer number |
|
526 TUint trailerNumber( KWVSettingsViewServerNameTrailerMinNumber ); |
|
527 |
|
528 //setup temp buff |
|
529 HBufC* nameTryBuff = HBufC::NewLC( aNameToForm.MaxLength() ); |
|
530 TPtr nameTry( nameTryBuff->Des() ); |
|
531 |
|
532 //truncate the server name copy, to hold the trailer |
|
533 TInt availableSpaceForActualName( aNameToForm.MaxLength() - nameTrailerTotalLength ); |
|
534 |
|
535 //find passfull server name |
|
536 TInt result( 0 ); |
|
537 |
|
538 TBuf<KWVSettingsServerNameMaxLength> tempBuf( KNullDesC ); |
|
539 while ( result == 0 ) |
|
540 { |
|
541 // check how many numbers we need to have in the index |
|
542 tempBuf.Zero(); |
|
543 tempBuf.AppendNum( trailerNumber ); |
|
544 TInt length ( tempBuf.Length() ); |
|
545 // but we want to have atleast 2 |
|
546 if ( length < 2 ) |
|
547 { |
|
548 length = 2; |
|
549 } |
|
550 |
|
551 nameTry.Zero(); |
|
552 nameTry.Copy( aNameToForm.Left( availableSpaceForActualName ) ); |
|
553 nameTry.Append( KWVSettingsViewServerNameTrailerDecorationStart ); |
|
554 nameTry.AppendNumFixedWidth( trailerNumber, EDecimal, length ); |
|
555 nameTry.Append( KWVSettingsViewServerNameTrailerDecorationEnd ); |
|
556 |
|
557 //result == 0, if a matching descriptor is found. |
|
558 AknTextUtils::DisplayTextLanguageSpecificNumberConversion( nameTry ); |
|
559 result = aExistingNames.Find( nameTry, position, ECmpFolded ); |
|
560 trailerNumber++; |
|
561 } |
|
562 |
|
563 if ( result != 0 ) |
|
564 { |
|
565 //free nameslot found |
|
566 AknTextUtils::DisplayTextLanguageSpecificNumberConversion( nameTry ); |
|
567 aNameToForm.Zero(); |
|
568 aNameToForm.Copy( nameTry.Left( aNameToForm.MaxLength() ) ); |
|
569 nameChanged = ETrue; |
|
570 } |
|
571 |
|
572 CleanupStack::PopAndDestroy( nameTryBuff ); // nameTryBuff |
|
573 } |
|
574 return nameChanged; |
|
575 } |
|
576 |
|
577 // ----------------------------------------------------------------------------- |
|
578 // CWVSettingsUIDefineNewServerDialog::ChangeFocusToInvalidCompulsoryField |
|
579 // |
|
580 // (other items were commented in a header). |
|
581 // ----------------------------------------------------------------------------- |
|
582 // |
|
583 void CWVSettingsUIDefineNewServerDialog::ChangeFocusToInvalidCompulsoryField() const |
|
584 { |
|
585 TBool found( EFalse ); |
|
586 TInt itemIndex( 0 ); |
|
587 |
|
588 do |
|
589 { |
|
590 if ( iFailedFields & GenerateFlagValue( itemIndex ) ) |
|
591 { |
|
592 iListbox->SetCurrentItemIndexAndDraw( itemIndex ); |
|
593 found = ETrue; |
|
594 } |
|
595 else |
|
596 { |
|
597 itemIndex++; |
|
598 } |
|
599 |
|
600 } while ( itemIndex < ELastItemMarker && !found ); |
|
601 } |
|
602 |
|
603 // ----------------------------------------------------------------------------- |
|
604 // CWVSettingsUIDefineNewServerDialog::ProcessCommandL |
|
605 // |
|
606 // (other items were commented in a header). |
|
607 // ----------------------------------------------------------------------------- |
|
608 // |
|
609 void CWVSettingsUIDefineNewServerDialog::ProcessCommandL( TInt aCommand ) |
|
610 { |
|
611 HideMenu(); |
|
612 |
|
613 switch ( aCommand ) |
|
614 { |
|
615 case EAknSoftkeyEdit: // Flowthrough, MSK command |
|
616 case EWVSettingsViewDefNewServerChange: |
|
617 { |
|
618 CEikListBox* listBox = |
|
619 static_cast <CEikListBox*> ( Control( EWVSettingsViewControlIdDefNewServer ) ); |
|
620 HandleListBoxEventL( listBox, EEventEditingStarted ); |
|
621 break; |
|
622 } |
|
623 // Help key support EWVSettingsViewCmdHelp is assigned EAknCmdHelp in |
|
624 // CWSettingsUI.hrh |
|
625 case EWVSettingsViewCmdHelp: |
|
626 { |
|
627 HlpLauncher::LaunchHelpApplicationL( CEikonEnv::Static()->WsSession(), |
|
628 ( CCoeEnv::Static()->AppUi() )->AppHelpContextL () ); |
|
629 break; |
|
630 } |
|
631 case EWVSettingsViewCmdExit: |
|
632 { |
|
633 TryExitL ( aCommand ); |
|
634 iIsDeleted = ETrue; |
|
635 break; |
|
636 } |
|
637 default: |
|
638 { |
|
639 CEikonEnv::Static()->EikAppUi()->HandleCommandL( aCommand ); |
|
640 break; |
|
641 } |
|
642 } |
|
643 } |
|
644 |
|
645 // ----------------------------------------------------------------------------- |
|
646 // CWVSettingsUIDefineNewServerDialog::HandleListBoxEventL |
|
647 // |
|
648 // (other items were commented in a header). |
|
649 // ----------------------------------------------------------------------------- |
|
650 // |
|
651 void CWVSettingsUIDefineNewServerDialog::HandleListBoxEventL( CEikListBox* aListBox, |
|
652 TListBoxEvent aEventType ) |
|
653 { |
|
654 if ( aEventType == EEventEnterKeyPressed || |
|
655 aEventType == EEventEditingStarted || |
|
656 aEventType == EEventItemDoubleClicked ) |
|
657 { |
|
658 TBool isPopup( aEventType == EEventEditingStarted ); |
|
659 TInt index( aListBox->CurrentItemIndex() ); |
|
660 |
|
661 if ( iConnectionUI ) |
|
662 { |
|
663 CPEngNWSessionSlotID2* sessionSlotID = NULL; |
|
664 TRAPD( error, sessionSlotID = |
|
665 iConnectionUI->GetActiveNWSessionSlotIDL( EIMPSConnClientIM ) ); |
|
666 CleanupStack::PushL( sessionSlotID ); |
|
667 TInt retVal( KErrNone ); |
|
668 TIMPSConnectionOperation connOperation( EIMPSConnOppUnknown ); |
|
669 |
|
670 if ( error == KErrNone ) |
|
671 { |
|
672 // check if IM or PEC is connected to this server |
|
673 CIMPSSAPSettings* loggedInSap = CIMPSSAPSettings::NewLC(); |
|
674 retVal = iConnectionUI->GetLoggedInSapL( *sessionSlotID, *loggedInSap ); |
|
675 |
|
676 // check if we were logged in |
|
677 if ( retVal != KErrNone ) |
|
678 { |
|
679 // we were not logged in |
|
680 // check if the log in is ongoing |
|
681 HBufC* buffer = NULL; |
|
682 |
|
683 // if connOperation is != EAppConnOppClientLogin, then buffer is not |
|
684 // initialised |
|
685 connOperation = iConnectionUI->CurrentConnectionOperationL( buffer ); |
|
686 // check if there was an ongoing login operation |
|
687 if ( connOperation == EIMPSConnOppClientLogin ) |
|
688 { |
|
689 // login was ongoing, set the sap name for later checks |
|
690 CleanupStack::PushL( buffer ); |
|
691 loggedInSap->SetSAPNameL( *buffer ); |
|
692 CleanupStack::PopAndDestroy( buffer ); |
|
693 } |
|
694 } |
|
695 |
|
696 // check if there was an active connection or an ongoing login operation |
|
697 if ( ( retVal == KErrNone ) || ( connOperation == EIMPSConnOppClientLogin ) ) |
|
698 { |
|
699 |
|
700 if ( loggedInSap->SAPName().CompareF ( iSAP->SAPName() ) == 0 ) |
|
701 { |
|
702 if ( connOperation == EIMPSConnOppClientLogin ) |
|
703 { |
|
704 // a login operation is ongoing, we cannot let the user edit the settings |
|
705 HBufC* prompt = StringLoader::LoadLC( |
|
706 R_QTN_CHAT_LOGIN_ONGOING_NOTE, |
|
707 loggedInSap->SAPName(), |
|
708 iCoeEnv ); |
|
709 |
|
710 CAknErrorNote* dlg = new ( ELeave ) CAknErrorNote( ETrue ); |
|
711 dlg->ExecuteLD( *prompt ); |
|
712 CleanupStack::PopAndDestroy( 3, sessionSlotID ); // prompt, loggedInSap, sessionSlotID |
|
713 return; |
|
714 } |
|
715 // this is the server we are logged in to |
|
716 // we have to query if we should log out |
|
717 else if ( !ConfirmLogoutL() ) |
|
718 { |
|
719 // user declined logout, we cannot delete this server |
|
720 CleanupStack::PopAndDestroy( 2, sessionSlotID ); // loggedInSap, sessionSlotID |
|
721 return; |
|
722 } |
|
723 } |
|
724 } |
|
725 CleanupStack::PopAndDestroy( loggedInSap ); |
|
726 } |
|
727 else if ( error != KErrNotFound ) |
|
728 { |
|
729 // we ignore not found error, since then we know that we dont have a connection |
|
730 User::Leave( error ); |
|
731 } |
|
732 CleanupStack::PopAndDestroy( sessionSlotID ); |
|
733 } |
|
734 |
|
735 switch ( index ) |
|
736 { |
|
737 case ESAP: |
|
738 { |
|
739 TInt returnFlags = EditSapSettingsL(); |
|
740 |
|
741 if ( ( returnFlags == KApUiEventExitRequested ) || |
|
742 ( returnFlags == KApUiEventShutDownRequested ) ) |
|
743 { |
|
744 // Exit was selected from the menu |
|
745 TryExitL ( EWVSettingsViewCmdExit ); |
|
746 iIsDeleted = ETrue; |
|
747 return; |
|
748 } |
|
749 else |
|
750 { |
|
751 break; |
|
752 } |
|
753 } |
|
754 |
|
755 |
|
756 case EServerName: |
|
757 { |
|
758 if ( iSAP->Protection() == ESAPBrandProtection ) |
|
759 { |
|
760 // show note |
|
761 CAknInformationNote* dlg = new ( ELeave ) CAknInformationNote( ETrue ); |
|
762 CleanupStack::PushL( dlg ); |
|
763 HBufC* noteText = iEikonEnv->AllocReadResourceL( R_QTN_WVSETTINGSVIEW_BRAND_SERVER_INFO ); |
|
764 CleanupStack::Pop( dlg ); |
|
765 CleanupStack::PushL( noteText ); |
|
766 dlg->ExecuteLD( *noteText ); |
|
767 CleanupStack::PopAndDestroy( noteText ); |
|
768 } |
|
769 else |
|
770 { |
|
771 TInt returnFlags = EditServerNameL( index ); |
|
772 if ( returnFlags == EEikBidCancel ) |
|
773 { |
|
774 if( !iDlgLauncher->IsActive() ) |
|
775 { |
|
776 iDlgLauncher->Call(); |
|
777 } |
|
778 return; |
|
779 } |
|
780 } |
|
781 break; |
|
782 } |
|
783 |
|
784 case EURL: |
|
785 { |
|
786 if ( iProtected ) |
|
787 { |
|
788 // this sap is protected, we do not have URL item in the listbox |
|
789 // so this item is actually user id |
|
790 iStoreOldId = ETrue; |
|
791 EditUserIdL ( index ); |
|
792 } |
|
793 else |
|
794 { |
|
795 HBufC* urlTitle = StringLoader::LoadL( R_WVSETTINGSVIEW_SETTING_CONF_URL_TITLE ); |
|
796 CleanupStack::PushL( urlTitle ); |
|
797 |
|
798 // launch a T9-enabled text setting page |
|
799 CAknSettingPage* dlg = new( ELeave ) CAknTextSettingPage( |
|
800 urlTitle, |
|
801 EAknSettingPageNoOrdinalDisplayed, // setting number (not used) |
|
802 EAknCtSettingPage, // control type |
|
803 0, // editor resource id (not used) |
|
804 R_WVSETTINGSVIEW_SETTING_CONF_URL, // setting page resource |
|
805 iURLPtr, |
|
806 CAknTextSettingPage::EPredictiveTextEntryPermitted ); |
|
807 |
|
808 dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ); |
|
809 |
|
810 iSettingItemArray->At( index )->LoadL(); |
|
811 CleanupStack::PopAndDestroy( urlTitle ); |
|
812 |
|
813 iEdited = ETrue; |
|
814 } |
|
815 break; |
|
816 } |
|
817 |
|
818 |
|
819 case EWVSettingsViewWVUserIdIndex: |
|
820 { |
|
821 if ( iProtected ) |
|
822 { |
|
823 // this sap is protected, we do not have URL item in the listbox |
|
824 // so this item is actually password |
|
825 iStoreOldId = ETrue; |
|
826 EditPasswordL ( index ); |
|
827 } |
|
828 else |
|
829 { |
|
830 iStoreOldId = ETrue; |
|
831 EditUserIdL ( index ); |
|
832 } |
|
833 break; |
|
834 } |
|
835 |
|
836 case EWVSettingsViewPasswordIndex: |
|
837 { |
|
838 iStoreOldId = ETrue; |
|
839 EditPasswordL ( index ); |
|
840 break; |
|
841 } |
|
842 |
|
843 default: |
|
844 { |
|
845 iSettingItemArray->At( index )->EditItemL( isPopup ); |
|
846 break; |
|
847 } |
|
848 } |
|
849 if ( iSettingItemArray ) |
|
850 { |
|
851 iSettingItemArray->At( index )->UpdateListBoxTextL(); |
|
852 |
|
853 // Update title-pane if needed |
|
854 if( index == EServerName ) |
|
855 { |
|
856 iTitlePaneHandler->SetTitlePaneTextL ( iSettingItemArray->At( index )->SettingTextL() ); |
|
857 } |
|
858 DrawNow(); |
|
859 } |
|
860 } |
|
861 } |
|
862 |
|
863 TInt CWVSettingsUIDefineNewServerDialog::LaunchDlgCallback( TAny* aDlg ) |
|
864 { |
|
865 CWVSettingsUIDefineNewServerDialog* dlg = static_cast<CWVSettingsUIDefineNewServerDialog*>( aDlg ); |
|
866 TRAP_IGNORE( dlg->CloseDialogL() ); |
|
867 return EFalse; |
|
868 } |
|
869 |
|
870 |
|
871 |
|
872 void CWVSettingsUIDefineNewServerDialog::CloseDialogL() |
|
873 { |
|
874 TryExitL ( EEikBidCancel ); |
|
875 } |
|
876 // ----------------------------------------------------------------------------- |
|
877 // CWVSettingsUIDefineNewServerDialog::HandleSettingPageEventL |
|
878 // (other items were commented in a header). |
|
879 // ----------------------------------------------------------------------------- |
|
880 // |
|
881 void CWVSettingsUIDefineNewServerDialog::HandleSettingPageEventL( |
|
882 CAknSettingPage* aSettingPage, |
|
883 TAknSettingPageEvent aEventType ) |
|
884 { |
|
885 switch ( aEventType ) |
|
886 { |
|
887 case EEventSettingChanged: |
|
888 { |
|
889 CCoeControl* ctrl = aSettingPage->EditorControl(); |
|
890 if ( ctrl ) |
|
891 { |
|
892 CEikEdwin* edwin = static_cast<CEikEdwin*>( ctrl ); |
|
893 if ( edwin->TextLength() == 0 && iDomainSelectionQuery ) |
|
894 { |
|
895 // User has cleared user id field, pop-up domain |
|
896 // selection query |
|
897 if ( iConnectionUI->DisplayDomainSelectionQueryL( iWVUserIdPtr, iSAP ) ) |
|
898 { |
|
899 edwin->SetTextL( &iWVUserIdPtr ); |
|
900 edwin->SetCursorPosL( 0, EFalse ); |
|
901 } |
|
902 } |
|
903 } |
|
904 break; |
|
905 } |
|
906 default: |
|
907 { |
|
908 break; |
|
909 } |
|
910 } |
|
911 } |
|
912 |
|
913 // ----------------------------------------------------------------------------- |
|
914 // CWVSettingsUIDefineNewServerDialog::EditUserIdL |
|
915 // |
|
916 // (other items were commented in a header). |
|
917 // ----------------------------------------------------------------------------- |
|
918 // |
|
919 void CWVSettingsUIDefineNewServerDialog::EditUserIdL( TInt aIndex ) |
|
920 { |
|
921 __ASSERT_DEBUG( aIndex >= 0, User::Panic( KPanicText, EWVSettingsListArrayIndexOutOfBounds ) ); |
|
922 __ASSERT_DEBUG( aIndex < iSettingItemArray->Count(), |
|
923 User::Panic( KPanicText, EWVSettingsListArrayIndexOutOfBounds ) ); |
|
924 |
|
925 if ( iStoreOldId ) |
|
926 { |
|
927 iOldUserIdPtr.Copy( iWVUserIdPtr.Left( iWVUserIdPtr.MaxLength() ) ); |
|
928 } |
|
929 |
|
930 // change input mode according to resource variation |
|
931 // This function is provided to get the setting (mode of input) from Cenrep/Resource file. |
|
932 TBool textualInput = IntResourceValueL( RSC_CHAT_VARIATION_IMPSCU_USERID_TEXTUAL_INPUTMODE ); |
|
933 |
|
934 // Get setting item |
|
935 CAknSettingItem* item = ( *iSettingItemArray )[ aIndex ]; |
|
936 |
|
937 TBool domainAccepted = EFalse; |
|
938 if ( iDomainSelectionQuery && iWVUserIdPtr.Length() == 0 ) |
|
939 { |
|
940 // If domain query variation is enabled and user id length is 0 |
|
941 // show domain selection query |
|
942 if ( !iConnectionUI ) |
|
943 { |
|
944 // iConnectionUI is NULL if define new server dialog |
|
945 // is launched in application start up when there aren't |
|
946 // any servers defined |
|
947 iConnectionUI = CIMPSPresenceConnectionUi::NewL( EIMPSConnClientIM ); |
|
948 iConnectionUIOwned = ETrue; |
|
949 } |
|
950 |
|
951 if ( iConnectionUI->DisplayDomainSelectionQueryL( iWVUserIdPtr, iSAP ) == 0 ) |
|
952 { |
|
953 // User cancelled dialog |
|
954 iStoreOldId = ETrue; |
|
955 item->LoadL(); |
|
956 item->UpdateListBoxTextL(); |
|
957 iListbox->DrawItem( aIndex ); |
|
958 return; |
|
959 } |
|
960 else |
|
961 { |
|
962 domainAccepted = ETrue; |
|
963 } |
|
964 } |
|
965 |
|
966 CAknTextSettingPage* settingPage = new ( ELeave ) CWVSettingsUserIDSettingPage ( |
|
967 R_WVSETTINGSVIEW_SETTING_CONF_WVUID, |
|
968 iWVUserIdPtr, |
|
969 CAknTextSettingPage::EZeroLengthAllowed |
|
970 | CAknTextSettingPage::EPredictiveTextEntryPermitted ); |
|
971 |
|
972 CleanupStack::PushL( settingPage ); |
|
973 |
|
974 settingPage->ConstructL(); |
|
975 CleanupStack::Pop( settingPage ); |
|
976 |
|
977 // Set flags to edwin -> domain not selected in editor when launched |
|
978 if ( domainAccepted ) |
|
979 { |
|
980 settingPage->TextControl()->AddFlagToUserFlags( CEikEdwin::ENoAutoSelection ); |
|
981 } |
|
982 |
|
983 if ( ! textualInput ) |
|
984 { |
|
985 // enable numeric input for the WVID field |
|
986 settingPage->TextControl()->SetAknEditorInputMode( EAknEditorNumericInputMode ); |
|
987 } |
|
988 |
|
989 TInt mode = CAknSettingPage::EUpdateWhenAccepted; |
|
990 if ( iDomainSelectionQuery ) |
|
991 { |
|
992 mode = CAknSettingPage::EUpdateWhenChanged; |
|
993 static_cast<CWVSettingsUserIDSettingPage*>( settingPage )->SetSettingPageObserver( this ); |
|
994 } |
|
995 |
|
996 if ( settingPage->ExecuteLD( ( CAknSettingPage::TAknSettingPageUpdateMode )mode ) ) |
|
997 { |
|
998 iEdited = ETrue; |
|
999 // accepted |
|
1000 if ( iWVUserId->Length() > 0 ) |
|
1001 { |
|
1002 // check wv id |
|
1003 if ( !( IMPSPresenceLoginDetailValidator::ValidWVLoginIdL( *iWVUserId ) ) ) |
|
1004 { |
|
1005 // show a note about the wrong wvid and return to editing |
|
1006 HBufC* prompt = StringLoader::LoadLC( R_WVSETTINGSVIEW_ERROR_WRONG_WVID, *iWVUserId ); |
|
1007 // Code scanner warning neglected to put variable on cleanup stack (Id: 35) |
|
1008 // PrepareLC pushes the dialog into cleanupstack |
|
1009 CAknNoteDialog* dlg = new ( ELeave ) CAknNoteDialog( // CSI: 35 # See above |
|
1010 CAknNoteDialog::EErrorTone , CAknNoteDialog::ELongTimeout ); |
|
1011 |
|
1012 dlg->PrepareLC( R_WVSETTINGSVIEW_ERROR_NOTE_TEMPLATE ); |
|
1013 dlg->SetTextL( *prompt ); |
|
1014 dlg->RunLD(); |
|
1015 |
|
1016 CleanupStack::PopAndDestroy( prompt ); |
|
1017 iStoreOldId = EFalse; |
|
1018 EditUserIdL ( aIndex ); |
|
1019 } |
|
1020 } |
|
1021 else |
|
1022 { |
|
1023 if ( CheckAutoLoginValuesL() ) |
|
1024 { |
|
1025 // login type was automatic, we have to rollback changes |
|
1026 iWVUserIdPtr.Copy( iOldUserIdPtr.Left( iOldUserIdPtr.MaxLength() ) ); |
|
1027 } |
|
1028 } |
|
1029 } |
|
1030 else |
|
1031 { |
|
1032 // cancel pressed |
|
1033 iWVUserIdPtr.Copy( iOldUserIdPtr.Left( iOldUserIdPtr.MaxLength() ) ); |
|
1034 } |
|
1035 |
|
1036 iStoreOldId = ETrue; |
|
1037 item->LoadL(); |
|
1038 item->UpdateListBoxTextL(); |
|
1039 iListbox->DrawItem( aIndex ); |
|
1040 } |
|
1041 |
|
1042 |
|
1043 // ----------------------------------------------------------------------------- |
|
1044 // CWVSettingsUIDefineNewServerDialog::EditPasswordL |
|
1045 // |
|
1046 // (other items were commented in a header). |
|
1047 // ----------------------------------------------------------------------------- |
|
1048 // |
|
1049 void CWVSettingsUIDefineNewServerDialog::EditPasswordL( TInt aIndex ) |
|
1050 { |
|
1051 __ASSERT_DEBUG( aIndex >= 0, User::Panic( KPanicText, EWVSettingsListArrayIndexOutOfBounds ) ); |
|
1052 __ASSERT_DEBUG( aIndex < iSettingItemArray->Count(), |
|
1053 User::Panic( KPanicText, EWVSettingsListArrayIndexOutOfBounds ) ); |
|
1054 |
|
1055 //first just edit name |
|
1056 CAknSettingItem* item = ( *iSettingItemArray )[ aIndex ]; |
|
1057 |
|
1058 if ( iStoreOldId ) |
|
1059 { |
|
1060 TPtr oldPasswordPtr ( iOldPassword->Des() ); |
|
1061 oldPasswordPtr.Copy( iPasswordPtr.Left( iPasswordPtr.MaxLength() ) ); |
|
1062 } |
|
1063 |
|
1064 CAknAlphaPasswordSettingPage* settingPage = new ( ELeave ) |
|
1065 CAknAlphaPasswordSettingPage( |
|
1066 R_WVSETTINGSVIEW_SETTING_CONF_PW, |
|
1067 iPasswordPtr , |
|
1068 iPasswordPtr ); |
|
1069 CleanupStack::PushL( settingPage ); |
|
1070 |
|
1071 settingPage->ConstructL(); |
|
1072 CleanupStack::Pop( settingPage ); |
|
1073 |
|
1074 if ( settingPage->ExecuteLD() ) |
|
1075 { |
|
1076 // Check variation about password saving warning |
|
1077 // This function is provided to get the setting (password saving warning) from Cenrep/Resource file. |
|
1078 TBool showWarning = IntResourceValueL( RSC_CHAT_VARIATION_IMPSCU_SAVE_PW_WARNING ); |
|
1079 |
|
1080 if ( showWarning && iPassword->Length() > 0 ) |
|
1081 { |
|
1082 |
|
1083 CCoeEnv* coeEnv = CCoeEnv::Static(); |
|
1084 |
|
1085 // Read texts from resources |
|
1086 HBufC* warningText = coeEnv->AllocReadResourceLC( |
|
1087 R_CHAT_SAVE_PW_WARNING ); |
|
1088 HBufC* warningHeading = coeEnv->AllocReadResourceLC( |
|
1089 R_CHAT_SAVE_PW_WARNING_HEADING ); |
|
1090 |
|
1091 // Show warning with message query dialog |
|
1092 // CodeScanner warning ignored because CS does not |
|
1093 // notice that PrepareLC puts the dialog to cleanupstack |
|
1094 CAknMessageQueryDialog* dlg = new ( ELeave ) CAknMessageQueryDialog(); // CSI: 35 # See comment above |
|
1095 dlg->PrepareLC( R_WVSETTINGSVIEW_MESSAGE_QUERY_DIALOG ); |
|
1096 dlg->QueryHeading()->SetTextL( *warningHeading ); |
|
1097 dlg->SetMessageTextL( *warningText ); |
|
1098 dlg->RunLD(); |
|
1099 |
|
1100 CleanupStack::PopAndDestroy( 2, warningText ); |
|
1101 } |
|
1102 |
|
1103 iEdited = ETrue; |
|
1104 // accepted |
|
1105 if ( iPassword->Length() == 0 ) |
|
1106 { |
|
1107 if ( CheckAutoLoginValuesL() ) |
|
1108 { |
|
1109 // login type was automatic, we have to rollback the changes |
|
1110 TPtr oldPasswordPtr ( iOldPassword->Des() ); |
|
1111 iPasswordPtr.Copy( oldPasswordPtr.Left( oldPasswordPtr.MaxLength() ) ); |
|
1112 } |
|
1113 } |
|
1114 } |
|
1115 else |
|
1116 { |
|
1117 // cancel pressed |
|
1118 TPtr oldPasswordPtr ( iOldPassword->Des() ); |
|
1119 iPasswordPtr.Copy( oldPasswordPtr.Left( oldPasswordPtr.MaxLength() ) ); |
|
1120 } |
|
1121 iStoreOldId = ETrue; |
|
1122 item->LoadL(); |
|
1123 item->UpdateListBoxTextL(); |
|
1124 iListbox->DrawItem( aIndex ); |
|
1125 } |
|
1126 |
|
1127 // ----------------------------------------------------------------------------- |
|
1128 // CWVSettingsUIDefineNewServerDialog::CheckAutoLoginValuesL |
|
1129 // |
|
1130 // (other items were commented in a header). |
|
1131 // ----------------------------------------------------------------------------- |
|
1132 // |
|
1133 TBool CWVSettingsUIDefineNewServerDialog::CheckAutoLoginValuesL() |
|
1134 { |
|
1135 TUint32 defaultSAPId( 0 ); |
|
1136 |
|
1137 if ( !iDialog ) |
|
1138 { |
|
1139 // if we dont have base dialog it means that chat launched this dialog byitself |
|
1140 // and that means that automatic login cannot be on so we can just return false |
|
1141 return EFalse; |
|
1142 } |
|
1143 |
|
1144 // Query for default SAP uid |
|
1145 iSAPSettingsStore->GetDefaultL( defaultSAPId, EIMPSIMAccessGroup ); |
|
1146 |
|
1147 if ( iSAP->Uid() == defaultSAPId ) |
|
1148 { |
|
1149 // check if the login type is automatic |
|
1150 // or automatic in home network |
|
1151 TInt imLoginType = iDialog->GetChatLoginType(); |
|
1152 if ( ( imLoginType == EWVSettingsChatLoginAutoAlways ) |
|
1153 || ( imLoginType == EWVSettingsChatLoginAutoInHomeNW ) |
|
1154 || ( imLoginType == EWVSettingsChatLoginApplicationLaunch ) ) |
|
1155 { |
|
1156 // show an information note, password cannot be removed if automatic login |
|
1157 |
|
1158 CAknInformationNote* dlg = new ( ELeave ) CAknInformationNote( ETrue ); |
|
1159 CleanupStack::PushL( dlg ); |
|
1160 HBufC* noteText = iEikonEnv->AllocReadResourceL( R_WVSETTINGSVIEW_ERROR_ID_PASSWORD_MISSING ); |
|
1161 CleanupStack::Pop( dlg ); |
|
1162 CleanupStack::PushL( noteText ); |
|
1163 dlg->ExecuteLD( *noteText ); |
|
1164 CleanupStack::PopAndDestroy( noteText ); |
|
1165 |
|
1166 |
|
1167 |
|
1168 // login type was automatic |
|
1169 return ETrue; |
|
1170 } |
|
1171 } |
|
1172 |
|
1173 return EFalse; |
|
1174 } |
|
1175 |
|
1176 // ----------------------------------------------------------------------------- |
|
1177 // CWVSettingsUIDefineNewServerDialog::EditServerNameL |
|
1178 // |
|
1179 // (other items were commented in a header). |
|
1180 // ----------------------------------------------------------------------------- |
|
1181 // |
|
1182 TInt CWVSettingsUIDefineNewServerDialog::EditServerNameL( TInt aIndex ) |
|
1183 { |
|
1184 __ASSERT_ALWAYS( aIndex >= 0, User::Panic( KPanicText, EWVSettingsListArrayIndexOutOfBounds ) ); |
|
1185 __ASSERT_ALWAYS( aIndex < iSettingItemArray->Count(), |
|
1186 User::Panic( KPanicText, EWVSettingsListArrayIndexOutOfBounds ) ); |
|
1187 |
|
1188 HBufC* srvTitle = StringLoader::LoadL( R_WVSETTINGSVIEW_SETTING_CONF_SERVER_TITLE ); |
|
1189 CleanupStack::PushL( srvTitle ); |
|
1190 |
|
1191 HBufC* oldServerName = iServerName->AllocLC(); |
|
1192 |
|
1193 // get the setting item, used later |
|
1194 CAknSettingItem* item = ( *iSettingItemArray )[ aIndex ]; |
|
1195 isDisplayedSubDialog = ETrue; |
|
1196 // launch a T9-enabled text setting page |
|
1197 CAknSettingPage* dlg = new( ELeave ) CAknTextSettingPage( |
|
1198 srvTitle, |
|
1199 EAknSettingPageNoOrdinalDisplayed, // setting number (not used) |
|
1200 EAknCtSettingPage, // control type |
|
1201 0, // editor resource id (not used) |
|
1202 R_WVSETTINGSVIEW_SETTING_CONF_SERVER, // setting page resource |
|
1203 iServerNamePtr, |
|
1204 CAknTextSettingPage::EPredictiveTextEntryPermitted ); |
|
1205 |
|
1206 TBool returnvalue(dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged )); |
|
1207 if ( iIsDeleted ) |
|
1208 { |
|
1209 CleanupStack::PopAndDestroy( 2, srvTitle ); // oldServerName, srvTitle |
|
1210 isDisplayedSubDialog = EFalse; |
|
1211 return EEikBidCancel; |
|
1212 } |
|
1213 // update setting item too |
|
1214 item->LoadL(); |
|
1215 |
|
1216 //get edited text and get rid of listbox control characters |
|
1217 |
|
1218 if ( *iServerName != *oldServerName ) |
|
1219 { |
|
1220 // the server name was edited, check that it does not become a duplicate |
|
1221 |
|
1222 TPtr name = iServerName->Des(); |
|
1223 AknTextUtils::ReplaceCharacters( name, |
|
1224 KAknReplaceListControlChars, |
|
1225 TChar( KWhiteSpace16 ) ); |
|
1226 FormUniqueServerL(); |
|
1227 item->LoadL(); |
|
1228 // set on the flag that we should save the server |
|
1229 iEdited = ETrue; |
|
1230 } |
|
1231 |
|
1232 CleanupStack::PopAndDestroy( 2, srvTitle ); // oldServerName, srvTitle |
|
1233 |
|
1234 item->UpdateListBoxTextL(); |
|
1235 iListbox->DrawItem( aIndex ); |
|
1236 |
|
1237 iTitlePaneHandler->SetTitlePaneTextL ( *iServerName ); |
|
1238 isDisplayedSubDialog = EFalse; |
|
1239 return returnvalue; |
|
1240 } |
|
1241 |
|
1242 // ----------------------------------------------------------------------------- |
|
1243 // CWVSettingsUIDefineNewServerDialog::PreLayoutDynInitL |
|
1244 // |
|
1245 // (other items were commented in a header). |
|
1246 // ----------------------------------------------------------------------------- |
|
1247 // |
|
1248 void CWVSettingsUIDefineNewServerDialog::PreLayoutDynInitL() |
|
1249 { |
|
1250 // Check disk space, use CCoeEnv's file server session |
|
1251 if ( SysUtil::FFSSpaceBelowCriticalLevelL( |
|
1252 &ControlEnv()->FsSession(), KWVSettingsServerSizeEstimate ) ) |
|
1253 { |
|
1254 // Don't show any own notes here |
|
1255 User::Leave( KErrDiskFull ); |
|
1256 } |
|
1257 |
|
1258 iCommsDb = CCommsDatabase::NewL( EDatabaseTypeIAP ); |
|
1259 iAPUtils = CApUtils::NewLC( *iCommsDb ); |
|
1260 CleanupStack::Pop( iAPUtils ); |
|
1261 |
|
1262 iDlgLauncher = new (ELeave) CAsyncCallBack( TCallBack( LaunchDlgCallback, this), |
|
1263 CActive::EPriorityStandard ); |
|
1264 CApSettingsHandler* apSettingsHnadler = CApSettingsHandler::NewLC( ETrue, // Start with selection ? |
|
1265 EApSettingsSelListIsPopUp, // desired list type |
|
1266 EApSettingsSelMenuSelectNormal, // desired menu type |
|
1267 KEApIspTypeAll, // Filtering criteria on ISP type |
|
1268 KWVSettingsViewBearerTypes, // Filtering criteria on bearer type |
|
1269 KEApSortNameAscending // Specifies the sort order to use |
|
1270 //- WLAN APN can not be used from IM Application |
|
1271 // |
|
1272 //EIPv4|EIPv6 |
|
1273 //End of |
|
1274 //The error was raised for 3.1 and we have fixed the same to 3.2 also) |
|
1275 ); |
|
1276 |
|
1277 /* To be uncommented once the CApSettingsHandler provides NewL methods. |
|
1278 // Code scanner warning ignored LC method is the only available and it is popped right after |
|
1279 iAPSettingsHandler = CApSettingsHandler::NewLC( // CSI: 49 # See above |
|
1280 ETrue, // Start with selection ? |
|
1281 EApSettingsSelListIsPopUp, // desired list type |
|
1282 EApSettingsSelMenuSelectNormal, // desired menu type |
|
1283 KEApIspTypeAll, // Filtering criteria on ISP type |
|
1284 KWVSettingsViewBearerTypes, // Filtering criteria on bearer type |
|
1285 KEApSortNameAscending, // Specifies the sort order to use |
|
1286 //WLAN APN can not be used from IM Application |
|
1287 EIPv4|EIPv6 |
|
1288 //End |
|
1289 //The error was raised for 3.1 and we have fixed the same to 3.2 also |
|
1290 |
|
1291 ); */ |
|
1292 iAPSettingsHandler = apSettingsHnadler; |
|
1293 |
|
1294 CleanupStack::Pop( apSettingsHnadler ); |
|
1295 |
|
1296 HBufC* popUpPrompt = iCoeEnv->AllocReadResourceLC( R_WVSETTINGSVIEW_SETTING_CONF_SAP_TITLE ); |
|
1297 iAPSettingsHandler->SetTextOverrideL( EPopupPromptText, *popUpPrompt ); |
|
1298 CleanupStack::PopAndDestroy( popUpPrompt ); //popUpPrompt |
|
1299 |
|
1300 iServerName = HBufC::NewL( KWVSettingsServerNameMaxLength ); |
|
1301 iServerNamePtr.Set( iServerName->Des() ); |
|
1302 |
|
1303 iIAPName = HBufC::NewL( KWVSettingsServerSAPMaxLength ); |
|
1304 iIAPNamePtr.Set( iIAPName->Des() ); |
|
1305 |
|
1306 iWVUserId = HBufC::NewL( KWVSettingsServerWVUserIdMaxLength ); |
|
1307 iWVUserIdPtr.Set( iWVUserId->Des() ); |
|
1308 |
|
1309 iOldUserId = HBufC::NewL( KWVSettingsServerWVUserIdMaxLength ); |
|
1310 iOldUserIdPtr.Set ( iOldUserId->Des() ); |
|
1311 |
|
1312 iPassword = HBufC::NewL( KWVSettingsServerPasswordMaxLength ); |
|
1313 iPasswordPtr.Set( iPassword->Des() ); |
|
1314 |
|
1315 iURL = HBufC::NewL( KWVSettingsServerURLMaxlength ); |
|
1316 iURLPtr.Set( iURL->Des() ); |
|
1317 |
|
1318 iOldPassword = HBufC::NewL( KWVSettingsServerPasswordMaxLength ); |
|
1319 |
|
1320 if ( iEditMode == EEditServer ) |
|
1321 { |
|
1322 LoadExistingItemL(); |
|
1323 } |
|
1324 else |
|
1325 { |
|
1326 iSAP = CIMPSSAPSettings::NewL(); |
|
1327 FormUniqueServerNameL(); |
|
1328 } |
|
1329 |
|
1330 if ( iObserver ) |
|
1331 { |
|
1332 // iObserver might not exist if we didn't get here through application settings |
|
1333 // update previous server name |
|
1334 iOldServerName = iObserver->CurrentServerNameLC(); |
|
1335 CleanupStack::Pop(); |
|
1336 // load resource branding for this server (settings contain branded items) |
|
1337 // if this is different server than old server |
|
1338 if ( iOldServerName->Compare( *iServerName ) != 0 ) |
|
1339 { |
|
1340 iObserver->ServerChangedL( *iServerName ); |
|
1341 } |
|
1342 } |
|
1343 |
|
1344 iTitlePaneHandler->SetTitlePaneTextL ( *iServerName ); |
|
1345 |
|
1346 // check if the sap is protected |
|
1347 if ( iSAP ) |
|
1348 { |
|
1349 // check if the sap is protected |
|
1350 if ( iSAP->Protection() == ESAPBrandProtection ) |
|
1351 { |
|
1352 iProtected = ETrue; |
|
1353 } |
|
1354 } |
|
1355 |
|
1356 iListbox = |
|
1357 static_cast< CAknSettingStyleListBox* >( Control( EWVSettingsViewControlIdDefNewServer ) ); |
|
1358 |
|
1359 // Create item-array starting from ordinal 0 |
|
1360 iSettingItemArray = new ( ELeave ) CAknSettingItemArray( ELastItemMarker, EFalse, 1 ); |
|
1361 |
|
1362 if ( iProtected ) |
|
1363 { |
|
1364 // protected server -> we need to load icon array |
|
1365 LoadIconArrayL(); |
|
1366 } |
|
1367 |
|
1368 AddItemL( iServerNamePtr, |
|
1369 EServerName, |
|
1370 R_WVSETTINGSVIEW_SETTING_CONF_SERVER_TITLE, |
|
1371 R_WVSETTINGSVIEW_SETTING_CONF_SERVER, |
|
1372 ETrue, |
|
1373 iProtected ); |
|
1374 |
|
1375 AddItemL( iIAPNamePtr, |
|
1376 ESAP, |
|
1377 R_WVSETTINGSVIEW_SETTING_CONF_SAP_TITLE, |
|
1378 R_WVSETTINGSVIEW_SETTING_CONF_SAP, |
|
1379 ETrue ); |
|
1380 |
|
1381 // if the sap is protected we do not show the URL field to the user |
|
1382 if ( !iProtected ) |
|
1383 { |
|
1384 AddItemL( iURLPtr, |
|
1385 EURL, |
|
1386 R_WVSETTINGSVIEW_SETTING_CONF_URL_TITLE, |
|
1387 R_WVSETTINGSVIEW_SETTING_CONF_URL, |
|
1388 ETrue ); |
|
1389 } |
|
1390 |
|
1391 |
|
1392 AddItemL( iWVUserIdPtr, |
|
1393 EWVId, |
|
1394 R_WVSETTINGSVIEW_SETTING_CONF_WVUID_TITLE, |
|
1395 R_WVSETTINGSVIEW_SETTING_CONF_WVUID ); |
|
1396 |
|
1397 AddItemL( iPasswordPtr, |
|
1398 EPassword, |
|
1399 R_WVSETTINGSVIEW_SETTING_CONF_PW_TITLE, |
|
1400 R_WVSETTINGSVIEW_SETTING_CONF_PW, |
|
1401 EFalse, |
|
1402 EFalse, |
|
1403 EPasswordItem ); |
|
1404 |
|
1405 CTextListBoxModel* model = iListbox->Model(); |
|
1406 model->SetItemTextArray( iSettingItemArray ); |
|
1407 model->SetOwnershipType( ELbmDoesNotOwnItemArray ); // Ownership retained by us |
|
1408 |
|
1409 iSettingItemArray->RecalculateVisibleIndicesL(); |
|
1410 iListbox->CreateScrollBarFrameL( ETrue ); |
|
1411 iListbox->ScrollBarFrame()->SetScrollBarVisibilityL( |
|
1412 CEikScrollBarFrame::EOff, |
|
1413 CEikScrollBarFrame::EAuto ); |
|
1414 iListbox->HandleItemAdditionL(); |
|
1415 iListbox->SetListBoxObserver( this ); |
|
1416 iListbox->UpdateScrollBarsL(); |
|
1417 |
|
1418 // Check domain query variation |
|
1419 // This function is provided to get the setting (domain query variation) from Cenrep/Resource file. |
|
1420 iDomainSelectionQuery = IntResourceValueL( RSC_CHAT_VARIATION_IMPSCU_DOMAIN_SELECTION ); |
|
1421 |
|
1422 } |
|
1423 |
|
1424 // ----------------------------------------------------------------------------- |
|
1425 // CWVSettingsUIDefineNewServerDialog::DynInitMenuPaneL |
|
1426 // |
|
1427 // (other items were commented in a header). |
|
1428 // ----------------------------------------------------------------------------- |
|
1429 // |
|
1430 void CWVSettingsUIDefineNewServerDialog::DynInitMenuPaneL( TInt aResourceId, |
|
1431 CEikMenuPane* aMenuPane ) |
|
1432 { |
|
1433 // if we're displaying general menu and help feature is not supported.. |
|
1434 if ( aResourceId == R_WVSETTINGSVIEW_GENERAL_MENU && |
|
1435 !FeatureManager::FeatureSupported( KFeatureIdHelp ) ) |
|
1436 { |
|
1437 // dimm the help menu item |
|
1438 aMenuPane->SetItemDimmed( EWVSettingsViewCmdHelp, ETrue ); |
|
1439 } |
|
1440 } |
|
1441 |
|
1442 // ----------------------------------------------------------------------------- |
|
1443 // CWVSettingsUIDefineNewServerDialog::PostLayoutDynInitL |
|
1444 // |
|
1445 // (other items were commented in a header). |
|
1446 // ----------------------------------------------------------------------------- |
|
1447 // |
|
1448 void CWVSettingsUIDefineNewServerDialog::PostLayoutDynInitL() |
|
1449 { |
|
1450 if ( iEditMode == EEditServer ) |
|
1451 { |
|
1452 ChangeFocusToInvalidCompulsoryField(); |
|
1453 } |
|
1454 } |
|
1455 |
|
1456 // ----------------------------------------------------------------------------- |
|
1457 // CWVSettingsUIDefineNewServerDialog::OkToExitL |
|
1458 // |
|
1459 // (other items were commented in a header). |
|
1460 // ----------------------------------------------------------------------------- |
|
1461 // |
|
1462 TBool CWVSettingsUIDefineNewServerDialog::OkToExitL( TInt aButtonId ) |
|
1463 { |
|
1464 |
|
1465 |
|
1466 if ( iExitReason == EApplicationExit ) |
|
1467 { |
|
1468 return EFalse; |
|
1469 } |
|
1470 |
|
1471 // show the menu |
|
1472 if ( aButtonId == EAknSoftkeyOptions ) |
|
1473 { |
|
1474 DisplayMenuL(); |
|
1475 return EFalse; |
|
1476 } |
|
1477 |
|
1478 if ( aButtonId == EAknSoftkeyEdit ) |
|
1479 { |
|
1480 // MSK command |
|
1481 ProcessCommandL( aButtonId ); |
|
1482 return EFalse; |
|
1483 } |
|
1484 |
|
1485 // Take old servername and ask UI components to extrernalize their state |
|
1486 TBuf<KWVSettingsServerNameMaxLength> serverName( *iServerName ); |
|
1487 SignalStoreLToAllL(); |
|
1488 |
|
1489 // If all the data is filled, then save, otherwise ask for deletion |
|
1490 if ( CompulsoryItemsFilled() ) |
|
1491 { |
|
1492 |
|
1493 if ( serverName != *iServerName ) |
|
1494 { |
|
1495 FormUniqueServerL(); |
|
1496 } |
|
1497 |
|
1498 // If everything went ok, then store server |
|
1499 // only try to save if something is edited |
|
1500 if ( iEdited ) |
|
1501 { |
|
1502 StoreAllItemsL(); |
|
1503 } |
|
1504 |
|
1505 if ( ( aButtonId == EWVSettingsViewCmdExit ) || ( aButtonId == EAknSoftkeyExit ) ) |
|
1506 { |
|
1507 iExitReason = EApplicationExit; |
|
1508 } |
|
1509 else |
|
1510 { |
|
1511 iExitReason = EServerSaved; |
|
1512 } |
|
1513 } |
|
1514 else |
|
1515 { |
|
1516 // if application exit requested, we don't show the query about deleting the server |
|
1517 if ( ( aButtonId == EAknSoftkeyExit ) || ( aButtonId == EWVSettingsViewCmdExit ) ) |
|
1518 { |
|
1519 iExitReason = EApplicationExit; |
|
1520 return ETrue; |
|
1521 } |
|
1522 CAknQueryDialog* dlg = new ( ELeave ) CAknQueryDialog( CAknQueryDialog::ENoTone ); |
|
1523 CleanupStack::PushL( dlg ); |
|
1524 |
|
1525 // Set prompt |
|
1526 HBufC* text = CEikonEnv::Static()->AllocReadResourceLC( RSC_WVSETTINGSVIEW_COMPUL_QUERY ); |
|
1527 dlg->SetPromptL( *text ); |
|
1528 CleanupStack::PopAndDestroy( text ); |
|
1529 |
|
1530 CleanupStack::Pop( dlg ); |
|
1531 TInt ret( dlg->ExecuteLD( R_DELETE_CONFIRMATION_QUERY ) ); |
|
1532 |
|
1533 if ( ( ret == EAknSoftkeyOk ) || ( ret == EAknSoftkeyYes ) ) |
|
1534 { |
|
1535 iExitReason = EMissingCompulsory; |
|
1536 } |
|
1537 else |
|
1538 { |
|
1539 // User declined delete -> return to form |
|
1540 ChangeFocusToInvalidCompulsoryField(); |
|
1541 return EFalse; |
|
1542 } |
|
1543 } |
|
1544 |
|
1545 // load resource branding for the previous server (settings contain branded items) |
|
1546 if ( iObserver ) |
|
1547 { |
|
1548 // iObserver might not exist if we didn't get here through application settings |
|
1549 // If edited server wasr different than old server, load old server resources |
|
1550 if ( iOldServerName->Compare( *iServerName ) != 0 ) |
|
1551 { |
|
1552 iObserver->ServerChangedL( *iOldServerName ); |
|
1553 } |
|
1554 } |
|
1555 |
|
1556 return ETrue; |
|
1557 } |
|
1558 |
|
1559 // ----------------------------------------------------------------------------- |
|
1560 // CWVSettingsUIDefineNewServerDialog::GenerateFlagValue |
|
1561 // Generates safe value for given seed (enum). This needs |
|
1562 // because we use this number in single master-flag with OR-operations |
|
1563 // (other items were commented in a header). |
|
1564 // ----------------------------------------------------------------------------- |
|
1565 // |
|
1566 TInt CWVSettingsUIDefineNewServerDialog::GenerateFlagValue( TInt aSeed ) const |
|
1567 { |
|
1568 TInt generatedNumber( 1 ); |
|
1569 |
|
1570 for ( TInt i( 0 ); i < aSeed; ++i ) |
|
1571 { |
|
1572 generatedNumber *= 2; |
|
1573 } |
|
1574 |
|
1575 return generatedNumber; |
|
1576 } |
|
1577 |
|
1578 // ----------------------------------------------------------------------------- |
|
1579 // CWVSettingsUIDefineNewServerDialog::ServerListL |
|
1580 // |
|
1581 // (other items were commented in a header). |
|
1582 // ----------------------------------------------------------------------------- |
|
1583 // |
|
1584 CDesCArrayFlat* CWVSettingsUIDefineNewServerDialog::ServerListL() const |
|
1585 { |
|
1586 TInt srvCount( iSAPSettingsStore->SAPCountL( EIMPSIMAccessGroup ) ); |
|
1587 |
|
1588 if ( srvCount > 0 ) |
|
1589 { |
|
1590 CIMPSSAPSettingsList* sapList = CIMPSSAPSettingsList::NewLC(); |
|
1591 iSAPSettingsStore->PopulateSAPSettingsListL( *sapList, EIMPSIMAccessGroup ); |
|
1592 |
|
1593 //get existing server names |
|
1594 CDesCArrayFlat* serverNames = new( ELeave ) CDesCArrayFlat( srvCount ); |
|
1595 CleanupStack::PushL( serverNames ); |
|
1596 |
|
1597 for ( TInt ii( 0 ); ii < srvCount; ++ii ) |
|
1598 { |
|
1599 serverNames->AppendL( sapList->MdcaPoint( ii ) ); |
|
1600 } |
|
1601 |
|
1602 CleanupStack::Pop( serverNames ); |
|
1603 CleanupStack::PopAndDestroy( sapList ); |
|
1604 return serverNames; |
|
1605 } |
|
1606 |
|
1607 return NULL; |
|
1608 } |
|
1609 |
|
1610 // ----------------------------------------------------------------------------- |
|
1611 // CWVSettingsUIDefineNewServerDialog::FormUniqueServerL |
|
1612 // |
|
1613 // (other items were commented in a header). |
|
1614 // ----------------------------------------------------------------------------- |
|
1615 // |
|
1616 void CWVSettingsUIDefineNewServerDialog::FormUniqueServerL() |
|
1617 { |
|
1618 TInt pos( 0 ); |
|
1619 CDesCArrayFlat* serverNames = ServerListL(); |
|
1620 |
|
1621 if ( !serverNames ) |
|
1622 { |
|
1623 return; |
|
1624 } |
|
1625 |
|
1626 CleanupStack::PushL( serverNames ); |
|
1627 |
|
1628 TBool serverExists( serverNames->Find( *iServerName, pos ) == 0 ); |
|
1629 |
|
1630 if ( serverExists ) |
|
1631 { |
|
1632 // the name is already in the list modify the new name |
|
1633 TBuf<KWVSettingsServerNameMaxLength> serverName; |
|
1634 serverName.Copy( ( *iServerName ).Left( serverName.MaxLength() ) ); |
|
1635 |
|
1636 if ( FormUniqueNameL( *serverNames, serverName ) ) |
|
1637 { |
|
1638 iServerNamePtr.Copy( serverName.Left( iServerNamePtr.MaxLength() ) ); |
|
1639 } |
|
1640 } |
|
1641 |
|
1642 CleanupStack::PopAndDestroy( serverNames ); |
|
1643 } |
|
1644 |
|
1645 |
|
1646 // --------------------------------------------------------- |
|
1647 // CWVSettingsUIDefineNewServerDialog::OfferKeyEventL() |
|
1648 // |
|
1649 // (other items were commented in a header). |
|
1650 // --------------------------------------------------------- |
|
1651 // |
|
1652 TKeyResponse CWVSettingsUIDefineNewServerDialog::OfferKeyEventL( |
|
1653 const TKeyEvent& aKeyEvent, |
|
1654 TEventCode aType ) |
|
1655 { |
|
1656 if ( aKeyEvent.iCode == EKeyEscape ) |
|
1657 { |
|
1658 if ( isDisplayedSubDialog ) |
|
1659 { |
|
1660 iIsDeleted = ETrue; |
|
1661 } |
|
1662 else |
|
1663 { |
|
1664 TryExitL( EAknSoftkeyCancel ); |
|
1665 } |
|
1666 return EKeyWasConsumed; |
|
1667 } |
|
1668 |
|
1669 if ( iIsDeleted ) |
|
1670 { |
|
1671 return EKeyWasConsumed; |
|
1672 } |
|
1673 else |
|
1674 { |
|
1675 return iListbox->OfferKeyEventL( aKeyEvent, aType ); |
|
1676 } |
|
1677 } |
|
1678 |
|
1679 // ----------------------------------------------------------------------------- |
|
1680 // CWVSettingsUIDefineNewServerDialog::ConfirmLogoutL |
|
1681 // |
|
1682 // (other items were commented in a header). |
|
1683 // ----------------------------------------------------------------------------- |
|
1684 // |
|
1685 TBool CWVSettingsUIDefineNewServerDialog::ConfirmLogoutL() |
|
1686 { |
|
1687 |
|
1688 // check if pec and chat are logged in |
|
1689 TBool loggedIn = iConnectionUI->LoggedInL( EIMPSConnClientIM ); |
|
1690 |
|
1691 if ( loggedIn ) |
|
1692 { |
|
1693 // ask confirmation about logging out |
|
1694 CAknQueryDialog* dlg = new ( ELeave ) CAknQueryDialog( CAknQueryDialog::ENoTone ); |
|
1695 CleanupStack::PushL( dlg ); |
|
1696 // Set prompt |
|
1697 HBufC* text = CEikonEnv::Static()->AllocReadResourceLC( |
|
1698 R_WVSETTINGSVIEW_ERROR_ID_ACTIVE_CONNECTION ); |
|
1699 dlg->SetPromptL( *text ); |
|
1700 CleanupStack::PopAndDestroy( text ); |
|
1701 CleanupStack::Pop( dlg ); |
|
1702 TInt ret( dlg->ExecuteLD( R_ACTIVE_CONNECTION_CONFIRMATION_QUERY ) ); |
|
1703 |
|
1704 if ( ( ret == EAknSoftkeyOk ) || ( ret == EAknSoftkeyYes ) ) |
|
1705 { |
|
1706 // user confirmed logout -> disconnect all open connections |
|
1707 CPEngNWSessionSlotID2* sessionSlotID = |
|
1708 iConnectionUI->GetActiveNWSessionSlotIDL( EIMPSConnClientIM ); |
|
1709 CleanupStack::PushL( sessionSlotID ); |
|
1710 User::LeaveIfError( iConnectionUI->LogoutL( *sessionSlotID ) ); |
|
1711 CleanupStack::PopAndDestroy( sessionSlotID ); |
|
1712 return ETrue; |
|
1713 } |
|
1714 else |
|
1715 { |
|
1716 // the user declined the logout, we can just return EFalse |
|
1717 return EFalse; |
|
1718 } |
|
1719 } |
|
1720 |
|
1721 return EFalse; |
|
1722 } |
|
1723 |
|
1724 // ----------------------------------------------------------------------------- |
|
1725 // CWVSettingsUIDefineNewServerDialog::LoadIconArrayL |
|
1726 // |
|
1727 // (other items were commented in a header). |
|
1728 // ----------------------------------------------------------------------------- |
|
1729 // |
|
1730 void CWVSettingsUIDefineNewServerDialog::LoadIconArrayL() |
|
1731 { |
|
1732 // Create array for listbox graphics |
|
1733 CAknIconArray* icons = new ( ELeave ) CAknIconArray( 1 ); // one icon in array |
|
1734 CleanupStack::PushL( icons ); |
|
1735 CFbsBitmap* bitmap = NULL; |
|
1736 CFbsBitmap* mask = NULL; |
|
1737 |
|
1738 TFileName bitmapfilepath; |
|
1739 bitmapfilepath.Append( TParsePtrC( PathInfo::RomRootPath() ).Drive() ); |
|
1740 bitmapfilepath.Append( KDC_APP_BITMAP_DIR() ); |
|
1741 bitmapfilepath.Append( KBitmapFile() ); |
|
1742 |
|
1743 AknsUtils::CreateIconLC( AknsUtils::SkinInstance(), |
|
1744 KAknsIIDQgnIndiSettProtectedAdd, |
|
1745 bitmap, mask, bitmapfilepath, |
|
1746 EMbmApsettingsQgn_indi_sett_protected_add, |
|
1747 EMbmApsettingsQgn_indi_sett_protected_add_mask ); |
|
1748 icons->AppendL( CGulIcon::NewL( bitmap, mask ) ); |
|
1749 CleanupStack::Pop( 2 ); // mask, bitmap |
|
1750 |
|
1751 CArrayPtr<CGulIcon>* oldIconArray = iListbox->ItemDrawer()->ColumnData()->IconArray(); |
|
1752 |
|
1753 if ( oldIconArray ) |
|
1754 { |
|
1755 oldIconArray->ResetAndDestroy(); |
|
1756 delete oldIconArray; |
|
1757 } |
|
1758 |
|
1759 // Transfer ownership to listbox |
|
1760 iListbox->ItemDrawer()->ColumnData()->SetIconArray( icons ); |
|
1761 CleanupStack::Pop( icons ); |
|
1762 } |
|
1763 // --------------------------------------------------------- |
|
1764 // CWVSettingsUIDefineNewServerDialog::MappedCommandId() |
|
1765 // (other items were commented in a header). |
|
1766 // --------------------------------------------------------- |
|
1767 // |
|
1768 TInt CWVSettingsUIDefineNewServerDialog::MappedCommandId( TInt aButtonId ) |
|
1769 { |
|
1770 // change cancel id so avkon don't remap it to 0 |
|
1771 if ( aButtonId == EEikBidCancel ) |
|
1772 { |
|
1773 // This value has to be something else than EEikBidCancel |
|
1774 // returned value in here is NOT the return value of ExecuteLD. |
|
1775 return EEikBidCancel + 1; |
|
1776 } |
|
1777 return aButtonId; |
|
1778 } |
|
1779 |
|
1780 // ----------------------------------------------------------------------------- |
|
1781 // CWVSettingsUIDefineNewServerDialog::IntResourceValueL() |
|
1782 // @param aResourceId The resource ID to be fetched from Cenrep (if present) or else from the variation file |
|
1783 // ----------------------------------------------------------------------------- |
|
1784 // |
|
1785 TInt CWVSettingsUIDefineNewServerDialog::IntResourceValueL( TInt aResourceId ) |
|
1786 { |
|
1787 |
|
1788 TInt val( 0 ); |
|
1789 TInt err ( KErrNone ); |
|
1790 CRepository* rep = 0; |
|
1791 |
|
1792 TRAP( err, rep = CRepository::NewL( KCRUidIMNG ) ); |
|
1793 |
|
1794 if ( err == KErrNone ) |
|
1795 { |
|
1796 TInt key = aResourceId + KIMCUStartVariationID; |
|
1797 |
|
1798 err = rep->Get( key, val ); |
|
1799 |
|
1800 delete rep; |
|
1801 } |
|
1802 |
|
1803 if ( err != KErrNone ) |
|
1804 { |
|
1805 |
|
1806 TResourceReader reader; |
|
1807 |
|
1808 aResourceId = aResourceId + RSC_CRRSS_CHAT_VARIATION_IMPSCU_START_ID; |
|
1809 |
|
1810 CCoeEnv::Static()->CreateResourceReaderLC( |
|
1811 reader, |
|
1812 aResourceId ); |
|
1813 val = reader.ReadInt32(); |
|
1814 CleanupStack::PopAndDestroy(); // reader |
|
1815 |
|
1816 } |
|
1817 |
|
1818 return val; |
|
1819 |
|
1820 } |
|
1821 |
|
1822 |
|
1823 |
|
1824 /** |
|
1825 * Help key support - GetHelpContext is called by the framework on |
|
1826 * event EAknCmdHelp |
|
1827 * -------------------------------------------------------------------------------- |
|
1828 * CWVSettingsUIDefineNewServerDialog::GetHelpContext |
|
1829 * @param aContext The context dependent on the current view is passed by the framework. |
|
1830 */ |
|
1831 void CWVSettingsUIDefineNewServerDialog::GetHelpContext( |
|
1832 TCoeHelpContext& aContext ) const |
|
1833 { |
|
1834 aContext.iMajor = KUidChatClient; |
|
1835 aContext.iContext = KIMNG_HLP_DEFSERVER ; |
|
1836 } |
|
1837 |
|
1838 |
|
1839 |
|
1840 // End of File |