64
|
1 |
/*
|
|
2 |
* Copyright (c) 2007 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: This file implements class CIpsSetUiBaseDialog.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
#include "emailtrace.h"
|
|
21 |
#include <akntitle.h> // CAknTitlePane
|
|
22 |
#include <AknQueryDialog.h> // CAknQueryDialog
|
|
23 |
#include <aknradiobuttonsettingpage.h> // CAknRadioButtonSettingPage
|
|
24 |
#include <aknpasswordsettingpage.h> // CAknPasswordSettingPage
|
|
25 |
#include <akntextsettingpage.h> // CAknTextSettingPage
|
|
26 |
#include <akncheckboxsettingpage.h> // CAknCheckBoxSettingPage
|
|
27 |
#include <ipssossettings.rsg>
|
|
28 |
#include <StringLoader.h>
|
|
29 |
//<cmail> checking if MSK is enabled in layout (Layout_Meta_Data::IsMSKEnabled)
|
|
30 |
#include <layoutmetadata.cdl.h>
|
|
31 |
//</cmail>
|
|
32 |
|
|
33 |
#include "ipssetutilsexception.h"
|
|
34 |
#include "ipssetuiapprover.h"
|
|
35 |
#include "ipssetuiitembase.h" // CIpsSetUiItem
|
|
36 |
#include "ipssetuiitemvalue.h" // CIpsSetUiItemValue
|
|
37 |
#include "ipssetuiitemtext.h" // CIpsSetUiItemEditText
|
|
38 |
#include "ipssetuiitemlink.h" // CIpsSetUiItemLink
|
|
39 |
#include "ipssetuiitemextlink.h" // CIpsSetUiItemExtLink
|
|
40 |
#include "ipssetuictrlsoftkey.h"
|
|
41 |
#include "ipssetdata.h" // CIpsSetData::EAllDay, KIpsSetDataTimeDefault
|
|
42 |
#include "ipssetuibasedialog.h" // CIpsSetUiBaseDialog
|
|
43 |
#include "ipssetutilspageids.hrh"
|
|
44 |
|
|
45 |
// Prevent any looping problems by defining maximum amount of editor openings
|
|
46 |
const TInt KIpsSetUiMaxEditors = 100;
|
|
47 |
|
|
48 |
|
|
49 |
|
|
50 |
// ============================ MEMBER FUNCTIONS ==============================
|
|
51 |
|
|
52 |
// ----------------------------------------------------------------------------
|
|
53 |
// CIpsSetUiBaseDialog::CIpsSetUiBaseDialog()
|
|
54 |
// ----------------------------------------------------------------------------
|
|
55 |
//
|
|
56 |
CIpsSetUiBaseDialog::CIpsSetUiBaseDialog(
|
|
57 |
CEikFormattedCellListBox& aListBox,
|
|
58 |
CAknTitlePane& aTitlePane )
|
|
59 |
:
|
|
60 |
CIpsSetUiBaseArray(),
|
|
61 |
iListBox( aListBox ),
|
|
62 |
iTitlePane( aTitlePane ),
|
|
63 |
iSoftkeys( NULL ),
|
|
64 |
iSettingPage( NULL ),
|
|
65 |
iSettingPageResources( NULL ),
|
|
66 |
iSettingsPageArray( NULL ),
|
|
67 |
iScrollBar( NULL ),
|
|
68 |
iOldTitleText( NULL ),
|
|
69 |
iQueryDialog( NULL ),
|
|
70 |
iSettingsLastItemIndex( NULL ),
|
|
71 |
iSettingValue( KErrNotFound ),
|
|
72 |
iSettingText( NULL ),
|
|
73 |
iNewPassword( NULL ),
|
|
74 |
iOldPassword( NULL ),
|
|
75 |
iButtonArray( NULL ),
|
|
76 |
iCheckboxArray( NULL )
|
|
77 |
{
|
|
78 |
FUNC_LOG;
|
|
79 |
}
|
|
80 |
|
|
81 |
// ----------------------------------------------------------------------------
|
|
82 |
// CIpsSetUiBaseDialog::~CIpsSetUiBaseDialog()
|
|
83 |
// ----------------------------------------------------------------------------
|
|
84 |
//
|
|
85 |
CIpsSetUiBaseDialog::~CIpsSetUiBaseDialog()
|
|
86 |
{
|
|
87 |
FUNC_LOG;
|
|
88 |
// Remove the scrollbar from listbox
|
|
89 |
iListBox.SetScrollBarFrame( NULL, CEikListBox::EOwnedExternally );
|
|
90 |
|
|
91 |
if ( iSoftkeys )
|
|
92 |
{
|
|
93 |
iSoftkeys->SetObserver( EFalse, EFalse, EFalse, *this );
|
|
94 |
}
|
|
95 |
delete iSoftkeys;
|
|
96 |
iSoftkeys = NULL;
|
|
97 |
|
|
98 |
delete iSettingPageResources;
|
|
99 |
iSettingPageResources = NULL;
|
|
100 |
|
|
101 |
if ( iSettingsLastItemIndex )
|
|
102 |
{
|
|
103 |
iSettingsLastItemIndex->Reset();
|
|
104 |
}
|
|
105 |
|
|
106 |
delete iSettingsLastItemIndex;
|
|
107 |
iSettingsLastItemIndex = NULL;
|
|
108 |
|
|
109 |
if ( iCheckboxArray )
|
|
110 |
{
|
|
111 |
iCheckboxArray->ResetAndDestroy();
|
|
112 |
}
|
|
113 |
|
|
114 |
if ( iSettingsPageArray )
|
|
115 |
{
|
|
116 |
iSettingsPageArray->Reset();
|
|
117 |
}
|
|
118 |
|
|
119 |
if ( iBackupArray )
|
|
120 |
{
|
|
121 |
iBackupArray->ResetAndDestroy();
|
|
122 |
}
|
|
123 |
|
|
124 |
delete iBackupArray;
|
|
125 |
iBackupArray = NULL;
|
|
126 |
delete iSettingsPageArray;
|
|
127 |
iSettingsPageArray = NULL;
|
|
128 |
delete iCheckboxArray;
|
|
129 |
iCheckboxArray = NULL;
|
|
130 |
delete iOldTitleText;
|
|
131 |
iOldTitleText = NULL;
|
|
132 |
delete iQueryDialog;
|
|
133 |
iQueryDialog = NULL;
|
|
134 |
delete iSettingPage;
|
|
135 |
iSettingPage = NULL;
|
|
136 |
delete iButtonArray;
|
|
137 |
iButtonArray = NULL;
|
|
138 |
iSettingText.Close();
|
|
139 |
delete iNewPassword;
|
|
140 |
iNewPassword = NULL;
|
|
141 |
delete iOldPassword;
|
|
142 |
iOldPassword = NULL;
|
|
143 |
iScrollBar = NULL;
|
|
144 |
delete iItemApprover;
|
|
145 |
iItemApprover = NULL;
|
|
146 |
delete iMainMBoxMenuTitleText;
|
|
147 |
iMainMBoxMenuTitleText = NULL;
|
|
148 |
}
|
|
149 |
|
|
150 |
// ----------------------------------------------------------------------------
|
|
151 |
// CIpsSetUiBaseDialog::ConstructL()
|
|
152 |
// ----------------------------------------------------------------------------
|
|
153 |
//
|
|
154 |
void CIpsSetUiBaseDialog::ConstructL(
|
|
155 |
CEikButtonGroupContainer& aSoftkeys,
|
|
156 |
const TInt aResource,
|
|
157 |
const TBool aUpdateMSK )
|
|
158 |
{
|
|
159 |
FUNC_LOG;
|
|
160 |
BaseConstructL( aResource );
|
|
161 |
|
|
162 |
// Set as observer
|
|
163 |
iListBox.SetListBoxObserver( this );
|
|
164 |
iListBox.View()->SetListEmptyTextL( KNullDesC );
|
|
165 |
|
|
166 |
// Get scrollbar
|
|
167 |
iScrollBar = iListBox.CreateScrollBarFrameL( ETrue );
|
|
168 |
iScrollBar->SetScrollBarVisibilityL(
|
|
169 |
CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto );
|
|
170 |
|
|
171 |
// Create array
|
|
172 |
CTextListBoxModel* model = iListBox.Model();
|
|
173 |
model->SetItemTextArray( this );
|
|
174 |
model->SetOwnershipType( ELbmDoesNotOwnItemArray );
|
|
175 |
|
|
176 |
// Set this dialog for button listening
|
|
177 |
iSoftkeys = CIpsSetUiCtrlSoftkey::NewL( aSoftkeys );
|
|
178 |
iSoftkeys->SetObserver( ETrue, ETrue, ETrue, *this );
|
|
179 |
iSoftkeys->SetMSKLabelling( aUpdateMSK );
|
|
180 |
iSoftkeys->UpdateMiddleSoftkeyLabelL(
|
|
181 |
GetResourceForMiddlekey(), EAknSoftkeyOpen, this );
|
|
182 |
|
|
183 |
// Prepare setting page arrays
|
|
184 |
iSettingPageResources = CIpsSetUiCtrlPageResource::NewL();
|
|
185 |
iSettingsLastItemIndex =
|
|
186 |
new ( ELeave ) CIpsSetUiIntArray( KIpsSetUiArrayGranularity );
|
|
187 |
|
|
188 |
// Add array to store the backup items
|
|
189 |
iBackupArray = new ( ELeave ) CIpsSetUiBaseItemArray( KIpsSetUiArrayGranularity );
|
|
190 |
|
|
191 |
// Define setting pages in enumeration order
|
|
192 |
iSettingPageResources->CreateStackL( R_IPS_SET_DIALOG_LISTBOX );
|
|
193 |
iSettingPageResources->CreateStackL( R_IPS_SET_DIALOG_CHECKLISTBOX );
|
|
194 |
iSettingPageResources->CreateStackL( R_IPS_SET_DIALOG_TEXT );
|
|
195 |
iSettingPageResources->CreateStackL( R_IPS_SET_DIALOG_NUMBER );
|
|
196 |
iSettingPageResources->CreateStackL( R_IPS_SET_DIALOG_SC_NUMBER );
|
|
197 |
iSettingPageResources->CreateStackL( R_IPS_SET_DIALOG_PASSWORD );
|
|
198 |
iSettingPageResources->CreateStackL( NULL );
|
|
199 |
|
|
200 |
iItemApprover = CIpsSetUiApprover::NewL();
|
|
201 |
}
|
|
202 |
|
|
203 |
// ----------------------------------------------------------------------------
|
|
204 |
// CIpsSetUiBaseDialog::HandleListBoxEventL()
|
|
205 |
// ----------------------------------------------------------------------------
|
|
206 |
//
|
|
207 |
void CIpsSetUiBaseDialog::HandleListBoxEventL(
|
|
208 |
CEikListBox* /* aListBox */,
|
|
209 |
TListBoxEvent aEventType )
|
|
210 |
{
|
|
211 |
FUNC_LOG;
|
|
212 |
if( aEventType == EEventItemSingleClicked )
|
|
213 |
{
|
|
214 |
CIpsSetUiItem* base = CurrentItem();
|
|
215 |
OpenSettingPageL( *base );
|
|
216 |
}
|
|
217 |
}
|
|
218 |
|
|
219 |
// ----------------------------------------------------------------------------
|
|
220 |
// CIpsSetUiBaseDialog::OfferKeyEventL
|
|
221 |
// ----------------------------------------------------------------------------
|
|
222 |
//
|
|
223 |
TKeyResponse CIpsSetUiBaseDialog::OfferKeyEventL(
|
|
224 |
const TKeyEvent& /* aKeyEvent */,
|
|
225 |
TEventCode aType )
|
|
226 |
{
|
|
227 |
FUNC_LOG;
|
|
228 |
if ( aType == EEventKeyUp && iSoftkeys->MSKLabelling() )
|
|
229 |
{
|
|
230 |
iSoftkeys->UpdateMiddleSoftkeyLabelL(
|
|
231 |
GetResourceForMiddlekey(), EAknSoftkeyOpen, this );
|
|
232 |
}
|
|
233 |
|
|
234 |
return EKeyWasNotConsumed;
|
|
235 |
}
|
|
236 |
|
|
237 |
// ----------------------------------------------------------------------------
|
|
238 |
// CIpsSetUiBaseDialog::GetResourceForMiddlekey()
|
|
239 |
// ----------------------------------------------------------------------------
|
|
240 |
//
|
|
241 |
TInt CIpsSetUiBaseDialog::GetResourceForMiddlekey()
|
|
242 |
{
|
|
243 |
FUNC_LOG;
|
|
244 |
//<cmail> run-time MSK variation check (enabled in platform + in current layout)
|
|
245 |
TInt resource = 0;
|
|
246 |
if ( AknLayoutUtils::MSKEnabled() && Layout_Meta_Data::IsMSKEnabled() )
|
|
247 |
{
|
|
248 |
CIpsSetUiItem* item = CurrentItem();
|
|
249 |
IPS_ASSERT_DEBUG( item , KErrNotFound, EBaseDialog );
|
|
250 |
if ( item )
|
|
251 |
{
|
|
252 |
resource = ItemSubArrayCheck( *item ) ?
|
|
253 |
R_QTN_MSK_OPEN : R_QTN_MSK_CHANGE; // <cmail>
|
|
254 |
}
|
|
255 |
}
|
|
256 |
return resource;
|
|
257 |
//</cmail>
|
|
258 |
}
|
|
259 |
|
|
260 |
// ----------------------------------------------------------------------------
|
|
261 |
// CIpsSetUiBaseDialog::SetTitlePaneTextL()
|
|
262 |
// ----------------------------------------------------------------------------
|
|
263 |
//
|
|
264 |
void CIpsSetUiBaseDialog::SetMainMBoxMenuTitlePaneTextL(
|
|
265 |
const TDesC& aText,
|
|
266 |
const TBool aSaveCurrent )
|
|
267 |
{
|
|
268 |
FUNC_LOG;
|
|
269 |
// aText contains mailbox name
|
|
270 |
HBufC* titleText = StringLoader::LoadLC(
|
|
271 |
R_FSE_SETTINGS_LIST_MAILBOX_TITLE, aText );
|
|
272 |
|
|
273 |
if ( aSaveCurrent )
|
|
274 |
{
|
|
275 |
delete iOldTitleText;
|
|
276 |
iOldTitleText = NULL;
|
|
277 |
iOldTitleText = iTitlePane.Text()->Alloc();
|
|
278 |
delete iMainMBoxMenuTitleText;
|
|
279 |
iMainMBoxMenuTitleText = NULL;
|
|
280 |
iMainMBoxMenuTitleText = aText.AllocL();
|
|
281 |
}
|
|
282 |
|
|
283 |
iTitlePane.SetTextL( *titleText );
|
|
284 |
CleanupStack::PopAndDestroy( titleText );
|
|
285 |
titleText = NULL;
|
|
286 |
}
|
|
287 |
|
|
288 |
// ----------------------------------------------------------------------------
|
|
289 |
// CIpsSetUiBaseDialog::SetPreviousTitlePaneText()
|
|
290 |
// ----------------------------------------------------------------------------
|
|
291 |
//
|
|
292 |
void CIpsSetUiBaseDialog::SetSettingsMenuTitlePaneText(
|
|
293 |
const TBool aSaveCurrent )
|
|
294 |
{
|
|
295 |
FUNC_LOG;
|
|
296 |
TRAP_IGNORE( SetMainMBoxMenuTitlePaneTextL(
|
|
297 |
*iOldTitleText, aSaveCurrent ) );
|
|
298 |
}
|
|
299 |
|
|
300 |
/******************************************************************************
|
|
301 |
|
|
302 |
Settingpage opening
|
|
303 |
|
|
304 |
- Find out the item to be edited
|
|
305 |
- Send start editing event with the item
|
|
306 |
- Check the item type
|
|
307 |
- Check the resources
|
|
308 |
- If no resources available, ask them
|
|
309 |
- Start editing
|
|
310 |
- Send end editing event
|
|
311 |
|
|
312 |
******************************************************************************/
|
|
313 |
|
|
314 |
// ----------------------------------------------------------------------------
|
|
315 |
// CIpsSetUiBaseDialog::OpenSettingPageL()
|
|
316 |
// ----------------------------------------------------------------------------
|
|
317 |
//
|
|
318 |
TIpsSetUiPageResult CIpsSetUiBaseDialog::OpenSettingPageL(
|
|
319 |
const TInt aIndex )
|
|
320 |
{
|
|
321 |
FUNC_LOG;
|
|
322 |
// To open setting page, check if the Setting Page index is provided,
|
|
323 |
// if not get the current item index in array
|
|
324 |
TInt index = ( aIndex == KErrNotFound ) ?
|
|
325 |
iListBox.CurrentItemIndex() : aIndex;
|
|
326 |
|
|
327 |
// Search for the item and open it
|
|
328 |
return SettingPageOpenL( *GetItem( index ) );
|
|
329 |
}
|
|
330 |
|
|
331 |
// ----------------------------------------------------------------------------
|
|
332 |
// CIpsSetUiBaseDialog::OpenSettingPageL()
|
|
333 |
// ----------------------------------------------------------------------------
|
|
334 |
//
|
|
335 |
TIpsSetUiPageResult CIpsSetUiBaseDialog::OpenSettingPageL(
|
|
336 |
CIpsSetUiItem& aBaseItem )
|
|
337 |
{
|
|
338 |
FUNC_LOG;
|
|
339 |
return SettingPageOpenL( aBaseItem );
|
|
340 |
}
|
|
341 |
|
|
342 |
// ----------------------------------------------------------------------------
|
|
343 |
// CIpsSetUiBaseDialog::SettingPageOpenL()
|
|
344 |
//
|
|
345 |
// This function contains the main logic for the setting editor handling
|
|
346 |
// in the settings dialog. The setting editors are kept opening as long
|
|
347 |
// as the all the settings are gone through or the editor is dismissed.
|
|
348 |
// ----------------------------------------------------------------------------
|
|
349 |
//
|
|
350 |
TIpsSetUiPageResult CIpsSetUiBaseDialog::SettingPageOpenL(
|
|
351 |
CIpsSetUiItem& aBaseItem )
|
|
352 |
{
|
|
353 |
FUNC_LOG;
|
|
354 |
// Don't open the editor for read-only items
|
|
355 |
if ( aBaseItem.iItemFlags.Flag32( KIpsSetUiFlagReadOnly ) )
|
|
356 |
{
|
|
357 |
return EIpsSetUiPageResultReadOnly;
|
|
358 |
}
|
|
359 |
// Store current focused item for last item index array
|
|
360 |
iCurrentItemIndex = iListBox.CurrentItemIndex();
|
|
361 |
|
|
362 |
// Starting editing of the item, do not allow updating during editing
|
|
363 |
iArrayFlags.ClearFlag( EIpsSetUiArrayAllowRefresh );
|
|
364 |
|
|
365 |
// When starting to edit page, send event so that item can be prepared
|
|
366 |
// for the editing. In case of error, editing won't start
|
|
367 |
TIpsSetUiEventResult eventResult = EventItemEditStartsL( aBaseItem );
|
|
368 |
TIpsSetUiPageResult result;
|
|
369 |
|
|
370 |
if ( eventResult == EIpsSetUiPageEventResultApproved )
|
|
371 |
{
|
|
372 |
// Create the array if it doesn't exist yet
|
|
373 |
if ( !iSettingsPageArray )
|
|
374 |
{
|
|
375 |
iSettingsPageArray = new ( ELeave ) CIpsSetUiBaseItemArray(
|
|
376 |
KIpsSetUiArrayGranularity );
|
|
377 |
}
|
|
378 |
|
|
379 |
// Clear the array and add the editable item to array
|
|
380 |
CleanBackupArray();
|
|
381 |
iSettingsPageArray->Reset();
|
|
382 |
SetCurrentSettingsPageL( aBaseItem );
|
|
383 |
result = SettingsPageOpenCheckL();
|
|
384 |
|
|
385 |
do
|
|
386 |
{
|
|
387 |
if ( result == EIpsSetUiPageResultEditing )
|
|
388 |
{
|
|
389 |
// Open the setting page
|
|
390 |
result = SettingPageOpenEditorL();
|
|
391 |
|
|
392 |
// Do open check. Note that the result can be modified!
|
|
393 |
SettingsCheckNextEditorOpenL( result );
|
|
394 |
}
|
|
395 |
|
|
396 |
// Finish the editing of the item
|
|
397 |
SettingPageOpenFinishL();
|
|
398 |
}
|
|
399 |
while ( result == EIpsSetUiPageResultEditing );
|
|
400 |
}
|
|
401 |
else if ( eventResult == EIpsSetUiPageEventResultDisapproved )
|
|
402 |
{
|
|
403 |
result = EIpsSetUiPageResultOk;
|
|
404 |
}
|
|
405 |
else
|
|
406 |
{
|
|
407 |
result = EIpsSetUiPageResultEventCancel;
|
|
408 |
}
|
|
409 |
|
|
410 |
// Send item edit ends
|
|
411 |
EventItemEditEndsL( aBaseItem );
|
|
412 |
aBaseItem.iItemFlags.ClearFlag32( KIpsSetUiFlagOneTimeForceViewOpen );
|
|
413 |
iArrayFlags.SetFlag( EIpsSetUiArrayAllowRefresh );
|
|
414 |
|
|
415 |
// Update the listbox
|
|
416 |
Refresh();
|
|
417 |
|
|
418 |
return result;
|
|
419 |
}
|
|
420 |
|
|
421 |
// ----------------------------------------------------------------------------
|
|
422 |
// CIpsSetUiBaseDialog::EventPrepareSubArrayL()
|
|
423 |
// ----------------------------------------------------------------------------
|
|
424 |
//
|
|
425 |
TInt CIpsSetUiBaseDialog::EventPrepareSubArrayL(
|
|
426 |
CIpsSetUiItem& aBaseItem,
|
|
427 |
const TBool aForward )
|
|
428 |
{
|
|
429 |
FUNC_LOG;
|
|
430 |
// Check direction in array
|
|
431 |
UpdateTitlePaneTextL( GetLastResourceId( ) );
|
|
432 |
if ( aForward )
|
|
433 |
{
|
|
434 |
// Store the index and set to beginning
|
|
435 |
SetSettingsLastItemIndexL( iCurrentItemIndex );
|
|
436 |
iListBox.SetCurrentItemIndex( 0 );
|
|
437 |
}
|
|
438 |
// When going backwards
|
|
439 |
else
|
|
440 |
{
|
|
441 |
// Restore previous index
|
|
442 |
iListBox.SetCurrentItemIndex( SettingsLastItemIndex() );
|
|
443 |
}
|
|
444 |
|
|
445 |
return EventSubArrayChangeL( aBaseItem );
|
|
446 |
}
|
|
447 |
|
|
448 |
// ----------------------------------------------------------------------------
|
|
449 |
// CIpsSetUiBaseDialog::UpdateTitlePaneTextL()
|
|
450 |
// ----------------------------------------------------------------------------
|
|
451 |
//
|
|
452 |
void CIpsSetUiBaseDialog::UpdateTitlePaneTextL( TInt aId )
|
|
453 |
{
|
|
454 |
FUNC_LOG;
|
|
455 |
HBufC* titleText = NULL;
|
|
456 |
switch ( aId )
|
|
457 |
{
|
|
458 |
case R_IPS_SET_MENU_MAILBOX_SETTINGS:
|
|
459 |
titleText = StringLoader::LoadLC( R_FSE_SETTINGS_TITLE_MAILBOX );
|
|
460 |
iTitlePane.SetTextL( *titleText );
|
|
461 |
break;
|
|
462 |
case R_IPS_SET_MENU_ADVANCED_MAILBOX_SETTINGS:
|
|
463 |
titleText = StringLoader::LoadLC(
|
|
464 |
R_FSE_SETTINGS_ADVANCED_MAILBOX_SETTINGS );
|
|
465 |
iTitlePane.SetTextL( *titleText );
|
|
466 |
break;
|
|
467 |
// <cmail> ipssossettings to use correct loc strings in titles
|
|
468 |
case R_IPS_SET_MENU_INCOMING_SETTINGS:
|
|
469 |
titleText = StringLoader::LoadLC(
|
|
470 |
R_FSE_SETTINGS_INCOMING_TITLE );
|
|
471 |
iTitlePane.SetTextL( *titleText );
|
|
472 |
break;
|
|
473 |
case R_IPS_SET_MENU_OUTGOING_SETTINGS:
|
|
474 |
titleText = StringLoader::LoadLC(
|
|
475 |
R_FSE_SETTINGS_OUTGOING_TITLE );
|
|
476 |
iTitlePane.SetTextL( *titleText );
|
|
477 |
break;
|
|
478 |
case R_IPS_SET_MENU_WHAT_TO_SYNC:
|
|
479 |
//case R_IPS_SET_WHAT_TO_SYNC_ARRAY_EMAIL_RETRIEVE_POP3:
|
|
480 |
case R_IPS_SET_WHAT_TO_SYNC_ARRAY_EMAIL_RETRIEVE_IMAP4:
|
|
481 |
titleText = StringLoader::LoadLC(
|
|
482 |
R_FSE_SETTINGS_SERVICE_WHAT_TO_SYNC_TITLE );
|
|
483 |
iTitlePane.SetTextL( *titleText );
|
|
484 |
break;
|
|
485 |
case R_IPS_SET_MENU_WHEN_TO_SYNC:
|
|
486 |
titleText = StringLoader::LoadLC(
|
|
487 |
R_FSE_SETTINGS_SERVICE_WHEN_TO_SYNC_TITLE );
|
|
488 |
iTitlePane.SetTextL( *titleText );
|
|
489 |
break;
|
|
490 |
// </cmail>
|
|
491 |
default:
|
|
492 |
{
|
|
493 |
delete iMainMBoxMenuTitleText;
|
|
494 |
iMainMBoxMenuTitleText = NULL;
|
|
495 |
iMainMBoxMenuTitleText = GetItem( TUid::Uid( EIpsSetUiMailboxMailboxName ) )->Text().AllocL();
|
|
496 |
Refresh();
|
|
497 |
|
|
498 |
if ( iMainMBoxMenuTitleText )
|
|
499 |
{
|
|
500 |
titleText = StringLoader::LoadLC(
|
|
501 |
R_FSE_SETTINGS_LIST_MAILBOX_TITLE, *iMainMBoxMenuTitleText );
|
|
502 |
iTitlePane.SetTextL( *titleText );
|
|
503 |
}
|
|
504 |
break;
|
|
505 |
}
|
|
506 |
}
|
|
507 |
if ( titleText )
|
|
508 |
{
|
|
509 |
CleanupStack::PopAndDestroy( titleText );
|
|
510 |
}
|
|
511 |
}
|
|
512 |
|
|
513 |
/******************************************************************************
|
|
514 |
|
|
515 |
Settingpage creation
|
|
516 |
|
|
517 |
******************************************************************************/
|
|
518 |
|
|
519 |
// ----------------------------------------------------------------------------
|
|
520 |
// CIpsSetUiBaseDialog::SettingsPageOpenCheckL()
|
|
521 |
// ----------------------------------------------------------------------------
|
|
522 |
//
|
|
523 |
TIpsSetUiPageResult CIpsSetUiBaseDialog::SettingsPageOpenCheckL()
|
|
524 |
{
|
|
525 |
FUNC_LOG;
|
|
526 |
CIpsSetUiItem* base = CurrentSettingsPage();
|
|
527 |
|
|
528 |
// Before starting to open the page, check that item type is not
|
|
529 |
// menuarray. In case of menuarray, just open the next level
|
|
530 |
if ( HandleStackForwardL( *base ) == EIpsSetUiStackResultSubMenuOpen )
|
|
531 |
{
|
|
532 |
iSoftkeys->UpdateMiddleSoftkeyLabelL(
|
|
533 |
GetResourceForMiddlekey(), EAknSoftkeyOpen, this );
|
|
534 |
return EIpsSetUiPageResultSubMenuOpen;
|
|
535 |
}
|
|
536 |
|
|
537 |
// Don't open read only items
|
|
538 |
if ( base->iItemFlags.Flag32( KIpsSetUiFlagReadOnly ) )
|
|
539 |
{
|
|
540 |
return EIpsSetUiPageResultReadOnly;
|
|
541 |
}
|
|
542 |
|
|
543 |
// The page is ok is for edit
|
|
544 |
return EIpsSetUiPageResultEditing;
|
|
545 |
}
|
|
546 |
|
|
547 |
// ----------------------------------------------------------------------------
|
|
548 |
// CIpsSetUiBaseDialog::SettingsCheckNextEditorOpenL()
|
|
549 |
// ----------------------------------------------------------------------------
|
|
550 |
//
|
|
551 |
void CIpsSetUiBaseDialog::SettingsCheckNextEditorOpenL(
|
|
552 |
TIpsSetUiPageResult& aResult )
|
|
553 |
{
|
|
554 |
FUNC_LOG;
|
|
555 |
// The settings user have selected, must be available to user.
|
|
556 |
// For this reason, items shall restored to main array only, when
|
|
557 |
// returning from editors
|
|
558 |
|
|
559 |
switch ( aResult )
|
|
560 |
{
|
|
561 |
// Handle approved
|
|
562 |
case EIpsSetUiPageResultOk:
|
|
563 |
aResult = HandleEditorOk();
|
|
564 |
break;
|
|
565 |
|
|
566 |
// Handle the cancelled editor page
|
|
567 |
case EIpsSetUiPageResultCancelled:
|
|
568 |
aResult = HandleEditorCancelL();
|
|
569 |
break;
|
|
570 |
|
|
571 |
// Continue editing
|
|
572 |
case EIpsSetUiPageResultEditing:
|
|
573 |
aResult = HandleEditorDisapproved();
|
|
574 |
break;
|
|
575 |
|
|
576 |
default:
|
|
577 |
IPS_ASSERT_DEBUG( EFalse, KErrUnknown, EBaseDialog );
|
|
578 |
User::Leave( KErrUnknown );
|
|
579 |
break;
|
|
580 |
}
|
|
581 |
}
|
|
582 |
|
|
583 |
// ----------------------------------------------------------------------------
|
|
584 |
// CIpsSetUiBaseDialog::HandleEditorCancelL()
|
|
585 |
// ----------------------------------------------------------------------------
|
|
586 |
//
|
|
587 |
TIpsSetUiPageResult CIpsSetUiBaseDialog::HandleEditorCancelL()
|
|
588 |
{
|
|
589 |
FUNC_LOG;
|
|
590 |
// The editor was cancelled, so the first check needed to make
|
|
591 |
// is deterimine, if the editor was first in the line.
|
|
592 |
TIpsSetUiPageResult result = EIpsSetUiPageResultInvalidResult;
|
|
593 |
|
|
594 |
TInt editorCount = iSettingsPageArray->Count();
|
|
595 |
if ( editorCount == 1 )
|
|
596 |
{
|
|
597 |
// Restore all of the items
|
|
598 |
RestoreFromBackup();
|
|
599 |
result = EIpsSetUiPageResultCancelled;
|
|
600 |
}
|
|
601 |
// More than one page in the array, just jump back to the previous
|
|
602 |
// and remove the previous value
|
|
603 |
else if ( editorCount > 0 )
|
|
604 |
{
|
|
605 |
RemoveLastBackupItem();
|
|
606 |
iSettingsPageArray->Delete( editorCount-1 );
|
|
607 |
result = EIpsSetUiPageResultEditing;
|
|
608 |
}
|
|
609 |
// Array is empty, unexpected situation
|
|
610 |
else
|
|
611 |
{
|
|
612 |
IPS_ASSERT_DEBUG( EFalse, KErrNotFound, EBaseDialog );
|
|
613 |
User::Leave( KErrNotFound );
|
|
614 |
}
|
|
615 |
|
|
616 |
return result;
|
|
617 |
}
|
|
618 |
|
|
619 |
// ----------------------------------------------------------------------------
|
|
620 |
// CIpsSetUiBaseDialog::HandleEditorOk()
|
|
621 |
// ----------------------------------------------------------------------------
|
|
622 |
//
|
|
623 |
TIpsSetUiPageResult CIpsSetUiBaseDialog::HandleEditorOk()
|
|
624 |
{
|
|
625 |
FUNC_LOG;
|
|
626 |
CIpsSetUiItem* nextItem = NULL;
|
|
627 |
|
|
628 |
// Check if current selection contains subeditors
|
|
629 |
if ( iSettingValue >= 0 )
|
|
630 |
{
|
|
631 |
nextItem = SettingFindEditor(
|
|
632 |
*CurrentSettingsPage(), iSettingValue );
|
|
633 |
}
|
|
634 |
|
|
635 |
TIpsSetUiPageResult result = EIpsSetUiPageResultInvalidResult;
|
|
636 |
|
|
637 |
// In case subeditor is found, set the item to list and continue
|
|
638 |
// editing
|
|
639 |
if ( nextItem )
|
|
640 |
{
|
|
641 |
TRAP_IGNORE( SetCurrentSettingsPageL( *nextItem ) );
|
|
642 |
result = EIpsSetUiPageResultEditing;
|
|
643 |
}
|
|
644 |
// Cleanup the array and stop editing
|
|
645 |
else
|
|
646 |
{
|
|
647 |
CleanBackupArray();
|
|
648 |
result = EIpsSetUiPageResultOk;
|
|
649 |
}
|
|
650 |
|
|
651 |
return result;
|
|
652 |
}
|
|
653 |
|
|
654 |
// ----------------------------------------------------------------------------
|
|
655 |
// CIpsSetUiBaseDialog::HandleEditorDisapproved()
|
|
656 |
// ----------------------------------------------------------------------------
|
|
657 |
//
|
|
658 |
TIpsSetUiPageResult CIpsSetUiBaseDialog::HandleEditorDisapproved()
|
|
659 |
{
|
|
660 |
FUNC_LOG;
|
|
661 |
// Get current setting page
|
|
662 |
CurrentSettingsPage()->SetText( iSettingText );
|
|
663 |
|
|
664 |
return EIpsSetUiPageResultEditing;
|
|
665 |
}
|
|
666 |
|
|
667 |
// ----------------------------------------------------------------------------
|
|
668 |
// CIpsSetUiBaseDialog::SettingPageOpenEditorL()
|
|
669 |
// ----------------------------------------------------------------------------
|
|
670 |
//
|
|
671 |
TIpsSetUiPageResult CIpsSetUiBaseDialog::SettingPageOpenEditorL()
|
|
672 |
{
|
|
673 |
FUNC_LOG;
|
|
674 |
CIpsSetUiItem* currentEditor = CurrentSettingsPage();
|
|
675 |
|
|
676 |
// Prepare setting page. The setting page shall be acquired
|
|
677 |
// from the owner class, if required, or the setting page is
|
|
678 |
// created with default values
|
|
679 |
TIpsSetUiUpdateMode updateMode;
|
|
680 |
TIpsSetUtilsFlags& editorFlags = currentEditor->iItemFlags;
|
|
681 |
|
|
682 |
// If enter pressed is set, the setting page won't be opened,
|
|
683 |
// which means creation of page is not needed either
|
|
684 |
if ( !( editorFlags.Flag32( KIpsSetUiFlagEnterPressed ) ) ||
|
|
685 |
editorFlags.Flag32( KIpsSetUiFlagOneTimeForceViewOpen ) )
|
|
686 |
{
|
|
687 |
if ( editorFlags.Flag32( KIpsSetUiFlagAcquireCustomPage ) )
|
|
688 |
{
|
|
689 |
SettingPrepareAcquireL( updateMode, *currentEditor );
|
|
690 |
IPS_ASSERT_DEBUG( iSettingPage , KErrUnknown, EBaseDialog );
|
|
691 |
}
|
|
692 |
else
|
|
693 |
{
|
|
694 |
SettingCreateEditorL( *currentEditor, updateMode );
|
|
695 |
}
|
|
696 |
}
|
|
697 |
|
|
698 |
// Finally launch the editor
|
|
699 |
return SettingLaunchPageLD( *currentEditor, updateMode );
|
|
700 |
}
|
|
701 |
|
|
702 |
// ----------------------------------------------------------------------------
|
|
703 |
// CIpsSetUiBaseDialog::SettingPageOpenFinishL()
|
|
704 |
// ----------------------------------------------------------------------------
|
|
705 |
//
|
|
706 |
void CIpsSetUiBaseDialog::SettingPageOpenFinishL()
|
|
707 |
{
|
|
708 |
FUNC_LOG;
|
|
709 |
// Clean up
|
|
710 |
iBaseDialogFlags &= ~EIpsSetUiRunningCustomPage;
|
|
711 |
delete iButtonArray;
|
|
712 |
iButtonArray = NULL;
|
|
713 |
if ( iCheckboxArray )
|
|
714 |
{
|
|
715 |
iCheckboxArray->ResetAndDestroy();
|
|
716 |
}
|
|
717 |
delete iCheckboxArray;
|
|
718 |
iCheckboxArray = NULL;
|
|
719 |
iSettingPage = NULL;
|
|
720 |
iSettingValue = KErrNotFound;
|
|
721 |
iSettingText.Close();
|
|
722 |
delete iNewPassword;
|
|
723 |
iNewPassword = NULL;
|
|
724 |
delete iOldPassword;
|
|
725 |
iOldPassword = NULL;
|
|
726 |
}
|
|
727 |
|
|
728 |
/******************************************************************************
|
|
729 |
|
|
730 |
Settingpage Open
|
|
731 |
|
|
732 |
******************************************************************************/
|
|
733 |
|
|
734 |
// ----------------------------------------------------------------------------
|
|
735 |
// CIpsSetUiDialogCtrl::SettingFindEditor()
|
|
736 |
// ----------------------------------------------------------------------------
|
|
737 |
//
|
|
738 |
CIpsSetUiItem* CIpsSetUiBaseDialog::SettingFindEditor(
|
|
739 |
const CIpsSetUiItem& aBaseItem,
|
|
740 |
const TInt aIndex,
|
|
741 |
const TBool aExcludeHidden )
|
|
742 |
{
|
|
743 |
FUNC_LOG;
|
|
744 |
CIpsSetUiItem* volunteerBase = NULL;
|
|
745 |
|
|
746 |
// The settings structure is constructed in a way, that the radiobutton
|
|
747 |
// or the checkbox editor has the array of buttons. To retrieve the editor
|
|
748 |
// first the radiobutton has to be retrieved, then inside the radiobutton,
|
|
749 |
// the editor can be taken.
|
|
750 |
volunteerBase =
|
|
751 |
GetSubItem( aBaseItem, aIndex, aExcludeHidden );
|
|
752 |
|
|
753 |
if ( volunteerBase &&
|
|
754 |
volunteerBase->iItemFlags.Flag32( KIpsSetUiFlagFindEditor ) )
|
|
755 |
{
|
|
756 |
// Find the editor from the link array
|
|
757 |
volunteerBase = GetSubItem( *volunteerBase, 0, EFalse );
|
|
758 |
|
|
759 |
if ( !volunteerBase )
|
|
760 |
{
|
|
761 |
// Not found, yet. It may be seperate editor in the button arrays
|
|
762 |
volunteerBase = GetSubItemByType( aBaseItem, EIpsSetUiItemValue );
|
|
763 |
}
|
|
764 |
|
|
765 |
if ( !volunteerBase )
|
|
766 |
{
|
|
767 |
// Still not found... time editor perhaps??
|
|
768 |
volunteerBase =
|
|
769 |
GetSubItemByType( aBaseItem, EIpsSetUiItemMultiLine );
|
|
770 |
}
|
|
771 |
}
|
|
772 |
else
|
|
773 |
{
|
|
774 |
volunteerBase = NULL;
|
|
775 |
}
|
|
776 |
|
|
777 |
// return the item
|
|
778 |
return volunteerBase;
|
|
779 |
}
|
|
780 |
|
|
781 |
// ----------------------------------------------------------------------------
|
|
782 |
// CIpsSetUiDialogCtrl::SettingFindEditor()
|
|
783 |
// ----------------------------------------------------------------------------
|
|
784 |
//
|
|
785 |
CIpsSetUiItem* CIpsSetUiBaseDialog::SettingFindEditor(
|
|
786 |
const CIpsSetUiItem& aBaseItem,
|
|
787 |
const TUid& aId,
|
|
788 |
const TBool aExcludeHidden )
|
|
789 |
{
|
|
790 |
FUNC_LOG;
|
|
791 |
// The settings structure is constructed in a way, that the radiobutton
|
|
792 |
// or the checkbox editor has the array of buttons. To retrieve the editor
|
|
793 |
// first the radiobutton has to be retrieved, then inside the radiobutton,
|
|
794 |
// the editor can be taken.
|
|
795 |
CIpsSetUiItem* volunteerBase =
|
|
796 |
GetSubItem( aBaseItem, aId, aExcludeHidden );
|
|
797 |
|
|
798 |
// Make sure the item is found and check that it is
|
|
799 |
if ( volunteerBase )
|
|
800 |
{
|
|
801 |
volunteerBase = GetSubItem( *volunteerBase, 0, EFalse );
|
|
802 |
}
|
|
803 |
else
|
|
804 |
{
|
|
805 |
volunteerBase = NULL;
|
|
806 |
}
|
|
807 |
|
|
808 |
// return the item
|
|
809 |
return volunteerBase;
|
|
810 |
}
|
|
811 |
|
|
812 |
// ----------------------------------------------------------------------------
|
|
813 |
// CIpsSetUiBaseDialog::SettingPrepareAcquireRadioButtonPageL()
|
|
814 |
// ----------------------------------------------------------------------------
|
|
815 |
//
|
|
816 |
void CIpsSetUiBaseDialog::SettingPrepareAcquireRadioButtonPageL(
|
|
817 |
CIpsSetUiItem& aBaseItem )
|
|
818 |
{
|
|
819 |
FUNC_LOG;
|
|
820 |
// Convert the base item to link item and define button array
|
|
821 |
CIpsSetUiItemLink* radio = static_cast<CIpsSetUiItemLink*>( &aBaseItem );
|
|
822 |
|
|
823 |
// Make sure the link exist
|
|
824 |
if ( !radio->iItemLinkArray )
|
|
825 |
{
|
|
826 |
radio->iItemLinkArray =
|
|
827 |
new ( ELeave ) CIpsSetUiBaseItemArray( KIpsSetUiArrayGranularity );
|
|
828 |
}
|
|
829 |
|
|
830 |
SettingCreateButtonArrayL( *radio->iItemLinkArray );
|
|
831 |
|
|
832 |
iSettingValue = radio->Value();
|
|
833 |
radio = NULL;
|
|
834 |
}
|
|
835 |
|
|
836 |
// ----------------------------------------------------------------------------
|
|
837 |
// CIpsSetUiBaseDialog::SettingPrepareAcquireCheckboxPageL()
|
|
838 |
// ----------------------------------------------------------------------------
|
|
839 |
//
|
|
840 |
void CIpsSetUiBaseDialog::SettingPrepareAcquireCheckboxPageL(
|
|
841 |
CIpsSetUiItem& aBaseItem )
|
|
842 |
{
|
|
843 |
FUNC_LOG;
|
|
844 |
// Convert the base item to link item and define button array
|
|
845 |
CIpsSetUiItemLink* link = static_cast<CIpsSetUiItemLink*>( &aBaseItem );
|
|
846 |
|
|
847 |
// Make sure the link array exist
|
|
848 |
if ( link->iItemLinkArray )
|
|
849 |
{
|
|
850 |
SettingCreateButtonArrayL( *link->iItemLinkArray );
|
|
851 |
}
|
|
852 |
|
|
853 |
link = NULL;
|
|
854 |
}
|
|
855 |
|
|
856 |
// ----------------------------------------------------------------------------
|
|
857 |
// CIpsSetUiBaseDialog::SettingPrepareAcquireTextEditorPageL()
|
|
858 |
// ----------------------------------------------------------------------------
|
|
859 |
//
|
|
860 |
void CIpsSetUiBaseDialog::SettingPrepareAcquireTextEditorPageL(
|
|
861 |
CIpsSetUiItem& aBaseItem )
|
|
862 |
{
|
|
863 |
FUNC_LOG;
|
|
864 |
// Create either password or plain texts
|
|
865 |
if ( aBaseItem.iItemFlags.Flag32( KIpsSetUiFlagPassword ) )
|
|
866 |
{
|
|
867 |
iNewPassword = new ( ELeave ) TIpsSetUiPasswordText( aBaseItem.Text() );
|
|
868 |
iOldPassword = new ( ELeave ) TIpsSetUiPasswordText( aBaseItem.Text() );
|
|
869 |
}
|
|
870 |
else
|
|
871 |
{
|
|
872 |
iSettingText.CreateL( aBaseItem.Text() );
|
|
873 |
}
|
|
874 |
}
|
|
875 |
|
|
876 |
// ----------------------------------------------------------------------------
|
|
877 |
// CIpsSetUiBaseDialog::SettingPrepareAcquireValueEditorPageL()
|
|
878 |
// ----------------------------------------------------------------------------
|
|
879 |
//
|
|
880 |
void CIpsSetUiBaseDialog::SettingPrepareAcquireValueEditorPageL(
|
|
881 |
CIpsSetUiItem& aBaseItem )
|
|
882 |
{
|
|
883 |
FUNC_LOG;
|
|
884 |
iSettingValue = aBaseItem.Value();
|
|
885 |
}
|
|
886 |
|
|
887 |
// ----------------------------------------------------------------------------
|
|
888 |
// CIpsSetUiBaseDialog::SettingPrepareAcquireL()
|
|
889 |
// ----------------------------------------------------------------------------
|
|
890 |
//
|
|
891 |
void CIpsSetUiBaseDialog::SettingPrepareAcquireL(
|
|
892 |
TIpsSetUiUpdateMode& aUpdateMode,
|
|
893 |
CIpsSetUiItem& aBaseItem )
|
|
894 |
{
|
|
895 |
FUNC_LOG;
|
|
896 |
// Handle the item, based on the type
|
|
897 |
switch ( aBaseItem.Type() )
|
|
898 |
{
|
|
899 |
// Radio button page
|
|
900 |
case EIpsSetUiRadioButtonArray:
|
|
901 |
SettingPrepareAcquireRadioButtonPageL( aBaseItem );
|
|
902 |
break;
|
|
903 |
|
|
904 |
// Checkbox page
|
|
905 |
case EIpsSetUiCheckBoxArray:
|
|
906 |
SettingPrepareAcquireCheckboxPageL( aBaseItem );
|
|
907 |
break;
|
|
908 |
|
|
909 |
// Text editor
|
|
910 |
case EIpsSetUiItemText:
|
|
911 |
SettingPrepareAcquireTextEditorPageL( aBaseItem );
|
|
912 |
break;
|
|
913 |
|
|
914 |
// Number editor
|
|
915 |
case EIpsSetUiItemValue:
|
|
916 |
SettingPrepareAcquireValueEditorPageL( aBaseItem );
|
|
917 |
break;
|
|
918 |
|
|
919 |
// Type is not recognized
|
|
920 |
default:
|
|
921 |
IPS_ASSERT_DEBUG( EFalse, KErrUnknown, EBaseDialog );
|
|
922 |
User::Leave( KErrUnknown );
|
|
923 |
}
|
|
924 |
|
|
925 |
// Acquire the custom setting page
|
|
926 |
AcquireCustomSettingPageL(
|
|
927 |
iSettingPage, aUpdateMode, iSettingValue,
|
|
928 |
iSettingText, *iButtonArray, aBaseItem );
|
|
929 |
}
|
|
930 |
|
|
931 |
// ----------------------------------------------------------------------------
|
|
932 |
// CIpsSetUiBaseDialog::AcquireCustomSettingPageL()
|
|
933 |
// ----------------------------------------------------------------------------
|
|
934 |
//
|
|
935 |
void CIpsSetUiBaseDialog::AcquireCustomSettingPageL(
|
|
936 |
CAknSettingPage*& /* aReturnPage */,
|
|
937 |
TIpsSetUiUpdateMode& /* aReturnUpdateMode */,
|
|
938 |
TInt& /* aReturnSettingValue */,
|
|
939 |
TDes& /* aReturnSettingText */,
|
|
940 |
CDesCArrayFlat& /* aParamRadioButtonArray */,
|
|
941 |
CIpsSetUiItem& /* aParamBaseItem */ )
|
|
942 |
{
|
|
943 |
FUNC_LOG;
|
|
944 |
}
|
|
945 |
|
|
946 |
// ----------------------------------------------------------------------------
|
|
947 |
// CIpsSetUiBaseDialog::SettingCreateEditorL()
|
|
948 |
// ----------------------------------------------------------------------------
|
|
949 |
//
|
|
950 |
void CIpsSetUiBaseDialog::SettingCreateEditorL(
|
|
951 |
CIpsSetUiItem& aBaseItem,
|
|
952 |
TIpsSetUiUpdateMode& aUpdateMode )
|
|
953 |
{
|
|
954 |
FUNC_LOG;
|
|
955 |
// Create different editors for password settings
|
|
956 |
if ( aBaseItem.iItemFlags.Flag32( KIpsSetUiFlagPassword ) )
|
|
957 |
{
|
|
958 |
switch ( aBaseItem.iItemType )
|
|
959 |
{
|
|
960 |
case EIpsSetUiItemText:
|
|
961 |
SettingCreatePasswordTextEditorPageL(
|
|
962 |
aBaseItem, aUpdateMode );
|
|
963 |
break;
|
|
964 |
|
|
965 |
}
|
|
966 |
}
|
|
967 |
// Normal editors
|
|
968 |
else
|
|
969 |
{
|
|
970 |
switch ( aBaseItem.iItemType )
|
|
971 |
{
|
|
972 |
case EIpsSetUiRadioButtonArray:
|
|
973 |
SettingCreateRadioButtonPageL( aBaseItem, aUpdateMode );
|
|
974 |
break;
|
|
975 |
|
|
976 |
case EIpsSetUiCheckBoxArray:
|
|
977 |
SettingCreateCheckboxPageL( aBaseItem, aUpdateMode );
|
|
978 |
break;
|
|
979 |
|
|
980 |
case EIpsSetUiItemText:
|
|
981 |
SettingCreatePlainTextEditorPageL(
|
|
982 |
aBaseItem, aUpdateMode );
|
|
983 |
break;
|
|
984 |
|
|
985 |
case EIpsSetUiItemValue:
|
|
986 |
SettingCreatePlainNumberEditorPageL(
|
|
987 |
aBaseItem, aUpdateMode );
|
|
988 |
break;
|
|
989 |
|
|
990 |
case EIpsSetUiItemScValue:
|
|
991 |
SettingCreateScNumberEditorPageL(
|
|
992 |
aBaseItem, aUpdateMode );
|
|
993 |
break;
|
|
994 |
|
|
995 |
default:
|
|
996 |
break;
|
|
997 |
}
|
|
998 |
}
|
|
999 |
}
|
|
1000 |
|
|
1001 |
// ----------------------------------------------------------------------------
|
|
1002 |
// CIpsSetUiBaseDialog::DefineDefaultSettingPageL()
|
|
1003 |
// ----------------------------------------------------------------------------
|
|
1004 |
//
|
|
1005 |
TIpsSetUiUpdateMode CIpsSetUiBaseDialog::DefineDefaultSettingPageL(
|
|
1006 |
const CIpsSetUiItem& aBase )
|
|
1007 |
{
|
|
1008 |
FUNC_LOG;
|
|
1009 |
// Create the aSetting page
|
|
1010 |
iSettingPage->SetSettingTextL( *aBase.iItemLabel );
|
|
1011 |
|
|
1012 |
// Determine the update mode
|
|
1013 |
return static_cast<TIpsSetUiUpdateMode>( aBase.iItemFlags.ValueForFlag(
|
|
1014 |
KIpsSetUiFlagUpdateOnChange,
|
|
1015 |
CAknSettingPage::EUpdateWhenChanged,
|
|
1016 |
CAknSettingPage::EUpdateWhenAccepted ) );
|
|
1017 |
}
|
|
1018 |
|
|
1019 |
// ----------------------------------------------------------------------------
|
|
1020 |
// CIpsSetUiBaseDialog::SettingCreateButtonArrayL()
|
|
1021 |
// ----------------------------------------------------------------------------
|
|
1022 |
//
|
|
1023 |
void CIpsSetUiBaseDialog::SettingCreateButtonArrayL(
|
|
1024 |
CIpsSetUiBaseItemArray& aButtonArray )
|
|
1025 |
{
|
|
1026 |
FUNC_LOG;
|
|
1027 |
// Get the item count in array
|
|
1028 |
const TInt count = aButtonArray.Count();
|
|
1029 |
iButtonArray = new ( ELeave ) CDesCArrayFlat( KIpsSetUiArrayGranularity );
|
|
1030 |
|
|
1031 |
// Do number conversion to all items and add them to temporary array
|
|
1032 |
for ( TInt item = 0; item < count; item++ )
|
|
1033 |
{
|
|
1034 |
CIpsSetUiItem* base = aButtonArray[item];
|
|
1035 |
|
|
1036 |
// Append only visible items on the list
|
|
1037 |
if ( !IsHidden( *base ) )
|
|
1038 |
{
|
|
1039 |
HBufC* label = base->iItemLabel->AllocLC();
|
|
1040 |
TPtr labelPtr = label->Des();
|
|
1041 |
|
|
1042 |
// Do number conversion when needed
|
|
1043 |
if ( base->iItemFlags.Flag32( KIpsSetUiFlagLangSpecificNumConv ) )
|
|
1044 |
{
|
|
1045 |
AknTextUtils::DisplayTextLanguageSpecificNumberConversion(
|
|
1046 |
labelPtr );
|
|
1047 |
}
|
|
1048 |
|
|
1049 |
// Insert to array and delete old item
|
|
1050 |
iButtonArray->AppendL( *label );
|
|
1051 |
CleanupStack::PopAndDestroy( label );
|
|
1052 |
label = NULL;
|
|
1053 |
}
|
|
1054 |
}
|
|
1055 |
}
|
|
1056 |
|
|
1057 |
// ----------------------------------------------------------------------------
|
|
1058 |
// CIpsSetUiBaseDialog::SettingCreateCheckboxArrayL()
|
|
1059 |
// ----------------------------------------------------------------------------
|
|
1060 |
//
|
|
1061 |
void CIpsSetUiBaseDialog::SettingCreateCheckboxArrayL(
|
|
1062 |
CIpsSetUiBaseItemArray& aButtonArray )
|
|
1063 |
{
|
|
1064 |
FUNC_LOG;
|
|
1065 |
// Get the item count in array
|
|
1066 |
const TInt count = aButtonArray.Count();
|
|
1067 |
iCheckboxArray =
|
|
1068 |
new ( ELeave ) CSelectionItemList( KIpsSetUiArrayGranularity );
|
|
1069 |
|
|
1070 |
// Do number conversion to all items and add them to temporary array
|
|
1071 |
for ( TInt item = 0; item < count; item++ )
|
|
1072 |
{
|
|
1073 |
CIpsSetUiItem* base = aButtonArray[item];
|
|
1074 |
|
|
1075 |
// Append only visible items on the list
|
|
1076 |
if ( !IsHidden( *base ) )
|
|
1077 |
{
|
|
1078 |
HBufC* label = base->iItemLabel->AllocLC();
|
|
1079 |
TPtr labelPtr = label->Des();
|
|
1080 |
|
|
1081 |
// Do number conversion when needed
|
|
1082 |
if ( base->iItemFlags.Flag32( KIpsSetUiFlagLangSpecificNumConv ) )
|
|
1083 |
{
|
|
1084 |
AknTextUtils::DisplayTextLanguageSpecificNumberConversion(
|
|
1085 |
labelPtr );
|
|
1086 |
}
|
|
1087 |
|
|
1088 |
// Create item and check it
|
|
1089 |
CSelectableItem* checkbox =
|
|
1090 |
new ( ELeave ) CSelectableItem(
|
|
1091 |
*label, base->iItemFlags.Flag32( KIpsSetUiFlagChecked ) );
|
|
1092 |
CleanupStack::PushL( checkbox );
|
|
1093 |
checkbox->ConstructL();
|
|
1094 |
|
|
1095 |
// Insert to array and delete old item
|
|
1096 |
iCheckboxArray->AppendL( checkbox );
|
|
1097 |
CleanupStack::Pop( checkbox );
|
|
1098 |
CleanupStack::PopAndDestroy( label );
|
|
1099 |
label = NULL;
|
|
1100 |
}
|
|
1101 |
}
|
|
1102 |
}
|
|
1103 |
|
|
1104 |
// ----------------------------------------------------------------------------
|
|
1105 |
// CIpsSetUiBaseDialog::SettingCreateRadioButtonPageL()
|
|
1106 |
// ----------------------------------------------------------------------------
|
|
1107 |
//
|
|
1108 |
void CIpsSetUiBaseDialog::SettingCreateRadioButtonPageL(
|
|
1109 |
CIpsSetUiItem& aBaseItem,
|
|
1110 |
TIpsSetUiUpdateMode& aUpdateMode )
|
|
1111 |
{
|
|
1112 |
FUNC_LOG;
|
|
1113 |
// Convert the base item to radiobutton item
|
|
1114 |
CIpsSetUiItemLinkExt* radioArray =
|
|
1115 |
static_cast<CIpsSetUiItemLinkExt*>( &aBaseItem );
|
|
1116 |
|
|
1117 |
// Create button array for the page and set the selection for page
|
|
1118 |
SettingCreateButtonArrayL( *radioArray->iItemLinkArray );
|
|
1119 |
iSettingValue = radioArray->Value();
|
|
1120 |
|
|
1121 |
// Create the setting page to member
|
|
1122 |
iSettingPage = ( new ( ELeave ) CAknRadioButtonSettingPage(
|
|
1123 |
( *iSettingPageResources )[EIpsSetUiRadioButton],
|
|
1124 |
iSettingValue, iButtonArray ) );
|
|
1125 |
|
|
1126 |
// Apply defaults
|
|
1127 |
aUpdateMode = DefineDefaultSettingPageL( aBaseItem );
|
|
1128 |
}
|
|
1129 |
|
|
1130 |
// ----------------------------------------------------------------------------
|
|
1131 |
// CIpsSetUiBaseDialog::SettingCreateCheckboxPageL()
|
|
1132 |
// ----------------------------------------------------------------------------
|
|
1133 |
//
|
|
1134 |
void CIpsSetUiBaseDialog::SettingCreateCheckboxPageL(
|
|
1135 |
CIpsSetUiItem& aBaseItem,
|
|
1136 |
TIpsSetUiUpdateMode& aUpdateMode )
|
|
1137 |
{
|
|
1138 |
FUNC_LOG;
|
|
1139 |
// Convert the base item to radiobutton item
|
|
1140 |
CIpsSetUiItemLink* radioArray =
|
|
1141 |
static_cast<CIpsSetUiItemLink*>( &aBaseItem );
|
|
1142 |
|
|
1143 |
// Create button array for the page
|
|
1144 |
SettingCreateCheckboxArrayL( *radioArray->iItemLinkArray );
|
|
1145 |
|
|
1146 |
// Create the setting page to member
|
|
1147 |
iSettingPage = ( new ( ELeave ) CAknCheckBoxSettingPage(
|
|
1148 |
( *iSettingPageResources )[EIpsSetUiCheckbox], iCheckboxArray ) );
|
|
1149 |
|
|
1150 |
// Apply defaults
|
|
1151 |
aUpdateMode = DefineDefaultSettingPageL( aBaseItem );
|
|
1152 |
}
|
|
1153 |
|
|
1154 |
// ----------------------------------------------------------------------------
|
|
1155 |
// CIpsSetUiBaseDialog::SettingCreatePlainTextEditorPageL()
|
|
1156 |
// ----------------------------------------------------------------------------
|
|
1157 |
//
|
|
1158 |
void CIpsSetUiBaseDialog::SettingCreatePlainTextEditorPageL(
|
|
1159 |
CIpsSetUiItem& aBaseItem,
|
|
1160 |
TIpsSetUiUpdateMode& aUpdateMode )
|
|
1161 |
{
|
|
1162 |
FUNC_LOG;
|
|
1163 |
// Get the text to be edited
|
|
1164 |
CIpsSetUiItemsEditText* textEditor =
|
|
1165 |
static_cast<CIpsSetUiItemsEditText*>( &aBaseItem );
|
|
1166 |
iSettingText.CreateL( textEditor->iItemMaxLength );
|
|
1167 |
iSettingText.Copy( textEditor->Text() );
|
|
1168 |
|
|
1169 |
// Define flags according to item
|
|
1170 |
TInt flags = GetTextEditorFlags( aBaseItem );
|
|
1171 |
|
|
1172 |
// Create the setting page using the flags
|
|
1173 |
TInt pageResource = ( *iSettingPageResources )[EIpsSetUiText];
|
|
1174 |
CAknTextSettingPage* settingPage =
|
|
1175 |
new ( ELeave ) CAknTextSettingPage(
|
|
1176 |
pageResource, iSettingText, flags );
|
|
1177 |
CleanupStack::PushL( settingPage );
|
|
1178 |
settingPage->ConstructL();
|
|
1179 |
CEikEdwin& txtCtrl = *settingPage->TextControl();
|
|
1180 |
txtCtrl.SetTextLimit( textEditor->iItemMaxLength );
|
|
1181 |
|
|
1182 |
if ( textEditor->iItemFlags.Flag32( KIpsSetUiFlagLatinOnly ) )
|
|
1183 |
{
|
|
1184 |
txtCtrl.SetAknEditorFlags(
|
|
1185 |
EAknEditorFlagLatinInputModesOnly | EAknEditorFlagNoT9 );
|
|
1186 |
}
|
|
1187 |
|
|
1188 |
iSettingPage = settingPage;
|
|
1189 |
CleanupStack::Pop( settingPage );
|
|
1190 |
|
|
1191 |
// Apply defaults
|
|
1192 |
aUpdateMode = DefineDefaultSettingPageL( aBaseItem );
|
|
1193 |
}
|
|
1194 |
|
|
1195 |
// ----------------------------------------------------------------------------
|
|
1196 |
// CIpsSetUiBaseDialog::SettingCreatePasswordTextEditorPageL()
|
|
1197 |
// ----------------------------------------------------------------------------
|
|
1198 |
//
|
|
1199 |
void CIpsSetUiBaseDialog::SettingCreatePasswordTextEditorPageL(
|
|
1200 |
CIpsSetUiItem& aBaseItem,
|
|
1201 |
TIpsSetUiUpdateMode& aUpdateMode )
|
|
1202 |
{
|
|
1203 |
FUNC_LOG;
|
|
1204 |
// Prepare password and save the old
|
|
1205 |
CIpsSetUiItemsEditText* textEditor =
|
|
1206 |
static_cast<CIpsSetUiItemsEditText*>( &aBaseItem );
|
|
1207 |
|
|
1208 |
iNewPassword = new ( ELeave ) TIpsSetUiPasswordText(
|
|
1209 |
textEditor->Text().Left( KIpsSetUiMaxPasswordLength ) );
|
|
1210 |
iOldPassword = new ( ELeave ) TIpsSetUiPasswordText(
|
|
1211 |
textEditor->Text().Left( KIpsSetUiMaxPasswordLength ) );
|
|
1212 |
|
|
1213 |
// Create the settings page
|
|
1214 |
iSettingPage = ( new ( ELeave ) CAknAlphaPasswordSettingPage(
|
|
1215 |
( *iSettingPageResources )[EIpsSetUiSecret],
|
|
1216 |
*iNewPassword, *iOldPassword ) );
|
|
1217 |
iSettingPage->ConstructL();
|
|
1218 |
CAknAlphaPasswordSettingPage* pwPage =
|
|
1219 |
static_cast<CAknAlphaPasswordSettingPage*>( iSettingPage );
|
|
1220 |
pwPage->SetMaxPasswordLength( textEditor->iItemMaxLength );
|
|
1221 |
if ( pwPage->AlphaPasswordEditor() )
|
|
1222 |
{
|
|
1223 |
pwPage->AlphaPasswordEditor()->SetMaxLength(
|
|
1224 |
textEditor->iItemMaxLength );
|
|
1225 |
}
|
|
1226 |
|
|
1227 |
// Apply defaults
|
|
1228 |
aUpdateMode = DefineDefaultSettingPageL( aBaseItem );
|
|
1229 |
}
|
|
1230 |
|
|
1231 |
// ----------------------------------------------------------------------------
|
|
1232 |
// CIpsSetUiBaseDialog::SettingCreatePlainNumberEditorPageL()
|
|
1233 |
// ----------------------------------------------------------------------------
|
|
1234 |
//
|
|
1235 |
void CIpsSetUiBaseDialog::SettingCreatePlainNumberEditorPageL(
|
|
1236 |
CIpsSetUiItem& aBaseItem,
|
|
1237 |
TIpsSetUiUpdateMode& aUpdateMode )
|
|
1238 |
{
|
|
1239 |
FUNC_LOG;
|
|
1240 |
// Conver item and set the value
|
|
1241 |
CIpsSetUiItemValue* numberEditor =
|
|
1242 |
static_cast<CIpsSetUiItemValue*>( &aBaseItem );
|
|
1243 |
iSettingValue = numberEditor->Value();
|
|
1244 |
|
|
1245 |
// Define flags according to item
|
|
1246 |
TInt flags = GetValueEditorFlags( aBaseItem );
|
|
1247 |
|
|
1248 |
// Create aSetting page
|
|
1249 |
iSettingPage = ( new ( ELeave ) CAknIntegerSettingPage(
|
|
1250 |
( *iSettingPageResources )[EIpsSetUiNumber],
|
|
1251 |
*&iSettingValue, flags ) );
|
|
1252 |
iSettingPage->ConstructL();
|
|
1253 |
iSettingPage->SetSettingTextL( *numberEditor->iItemLabel );
|
|
1254 |
|
|
1255 |
// Apply defaults, for number editors, the update mode has to be onchange
|
|
1256 |
aBaseItem.iItemFlags.SetFlag32( KIpsSetUiFlagUpdateOnChange );
|
|
1257 |
aUpdateMode = DefineDefaultSettingPageL( aBaseItem );
|
|
1258 |
}
|
|
1259 |
|
|
1260 |
// ----------------------------------------------------------------------------
|
|
1261 |
// CIpsSetUiBaseDialog::SettingCreateScNumberEditorPageL()
|
|
1262 |
// ----------------------------------------------------------------------------
|
|
1263 |
//
|
|
1264 |
void CIpsSetUiBaseDialog::SettingCreateScNumberEditorPageL(
|
|
1265 |
CIpsSetUiItem& aBaseItem,
|
|
1266 |
TIpsSetUiUpdateMode& aUpdateMode )
|
|
1267 |
{
|
|
1268 |
FUNC_LOG;
|
|
1269 |
// Conver item and set the value
|
|
1270 |
CIpsSetUiItemsEditText* textEditor =
|
|
1271 |
static_cast<CIpsSetUiItemsEditText*>( &aBaseItem );
|
|
1272 |
iSettingText.CreateL( textEditor->iItemMaxLength );
|
|
1273 |
iSettingText.Copy( textEditor->Text() );
|
|
1274 |
|
|
1275 |
if ( aBaseItem.iItemFlags.Flag32( KIpsSetUiFlagLangSpecificNumConv ) )
|
|
1276 |
{
|
|
1277 |
AknTextUtils::DisplayTextLanguageSpecificNumberConversion(
|
|
1278 |
iSettingText );
|
|
1279 |
}
|
|
1280 |
|
|
1281 |
// Define flags according to item
|
|
1282 |
TInt flags = CAknIntegerSettingPage::EInvalidValueNotOffered;
|
|
1283 |
flags |= !aBaseItem.iItemFlags.Flag32( KIpsSetUiFlagForceMustFill ) &
|
|
1284 |
CAknIntegerSettingPage::EEmptyValueAllowed;
|
|
1285 |
flags |= aBaseItem.iItemFlags.Flag32( KIpsSetUiFlagNoInitialSelection ) &
|
|
1286 |
CAknIntegerSettingPage::ENoInitialSelection;
|
|
1287 |
flags |= aBaseItem.iItemFlags.Flag32( KIpsSetUiFlagEditorCursorAtBeginning ) &
|
|
1288 |
CAknIntegerSettingPage::EPutCursorAtBeginning;
|
|
1289 |
|
|
1290 |
// Create aSetting page
|
|
1291 |
iSettingPage = ( new ( ELeave ) CAknTextSettingPage(
|
|
1292 |
( *iSettingPageResources )[EIpsSetUiScNumber],
|
|
1293 |
iSettingText, flags ) );
|
|
1294 |
iSettingPage->ConstructL();
|
|
1295 |
static_cast<CAknTextSettingPage*>( iSettingPage
|
|
1296 |
)->TextControl()->SetTextLimit( textEditor->iItemMaxLength );
|
|
1297 |
iSettingPage->SetSettingTextL( *textEditor->iItemLabel );
|
|
1298 |
|
|
1299 |
// Apply defaults
|
|
1300 |
aUpdateMode = DefineDefaultSettingPageL( aBaseItem );
|
|
1301 |
}
|
|
1302 |
|
|
1303 |
// ----------------------------------------------------------------------------
|
|
1304 |
// CIpsSetUiBaseDialog::SettingLaunchPageLD()
|
|
1305 |
// ----------------------------------------------------------------------------
|
|
1306 |
//
|
|
1307 |
TIpsSetUiPageResult CIpsSetUiBaseDialog::SettingLaunchPageLD(
|
|
1308 |
CIpsSetUiItem& aBaseItem,
|
|
1309 |
TIpsSetUiUpdateMode& aUpdateMode )
|
|
1310 |
{
|
|
1311 |
FUNC_LOG;
|
|
1312 |
switch ( aBaseItem.Type() )
|
|
1313 |
{
|
|
1314 |
case EIpsSetUiRadioButtonArray:
|
|
1315 |
return SettingLaunchRadioButtonPageLD(
|
|
1316 |
aBaseItem, aUpdateMode );
|
|
1317 |
|
|
1318 |
case EIpsSetUiCheckBoxArray:
|
|
1319 |
return SettingLaunchCheckboxPageLD( aBaseItem, aUpdateMode );
|
|
1320 |
|
|
1321 |
case EIpsSetUiItemText:
|
|
1322 |
case EIpsSetUiItemScValue:
|
|
1323 |
return SettingLaunchTextEditorPageLD( aBaseItem, aUpdateMode );
|
|
1324 |
|
|
1325 |
case EIpsSetUiItemValue:
|
|
1326 |
return SettingLaunchNumberEditorPageLD( aBaseItem, aUpdateMode );
|
|
1327 |
|
|
1328 |
// Multiline dialogs are launched from client only
|
|
1329 |
case EIpsSetUiItemMultiLine:
|
|
1330 |
return SettingLaunchMultilinePageL( aBaseItem, aUpdateMode );
|
|
1331 |
|
|
1332 |
default:
|
|
1333 |
IPS_ASSERT_DEBUG( EFalse, KErrUnknown, EBaseDialog );
|
|
1334 |
return EIpsSetUiPageResultCancelled;
|
|
1335 |
}
|
|
1336 |
}
|
|
1337 |
|
|
1338 |
// ----------------------------------------------------------------------------
|
|
1339 |
// CIpsSetUiBaseDialog::SettingLaunchRadioButtonPageLD()
|
|
1340 |
// ----------------------------------------------------------------------------
|
|
1341 |
//
|
|
1342 |
TIpsSetUiPageResult CIpsSetUiBaseDialog::SettingLaunchRadioButtonPageLD(
|
|
1343 |
CIpsSetUiItem& aBaseItem,
|
|
1344 |
TIpsSetUiUpdateMode& aUpdateMode )
|
|
1345 |
{
|
|
1346 |
FUNC_LOG;
|
|
1347 |
// Convert the base item to radio item
|
|
1348 |
CIpsSetUiItemLink* linkArray = static_cast<CIpsSetUiItemLink*>( &aBaseItem );
|
|
1349 |
TIpsSetUiPageResult result = EIpsSetUiPageResultOk;
|
|
1350 |
|
|
1351 |
if ( linkArray->iItemFlags.Flag32( KIpsSetUiFlagEnterPressed ) &&
|
|
1352 |
!linkArray->iItemFlags.Flag32( KIpsSetUiFlagOneTimeForceViewOpen ) )
|
|
1353 |
{
|
|
1354 |
TInt value = !linkArray->Value();
|
|
1355 |
TIpsSetUiEventResult evaluation =
|
|
1356 |
EventItemEvaluateRadioButton( *linkArray, value );
|
|
1357 |
|
|
1358 |
// Handle approved item
|
|
1359 |
if ( evaluation == EIpsSetUiPageEventResultApproved )
|
|
1360 |
{
|
|
1361 |
// Change the value and the text
|
|
1362 |
linkArray->SetValue( value );
|
|
1363 |
linkArray->iItemSettingText->Copy(
|
|
1364 |
*( *linkArray->iItemLinkArray
|
|
1365 |
)[value]->iItemLabel );
|
|
1366 |
}
|
|
1367 |
|
|
1368 |
result = EIpsSetUiPageResultOk;
|
|
1369 |
}
|
|
1370 |
else
|
|
1371 |
{
|
|
1372 |
// Opening the editor, clear flag immediately
|
|
1373 |
linkArray->iItemFlags.ClearFlag32( KIpsSetUiFlagOneTimeForceViewOpen );
|
|
1374 |
|
|
1375 |
// Launch the settings dialog and update the item, if item is valid
|
|
1376 |
if ( iSettingPage->ExecuteLD( aUpdateMode ) > 0 )
|
|
1377 |
{
|
|
1378 |
iSettingPage = NULL;
|
|
1379 |
TIpsSetUiEventResult evaluation =
|
|
1380 |
EventItemEvaluateRadioButton( *linkArray, iSettingValue );
|
|
1381 |
|
|
1382 |
// Handle approved item
|
|
1383 |
if ( evaluation == EIpsSetUiPageEventResultApproved )
|
|
1384 |
{
|
|
1385 |
// First store the index value from the visible radiobutton array
|
|
1386 |
linkArray->SetValue( iSettingValue );
|
|
1387 |
CIpsSetUiItem* subItem =
|
|
1388 |
GetSubItem( *linkArray, iSettingValue );
|
|
1389 |
|
|
1390 |
// Mark the item as checked and copy the text
|
|
1391 |
if ( subItem )
|
|
1392 |
{
|
|
1393 |
CheckRadioButton( *linkArray, subItem->iItemId );
|
|
1394 |
linkArray->iItemSettingText->Copy( *subItem->iItemLabel );
|
|
1395 |
}
|
|
1396 |
|
|
1397 |
if( linkArray->iItemId.iUid == EIpsSetUiWhenHours &&
|
|
1398 |
iSettingValue == CIpsSetData::EAllDay )
|
|
1399 |
{
|
|
1400 |
// set related 'from' and 'to' settings to 0
|
|
1401 |
CIpsSetUiItem* item = GetItem(
|
|
1402 |
TUid::Uid( EIpsSetUiWhenHoursEditCustomizeFrom ) );
|
|
1403 |
item->SetValue( KIpsSetDataTimeDialogDefault );
|
|
1404 |
item = GetItem(
|
|
1405 |
TUid::Uid( EIpsSetUiWhenHoursEditCustomizeTo ) );
|
|
1406 |
item->SetValue( KIpsSetDataTimeDialogDefault );
|
|
1407 |
}
|
|
1408 |
|
|
1409 |
result = EIpsSetUiPageResultOk;
|
|
1410 |
}
|
|
1411 |
// Handle disapproved item
|
|
1412 |
else if ( evaluation == EIpsSetUiPageEventResultDisapproved )
|
|
1413 |
{
|
|
1414 |
result = EIpsSetUiPageResultEditing;
|
|
1415 |
}
|
|
1416 |
// Handle cancelled item
|
|
1417 |
else
|
|
1418 |
{
|
|
1419 |
result = EIpsSetUiPageResultCancelled;
|
|
1420 |
}
|
|
1421 |
}
|
|
1422 |
else
|
|
1423 |
{
|
|
1424 |
// Editor cancelled
|
|
1425 |
iSettingPage = NULL;
|
|
1426 |
result = EIpsSetUiPageResultCancelled;
|
|
1427 |
}
|
|
1428 |
}
|
|
1429 |
|
|
1430 |
linkArray = NULL;
|
|
1431 |
|
|
1432 |
// Return the result
|
|
1433 |
return result;
|
|
1434 |
}
|
|
1435 |
|
|
1436 |
// ----------------------------------------------------------------------------
|
|
1437 |
// CIpsSetUiBaseDialog::SettingLaunchCheckboxPageLD()
|
|
1438 |
// ----------------------------------------------------------------------------
|
|
1439 |
//
|
|
1440 |
TIpsSetUiPageResult CIpsSetUiBaseDialog::SettingLaunchCheckboxPageLD(
|
|
1441 |
CIpsSetUiItem& aBaseItem,
|
|
1442 |
TIpsSetUiUpdateMode& aUpdateMode )
|
|
1443 |
{
|
|
1444 |
FUNC_LOG;
|
|
1445 |
// Convert the base item to link item
|
|
1446 |
CIpsSetUiItemLinkExt* checkboxArray =
|
|
1447 |
static_cast<CIpsSetUiItemLinkExt*>( &aBaseItem );
|
|
1448 |
TIpsSetUiPageResult result = EIpsSetUiPageResultOk;
|
|
1449 |
|
|
1450 |
// Launch the settings dialog and update the item, if item is valid
|
|
1451 |
if ( iSettingPage->ExecuteLD( aUpdateMode ) )
|
|
1452 |
{
|
|
1453 |
iSettingPage = NULL;
|
|
1454 |
TIpsSetUiEventResult evaluation =
|
|
1455 |
EventItemEvaluateValue( aBaseItem, iSettingValue );
|
|
1456 |
|
|
1457 |
if ( evaluation == EIpsSetUiPageEventResultApproved )
|
|
1458 |
{
|
|
1459 |
// Clean the value
|
|
1460 |
TInt checkbox = 0;
|
|
1461 |
|
|
1462 |
// Check all items in the array, and set the flags to item
|
|
1463 |
for ( TInt item = iCheckboxArray->Count()-1; item >= 0; item-- )
|
|
1464 |
{
|
|
1465 |
TBool checked = iCheckboxArray->At( item )->SelectionStatus();
|
|
1466 |
if ( checked )
|
|
1467 |
{
|
|
1468 |
checkboxArray->iItemLinkArray->At(
|
|
1469 |
item )->iItemFlags.SetFlag32( KIpsSetUiFlagChecked );
|
|
1470 |
}
|
|
1471 |
else
|
|
1472 |
{
|
|
1473 |
checkboxArray->iItemLinkArray->At(
|
|
1474 |
item )->iItemFlags.ClearFlag32( KIpsSetUiFlagChecked );
|
|
1475 |
}
|
|
1476 |
checkbox |= ( checked << item );
|
|
1477 |
}
|
|
1478 |
|
|
1479 |
checkboxArray->SetValue( checkbox );
|
|
1480 |
|
|
1481 |
result = EIpsSetUiPageResultOk;
|
|
1482 |
}
|
|
1483 |
// Handle disapproved item
|
|
1484 |
else if ( evaluation == EIpsSetUiPageEventResultDisapproved )
|
|
1485 |
{
|
|
1486 |
result = EIpsSetUiPageResultEditing;
|
|
1487 |
}
|
|
1488 |
// Handle cancelled item
|
|
1489 |
else
|
|
1490 |
{
|
|
1491 |
result = EIpsSetUiPageResultCancelled;
|
|
1492 |
}
|
|
1493 |
}
|
|
1494 |
else
|
|
1495 |
{
|
|
1496 |
// Editor cancelled
|
|
1497 |
iSettingPage = NULL;
|
|
1498 |
result = EIpsSetUiPageResultCancelled;
|
|
1499 |
}
|
|
1500 |
|
|
1501 |
return result;
|
|
1502 |
}
|
|
1503 |
|
|
1504 |
// ----------------------------------------------------------------------------
|
|
1505 |
// CIpsSetUiBaseDialog::SettingLaunchTextEditorPageLD()
|
|
1506 |
// ----------------------------------------------------------------------------
|
|
1507 |
//
|
|
1508 |
TIpsSetUiPageResult CIpsSetUiBaseDialog::SettingLaunchTextEditorPageLD(
|
|
1509 |
CIpsSetUiItem& aBaseItem,
|
|
1510 |
TIpsSetUiUpdateMode& aUpdateMode )
|
|
1511 |
{
|
|
1512 |
FUNC_LOG;
|
|
1513 |
TIpsSetUiPageResult result = EIpsSetUiPageResultOk;
|
|
1514 |
|
|
1515 |
if ( iSettingPage->ExecuteLD( aUpdateMode ) > 0 )
|
|
1516 |
{
|
|
1517 |
iSettingPage = NULL;
|
|
1518 |
RBuf tempText;
|
|
1519 |
|
|
1520 |
// Depending on the text editor, choose the correct text
|
|
1521 |
if ( aBaseItem.iItemFlags.Flag32( KIpsSetUiFlagPassword ) )
|
|
1522 |
{
|
|
1523 |
tempText.CreateL( *iNewPassword );
|
|
1524 |
}
|
|
1525 |
else
|
|
1526 |
{
|
|
1527 |
tempText.CreateL( iSettingText );
|
|
1528 |
}
|
|
1529 |
|
|
1530 |
TIpsSetUiEventResult evaluation =
|
|
1531 |
EventItemEvaluateText( aBaseItem, tempText );
|
|
1532 |
|
|
1533 |
if ( evaluation == EIpsSetUiPageEventResultApproved )
|
|
1534 |
{
|
|
1535 |
// Text is ok, store the text and close editor
|
|
1536 |
aBaseItem.SetText( tempText );
|
|
1537 |
}
|
|
1538 |
// Handle disapproved item
|
|
1539 |
else if ( evaluation == EIpsSetUiPageEventResultDisapproved )
|
|
1540 |
{
|
|
1541 |
result = EIpsSetUiPageResultEditing;
|
|
1542 |
}
|
|
1543 |
// Handle cancelled item
|
|
1544 |
else
|
|
1545 |
{
|
|
1546 |
result = EIpsSetUiPageResultCancelled;
|
|
1547 |
}
|
|
1548 |
|
|
1549 |
tempText.Close();
|
|
1550 |
}
|
|
1551 |
else
|
|
1552 |
{
|
|
1553 |
iSettingPage = NULL;
|
|
1554 |
result = EIpsSetUiPageResultCancelled;
|
|
1555 |
}
|
|
1556 |
|
|
1557 |
return result;
|
|
1558 |
}
|
|
1559 |
|
|
1560 |
// ----------------------------------------------------------------------------
|
|
1561 |
// CIpsSetUiBaseDialog::SettingLaunchNumberEditorPageLD()
|
|
1562 |
// ----------------------------------------------------------------------------
|
|
1563 |
//
|
|
1564 |
TIpsSetUiPageResult CIpsSetUiBaseDialog::SettingLaunchNumberEditorPageLD(
|
|
1565 |
CIpsSetUiItem& aBaseItem,
|
|
1566 |
TIpsSetUiUpdateMode& aUpdateMode )
|
|
1567 |
{
|
|
1568 |
FUNC_LOG;
|
|
1569 |
TIpsSetUiPageResult result = EIpsSetUiPageResultOk;
|
|
1570 |
|
|
1571 |
// Convert baseitem to number editor
|
|
1572 |
CIpsSetUiItemValue* numberEdit =
|
|
1573 |
static_cast<CIpsSetUiItemValue*>( &aBaseItem );
|
|
1574 |
|
|
1575 |
// Launch the editor and fill the settings if approved
|
|
1576 |
if ( iSettingPage->ExecuteLD( aUpdateMode ) )
|
|
1577 |
{
|
|
1578 |
iSettingPage = NULL;
|
|
1579 |
TIpsSetUiEventResult evaluation =
|
|
1580 |
EventItemEvaluateValue( aBaseItem, iSettingValue );
|
|
1581 |
|
|
1582 |
// Evaluate item
|
|
1583 |
if ( evaluation == EIpsSetUiPageEventResultApproved )
|
|
1584 |
{
|
|
1585 |
// Item ok
|
|
1586 |
numberEdit->SetValue( iSettingValue );
|
|
1587 |
numberEdit->iItemSettingText->Num( iSettingValue );
|
|
1588 |
result = EIpsSetUiPageResultOk;
|
|
1589 |
}
|
|
1590 |
// Handle disapproved item
|
|
1591 |
else if ( evaluation == EIpsSetUiPageEventResultDisapproved )
|
|
1592 |
{
|
|
1593 |
result = EIpsSetUiPageResultEditing;
|
|
1594 |
}
|
|
1595 |
// Handle cancelled item
|
|
1596 |
else
|
|
1597 |
{
|
|
1598 |
result = EIpsSetUiPageResultCancelled;
|
|
1599 |
}
|
|
1600 |
}
|
|
1601 |
else
|
|
1602 |
{
|
|
1603 |
// Editor cancelled
|
|
1604 |
iSettingPage = NULL;
|
|
1605 |
result = EIpsSetUiPageResultCancelled;
|
|
1606 |
}
|
|
1607 |
|
|
1608 |
return result;
|
|
1609 |
}
|
|
1610 |
|
|
1611 |
// ----------------------------------------------------------------------------
|
|
1612 |
// CIpsSetUiBaseDialog::SettingLaunchScNumberEditorPageLD()
|
|
1613 |
// ----------------------------------------------------------------------------
|
|
1614 |
//
|
|
1615 |
TIpsSetUiPageResult CIpsSetUiBaseDialog::SettingLaunchScNumberEditorPageLD(
|
|
1616 |
CIpsSetUiItem& aBaseItem,
|
|
1617 |
TIpsSetUiUpdateMode& aUpdateMode )
|
|
1618 |
{
|
|
1619 |
FUNC_LOG;
|
|
1620 |
// Convert baseitem to number editor
|
|
1621 |
CIpsSetUiItemsEditText* textEditor =
|
|
1622 |
static_cast<CIpsSetUiItemsEditText*>( &aBaseItem );
|
|
1623 |
TIpsSetUiPageResult result = EIpsSetUiPageResultOk;
|
|
1624 |
|
|
1625 |
// Launch the editor and fill the settings if approved
|
|
1626 |
if ( iSettingPage->ExecuteLD( aUpdateMode ) )
|
|
1627 |
{
|
|
1628 |
iSettingPage = NULL;
|
|
1629 |
TIpsSetUiEventResult evaluation =
|
|
1630 |
EventItemEvaluateText( aBaseItem, iSettingText );
|
|
1631 |
|
|
1632 |
if ( evaluation == EIpsSetUiPageEventResultApproved )
|
|
1633 |
{
|
|
1634 |
// Item ok
|
|
1635 |
AknTextUtils::ConvertDigitsTo( iSettingText, EDigitTypeWestern );
|
|
1636 |
textEditor->SetText( iSettingText );
|
|
1637 |
result = EIpsSetUiPageResultOk;
|
|
1638 |
}
|
|
1639 |
// Handle disapproved item
|
|
1640 |
else if ( evaluation == EIpsSetUiPageEventResultDisapproved )
|
|
1641 |
{
|
|
1642 |
result = EIpsSetUiPageResultEditing;
|
|
1643 |
}
|
|
1644 |
// Handle cancelled item
|
|
1645 |
else
|
|
1646 |
{
|
|
1647 |
result = EIpsSetUiPageResultCancelled;
|
|
1648 |
}
|
|
1649 |
}
|
|
1650 |
else
|
|
1651 |
{
|
|
1652 |
// Editor cancelled
|
|
1653 |
iSettingPage = NULL;
|
|
1654 |
result = EIpsSetUiPageResultCancelled;
|
|
1655 |
}
|
|
1656 |
|
|
1657 |
return result;
|
|
1658 |
}
|
|
1659 |
|
|
1660 |
// ----------------------------------------------------------------------------
|
|
1661 |
// CIpsSetUiBaseDialog::SettingLaunchMultilinePageL()
|
|
1662 |
// ----------------------------------------------------------------------------
|
|
1663 |
//
|
|
1664 |
TIpsSetUiPageResult CIpsSetUiBaseDialog::SettingLaunchMultilinePageL(
|
|
1665 |
CIpsSetUiItem& aBaseItem,
|
|
1666 |
TIpsSetUiUpdateMode& aUpdateMode )
|
|
1667 |
{
|
|
1668 |
FUNC_LOG;
|
|
1669 |
TIpsSetUiEventResult result =
|
|
1670 |
SettingLaunchMultilineEditorL( aBaseItem, aUpdateMode );
|
|
1671 |
|
|
1672 |
switch ( result )
|
|
1673 |
{
|
|
1674 |
case EIpsSetUiPageEventResultApproved:
|
|
1675 |
return EIpsSetUiPageResultOk;
|
|
1676 |
|
|
1677 |
case EIpsSetUiPageEventResultDisapproved:
|
|
1678 |
return EIpsSetUiPageResultEditing;
|
|
1679 |
|
|
1680 |
default:
|
|
1681 |
case EIpsSetUiPageEventResultCancel:
|
|
1682 |
break;
|
|
1683 |
}
|
|
1684 |
|
|
1685 |
return EIpsSetUiPageResultCancelled;
|
|
1686 |
}
|
|
1687 |
|
|
1688 |
// ----------------------------------------------------------------------------
|
|
1689 |
// CIpsSetUiBaseDialog::SettingLaunchMultilineEditorL()
|
|
1690 |
// ----------------------------------------------------------------------------
|
|
1691 |
//
|
|
1692 |
TIpsSetUiEventResult CIpsSetUiBaseDialog::SettingLaunchMultilineEditorL(
|
|
1693 |
CIpsSetUiItem& /* aBaseItem */,
|
|
1694 |
TIpsSetUiUpdateMode& /* aUpdateMode */ )
|
|
1695 |
{
|
|
1696 |
FUNC_LOG;
|
|
1697 |
// This should be called from the client side
|
|
1698 |
IPS_ASSERT_DEBUG( EFalse, KErrUnknown, EBaseDialog );
|
|
1699 |
|
|
1700 |
return EIpsSetUiPageEventResultCancel;
|
|
1701 |
}
|
|
1702 |
|
|
1703 |
/******************************************************************************
|
|
1704 |
|
|
1705 |
Event handling
|
|
1706 |
|
|
1707 |
******************************************************************************/
|
|
1708 |
|
|
1709 |
// ----------------------------------------------------------------------------
|
|
1710 |
// CIpsSetUiBaseDialog::EventArrayChangedL()
|
|
1711 |
// ----------------------------------------------------------------------------
|
|
1712 |
//
|
|
1713 |
TInt CIpsSetUiBaseDialog::EventArrayChangedL(
|
|
1714 |
const TIpsSetUiArrayEvent aEvent )
|
|
1715 |
{
|
|
1716 |
FUNC_LOG;
|
|
1717 |
switch ( aEvent )
|
|
1718 |
{
|
|
1719 |
case EIpsSetUiArrayAdded:
|
|
1720 |
iListBox.HandleItemAdditionL();
|
|
1721 |
break;
|
|
1722 |
|
|
1723 |
case EIpsSetUiArrayRemoved:
|
|
1724 |
iListBox.HandleItemRemovalL();
|
|
1725 |
break;
|
|
1726 |
|
|
1727 |
// When array has changed, send event before updating listbox
|
|
1728 |
case EIpsSetUiArrayStackForward:
|
|
1729 |
case EIpsSetUiArrayStackBackward:
|
|
1730 |
EventPrepareSubArrayL(
|
|
1731 |
*GetItem( 0 ),
|
|
1732 |
aEvent == EIpsSetUiArrayStackForward ? ETrue : EFalse );
|
|
1733 |
|
|
1734 |
//lint -fallthrough
|
|
1735 |
case EIpsSetUiArrayChanged:
|
|
1736 |
iListBox.HandleItemRemovalL();
|
|
1737 |
iListBox.HandleItemAdditionL();
|
|
1738 |
break;
|
|
1739 |
}
|
|
1740 |
|
|
1741 |
return KErrNone;
|
|
1742 |
}
|
|
1743 |
|
|
1744 |
|
|
1745 |
// ----------------------------------------------------------------------------
|
|
1746 |
// CIpsSetUiBaseDialog::EventSubArrayChangeL()
|
|
1747 |
// ----------------------------------------------------------------------------
|
|
1748 |
//
|
|
1749 |
TInt CIpsSetUiBaseDialog::EventSubArrayChangeL(
|
|
1750 |
CIpsSetUiItem& /* aBaseItem */ )
|
|
1751 |
{
|
|
1752 |
FUNC_LOG;
|
|
1753 |
return KErrNone;
|
|
1754 |
}
|
|
1755 |
|
|
1756 |
// ----------------------------------------------------------------------------
|
|
1757 |
// CIpsSetUiBaseDialog::EventItemEditStartsL()
|
|
1758 |
// ----------------------------------------------------------------------------
|
|
1759 |
//
|
|
1760 |
TIpsSetUiEventResult CIpsSetUiBaseDialog::EventItemEditStartsL(
|
|
1761 |
CIpsSetUiItem& /* aBaseItem */ )
|
|
1762 |
{
|
|
1763 |
FUNC_LOG;
|
|
1764 |
return EIpsSetUiPageEventResultApproved;
|
|
1765 |
}
|
|
1766 |
|
|
1767 |
// ----------------------------------------------------------------------------
|
|
1768 |
// CIpsSetUiBaseDialog::EventItemEditEndsL()
|
|
1769 |
// ----------------------------------------------------------------------------
|
|
1770 |
//
|
|
1771 |
TInt CIpsSetUiBaseDialog::EventItemEditEndsL(
|
|
1772 |
CIpsSetUiItem& /* aBaseItem */ )
|
|
1773 |
{
|
|
1774 |
FUNC_LOG;
|
|
1775 |
return KErrNone;
|
|
1776 |
}
|
|
1777 |
|
|
1778 |
// ----------------------------------------------------------------------------
|
|
1779 |
// CIpsSetUiBaseDialog::EventItemEvaluateRadioButton()
|
|
1780 |
// ----------------------------------------------------------------------------
|
|
1781 |
//
|
|
1782 |
TIpsSetUiEventResult CIpsSetUiBaseDialog::EventItemEvaluateRadioButton(
|
|
1783 |
const CIpsSetUiItem& aBaseItem,
|
|
1784 |
TInt& aNewValue )
|
|
1785 |
{
|
|
1786 |
FUNC_LOG;
|
|
1787 |
// This check fails always
|
|
1788 |
return iItemApprover->EvaluateValue( aBaseItem, aNewValue );;
|
|
1789 |
}
|
|
1790 |
|
|
1791 |
// ----------------------------------------------------------------------------
|
|
1792 |
// CIpsSetUiBaseDialog::EventItemEvaluateValue()
|
|
1793 |
// ----------------------------------------------------------------------------
|
|
1794 |
//
|
|
1795 |
TIpsSetUiEventResult CIpsSetUiBaseDialog::EventItemEvaluateValue(
|
|
1796 |
const CIpsSetUiItem& aBaseItem,
|
|
1797 |
TInt& aNewValue )
|
|
1798 |
{
|
|
1799 |
FUNC_LOG;
|
|
1800 |
return iItemApprover->EvaluateValue( aBaseItem, aNewValue );
|
|
1801 |
}
|
|
1802 |
|
|
1803 |
// ----------------------------------------------------------------------------
|
|
1804 |
// CIpsSetUiBaseDialog::EventItemEvaluateText()
|
|
1805 |
// ----------------------------------------------------------------------------
|
|
1806 |
//
|
|
1807 |
TIpsSetUiEventResult CIpsSetUiBaseDialog::EventItemEvaluateText(
|
|
1808 |
const CIpsSetUiItem& aBaseItem,
|
|
1809 |
TDes& aNewText )
|
|
1810 |
{
|
|
1811 |
FUNC_LOG;
|
|
1812 |
// This check fails always
|
|
1813 |
return iItemApprover->EvaluateText( aBaseItem, aNewText );
|
|
1814 |
}
|
|
1815 |
|
|
1816 |
// ----------------------------------------------------------------------------
|
|
1817 |
// CIpsSetUiBaseDialog::EventCustomMdcaPoint()
|
|
1818 |
// ----------------------------------------------------------------------------
|
|
1819 |
//
|
|
1820 |
TBool CIpsSetUiBaseDialog::EventCustomMdcaPoint(
|
|
1821 |
const TUid& /* aId */,
|
|
1822 |
TPtr& /* aString */ ) const
|
|
1823 |
{
|
|
1824 |
FUNC_LOG;
|
|
1825 |
return EFalse;
|
|
1826 |
}
|
|
1827 |
|
|
1828 |
/******************************************************************************
|
|
1829 |
|
|
1830 |
Utilities
|
|
1831 |
|
|
1832 |
******************************************************************************/
|
|
1833 |
|
|
1834 |
// ----------------------------------------------------------------------------
|
|
1835 |
// CIpsSetUiBaseDialog::SettingsStartedL()
|
|
1836 |
// ----------------------------------------------------------------------------
|
|
1837 |
//
|
|
1838 |
TInt CIpsSetUiBaseDialog::SettingsStartedL()
|
|
1839 |
{
|
|
1840 |
FUNC_LOG;
|
|
1841 |
return KErrNone;
|
|
1842 |
}
|
|
1843 |
|
|
1844 |
// ----------------------------------------------------------------------------
|
|
1845 |
// CIpsSetUiBaseDialog::SettingPageResource()
|
|
1846 |
// ----------------------------------------------------------------------------
|
|
1847 |
//
|
|
1848 |
TInt CIpsSetUiBaseDialog::SettingPageResource(
|
|
1849 |
const TIpsSetUiPageResource aSettingPage ) const
|
|
1850 |
{
|
|
1851 |
FUNC_LOG;
|
|
1852 |
return ( *iSettingPageResources )[aSettingPage];
|
|
1853 |
}
|
|
1854 |
|
|
1855 |
|
|
1856 |
|
|
1857 |
// ----------------------------------------------------------------------------
|
|
1858 |
// CIpsSetUiBaseDialog::SetSettingPageResource()
|
|
1859 |
// ----------------------------------------------------------------------------
|
|
1860 |
//
|
|
1861 |
void CIpsSetUiBaseDialog::SetSettingPageResource(
|
|
1862 |
const TIpsSetUiPageResource aSettingPage,
|
|
1863 |
const TInt aResourceId )
|
|
1864 |
{
|
|
1865 |
FUNC_LOG;
|
|
1866 |
TRAP_IGNORE( iSettingPageResources->PushResourceL( aSettingPage, aResourceId ) );
|
|
1867 |
}
|
|
1868 |
|
|
1869 |
|
|
1870 |
// ----------------------------------------------------------------------------
|
|
1871 |
// CIpsSetUiBaseDialog::ShowCustomQueryL()
|
|
1872 |
// ----------------------------------------------------------------------------
|
|
1873 |
//
|
|
1874 |
TInt CIpsSetUiBaseDialog::ShowCustomQueryL(
|
|
1875 |
const TInt aResourceStringId )
|
|
1876 |
{
|
|
1877 |
FUNC_LOG;
|
|
1878 |
iQueryDialog = CAknQueryDialog::NewL();
|
|
1879 |
TInt result = iQueryDialog->ExecuteLD( aResourceStringId );
|
|
1880 |
iQueryDialog = NULL;
|
|
1881 |
return result;
|
|
1882 |
}
|
|
1883 |
|
|
1884 |
// ----------------------------------------------------------------------------
|
|
1885 |
// CIpsSetUiBaseDialog::CurrentItemIndex()
|
|
1886 |
// ----------------------------------------------------------------------------
|
|
1887 |
//
|
|
1888 |
TInt CIpsSetUiBaseDialog::CurrentItemIndex() const
|
|
1889 |
{
|
|
1890 |
FUNC_LOG;
|
|
1891 |
return iListBox.CurrentItemIndex();
|
|
1892 |
}
|
|
1893 |
|
|
1894 |
// ----------------------------------------------------------------------------
|
|
1895 |
// CIpsSetUiBaseDialog::CurrentItem()
|
|
1896 |
// ----------------------------------------------------------------------------
|
|
1897 |
//
|
|
1898 |
CIpsSetUiItem* CIpsSetUiBaseDialog::CurrentItem() const
|
|
1899 |
{
|
|
1900 |
FUNC_LOG;
|
|
1901 |
return GetItem( iListBox.CurrentItemIndex() );
|
|
1902 |
}
|
|
1903 |
|
|
1904 |
// ----------------------------------------------------------------------------
|
|
1905 |
// CIpsSetUiBaseDialog::GetValueEditorFlags()
|
|
1906 |
// ----------------------------------------------------------------------------
|
|
1907 |
//
|
|
1908 |
TInt CIpsSetUiBaseDialog::GetValueEditorFlags(
|
|
1909 |
const CIpsSetUiItem& aBaseItem )
|
|
1910 |
{
|
|
1911 |
FUNC_LOG;
|
|
1912 |
const TIpsSetUtilsFlags& itemFlags = aBaseItem.iItemFlags;
|
|
1913 |
|
|
1914 |
// Get the flags for editor
|
|
1915 |
TInt flags =
|
|
1916 |
CAknIntegerSettingPage::EInvalidValueNotOffered;
|
|
1917 |
flags |= itemFlags.ValueForFlag(
|
|
1918 |
KIpsSetUiFlagForceMustFill,
|
|
1919 |
0,
|
|
1920 |
CAknIntegerSettingPage::EEmptyValueAllowed );
|
|
1921 |
|
|
1922 |
flags |= itemFlags.ValueForFlag(
|
|
1923 |
KIpsSetUiFlagForceMustFill,
|
|
1924 |
CAknIntegerSettingPage::ENoInitialSelection,
|
|
1925 |
0 );
|
|
1926 |
|
|
1927 |
flags |= itemFlags.ValueForFlag(
|
|
1928 |
KIpsSetUiFlagForceMustFill,
|
|
1929 |
CAknIntegerSettingPage::EPutCursorAtBeginning,
|
|
1930 |
0 );
|
|
1931 |
|
|
1932 |
return flags;
|
|
1933 |
}
|
|
1934 |
|
|
1935 |
// ----------------------------------------------------------------------------
|
|
1936 |
// CIpsSetUiBaseDialog::GetTextEditorFlags()
|
|
1937 |
// ----------------------------------------------------------------------------
|
|
1938 |
//
|
|
1939 |
TInt CIpsSetUiBaseDialog::GetTextEditorFlags(
|
|
1940 |
const CIpsSetUiItem& aBaseItem )
|
|
1941 |
{
|
|
1942 |
FUNC_LOG;
|
|
1943 |
const TIpsSetUtilsFlags& itemFlags = aBaseItem.iItemFlags;
|
|
1944 |
|
|
1945 |
TInt flags =
|
|
1946 |
CAknTextSettingPage::EZeroLengthNotOffered;
|
|
1947 |
flags |= itemFlags.ValueForFlag(
|
|
1948 |
KIpsSetUiFlagForceMustFill,
|
|
1949 |
0,
|
|
1950 |
CAknTextSettingPage::EZeroLengthAllowed );
|
|
1951 |
|
|
1952 |
flags |= itemFlags.ValueForFlag(
|
|
1953 |
KIpsSetUiFlagForceMustFill,
|
|
1954 |
CAknTextSettingPage::ENoInitialSelection,
|
|
1955 |
0 );
|
|
1956 |
|
|
1957 |
flags |= itemFlags.ValueForFlag(
|
|
1958 |
KIpsSetUiFlagForceMustFill,
|
|
1959 |
CAknTextSettingPage::EPutCursorAtBeginning,
|
|
1960 |
0 );
|
|
1961 |
|
|
1962 |
return flags;
|
|
1963 |
}
|
|
1964 |
|
|
1965 |
/******************************************************************************
|
|
1966 |
|
|
1967 |
Item initialization
|
|
1968 |
|
|
1969 |
******************************************************************************/
|
|
1970 |
|
|
1971 |
// ----------------------------------------------------------------------------
|
|
1972 |
// CIpsSetUiBaseDialog::InitAnyItem()
|
|
1973 |
// ----------------------------------------------------------------------------
|
|
1974 |
//
|
|
1975 |
TInt CIpsSetUiBaseDialog::InitAnyItem(
|
|
1976 |
CIpsSetUiItem& aBaseItem,
|
|
1977 |
const TInt aValue,
|
|
1978 |
const TDesC& aText )
|
|
1979 |
{
|
|
1980 |
FUNC_LOG;
|
|
1981 |
TInt error = KErrNone;
|
|
1982 |
|
|
1983 |
// Initialize any item
|
|
1984 |
switch ( aBaseItem.Type() )
|
|
1985 |
{
|
|
1986 |
case EIpsSetUiMenuArray:
|
|
1987 |
error = InitArrayLink( aBaseItem, aText );
|
|
1988 |
break;
|
|
1989 |
|
|
1990 |
case EIpsSetUiRadioButtonArray:
|
|
1991 |
error = InitArrayRadioButton( aBaseItem, aValue, aText );
|
|
1992 |
break;
|
|
1993 |
|
|
1994 |
case EIpsSetUiCheckBoxArray:
|
|
1995 |
error = InitArrayCheckBox( aBaseItem, aValue, aText );
|
|
1996 |
break;
|
|
1997 |
|
|
1998 |
case EIpsSetUiItemText:
|
|
1999 |
error = InitItemTextEdit( aBaseItem, aText );
|
|
2000 |
break;
|
|
2001 |
|
|
2002 |
case EIpsSetUiItemValue:
|
|
2003 |
error = InitItemNumberEdit( aBaseItem, aValue, aText );
|
|
2004 |
break;
|
|
2005 |
|
|
2006 |
// Radiobutton and checkbox initialization is done during
|
|
2007 |
// the array initialization
|
|
2008 |
default:
|
|
2009 |
error = KErrNotFound;
|
|
2010 |
break;
|
|
2011 |
}
|
|
2012 |
|
|
2013 |
// Set the initialized flag on for the item
|
|
2014 |
if ( !error )
|
|
2015 |
{
|
|
2016 |
aBaseItem.iItemFlags.SetFlag32( KIpsSetUiFlagIsInitialized );
|
|
2017 |
}
|
|
2018 |
else
|
|
2019 |
{
|
|
2020 |
aBaseItem.iItemFlags.ClearFlag32( KIpsSetUiFlagIsInitialized );
|
|
2021 |
}
|
|
2022 |
|
|
2023 |
return error;
|
|
2024 |
}
|
|
2025 |
|
|
2026 |
// ----------------------------------------------------------------------------
|
|
2027 |
// CIpsSetUiBaseDialog::InitArrayLink()
|
|
2028 |
// ----------------------------------------------------------------------------
|
|
2029 |
//
|
|
2030 |
TInt CIpsSetUiBaseDialog::InitArrayLink(
|
|
2031 |
CIpsSetUiItem& aBaseItem,
|
|
2032 |
const TDesC& aText )
|
|
2033 |
{
|
|
2034 |
FUNC_LOG;
|
|
2035 |
// Convert item
|
|
2036 |
CIpsSetUiItemLink* link = static_cast<CIpsSetUiItemLink*>( &aBaseItem );
|
|
2037 |
|
|
2038 |
// Get the item count in array
|
|
2039 |
TInt items = KErrNotFound;
|
|
2040 |
if ( link->iItemLinkArray )
|
|
2041 |
{
|
|
2042 |
items = link->iItemLinkArray->Count();
|
|
2043 |
}
|
|
2044 |
|
|
2045 |
// Clear checked flag from all items
|
|
2046 |
while ( --items >= 0 )
|
|
2047 |
{
|
|
2048 |
link->iItemFlags.ClearFlag32( KIpsSetUiFlagChecked );
|
|
2049 |
|
|
2050 |
// Uncheck the buttons in the array
|
|
2051 |
CIpsSetUiItem* base = GetSubItem( aBaseItem, items );
|
|
2052 |
if ( base )
|
|
2053 |
{
|
|
2054 |
base->iItemFlags.ClearFlag32( KIpsSetUiFlagChecked );
|
|
2055 |
base = NULL;
|
|
2056 |
}
|
|
2057 |
}
|
|
2058 |
|
|
2059 |
// Set the text if provided
|
|
2060 |
if ( link->iItemSettingText )
|
|
2061 |
{
|
|
2062 |
link->iItemSettingText->Copy( aText );
|
|
2063 |
}
|
|
2064 |
|
|
2065 |
return KErrNone;
|
|
2066 |
}
|
|
2067 |
|
|
2068 |
// ----------------------------------------------------------------------------
|
|
2069 |
// CIpsSetUiBaseDialog::InitArrayRadioButton()
|
|
2070 |
// ----------------------------------------------------------------------------
|
|
2071 |
//
|
|
2072 |
TInt CIpsSetUiBaseDialog::InitArrayRadioButton(
|
|
2073 |
CIpsSetUiItem& aBaseItem,
|
|
2074 |
const TInt aValue,
|
|
2075 |
const TDesC& aText )
|
|
2076 |
{
|
|
2077 |
FUNC_LOG;
|
|
2078 |
// Convert item
|
|
2079 |
CIpsSetUiItemLinkExt* radioArray =
|
|
2080 |
static_cast<CIpsSetUiItemLinkExt*>( &aBaseItem );
|
|
2081 |
CIpsSetUiItem* base = NULL;
|
|
2082 |
|
|
2083 |
// Do normal link array initialization
|
|
2084 |
InitArrayLink( aBaseItem, KNullDesC );
|
|
2085 |
|
|
2086 |
TInt result = KErrNotFound;
|
|
2087 |
|
|
2088 |
// If the item has no value, check if any of the radiobuttons is
|
|
2089 |
// checked, and get the index from there
|
|
2090 |
if ( aValue == KErrNotFound && radioArray->iItemLinkArray )
|
|
2091 |
{
|
|
2092 |
TUid id = TUid::Uid( 0 );
|
|
2093 |
TInt index;
|
|
2094 |
FindCheckedRadiobutton( *radioArray, id, index );
|
|
2095 |
base = GetSubItem( *radioArray, id );
|
|
2096 |
|
|
2097 |
radioArray->SetValue( index );
|
|
2098 |
}
|
|
2099 |
// For listbox item, simply check one of the buttons
|
|
2100 |
else if ( aValue >= 0 && radioArray->iItemLinkArray &&
|
|
2101 |
aValue < radioArray->iItemLinkArray->Count() )
|
|
2102 |
{
|
|
2103 |
// In initialization phase, the received index value is from
|
|
2104 |
// the main resource. Get the visible array's item index
|
|
2105 |
// and setting the item checked and getting the checked item
|
|
2106 |
TInt value = GetSubItemIndex( *radioArray, aValue, EFalse );
|
|
2107 |
CheckRadioButton( *radioArray, value );
|
|
2108 |
base = GetSubItem( *radioArray, value );
|
|
2109 |
|
|
2110 |
// Set number of radiobox item to indicate the checked item
|
|
2111 |
radioArray->SetValue( value );
|
|
2112 |
result = KErrNone;
|
|
2113 |
}
|
|
2114 |
else
|
|
2115 |
{
|
|
2116 |
result = KErrNotFound;
|
|
2117 |
}
|
|
2118 |
|
|
2119 |
// Make sure the setting text exist and copy text if provided
|
|
2120 |
if ( result == KErrNone && radioArray->iItemSettingText &&
|
|
2121 |
( base && base->iItemLabel ) )
|
|
2122 |
{
|
|
2123 |
radioArray->iItemSettingText->Copy(
|
|
2124 |
aText.Length() ? aText : *base->iItemLabel );
|
|
2125 |
}
|
|
2126 |
|
|
2127 |
base = NULL;
|
|
2128 |
radioArray = NULL;
|
|
2129 |
|
|
2130 |
return result;
|
|
2131 |
}
|
|
2132 |
|
|
2133 |
// ----------------------------------------------------------------------------
|
|
2134 |
// CIpsSetUiBaseDialog::InitArrayCheckBox()
|
|
2135 |
// ----------------------------------------------------------------------------
|
|
2136 |
//
|
|
2137 |
TInt CIpsSetUiBaseDialog::InitArrayCheckBox(
|
|
2138 |
CIpsSetUiItem& aBaseItem,
|
|
2139 |
const TInt aValue,
|
|
2140 |
const TDesC& aText )
|
|
2141 |
{
|
|
2142 |
FUNC_LOG;
|
|
2143 |
// Convert item
|
|
2144 |
CIpsSetUiItemLinkExt* link =
|
|
2145 |
static_cast<CIpsSetUiItemLinkExt*>( &aBaseItem );
|
|
2146 |
CIpsSetUiItem* base;
|
|
2147 |
|
|
2148 |
// Do normal link array initialization
|
|
2149 |
InitArrayLink( aBaseItem, KNullDesC );
|
|
2150 |
link->SetValue( aValue );
|
|
2151 |
|
|
2152 |
// aValue can contain value KErrNotFound, which means 32 flags set.
|
|
2153 |
// This function trusts the user provides correct value in the field
|
|
2154 |
if ( link->iItemLinkArray )
|
|
2155 |
{
|
|
2156 |
// Get the item count in array
|
|
2157 |
TInt buttons = link->iItemLinkArray->Count();
|
|
2158 |
|
|
2159 |
// Check the checkbox buttons
|
|
2160 |
while ( --buttons >= 0 )
|
|
2161 |
{
|
|
2162 |
base = link->iItemLinkArray->At( buttons );
|
|
2163 |
if ( ( aValue >> buttons ) & 0x01 )
|
|
2164 |
{
|
|
2165 |
base->iItemFlags.SetFlag32( KIpsSetUiFlagChecked );
|
|
2166 |
}
|
|
2167 |
else
|
|
2168 |
{
|
|
2169 |
base->iItemFlags.ClearFlag32( KIpsSetUiFlagChecked );
|
|
2170 |
}
|
|
2171 |
}
|
|
2172 |
}
|
|
2173 |
|
|
2174 |
// Make sure the setting text exist and copy text if provided
|
|
2175 |
if ( link->iItemSettingText )
|
|
2176 |
{
|
|
2177 |
link->iItemSettingText->Copy( aText );
|
|
2178 |
}
|
|
2179 |
|
|
2180 |
link = NULL;
|
|
2181 |
base = NULL;
|
|
2182 |
|
|
2183 |
return KErrNone;
|
|
2184 |
}
|
|
2185 |
|
|
2186 |
// ----------------------------------------------------------------------------
|
|
2187 |
// CIpsSetUiBaseDialog::InitItemTextEdit()
|
|
2188 |
// ----------------------------------------------------------------------------
|
|
2189 |
//
|
|
2190 |
TInt CIpsSetUiBaseDialog::InitItemTextEdit(
|
|
2191 |
CIpsSetUiItem& aBaseItem,
|
|
2192 |
const TDesC& aText )
|
|
2193 |
{
|
|
2194 |
FUNC_LOG;
|
|
2195 |
CIpsSetUiItemsEditText* textEditor =
|
|
2196 |
static_cast<CIpsSetUiItemsEditText*>( &aBaseItem );
|
|
2197 |
const TDesC& temp = aText.Left( textEditor->iItemMaxLength );
|
|
2198 |
aBaseItem.SetText( temp );
|
|
2199 |
|
|
2200 |
return KErrNone;
|
|
2201 |
}
|
|
2202 |
|
|
2203 |
// ----------------------------------------------------------------------------
|
|
2204 |
// CIpsSetUiBaseDialog::InitItemNumberEdit()
|
|
2205 |
// ----------------------------------------------------------------------------
|
|
2206 |
//
|
|
2207 |
TInt CIpsSetUiBaseDialog::InitItemNumberEdit(
|
|
2208 |
CIpsSetUiItem& aBaseItem,
|
|
2209 |
const TInt aValue,
|
|
2210 |
const TDesC& aText )
|
|
2211 |
{
|
|
2212 |
FUNC_LOG;
|
|
2213 |
// Convert item
|
|
2214 |
CIpsSetUiItemValue* numberEditor =
|
|
2215 |
static_cast<CIpsSetUiItemValue*>( &aBaseItem );
|
|
2216 |
|
|
2217 |
// Fill the existing fields
|
|
2218 |
numberEditor->SetValue( aValue );
|
|
2219 |
|
|
2220 |
// Make sure all of the fields exists
|
|
2221 |
if ( numberEditor->iItemSettingText )
|
|
2222 |
{
|
|
2223 |
if ( !aText.Length() )
|
|
2224 |
{
|
|
2225 |
numberEditor->iItemSettingText->Num( aValue );
|
|
2226 |
}
|
|
2227 |
else
|
|
2228 |
{
|
|
2229 |
numberEditor->iItemSettingText->Copy( aText );
|
|
2230 |
}
|
|
2231 |
}
|
|
2232 |
|
|
2233 |
return KErrNone;
|
|
2234 |
}
|
|
2235 |
|
|
2236 |
// ----------------------------------------------------------------------------
|
|
2237 |
// CIpsSetUiBaseDialog::InitItemUnidentified()
|
|
2238 |
// ----------------------------------------------------------------------------
|
|
2239 |
//
|
|
2240 |
TInt CIpsSetUiBaseDialog::InitItemUnidentified(
|
|
2241 |
CIpsSetUiItem& /* aBaseItem */,
|
|
2242 |
const TInt /* aValue */,
|
|
2243 |
const TDesC& /* aText */ )
|
|
2244 |
{
|
|
2245 |
FUNC_LOG;
|
|
2246 |
return KErrNotFound;
|
|
2247 |
}
|
|
2248 |
|
|
2249 |
// ----------------------------------------------------------------------------
|
|
2250 |
// CIpsSetUiBaseDialog::SettingsLastItemIndex()
|
|
2251 |
// ----------------------------------------------------------------------------
|
|
2252 |
//
|
|
2253 |
TInt CIpsSetUiBaseDialog::SettingsLastItemIndex(
|
|
2254 |
const TBool aRemove ) const
|
|
2255 |
{
|
|
2256 |
FUNC_LOG;
|
|
2257 |
// Store the last index to speed up fetching and removing
|
|
2258 |
TInt lastIndex = iSettingsLastItemIndex->Count() - 1;
|
|
2259 |
|
|
2260 |
// Fetch the last item in the list and remove it
|
|
2261 |
TInt lastItem = iSettingsLastItemIndex->At( lastIndex );
|
|
2262 |
|
|
2263 |
if ( aRemove )
|
|
2264 |
{
|
|
2265 |
iSettingsLastItemIndex->Delete( lastIndex );
|
|
2266 |
}
|
|
2267 |
|
|
2268 |
// in case the array has been changed, set the new index in the boundaries
|
|
2269 |
// of the new array
|
|
2270 |
SetBetweenValues( lastItem, 0, MdcaCount() );
|
|
2271 |
|
|
2272 |
return lastItem;
|
|
2273 |
}
|
|
2274 |
|
|
2275 |
// ----------------------------------------------------------------------------
|
|
2276 |
// CIpsSetUiBaseDialog::SetSettingsLastItemIndexL()
|
|
2277 |
// ----------------------------------------------------------------------------
|
|
2278 |
//
|
|
2279 |
void CIpsSetUiBaseDialog::SetSettingsLastItemIndexL(
|
|
2280 |
const TInt aLastItemIndex )
|
|
2281 |
{
|
|
2282 |
FUNC_LOG;
|
|
2283 |
iSettingsLastItemIndex->AppendL( aLastItemIndex );
|
|
2284 |
}
|
|
2285 |
|
|
2286 |
// ----------------------------------------------------------------------------
|
|
2287 |
// CIpsSetUiBaseDialog::SetListboxEmptyTextL()
|
|
2288 |
// ----------------------------------------------------------------------------
|
|
2289 |
//
|
|
2290 |
void CIpsSetUiBaseDialog::SetListboxEmptyTextL(
|
|
2291 |
const TDesC& aText )
|
|
2292 |
{
|
|
2293 |
FUNC_LOG;
|
|
2294 |
iListBox.View()->SetListEmptyTextL( aText );
|
|
2295 |
}
|
|
2296 |
|
|
2297 |
// ----------------------------------------------------------------------------
|
|
2298 |
// CIpsSetUiBaseDialog::CurrentSettingsPage()
|
|
2299 |
// ----------------------------------------------------------------------------
|
|
2300 |
//
|
|
2301 |
CIpsSetUiItem* CIpsSetUiBaseDialog::CurrentSettingsPage(
|
|
2302 |
const TBool aRemove )
|
|
2303 |
{
|
|
2304 |
FUNC_LOG;
|
|
2305 |
// Get the last item in the array
|
|
2306 |
TInt lastIndex = iSettingsPageArray->Count() - 1;
|
|
2307 |
|
|
2308 |
// Get item
|
|
2309 |
CIpsSetUiItem* currentItem = NULL;
|
|
2310 |
|
|
2311 |
if ( lastIndex >= 0 )
|
|
2312 |
{
|
|
2313 |
currentItem = iSettingsPageArray->At( lastIndex );
|
|
2314 |
}
|
|
2315 |
|
|
2316 |
// Remove the item when required
|
|
2317 |
if ( aRemove )
|
|
2318 |
{
|
|
2319 |
iSettingsPageArray->Delete( lastIndex );
|
|
2320 |
}
|
|
2321 |
|
|
2322 |
return currentItem;
|
|
2323 |
}
|
|
2324 |
|
|
2325 |
// ----------------------------------------------------------------------------
|
|
2326 |
// CIpsSetUiBaseDialog::SetCurrentSettingsPageL()
|
|
2327 |
// ----------------------------------------------------------------------------
|
|
2328 |
//
|
|
2329 |
void CIpsSetUiBaseDialog::SetCurrentSettingsPageL(
|
|
2330 |
CIpsSetUiItem& aBaseItem )
|
|
2331 |
{
|
|
2332 |
FUNC_LOG;
|
|
2333 |
if ( iSettingsPageArray->Count() < KIpsSetUiMaxEditors )
|
|
2334 |
{
|
|
2335 |
// Set the new item as a last item
|
|
2336 |
iSettingsPageArray->AppendL( &aBaseItem );
|
|
2337 |
|
|
2338 |
// Insert the backup item to array
|
|
2339 |
AddBackupItemL( aBaseItem );
|
|
2340 |
}
|
|
2341 |
else
|
|
2342 |
{
|
|
2343 |
// Too many editors, something is wrong
|
|
2344 |
IPS_ASSERT_DEBUG( EFalse, KErrOverflow, EBaseDialog );
|
|
2345 |
}
|
|
2346 |
}
|
|
2347 |
|
|
2348 |
// ----------------------------------------------------------------------------
|
|
2349 |
// CIpsSetUiBaseDialog::CheckRadioButton()
|
|
2350 |
// ----------------------------------------------------------------------------
|
|
2351 |
//
|
|
2352 |
void CIpsSetUiBaseDialog::CheckRadioButton(
|
|
2353 |
CIpsSetUiItemLink& aRadioButtonArray,
|
|
2354 |
const TInt aRadioButtonIndex )
|
|
2355 |
{
|
|
2356 |
FUNC_LOG;
|
|
2357 |
// Make sure the array exists
|
|
2358 |
if ( aRadioButtonArray.iItemLinkArray )
|
|
2359 |
{
|
|
2360 |
CIpsSetUiBaseItemArray& array = *aRadioButtonArray.iItemLinkArray;
|
|
2361 |
|
|
2362 |
// The loop must return the index of the item from the visible list
|
|
2363 |
// All items must be searched through
|
|
2364 |
// Each item has to be checked from their hidden properties
|
|
2365 |
const TInt buttons = array.Count();
|
|
2366 |
TInt index = buttons;
|
|
2367 |
|
|
2368 |
// First, the item flags needs to be cleared
|
|
2369 |
while ( --index >= 0 )
|
|
2370 |
{
|
|
2371 |
array[index]->iItemFlags.ClearFlag32( KIpsSetUiFlagChecked );
|
|
2372 |
}
|
|
2373 |
|
|
2374 |
// Get the item from the actual list
|
|
2375 |
CIpsSetUiItem* subItem =
|
|
2376 |
GetSubItem( aRadioButtonArray, aRadioButtonIndex );
|
|
2377 |
|
|
2378 |
if ( subItem )
|
|
2379 |
{
|
|
2380 |
subItem->iItemFlags.SetFlag32( KIpsSetUiFlagChecked );
|
|
2381 |
}
|
|
2382 |
}
|
|
2383 |
}
|
|
2384 |
|
|
2385 |
// ----------------------------------------------------------------------------
|
|
2386 |
// CIpsSetUiBaseDialog::CheckRadioButton()
|
|
2387 |
// ----------------------------------------------------------------------------
|
|
2388 |
//
|
|
2389 |
void CIpsSetUiBaseDialog::CheckRadioButton(
|
|
2390 |
CIpsSetUiItemLink& aRadioButtonArray,
|
|
2391 |
const TUid& aId )
|
|
2392 |
{
|
|
2393 |
FUNC_LOG;
|
|
2394 |
// Make sure the array exists
|
|
2395 |
if ( aRadioButtonArray.iItemLinkArray )
|
|
2396 |
{
|
|
2397 |
CIpsSetUiItem* radioButton = NULL;
|
|
2398 |
|
|
2399 |
TInt buttons = aRadioButtonArray.iItemLinkArray->Count();
|
|
2400 |
|
|
2401 |
// Check the selected radiobutton
|
|
2402 |
while ( --buttons >= 0 )
|
|
2403 |
{
|
|
2404 |
radioButton = ( *aRadioButtonArray.iItemLinkArray )[buttons];
|
|
2405 |
if ( radioButton->iItemId == aId )
|
|
2406 |
{
|
|
2407 |
radioButton->iItemFlags.SetFlag32( KIpsSetUiFlagChecked );
|
|
2408 |
}
|
|
2409 |
else
|
|
2410 |
{
|
|
2411 |
radioButton->iItemFlags.ClearFlag32( KIpsSetUiFlagChecked );
|
|
2412 |
}
|
|
2413 |
}
|
|
2414 |
}
|
|
2415 |
|
|
2416 |
}
|
|
2417 |
|
|
2418 |
// ----------------------------------------------------------------------------
|
|
2419 |
// CIpsSetUiBaseDialog::FindCheckedRadiobutton()
|
|
2420 |
// ----------------------------------------------------------------------------
|
|
2421 |
//
|
|
2422 |
TInt CIpsSetUiBaseDialog::FindCheckedRadiobutton(
|
|
2423 |
const CIpsSetUiItemLinkExt& aArray,
|
|
2424 |
TUid& aId,
|
|
2425 |
TInt& aIndex )
|
|
2426 |
{
|
|
2427 |
FUNC_LOG;
|
|
2428 |
CIpsSetUiItem* radioButton = NULL;
|
|
2429 |
aId.iUid = KErrNotFound;
|
|
2430 |
aIndex = KErrNotFound;
|
|
2431 |
|
|
2432 |
if ( aArray.iItemLinkArray )
|
|
2433 |
{
|
|
2434 |
// Find the checked radio button, as there can be only one!
|
|
2435 |
for ( TInt count = aArray.iItemLinkArray->Count()-1; count >= 0; --count)
|
|
2436 |
{
|
|
2437 |
radioButton = ( *aArray.iItemLinkArray )[count];
|
|
2438 |
|
|
2439 |
// Search for the radiobuttons but ignore hidden ones,
|
|
2440 |
// even if it is checked
|
|
2441 |
if ( radioButton && !IsHidden( *radioButton ) )
|
|
2442 |
{
|
|
2443 |
++aIndex;
|
|
2444 |
|
|
2445 |
// If checked, return the value
|
|
2446 |
if ( radioButton->iItemFlags.Flag32( KIpsSetUiFlagChecked ) )
|
|
2447 |
{
|
|
2448 |
aId = radioButton->iItemId;
|
|
2449 |
return KErrNone;
|
|
2450 |
}
|
|
2451 |
}
|
|
2452 |
}
|
|
2453 |
}
|
|
2454 |
|
|
2455 |
return KErrNotFound;
|
|
2456 |
}
|
|
2457 |
|
|
2458 |
// ----------------------------------------------------------------------------
|
|
2459 |
// CIpsSetUiBaseDialog::AddBackupItemL()
|
|
2460 |
// ----------------------------------------------------------------------------
|
|
2461 |
//
|
|
2462 |
void CIpsSetUiBaseDialog::AddBackupItemL(
|
|
2463 |
const CIpsSetUiItem& aBaseItem )
|
|
2464 |
{
|
|
2465 |
FUNC_LOG;
|
|
2466 |
switch ( aBaseItem.iItemType )
|
|
2467 |
{
|
|
2468 |
case EIpsSetUiItemMultiLine:
|
|
2469 |
case EIpsSetUiRadioButtonArray:
|
|
2470 |
case EIpsSetUiCheckBoxArray:
|
|
2471 |
BackupItemCreateRadioL( aBaseItem );
|
|
2472 |
break;
|
|
2473 |
|
|
2474 |
case EIpsSetUiItemScValue:
|
|
2475 |
case EIpsSetUiItemText:
|
|
2476 |
BackupItemCreateTextL( aBaseItem );
|
|
2477 |
break;
|
|
2478 |
|
|
2479 |
case EIpsSetUiItemValue:
|
|
2480 |
BackupItemCreateValueL( aBaseItem );
|
|
2481 |
break;
|
|
2482 |
|
|
2483 |
case EIpsSetUiUndefined:
|
|
2484 |
BackupItemCreateUndefinedL( aBaseItem );
|
|
2485 |
break;
|
|
2486 |
|
|
2487 |
default:
|
|
2488 |
// No need to backup, or unsupported
|
|
2489 |
break;
|
|
2490 |
}
|
|
2491 |
}
|
|
2492 |
|
|
2493 |
// ----------------------------------------------------------------------------
|
|
2494 |
// CIpsSetUiBaseDialog::RemoveLastBackupItem()
|
|
2495 |
// ----------------------------------------------------------------------------
|
|
2496 |
//
|
|
2497 |
void CIpsSetUiBaseDialog::RemoveLastBackupItem()
|
|
2498 |
{
|
|
2499 |
FUNC_LOG;
|
|
2500 |
CIpsSetUiItem* base = GetLastBackupItem();
|
|
2501 |
iBackupArray->Delete( iBackupArray->Count() - 1 );
|
|
2502 |
|
|
2503 |
if ( base )
|
|
2504 |
{
|
|
2505 |
// With link items do not delete array, since the pointer points
|
|
2506 |
// directly to original array. So set the pointer to null before
|
|
2507 |
// deleting the item.
|
|
2508 |
if ( base->HasLinkArray() )
|
|
2509 |
{
|
|
2510 |
static_cast<CIpsSetUiItemLink*>( &*base )->iItemLinkArray = NULL;
|
|
2511 |
}
|
|
2512 |
|
|
2513 |
delete base;
|
|
2514 |
base = NULL;
|
|
2515 |
}
|
|
2516 |
}
|
|
2517 |
|
|
2518 |
// ----------------------------------------------------------------------------
|
|
2519 |
// CIpsSetUiBaseDialog::GetLastBackupItem()
|
|
2520 |
// ----------------------------------------------------------------------------
|
|
2521 |
//
|
|
2522 |
CIpsSetUiItem* CIpsSetUiBaseDialog::GetLastBackupItem()
|
|
2523 |
{
|
|
2524 |
FUNC_LOG;
|
|
2525 |
return iBackupArray->At( iBackupArray->Count() - 1 );
|
|
2526 |
}
|
|
2527 |
|
|
2528 |
// ----------------------------------------------------------------------------
|
|
2529 |
// CIpsSetUiBaseDialog::RestoreFromBackup()
|
|
2530 |
// ----------------------------------------------------------------------------
|
|
2531 |
//
|
|
2532 |
void CIpsSetUiBaseDialog::RestoreFromBackup()
|
|
2533 |
{
|
|
2534 |
FUNC_LOG;
|
|
2535 |
// Restore
|
|
2536 |
for ( TInt count = iSettingsPageArray->Count()-1; count >= 0; count-- )
|
|
2537 |
{
|
|
2538 |
TInt lastPageNum = iSettingsPageArray->Count() - 1;
|
|
2539 |
TInt lastBackupNum = iBackupArray->Count() - 1;
|
|
2540 |
CIpsSetUiItem* currentPage = iSettingsPageArray->At( lastPageNum );
|
|
2541 |
CIpsSetUiItem* backupPage = iBackupArray->At( lastBackupNum );
|
|
2542 |
|
|
2543 |
// Restore values
|
|
2544 |
const TDesC& text( ItemText( *backupPage ) );
|
|
2545 |
if ( text.Length() )
|
|
2546 |
{
|
|
2547 |
SetItemText( *currentPage, text );
|
|
2548 |
}
|
|
2549 |
|
|
2550 |
currentPage->SetValue( backupPage->Value() );
|
|
2551 |
currentPage->SetText( backupPage->Text() );
|
|
2552 |
|
|
2553 |
iSettingsPageArray->Delete( lastPageNum );
|
|
2554 |
RemoveLastBackupItem();
|
|
2555 |
}
|
|
2556 |
}
|
|
2557 |
|
|
2558 |
// ----------------------------------------------------------------------------
|
|
2559 |
// CIpsSetUiBaseDialog::CleanBackupArray()
|
|
2560 |
// ----------------------------------------------------------------------------
|
|
2561 |
//
|
|
2562 |
void CIpsSetUiBaseDialog::CleanBackupArray()
|
|
2563 |
{
|
|
2564 |
FUNC_LOG;
|
|
2565 |
for ( TInt count = iBackupArray->Count()-1; count >= 0; count-- )
|
|
2566 |
{
|
|
2567 |
RemoveLastBackupItem();
|
|
2568 |
}
|
|
2569 |
}
|
|
2570 |
|
|
2571 |
// ----------------------------------------------------------------------------
|
|
2572 |
// CIpsSetUiBaseDialog::BackupItemCreateLinkL()
|
|
2573 |
// ----------------------------------------------------------------------------
|
|
2574 |
//
|
|
2575 |
void CIpsSetUiBaseDialog::BackupItemCreateLinkL(
|
|
2576 |
const CIpsSetUiItem& aBaseItem )
|
|
2577 |
{
|
|
2578 |
FUNC_LOG;
|
|
2579 |
CIpsSetUiItemLink* linkBackup = CIpsSetUiItemLink::NewL();
|
|
2580 |
CleanupStack::PushL( linkBackup );
|
|
2581 |
const CIpsSetUiItemLink* link =
|
|
2582 |
static_cast<const CIpsSetUiItemLink*>( &aBaseItem );
|
|
2583 |
*linkBackup = *link;
|
|
2584 |
|
|
2585 |
iBackupArray->AppendL( linkBackup );
|
|
2586 |
CleanupStack::Pop( linkBackup );
|
|
2587 |
}
|
|
2588 |
|
|
2589 |
// ----------------------------------------------------------------------------
|
|
2590 |
// CIpsSetUiBaseDialog::BackupItemCreateRadioL()
|
|
2591 |
// ----------------------------------------------------------------------------
|
|
2592 |
//
|
|
2593 |
void CIpsSetUiBaseDialog::BackupItemCreateRadioL(
|
|
2594 |
const CIpsSetUiItem& aBaseItem )
|
|
2595 |
{
|
|
2596 |
FUNC_LOG;
|
|
2597 |
CIpsSetUiItemLinkExt* radioBackup = CIpsSetUiItemLinkExt::NewL();
|
|
2598 |
CleanupStack::PushL( radioBackup );
|
|
2599 |
const CIpsSetUiItemLinkExt* radio =
|
|
2600 |
static_cast<const CIpsSetUiItemLinkExt*>( &aBaseItem );
|
|
2601 |
*radioBackup = *radio;
|
|
2602 |
|
|
2603 |
iBackupArray->AppendL( radioBackup );
|
|
2604 |
CleanupStack::Pop( radioBackup );
|
|
2605 |
}
|
|
2606 |
|
|
2607 |
// ----------------------------------------------------------------------------
|
|
2608 |
// CIpsSetUiBaseDialog::BackupItemCreateValueL()
|
|
2609 |
// ----------------------------------------------------------------------------
|
|
2610 |
//
|
|
2611 |
void CIpsSetUiBaseDialog::BackupItemCreateValueL(
|
|
2612 |
const CIpsSetUiItem& aBaseItem )
|
|
2613 |
{
|
|
2614 |
FUNC_LOG;
|
|
2615 |
CIpsSetUiItemValue* valueBackup = CIpsSetUiItemValue::NewL();
|
|
2616 |
CleanupStack::PushL( valueBackup );
|
|
2617 |
const CIpsSetUiItemValue* value =
|
|
2618 |
static_cast<const CIpsSetUiItemValue*>( &aBaseItem );
|
|
2619 |
*valueBackup = *value;
|
|
2620 |
|
|
2621 |
iBackupArray->AppendL( valueBackup );
|
|
2622 |
CleanupStack::Pop( valueBackup );
|
|
2623 |
}
|
|
2624 |
|
|
2625 |
// ----------------------------------------------------------------------------
|
|
2626 |
// CIpsSetUiBaseDialog::BackupItemCreateTextL()
|
|
2627 |
// ----------------------------------------------------------------------------
|
|
2628 |
//
|
|
2629 |
void CIpsSetUiBaseDialog::BackupItemCreateTextL(
|
|
2630 |
const CIpsSetUiItem& aBaseItem )
|
|
2631 |
{
|
|
2632 |
FUNC_LOG;
|
|
2633 |
CIpsSetUiItemsEditText* textBackup = CIpsSetUiItemsEditText::NewL();
|
|
2634 |
CleanupStack::PushL( textBackup );
|
|
2635 |
const CIpsSetUiItemsEditText* text =
|
|
2636 |
static_cast<const CIpsSetUiItemsEditText*>( &aBaseItem );
|
|
2637 |
*textBackup = *text;
|
|
2638 |
|
|
2639 |
iBackupArray->AppendL( textBackup );
|
|
2640 |
CleanupStack::Pop( textBackup );
|
|
2641 |
}
|
|
2642 |
|
|
2643 |
// ----------------------------------------------------------------------------
|
|
2644 |
// CIpsSetUiBaseDialog::BackupItemCreateUndefinedL()
|
|
2645 |
// ----------------------------------------------------------------------------
|
|
2646 |
//
|
|
2647 |
void CIpsSetUiBaseDialog::BackupItemCreateUndefinedL(
|
|
2648 |
const CIpsSetUiItem& aBaseItem )
|
|
2649 |
{
|
|
2650 |
FUNC_LOG;
|
|
2651 |
CIpsSetUiItem* base = CreateItemForBackupL( aBaseItem );
|
|
2652 |
|
|
2653 |
iBackupArray->AppendL( base );
|
|
2654 |
}
|
|
2655 |
|
|
2656 |
// ----------------------------------------------------------------------------
|
|
2657 |
// CIpsSetUiBaseDialog::CreateItemForBackupL()
|
|
2658 |
// ----------------------------------------------------------------------------
|
|
2659 |
//
|
|
2660 |
CIpsSetUiItem* CIpsSetUiBaseDialog::CreateItemForBackupL(
|
|
2661 |
const CIpsSetUiItem& aBaseItem )
|
|
2662 |
{
|
|
2663 |
FUNC_LOG;
|
|
2664 |
CIpsSetUiItemLinkExt* radioBackup = CIpsSetUiItemLinkExt::NewL();
|
|
2665 |
const CIpsSetUiItemLinkExt* radio =
|
|
2666 |
static_cast<const CIpsSetUiItemLinkExt*>( &aBaseItem );
|
|
2667 |
*radioBackup = *radio;
|
|
2668 |
|
|
2669 |
return radioBackup;
|
|
2670 |
}
|
|
2671 |
|
|
2672 |
//<cmail>
|
|
2673 |
// ----------------------------------------------------------------------------
|
|
2674 |
// CIpsSetUiBaseDialog::CountInListBox()
|
|
2675 |
// ----------------------------------------------------------------------------
|
|
2676 |
//
|
|
2677 |
TInt CIpsSetUiBaseDialog::CountInListBox() const
|
|
2678 |
{
|
|
2679 |
return iListBox.Model()->NumberOfItems();
|
|
2680 |
}
|
|
2681 |
//</cmail>
|
|
2682 |
// End of File
|
|
2683 |
|