79
|
1 |
/*
|
|
2 |
* Copyright (c) 2002 - 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:
|
|
15 |
* Message centre's general settings dialog.
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
// INCLUDE FILES
|
|
22 |
|
|
23 |
#include <aknViewAppUi.h>
|
|
24 |
#include <AknDlgShut.h>
|
|
25 |
#include <muiusettingsarray.h> // CMuiuSettingsArray
|
|
26 |
|
|
27 |
#include <centralrepository.h>
|
|
28 |
#include <messaginginternalcrkeys.h>
|
|
29 |
#include <e32property.h>
|
|
30 |
#include <messaginginternalpskeys.h>
|
|
31 |
#include <e32capability.h>
|
|
32 |
|
|
33 |
#include "MceSettingsGeneralSettingsDialog.h"
|
|
34 |
#include "MceSettingsMoveProgress.h" // CMceMoveProgress
|
|
35 |
#include "MceSettingsIds.hrh"
|
|
36 |
#include "MceSettingsAccountManager.h"
|
|
37 |
#include <MceSettings.rsg>
|
|
38 |
|
|
39 |
#include <CAknMemorySelectionSettingItem.h> // CAknMemorySelectionSettingPage
|
|
40 |
#include <msvuids.h> // KUidMsvServiceEntry
|
|
41 |
#include <akninputblock.h> // CAknInputBlock
|
|
42 |
#include <aknnotewrappers.h> // CAknErrorNote
|
|
43 |
#include <bautils.h> // BaflUtils
|
|
44 |
|
|
45 |
#include <MuiuOperationWait.h> // CMuiuOperationWait
|
|
46 |
#include <sysutil.h> // Sysutil
|
|
47 |
|
|
48 |
#include <csxhelp/mce.hlp.hrh>
|
|
49 |
#include <featmgr.h>
|
|
50 |
#include <hlplch.h> // For HlpLauncher
|
|
51 |
#include "MceSettingsUtils.h"
|
|
52 |
|
|
53 |
#ifdef RD_MULTIPLE_DRIVE
|
|
54 |
#include <AknCommonDialogsDynMem.h> // Media type
|
|
55 |
#include <CAknMemorySelectionDialogMultiDrive.h> // CAknMemorySelectionDialogMultiDrive
|
|
56 |
#include <driveinfo.h> // DriveInfo
|
|
57 |
#endif //RD_MULTIPLE_DRIVE
|
|
58 |
#include <e32cmn.h> // RBuf
|
|
59 |
|
|
60 |
#include <bldvariant.hrh>
|
|
61 |
#include <data_caging_path_literals.hrh>
|
|
62 |
#include <msvids.h>
|
|
63 |
#include <mtudreg.h>
|
|
64 |
#include <miutset.h>
|
|
65 |
#include <SendUiConsts.h>
|
|
66 |
// CONSTANTS
|
|
67 |
|
|
68 |
#define KMceApplicationUidValue 0x100058C5
|
|
69 |
const TUid KMceApplicationUid = {KMceApplicationUidValue};
|
|
70 |
|
|
71 |
const TInt KMceDefaultSentItemsCount = 15;
|
|
72 |
const TInt KMceDefaultSentItemsOn = 0; // first item in list array is 'On'
|
|
73 |
const TInt KMceDefaultSentItemsOff = 1; // second item in list array is 'Off'
|
|
74 |
const TInt KMceDefaultSentItems = 1; // == On
|
|
75 |
|
|
76 |
const TInt KMceEmptyMessageStore = 40000; // size of empty message store
|
|
77 |
const TInt KMceEditorsWaitInterval = 4000000; // wait one second,that message editors close
|
|
78 |
|
|
79 |
const TInt KMSKPosition = 3;
|
|
80 |
|
|
81 |
const TInt KMceListTypeTwoRow = 0;
|
|
82 |
const TInt KMceListTypeOneRow = 1;
|
|
83 |
|
|
84 |
#define KUidMsgTypeCmailMtmVal 0x2001F406
|
|
85 |
|
|
86 |
#ifdef _DEBUG
|
|
87 |
_LIT( KPanicText, "MceSettings" );
|
|
88 |
const TInt KCRepositorySettingFailure = 1;
|
|
89 |
#endif
|
|
90 |
#ifdef RD_MESSAGING_GENERAL_SETTINGS_RENOVATION
|
|
91 |
_LIT( KMceDirAndFile,"MceSettings.rsc" );
|
|
92 |
#endif // RD_MESSAGING_GENERAL_SETTINGS_RENOVATION
|
|
93 |
|
|
94 |
// MODULE DATA STRUCTURES
|
|
95 |
enum TMceGeneralSettings
|
|
96 |
{
|
|
97 |
EMceGeneralSettingsSentItemsInUse,
|
|
98 |
EMceGeneralSettingsSentItemsCount,
|
|
99 |
EMceGeneralSettingsMemoryInUse,
|
|
100 |
EMceGeneralSettingsInboxListType,
|
|
101 |
EMceGeneralSettingsMailListType
|
|
102 |
};
|
|
103 |
// These constants are added to handle "show e-mails in groups", when R_MCE_GENERAL_SETTINGS_ITEMS is used for MCESETTINGS.
|
|
104 |
const TInt MceGeneralSettingsInboxListType = 2;
|
|
105 |
const TInt MceGeneralSettingsMailListType = 3;
|
|
106 |
#ifdef RD_MULTIPLE_DRIVE
|
|
107 |
const TInt KSpaceDelimiter=' ';
|
|
108 |
#endif //RD_MULTIPLE_DRIVE
|
|
109 |
|
|
110 |
// ================= MEMBER FUNCTIONS =======================
|
|
111 |
|
|
112 |
EXPORT_C TInt CMceGeneralSettingsDialog::CreateAndExecuteL(
|
|
113 |
CMsvSession* aSession, MMsvSessionObserver& aObserver )
|
|
114 |
{
|
|
115 |
#ifdef RD_MESSAGING_GENERAL_SETTINGS_RENOVATION
|
|
116 |
// general settings are list item in the list
|
|
117 |
CMceGeneralSettingsDialog* generalSettingsDlg =
|
|
118 |
new (ELeave) CMceGeneralSettingsDialog( aSession, aObserver, NULL );
|
|
119 |
CleanupStack::PushL( generalSettingsDlg );
|
|
120 |
generalSettingsDlg->ConstructL( R_MCE_GENERAL_SETTINGS_CHOICE_MENUBAR );
|
|
121 |
CleanupStack::Pop( generalSettingsDlg );
|
|
122 |
return generalSettingsDlg->ExecuteLD( R_MCE_GENERAL_SETTINGS );
|
|
123 |
#else
|
|
124 |
User::Leave( KErrNotSupported );
|
|
125 |
return KErrNotSupported;
|
|
126 |
#endif // RD_MESSAGING_GENERAL_SETTINGS_RENOVATION
|
|
127 |
}
|
|
128 |
|
|
129 |
// C++ default constructor can NOT contain any code that
|
|
130 |
// might leave.
|
|
131 |
// ----------------------------------------------------
|
|
132 |
// CMceGeneralSettingsDialog::Constructor
|
|
133 |
// ----------------------------------------------------
|
|
134 |
CMceGeneralSettingsDialog::CMceGeneralSettingsDialog(
|
|
135 |
CMsvSession* aSession,
|
|
136 |
MMsvSessionObserver& aObserver,
|
|
137 |
MMceSettingsAccountManager* aManager )
|
|
138 |
:
|
|
139 |
#ifdef RD_MESSAGING_GENERAL_SETTINGS_RENOVATION
|
|
140 |
CMceSettingsTitlePaneHandlerDialog(),
|
|
141 |
iSession( aSession ), iObserver( aObserver ),
|
|
142 |
iResources( *CCoeEnv::Static() ), iAccountManager( aManager ),
|
|
143 |
#else
|
|
144 |
CMceSettingsTitlePaneHandlerDialog(),
|
|
145 |
iSession( aSession ), iObserver(aObserver ), iAccountManager( aManager ),
|
|
146 |
#endif
|
|
147 |
iChangeDrive(EFalse),
|
|
148 |
iIsThirdPartyMail( EFalse )
|
|
149 |
|
|
150 |
{
|
|
151 |
}
|
|
152 |
|
|
153 |
|
|
154 |
void CMceGeneralSettingsDialog::ConstructL( TInt aResource )
|
|
155 |
{
|
|
156 |
#ifdef RD_MESSAGING_GENERAL_SETTINGS_RENOVATION
|
|
157 |
TParse fp;
|
|
158 |
fp.Set( KMceDirAndFile, &KDC_RESOURCE_FILES_DIR , NULL );
|
|
159 |
TFileName fileName = fp.FullName();
|
|
160 |
|
|
161 |
iResources.OpenL( fileName );
|
|
162 |
#endif
|
|
163 |
CMceSettingsTitlePaneHandlerDialog::ConstructL( aResource );
|
|
164 |
iIsThirdPartyMail = IsThirdPartyMailBoxL();
|
|
165 |
}
|
|
166 |
|
|
167 |
// ----------------------------------------------------
|
|
168 |
// CMceGeneralSettingsDialog::Destructor
|
|
169 |
// ----------------------------------------------------
|
|
170 |
CMceGeneralSettingsDialog::~CMceGeneralSettingsDialog()
|
|
171 |
{
|
|
172 |
#ifdef RD_MESSAGING_GENERAL_SETTINGS_RENOVATION
|
|
173 |
iResources.Close();
|
|
174 |
#endif // RD_MESSAGING_GENERAL_SETTINGS_RENOVATION
|
|
175 |
// don't delete iAccountManager
|
|
176 |
}
|
|
177 |
|
|
178 |
// ----------------------------------------------------
|
|
179 |
// CMceGeneralSettingsDialog::OkToExitL
|
|
180 |
// ----------------------------------------------------
|
|
181 |
TInt CMceGeneralSettingsDialog::OkToExitL( TInt aButtonId )
|
|
182 |
{
|
|
183 |
TBool okToExit = CAknDialog::OkToExitL( aButtonId );
|
|
184 |
if ( aButtonId == EAknSoftkeyBack || okToExit )
|
|
185 |
{
|
|
186 |
CRepository* repository = NULL;
|
|
187 |
TRAPD( ret, repository = CRepository::NewL( KCRUidMuiuSettings ) );
|
|
188 |
CleanupStack::PushL( repository );
|
|
189 |
|
|
190 |
if ( ret == KErrNone )
|
|
191 |
{
|
|
192 |
ret = repository->Set( KMuiuSentItemsInUse,
|
|
193 |
( *iMceSettingsArray )[EMceGeneralSettingsSentItemsInUse].iCurrentNumber == KMceDefaultSentItemsOn );
|
|
194 |
__ASSERT_DEBUG( !ret, User::Panic( KPanicText,KCRepositorySettingFailure ) );
|
|
195 |
#ifdef _DEBUG
|
|
196 |
TInt setValue = ( *iMceSettingsArray )[EMceGeneralSettingsSentItemsInUse].iCurrentNumber;
|
|
197 |
setValue = ( setValue == KMceDefaultSentItemsOn );
|
|
198 |
#endif
|
|
199 |
|
|
200 |
ret = repository->Set( KMuiuSentItemsCount,
|
|
201 |
( *iMceSettingsArray )[EMceGeneralSettingsSentItemsCount].iCurrentNumber );
|
|
202 |
__ASSERT_DEBUG( !ret, User::Panic(KPanicText,KCRepositorySettingFailure) );
|
|
203 |
#ifdef _DEBUG
|
|
204 |
setValue = ( *iMceSettingsArray )[EMceGeneralSettingsSentItemsCount].iCurrentNumber;
|
|
205 |
#endif
|
|
206 |
|
|
207 |
if ( iMemoryInUse )
|
|
208 |
{
|
|
209 |
ret = repository->Set( KMuiuInboxMessageListType,
|
|
210 |
( *iMceSettingsArray )[EMceGeneralSettingsInboxListType].iCurrentNumber );
|
|
211 |
}
|
|
212 |
else
|
|
213 |
{
|
|
214 |
ret = repository->Set( KMuiuInboxMessageListType,
|
|
215 |
( *iMceSettingsArray )[MceGeneralSettingsInboxListType].iCurrentNumber );
|
|
216 |
}
|
|
217 |
__ASSERT_DEBUG( !ret, User::Panic(KPanicText,KCRepositorySettingFailure) );
|
|
218 |
|
|
219 |
if ( iIsThirdPartyMail )
|
|
220 |
{
|
|
221 |
if ( iMemoryInUse )
|
|
222 |
{
|
|
223 |
ret = repository->Set( KMuiuMailMessageListType,
|
|
224 |
( *iMceSettingsArray )[EMceGeneralSettingsMailListType].iCurrentNumber );
|
|
225 |
}
|
|
226 |
else
|
|
227 |
{
|
|
228 |
ret = repository->Set( KMuiuMailMessageListType,
|
|
229 |
( *iMceSettingsArray )[MceGeneralSettingsMailListType].iCurrentNumber );
|
|
230 |
}
|
|
231 |
__ASSERT_DEBUG( !ret, User::Panic(KPanicText,KCRepositorySettingFailure) );
|
|
232 |
}
|
|
233 |
|
|
234 |
}
|
|
235 |
CleanupStack::Pop( repository );
|
|
236 |
delete repository;
|
|
237 |
}
|
|
238 |
|
|
239 |
if ( aButtonId == EMceSettingsCmdSettingsDialogOpen ||
|
|
240 |
aButtonId == EMceSettingsCmdSettingsDialogChange )
|
|
241 |
{
|
|
242 |
ProcessCommandL( aButtonId );
|
|
243 |
okToExit = EFalse; // Cannot exit, since MSK was pressed
|
|
244 |
}
|
|
245 |
else if ( aButtonId != EEikBidCancel && okToExit )
|
|
246 |
{
|
|
247 |
RestoreTitleTextL();
|
|
248 |
}
|
|
249 |
return okToExit;
|
|
250 |
}
|
|
251 |
|
|
252 |
// ----------------------------------------------------
|
|
253 |
// CMceGeneralSettingsDialog::HandleListBoxEventL
|
|
254 |
// ----------------------------------------------------
|
|
255 |
void CMceGeneralSettingsDialog::HandleListBoxEventL(
|
|
256 |
CEikListBox* /*aListBox*/,
|
|
257 |
TListBoxEvent aEventType )
|
|
258 |
{
|
|
259 |
CEikTextListBox* list=STATIC_CAST( CEikTextListBox*,
|
|
260 |
Control( EMceSettingsIdOtherItems ) );
|
|
261 |
switch(aEventType)
|
|
262 |
{
|
|
263 |
case EEventEnterKeyPressed:
|
|
264 |
case EEventItemSingleClicked:
|
|
265 |
{
|
|
266 |
TInt item = list->CurrentItemIndex();
|
|
267 |
if ( iMemoryInUse && item == EMceGeneralSettingsMemoryInUse )
|
|
268 |
{
|
|
269 |
HandleMemoryInUseDialogL();
|
|
270 |
}
|
|
271 |
else
|
|
272 |
{
|
|
273 |
iMceSettingsArray->EditItemL( item, ETrue );
|
|
274 |
list->DrawNow();
|
|
275 |
}
|
|
276 |
}
|
|
277 |
break;
|
|
278 |
|
|
279 |
default:
|
|
280 |
break;
|
|
281 |
}
|
|
282 |
}
|
|
283 |
|
|
284 |
// ----------------------------------------------------
|
|
285 |
// CMceGeneralSettingsDialog::ProcessCommandL
|
|
286 |
// ----------------------------------------------------
|
|
287 |
void CMceGeneralSettingsDialog::ProcessCommandL( TInt aCommandId )
|
|
288 |
{
|
|
289 |
CAknDialog::ProcessCommandL( aCommandId ); // hides menu
|
|
290 |
if ( aCommandId == EMceSettingsCmdSettingsDialogExit )
|
|
291 |
{
|
|
292 |
if (iAvkonViewAppUi->ExitHidesInBackground())
|
|
293 |
{
|
|
294 |
iAvkonViewAppUi->ProcessCommandL( EAknCmdHideInBackground );
|
|
295 |
}
|
|
296 |
else
|
|
297 |
{
|
|
298 |
iAvkonViewAppUi->ProcessCommandL( EAknCmdExit );
|
|
299 |
}
|
|
300 |
return;
|
|
301 |
}
|
|
302 |
|
|
303 |
|
|
304 |
CEikTextListBox* list=STATIC_CAST( CEikTextListBox*,
|
|
305 |
Control( EMceSettingsIdOtherItems ) );
|
|
306 |
|
|
307 |
switch ( aCommandId )
|
|
308 |
{
|
|
309 |
case EMceSettingsCmdSettingsDialogOpen:
|
|
310 |
{
|
|
311 |
TInt item = list->CurrentItemIndex();
|
|
312 |
if ( iMemoryInUse && item == EMceGeneralSettingsMemoryInUse )
|
|
313 |
{
|
|
314 |
HandleMemoryInUseDialogL();
|
|
315 |
}
|
|
316 |
else
|
|
317 |
{
|
|
318 |
iMceSettingsArray->EditItemL( item, EFalse );
|
|
319 |
list->DrawNow();
|
|
320 |
}
|
|
321 |
}
|
|
322 |
break;
|
|
323 |
|
|
324 |
case EMceSettingsCmdSettingsDialogHelp:
|
|
325 |
{
|
|
326 |
LaunchHelpL();
|
|
327 |
}
|
|
328 |
break;
|
|
329 |
|
|
330 |
case EMceSettingsCmdSettingsDialogChange:
|
|
331 |
{
|
|
332 |
TInt item = list->CurrentItemIndex();
|
|
333 |
if ( iMemoryInUse && item == EMceGeneralSettingsMemoryInUse )
|
|
334 |
{
|
|
335 |
HandleMemoryInUseDialogL();
|
|
336 |
}
|
|
337 |
else
|
|
338 |
{
|
|
339 |
iMceSettingsArray->EditItemL( item, ETrue );
|
|
340 |
list->DrawNow();
|
|
341 |
}
|
|
342 |
}
|
|
343 |
break;
|
|
344 |
default :
|
|
345 |
break;
|
|
346 |
}
|
|
347 |
}
|
|
348 |
|
|
349 |
|
|
350 |
// ----------------------------------------------------
|
|
351 |
// CMceGeneralSettingsDialog::PreLayoutDynInitL
|
|
352 |
// ----------------------------------------------------
|
|
353 |
void CMceGeneralSettingsDialog::PreLayoutDynInitL( )
|
|
354 |
{
|
|
355 |
//check if 'Memory in use' -option is enabled in mce settings
|
|
356 |
iMemoryInUse = ETrue;
|
|
357 |
iMemoryInUse = MceSettingsUtils::MemoryInUseOptionL();
|
|
358 |
|
|
359 |
CEikTextListBox* list=STATIC_CAST( CEikTextListBox*,
|
|
360 |
Control( EMceSettingsIdOtherItems ) );
|
|
361 |
|
|
362 |
// Setting scrollbar-indicators on
|
|
363 |
list->CreateScrollBarFrameL( ETrue );
|
|
364 |
list->ScrollBarFrame()->SetScrollBarVisibilityL(
|
|
365 |
CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto );
|
|
366 |
|
|
367 |
if ( iMemoryInUse )
|
|
368 |
{
|
|
369 |
iMceSettingsArray = CMuiuSettingsArray::NewL( R_MCE_GENERAL_MMC );
|
|
370 |
}
|
|
371 |
else
|
|
372 |
{
|
|
373 |
iMceSettingsArray = CMuiuSettingsArray::NewL( R_MCE_GENERAL_SETTINGS_ITEMS );
|
|
374 |
}
|
|
375 |
|
|
376 |
list->SetListBoxObserver( this );
|
|
377 |
|
|
378 |
CRepository* repository = NULL;
|
|
379 |
TRAPD( ret, repository = CRepository::NewL( KCRUidMuiuSettings ) );
|
|
380 |
CleanupStack::PushL( repository );
|
|
381 |
|
|
382 |
if ( ret == KErrNone )
|
|
383 |
{
|
|
384 |
TInt i;
|
|
385 |
if ( repository->Get( KMuiuSentItemsInUse, i ) != KErrNone )
|
|
386 |
{
|
|
387 |
i = KMceDefaultSentItems;
|
|
388 |
}
|
|
389 |
( *iMceSettingsArray )[EMceGeneralSettingsSentItemsInUse].iCurrentNumber =
|
|
390 |
i ? KMceDefaultSentItemsOn : KMceDefaultSentItemsOff;
|
|
391 |
|
|
392 |
if ( repository->Get(KMuiuSentItemsCount, i ) != KErrNone )
|
|
393 |
{
|
|
394 |
i = KMceDefaultSentItemsCount;
|
|
395 |
}
|
|
396 |
( *iMceSettingsArray )[EMceGeneralSettingsSentItemsCount].iCurrentNumber = i;
|
|
397 |
( *iMceSettingsArray )[EMceGeneralSettingsSentItemsCount].iUserText.Num( i );
|
|
398 |
|
|
399 |
// Get one/two row list type selection
|
|
400 |
if ( repository->Get( KMuiuInboxMessageListType, i ) != KErrNone )
|
|
401 |
{
|
|
402 |
i = KMceListTypeTwoRow;
|
|
403 |
}
|
|
404 |
if ( iMemoryInUse )
|
|
405 |
{
|
|
406 |
( *iMceSettingsArray )[EMceGeneralSettingsInboxListType].iCurrentNumber =
|
|
407 |
i ? KMceListTypeOneRow : KMceListTypeTwoRow;
|
|
408 |
}
|
|
409 |
else
|
|
410 |
{
|
|
411 |
( *iMceSettingsArray )[MceGeneralSettingsInboxListType].iCurrentNumber =
|
|
412 |
i ? KMceListTypeOneRow : KMceListTypeTwoRow;
|
|
413 |
}
|
|
414 |
|
|
415 |
if ( iIsThirdPartyMail )
|
|
416 |
{
|
|
417 |
// Get one/two row list type selection
|
|
418 |
if ( repository->Get( KMuiuMailMessageListType, i ) != KErrNone )
|
|
419 |
{
|
|
420 |
i = KMceListTypeOneRow;
|
|
421 |
}
|
|
422 |
if ( iMemoryInUse )
|
|
423 |
{
|
|
424 |
( *iMceSettingsArray )[EMceGeneralSettingsMailListType].iCurrentNumber =
|
|
425 |
i ? KMceListTypeOneRow : KMceListTypeTwoRow;
|
|
426 |
}
|
|
427 |
else
|
|
428 |
{
|
|
429 |
( *iMceSettingsArray )[MceGeneralSettingsMailListType].iCurrentNumber =
|
|
430 |
i ? KMceListTypeOneRow : KMceListTypeTwoRow;
|
|
431 |
}
|
|
432 |
}
|
|
433 |
else
|
|
434 |
{
|
|
435 |
if ( iMemoryInUse )
|
|
436 |
{
|
|
437 |
delete (*iMceSettingsArray)[EMceGeneralSettingsMailListType].iMuiuSettingsItemArray;
|
|
438 |
iMceSettingsArray->Delete(EMceGeneralSettingsMailListType);
|
|
439 |
}
|
|
440 |
else
|
|
441 |
{
|
|
442 |
delete (*iMceSettingsArray)[MceGeneralSettingsMailListType].iMuiuSettingsItemArray;
|
|
443 |
iMceSettingsArray->Delete(MceGeneralSettingsMailListType);
|
|
444 |
}
|
|
445 |
}
|
|
446 |
}
|
|
447 |
|
|
448 |
if ( iMemoryInUse )
|
|
449 |
{
|
|
450 |
UpdateMemorySelectionL();
|
|
451 |
}
|
|
452 |
|
|
453 |
CleanupStack::Pop( repository );
|
|
454 |
delete repository;
|
|
455 |
|
|
456 |
CTextListBoxModel* model=list->Model();
|
|
457 |
model->SetItemTextArray( iMceSettingsArray );
|
|
458 |
|
|
459 |
StoreTitleTextAndSetNewL( R_MCE_SETTINGS_TITLE_GENERAL );
|
|
460 |
SetMSKButtonL();
|
|
461 |
}
|
|
462 |
|
|
463 |
// ----------------------------------------------------
|
|
464 |
// CMceGeneralSettingsDialog::SetTransferError
|
|
465 |
// Catches the error when failed moving message store
|
|
466 |
// ----------------------------------------------------
|
|
467 |
void CMceGeneralSettingsDialog::SetTransferError( TInt aError )
|
|
468 |
{
|
|
469 |
iTransferError = aError;
|
|
470 |
}
|
|
471 |
|
|
472 |
// ----------------------------------------------------
|
|
473 |
// CMceGeneralSettingsDialog::MoveMessageStoreL
|
|
474 |
// starts copying/moving message store
|
|
475 |
// if move, aDeleteCopiedStore is ETrue, if copy EFalse
|
|
476 |
// ----------------------------------------------------
|
|
477 |
void CMceGeneralSettingsDialog::MoveMessageStoreL( TInt currentDrive,
|
|
478 |
TInt driveNumber, TBool aDeleteCopiedStore )
|
|
479 |
{
|
|
480 |
if( !CheckIsServerBusyL() )
|
|
481 |
{
|
|
482 |
CAknInputBlock* comAbs=CAknInputBlock::NewLC();
|
|
483 |
iTransferError = KErrNone;
|
|
484 |
CMceMoveProgress* moveProgress=CMceMoveProgress::NewL(
|
|
485 |
iSession, iObserver, currentDrive, driveNumber, aDeleteCopiedStore,*this, EFalse );
|
|
486 |
|
|
487 |
CleanupStack::PushL( moveProgress );
|
|
488 |
if ( iAccountManager )
|
|
489 |
{
|
|
490 |
iAccountManager->SetChangeMessageStore( EFalse );
|
|
491 |
}
|
|
492 |
|
|
493 |
moveProgress->InitializingL();
|
|
494 |
|
|
495 |
// KErrAccessDenied: when MC is read-only
|
|
496 |
// preventing messaging close. Todo: anyother erro cases?
|
|
497 |
if ( iTransferError != KErrAccessDenied && iAccountManager )
|
|
498 |
{
|
|
499 |
iAccountManager->SetChangeMessageStore( ETrue );
|
|
500 |
}
|
|
501 |
|
|
502 |
// cannot delete CMceMoveProgress,
|
|
503 |
// because CMceMessageTransHandler is cancelled-> has to be deleted in CMceMoveProgress
|
|
504 |
CleanupStack::Pop( moveProgress );
|
|
505 |
CleanupStack::PopAndDestroy( comAbs );
|
|
506 |
}
|
|
507 |
}
|
|
508 |
|
|
509 |
|
|
510 |
// ----------------------------------------------------
|
|
511 |
// CMceGeneralSettingsDialog::CheckIsServerBusyL
|
|
512 |
// checks, if connection is on
|
|
513 |
// return ETrue, if connection is on
|
|
514 |
// ----------------------------------------------------
|
|
515 |
TBool CMceGeneralSettingsDialog::CheckIsServerBusyL()
|
|
516 |
{
|
|
517 |
TInt outstanding=iSession->OutstandingOperationsL();
|
|
518 |
|
|
519 |
if (outstanding==0)
|
|
520 |
{
|
|
521 |
// check to see if any mailboxes are open - otherwise we could miss client side operations
|
|
522 |
CMsvEntry* root=CMsvEntry::NewL( *iSession,
|
|
523 |
KMsvRootIndexEntryIdValue,
|
|
524 |
TMsvSelectionOrdering(KMsvNoGrouping, EMsvSortByNone, ETrue ) );
|
|
525 |
CleanupStack::PushL( root );
|
|
526 |
CMsvEntrySelection* sel=root->ChildrenWithTypeL( KUidMsvServiceEntry );
|
|
527 |
CleanupStack::PushL( sel );
|
|
528 |
const TMsvEntry* tentry=NULL;
|
|
529 |
for ( TInt cc=sel->Count(); --cc>=0 && !outstanding ;)
|
|
530 |
{
|
|
531 |
tentry=&( root->ChildDataL( ( *sel )[cc] ) );
|
|
532 |
if ( tentry->Connected() )
|
|
533 |
{
|
|
534 |
outstanding++;
|
|
535 |
}
|
|
536 |
}
|
|
537 |
|
|
538 |
CleanupStack::PopAndDestroy( sel );
|
|
539 |
CleanupStack::PopAndDestroy( root );
|
|
540 |
}
|
|
541 |
|
|
542 |
if (outstanding>0)
|
|
543 |
{
|
|
544 |
HBufC* text = StringLoader::LoadLC( R_MCE_SETTINGS_SERVER_BUSY, CCoeEnv::Static() );
|
|
545 |
CAknErrorNote* note = new ( ELeave ) CAknErrorNote();
|
|
546 |
note->ExecuteLD( *text );
|
|
547 |
CleanupStack::PopAndDestroy( text );
|
|
548 |
return ETrue;
|
|
549 |
}
|
|
550 |
|
|
551 |
return EFalse;
|
|
552 |
}
|
|
553 |
|
|
554 |
// ----------------------------------------------------
|
|
555 |
// CMceGeneralSettingsDialog::FindSourcePathL
|
|
556 |
// gives message store path in aPath, when drive number is got
|
|
557 |
//
|
|
558 |
// ----------------------------------------------------
|
|
559 |
void CMceGeneralSettingsDialog::FindSourcePathL( TInt aDrive, TFileName& aPath ) const
|
|
560 |
{
|
|
561 |
GetMessageDriveL( aDrive, aPath );
|
|
562 |
TParsePtrC pptr( KMsvDefaultFolder );
|
|
563 |
aPath.Append( pptr.Path() );
|
|
564 |
}
|
|
565 |
|
|
566 |
// ----------------------------------------------------
|
|
567 |
// CMceGeneralSettingsDialog::GetMessageDriveL
|
|
568 |
// gives drive letter and drive delimiter in aPath,
|
|
569 |
// when drive number is got
|
|
570 |
// ----------------------------------------------------
|
|
571 |
void CMceGeneralSettingsDialog::GetMessageDriveL( TInt aDrive, TDes& aPath ) const
|
|
572 |
{
|
|
573 |
TChar driveLetter;
|
|
574 |
User::LeaveIfError( iEikonEnv->FsSession().DriveToChar( aDrive, driveLetter ) );
|
|
575 |
aPath.Zero();
|
|
576 |
aPath.Append( driveLetter );
|
|
577 |
aPath.Append( TChar( KDriveDelimiter ) );
|
|
578 |
}
|
|
579 |
|
|
580 |
// ----------------------------------------------------
|
|
581 |
// CMceGeneralSettingsDialog::UpdateMemorySelectionL
|
|
582 |
// sets correct string in General settings memory in use -option
|
|
583 |
//
|
|
584 |
// ----------------------------------------------------
|
|
585 |
void CMceGeneralSettingsDialog::UpdateMemorySelectionL()
|
|
586 |
{
|
|
587 |
RFs& fs=iEikonEnv->FsSession();
|
|
588 |
|
|
589 |
#ifndef RD_MULTIPLE_DRIVE
|
|
590 |
if ( TInt( iSession->CurrentDriveL() ) == EDriveC )
|
|
591 |
{
|
|
592 |
HBufC* text = StringLoader::LoadLC( R_MCE_SETTINGS_PHONE_MEMORY, iEikonEnv );
|
|
593 |
|
|
594 |
( *iMceSettingsArray )[EMceGeneralSettingsMemoryInUse].iUserText.Copy( *text );
|
|
595 |
CleanupStack::PopAndDestroy( text );
|
|
596 |
}
|
|
597 |
else
|
|
598 |
{
|
|
599 |
TVolumeInfo volumeinfo;
|
|
600 |
fs.Volume( volumeinfo, TInt(iSession->CurrentDriveL() ) );
|
|
601 |
if( volumeinfo.iName.Length() > 0 ) // Volume has a label
|
|
602 |
{ // Use volume label as memory card name
|
|
603 |
( *iMceSettingsArray )[EMceGeneralSettingsMemoryInUse].iUserText.Copy( volumeinfo.iName );
|
|
604 |
}
|
|
605 |
else
|
|
606 |
{
|
|
607 |
HBufC* text = StringLoader::LoadLC( R_MCE_SETTINGS_MEMORY_CARD, iEikonEnv );
|
|
608 |
( *iMceSettingsArray )[EMceGeneralSettingsMemoryInUse].iUserText.Copy( *text );
|
|
609 |
CleanupStack::PopAndDestroy( text );
|
|
610 |
}
|
|
611 |
}
|
|
612 |
|
|
613 |
#else
|
|
614 |
TInt currentDrive = TInt( iSession->CurrentDriveL() );
|
|
615 |
|
|
616 |
TVolumeInfo volumeinfo;
|
|
617 |
fs.Volume( volumeinfo, TInt( currentDrive ) );
|
|
618 |
if( volumeinfo.iName.Length() > 0 ) // Volume has a label
|
|
619 |
{ // Use volume label as memory card name
|
|
620 |
TDriveName driveName(TDriveUnit( currentDrive ).Name() );
|
|
621 |
RBuf newtxt;
|
|
622 |
newtxt.CreateL( driveName.Length() + volumeinfo.iName.Length() + 1 ); // 1 for space
|
|
623 |
CleanupClosePushL( newtxt );
|
|
624 |
|
|
625 |
newtxt.Append( driveName );
|
|
626 |
newtxt.Append( KSpaceDelimiter );
|
|
627 |
newtxt.Append( volumeinfo.iName );
|
|
628 |
|
|
629 |
( *iMceSettingsArray )[EMceGeneralSettingsMemoryInUse].iUserText.Copy( newtxt );
|
|
630 |
CleanupStack::PopAndDestroy( &newtxt );
|
|
631 |
}
|
|
632 |
else
|
|
633 |
{
|
|
634 |
HBufC *driveNameText = MakeDriveNameStringLC( currentDrive );
|
|
635 |
( *iMceSettingsArray )[EMceGeneralSettingsMemoryInUse].iUserText.Copy( *driveNameText );
|
|
636 |
CleanupStack::PopAndDestroy( driveNameText );
|
|
637 |
}
|
|
638 |
|
|
639 |
#endif //RD_MULTIPLE_DRIVE
|
|
640 |
CEikTextListBox* list=STATIC_CAST( CEikTextListBox*,
|
|
641 |
Control( EMceSettingsIdOtherItems ) );
|
|
642 |
list->DrawNow();
|
|
643 |
|
|
644 |
CRepository* repository = NULL;
|
|
645 |
TRAPD( ret, repository = CRepository::NewL( KCRUidMuiuSettings ) );
|
|
646 |
CleanupStack::PushL( repository );
|
|
647 |
|
|
648 |
if ( ret == KErrNone )
|
|
649 |
{
|
|
650 |
ret = repository->Set( KMuiuMemoryInUse, TInt( iSession->CurrentDriveL() ) );
|
|
651 |
__ASSERT_DEBUG( !ret, User::Panic( KPanicText,KCRepositorySettingFailure ) );
|
|
652 |
}
|
|
653 |
|
|
654 |
CleanupStack::Pop( repository );
|
|
655 |
delete repository;
|
|
656 |
}
|
|
657 |
|
|
658 |
// ----------------------------------------------------
|
|
659 |
// CMceGeneralSettingsDialog::ShutdownAppsL
|
|
660 |
// closes sms, mms and mail applications,
|
|
661 |
// before changing message store
|
|
662 |
// ----------------------------------------------------
|
|
663 |
TBool CMceGeneralSettingsDialog::ShutdownAppsL() const
|
|
664 |
{
|
|
665 |
RProperty property;
|
|
666 |
|
|
667 |
User::LeaveIfError( property.Attach( KPSUidMuiu,KMuiuSysOpenMsgEditors ) );
|
|
668 |
CleanupClosePushL( property );
|
|
669 |
|
|
670 |
TInt i = 0;
|
|
671 |
if ( property.Get(i) != KErrNone )
|
|
672 |
{
|
|
673 |
i = 0;
|
|
674 |
}
|
|
675 |
if ( i != 0 )
|
|
676 |
{
|
|
677 |
// clients are open
|
|
678 |
CAknQueryDialog* closeDialog = CAknQueryDialog::NewL();
|
|
679 |
|
|
680 |
HBufC* text = NULL;
|
|
681 |
text = StringLoader::LoadLC( R_MCE_CLOSE_MESSAGES_CONFIRM, CCoeEnv::Static() );
|
|
682 |
closeDialog->SetPromptL( *text );
|
|
683 |
CleanupStack::PopAndDestroy( text );
|
|
684 |
|
|
685 |
// Do you want to close all the open messages?
|
|
686 |
if ( !closeDialog->ExecuteLD( R_MCE_MOVE_CONFIRM ) )
|
|
687 |
{
|
|
688 |
CleanupStack::PopAndDestroy( &property );
|
|
689 |
return EFalse;
|
|
690 |
}
|
|
691 |
else
|
|
692 |
{
|
|
693 |
i = 0;
|
|
694 |
property.Set( KPSUidMuiu, KMuiuSysOpenMsgEditors, i );
|
|
695 |
|
|
696 |
// wait a second
|
|
697 |
User::After( KMceEditorsWaitInterval );
|
|
698 |
}
|
|
699 |
}
|
|
700 |
CleanupStack::PopAndDestroy( &property );
|
|
701 |
return ETrue;
|
|
702 |
}
|
|
703 |
|
|
704 |
|
|
705 |
// ----------------------------------------------------
|
|
706 |
// CMceGeneralSettingsDialog::HandleMemoryInUseDialogL
|
|
707 |
// handles Memory in Use option
|
|
708 |
//
|
|
709 |
// ----------------------------------------------------
|
|
710 |
void CMceGeneralSettingsDialog::HandleMemoryInUseDialogL()
|
|
711 |
{
|
|
712 |
if ( !ShutdownAppsL() )
|
|
713 |
{
|
|
714 |
// User does not want to close open messages
|
|
715 |
return;
|
|
716 |
}
|
|
717 |
|
|
718 |
if(iChangeDrive)
|
|
719 |
{
|
|
720 |
return;
|
|
721 |
}
|
|
722 |
|
|
723 |
RFs& fs=iEikonEnv->FsSession();
|
|
724 |
|
|
725 |
#ifdef RD_MULTIPLE_DRIVE
|
|
726 |
// Memory selection dialog from Avkon
|
|
727 |
CAknMemorySelectionDialogMultiDrive* dlg = CAknMemorySelectionDialogMultiDrive::NewL(
|
|
728 |
ECFDDialogTypeNormal,
|
|
729 |
0, // Default resource Id
|
|
730 |
EFalse,
|
|
731 |
AknCommonDialogsDynMem::EMemoryTypePhone |
|
|
732 |
AknCommonDialogsDynMem::EMemoryTypeInternalMassStorage |
|
|
733 |
AknCommonDialogsDynMem::EMemoryTypeMMCExternal );
|
|
734 |
|
|
735 |
CleanupStack::PushL( dlg );
|
|
736 |
TInt currentDrive = TInt( iSession->CurrentDriveL() );
|
|
737 |
TDriveNumber driveNumber = static_cast<TDriveNumber>( currentDrive );
|
|
738 |
CAknMemorySelectionDialogMultiDrive::TReturnKey value = dlg->ExecuteL( driveNumber );
|
|
739 |
CleanupStack::PopAndDestroy( dlg );
|
|
740 |
|
|
741 |
TInt selectedDrive;
|
|
742 |
//if the user didn't press cancel key
|
|
743 |
if (value != CAknMemorySelectionDialogMultiDrive::ERightSoftkey )
|
|
744 |
{
|
|
745 |
selectedDrive = static_cast<TInt>( driveNumber );
|
|
746 |
}
|
|
747 |
// if the user press cancel
|
|
748 |
else
|
|
749 |
{
|
|
750 |
return;
|
|
751 |
}
|
|
752 |
|
|
753 |
#else
|
|
754 |
TInt currentDrive = TInt( iSession->CurrentDriveL() );
|
|
755 |
CAknMemorySelectionSettingPage::TMemory memory( CAknMemorySelectionSettingPage::EPhoneMemory );
|
|
756 |
|
|
757 |
CAknMemorySelectionSettingPage* dlg = CAknMemorySelectionSettingPage::NewL();
|
|
758 |
CleanupStack::PushL( dlg );
|
|
759 |
|
|
760 |
HBufC* text = StringLoader::LoadLC( R_MCE_SETTINGS_GEN_HEADING, iEikonEnv );
|
|
761 |
dlg->SetTitleL( *text );
|
|
762 |
CleanupStack::PopAndDestroy( text );
|
|
763 |
|
|
764 |
if ( currentDrive == EDriveC )
|
|
765 |
{
|
|
766 |
memory = CAknMemorySelectionSettingPage::EPhoneMemory;
|
|
767 |
}
|
|
768 |
else
|
|
769 |
{
|
|
770 |
memory = CAknMemorySelectionSettingPage::EMemoryCard;
|
|
771 |
}
|
|
772 |
|
|
773 |
CAknMemorySelectionSettingPage::TReturnKey value = dlg->ExecuteL( memory );
|
|
774 |
CleanupStack::PopAndDestroy( dlg );
|
|
775 |
|
|
776 |
if ( value == CAknMemorySelectionSettingPage::ERightSoftkey )
|
|
777 |
//Cancel was pressed;
|
|
778 |
{
|
|
779 |
return;
|
|
780 |
}
|
|
781 |
|
|
782 |
TInt selectedDrive;
|
|
783 |
if ( memory == CAknMemorySelectionSettingPage::EPhoneMemory )
|
|
784 |
{
|
|
785 |
selectedDrive = EDriveC;
|
|
786 |
}
|
|
787 |
else
|
|
788 |
{
|
|
789 |
selectedDrive = EDriveE;
|
|
790 |
}
|
|
791 |
#endif // RD_MULTIPLE_DRIVE
|
|
792 |
|
|
793 |
if (selectedDrive == currentDrive )
|
|
794 |
{
|
|
795 |
// no change, memory has not been changed
|
|
796 |
UpdateMemorySelectionL();
|
|
797 |
return;
|
|
798 |
}
|
|
799 |
else
|
|
800 |
{
|
|
801 |
TBool storeExist = EFalse;
|
|
802 |
TRAPD( error, storeExist = iSession->DriveContainsStoreL( selectedDrive ) );
|
|
803 |
|
|
804 |
if ( !error && storeExist )
|
|
805 |
{
|
|
806 |
//if server is busy, do not change store
|
|
807 |
if( CheckIsServerBusyL() )
|
|
808 |
{
|
|
809 |
return;
|
|
810 |
}
|
|
811 |
CAknInputBlock* comAbs=CAknInputBlock::NewLC();
|
|
812 |
// change message store
|
|
813 |
CMuiuOperationWait* waiter=CMuiuOperationWait::NewLC();
|
|
814 |
|
|
815 |
CMsvProgressReporterOperation* reportOp =
|
|
816 |
CMsvProgressReporterOperation::NewL( *iSession, waiter->iStatus );
|
|
817 |
CleanupStack::PushL( reportOp );
|
|
818 |
|
|
819 |
reportOp->SetProgressVisibilityDelay(EFalse);
|
|
820 |
HBufC* text = StringLoader::LoadLC( R_MCE_SETTINGS_SWITCHING_MESSAGE_STORE,
|
|
821 |
iEikonEnv );
|
|
822 |
reportOp->SetTitleL( *text );
|
|
823 |
|
|
824 |
reportOp->SetCanCancelL( EFalse);
|
|
825 |
|
|
826 |
CleanupStack::PopAndDestroy( text );
|
|
827 |
iChangeDrive = ETrue;
|
|
828 |
CMsvOperation* changeOp=iSession->ChangeDriveL( selectedDrive, reportOp->RequestStatus() );
|
|
829 |
reportOp->SetOperationL( changeOp );
|
|
830 |
|
|
831 |
waiter->Start();
|
|
832 |
iChangeDrive = EFalse;
|
|
833 |
CleanupStack::PopAndDestroy( reportOp );
|
|
834 |
CleanupStack::PopAndDestroy( waiter );
|
|
835 |
CleanupStack::PopAndDestroy( comAbs );
|
|
836 |
|
|
837 |
//memory has been changed
|
|
838 |
UpdateMemorySelectionL();
|
|
839 |
}
|
|
840 |
else
|
|
841 |
{
|
|
842 |
//#ifdef RD_MULTIPLE_DRIVE
|
|
843 |
// //Todo: Check the memory statue here, if it's read-only then show error note
|
|
844 |
// // Wait for UIcr approved
|
|
845 |
// TUint driveStatus( 0 );
|
|
846 |
// User::LeaveIfError( DriveInfo::GetDriveStatus( fs, driveNumber, driveStatus ) );
|
|
847 |
// if ( driveStatus & DriveInfo::EDriveReadOnly )
|
|
848 |
// {
|
|
849 |
// HBufC* text = StringLoader::LoadLC( R_MCE_SETTINGS_CANNOT_MOVE_STORE,
|
|
850 |
// CCoeEnv::Static() );
|
|
851 |
// CAknErrorNote* note = new (ELeave) CAknErrorNote();
|
|
852 |
// note->ExecuteLD(*text);
|
|
853 |
// CleanupStack::PopAndDestroy( text );
|
|
854 |
//
|
|
855 |
// return;
|
|
856 |
// }
|
|
857 |
//#endif
|
|
858 |
|
|
859 |
// copy/move message store
|
|
860 |
CAknQueryDialog* moveDialog = CAknQueryDialog::NewL();
|
|
861 |
|
|
862 |
// Do you want to copy all messages to the messaging store?
|
|
863 |
if ( moveDialog->ExecuteLD( R_MCE_MOVE_CONFIRM ) )
|
|
864 |
{
|
|
865 |
// Yes:
|
|
866 |
// other question: Do you want to save the original messages?
|
|
867 |
CAknQueryDialog* movesaveDialog = CAknQueryDialog::NewL();
|
|
868 |
|
|
869 |
HBufC* text = NULL;
|
|
870 |
text = StringLoader::LoadLC( R_MCE_MOVE_SAVE_CONFIRM, CCoeEnv::Static() );
|
|
871 |
movesaveDialog->SetPromptL( *text );
|
|
872 |
CleanupStack::PopAndDestroy( text );
|
|
873 |
|
|
874 |
if ( movesaveDialog->ExecuteLD( R_MCE_MOVE_CONFIRM ) )
|
|
875 |
{
|
|
876 |
//Yes: Copy messages
|
|
877 |
MoveMessageStoreL( currentDrive, selectedDrive, EFalse );
|
|
878 |
}
|
|
879 |
else
|
|
880 |
{
|
|
881 |
//No: Move messages
|
|
882 |
MoveMessageStoreL( currentDrive, selectedDrive, ETrue );
|
|
883 |
}
|
|
884 |
}
|
|
885 |
else
|
|
886 |
{
|
|
887 |
// No: show empty message storage
|
|
888 |
|
|
889 |
//if server is busy, do not change store
|
|
890 |
if( CheckIsServerBusyL() )
|
|
891 |
{
|
|
892 |
return;
|
|
893 |
}
|
|
894 |
|
|
895 |
// when empty store is created, it takes memory about 40kb
|
|
896 |
// check first free memory
|
|
897 |
if ( SysUtil::DiskSpaceBelowCriticalLevelL( &iEikonEnv->FsSession(),
|
|
898 |
KMceEmptyMessageStore, selectedDrive ) )
|
|
899 |
{
|
|
900 |
User::Leave( KErrDiskFull );
|
|
901 |
}
|
|
902 |
CAknInputBlock* comAbs=CAknInputBlock::NewLC();
|
|
903 |
CMuiuOperationWait* waiter=CMuiuOperationWait::NewLC();
|
|
904 |
|
|
905 |
CMsvProgressReporterOperation* reportOp =
|
|
906 |
CMsvProgressReporterOperation::NewL( *iSession, waiter->iStatus );
|
|
907 |
CleanupStack::PushL( reportOp );
|
|
908 |
|
|
909 |
reportOp->SetProgressVisibilityDelay(EFalse);
|
|
910 |
HBufC* text = StringLoader::LoadLC( R_MCE_SETTINGS_SWITCHING_MESSAGE_STORE,
|
|
911 |
iEikonEnv );
|
|
912 |
reportOp->SetTitleL( *text );
|
|
913 |
|
|
914 |
reportOp->SetCanCancelL( EFalse);
|
|
915 |
|
|
916 |
CleanupStack::PopAndDestroy( text );
|
|
917 |
iChangeDrive = ETrue;
|
|
918 |
CMsvOperation* changeOp=iSession->ChangeDriveL( selectedDrive,
|
|
919 |
reportOp->RequestStatus() );
|
|
920 |
reportOp->SetOperationL( changeOp );
|
|
921 |
|
|
922 |
waiter->Start();
|
|
923 |
iChangeDrive = EFalse;
|
|
924 |
CleanupStack::PopAndDestroy( reportOp );
|
|
925 |
CleanupStack::PopAndDestroy( waiter );
|
|
926 |
CleanupStack::PopAndDestroy( comAbs );
|
|
927 |
UpdateMemorySelectionL();
|
|
928 |
}
|
|
929 |
}
|
|
930 |
|
|
931 |
CEikTextListBox* list=STATIC_CAST( CEikTextListBox*,
|
|
932 |
Control( EMceSettingsIdOtherItems ) );
|
|
933 |
list->DrawNow();
|
|
934 |
}
|
|
935 |
}
|
|
936 |
|
|
937 |
|
|
938 |
// ----------------------------------------------------
|
|
939 |
// CMceGeneralSettingsDialog::GetHelpContext
|
|
940 |
// returns helpcontext as aContext
|
|
941 |
//
|
|
942 |
// ----------------------------------------------------
|
|
943 |
void CMceGeneralSettingsDialog::GetHelpContext
|
|
944 |
( TCoeHelpContext& aContext ) const
|
|
945 |
{
|
|
946 |
aContext.iMajor = KMceApplicationUid;
|
|
947 |
aContext.iContext = KMCE_HLP_SETTINGS_GEN;
|
|
948 |
}
|
|
949 |
|
|
950 |
// ----------------------------------------------------
|
|
951 |
// CMceGeneralSettingsDialog::DynInitMenuPaneL
|
|
952 |
// ----------------------------------------------------
|
|
953 |
void CMceGeneralSettingsDialog::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane )
|
|
954 |
{
|
|
955 |
if ( aResourceId == R_MCE_GENERAL_SETTINGS_CHOICE_MENUPANE )
|
|
956 |
{
|
|
957 |
aMenuPane->SetItemDimmed( EMceSettingsCmdSettingsDialogHelp,
|
|
958 |
!FeatureManager::FeatureSupported( KFeatureIdHelp ) );
|
|
959 |
}
|
|
960 |
}
|
|
961 |
|
|
962 |
// ----------------------------------------------------
|
|
963 |
// CMceGeneralSettingsDialog::LaunchHelpL
|
|
964 |
// Launch help using context
|
|
965 |
//
|
|
966 |
// ----------------------------------------------------
|
|
967 |
void CMceGeneralSettingsDialog::LaunchHelpL() const
|
|
968 |
{
|
|
969 |
CCoeAppUi* appUi = STATIC_CAST( CCoeAppUi*, ControlEnv()->AppUi() );
|
|
970 |
CArrayFix<TCoeHelpContext>* helpContext = appUi->AppHelpContextL();
|
|
971 |
HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(), helpContext );
|
|
972 |
}
|
|
973 |
|
|
974 |
// ----------------------------------------------------
|
|
975 |
// CMceGeneralSettingsDialog::ChangeMessageStoreL
|
|
976 |
// Changes the drive of the message store
|
|
977 |
//
|
|
978 |
// ----------------------------------------------------
|
|
979 |
#ifdef RD_MULTIPLE_DRIVE
|
|
980 |
void CMceGeneralSettingsDialog::ChangeMessageStoreL( TInt aTargetDrive )
|
|
981 |
#else
|
|
982 |
void CMceGeneralSettingsDialog::ChangeMessageStoreL()
|
|
983 |
#endif //RD_MULTIPLE_DRIVE
|
|
984 |
{
|
|
985 |
//if server is busy, do not change store
|
|
986 |
if( CheckIsServerBusyL() )
|
|
987 |
{
|
|
988 |
return;
|
|
989 |
}
|
|
990 |
|
|
991 |
RFs& fs=iEikonEnv->FsSession();
|
|
992 |
|
|
993 |
TInt driveNumber;
|
|
994 |
|
|
995 |
#ifdef RD_MULTIPLE_DRIVE
|
|
996 |
driveNumber = aTargetDrive;
|
|
997 |
#else
|
|
998 |
// Get the current drive
|
|
999 |
TInt currentDrive=TInt( iSession->CurrentDriveL() );
|
|
1000 |
|
|
1001 |
if ( currentDrive == EDriveC )
|
|
1002 |
{
|
|
1003 |
driveNumber = EDriveE;
|
|
1004 |
}
|
|
1005 |
else
|
|
1006 |
{
|
|
1007 |
driveNumber = EDriveC;
|
|
1008 |
}
|
|
1009 |
#endif //RD_MULTIPLE_DRIVE
|
|
1010 |
|
|
1011 |
// change message store
|
|
1012 |
CMuiuOperationWait* waiter=CMuiuOperationWait::NewLC();
|
|
1013 |
|
|
1014 |
CMsvProgressReporterOperation* reportOp =
|
|
1015 |
CMsvProgressReporterOperation::NewL( *iSession, waiter->iStatus );
|
|
1016 |
CleanupStack::PushL( reportOp );
|
|
1017 |
|
|
1018 |
HBufC* text = StringLoader::LoadLC( R_MCE_SETTINGS_SWITCHING_MESSAGE_STORE,
|
|
1019 |
iEikonEnv );
|
|
1020 |
reportOp->SetTitleL( *text );
|
|
1021 |
|
|
1022 |
reportOp->SetCanCancelL( EFalse );
|
|
1023 |
|
|
1024 |
CleanupStack::PopAndDestroy( text );
|
|
1025 |
|
|
1026 |
CMsvOperation* changeOp=iSession->ChangeDriveL( driveNumber, reportOp->RequestStatus() );
|
|
1027 |
reportOp->SetOperationL( changeOp );
|
|
1028 |
|
|
1029 |
waiter->Start();
|
|
1030 |
|
|
1031 |
CleanupStack::PopAndDestroy( reportOp );
|
|
1032 |
CleanupStack::PopAndDestroy( waiter );
|
|
1033 |
}
|
|
1034 |
|
|
1035 |
|
|
1036 |
// ----------------------------------------------------
|
|
1037 |
// void CMceGeneralSettingsDialog::SetMSKButtonL()
|
|
1038 |
// ----------------------------------------------------
|
|
1039 |
void CMceGeneralSettingsDialog::SetMSKButtonL()
|
|
1040 |
{
|
|
1041 |
CEikTextListBox* list=STATIC_CAST(
|
|
1042 |
CEikTextListBox*,
|
|
1043 |
Control( EMceSettingsIdOtherItems) );
|
|
1044 |
const TInt index = list->CurrentItemIndex();
|
|
1045 |
const TInt numberOfItem = list->Model()->NumberOfItems();
|
|
1046 |
const TInt resourceId = index==0 ?
|
|
1047 |
R_MCE_MSK_BUTTON_CHANGE : R_MCE_MSK_BUTTON_OPEN;
|
|
1048 |
CEikButtonGroupContainer& cba = ButtonGroupContainer();
|
|
1049 |
cba.SetCommandL( KMSKPosition, resourceId );
|
|
1050 |
cba.DrawNow();
|
|
1051 |
}
|
|
1052 |
|
|
1053 |
#ifdef RD_MULTIPLE_DRIVE
|
|
1054 |
// ----------------------------------------------------
|
|
1055 |
// CMceGeneralSettingsDialog::MakeDriveNameStringLC
|
|
1056 |
// ----------------------------------------------------
|
|
1057 |
HBufC* CMceGeneralSettingsDialog::MakeDriveNameStringLC( TInt aDriveNumber )
|
|
1058 |
{
|
|
1059 |
// get drive later and delimiter, e.g. "C:"
|
|
1060 |
TDriveName driveName(TDriveUnit( aDriveNumber ).Name() );
|
|
1061 |
|
|
1062 |
TUint driveStatus( 0 );
|
|
1063 |
RFs& fs=iEikonEnv->FsSession();
|
|
1064 |
User::LeaveIfError( DriveInfo::GetDriveStatus( fs, aDriveNumber, driveStatus ) );
|
|
1065 |
|
|
1066 |
//Following flitters are referred to filemanager application
|
|
1067 |
if ( driveStatus & DriveInfo::EDriveInternal )
|
|
1068 |
{
|
|
1069 |
//Device Memory and Mass storage drives
|
|
1070 |
if ( driveStatus & DriveInfo::EDriveExternallyMountable )
|
|
1071 |
{
|
|
1072 |
return StringLoader::LoadLC( R_MCE_SETT_MEM_MASS_STORAGE, driveName, iEikonEnv );
|
|
1073 |
}
|
|
1074 |
else
|
|
1075 |
{
|
|
1076 |
return StringLoader::LoadLC( R_MCE_SETT_MEM_DEVICE, driveName, iEikonEnv );
|
|
1077 |
}
|
|
1078 |
}
|
|
1079 |
//memory card
|
|
1080 |
else
|
|
1081 |
{
|
|
1082 |
return StringLoader::LoadLC( R_MCE_SETT_MEM_MEMORY_CARD, driveName, iEikonEnv );
|
|
1083 |
}
|
|
1084 |
}
|
|
1085 |
#endif //RD_MULTIPLE_DRIVE
|
|
1086 |
|
|
1087 |
// ---------------------------------------------------------
|
|
1088 |
// CMceGeneralSettingsDialog::IsThirdPartyMailBox()
|
|
1089 |
//
|
|
1090 |
// ---------------------------------------------------------
|
|
1091 |
//
|
|
1092 |
TBool CMceGeneralSettingsDialog::IsThirdPartyMailBoxL()
|
|
1093 |
{
|
|
1094 |
CMsvEntry* entry = iSession->GetEntryL( KMsvRootIndexEntryId );
|
|
1095 |
CleanupStack::PushL( entry );
|
|
1096 |
TInt cnt = entry->Count();
|
|
1097 |
TBool isThirdPartyMail = EFalse;
|
|
1098 |
for ( TInt i=0; i < cnt ; i++)
|
|
1099 |
{
|
|
1100 |
if ( (*entry)[i].iType.iUid == KUidMsvServiceEntryValue &&
|
|
1101 |
(*entry)[i].Id() != KMsvLocalServiceIndexEntryIdValue &&
|
|
1102 |
( !( (*entry)[i].iMtm.iUid == KUidMsgTypeCmailMtmVal ||
|
|
1103 |
(*entry)[i].iMtm == KSenduiMtmImap4Uid ||
|
|
1104 |
(*entry)[i].iMtm == KSenduiMtmPop3Uid ||
|
|
1105 |
(*entry)[i].iMtm == KSenduiMtmSmtpUid )) &&
|
|
1106 |
IsEmailEntryL((*entry)[i]))
|
|
1107 |
{
|
|
1108 |
isThirdPartyMail = ETrue;
|
|
1109 |
break;
|
|
1110 |
}
|
|
1111 |
}
|
|
1112 |
CleanupStack::PopAndDestroy( entry );
|
|
1113 |
return isThirdPartyMail;
|
|
1114 |
}
|
|
1115 |
|
|
1116 |
// ---------------------------------------------------------
|
|
1117 |
// CMceGeneralSettingsDialog::IsEmailEntryL
|
|
1118 |
//
|
|
1119 |
// ---------------------------------------------------------
|
|
1120 |
//
|
|
1121 |
TBool CMceGeneralSettingsDialog::IsEmailEntryL(TMsvEntry tentry)
|
|
1122 |
{
|
|
1123 |
TBool IsEmail = EFalse;
|
|
1124 |
|
|
1125 |
CMtmUiDataRegistry* uiRegistry =
|
|
1126 |
CMtmUiDataRegistry::NewL( *iSession );
|
|
1127 |
CleanupStack::PushL(uiRegistry);
|
|
1128 |
if ( uiRegistry->IsPresent( tentry.iMtm ) &&
|
|
1129 |
uiRegistry->IsPresent( KUidMsgTypePOP3 ) )
|
|
1130 |
{
|
|
1131 |
TUid mailMTMTechType =
|
|
1132 |
uiRegistry->TechnologyTypeUid( KUidMsgTypePOP3 );
|
|
1133 |
if( uiRegistry->TechnologyTypeUid( tentry.iMtm ) == mailMTMTechType )
|
|
1134 |
{
|
|
1135 |
IsEmail = ETrue;
|
|
1136 |
}
|
|
1137 |
}
|
|
1138 |
CleanupStack::PopAndDestroy( uiRegistry );
|
|
1139 |
|
|
1140 |
return IsEmail;
|
|
1141 |
}
|
|
1142 |
// End of File
|