52
|
1 |
/*
|
|
2 |
* Copyright (c) 2005 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 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
// INCLUDE FILES
|
|
20 |
#include <AknIconArray.h> // for GulArray
|
|
21 |
#include <aknconsts.h> // for KAvkonBitmapFile
|
|
22 |
|
|
23 |
#include "AspSettingDialog.h"
|
|
24 |
#include "AspProfileDialog.h"
|
|
25 |
#include "AspScheduleDialog.h"
|
|
26 |
#include "AspSchedule.h"
|
|
27 |
#include "AspDialogUtil.h"
|
|
28 |
#include "AspLogDialog.h"
|
|
29 |
#include "AspUtil.h"
|
|
30 |
#include "AspProfileWizardDialog.h"
|
|
31 |
#include "AspDebug.h"
|
|
32 |
#include "AspSyncUtil.rh"
|
|
33 |
#include "AspAdvanceSettingsDialog.h"
|
|
34 |
|
|
35 |
#include <aknsettingitemlist.h>
|
|
36 |
|
|
37 |
#include <csxhelp/ds.hlp.hrh> // for help text ids
|
|
38 |
|
|
39 |
#ifndef RD_DSUI_TIMEDSYNC
|
|
40 |
#include <avkon.mbg>
|
|
41 |
#else
|
|
42 |
#include "AspSettingViewDialog.h"
|
|
43 |
#endif
|
|
44 |
#include <DataSyncInternalPSKeys.h>
|
|
45 |
#include "AspAutoSyncHandler.h"
|
|
46 |
#include <featmgr.h> // FeatureManager
|
|
47 |
|
|
48 |
const TInt KMSKControlId( CEikButtonGroupContainer::EMiddleSoftkeyPosition );
|
|
49 |
|
|
50 |
|
|
51 |
|
|
52 |
|
|
53 |
// ============================ MEMBER FUNCTIONS ===============================
|
|
54 |
|
|
55 |
|
|
56 |
|
|
57 |
|
|
58 |
/******************************************************************************
|
|
59 |
* class CAspSettingDialog
|
|
60 |
******************************************************************************/
|
|
61 |
|
|
62 |
// -----------------------------------------------------------------------------
|
|
63 |
// CAspSettingDialog::ShowDialogL
|
|
64 |
//
|
|
65 |
// -----------------------------------------------------------------------------
|
|
66 |
//
|
|
67 |
TBool CAspSettingDialog::ShowDialogL(TAspParam& aParam)
|
|
68 |
{
|
|
69 |
CAspSettingDialog* dialog = CAspSettingDialog::NewL(aParam);
|
|
70 |
|
|
71 |
TBool ret = dialog->ExecuteLD(R_ASP_SETTING_DIALOG);
|
|
72 |
|
|
73 |
return ret;
|
|
74 |
}
|
|
75 |
|
|
76 |
|
|
77 |
// -----------------------------------------------------------------------------
|
|
78 |
// CAspSettingDialog::NewL
|
|
79 |
//
|
|
80 |
// -----------------------------------------------------------------------------
|
|
81 |
//
|
|
82 |
CAspSettingDialog* CAspSettingDialog::NewL(TAspParam& aParam)
|
|
83 |
{
|
|
84 |
FLOG( _L("CAspSettingDialog::NewL START") );
|
|
85 |
|
|
86 |
CAspSettingDialog* self = new (ELeave) CAspSettingDialog(aParam);
|
|
87 |
CleanupStack::PushL(self);
|
|
88 |
self->ConstructL();
|
|
89 |
CleanupStack::Pop(self);
|
|
90 |
|
|
91 |
FLOG( _L("CAspSettingDialog::NewL END") );
|
|
92 |
return self;
|
|
93 |
}
|
|
94 |
|
|
95 |
|
|
96 |
// -----------------------------------------------------------------------------
|
|
97 |
// CAspSettingDialog::CAspSettingDialog
|
|
98 |
//
|
|
99 |
// -----------------------------------------------------------------------------
|
|
100 |
//
|
|
101 |
CAspSettingDialog::CAspSettingDialog(TAspParam& aParam)
|
|
102 |
{
|
|
103 |
iApplicationId = aParam.iApplicationId;
|
|
104 |
iSyncSession = aParam.iSyncSession;
|
|
105 |
iDialogMode = aParam.iMode;
|
|
106 |
|
|
107 |
iCurrentProfileId = KErrNotFound;
|
|
108 |
iCurrentProfileName = KNullDesC;
|
|
109 |
|
|
110 |
__ASSERT_ALWAYS(iSyncSession, TUtil::Panic(KErrGeneral));
|
|
111 |
}
|
|
112 |
|
|
113 |
|
|
114 |
// -----------------------------------------------------------------------------
|
|
115 |
// CAspSettingDialog::ConstructL
|
|
116 |
//
|
|
117 |
// -----------------------------------------------------------------------------
|
|
118 |
//
|
|
119 |
void CAspSettingDialog::ConstructL()
|
|
120 |
{
|
|
121 |
FLOG( _L("CAspSettingDialog::ConstructL START") );
|
|
122 |
|
|
123 |
CAknDialog::ConstructL(R_ASP_SETTING_DIALOG_MENU);
|
|
124 |
|
|
125 |
iSettingEnforcement = TUtil::SettingEnforcementState();
|
|
126 |
|
|
127 |
TAspParam param(iApplicationId, iSyncSession);
|
|
128 |
iProfileList = CAspProfileList::NewL(param);
|
|
129 |
iProfileList->ReadAllProfilesL(CAspProfileList::ENoMandatoryCheck);
|
|
130 |
iProfileList->Sort();
|
|
131 |
|
|
132 |
param.iMode = CAspContentList::EInitDataProviders;
|
|
133 |
iContentList = CAspContentList::NewL(param);
|
|
134 |
|
|
135 |
// get previous title so it can be restored
|
|
136 |
iStatusPaneHandler = CStatusPaneHandler::NewL(iAvkonAppUi);
|
|
137 |
iStatusPaneHandler->StoreOriginalTitleL();
|
|
138 |
|
|
139 |
iAutoSyncDialog = EFalse;
|
|
140 |
|
|
141 |
#ifdef RD_DSUI_TIMEDSYNC
|
|
142 |
|
|
143 |
iTabHandler = new (ELeave) CAspTabbedNaviPaneHandler(iAvkonAppUi->StatusPane() ,this);
|
|
144 |
iUpdateTabGroup = ETrue;
|
|
145 |
|
|
146 |
#else
|
|
147 |
// store current navi pane
|
|
148 |
iStatusPaneHandler->StoreNavipaneL();
|
|
149 |
|
|
150 |
#endif
|
|
151 |
|
|
152 |
|
|
153 |
|
|
154 |
iResHandler = CAspResHandler::NewL();
|
|
155 |
|
|
156 |
// start listening sync database events
|
|
157 |
iDbNotifier = CAspDbNotifier::NewL(param, this);
|
|
158 |
iDbNotifier->RequestL();
|
|
159 |
|
|
160 |
iPopupNote = CAknInfoPopupNoteController::NewL();
|
|
161 |
iBearerHandler = CAspBearerHandler::NewL(param);
|
|
162 |
|
|
163 |
SetCurrentProfileL();
|
|
164 |
|
|
165 |
FLOG( _L("CAspSettingDialog::ConstructL END") );
|
|
166 |
}
|
|
167 |
|
|
168 |
|
|
169 |
// -----------------------------------------------------------------------------
|
|
170 |
// Destructor
|
|
171 |
//
|
|
172 |
// -----------------------------------------------------------------------------
|
|
173 |
//
|
|
174 |
CAspSettingDialog::~CAspSettingDialog()
|
|
175 |
{
|
|
176 |
FLOG( _L("CAspSettingDialog::~CAspSettingDialog START") );
|
|
177 |
|
|
178 |
delete iProfileList;
|
|
179 |
delete iContentList;
|
|
180 |
|
|
181 |
delete iStatusPaneHandler;
|
|
182 |
delete iResHandler;
|
|
183 |
|
|
184 |
delete iDbNotifier;
|
|
185 |
iDbNotifier = NULL;
|
|
186 |
|
|
187 |
delete iSyncHandler; // created when sync is started
|
|
188 |
|
|
189 |
if (iAvkonAppUi)
|
|
190 |
{
|
|
191 |
iAvkonAppUi->RemoveFromStack(this);
|
|
192 |
}
|
|
193 |
|
|
194 |
if (iPopupNote)
|
|
195 |
{
|
|
196 |
iPopupNote->HideInfoPopupNote();
|
|
197 |
delete iPopupNote;
|
|
198 |
}
|
|
199 |
|
|
200 |
delete iBearerHandler;
|
|
201 |
|
|
202 |
#ifdef RD_DSUI_TIMEDSYNC
|
|
203 |
|
|
204 |
delete iTabHandler;
|
|
205 |
#endif
|
|
206 |
|
|
207 |
FLOG( _L("CAspSettingDialog::~CAspSettingDialog END") );
|
|
208 |
}
|
|
209 |
|
|
210 |
|
|
211 |
//------------------------------------------------------------------------------
|
|
212 |
// CAspSettingDialog::ActivateL (from CCoeControl)
|
|
213 |
//
|
|
214 |
// Called by system when dialog is activated
|
|
215 |
//------------------------------------------------------------------------------
|
|
216 |
//
|
|
217 |
void CAspSettingDialog::ActivateL()
|
|
218 |
{
|
|
219 |
CAknDialog::ActivateL();
|
|
220 |
|
|
221 |
// this cannot be in ConstructL which is executed before dialog is launched
|
|
222 |
iAvkonAppUi->AddToStackL(this);
|
|
223 |
}
|
|
224 |
|
|
225 |
|
|
226 |
//------------------------------------------------------------------------------
|
|
227 |
// CAspSettingDialog::GetHelpContext
|
|
228 |
//
|
|
229 |
//
|
|
230 |
//------------------------------------------------------------------------------
|
|
231 |
//
|
|
232 |
void CAspSettingDialog::GetHelpContext(TCoeHelpContext& aContext) const
|
|
233 |
{
|
|
234 |
aContext.iMajor = KUidSmlSyncApp;
|
|
235 |
aContext.iContext = KDS_HLP_MAIN_VIEW;
|
|
236 |
}
|
|
237 |
|
|
238 |
|
|
239 |
//------------------------------------------------------------------------------
|
|
240 |
// CAspSettingDialog::ProcessCommandL
|
|
241 |
//
|
|
242 |
// Handle commands from menu.
|
|
243 |
//------------------------------------------------------------------------------
|
|
244 |
//
|
|
245 |
void CAspSettingDialog::ProcessCommandL(TInt aCommandId)
|
|
246 |
{
|
|
247 |
TInt err = KErrNone;
|
|
248 |
|
|
249 |
// prevent db notifications while processing menu command
|
|
250 |
//Notifier()->SetDisabled(ETrue);
|
|
251 |
TRAP(err, DoProcessCommandL(aCommandId));
|
|
252 |
//Notifier()->SetDisabled(EFalse);
|
|
253 |
|
|
254 |
if (err != KErrNone)
|
|
255 |
{
|
|
256 |
iDbNotifier->CheckUpdateEventL();
|
|
257 |
FLOG( _L("### CAspSettingDialog::ProcessCommandL failed (%d) ###"), err );
|
|
258 |
User::Leave(err);
|
|
259 |
}
|
|
260 |
}
|
|
261 |
|
|
262 |
|
|
263 |
//------------------------------------------------------------------------------
|
|
264 |
// CAspSettingDialog::DoProcessCommandL
|
|
265 |
//
|
|
266 |
// Handle commands from menu.
|
|
267 |
//------------------------------------------------------------------------------
|
|
268 |
//
|
|
269 |
void CAspSettingDialog::DoProcessCommandL(TInt aCommandId)
|
|
270 |
{
|
|
271 |
HideMenu();
|
|
272 |
|
|
273 |
switch (aCommandId)
|
|
274 |
{
|
|
275 |
case EAspMenuCmdSync:
|
|
276 |
{
|
|
277 |
SyncProfileL();
|
|
278 |
break;
|
|
279 |
}
|
|
280 |
case EAspMenuCmdCopyFromServer:
|
|
281 |
{
|
|
282 |
CopyFromServerL();
|
|
283 |
break;
|
|
284 |
}
|
|
285 |
case EAspMenuCmdChangeProfile:
|
|
286 |
{
|
|
287 |
ChangeProfileL();
|
|
288 |
break;
|
|
289 |
}
|
|
290 |
case EAspMenuCmdEdit:
|
|
291 |
{
|
|
292 |
EditProfileL(EDialogModeEdit ,KErrNotFound);
|
|
293 |
break;
|
|
294 |
}
|
|
295 |
case EAspMenuCmdNewSet:
|
|
296 |
{
|
|
297 |
CreateProfileL();
|
|
298 |
break;
|
|
299 |
}
|
|
300 |
case EAspMenuCmdDelete:
|
|
301 |
{
|
|
302 |
DeleteProfileL();
|
|
303 |
break;
|
|
304 |
}
|
|
305 |
case EAspMenuCmdViewLog:
|
|
306 |
{
|
|
307 |
ShowLogDialogL();
|
|
308 |
break;
|
|
309 |
}
|
|
310 |
case EAspMenuCmdAutoSync:
|
|
311 |
{
|
|
312 |
ShowAutoSyncDialogL();
|
|
313 |
break;
|
|
314 |
}
|
|
315 |
case EAspMenuCmdAdvanceSettings:
|
|
316 |
{
|
|
317 |
//CAspAdvanceSettingsDialog* dialog = CAspAdvanceSettingsDialog::NewL();
|
|
318 |
//CleanupStack::PushL(dialog);
|
|
319 |
|
|
320 |
CAspAdvanceSettingsDialog::ShowDialogL();
|
|
321 |
|
|
322 |
//CleanupStack::PopAndDestroy(dialog);
|
|
323 |
|
|
324 |
//ShowContextMenuL(R_ASP_ROAMING_SETTINGS_CONTEXT_MENU);
|
|
325 |
break;
|
|
326 |
}
|
|
327 |
case EAspMenuCmdRoamingSettings:
|
|
328 |
{
|
|
329 |
ShowContextMenuL(R_ASP_ROAMING_SETTINGS_CONTEXT_MENU);
|
|
330 |
break;
|
|
331 |
}
|
|
332 |
|
|
333 |
case EAspMenuCmdMark:
|
|
334 |
case EAspMenuCmdUnmark:
|
|
335 |
{
|
|
336 |
SaveSelectionL();
|
|
337 |
break;
|
|
338 |
}
|
|
339 |
case EAknCmdHelp:
|
|
340 |
{
|
|
341 |
TUtil::LaunchHelpAppL(iEikonEnv);
|
|
342 |
break;
|
|
343 |
}
|
|
344 |
|
|
345 |
case EAspMenuCmdExit:
|
|
346 |
case EAknCmdExit:
|
|
347 |
case EEikCmdExit:
|
|
348 |
{
|
|
349 |
|
|
350 |
//
|
|
351 |
// Exit dialog
|
|
352 |
//
|
|
353 |
// CEikAppUi::ProcessCommandL starts CAknAppShutter that
|
|
354 |
// closes all dialogs and finally calling application. Before
|
|
355 |
// dialog is closed (deleted) it's OkToExitL(EEikBidCancel)
|
|
356 |
// is called. EEikBidCancel means OkToExitL must silently
|
|
357 |
// save and return ETrue.
|
|
358 |
//
|
|
359 |
iAvkonAppUi->ProcessCommandL(EAknCmdExit);
|
|
360 |
|
|
361 |
break;
|
|
362 |
}
|
|
363 |
|
|
364 |
default:
|
|
365 |
{
|
|
366 |
break;
|
|
367 |
}
|
|
368 |
}
|
|
369 |
}
|
|
370 |
|
|
371 |
|
|
372 |
// -----------------------------------------------------------------------------
|
|
373 |
// CAspSettingDialog::OkToExitL
|
|
374 |
//
|
|
375 |
// Called by framework before dialog is closed.
|
|
376 |
// -----------------------------------------------------------------------------
|
|
377 |
//
|
|
378 |
TBool CAspSettingDialog::OkToExitL(TInt aButtonId)
|
|
379 |
{
|
|
380 |
|
|
381 |
// Options/Exit, End key, Close key ('c')
|
|
382 |
if (aButtonId == EEikBidCancel)
|
|
383 |
{
|
|
384 |
// framework calls this when dialog must shut down
|
|
385 |
return ETrue;
|
|
386 |
}
|
|
387 |
|
|
388 |
// Back key (cba)
|
|
389 |
if (aButtonId == EAknSoftkeyBack)
|
|
390 |
{
|
|
391 |
if( iAutoSyncDialog )
|
|
392 |
{
|
|
393 |
return EFalse;
|
|
394 |
}
|
|
395 |
else
|
|
396 |
{
|
|
397 |
return ETrue;
|
|
398 |
}
|
|
399 |
}
|
|
400 |
|
|
401 |
// Exit key (cba)
|
|
402 |
if (aButtonId == EAknSoftkeyExit)
|
|
403 |
{
|
|
404 |
if (iDialogMode == EModeDialogNoWait && iApplicationId == EApplicationIdSync)
|
|
405 |
{
|
|
406 |
// close sync app
|
|
407 |
iAvkonAppUi->ProcessCommandL(EAknCmdExit);
|
|
408 |
}
|
|
409 |
|
|
410 |
return ETrue;
|
|
411 |
}
|
|
412 |
|
|
413 |
if (aButtonId == EAknSoftkeyMark || aButtonId == EAknSoftkeyUnmark
|
|
414 |
|| aButtonId == EAknSoftkeyOpen) // MSK
|
|
415 |
{
|
|
416 |
|
|
417 |
if (iProfileList->Count() == 0)
|
|
418 |
{
|
|
419 |
return EFalse;
|
|
420 |
}
|
|
421 |
|
|
422 |
if (IsProfileLockedL(iCurrentProfileId))
|
|
423 |
{
|
|
424 |
TDialogUtil::ShowErrorNoteL(R_ASP_LOCKED_PROFILE);
|
|
425 |
CancelCheckboxEvent();
|
|
426 |
return EFalse;
|
|
427 |
}
|
|
428 |
|
|
429 |
if (iSettingEnforcement)
|
|
430 |
{
|
|
431 |
TDialogUtil::ShowInformationNoteL(R_ASP_PROTECTED_SETTING);
|
|
432 |
return EFalse; // leave dialog open;
|
|
433 |
}
|
|
434 |
|
|
435 |
if (!CheckEmailSelection())
|
|
436 |
{
|
|
437 |
return EFalse; // leave dialog open;
|
|
438 |
}
|
|
439 |
|
|
440 |
TInt ret = SaveCurrentProfile();
|
|
441 |
if (ret != KErrNone)
|
|
442 |
{
|
|
443 |
CancelCheckboxEvent();
|
|
444 |
}
|
|
445 |
|
|
446 |
return EFalse; // leave dialog open
|
|
447 |
}
|
|
448 |
|
|
449 |
|
|
450 |
return CAknDialog::OkToExitL(aButtonId);
|
|
451 |
}
|
|
452 |
|
|
453 |
|
|
454 |
// ----------------------------------------------------------------------------
|
|
455 |
// CAspSettingDialog::CancelMailBoxForEnterL
|
|
456 |
//
|
|
457 |
// ----------------------------------------------------------------------------
|
|
458 |
//
|
|
459 |
|
|
460 |
void CAspSettingDialog::CancelMailBoxForEnterL()
|
|
461 |
{
|
|
462 |
CListBoxView* view = iSettingListBox->View();
|
|
463 |
|
|
464 |
TInt index = view->CurrentItemIndex();
|
|
465 |
TAspProviderItem& item = iContentList->ProviderItem(index);
|
|
466 |
TBool selected = view->ItemIsSelected(index);
|
|
467 |
|
|
468 |
if(selected)
|
|
469 |
{
|
|
470 |
view->DeselectItem(index);
|
|
471 |
}
|
|
472 |
else
|
|
473 |
{
|
|
474 |
view->SelectItemL(index);
|
|
475 |
}
|
|
476 |
|
|
477 |
}
|
|
478 |
|
|
479 |
|
|
480 |
// ----------------------------------------------------------------------------
|
|
481 |
// CAspSettingDialog::OfferKeyEventL
|
|
482 |
//
|
|
483 |
// ----------------------------------------------------------------------------
|
|
484 |
//
|
|
485 |
TKeyResponse CAspSettingDialog::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
|
|
486 |
{
|
|
487 |
if (aType == EEventKey)
|
|
488 |
{
|
|
489 |
switch (aKeyEvent.iCode)
|
|
490 |
{
|
|
491 |
//case EKeyOK:
|
|
492 |
// {
|
|
493 |
// ShowContextMenuL(R_ASP_SETTING_DIALOG_CONTEXT_MENU);
|
|
494 |
// return EKeyWasConsumed;
|
|
495 |
// }
|
|
496 |
case EKeyEnter:
|
|
497 |
{
|
|
498 |
CancelMailBoxForEnterL();
|
|
499 |
OkToExitL(EAknSoftkeyOpen);
|
|
500 |
return EKeyWasConsumed;
|
|
501 |
}
|
|
502 |
|
|
503 |
case EKeyEscape: // framework calls this when dialog must shut
|
|
504 |
{
|
|
505 |
return CAknDialog::OfferKeyEventL(aKeyEvent, aType);
|
|
506 |
}
|
|
507 |
|
|
508 |
//case EStdKeyHome:
|
|
509 |
// {
|
|
510 |
// DeleteSelectedProfileL();
|
|
511 |
// return EKeyWasConsumed;
|
|
512 |
// }
|
|
513 |
|
|
514 |
#ifdef RD_DSUI_TIMEDSYNC
|
|
515 |
|
|
516 |
case EKeyLeftArrow:
|
|
517 |
{
|
|
518 |
SetPreviousProfileL();
|
|
519 |
return EKeyWasConsumed;
|
|
520 |
}
|
|
521 |
|
|
522 |
case EKeyRightArrow:
|
|
523 |
{
|
|
524 |
SetNextProfileL();
|
|
525 |
return EKeyWasConsumed;
|
|
526 |
}
|
|
527 |
|
|
528 |
#endif
|
|
529 |
default:
|
|
530 |
break;
|
|
531 |
}
|
|
532 |
}
|
|
533 |
|
|
534 |
return CAknDialog::OfferKeyEventL( aKeyEvent, aType);
|
|
535 |
}
|
|
536 |
|
|
537 |
|
|
538 |
// ----------------------------------------------------------------------------
|
|
539 |
// CAspSettingDialog::HandleResourceChange
|
|
540 |
//
|
|
541 |
// ----------------------------------------------------------------------------
|
|
542 |
//
|
|
543 |
|
|
544 |
void CAspSettingDialog::HandleResourceChange(TInt aType)
|
|
545 |
{
|
|
546 |
if (aType == KEikDynamicLayoutVariantSwitch) //Handle change in layout orientation
|
|
547 |
{
|
|
548 |
TRect mainPaneRect;
|
|
549 |
AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect);
|
|
550 |
SetRect(mainPaneRect);
|
|
551 |
iSettingListBox->SetSize(mainPaneRect.Size());
|
|
552 |
CCoeControl::HandleResourceChange(aType);
|
|
553 |
DrawDeferred();
|
|
554 |
return;
|
|
555 |
}
|
|
556 |
|
|
557 |
if (aType == KAknsMessageSkinChange)
|
|
558 |
{
|
|
559 |
TRAP_IGNORE(SetIconsL());
|
|
560 |
}
|
|
561 |
|
|
562 |
CCoeControl::HandleResourceChange(aType);
|
|
563 |
}
|
|
564 |
|
|
565 |
/*
|
|
566 |
void CAspSettingDialog::HandleResourceChange(TInt aType)
|
|
567 |
{
|
|
568 |
if (aType == KEikDynamicLayoutVariantSwitch) //Handle change in layout orientation
|
|
569 |
{
|
|
570 |
|
|
571 |
TRect mainPaneRect;
|
|
572 |
AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect);
|
|
573 |
TBuf<299> buf;
|
|
574 |
buf.Format(_L("(%d,%d) (%d,%d)"), mainPaneRect.iTl.iX, mainPaneRect.iTl.iY, mainPaneRect.iBr.iX, mainPaneRect.iBr.iY);
|
|
575 |
|
|
576 |
SetRect(mainPaneRect);
|
|
577 |
iSettingListBox->HandleResourceChange(aType);
|
|
578 |
DrawNow();
|
|
579 |
|
|
580 |
|
|
581 |
CAknDialog::HandleResourceChange(aType);
|
|
582 |
|
|
583 |
TRect mainPaneRect;
|
|
584 |
AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect);
|
|
585 |
SetRect(mainPaneRect);
|
|
586 |
|
|
587 |
iSettingListBox->SetSize(mainPaneRect.Size());
|
|
588 |
//iSettingListBox->HandleResourceChange(aType);
|
|
589 |
CCoeControl::HandleResourceChange(aType);
|
|
590 |
DrawDeferred();
|
|
591 |
|
|
592 |
|
|
593 |
return;
|
|
594 |
}
|
|
595 |
|
|
596 |
if (aType == KAknsMessageSkinChange)
|
|
597 |
{
|
|
598 |
TRAP_IGNORE(SetIconsL());
|
|
599 |
}
|
|
600 |
|
|
601 |
CCoeControl::HandleResourceChange(aType);
|
|
602 |
}
|
|
603 |
*/
|
|
604 |
|
|
605 |
// ----------------------------------------------------------------------------
|
|
606 |
// CAspSettingDialog::SetIconsL
|
|
607 |
//
|
|
608 |
// ----------------------------------------------------------------------------
|
|
609 |
//
|
|
610 |
void CAspSettingDialog::SetIconsL()
|
|
611 |
{
|
|
612 |
if (!iSettingListBox)
|
|
613 |
{
|
|
614 |
return;
|
|
615 |
}
|
|
616 |
|
|
617 |
TFileName bitmapName;
|
|
618 |
CAspResHandler::GetBitmapFileName(bitmapName);
|
|
619 |
CArrayPtr<CGulIcon>* icons = new (ELeave) CAknIconArray(KDefaultArraySize);
|
|
620 |
CleanupStack::PushL(icons);
|
|
621 |
|
|
622 |
// NOTE: icons must be appended in correct order (TAspSettingDialogIconIndex)
|
|
623 |
icons->AppendL(IconL(KAknsIIDQgnPropCheckboxOn, KAvkonBitmapFile,
|
|
624 |
EMbmAvkonQgn_prop_checkbox_on,
|
|
625 |
EMbmAvkonQgn_prop_checkbox_on_mask));
|
|
626 |
|
|
627 |
icons->AppendL(IconL(KAknsIIDQgnPropCheckboxOff, KAvkonBitmapFile,
|
|
628 |
EMbmAvkonQgn_prop_checkbox_off,
|
|
629 |
EMbmAvkonQgn_prop_checkbox_off_mask));
|
|
630 |
|
|
631 |
// delete old icons
|
|
632 |
CArrayPtr<CGulIcon>* arr = iSettingListBox->ItemDrawer()->FormattedCellData()->IconArray();
|
|
633 |
if (arr)
|
|
634 |
{
|
|
635 |
arr->ResetAndDestroy();
|
|
636 |
delete arr;
|
|
637 |
arr = NULL;
|
|
638 |
}
|
|
639 |
|
|
640 |
iSettingListBox->ItemDrawer()->FormattedCellData()->SetIconArrayL(icons);
|
|
641 |
CleanupStack::Pop(icons);
|
|
642 |
}
|
|
643 |
|
|
644 |
|
|
645 |
// ----------------------------------------------------------------------------
|
|
646 |
// CAspSettingDialog::ShowContextMenuL
|
|
647 |
//
|
|
648 |
// ----------------------------------------------------------------------------
|
|
649 |
//
|
|
650 |
void CAspSettingDialog::ShowContextMenuL(TInt aResource)
|
|
651 |
{
|
|
652 |
if (SyncRunning())
|
|
653 |
{
|
|
654 |
return;
|
|
655 |
}
|
|
656 |
|
|
657 |
//
|
|
658 |
// Switch to Context specific options menu,
|
|
659 |
// Show it and switch back to main options menu.
|
|
660 |
//
|
|
661 |
CEikMenuBar* menuBar = iMenuBar; // from CAknDialog
|
|
662 |
menuBar->SetMenuTitleResourceId(aResource);
|
|
663 |
|
|
664 |
|
|
665 |
// TRAP displaying of menu bar.
|
|
666 |
// If it fails, the correct resource is set back before leave.
|
|
667 |
TRAPD(err, menuBar->TryDisplayMenuBarL());
|
|
668 |
|
|
669 |
menuBar->SetMenuTitleResourceId(R_ASP_SETTING_DIALOG_MENU);
|
|
670 |
|
|
671 |
User::LeaveIfError(err);
|
|
672 |
}
|
|
673 |
|
|
674 |
|
|
675 |
// -----------------------------------------------------------------------------
|
|
676 |
// CAspSettingDialog::PostLayoutDynInitL
|
|
677 |
//
|
|
678 |
// Called by framework after dialog is shown.
|
|
679 |
// -----------------------------------------------------------------------------
|
|
680 |
//
|
|
681 |
void CAspSettingDialog::PostLayoutDynInitL()
|
|
682 |
{
|
|
683 |
#ifdef RD_DSUI_TIMEDSYNC
|
|
684 |
ShowAutoSyncProfileInfo();
|
|
685 |
#else
|
|
686 |
ShowCurrentProfileInfo();
|
|
687 |
#endif
|
|
688 |
}
|
|
689 |
|
|
690 |
|
|
691 |
// -----------------------------------------------------------------------------
|
|
692 |
// CAspSettingDialog::PreLayoutDynInitL
|
|
693 |
//
|
|
694 |
// Called by framework before dialog is shown.
|
|
695 |
// -----------------------------------------------------------------------------
|
|
696 |
//
|
|
697 |
void CAspSettingDialog::PreLayoutDynInitL()
|
|
698 |
{
|
|
699 |
iSettingListBox = (CAknDoubleLargeStyleListBox*) ControlOrNull (EAspSettingDialogList);
|
|
700 |
|
|
701 |
__ASSERT_ALWAYS(iSettingListBox, TUtil::Panic(KErrGeneral));
|
|
702 |
|
|
703 |
iSettingListBox->SetListBoxObserver(this);
|
|
704 |
iSettingListBox->CreateScrollBarFrameL(ETrue);
|
|
705 |
iSettingListBox->ScrollBarFrame()->SetScrollBarVisibilityL(
|
|
706 |
CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto);
|
|
707 |
|
|
708 |
SetIconsL();
|
|
709 |
UpdateListBoxL();
|
|
710 |
|
|
711 |
#ifdef RD_DSUI_TIMEDSYNC
|
|
712 |
|
|
713 |
UpdateTabsL();
|
|
714 |
#else
|
|
715 |
|
|
716 |
UpdateNavipaneL(iCurrentProfileName);
|
|
717 |
#endif
|
|
718 |
|
|
719 |
|
|
720 |
iSettingListBox->UpdateScrollBarsL();
|
|
721 |
iSettingListBox->ScrollBarFrame()->MoveVertThumbTo(0);
|
|
722 |
|
|
723 |
iStatusPaneHandler->SetTitleL(R_ASP_SETTING_DIALOG_TITLE);
|
|
724 |
|
|
725 |
SetCurrentIndex();
|
|
726 |
//#ifdef RD_DSUI_CP_INTEGRATION
|
|
727 |
TBool flag = CEikonEnv::Static()->StartedAsServerApp() ;
|
|
728 |
if (flag || iApplicationId != EApplicationIdSync)
|
|
729 |
/*#else
|
|
730 |
if (iApplicationId != EApplicationIdSync)
|
|
731 |
#endif */
|
|
732 |
{
|
|
733 |
UpdateCbaL(R_ASP_CBA_OPTIONS_BACK_MARK);
|
|
734 |
}
|
|
735 |
|
|
736 |
if(iSettingEnforcement)
|
|
737 |
{
|
|
738 |
UpdateMiddleSoftKeyLabelL(EAknSoftkeyOpen,R_TEXT_SOFTKEY_EMPTY);
|
|
739 |
}
|
|
740 |
}
|
|
741 |
|
|
742 |
|
|
743 |
// -----------------------------------------------------------------------------
|
|
744 |
// CAspSettingDialog::DynInitMenuPaneL
|
|
745 |
//
|
|
746 |
// Called by framework before menu is shown.
|
|
747 |
// -----------------------------------------------------------------------------
|
|
748 |
//
|
|
749 |
void CAspSettingDialog::DynInitMenuPaneL(TInt aResourceID, CEikMenuPane* aMenuPane)
|
|
750 |
{
|
|
751 |
TInt menu1 = R_ASP_SETTING_DIALOG_MENU_PANE;
|
|
752 |
TInt menu2 = R_ASP_SETTING_DIALOG_CONTEXT_MENU_PANE;
|
|
753 |
|
|
754 |
if (aResourceID != menu1 && aResourceID != menu2)
|
|
755 |
{
|
|
756 |
return; // not one of our menus
|
|
757 |
}
|
|
758 |
|
|
759 |
if (aResourceID == R_ASP_SETTING_DIALOG_CONTEXT_MENU_PANE)
|
|
760 |
{
|
|
761 |
InitContextMenuL(aMenuPane); // separate handling for context menu
|
|
762 |
}
|
|
763 |
else
|
|
764 |
{
|
|
765 |
InitOptionsMenuL(aMenuPane);
|
|
766 |
}
|
|
767 |
}
|
|
768 |
|
|
769 |
|
|
770 |
// -----------------------------------------------------------------------------
|
|
771 |
// CAspSettingDialog::InitContextMenuL
|
|
772 |
//
|
|
773 |
// -----------------------------------------------------------------------------
|
|
774 |
//
|
|
775 |
void CAspSettingDialog::InitContextMenuL(CEikMenuPane* /*aMenuPane*/)
|
|
776 |
{
|
|
777 |
}
|
|
778 |
|
|
779 |
|
|
780 |
// -----------------------------------------------------------------------------
|
|
781 |
// CAspSettingDialog::InitOptionsMenuL
|
|
782 |
//
|
|
783 |
// -----------------------------------------------------------------------------
|
|
784 |
//
|
|
785 |
void CAspSettingDialog::InitOptionsMenuL(CEikMenuPane* aMenuPane)
|
|
786 |
{
|
|
787 |
TInt profileCount = iProfileList->Count();
|
|
788 |
TInt providerCount = iContentList->ProviderCount();
|
|
789 |
TInt deletableProfileCount = iProfileList->DeletableProfileCount();
|
|
790 |
|
|
791 |
if (providerCount == 0) // no data providers
|
|
792 |
{
|
|
793 |
TDialogUtil::DeleteMenuItem(aMenuPane, EAspMenuCmdSync);
|
|
794 |
TDialogUtil::DeleteMenuItem(aMenuPane, EAspMenuCmdNewSet);
|
|
795 |
TDialogUtil::DeleteMenuItem(aMenuPane, EAspMenuCmdEdit);
|
|
796 |
TDialogUtil::DeleteMenuItem(aMenuPane, EAspMenuCmdChangeProfile);
|
|
797 |
TDialogUtil::DeleteMenuItem(aMenuPane, EAspMenuCmdDelete);
|
|
798 |
TDialogUtil::DeleteMenuItem(aMenuPane, EAspMenuCmdAutoSync);
|
|
799 |
TDialogUtil::DeleteMenuItem(aMenuPane, EAspMenuCmdViewLog);
|
|
800 |
TDialogUtil::DeleteMenuItem(aMenuPane, EAspMenuCmdCopyFromServer);
|
|
801 |
return;
|
|
802 |
}
|
|
803 |
|
|
804 |
|
|
805 |
// Options/Sync
|
|
806 |
// Options/Copy all from server
|
|
807 |
if (iCurrentProfileId == KErrNotFound && profileCount > 0)
|
|
808 |
{
|
|
809 |
TDialogUtil::DeleteMenuItem(aMenuPane, EAspMenuCmdSync);
|
|
810 |
TDialogUtil::DeleteMenuItem(aMenuPane, EAspMenuCmdCopyFromServer);
|
|
811 |
}
|
|
812 |
if (iSettingEnforcement && profileCount == 0)
|
|
813 |
{
|
|
814 |
TDialogUtil::DeleteMenuItem(aMenuPane, EAspMenuCmdSync);
|
|
815 |
TDialogUtil::DeleteMenuItem(aMenuPane, EAspMenuCmdCopyFromServer);
|
|
816 |
}
|
|
817 |
|
|
818 |
if (iCurrentProfileId == KErrNotFound)
|
|
819 |
{
|
|
820 |
TDialogUtil::DeleteMenuItem(aMenuPane, EAspMenuCmdCopyFromServer);
|
|
821 |
}
|
|
822 |
|
|
823 |
// Options/Change
|
|
824 |
if (profileCount == 0)
|
|
825 |
{
|
|
826 |
TDialogUtil::DeleteMenuItem(aMenuPane, EAspMenuCmdChangeProfile);
|
|
827 |
TDialogUtil::DeleteMenuItem(aMenuPane, EAspMenuCmdMark);
|
|
828 |
TDialogUtil::DeleteMenuItem(aMenuPane, EAspMenuCmdUnmark);
|
|
829 |
}
|
|
830 |
if (profileCount == 1 && iCurrentProfileId != KErrNotFound)
|
|
831 |
{
|
|
832 |
TDialogUtil::DeleteMenuItem(aMenuPane, EAspMenuCmdChangeProfile);
|
|
833 |
}
|
|
834 |
|
|
835 |
// Options/Edit
|
|
836 |
if (iCurrentProfileId == KErrNotFound)
|
|
837 |
{
|
|
838 |
TDialogUtil::DeleteMenuItem(aMenuPane, EAspMenuCmdEdit);
|
|
839 |
}
|
|
840 |
|
|
841 |
// Options/Auto sync
|
|
842 |
if (iCurrentProfileId == KErrNotFound)
|
|
843 |
{
|
|
844 |
TDialogUtil::DeleteMenuItem(aMenuPane, EAspMenuCmdAutoSync);
|
|
845 |
}
|
|
846 |
|
|
847 |
// Options/New
|
|
848 |
if (iSettingEnforcement)
|
|
849 |
{
|
|
850 |
TDialogUtil::DeleteMenuItem(aMenuPane, EAspMenuCmdNewSet);
|
|
851 |
TDialogUtil::DeleteMenuItem(aMenuPane, EAspMenuCmdMark);
|
|
852 |
TDialogUtil::DeleteMenuItem(aMenuPane, EAspMenuCmdUnmark);
|
|
853 |
}
|
|
854 |
|
|
855 |
// Options/Delete
|
|
856 |
if (IsSyncOnGoingL(iCurrentProfileId) || iSettingEnforcement
|
|
857 |
|| deletableProfileCount == 0)
|
|
858 |
{
|
|
859 |
TDialogUtil::DeleteMenuItem(aMenuPane, EAspMenuCmdDelete);
|
|
860 |
}
|
|
861 |
|
|
862 |
// Options/View log
|
|
863 |
if (iCurrentProfileId == KErrNotFound)
|
|
864 |
{
|
|
865 |
TDialogUtil::DeleteMenuItem(aMenuPane, EAspMenuCmdViewLog);
|
|
866 |
}
|
|
867 |
|
|
868 |
if (!FeatureManager::FeatureSupported(KFeatureIdHelp))
|
|
869 |
{
|
|
870 |
TDialogUtil::DeleteMenuItem(aMenuPane, EAknCmdHelp);
|
|
871 |
}
|
|
872 |
|
|
873 |
#ifdef RD_DSUI_TIMEDSYNC
|
|
874 |
if(profileCount)
|
|
875 |
{
|
|
876 |
//Delete active profile
|
|
877 |
TAspParam param(iApplicationId, iSyncSession);
|
|
878 |
TAspProfileItem& currentProfile = CurrentProfileL();
|
|
879 |
if(!currentProfile.iDeleteAllowed)
|
|
880 |
{
|
|
881 |
TDialogUtil::DeleteMenuItem(aMenuPane, EAspMenuCmdDelete);
|
|
882 |
}
|
|
883 |
//Change profile option is removed
|
|
884 |
TDialogUtil::DeleteMenuItem(aMenuPane, EAspMenuCmdChangeProfile);
|
|
885 |
|
|
886 |
|
|
887 |
CAspSchedule* schedule = CAspSchedule::NewLC();
|
|
888 |
TInt asProfileId = schedule->AutoSyncProfileId();
|
|
889 |
if (iCurrentProfileId == schedule->ProfileId()
|
|
890 |
&& asProfileId != KErrNotFound)
|
|
891 |
{
|
|
892 |
CAspProfile* asProfile = CAspProfile::NewLC(param);
|
|
893 |
asProfile->OpenL(asProfileId, CAspProfile::EOpenRead, CAspProfile::EAllProperties);
|
|
894 |
if (!asProfile->IsSynced() && !currentProfile.iSynced)
|
|
895 |
{
|
|
896 |
TDialogUtil::DeleteMenuItem(aMenuPane, EAspMenuCmdViewLog);
|
|
897 |
}
|
|
898 |
CleanupStack::PopAndDestroy(asProfile);
|
|
899 |
}
|
|
900 |
else
|
|
901 |
{
|
|
902 |
if (!currentProfile.iSynced)
|
|
903 |
{
|
|
904 |
TDialogUtil::DeleteMenuItem(aMenuPane, EAspMenuCmdViewLog);
|
|
905 |
}
|
|
906 |
|
|
907 |
}
|
|
908 |
CleanupStack::PopAndDestroy(schedule);
|
|
909 |
}
|
|
910 |
#else
|
|
911 |
|
|
912 |
|
|
913 |
TAspProfileItem& profile = CurrentProfileL();
|
|
914 |
if (!profile.iSynced)
|
|
915 |
{
|
|
916 |
iProfileList->ReadProfileL(iCurrentProfileId);
|
|
917 |
}
|
|
918 |
|
|
919 |
if (!profile.iSynced)
|
|
920 |
{
|
|
921 |
TDialogUtil::DeleteMenuItem(aMenuPane, EAspMenuCmdViewLog);
|
|
922 |
}
|
|
923 |
#endif
|
|
924 |
if(!iSettingEnforcement)
|
|
925 |
{
|
|
926 |
UpdateMarkMenuItem(aMenuPane);
|
|
927 |
}
|
|
928 |
#ifndef RD_DSUI_TIMEDSYNC
|
|
929 |
TDialogUtil::DeleteMenuItem(aMenuPane, EAspMenuCmdAutoSync);
|
|
930 |
#endif
|
|
931 |
|
|
932 |
}
|
|
933 |
|
|
934 |
// -----------------------------------------------------------------------------
|
|
935 |
// CAspSettingDialog::IsSyncOnGoing
|
|
936 |
//
|
|
937 |
// -----------------------------------------------------------------------------
|
|
938 |
//
|
|
939 |
TBool CAspSettingDialog::IsSyncOnGoingL(TInt aProfileId)
|
|
940 |
{
|
|
941 |
TInt currentJobId = CAspProfile::CurrentJob(iSyncSession);
|
|
942 |
if (currentJobId != KErrNotFound)
|
|
943 |
{
|
|
944 |
RSyncMLDataSyncJob syncJob;
|
|
945 |
syncJob.OpenL(*iSyncSession, currentJobId);
|
|
946 |
if (syncJob.Profile() == aProfileId)
|
|
947 |
{
|
|
948 |
syncJob.Close();
|
|
949 |
return ETrue;
|
|
950 |
}
|
|
951 |
syncJob.Close();
|
|
952 |
}
|
|
953 |
return EFalse;
|
|
954 |
}
|
|
955 |
|
|
956 |
|
|
957 |
#ifdef RD_DSUI_TIMEDSYNC
|
|
958 |
// -----------------------------------------------------------------------------
|
|
959 |
// CAspSettingDialog::SetNextProfileL
|
|
960 |
//
|
|
961 |
// -----------------------------------------------------------------------------
|
|
962 |
//
|
|
963 |
void CAspSettingDialog::SetNextProfileL()
|
|
964 |
{
|
|
965 |
FLOG( _L("CAspSettingDialog::SetNextProfileL START") );
|
|
966 |
|
|
967 |
if (iProfileList->Count() == 0)
|
|
968 |
{
|
|
969 |
return;
|
|
970 |
}
|
|
971 |
|
|
972 |
TInt currentIndex = iProfileList->ListIndex(iCurrentProfileId);
|
|
973 |
if (currentIndex == KErrNotFound)
|
|
974 |
{
|
|
975 |
FLOG( _L("CAspSettingDialog::SetNextProfileL END") );
|
|
976 |
|
|
977 |
User::Leave(KErrNotFound);
|
|
978 |
}
|
|
979 |
|
|
980 |
TInt newIndex = 0;
|
|
981 |
TInt count = iProfileList->Count();
|
|
982 |
if (currentIndex >= count-1)
|
|
983 |
{
|
|
984 |
newIndex = 0;
|
|
985 |
}
|
|
986 |
else
|
|
987 |
{
|
|
988 |
newIndex = currentIndex + 1;
|
|
989 |
}
|
|
990 |
TAspProfileItem& olditem = iProfileList->Item(currentIndex);
|
|
991 |
TAspProfileItem& item = iProfileList->Item(newIndex);
|
|
992 |
|
|
993 |
if (item.iProfileName.Compare(KAutoSyncProfileName) == 0)
|
|
994 |
{
|
|
995 |
if(newIndex >= count-1)
|
|
996 |
{
|
|
997 |
newIndex = 0;
|
|
998 |
}
|
|
999 |
else
|
|
1000 |
{
|
|
1001 |
newIndex++;
|
|
1002 |
}
|
|
1003 |
TAspProfileItem& newItem = iProfileList->Item(newIndex);
|
|
1004 |
SetCurrentProfile(newItem.iProfileId);
|
|
1005 |
}
|
|
1006 |
else
|
|
1007 |
{
|
|
1008 |
SetCurrentProfile(item.iProfileId);
|
|
1009 |
}
|
|
1010 |
|
|
1011 |
//ShowCurrentProfileInfo();
|
|
1012 |
UpdateListBoxL();
|
|
1013 |
//UpdateNavipaneL(iCurrentProfileName);
|
|
1014 |
UpdateTabsL();
|
|
1015 |
|
|
1016 |
FLOG( _L("CAspSettingDialog::SetNextProfileL END") );
|
|
1017 |
}
|
|
1018 |
|
|
1019 |
|
|
1020 |
// -----------------------------------------------------------------------------
|
|
1021 |
// CAspSettingDialog::SetPreviousProfileL
|
|
1022 |
//
|
|
1023 |
// -----------------------------------------------------------------------------
|
|
1024 |
//
|
|
1025 |
void CAspSettingDialog::SetPreviousProfileL()
|
|
1026 |
{
|
|
1027 |
FLOG( _L("CAspSettingDialog::SetPreviousProfileL START") );
|
|
1028 |
|
|
1029 |
if (iProfileList->Count() == 0)
|
|
1030 |
{
|
|
1031 |
return;
|
|
1032 |
}
|
|
1033 |
|
|
1034 |
TInt currentIndex = iProfileList->ListIndex(iCurrentProfileId);
|
|
1035 |
if (currentIndex == KErrNotFound)
|
|
1036 |
{
|
|
1037 |
FLOG( _L("CAspSettingDialog::SetNextProfileL END") );
|
|
1038 |
|
|
1039 |
User::Leave(KErrNotFound);
|
|
1040 |
}
|
|
1041 |
|
|
1042 |
TInt newIndex = 0;
|
|
1043 |
TInt count = iProfileList->Count();
|
|
1044 |
if (currentIndex == 0)
|
|
1045 |
{
|
|
1046 |
newIndex = count - 1;
|
|
1047 |
}
|
|
1048 |
else
|
|
1049 |
{
|
|
1050 |
newIndex = currentIndex - 1;
|
|
1051 |
}
|
|
1052 |
|
|
1053 |
TAspProfileItem& item = iProfileList->Item(newIndex);
|
|
1054 |
|
|
1055 |
if (item.iProfileName.Compare(KAutoSyncProfileName) == 0)
|
|
1056 |
{
|
|
1057 |
if(newIndex == 0)
|
|
1058 |
{
|
|
1059 |
newIndex = count - 1;
|
|
1060 |
}
|
|
1061 |
else
|
|
1062 |
{
|
|
1063 |
newIndex--;
|
|
1064 |
}
|
|
1065 |
TAspProfileItem& newItem = iProfileList->Item(newIndex);
|
|
1066 |
SetCurrentProfile(newItem.iProfileId);
|
|
1067 |
}
|
|
1068 |
else
|
|
1069 |
{
|
|
1070 |
SetCurrentProfile(item.iProfileId);
|
|
1071 |
}
|
|
1072 |
|
|
1073 |
|
|
1074 |
//ShowCurrentProfileInfo();
|
|
1075 |
UpdateListBoxL();
|
|
1076 |
//UpdateNavipaneL(iCurrentProfileName);
|
|
1077 |
UpdateTabsL();
|
|
1078 |
|
|
1079 |
FLOG( _L("CAspSettingDialog::SetPreviousProfileL END") );
|
|
1080 |
}
|
|
1081 |
|
|
1082 |
|
|
1083 |
// -----------------------------------------------------------------------------
|
|
1084 |
// CAspSettingDialog::UpdateTabsL
|
|
1085 |
//
|
|
1086 |
// -----------------------------------------------------------------------------
|
|
1087 |
//
|
|
1088 |
void CAspSettingDialog::UpdateTabsL()
|
|
1089 |
{
|
|
1090 |
FLOG( _L("CAspSettingDialog::UpdateTabsL START") );
|
|
1091 |
|
|
1092 |
TInt count = iProfileList->Count();
|
|
1093 |
if (count == 0)
|
|
1094 |
{
|
|
1095 |
//handle no profile condition
|
|
1096 |
iTabHandler->DeleteTabsL();
|
|
1097 |
_LIT(KEmpty, " ");
|
|
1098 |
TBuf<64> tabText(KEmpty);
|
|
1099 |
TInt profileId = KMaxProfileCount;
|
|
1100 |
iTabHandler->AddTabL(tabText, profileId);
|
|
1101 |
iTabHandler->SetActiveTabL(profileId);
|
|
1102 |
return;
|
|
1103 |
}
|
|
1104 |
|
|
1105 |
if (iTabHandler->TabIndex(iCurrentProfileId) == KErrNotFound)
|
|
1106 |
{
|
|
1107 |
iUpdateTabGroup = ETrue;
|
|
1108 |
}
|
|
1109 |
if (iUpdateTabGroup)
|
|
1110 |
{
|
|
1111 |
//update changed settings
|
|
1112 |
iProfileList->ReadAllProfilesL(CAspProfileList::ENoMandatoryCheck);
|
|
1113 |
iProfileList->Sort();
|
|
1114 |
SetCurrentProfile(iCurrentProfileId);
|
|
1115 |
count = iProfileList->Count();
|
|
1116 |
iTabHandler->DeleteTabsL();
|
|
1117 |
for (TInt i=0; i<count; i++)
|
|
1118 |
{
|
|
1119 |
TAspProfileItem& item = iProfileList->Item(i);
|
|
1120 |
iTabHandler->AddTabL(item.iProfileName, item.iProfileId);
|
|
1121 |
}
|
|
1122 |
iTabHandler->SetTabWidthL();
|
|
1123 |
iUpdateTabGroup = EFalse;
|
|
1124 |
}
|
|
1125 |
if (iCurrentProfileId != KErrNotFound)
|
|
1126 |
{
|
|
1127 |
iTabHandler->SetTabTextL(iCurrentProfileName, iCurrentProfileId);
|
|
1128 |
}
|
|
1129 |
CAspSchedule* schedule = CAspSchedule::NewLC();
|
|
1130 |
if (iCurrentProfileId == schedule->ProfileId()
|
|
1131 |
&& schedule->IsAutoSyncEnabled())
|
|
1132 |
{
|
|
1133 |
//show indicator icon for profile that has auto sync ON.
|
|
1134 |
_LIT(KSpace," ");
|
|
1135 |
TBuf<64> tabText;
|
|
1136 |
tabText.Append(KClockCharacter);//Unicode character U+F815 (clock)
|
|
1137 |
tabText.Append(KSpace);
|
|
1138 |
tabText.Append(iCurrentProfileName);
|
|
1139 |
iTabHandler->SetTabTextL(tabText, iCurrentProfileId);
|
|
1140 |
}
|
|
1141 |
|
|
1142 |
if (iCurrentProfileId != KErrNotFound)
|
|
1143 |
{
|
|
1144 |
iTabHandler->SetActiveTabL(iCurrentProfileId);
|
|
1145 |
}
|
|
1146 |
|
|
1147 |
CleanupStack::PopAndDestroy(schedule);
|
|
1148 |
|
|
1149 |
|
|
1150 |
FLOG( _L("CAspSettingDialog::UpdateTabsL END") );
|
|
1151 |
}
|
|
1152 |
|
|
1153 |
#endif
|
|
1154 |
// -----------------------------------------------------------------------------
|
|
1155 |
// CAspSettingDialog::UpdateMarkMenuItem
|
|
1156 |
//
|
|
1157 |
// -----------------------------------------------------------------------------
|
|
1158 |
//
|
|
1159 |
|
|
1160 |
void CAspSettingDialog::UpdateMarkMenuItem(CEikMenuPane* aMenuPane)
|
|
1161 |
{
|
|
1162 |
|
|
1163 |
CListBoxView* view = iSettingListBox->View();
|
|
1164 |
|
|
1165 |
TInt index = view->CurrentItemIndex();
|
|
1166 |
TBool mark = view->ItemIsSelected(index);
|
|
1167 |
|
|
1168 |
aMenuPane->SetItemDimmed(EAspMenuCmdMark,mark);
|
|
1169 |
aMenuPane->SetItemDimmed(EAspMenuCmdUnmark,!mark);
|
|
1170 |
|
|
1171 |
}
|
|
1172 |
|
|
1173 |
// -----------------------------------------------------------------------------
|
|
1174 |
// CAspSettingDialog::SaveSelection
|
|
1175 |
// Update Mark/Unmark selected from menu
|
|
1176 |
// -----------------------------------------------------------------------------
|
|
1177 |
//
|
|
1178 |
void CAspSettingDialog::SaveSelectionL()
|
|
1179 |
{
|
|
1180 |
if (IsProfileLockedL(iCurrentProfileId))
|
|
1181 |
{
|
|
1182 |
TDialogUtil::ShowErrorNoteL(R_ASP_LOCKED_PROFILE);
|
|
1183 |
return;
|
|
1184 |
}
|
|
1185 |
|
|
1186 |
if (iSettingEnforcement)
|
|
1187 |
{
|
|
1188 |
TDialogUtil::ShowInformationNoteL(R_ASP_PROTECTED_SETTING);
|
|
1189 |
return;
|
|
1190 |
}
|
|
1191 |
|
|
1192 |
//update check box & profile
|
|
1193 |
CListBoxView* view = iSettingListBox->View();
|
|
1194 |
|
|
1195 |
TInt index = view->CurrentItemIndex();
|
|
1196 |
TBool selected = view->ItemIsSelected(index);
|
|
1197 |
if (selected)
|
|
1198 |
{
|
|
1199 |
view->DeselectItem(index);
|
|
1200 |
}
|
|
1201 |
else
|
|
1202 |
{
|
|
1203 |
view->SelectItemL(index);
|
|
1204 |
}
|
|
1205 |
iSettingListBox->SetCurrentItemIndex(index);
|
|
1206 |
if (!CheckEmailSelection())
|
|
1207 |
{
|
|
1208 |
return;
|
|
1209 |
}
|
|
1210 |
TInt ret = SaveCurrentProfile();
|
|
1211 |
if (ret != KErrNone)
|
|
1212 |
{
|
|
1213 |
CancelCheckboxEvent();
|
|
1214 |
}
|
|
1215 |
|
|
1216 |
}
|
|
1217 |
|
|
1218 |
|
|
1219 |
|
|
1220 |
// -----------------------------------------------------------------------------
|
|
1221 |
// CAspSettingDialog::DoSetCurrentProfileL
|
|
1222 |
//
|
|
1223 |
// -----------------------------------------------------------------------------
|
|
1224 |
//
|
|
1225 |
void CAspSettingDialog::DoSetCurrentProfileL(TInt aProfileId)
|
|
1226 |
{
|
|
1227 |
FLOG( _L("CAspSettingDialog::DoSetCurrentProfileL START") );
|
|
1228 |
|
|
1229 |
iCurrentProfileId = KErrNotFound;
|
|
1230 |
iCurrentProfileName = KNullDesC;
|
|
1231 |
iContentList->RemoveAllTasks();
|
|
1232 |
iProfileList->ReadAllProfilesL(CAspProfileList::ENoMandatoryCheck);
|
|
1233 |
iProfileList->Sort();
|
|
1234 |
|
|
1235 |
if (iProfileList->Count() == 0)
|
|
1236 |
{
|
|
1237 |
return;
|
|
1238 |
}
|
|
1239 |
|
|
1240 |
if (aProfileId == KErrNotFound)
|
|
1241 |
{
|
|
1242 |
FLOG( _L("CAspSettingDialog::DoSetCurrentProfileL END") );
|
|
1243 |
User::Leave(KErrNotFound);
|
|
1244 |
}
|
|
1245 |
|
|
1246 |
TInt index = iProfileList->ListIndex(aProfileId);
|
|
1247 |
if (index == KErrNotFound)
|
|
1248 |
{
|
|
1249 |
FLOG( _L("### unknown profile (id=%d) ###"), aProfileId );
|
|
1250 |
FLOG( _L("CAspSettingDialog::DoSetCurrentProfileL END") );
|
|
1251 |
|
|
1252 |
User::Leave(KErrNotFound);
|
|
1253 |
}
|
|
1254 |
|
|
1255 |
TAspParam param(iApplicationId, iSyncSession);
|
|
1256 |
CAspProfile* profile = CAspProfile::NewLC(param);
|
|
1257 |
|
|
1258 |
//if profile already locked ,open as read only
|
|
1259 |
if (IsProfileLockedL(aProfileId))
|
|
1260 |
{
|
|
1261 |
profile->OpenL(aProfileId, CAspProfile::EOpenRead, CAspProfile::EAllProperties);
|
|
1262 |
|
|
1263 |
}
|
|
1264 |
else
|
|
1265 |
{
|
|
1266 |
profile->OpenL(aProfileId, CAspProfile::EOpenReadWrite, CAspProfile::EAllProperties);
|
|
1267 |
}
|
|
1268 |
|
|
1269 |
iContentList->SetProfile(profile);
|
|
1270 |
|
|
1271 |
// read sync tasks from database into content list
|
|
1272 |
iContentList->InitAllTasksL();
|
|
1273 |
if (IsProfileLockedL(aProfileId))
|
|
1274 |
{
|
|
1275 |
iContentList->UpdateLocalDatabaseL();
|
|
1276 |
}
|
|
1277 |
|
|
1278 |
if (!iContentList->CheckTaskDirectionsL())
|
|
1279 |
{
|
|
1280 |
if (!iSettingEnforcement)
|
|
1281 |
{
|
|
1282 |
iContentList->ModifyTaskDirectionsL(ESyncDirectionTwoWay);
|
|
1283 |
}
|
|
1284 |
|
|
1285 |
FLOG( _L("### sync direction conflict ###") );
|
|
1286 |
}
|
|
1287 |
|
|
1288 |
//check if mailbox exists
|
|
1289 |
CDesCArray* localDataStores = new (ELeave) CDesCArrayFlat(KDefaultArraySize);
|
|
1290 |
CleanupStack::PushL(localDataStores);
|
|
1291 |
iContentList->GetLocalDatabaseList(KUidNSmlAdapterEMail.iUid, localDataStores);
|
|
1292 |
|
|
1293 |
TInt num = profile->ProtocolVersion();
|
|
1294 |
if (num == EAspProtocol_1_1 || localDataStores->Count() == 0)
|
|
1295 |
{
|
|
1296 |
TInt index = iContentList->FindTaskIdForProvider( KUidNSmlAdapterEMail.iUid);
|
|
1297 |
if (index != KErrNotFound)
|
|
1298 |
{
|
|
1299 |
TAspTaskItem emailItem = iContentList->ReadTaskItemL(profile->Profile(), index);
|
|
1300 |
if (emailItem.iEnabled)
|
|
1301 |
{
|
|
1302 |
iContentList->ModifyTaskIncludedL(KUidNSmlAdapterEMail.iUid, EFalse, KNullDesC);
|
|
1303 |
}
|
|
1304 |
}
|
|
1305 |
}
|
|
1306 |
CleanupStack::PopAndDestroy(localDataStores);
|
|
1307 |
|
|
1308 |
iContentList->SetProfile(NULL);
|
|
1309 |
|
|
1310 |
iCurrentProfileId = aProfileId;
|
|
1311 |
|
|
1312 |
profile->GetName(iCurrentProfileName);
|
|
1313 |
if (TUtil::IsEmpty(iCurrentProfileName))
|
|
1314 |
{
|
|
1315 |
CAspResHandler::ReadL(iCurrentProfileName, R_ASP_UNNAMED_SET);
|
|
1316 |
}
|
|
1317 |
|
|
1318 |
|
|
1319 |
CleanupStack::PopAndDestroy(profile);
|
|
1320 |
|
|
1321 |
FLOG( _L("CAspSettingDialog::DoSetCurrentProfileL END") );
|
|
1322 |
}
|
|
1323 |
|
|
1324 |
|
|
1325 |
// -----------------------------------------------------------------------------
|
|
1326 |
// CAspSettingDialog::SetCurrentProfile
|
|
1327 |
//
|
|
1328 |
// -----------------------------------------------------------------------------
|
|
1329 |
//
|
|
1330 |
void CAspSettingDialog::SetCurrentProfile(TInt aProfileId)
|
|
1331 |
{
|
|
1332 |
if (iContentList->IsLocked())
|
|
1333 |
{
|
|
1334 |
return; // iContentList used by CAspProfileDialog
|
|
1335 |
}
|
|
1336 |
|
|
1337 |
TInt err = KErrNone;
|
|
1338 |
TInt oldCurrentProfileId = iCurrentProfileId;
|
|
1339 |
|
|
1340 |
TRAP(err, DoSetCurrentProfileL(aProfileId));
|
|
1341 |
|
|
1342 |
iContentList->SetProfile(NULL);
|
|
1343 |
|
|
1344 |
if (err != KErrNone)
|
|
1345 |
{
|
|
1346 |
iCurrentProfileId = KErrNotFound;
|
|
1347 |
iCurrentProfileName = KNullDesC;
|
|
1348 |
iContentList->RemoveAllTasks();
|
|
1349 |
}
|
|
1350 |
|
|
1351 |
if (err != KErrNone && oldCurrentProfileId != KErrNotFound)
|
|
1352 |
{
|
|
1353 |
// some error - try restoring old current profile
|
|
1354 |
TRAP(err, DoSetCurrentProfileL(oldCurrentProfileId));
|
|
1355 |
|
|
1356 |
iContentList->SetProfile(NULL);
|
|
1357 |
|
|
1358 |
if (err != KErrNone)
|
|
1359 |
{
|
|
1360 |
iCurrentProfileId = KErrNotFound;
|
|
1361 |
iCurrentProfileName = KNullDesC;
|
|
1362 |
iContentList->RemoveAllTasks();
|
|
1363 |
}
|
|
1364 |
}
|
|
1365 |
}
|
|
1366 |
|
|
1367 |
|
|
1368 |
// -----------------------------------------------------------------------------
|
|
1369 |
// CAspSettingDialog::SetCurrentProfile
|
|
1370 |
//
|
|
1371 |
// -----------------------------------------------------------------------------
|
|
1372 |
//
|
|
1373 |
void CAspSettingDialog::SetCurrentProfileL()
|
|
1374 |
{
|
|
1375 |
|
|
1376 |
#ifdef RD_DSUI_TIMEDSYNC //display profiles in alphabetic order.
|
|
1377 |
TInt index = 0;
|
|
1378 |
if (!iProfileList->Count())
|
|
1379 |
{
|
|
1380 |
index = KErrNotFound;
|
|
1381 |
}
|
|
1382 |
|
|
1383 |
#else
|
|
1384 |
TInt index = iProfileList->FindLastSyncedProfileIndexL();
|
|
1385 |
|
|
1386 |
#endif
|
|
1387 |
if (index != KErrNotFound)
|
|
1388 |
{
|
|
1389 |
TAspProfileItem& item = iProfileList->Item(index);
|
|
1390 |
SetCurrentProfile(item.iProfileId);
|
|
1391 |
}
|
|
1392 |
else
|
|
1393 |
{
|
|
1394 |
SetCurrentProfile(KErrNotFound);
|
|
1395 |
}
|
|
1396 |
}
|
|
1397 |
|
|
1398 |
|
|
1399 |
// -----------------------------------------------------------------------------
|
|
1400 |
// CAspSettingDialog::CurrentProfileL
|
|
1401 |
//
|
|
1402 |
// -----------------------------------------------------------------------------
|
|
1403 |
//
|
|
1404 |
TAspProfileItem& CAspSettingDialog::CurrentProfileL()
|
|
1405 |
{
|
|
1406 |
TInt index = iProfileList->ListIndex(iCurrentProfileId);
|
|
1407 |
if (index == KErrNotFound)
|
|
1408 |
{
|
|
1409 |
User::Leave(KErrNotFound);
|
|
1410 |
}
|
|
1411 |
|
|
1412 |
return iProfileList->Item(index);
|
|
1413 |
}
|
|
1414 |
|
|
1415 |
|
|
1416 |
// -----------------------------------------------------------------------------
|
|
1417 |
// CAspSettingDialog::HasCurrentProfile
|
|
1418 |
//
|
|
1419 |
// -----------------------------------------------------------------------------
|
|
1420 |
//
|
|
1421 |
TBool CAspSettingDialog::HasCurrentProfile()
|
|
1422 |
{
|
|
1423 |
TInt ret = ETrue;
|
|
1424 |
|
|
1425 |
if (iCurrentProfileId == KErrNotFound)
|
|
1426 |
{
|
|
1427 |
ret = EFalse;
|
|
1428 |
}
|
|
1429 |
|
|
1430 |
if (iProfileList->Count() == 0)
|
|
1431 |
{
|
|
1432 |
ret = EFalse;
|
|
1433 |
}
|
|
1434 |
|
|
1435 |
if (ret)
|
|
1436 |
{
|
|
1437 |
TInt index = iProfileList->ListIndex(iCurrentProfileId);
|
|
1438 |
|
|
1439 |
__ASSERT_DEBUG(index != KErrNotFound, TUtil::Panic(KErrGeneral));
|
|
1440 |
}
|
|
1441 |
|
|
1442 |
return ret;
|
|
1443 |
}
|
|
1444 |
|
|
1445 |
|
|
1446 |
// -----------------------------------------------------------------------------
|
|
1447 |
// CAspSettingDialog::IsCurrentProfile
|
|
1448 |
//
|
|
1449 |
// -----------------------------------------------------------------------------
|
|
1450 |
//
|
|
1451 |
TBool CAspSettingDialog::IsCurrentProfile(TInt aProfileId)
|
|
1452 |
{
|
|
1453 |
if (aProfileId != KErrNotFound && aProfileId == iCurrentProfileId)
|
|
1454 |
{
|
|
1455 |
return ETrue;
|
|
1456 |
}
|
|
1457 |
|
|
1458 |
return EFalse;
|
|
1459 |
}
|
|
1460 |
|
|
1461 |
|
|
1462 |
// -----------------------------------------------------------------------------
|
|
1463 |
// CAspSettingDialog::DoSaveCurrentProfileL
|
|
1464 |
//
|
|
1465 |
// -----------------------------------------------------------------------------
|
|
1466 |
//
|
|
1467 |
void CAspSettingDialog::DoSaveCurrentProfileL()
|
|
1468 |
{
|
|
1469 |
if (iSettingEnforcement)
|
|
1470 |
{
|
|
1471 |
return; // read-only profile
|
|
1472 |
}
|
|
1473 |
|
|
1474 |
if (!HasCurrentProfile())
|
|
1475 |
{
|
|
1476 |
User::Leave(KErrNotFound);
|
|
1477 |
}
|
|
1478 |
|
|
1479 |
TAspParam param(iApplicationId, iSyncSession);
|
|
1480 |
CAspProfile* profile = CAspProfile::NewLC(param);
|
|
1481 |
profile->OpenL(iCurrentProfileId, CAspProfile::EOpenReadWrite,
|
|
1482 |
CAspProfile::EAllProperties);
|
|
1483 |
|
|
1484 |
iContentList->SetProfile(profile);
|
|
1485 |
// store selected sync tasks into database
|
|
1486 |
iContentList->IncludeTasks(iSettingListBox->SelectionIndexes());
|
|
1487 |
iContentList->SetProfile(NULL);
|
|
1488 |
|
|
1489 |
CleanupStack::PopAndDestroy(profile);
|
|
1490 |
}
|
|
1491 |
|
|
1492 |
|
|
1493 |
// -----------------------------------------------------------------------------
|
|
1494 |
// CAspSettingDialog::SaveCurrentProfile
|
|
1495 |
//
|
|
1496 |
// -----------------------------------------------------------------------------
|
|
1497 |
//
|
|
1498 |
TInt CAspSettingDialog::SaveCurrentProfile()
|
|
1499 |
{
|
|
1500 |
TRAPD(err, DoSaveCurrentProfileL());
|
|
1501 |
|
|
1502 |
iContentList->SetProfile(NULL);
|
|
1503 |
|
|
1504 |
if (err == KErrLocked)
|
|
1505 |
{
|
|
1506 |
TRAP_IGNORE( TDialogUtil::ShowErrorNoteL(R_ASP_LOCKED_PROFILE) );
|
|
1507 |
}
|
|
1508 |
|
|
1509 |
if (err != KErrNone)
|
|
1510 |
{
|
|
1511 |
FLOG( _L("### CAspSettingDialog::SaveCurrentProfile: err=%d ###"), err );
|
|
1512 |
}
|
|
1513 |
|
|
1514 |
return err;
|
|
1515 |
}
|
|
1516 |
|
|
1517 |
|
|
1518 |
// -----------------------------------------------------------------------------
|
|
1519 |
// CAspSettingDialog::EditProfileL
|
|
1520 |
//
|
|
1521 |
// -----------------------------------------------------------------------------
|
|
1522 |
//
|
|
1523 |
void CAspSettingDialog::EditProfileL(TInt aEditMode ,TInt aFocus)
|
|
1524 |
{
|
|
1525 |
if (iSettingEnforcement)
|
|
1526 |
{
|
|
1527 |
aEditMode = EDialogModeSettingEnforcement;
|
|
1528 |
}
|
|
1529 |
|
|
1530 |
if (IsProfileLockedL(iCurrentProfileId))
|
|
1531 |
{
|
|
1532 |
TDialogUtil::ShowErrorNoteL(R_ASP_LOCKED_PROFILE);
|
|
1533 |
return;
|
|
1534 |
}
|
|
1535 |
TRAPD(err, DoEditProfileL(aEditMode ,aFocus));
|
|
1536 |
iContentList->SetProfile(NULL);
|
|
1537 |
User::LeaveIfError(err);
|
|
1538 |
|
|
1539 |
#ifdef RD_DSUI_TIMEDSYNC
|
|
1540 |
iUpdateTabGroup = ETrue;
|
|
1541 |
UpdateTabsL();
|
|
1542 |
#endif
|
|
1543 |
|
|
1544 |
}
|
|
1545 |
|
|
1546 |
|
|
1547 |
// -----------------------------------------------------------------------------
|
|
1548 |
// CAspSettingDialog::DoEditProfileL
|
|
1549 |
//
|
|
1550 |
// -----------------------------------------------------------------------------
|
|
1551 |
//
|
|
1552 |
void CAspSettingDialog::DoEditProfileL(TInt aEditMode, TInt aFocus)
|
|
1553 |
{
|
|
1554 |
if (!HasCurrentProfile())
|
|
1555 |
{
|
|
1556 |
return;
|
|
1557 |
}
|
|
1558 |
|
|
1559 |
TAspParam param(iApplicationId, iSyncSession);
|
|
1560 |
CAspProfile* profile = CAspProfile::NewLC(param);
|
|
1561 |
|
|
1562 |
iContentList->SetProfile(profile);
|
|
1563 |
|
|
1564 |
if (aEditMode == EDialogModeEdit || aEditMode == EDialogModeEditMandatory)
|
|
1565 |
{
|
|
1566 |
profile->OpenL(iCurrentProfileId, CAspProfile::EOpenReadWrite,
|
|
1567 |
CAspProfile::EAllProperties);
|
|
1568 |
|
|
1569 |
}
|
|
1570 |
else
|
|
1571 |
{
|
|
1572 |
profile->OpenL(iCurrentProfileId, CAspProfile::EOpenRead,
|
|
1573 |
CAspProfile::EAllProperties);
|
|
1574 |
}
|
|
1575 |
|
|
1576 |
|
|
1577 |
TAspParam param2(iApplicationId, iSyncSession);
|
|
1578 |
param2.iProfile = profile;
|
|
1579 |
param2.iMode = aEditMode;
|
|
1580 |
param2.iContentList = iContentList;
|
|
1581 |
param2.iProfileList = iProfileList; // needed for unique server id check
|
|
1582 |
param2.iDataProviderId = aFocus;
|
|
1583 |
|
|
1584 |
#ifdef RD_DSUI_TIMEDSYNC
|
|
1585 |
CAspSettingViewDialog::ShowDialogL(param2);
|
|
1586 |
#else
|
|
1587 |
CAspProfileDialog::ShowDialogL(param2);
|
|
1588 |
#endif
|
|
1589 |
|
|
1590 |
iContentList->SetProfile(NULL);
|
|
1591 |
CleanupStack::PopAndDestroy(profile);
|
|
1592 |
}
|
|
1593 |
|
|
1594 |
|
|
1595 |
// -----------------------------------------------------------------------------
|
|
1596 |
// CAspSettingDialog::CheckMandatoryDataL
|
|
1597 |
//
|
|
1598 |
// -----------------------------------------------------------------------------
|
|
1599 |
//
|
|
1600 |
TInt CAspSettingDialog::CheckMandatoryDataL()
|
|
1601 |
{
|
|
1602 |
TInt ret = EMandatoryOk;
|
|
1603 |
|
|
1604 |
TRAPD(err, ret = DoCheckMandatoryDataL());
|
|
1605 |
|
|
1606 |
User::LeaveIfError(err);
|
|
1607 |
|
|
1608 |
return ret;
|
|
1609 |
}
|
|
1610 |
|
|
1611 |
|
|
1612 |
// -----------------------------------------------------------------------------
|
|
1613 |
// CAspSettingDialog::DoCheckMandatoryDataL
|
|
1614 |
//
|
|
1615 |
// -----------------------------------------------------------------------------
|
|
1616 |
//
|
|
1617 |
TInt CAspSettingDialog::DoCheckMandatoryDataL()
|
|
1618 |
{
|
|
1619 |
if (!HasCurrentProfile())
|
|
1620 |
{
|
|
1621 |
User::Leave(KErrNotFound);
|
|
1622 |
}
|
|
1623 |
|
|
1624 |
TAspParam param(iApplicationId, iSyncSession);
|
|
1625 |
CAspProfile* profile = CAspProfile::NewLC(param);
|
|
1626 |
profile->OpenL(iCurrentProfileId, CAspProfile::EOpenReadWrite,
|
|
1627 |
CAspProfile::EAllProperties);
|
|
1628 |
|
|
1629 |
|
|
1630 |
TInt mandatoryConnectionData = CAspProfile::CheckMandatoryConnData(profile);
|
|
1631 |
iContentList->SetProfile(profile);
|
|
1632 |
TInt contentCount = 0;
|
|
1633 |
TInt mandatoryContentData = iContentList->CheckMandatoryDataL(contentCount);
|
|
1634 |
iContentList->SetProfile(NULL);
|
|
1635 |
CleanupStack::PopAndDestroy(profile);
|
|
1636 |
|
|
1637 |
if (mandatoryConnectionData != EMandatoryOk)
|
|
1638 |
{
|
|
1639 |
return mandatoryConnectionData;
|
|
1640 |
}
|
|
1641 |
|
|
1642 |
return mandatoryContentData;
|
|
1643 |
}
|
|
1644 |
|
|
1645 |
|
|
1646 |
// -----------------------------------------------------------------------------
|
|
1647 |
// CAspSettingDialog::DeleteProfileL
|
|
1648 |
//
|
|
1649 |
// -----------------------------------------------------------------------------
|
|
1650 |
//
|
|
1651 |
void CAspSettingDialog::DeleteProfileL()
|
|
1652 |
{
|
|
1653 |
|
|
1654 |
#ifdef RD_DSUI_TIMEDSYNC
|
|
1655 |
TAspParam param(iApplicationId, iSyncSession);
|
|
1656 |
CAspProfile* profile = CAspProfile::NewLC(param);
|
|
1657 |
TRAPD(err,profile->OpenL(iCurrentProfileId, CAspProfile::EOpenReadWrite,
|
|
1658 |
CAspProfile::EAllProperties));
|
|
1659 |
|
|
1660 |
if (err == KErrLocked)
|
|
1661 |
{
|
|
1662 |
TDialogUtil::ShowErrorNoteL(R_ASP_LOCKED_PROFILE);
|
|
1663 |
CleanupStack::PopAndDestroy(profile);
|
|
1664 |
return;
|
|
1665 |
}
|
|
1666 |
CAspSchedule* schedule = CAspSchedule::NewLC();
|
|
1667 |
|
|
1668 |
TInt profileId = schedule->ProfileId();
|
|
1669 |
if (profileId == iCurrentProfileId && schedule->IsAutoSyncEnabled())
|
|
1670 |
{
|
|
1671 |
HBufC* hBuf = CAspResHandler::ReadLC(R_ASP_DS_CONF_QUERY_DELETE_AUTO_SYNC_PROFILE);
|
|
1672 |
if (!TDialogUtil::ShowConfirmationQueryL(hBuf->Des()))
|
|
1673 |
{
|
|
1674 |
CleanupStack::PopAndDestroy(hBuf);
|
|
1675 |
CleanupStack::PopAndDestroy(schedule);
|
|
1676 |
CleanupStack::PopAndDestroy(profile);
|
|
1677 |
return;
|
|
1678 |
}
|
|
1679 |
CleanupStack::PopAndDestroy(hBuf);
|
|
1680 |
schedule->SetProfileId(KErrNotFound);
|
|
1681 |
schedule->UpdateSyncScheduleL();
|
|
1682 |
schedule->SaveL();
|
|
1683 |
}
|
|
1684 |
else
|
|
1685 |
{
|
|
1686 |
TBuf<KBufSize> profileName;
|
|
1687 |
profile->GetName(profileName);
|
|
1688 |
HBufC* hBuf1 = CAspResHandler::ReadLC(R_ASP_QUERY_COMMON_CONF_DELETE, profileName);
|
|
1689 |
|
|
1690 |
if (!TDialogUtil::ShowConfirmationQueryL(hBuf1->Des()))
|
|
1691 |
{
|
|
1692 |
CleanupStack::PopAndDestroy(hBuf1);
|
|
1693 |
CleanupStack::PopAndDestroy(schedule);
|
|
1694 |
CleanupStack::PopAndDestroy(profile);
|
|
1695 |
return;
|
|
1696 |
}
|
|
1697 |
CleanupStack::PopAndDestroy(hBuf1);
|
|
1698 |
}
|
|
1699 |
CleanupStack::PopAndDestroy(schedule);
|
|
1700 |
CleanupStack::PopAndDestroy(profile);
|
|
1701 |
if (!IsSyncOnGoingL(iCurrentProfileId))
|
|
1702 |
{
|
|
1703 |
TRAPD (err1,iSyncSession->DeleteProfileL(iCurrentProfileId));
|
|
1704 |
|
|
1705 |
if (err1 == KErrLocked)
|
|
1706 |
{
|
|
1707 |
TDialogUtil::ShowErrorNoteL(R_ASP_LOCKED_PROFILE);
|
|
1708 |
}
|
|
1709 |
User::LeaveIfError(err);
|
|
1710 |
}
|
|
1711 |
iUpdateTabGroup = ETrue;
|
|
1712 |
SetPreviousProfileL();
|
|
1713 |
|
|
1714 |
|
|
1715 |
#else
|
|
1716 |
|
|
1717 |
TAspFilterInfo info;
|
|
1718 |
info.iFilterType = TAspFilterInfo::EIncludeDeletableProfile;
|
|
1719 |
CAspProfileList* filteredList = iProfileList->FilteredListL(info);
|
|
1720 |
CleanupStack::PushL(filteredList);
|
|
1721 |
|
|
1722 |
TInt count = filteredList->Count();
|
|
1723 |
TInt err = KErrNone;
|
|
1724 |
|
|
1725 |
if (count == 1)
|
|
1726 |
{
|
|
1727 |
TAspProfileItem& profile = filteredList->Item(0);
|
|
1728 |
|
|
1729 |
HBufC* hBuf = CAspResHandler::ReadLC(R_ASP_CONFIRM_DELETE, profile.iProfileName);
|
|
1730 |
if (TDialogUtil::ShowConfirmationQueryL(hBuf->Des()))
|
|
1731 |
{
|
|
1732 |
if (!IsSyncOnGoingL(profile.iProfileId))
|
|
1733 |
{
|
|
1734 |
TRAP(err, iSyncSession->DeleteProfileL(profile.iProfileId));
|
|
1735 |
}
|
|
1736 |
}
|
|
1737 |
|
|
1738 |
CleanupStack::PopAndDestroy(hBuf);
|
|
1739 |
}
|
|
1740 |
|
|
1741 |
else if (count > 0)
|
|
1742 |
{
|
|
1743 |
TInt profileId = KErrNotFound;
|
|
1744 |
if (TDialogUtil::ShowProfileQueryL(filteredList, profileId,
|
|
1745 |
R_ASP_QUERY_TITLE_DELETE_PROFILE))
|
|
1746 |
{
|
|
1747 |
if (!IsSyncOnGoingL(profileId))
|
|
1748 |
{
|
|
1749 |
TRAP(err, iSyncSession->DeleteProfileL(profileId));
|
|
1750 |
}
|
|
1751 |
}
|
|
1752 |
}
|
|
1753 |
|
|
1754 |
if (err == KErrLocked)
|
|
1755 |
{
|
|
1756 |
TDialogUtil::ShowErrorNoteL(R_ASP_LOCKED_PROFILE);
|
|
1757 |
}
|
|
1758 |
User::LeaveIfError(err);
|
|
1759 |
|
|
1760 |
CleanupStack::PopAndDestroy(filteredList);
|
|
1761 |
|
|
1762 |
#endif
|
|
1763 |
}
|
|
1764 |
|
|
1765 |
|
|
1766 |
// -----------------------------------------------------------------------------
|
|
1767 |
// CAspSettingDialog::ShowLogDialogL
|
|
1768 |
//
|
|
1769 |
// -----------------------------------------------------------------------------
|
|
1770 |
//
|
|
1771 |
void CAspSettingDialog::ShowLogDialogL()
|
|
1772 |
{
|
|
1773 |
|
|
1774 |
TAspParam param(iApplicationId, iSyncSession);
|
|
1775 |
TAspProfileItem& profile = CurrentProfileL();
|
|
1776 |
param.iProfileId = profile.iProfileId;
|
|
1777 |
|
|
1778 |
#ifdef RD_DSUI_TIMEDSYNC
|
|
1779 |
|
|
1780 |
CAspSchedule* schedule = CAspSchedule::NewLC();
|
|
1781 |
if (iCurrentProfileId == schedule->ProfileId())
|
|
1782 |
{
|
|
1783 |
TInt asProfileId = schedule->AutoSyncProfileId();
|
|
1784 |
CAspProfile* asProfile = CAspProfile::NewLC(param);
|
|
1785 |
asProfile->OpenL(asProfileId, CAspProfile::EOpenRead, CAspProfile::EAllProperties);
|
|
1786 |
|
|
1787 |
/*if (asProfile->LastSync() > profile.iLastSync)
|
|
1788 |
{
|
|
1789 |
param.iProfileId = asProfileId;
|
|
1790 |
}*/
|
|
1791 |
TTime now;
|
|
1792 |
now.HomeTime();
|
|
1793 |
if (profile.iLastSync == 0)
|
|
1794 |
{
|
|
1795 |
param.iProfileId = asProfileId;
|
|
1796 |
}
|
|
1797 |
else if ((asProfile->LastSync()< now && profile.iLastSync < now)
|
|
1798 |
|| (asProfile->LastSync() > now && profile.iLastSync > now))
|
|
1799 |
{
|
|
1800 |
if (asProfile->LastSync() > profile.iLastSync)
|
|
1801 |
{
|
|
1802 |
param.iProfileId = asProfileId;
|
|
1803 |
}
|
|
1804 |
}
|
|
1805 |
else if ((asProfile->LastSync()< now && profile.iLastSync > now))
|
|
1806 |
{
|
|
1807 |
param.iProfileId = asProfileId;
|
|
1808 |
}
|
|
1809 |
CleanupStack::PopAndDestroy(asProfile);
|
|
1810 |
}
|
|
1811 |
|
|
1812 |
CleanupStack::PopAndDestroy(schedule);
|
|
1813 |
|
|
1814 |
#endif
|
|
1815 |
|
|
1816 |
|
|
1817 |
CAspLogDialog* dialog = CAspLogDialog::NewL(param);
|
|
1818 |
CleanupStack::PushL(dialog);
|
|
1819 |
|
|
1820 |
dialog->ShowDialogL();
|
|
1821 |
|
|
1822 |
CleanupStack::PopAndDestroy(dialog);
|
|
1823 |
}
|
|
1824 |
|
|
1825 |
|
|
1826 |
// -----------------------------------------------------------------------------
|
|
1827 |
// CAspSettingDialog::ShowAutoSyncDialogL
|
|
1828 |
//
|
|
1829 |
// -----------------------------------------------------------------------------
|
|
1830 |
//
|
|
1831 |
void CAspSettingDialog::ShowAutoSyncDialogL()
|
|
1832 |
{
|
|
1833 |
|
|
1834 |
CAspSchedule* schedule = CAspSchedule::NewLC();
|
|
1835 |
if (schedule->IsAutoSyncEnabled())
|
|
1836 |
{
|
|
1837 |
TInt profileId = schedule->ProfileId();
|
|
1838 |
if(profileId != iCurrentProfileId && profileId != KErrNotFound)
|
|
1839 |
{
|
|
1840 |
if(!TDialogUtil::ShowConfirmationQueryL(R_ASP_QUERY_AUTO_SYNC_ON))
|
|
1841 |
{
|
|
1842 |
CleanupStack::PopAndDestroy(schedule);
|
|
1843 |
return ;
|
|
1844 |
}
|
|
1845 |
}
|
|
1846 |
}
|
|
1847 |
CleanupStack::PopAndDestroy(schedule);
|
|
1848 |
|
|
1849 |
TAspParam param(iApplicationId, iSyncSession);
|
|
1850 |
param.iProfileList = iProfileList;
|
|
1851 |
param.iProfile = NULL;
|
|
1852 |
param.iContentList = iContentList;
|
|
1853 |
iAutoSyncDialog = ETrue;
|
|
1854 |
CAspScheduleDialog::ShowDialogL(param);
|
|
1855 |
iAutoSyncDialog = EFalse;
|
|
1856 |
|
|
1857 |
#ifdef RD_DSUI_TIMEDSYNC
|
|
1858 |
UpdateTabsL();
|
|
1859 |
#endif
|
|
1860 |
|
|
1861 |
}
|
|
1862 |
|
|
1863 |
|
|
1864 |
// -----------------------------------------------------------------------------
|
|
1865 |
// CAspSettingDialog::ChangeProfileL
|
|
1866 |
//
|
|
1867 |
// -----------------------------------------------------------------------------
|
|
1868 |
//
|
|
1869 |
void CAspSettingDialog::ChangeProfileL()
|
|
1870 |
{
|
|
1871 |
if (iProfileList->Count() == 0)
|
|
1872 |
{
|
|
1873 |
return;
|
|
1874 |
}
|
|
1875 |
|
|
1876 |
TInt profileId = KErrNotFound;
|
|
1877 |
if (TDialogUtil::ShowProfileQueryL(iProfileList, profileId,
|
|
1878 |
R_ASP_QUERY_TITLE_CHANGE_PROFILE))
|
|
1879 |
{
|
|
1880 |
if (profileId == iCurrentProfileId)
|
|
1881 |
{
|
|
1882 |
return;
|
|
1883 |
}
|
|
1884 |
|
|
1885 |
SetCurrentProfile(profileId);
|
|
1886 |
//ShowCurrentProfileInfo();
|
|
1887 |
UpdateListBoxL();
|
|
1888 |
|
|
1889 |
#ifdef RD_DSUI_TIMEDSYNC //RD_DSUI_NO_TIMEDSYNC
|
|
1890 |
|
|
1891 |
UpdateTabsL();
|
|
1892 |
#else
|
|
1893 |
UpdateNavipaneL(iCurrentProfileName);
|
|
1894 |
#endif
|
|
1895 |
}
|
|
1896 |
}
|
|
1897 |
|
|
1898 |
|
|
1899 |
// -----------------------------------------------------------------------------
|
|
1900 |
// CAspSettingDialog::CopyFromServerL
|
|
1901 |
//
|
|
1902 |
// -----------------------------------------------------------------------------
|
|
1903 |
//
|
|
1904 |
void CAspSettingDialog::CopyFromServerL()
|
|
1905 |
{
|
|
1906 |
if (!TDialogUtil::ShowConfirmationQueryL(R_ASP_COPY_FROM_SERVER))
|
|
1907 |
{
|
|
1908 |
return;
|
|
1909 |
}
|
|
1910 |
|
|
1911 |
TRAPD(err, DoSyncProfileL(ESyncDirectionRefreshFromServer));
|
|
1912 |
|
|
1913 |
if (err == KErrLocked)
|
|
1914 |
{
|
|
1915 |
TDialogUtil::ShowErrorNoteL(R_ASP_LOCKED_PROFILE);
|
|
1916 |
}
|
|
1917 |
User::LeaveIfError(err);
|
|
1918 |
}
|
|
1919 |
|
|
1920 |
|
|
1921 |
// -----------------------------------------------------------------------------
|
|
1922 |
// CAspSettingDialog::SyncProfileL
|
|
1923 |
//
|
|
1924 |
// -----------------------------------------------------------------------------
|
|
1925 |
//
|
|
1926 |
void CAspSettingDialog::SyncProfileL()
|
|
1927 |
{
|
|
1928 |
|
|
1929 |
if (IsProfileLockedL(iCurrentProfileId))
|
|
1930 |
{
|
|
1931 |
TDialogUtil::ShowErrorNoteL(R_ASP_LOCKED_PROFILE);
|
|
1932 |
return;
|
|
1933 |
}
|
|
1934 |
|
|
1935 |
TRAPD(err, DoSyncProfileL(KErrNotFound));
|
|
1936 |
User::LeaveIfError(err);
|
|
1937 |
}
|
|
1938 |
|
|
1939 |
|
|
1940 |
// -----------------------------------------------------------------------------
|
|
1941 |
// CAspSettingDialog::DoSyncProfileL
|
|
1942 |
//
|
|
1943 |
// -----------------------------------------------------------------------------
|
|
1944 |
//
|
|
1945 |
void CAspSettingDialog::DoSyncProfileL(TInt aSyncType)
|
|
1946 |
{
|
|
1947 |
__ASSERT_ALWAYS(iSyncSession, TUtil::Panic(KErrGeneral));
|
|
1948 |
|
|
1949 |
if (iProfileList->Count() == 0)
|
|
1950 |
{
|
|
1951 |
if (TDialogUtil::ShowConfirmationQueryL(R_ASP_QUERY_NO_PROFILES))
|
|
1952 |
{
|
|
1953 |
CreateProfileL();
|
|
1954 |
}
|
|
1955 |
|
|
1956 |
return;
|
|
1957 |
}
|
|
1958 |
|
|
1959 |
//check PS key
|
|
1960 |
TInt keyVal = 0;//EDataSyncNotRunning
|
|
1961 |
TInt err = RProperty::Get( KPSUidDataSynchronizationInternalKeys,
|
|
1962 |
KDataSyncStatus,
|
|
1963 |
keyVal );
|
|
1964 |
if(err == KErrNone && keyVal)
|
|
1965 |
{
|
|
1966 |
TDialogUtil::ShowInformationNoteL(R_ASP_SYNC_ALREADY_RUNNING);
|
|
1967 |
return;
|
|
1968 |
}
|
|
1969 |
|
|
1970 |
|
|
1971 |
if (CAspProfile::OtherSyncRunning(iSyncSession))
|
|
1972 |
{
|
|
1973 |
TDialogUtil::ShowInformationNoteL(R_ASP_SYNC_ALREADY_RUNNING);
|
|
1974 |
return;
|
|
1975 |
}
|
|
1976 |
|
|
1977 |
// check that valid current profile exists
|
|
1978 |
TInt mandatoryCheck = CheckMandatoryDataL();
|
|
1979 |
|
|
1980 |
if (mandatoryCheck == EMandatoryNoContent)
|
|
1981 |
{
|
|
1982 |
TDialogUtil::ShowErrorNoteL(R_ASP_ERR_NOCONTENT);
|
|
1983 |
return;
|
|
1984 |
}
|
|
1985 |
else if (mandatoryCheck != EMandatoryOk)
|
|
1986 |
{
|
|
1987 |
if (iSettingEnforcement)
|
|
1988 |
{
|
|
1989 |
TDialogUtil::ShowInformationNoteL(R_ASP_NOTE_TARM_MANDATORY_MISSING);
|
|
1990 |
}
|
|
1991 |
else if (TDialogUtil::ShowConfirmationQueryL(R_ASP_QUERY_MANDATORY_MISSING))
|
|
1992 |
{
|
|
1993 |
TInt contentCount = 0;
|
|
1994 |
TInt incompleteContent = KErrNotFound;
|
|
1995 |
TInt taskIndex = KErrNotFound;
|
|
1996 |
if (iContentList->CheckMandatoryDataL(contentCount))
|
|
1997 |
{
|
|
1998 |
TInt count = iContentList->ProviderCount();
|
|
1999 |
for (TInt i=0; i<count; i++)
|
|
2000 |
{
|
|
2001 |
//data provider ids are sorted before task list creation ,so provider id has to be used
|
|
2002 |
//to get the correct position of item
|
|
2003 |
TAspProviderItem& providerItem = iContentList->ProviderItem(i);
|
|
2004 |
taskIndex = iContentList->FindTaskIndexForProvider(providerItem.iDataProviderId);
|
|
2005 |
if (taskIndex == KErrNotFound)
|
|
2006 |
{
|
|
2007 |
//task is not created
|
|
2008 |
continue;
|
|
2009 |
}
|
|
2010 |
TAspTaskItem& task = iContentList->TaskItem(taskIndex);
|
|
2011 |
if (!task.iEnabled)
|
|
2012 |
{
|
|
2013 |
continue; // task not part of sync - no need to check remote data base
|
|
2014 |
}
|
|
2015 |
if (!task.iRemoteDatabaseDefined)
|
|
2016 |
{
|
|
2017 |
incompleteContent = task.iDataProviderId;
|
|
2018 |
break;
|
|
2019 |
}
|
|
2020 |
}
|
|
2021 |
}
|
|
2022 |
EditProfileL(EDialogModeEditMandatory ,incompleteContent);
|
|
2023 |
}
|
|
2024 |
|
|
2025 |
return;
|
|
2026 |
}
|
|
2027 |
|
|
2028 |
|
|
2029 |
if (!iSyncHandler)
|
|
2030 |
{
|
|
2031 |
TAspParam param(iApplicationId, NULL);
|
|
2032 |
iSyncHandler = CAspSyncHandler::NewL(param);
|
|
2033 |
}
|
|
2034 |
else
|
|
2035 |
{
|
|
2036 |
if (SyncRunning())
|
|
2037 |
{
|
|
2038 |
TDialogUtil::ShowInformationNoteL(R_ASP_SYNC_ALREADY_RUNNING);
|
|
2039 |
return;
|
|
2040 |
}
|
|
2041 |
}
|
|
2042 |
|
|
2043 |
iSyncHandler->SetObserver(this);
|
|
2044 |
|
|
2045 |
TAspSyncParam param(iApplicationId);
|
|
2046 |
param.iProfileId = iCurrentProfileId;
|
|
2047 |
if (aSyncType == ESyncDirectionRefreshFromServer)
|
|
2048 |
{
|
|
2049 |
param.iSyncDirection = aSyncType;
|
|
2050 |
}
|
|
2051 |
|
|
2052 |
#ifdef RD_DSUI_TIMEDSYNC
|
|
2053 |
DeleteAutoSyncHistory();
|
|
2054 |
#endif
|
|
2055 |
|
|
2056 |
iSyncHandler->SynchronizeL(param);
|
|
2057 |
}
|
|
2058 |
|
|
2059 |
// -----------------------------------------------------------------------------
|
|
2060 |
// CAspSettingDialog::DeleteAutoSyncHistory
|
|
2061 |
//
|
|
2062 |
// -----------------------------------------------------------------------------
|
|
2063 |
//
|
|
2064 |
void CAspSettingDialog::DeleteAutoSyncHistory()
|
|
2065 |
{
|
|
2066 |
TAspParam param(iApplicationId, iSyncSession);
|
|
2067 |
CAspSchedule* schedule = CAspSchedule::NewLC();
|
|
2068 |
if (schedule->IsAutoSyncEnabled() && iCurrentProfileId == schedule->ProfileId())
|
|
2069 |
{
|
|
2070 |
TInt asProfileId = schedule->AutoSyncProfileId();
|
|
2071 |
CAspProfile* asProfile = CAspProfile::NewLC(param);
|
|
2072 |
asProfile->OpenL(asProfileId, CAspProfile::EOpenReadWrite, CAspProfile::EAllProperties);
|
|
2073 |
asProfile->DeleteHistory();
|
|
2074 |
CleanupStack::PopAndDestroy(asProfile);
|
|
2075 |
}
|
|
2076 |
CleanupStack::PopAndDestroy(schedule);
|
|
2077 |
}
|
|
2078 |
|
|
2079 |
// -----------------------------------------------------------------------------
|
|
2080 |
// CAspSettingDialog::CreateProfileL
|
|
2081 |
//
|
|
2082 |
// -----------------------------------------------------------------------------
|
|
2083 |
//
|
|
2084 |
void CAspSettingDialog::CreateProfileL()
|
|
2085 |
{
|
|
2086 |
TAspParam param(iApplicationId, iSyncSession);
|
|
2087 |
param.iProfileList = iProfileList;
|
|
2088 |
|
|
2089 |
CAspProfileWizardDialog::ShowDialogL(param);
|
|
2090 |
|
|
2091 |
#ifdef RD_DSUI_TIMEDSYNC
|
|
2092 |
iUpdateTabGroup = ETrue;
|
|
2093 |
#endif
|
|
2094 |
|
|
2095 |
if (param.iReturnValue == KErrNone && param.iProfileId != KErrNotFound)
|
|
2096 |
{
|
|
2097 |
SetCurrentProfile(param.iProfileId);
|
|
2098 |
UpdateListBoxL();
|
|
2099 |
#ifdef RD_DSUI_TIMEDSYNC
|
|
2100 |
|
|
2101 |
UpdateTabsL();
|
|
2102 |
#else
|
|
2103 |
UpdateNavipaneL(iCurrentProfileName);
|
|
2104 |
#endif
|
|
2105 |
}
|
|
2106 |
else
|
|
2107 |
{
|
|
2108 |
#ifdef RD_DSUI_TIMEDSYNC
|
|
2109 |
|
|
2110 |
UpdateTabsL();
|
|
2111 |
#endif
|
|
2112 |
}
|
|
2113 |
}
|
|
2114 |
|
|
2115 |
|
|
2116 |
// -----------------------------------------------------------------------------
|
|
2117 |
// CAspSettingDialog::IconL
|
|
2118 |
//
|
|
2119 |
// -----------------------------------------------------------------------------
|
|
2120 |
//
|
|
2121 |
CGulIcon* CAspSettingDialog::IconL(TAknsItemID aId, const TDesC& aFileName, TInt aFileIndex, TInt aFileMaskIndex)
|
|
2122 |
{
|
|
2123 |
return TDialogUtil::CreateIconL(aId, aFileName, aFileIndex, aFileMaskIndex);
|
|
2124 |
}
|
|
2125 |
|
|
2126 |
|
|
2127 |
// -----------------------------------------------------------------------------
|
|
2128 |
// CAspSettingDialog::UpdateListBoxL
|
|
2129 |
//
|
|
2130 |
// -----------------------------------------------------------------------------
|
|
2131 |
//
|
|
2132 |
void CAspSettingDialog::UpdateListBoxL()
|
|
2133 |
{
|
|
2134 |
SetCurrentIndex();
|
|
2135 |
|
|
2136 |
CAknDoubleLargeStyleListBox* listBox = ListBox();
|
|
2137 |
CDesCArray* items = (CDesCArray*) listBox->Model()->ItemTextArray();
|
|
2138 |
items->Reset();
|
|
2139 |
listBox->ItemDrawer()->ClearAllPropertiesL();
|
|
2140 |
|
|
2141 |
TInt count = iContentList->ProviderCount();
|
|
2142 |
|
|
2143 |
for (TInt i=0; i<count; i++)
|
|
2144 |
{
|
|
2145 |
HBufC* firstLine = NULL;
|
|
2146 |
HBufC* secondLine = NULL;
|
|
2147 |
|
|
2148 |
TAspProviderItem& providerItem = iContentList->ProviderItem(i);
|
|
2149 |
|
|
2150 |
firstLine = CAspResHandler::GetContentNameLC(
|
|
2151 |
providerItem.iDataProviderId, providerItem.iDisplayName);
|
|
2152 |
|
|
2153 |
TInt index = iContentList->FindTaskIndexForProvider(providerItem.iDataProviderId);
|
|
2154 |
if (providerItem.iDataProviderId == KUidNSmlAdapterEMail.iUid )
|
|
2155 |
{
|
|
2156 |
|
|
2157 |
if(!providerItem.iHasDefaultDataStore)
|
|
2158 |
{
|
|
2159 |
TInt providerListIndex = iContentList->FindProviderIndex(providerItem.iDataProviderId);
|
|
2160 |
|
|
2161 |
CListBoxView* view = iSettingListBox->View();
|
|
2162 |
|
|
2163 |
view->DeselectItem(providerListIndex);
|
|
2164 |
}
|
|
2165 |
}
|
|
2166 |
if (index != KErrNotFound)
|
|
2167 |
{
|
|
2168 |
TAspTaskItem& task = iContentList->TaskItem(index);
|
|
2169 |
|
|
2170 |
if (task.iLastSync != 0) // task has been synchronised
|
|
2171 |
{
|
|
2172 |
secondLine = TUtil::SyncTimeLC(task.iLastSync);
|
|
2173 |
}
|
|
2174 |
else
|
|
2175 |
{
|
|
2176 |
secondLine = CAspResHandler::ReadLC(R_ASP_NOT_SYNCED);
|
|
2177 |
}
|
|
2178 |
}
|
|
2179 |
else
|
|
2180 |
{
|
|
2181 |
secondLine = CAspResHandler::ReadLC(R_ASP_NOT_SYNCED);
|
|
2182 |
}
|
|
2183 |
|
|
2184 |
|
|
2185 |
TPtr ptr1 = firstLine->Des();
|
|
2186 |
AknTextUtils::DisplayTextLanguageSpecificNumberConversion(ptr1);
|
|
2187 |
TPtr ptr2 = secondLine->Des();
|
|
2188 |
AknTextUtils::DisplayTextLanguageSpecificNumberConversion(ptr2);
|
|
2189 |
|
|
2190 |
HBufC* hBuf = NULL;
|
|
2191 |
hBuf = TDialogUtil::ConstructListBoxItemLC(firstLine->Des(), secondLine->Des(), 0);
|
|
2192 |
|
|
2193 |
items->AppendL(hBuf->Des());
|
|
2194 |
|
|
2195 |
CleanupStack::PopAndDestroy(hBuf);
|
|
2196 |
CleanupStack::PopAndDestroy(secondLine);
|
|
2197 |
CleanupStack::PopAndDestroy(firstLine);
|
|
2198 |
}
|
|
2199 |
|
|
2200 |
listBox->HandleItemAdditionL();
|
|
2201 |
|
|
2202 |
if (listBox->Model()->NumberOfItems() == 0)
|
|
2203 |
{
|
|
2204 |
iStatusPaneHandler->SetNaviPaneTitle(KNullDesC);
|
|
2205 |
}
|
|
2206 |
else
|
|
2207 |
{
|
|
2208 |
UpdateContentSelectionL();
|
|
2209 |
|
|
2210 |
TInt current = CurrentIndex();
|
|
2211 |
if (current != KErrNotFound)
|
|
2212 |
{
|
|
2213 |
ListBox()->SetCurrentItemIndexAndDraw(current);
|
|
2214 |
}
|
|
2215 |
}
|
|
2216 |
}
|
|
2217 |
|
|
2218 |
|
|
2219 |
// -----------------------------------------------------------------------------
|
|
2220 |
// CAspSettingDialog::UpdateContentSelectionL
|
|
2221 |
//
|
|
2222 |
// -----------------------------------------------------------------------------
|
|
2223 |
//
|
|
2224 |
void CAspSettingDialog::UpdateContentSelectionL()
|
|
2225 |
{
|
|
2226 |
// update selected task check boxes from current profile content list
|
|
2227 |
CListBoxView::CSelectionIndexArray* arrayOfSelectionIndexes = NULL;
|
|
2228 |
arrayOfSelectionIndexes = new (ELeave) CArrayFixFlat<TInt>(KDefaultArraySize);
|
|
2229 |
CleanupStack::PushL(arrayOfSelectionIndexes);
|
|
2230 |
|
|
2231 |
if (HasCurrentProfile())
|
|
2232 |
{
|
|
2233 |
iContentList->GetIncludedProviders(arrayOfSelectionIndexes);
|
|
2234 |
}
|
|
2235 |
|
|
2236 |
iSettingListBox->SetSelectionIndexesL(arrayOfSelectionIndexes);
|
|
2237 |
|
|
2238 |
CleanupStack::PopAndDestroy(arrayOfSelectionIndexes);
|
|
2239 |
}
|
|
2240 |
|
|
2241 |
|
|
2242 |
// -----------------------------------------------------------------------------
|
|
2243 |
// CAspSettingDialog::UpdateNavipaneL
|
|
2244 |
//
|
|
2245 |
// -----------------------------------------------------------------------------
|
|
2246 |
//
|
|
2247 |
void CAspSettingDialog::UpdateNavipaneL(const TDesC& aText)
|
|
2248 |
{
|
|
2249 |
if (iCurrentProfileName.Compare(aText) != 0)
|
|
2250 |
{
|
|
2251 |
TUtil::StrCopy(iCurrentProfileName, aText);
|
|
2252 |
}
|
|
2253 |
|
|
2254 |
iStatusPaneHandler->SetNaviPaneTitleL(iCurrentProfileName);
|
|
2255 |
}
|
|
2256 |
|
|
2257 |
|
|
2258 |
// -----------------------------------------------------------------------------
|
|
2259 |
// CAspSettingDialog::HandleSyncEventL (from MAspSyncObserver)
|
|
2260 |
//
|
|
2261 |
// -----------------------------------------------------------------------------
|
|
2262 |
//
|
|
2263 |
void CAspSettingDialog::HandleSyncEventL(TInt /*aError*/, TInt aInfo1)
|
|
2264 |
{
|
|
2265 |
iDbNotifier->CreateUpdateEventL(aInfo1, KErrNone);
|
|
2266 |
}
|
|
2267 |
|
|
2268 |
|
|
2269 |
// -----------------------------------------------------------------------------
|
|
2270 |
// CAspSettingDialog::HandleDbEventL (from MAspDbEventHandler)
|
|
2271 |
//
|
|
2272 |
// This function updates UI when it receives sync profile database
|
|
2273 |
// events (see AspDbNotifier).
|
|
2274 |
// -----------------------------------------------------------------------------
|
|
2275 |
//
|
|
2276 |
void CAspSettingDialog::HandleDbEventL(TAspDbEvent aEvent)
|
|
2277 |
{
|
|
2278 |
FLOG( _L("CAspSettingDialog::HandleDbEventL START") );
|
|
2279 |
|
|
2280 |
switch (aEvent.iType)
|
|
2281 |
{
|
|
2282 |
case CAspDbNotifier::EClose:
|
|
2283 |
{
|
|
2284 |
|
|
2285 |
#ifdef _DEBUG
|
|
2286 |
LogDatabaseEvent(aEvent);
|
|
2287 |
#endif
|
|
2288 |
|
|
2289 |
TDialogUtil::ShowErrorNoteL(R_ASP_LOG_ERR_SERVERERROR);
|
|
2290 |
iAvkonAppUi->ProcessCommandL(EAknCmdExit); // close sync app
|
|
2291 |
break;
|
|
2292 |
}
|
|
2293 |
|
|
2294 |
case CAspDbNotifier::EUpdate:
|
|
2295 |
{
|
|
2296 |
iProfileList->ReadProfileL(aEvent.iProfileId);
|
|
2297 |
iProfileList->Sort();
|
|
2298 |
if (IsCurrentProfile(aEvent.iProfileId))
|
|
2299 |
{
|
|
2300 |
if (!iContentList->IsLocked())
|
|
2301 |
{
|
|
2302 |
SetCurrentProfile(aEvent.iProfileId);
|
|
2303 |
UpdateListBoxL();
|
|
2304 |
#ifdef RD_DSUI_TIMEDSYNC
|
|
2305 |
UpdateTabsL();
|
|
2306 |
#else
|
|
2307 |
UpdateNavipaneL(iCurrentProfileName);
|
|
2308 |
#endif
|
|
2309 |
}
|
|
2310 |
}
|
|
2311 |
|
|
2312 |
#ifdef _DEBUG
|
|
2313 |
LogDatabaseEvent(aEvent);
|
|
2314 |
#endif
|
|
2315 |
|
|
2316 |
break;
|
|
2317 |
}
|
|
2318 |
|
|
2319 |
case CAspDbNotifier::EDelete:
|
|
2320 |
{
|
|
2321 |
|
|
2322 |
#ifdef _DEBUG
|
|
2323 |
LogDatabaseEvent(aEvent);
|
|
2324 |
#endif
|
|
2325 |
|
|
2326 |
TInt index = iProfileList->ListIndex(aEvent.iProfileId);
|
|
2327 |
if (index != KErrNotFound)
|
|
2328 |
{
|
|
2329 |
iProfileList->Remove(aEvent.iProfileId);
|
|
2330 |
if (IsCurrentProfile(aEvent.iProfileId))
|
|
2331 |
{
|
|
2332 |
if (!iContentList->IsLocked())
|
|
2333 |
{
|
|
2334 |
SetCurrentProfileL(); // set new current profile
|
|
2335 |
UpdateListBoxL();
|
|
2336 |
#ifdef RD_DSUI_TIMEDSYNC
|
|
2337 |
UpdateTabsL();
|
|
2338 |
#else
|
|
2339 |
UpdateNavipaneL(iCurrentProfileName);
|
|
2340 |
#endif
|
|
2341 |
}
|
|
2342 |
}
|
|
2343 |
}
|
|
2344 |
break;
|
|
2345 |
}
|
|
2346 |
|
|
2347 |
case CAspDbNotifier::EUpdateAll:
|
|
2348 |
{
|
|
2349 |
|
|
2350 |
#ifdef _DEBUG
|
|
2351 |
LogDatabaseEvent(aEvent);
|
|
2352 |
#endif
|
|
2353 |
|
|
2354 |
iProfileList->ReadAllProfilesL(CAspProfileList::ENoMandatoryCheck);
|
|
2355 |
iProfileList->Sort();
|
|
2356 |
if (!iContentList->IsLocked())
|
|
2357 |
{
|
|
2358 |
SetCurrentProfile(iCurrentProfileId); // set new current profile
|
|
2359 |
UpdateListBoxL();
|
|
2360 |
#ifdef RD_DSUI_TIMEDSYNC
|
|
2361 |
UpdateTabsL();
|
|
2362 |
#else
|
|
2363 |
UpdateNavipaneL(iCurrentProfileName);
|
|
2364 |
#endif
|
|
2365 |
}
|
|
2366 |
|
|
2367 |
break;
|
|
2368 |
}
|
|
2369 |
|
|
2370 |
default:
|
|
2371 |
break;
|
|
2372 |
}
|
|
2373 |
|
|
2374 |
FLOG( _L("CAspSettingDialog::HandleDbEventL END") );
|
|
2375 |
}
|
|
2376 |
// -----------------------------------------------------------------------------
|
|
2377 |
// CAspSettingDialog::HandleOKL()
|
|
2378 |
//
|
|
2379 |
// -----------------------------------------------------------------------------
|
|
2380 |
//
|
|
2381 |
|
|
2382 |
void CAspSettingDialog::HandleOKL()
|
|
2383 |
{
|
|
2384 |
|
|
2385 |
if (iProfileList->Count() == 0)
|
|
2386 |
{
|
|
2387 |
return;
|
|
2388 |
}
|
|
2389 |
|
|
2390 |
if (IsProfileLockedL(iCurrentProfileId))
|
|
2391 |
{
|
|
2392 |
TDialogUtil::ShowErrorNoteL(R_ASP_LOCKED_PROFILE);
|
|
2393 |
CancelCheckboxEvent();
|
|
2394 |
return;
|
|
2395 |
}
|
|
2396 |
|
|
2397 |
if (iSettingEnforcement)
|
|
2398 |
{
|
|
2399 |
CancelCheckboxEvent();
|
|
2400 |
TDialogUtil::ShowInformationNoteL(R_ASP_NOTE_MAIN_LOCKED);
|
|
2401 |
return ; // leave dialog open;
|
|
2402 |
}
|
|
2403 |
|
|
2404 |
if (!CheckEmailSelection())
|
|
2405 |
{
|
|
2406 |
return ; // leave dialog open;
|
|
2407 |
}
|
|
2408 |
|
|
2409 |
TInt ret = SaveCurrentProfile();
|
|
2410 |
if (ret != KErrNone)
|
|
2411 |
{
|
|
2412 |
CancelCheckboxEvent();
|
|
2413 |
}
|
|
2414 |
|
|
2415 |
return ;
|
|
2416 |
}
|
|
2417 |
// -----------------------------------------------------------------------------
|
|
2418 |
// CAspSettingDialog::HandleListBoxEventL (from MEikListBoxObserver)
|
|
2419 |
//
|
|
2420 |
// -----------------------------------------------------------------------------
|
|
2421 |
//
|
|
2422 |
void CAspSettingDialog::HandleListBoxEventL(CEikListBox* /*aListBox*/, TListBoxEvent aEventType)
|
|
2423 |
{
|
|
2424 |
if( AknLayoutUtils::PenEnabled() )
|
|
2425 |
{
|
|
2426 |
switch(aEventType)
|
|
2427 |
{
|
|
2428 |
case EEventItemSingleClicked :
|
|
2429 |
HandleOKL();
|
|
2430 |
break;
|
|
2431 |
default:
|
|
2432 |
break;
|
|
2433 |
}
|
|
2434 |
}
|
|
2435 |
|
|
2436 |
}
|
|
2437 |
|
|
2438 |
// -----------------------------------------------------------------------------
|
|
2439 |
// CAspSettingDialog::HandleActiveCallL (from MAspActiveCallerObserver)
|
|
2440 |
//
|
|
2441 |
// -----------------------------------------------------------------------------
|
|
2442 |
//
|
|
2443 |
void CAspSettingDialog::HandleActiveCallL(TInt /*aCallId*/)
|
|
2444 |
{
|
|
2445 |
}
|
|
2446 |
|
|
2447 |
|
|
2448 |
// -----------------------------------------------------------------------------
|
|
2449 |
// CAspSettingDialog::SetCurrentIndex
|
|
2450 |
//
|
|
2451 |
// -----------------------------------------------------------------------------
|
|
2452 |
//
|
|
2453 |
void CAspSettingDialog::SetCurrentIndex()
|
|
2454 |
{
|
|
2455 |
TInt count = ListBox()->Model()->NumberOfItems();
|
|
2456 |
|
|
2457 |
if (count == 0)
|
|
2458 |
{
|
|
2459 |
iCurrentListBoxIndex = KErrNotFound; // empty list
|
|
2460 |
}
|
|
2461 |
else
|
|
2462 |
{
|
|
2463 |
iCurrentListBoxIndex = ListBox()->CurrentItemIndex();
|
|
2464 |
}
|
|
2465 |
}
|
|
2466 |
|
|
2467 |
|
|
2468 |
// -----------------------------------------------------------------------------
|
|
2469 |
// CAspSettingDialog::CurrentIndex
|
|
2470 |
//
|
|
2471 |
// -----------------------------------------------------------------------------
|
|
2472 |
//
|
|
2473 |
TInt CAspSettingDialog::CurrentIndex()
|
|
2474 |
{
|
|
2475 |
TInt count = ListBox()->Model()->NumberOfItems();
|
|
2476 |
|
|
2477 |
if (count == 0)
|
|
2478 |
{
|
|
2479 |
iCurrentListBoxIndex = KErrNotFound;
|
|
2480 |
}
|
|
2481 |
else if (iCurrentListBoxIndex >= count)
|
|
2482 |
{
|
|
2483 |
iCurrentListBoxIndex = count-1; // last listbox item
|
|
2484 |
}
|
|
2485 |
else if (iCurrentListBoxIndex < 0)
|
|
2486 |
{
|
|
2487 |
iCurrentListBoxIndex = 0; // first listbox item
|
|
2488 |
}
|
|
2489 |
|
|
2490 |
return iCurrentListBoxIndex;
|
|
2491 |
}
|
|
2492 |
|
|
2493 |
|
|
2494 |
// -----------------------------------------------------------------------------
|
|
2495 |
// CAspSettingDialog::ShowCurrentProfileInfoL
|
|
2496 |
//
|
|
2497 |
// -----------------------------------------------------------------------------
|
|
2498 |
//
|
|
2499 |
void CAspSettingDialog::ShowCurrentProfileInfoL()
|
|
2500 |
{
|
|
2501 |
TAspProfileItem& item = CurrentProfileL();
|
|
2502 |
TBuf<KBufSize> buf;
|
|
2503 |
iBearerHandler->GetBearerName(buf, item.iBearer);
|
|
2504 |
HBufC* hBuf = CAspResHandler::ReadProfileInfoTextLC(item.iProfileName, buf);
|
|
2505 |
ShowPopupNoteL(hBuf->Des());
|
|
2506 |
CleanupStack::PopAndDestroy(hBuf);
|
|
2507 |
}
|
|
2508 |
|
|
2509 |
|
|
2510 |
// -----------------------------------------------------------------------------
|
|
2511 |
// CAspSettingDialog::ShowCurrentProfileInfo
|
|
2512 |
//
|
|
2513 |
// -----------------------------------------------------------------------------
|
|
2514 |
//
|
|
2515 |
void CAspSettingDialog::ShowCurrentProfileInfo()
|
|
2516 |
{
|
|
2517 |
TRAP_IGNORE(ShowCurrentProfileInfoL());
|
|
2518 |
}
|
|
2519 |
|
|
2520 |
|
|
2521 |
// -----------------------------------------------------------------------------
|
|
2522 |
// CAspSettingDialog::ShowAutoSyncProfileInfoL
|
|
2523 |
//
|
|
2524 |
// -----------------------------------------------------------------------------
|
|
2525 |
//
|
|
2526 |
TBool CAspSettingDialog::ShowAutoSyncProfileInfo()
|
|
2527 |
{
|
|
2528 |
TBool ret = EFalse;
|
|
2529 |
|
|
2530 |
TRAPD(err, ret = ShowAutoSyncProfileInfoL());
|
|
2531 |
|
|
2532 |
#ifdef RD_DSUI_TIMEDSYNC
|
|
2533 |
UpdateTabsL();
|
|
2534 |
#endif
|
|
2535 |
|
|
2536 |
if (err != KErrNone)
|
|
2537 |
{
|
|
2538 |
return EFalse;
|
|
2539 |
}
|
|
2540 |
return ret;
|
|
2541 |
}
|
|
2542 |
|
|
2543 |
// -----------------------------------------------------------------------------
|
|
2544 |
// CAspSettingDialog::ShowAutoSyncProfileInfoL
|
|
2545 |
//
|
|
2546 |
// -----------------------------------------------------------------------------
|
|
2547 |
//
|
|
2548 |
TBool CAspSettingDialog::ShowAutoSyncProfileInfoL()
|
|
2549 |
{
|
|
2550 |
CAspSchedule* schedule = CAspSchedule::NewLC();
|
|
2551 |
|
|
2552 |
if (!schedule->CanSynchronizeL())
|
|
2553 |
{
|
|
2554 |
CleanupStack::PopAndDestroy(schedule);
|
|
2555 |
return EFalse;
|
|
2556 |
}
|
|
2557 |
|
|
2558 |
TInt autoSyncError = schedule->Error();
|
|
2559 |
if (autoSyncError != KErrNone)
|
|
2560 |
{
|
|
2561 |
|
|
2562 |
TInt profileId = schedule->ProfileId();
|
|
2563 |
TInt asProfileId = schedule->AutoSyncProfileId();
|
|
2564 |
TAspParam param(iApplicationId, iSyncSession);
|
|
2565 |
CAspProfile* asProfile = CAspProfile::NewLC(param);
|
|
2566 |
asProfile->OpenL(asProfileId, CAspProfile::EOpenRead, CAspProfile::EAllProperties);
|
|
2567 |
CAspProfile* profile = CAspProfile::NewLC(param);
|
|
2568 |
profile->OpenL(profileId, CAspProfile::EOpenRead, CAspProfile::EAllProperties);
|
|
2569 |
|
|
2570 |
//display auto sync error query only if profile hasn't been manually synced after last auto sync
|
|
2571 |
if (asProfile->LastSync() >= profile->LastSync())
|
|
2572 |
{
|
|
2573 |
if (autoSyncError == CAspAutoSyncHandler::EOtherSyncRunning)
|
|
2574 |
{
|
|
2575 |
HBufC* hBuf = CAspResHandler::ReadLC(R_ASP_MANUAL_SYNC_OVERRIDE);
|
|
2576 |
_LIT(KEmpty, " ");
|
|
2577 |
TDialogUtil::ShowMessageQueryL(KEmpty, hBuf->Des());
|
|
2578 |
CleanupStack::PopAndDestroy(hBuf);
|
|
2579 |
}
|
|
2580 |
else
|
|
2581 |
{
|
|
2582 |
HBufC* hBuf = CAspResHandler::ReadLC(R_ASP_POPUP_AUTO_SYNC_ERROR);
|
|
2583 |
_LIT(KNewLine ,"\n");
|
|
2584 |
TBuf<KBufSize> buf(hBuf->Des());
|
|
2585 |
buf.Append(KNewLine);
|
|
2586 |
CAspResHandler::ReadL(iBuf, R_ASP_MAIN_AUTO_ERROR_LOG_LINK);
|
|
2587 |
buf.Append(iBuf);
|
|
2588 |
CleanupStack::PopAndDestroy(hBuf);
|
|
2589 |
hBuf = HBufC::NewLC(buf.Size());
|
|
2590 |
TPtr ptr(hBuf->Des());
|
|
2591 |
ptr = buf;
|
|
2592 |
|
|
2593 |
TDialogUtil::ShowAutoSyncMessageQueryL(hBuf->Des());
|
|
2594 |
CleanupStack::PopAndDestroy(hBuf);
|
|
2595 |
}
|
|
2596 |
|
|
2597 |
schedule->SetError(KErrNone);
|
|
2598 |
schedule->SaveL();
|
|
2599 |
|
|
2600 |
CleanupStack::PopAndDestroy(profile);
|
|
2601 |
CleanupStack::PopAndDestroy(asProfile);
|
|
2602 |
CleanupStack::PopAndDestroy(schedule);
|
|
2603 |
return ETrue;
|
|
2604 |
}
|
|
2605 |
|
|
2606 |
CleanupStack::PopAndDestroy(profile);
|
|
2607 |
CleanupStack::PopAndDestroy(asProfile);
|
|
2608 |
|
|
2609 |
schedule->SetError(KErrNone);
|
|
2610 |
schedule->SaveL();
|
|
2611 |
}
|
|
2612 |
|
|
2613 |
|
|
2614 |
TTime nextSync;
|
|
2615 |
schedule->GetStartTimeL(nextSync ,ETrue);
|
|
2616 |
|
|
2617 |
TInt profileIndex = iProfileList->ListIndex(schedule->ProfileId());
|
|
2618 |
TAspProfileItem& item = iProfileList->Item(profileIndex);
|
|
2619 |
|
|
2620 |
HBufC* hBuf1 = CAspResHandler::ReadAutoSyncInfoTextLC( item.iProfileName, nextSync);
|
|
2621 |
|
|
2622 |
TDialogUtil::ShowInformationNoteL(hBuf1->Des());
|
|
2623 |
CleanupStack::PopAndDestroy(hBuf1);
|
|
2624 |
CleanupStack::PopAndDestroy(schedule);
|
|
2625 |
return ETrue;
|
|
2626 |
}
|
|
2627 |
|
|
2628 |
|
|
2629 |
// -----------------------------------------------------------------------------
|
|
2630 |
// CAspSettingDialog::ShowPopupNote
|
|
2631 |
//
|
|
2632 |
// -----------------------------------------------------------------------------
|
|
2633 |
//
|
|
2634 |
void CAspSettingDialog::ShowPopupNoteL(const TDesC& aText)
|
|
2635 |
{
|
|
2636 |
iPopupNote->SetTextL(aText);
|
|
2637 |
iPopupNote->SetTimePopupInView(KSettingDialogPopupDisplayTime);
|
|
2638 |
iPopupNote->ShowInfoPopupNote();
|
|
2639 |
}
|
|
2640 |
|
|
2641 |
|
|
2642 |
// -----------------------------------------------------------------------------
|
|
2643 |
// CAspSettingDialog::Listbox
|
|
2644 |
//
|
|
2645 |
// -----------------------------------------------------------------------------
|
|
2646 |
//
|
|
2647 |
CAknDoubleLargeStyleListBox* CAspSettingDialog::ListBox()
|
|
2648 |
{
|
|
2649 |
__ASSERT_DEBUG(iSettingListBox, TUtil::Panic(KErrGeneral));
|
|
2650 |
|
|
2651 |
return iSettingListBox;
|
|
2652 |
}
|
|
2653 |
|
|
2654 |
|
|
2655 |
// -----------------------------------------------------------------------------
|
|
2656 |
// CAspSettingDialog::SyncRunning
|
|
2657 |
//
|
|
2658 |
// -----------------------------------------------------------------------------
|
|
2659 |
//
|
|
2660 |
TBool CAspSettingDialog::SyncRunning()
|
|
2661 |
{
|
|
2662 |
if (!iSyncHandler)
|
|
2663 |
{
|
|
2664 |
return EFalse;
|
|
2665 |
}
|
|
2666 |
|
|
2667 |
if (iSyncHandler->SyncRunning())
|
|
2668 |
{
|
|
2669 |
return ETrue;
|
|
2670 |
}
|
|
2671 |
|
|
2672 |
return EFalse;
|
|
2673 |
}
|
|
2674 |
|
|
2675 |
|
|
2676 |
// -----------------------------------------------------------------------------
|
|
2677 |
// CAspSettingDialog::UpdateCbaL
|
|
2678 |
//
|
|
2679 |
// -----------------------------------------------------------------------------
|
|
2680 |
//
|
|
2681 |
void CAspSettingDialog::UpdateCbaL(TInt aResourceId)
|
|
2682 |
{
|
|
2683 |
CEikButtonGroupContainer& cba = ButtonGroupContainer();
|
|
2684 |
cba.SetCommandSetL(aResourceId);
|
|
2685 |
cba.DrawDeferred();
|
|
2686 |
}
|
|
2687 |
|
|
2688 |
|
|
2689 |
// ----------------------------------------------------------------------------
|
|
2690 |
// CAspSettingDialog::CancelCheckboxEvent
|
|
2691 |
//
|
|
2692 |
// ----------------------------------------------------------------------------
|
|
2693 |
//
|
|
2694 |
void CAspSettingDialog::CancelCheckboxEventL()
|
|
2695 |
{
|
|
2696 |
CListBoxView* view = iSettingListBox->View();
|
|
2697 |
|
|
2698 |
TInt index = view->CurrentItemIndex();
|
|
2699 |
TBool selected = view->ItemIsSelected(index);
|
|
2700 |
if (selected)
|
|
2701 |
{
|
|
2702 |
view->DeselectItem(index);
|
|
2703 |
}
|
|
2704 |
else
|
|
2705 |
{
|
|
2706 |
view->SelectItemL(index);
|
|
2707 |
}
|
|
2708 |
|
|
2709 |
iSettingListBox->SetCurrentItemIndex(index);
|
|
2710 |
//view->SetCurrentItemIndex(index);
|
|
2711 |
}
|
|
2712 |
|
|
2713 |
|
|
2714 |
// ----------------------------------------------------------------------------
|
|
2715 |
// CAspSettingDialog::CancelCheckboxEvent
|
|
2716 |
//
|
|
2717 |
// ----------------------------------------------------------------------------
|
|
2718 |
//
|
|
2719 |
void CAspSettingDialog::CancelCheckboxEvent()
|
|
2720 |
{
|
|
2721 |
TRAP_IGNORE(CancelCheckboxEventL());
|
|
2722 |
}
|
|
2723 |
|
|
2724 |
|
|
2725 |
// ----------------------------------------------------------------------------
|
|
2726 |
// CAspSettingDialog::CheckEmailSelection
|
|
2727 |
//
|
|
2728 |
// ----------------------------------------------------------------------------
|
|
2729 |
//
|
|
2730 |
TBool CAspSettingDialog::CheckEmailSelection()
|
|
2731 |
{
|
|
2732 |
TBool ret = ETrue;
|
|
2733 |
|
|
2734 |
TRAPD(err, ret = CheckEmailSelectionL());
|
|
2735 |
|
|
2736 |
if (err != KErrNone)
|
|
2737 |
{
|
|
2738 |
return ETrue;
|
|
2739 |
}
|
|
2740 |
|
|
2741 |
return ret;
|
|
2742 |
}
|
|
2743 |
|
|
2744 |
|
|
2745 |
// ----------------------------------------------------------------------------
|
|
2746 |
// CAspSettingDialog::CheckEmailSelectionL
|
|
2747 |
//
|
|
2748 |
// ----------------------------------------------------------------------------
|
|
2749 |
//
|
|
2750 |
TBool CAspSettingDialog::CheckEmailSelectionL()
|
|
2751 |
{
|
|
2752 |
CListBoxView* view = iSettingListBox->View();
|
|
2753 |
|
|
2754 |
TInt index = view->CurrentItemIndex();
|
|
2755 |
TAspProviderItem& item = iContentList->ProviderItem(index);
|
|
2756 |
TBool selected = view->ItemIsSelected(index);
|
|
2757 |
|
|
2758 |
if (item.iDataProviderId != KUidNSmlAdapterEMail.iUid)
|
|
2759 |
{
|
|
2760 |
return ETrue;
|
|
2761 |
}
|
|
2762 |
|
|
2763 |
if (!selected)
|
|
2764 |
{
|
|
2765 |
return ETrue;
|
|
2766 |
}
|
|
2767 |
|
|
2768 |
iContentList->UpdateDataProviderL(item.iDataProviderId);
|
|
2769 |
if (!item.iHasDefaultDataStore)
|
|
2770 |
{
|
|
2771 |
CancelCheckboxEvent();
|
|
2772 |
TDialogUtil::ShowErrorNoteL(R_ASP_NO_MAILBOXES);
|
|
2773 |
return EFalse;
|
|
2774 |
}
|
|
2775 |
|
|
2776 |
if (HasCurrentProfile())
|
|
2777 |
{
|
|
2778 |
TAspParam param(iApplicationId, iSyncSession);
|
|
2779 |
CAspProfile* profile = CAspProfile::NewLC(param);
|
|
2780 |
profile->OpenL(iCurrentProfileId, CAspProfile::EOpenRead, CAspProfile::EAllProperties);
|
|
2781 |
|
|
2782 |
TInt num = profile->ProtocolVersion();
|
|
2783 |
CleanupStack::PopAndDestroy(profile);
|
|
2784 |
|
|
2785 |
}
|
|
2786 |
|
|
2787 |
|
|
2788 |
|
|
2789 |
return ETrue;
|
|
2790 |
}
|
|
2791 |
|
|
2792 |
// ----------------------------------------------------------------------------
|
|
2793 |
// CAspSettingDialog::IsProfileLockedL
|
|
2794 |
// Checks if a particular profile is already opened
|
|
2795 |
// ----------------------------------------------------------------------------
|
|
2796 |
//
|
|
2797 |
TBool CAspSettingDialog::IsProfileLockedL(TInt aProfileId)
|
|
2798 |
{
|
|
2799 |
|
|
2800 |
TAspParam param(iApplicationId, iSyncSession);
|
|
2801 |
CAspProfile* profile = CAspProfile::NewLC(param);
|
|
2802 |
|
|
2803 |
|
|
2804 |
TRAPD(err, profile->OpenL(aProfileId, CAspProfile::EOpenReadWrite,
|
|
2805 |
CAspProfile::EAllProperties));
|
|
2806 |
|
|
2807 |
|
|
2808 |
if (err == KErrLocked)
|
|
2809 |
{
|
|
2810 |
CleanupStack::PopAndDestroy(profile);
|
|
2811 |
return ETrue;
|
|
2812 |
}
|
|
2813 |
else
|
|
2814 |
{
|
|
2815 |
CleanupStack::PopAndDestroy(profile);
|
|
2816 |
return EFalse;
|
|
2817 |
}
|
|
2818 |
|
|
2819 |
}
|
|
2820 |
// ----------------------------------------------------------------------------
|
|
2821 |
// CAspSettingDialog::UpdateMiddleSoftKeyLabelL
|
|
2822 |
// Update the MSK Label
|
|
2823 |
// ----------------------------------------------------------------------------
|
|
2824 |
//
|
|
2825 |
void CAspSettingDialog::UpdateMiddleSoftKeyLabelL(TInt aCommandId,TInt aResourceId)
|
|
2826 |
{
|
|
2827 |
ButtonGroupContainer().RemoveCommandFromStack(KMSKControlId,aCommandId );
|
|
2828 |
HBufC* middleSKText = StringLoader::LoadLC( aResourceId );
|
|
2829 |
|
|
2830 |
ButtonGroupContainer().AddCommandToStackL(
|
|
2831 |
KMSKControlId,
|
|
2832 |
aCommandId,
|
|
2833 |
*middleSKText );
|
|
2834 |
CleanupStack::PopAndDestroy( middleSKText );
|
|
2835 |
}
|
|
2836 |
|
|
2837 |
#ifdef _DEBUG
|
|
2838 |
|
|
2839 |
|
|
2840 |
// -----------------------------------------------------------------------------
|
|
2841 |
// LogDatabaseEvent
|
|
2842 |
//
|
|
2843 |
// -----------------------------------------------------------------------------
|
|
2844 |
//
|
|
2845 |
void CAspSettingDialog::LogDatabaseEvent(TAspDbEvent aEvent)
|
|
2846 |
{
|
|
2847 |
TBuf<KBufSize> buf;
|
|
2848 |
|
|
2849 |
if (aEvent.iType == CAspDbNotifier::EClose)
|
|
2850 |
{
|
|
2851 |
FLOG( _L("### EClose: close setting dialog ###") );
|
|
2852 |
}
|
|
2853 |
else if (aEvent.iType == CAspDbNotifier::EUpdate)
|
|
2854 |
{
|
|
2855 |
TInt index = iProfileList->ListIndex(aEvent.iProfileId);
|
|
2856 |
if (index != KErrNotFound)
|
|
2857 |
{
|
|
2858 |
TAspProfileItem& item = iProfileList->Item(index);
|
|
2859 |
FTRACE( RDebug::Print(_L("EUpdate: %S (%d)"), &item.iProfileName, aEvent.iProfileId) );
|
|
2860 |
|
|
2861 |
buf.Format(_L("EUpdate: %S"), &item.iProfileName);
|
|
2862 |
TUtil::Print(buf);
|
|
2863 |
}
|
|
2864 |
else
|
|
2865 |
{
|
|
2866 |
FTRACE( RDebug::Print(_L("### EUpdate: profile not found (%d) ###"), aEvent.iProfileId) );
|
|
2867 |
TUtil::Print(_L("EUpdate: profile not found"));
|
|
2868 |
}
|
|
2869 |
}
|
|
2870 |
else if (aEvent.iType == CAspDbNotifier::EDelete)
|
|
2871 |
{
|
|
2872 |
TInt index = iProfileList->ListIndex(aEvent.iProfileId);
|
|
2873 |
if (index != KErrNotFound)
|
|
2874 |
{
|
|
2875 |
TAspProfileItem& item = iProfileList->Item(index);
|
|
2876 |
FTRACE( RDebug::Print(_L("EDelete: %S (%d)"), &item.iProfileName, aEvent.iProfileId) );
|
|
2877 |
|
|
2878 |
buf.Format(_L("EDelete: %S"), &item.iProfileName);
|
|
2879 |
TUtil::Print(buf);
|
|
2880 |
}
|
|
2881 |
else
|
|
2882 |
{
|
|
2883 |
FTRACE( RDebug::Print(_L("EDelete: profile not found (%d)"), aEvent.iProfileId) );
|
|
2884 |
TUtil::Print(_L("EDelete: profile not found"));
|
|
2885 |
}
|
|
2886 |
|
|
2887 |
}
|
|
2888 |
else if (aEvent.iType == CAspDbNotifier::EUpdateAll)
|
|
2889 |
{
|
|
2890 |
FLOG( _L("EUpdateAll: read all profiles") );
|
|
2891 |
TUtil::Print(_L("EUpdateAll: read all profiles"));
|
|
2892 |
}
|
|
2893 |
}
|
|
2894 |
|
|
2895 |
|
|
2896 |
// -----------------------------------------------------------------------------
|
|
2897 |
// TestL
|
|
2898 |
//
|
|
2899 |
// -----------------------------------------------------------------------------
|
|
2900 |
//
|
|
2901 |
void CAspSettingDialog::TestL()
|
|
2902 |
{
|
|
2903 |
TAspParam param(iApplicationId, iSyncSession);
|
|
2904 |
CAspProfile* profile = CAspProfile::NewLC(param);
|
|
2905 |
profile->OpenL(iCurrentProfileId, CAspProfile::EOpenRead, CAspProfile::EAllProperties);
|
|
2906 |
|
|
2907 |
TBuf<128> buf; TBuf<128> buf2;
|
|
2908 |
profile->GetPassword(buf);
|
|
2909 |
TInt len = buf.Length();
|
|
2910 |
buf2.Format(_L("len = %d text = %S"), len, &buf);
|
|
2911 |
TDialogUtil::ShowMessageQueryL(_L("huu"), buf2);
|
|
2912 |
CleanupStack::PopAndDestroy(profile);
|
|
2913 |
|
|
2914 |
/*
|
|
2915 |
CListBoxView* view = iSettingListBox->View();
|
|
2916 |
const CListBoxView::CSelectionIndexArray* arr = view->SelectionIndexes();
|
|
2917 |
TBuf<128> buf; TBuf<128> buf2;
|
|
2918 |
TInt count = arr->Count();
|
|
2919 |
for (TInt i=0; i<count; i++)
|
|
2920 |
{
|
|
2921 |
buf2.Format(_L("%d "), (*arr)[i]);
|
|
2922 |
buf.Append(buf2);
|
|
2923 |
}
|
|
2924 |
TDialogUtil::ShowMessageQueryL(_L("huu"), buf);
|
|
2925 |
*/
|
|
2926 |
|
|
2927 |
/*
|
|
2928 |
HBufC* hBuf = iResHandler->ReadProgressTextLC(_L("qwerty ggggggggggggggggggggggg"), CAspState::EPhaseSending);
|
|
2929 |
TDialogUtil::ShowMessageQueryL(_L("huu"), hBuf->Des());
|
|
2930 |
CleanupStack::PopAndDestroy(hBuf);
|
|
2931 |
|
|
2932 |
hBuf = iResHandler->ReadProgressTextLC(_L("qwerty ggggggggggggggggggggggg"), CAspState::EPhaseReceiving);
|
|
2933 |
TDialogUtil::ShowMessageQueryL(_L("huu"), hBuf->Des());
|
|
2934 |
CleanupStack::PopAndDestroy(hBuf);
|
|
2935 |
|
|
2936 |
hBuf = iResHandler->ReadProgressTextLC(_L("qwerty ggggggggggggggggggggggg"), 34);
|
|
2937 |
TDialogUtil::ShowMessageQueryL(_L("huu"), hBuf->Des());
|
|
2938 |
CleanupStack::PopAndDestroy(hBuf);
|
|
2939 |
*/
|
|
2940 |
}
|
|
2941 |
|
|
2942 |
|
|
2943 |
#endif
|
|
2944 |
|
|
2945 |
|
|
2946 |
|
|
2947 |
|
|
2948 |
|
|
2949 |
// End of File
|