39
|
1 |
/*
|
|
2 |
* Copyright (c) 2002-2008 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: Base class for all file manager views
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
// INCLUDE FILES
|
|
21 |
#include <aknlists.h>
|
|
22 |
#include <eikmenup.h> // CEikMenuPane
|
|
23 |
#include <eikmenub.h> // CEikMenuBar
|
|
24 |
#include <StringLoader.h>
|
|
25 |
#include <AknCommonDialogs.h> // Common File Dialogs
|
|
26 |
#include <CAknMemorySelectionDialog.h>
|
|
27 |
#include <CAknFileSelectionDialog.h>
|
|
28 |
#include <sendui.h>
|
|
29 |
#include <sendnorm.rsg>
|
|
30 |
#include <SenduiMtmUids.h>
|
|
31 |
#include <AknProgressDialog.h>
|
|
32 |
#include <eikprogi.h>
|
|
33 |
#include <AknWaitNoteWrapper.h>
|
|
34 |
#include <aknnotewrappers.h>
|
|
35 |
#include <AknWaitDialog.h>
|
|
36 |
#include <cmemstatepopup.h>
|
|
37 |
#include <f32file.h>
|
|
38 |
#include <aknmessagequerydialog.h>
|
|
39 |
#include <CMessageData.h>
|
|
40 |
#include <DRMHelper.h>
|
|
41 |
#include <bautils.h>
|
|
42 |
#include <AknCommonDialogsDynMem.h>
|
|
43 |
#include "CFileManagerViewBase.h"
|
|
44 |
#include "CFileManagerContainerBase.h"
|
|
45 |
#include "CFileManagerAppUi.h"
|
|
46 |
#include "CFileManagerDocument.h"
|
|
47 |
#include "CFileManagerFileSelectionFilter.h"
|
|
48 |
#include "FileManager.hrh"
|
|
49 |
#ifdef RD_FILE_MANAGER_BACKUP
|
|
50 |
#include "CFileManagerSchBackupHandler.h"
|
|
51 |
#include "CFileManagerBackupSettings.h"
|
|
52 |
#include "CFileManagerTaskScheduler.h"
|
|
53 |
#endif // RD_FILE_MANAGER_BACKUP
|
|
54 |
#include <CFileManagerEngine.h>
|
|
55 |
#include <CFileManagerUtils.h>
|
|
56 |
#include <CFileManagerCommonDefinitions.h>
|
|
57 |
#include <CFileManagerItemProperties.h>
|
|
58 |
#include <CFileManagerActiveExecute.h>
|
|
59 |
#include <Cfilemanageractivedelete.h>
|
|
60 |
#include <filemanager.rsg>
|
|
61 |
#include <filemanagerview.rsg>
|
|
62 |
#include <FileManagerDebug.h>
|
|
63 |
#include <FileManagerDlgUtils.h>
|
|
64 |
#include <CFileManagerFeatureManager.h>
|
|
65 |
#include <FileManagerPrivateCRKeys.h>
|
|
66 |
#include <DataSyncInternalPSKeys.h>
|
|
67 |
#include <connect/sbdefs.h>
|
|
68 |
#include <e32property.h>
|
|
69 |
#include <caf/caf.h>
|
|
70 |
#include <drmagents.h>
|
|
71 |
|
|
72 |
using namespace conn;
|
|
73 |
|
|
74 |
// CONSTANTS
|
|
75 |
const TUint KMessageSize = 1024;
|
|
76 |
const TUint KMaxPercentage = 100;
|
|
77 |
const TUint KProgressBarUpdateInterval = 1000000; // microseconds
|
|
78 |
const TUint KDriveLetterSize = 1;
|
|
79 |
const TUint KRefreshProgressStartDelay = 1000000; // microseconds
|
|
80 |
const TInt KFmgrMSK = 3;
|
|
81 |
const TInt KEstimateUpperLimit = 90; // User selectable continuation
|
|
82 |
const TInt KEstimateLowerLimit = 10; // Backup will be interrupted
|
|
83 |
const TUint32 KDefaultFolderMask = CFileManagerItemProperties::EFolder |
|
|
84 |
CFileManagerItemProperties::EDefault;
|
|
85 |
const TInt64 KMSecToMicroSecMultiplier = 1000000;
|
|
86 |
const TInt64 KMinToMicroSecMultiplier = KMSecToMicroSecMultiplier * 60;
|
|
87 |
const TInt64 KHourToMicroSecMultiplier = KMinToMicroSecMultiplier * 60;
|
|
88 |
const TUint KProgressBarAsyncStartDelay = 1500000; // microseconds
|
|
89 |
const TInt64 KMinificationFactor = 1024; // Used to zoom processbar's proportion
|
|
90 |
|
|
91 |
// ============================ LOCAL FUNCTIONS ================================
|
|
92 |
|
|
93 |
// -----------------------------------------------------------------------------
|
|
94 |
// IsWmDrmFile
|
|
95 |
//
|
|
96 |
// -----------------------------------------------------------------------------
|
|
97 |
//
|
|
98 |
static TBool IsWmDrmFile( const TDesC& aFullPath )
|
|
99 |
{
|
|
100 |
TBool ret( EFalse );
|
|
101 |
ContentAccess::CContent* content = NULL;
|
|
102 |
TRAPD( err, content = ContentAccess::CContent::CContent::NewL(
|
|
103 |
aFullPath, EContentShareReadWrite ) );
|
|
104 |
if ( err != KErrNone )
|
|
105 |
{
|
|
106 |
TRAP( err, content = ContentAccess::CContent::CContent::NewL(
|
|
107 |
aFullPath, EContentShareReadOnly ) );
|
|
108 |
}
|
|
109 |
if ( err == KErrNone )
|
|
110 |
{
|
|
111 |
TInt isProtected( 0 );
|
|
112 |
err = content->GetAttribute( EIsProtected, isProtected );
|
|
113 |
if ( err == KErrNone && isProtected )
|
|
114 |
{
|
|
115 |
TInt fileType( 0 );
|
|
116 |
err = content->GetAttribute( DRM::EDrmFileType, fileType );
|
|
117 |
ret = ( err == KErrNone && fileType == DRM::EDrmWMFile );
|
|
118 |
}
|
|
119 |
delete content;
|
|
120 |
}
|
|
121 |
return ret;
|
|
122 |
}
|
|
123 |
|
|
124 |
// -----------------------------------------------------------------------------
|
|
125 |
// Int64ToInt
|
|
126 |
//
|
|
127 |
// -----------------------------------------------------------------------------
|
|
128 |
//
|
|
129 |
static TInt Int64ToInt( const TInt64& aInt64 )
|
|
130 |
{
|
|
131 |
if ( aInt64 > KMaxTInt )
|
|
132 |
{
|
|
133 |
return KMaxTInt;
|
|
134 |
}
|
|
135 |
return I64INT( aInt64 );
|
|
136 |
}
|
|
137 |
|
|
138 |
// -----------------------------------------------------------------------------
|
|
139 |
// EmptyPwd
|
|
140 |
//
|
|
141 |
// -----------------------------------------------------------------------------
|
|
142 |
//
|
|
143 |
//static void EmptyPwd( TDes& aPwd )
|
|
144 |
// {
|
|
145 |
// aPwd.FillZ( aPwd.MaxLength( ) );
|
|
146 |
// aPwd.Zero();
|
|
147 |
// }
|
|
148 |
|
|
149 |
// -----------------------------------------------------------------------------
|
|
150 |
// ConvertCharsToPwd
|
|
151 |
//
|
|
152 |
// -----------------------------------------------------------------------------
|
|
153 |
//
|
|
154 |
//static void ConvertCharsToPwd( const TDesC& aWord, TDes8& aConverted )
|
|
155 |
// {
|
|
156 |
// // Make sure the target password is empty ( can't use the function here )
|
|
157 |
// aConverted.FillZ( aConverted.MaxLength() );
|
|
158 |
// aConverted.Zero();
|
|
159 |
// TInt size( aWord.Size() );
|
|
160 |
// if ( size )
|
|
161 |
// {
|
|
162 |
// if ( size > aConverted.MaxLength() )
|
|
163 |
// {
|
|
164 |
// size = aConverted.MaxLength();
|
|
165 |
// }
|
|
166 |
// aConverted.Copy( (TUint8*)aWord.Ptr(), size );
|
|
167 |
// }
|
|
168 |
// }
|
|
169 |
|
|
170 |
// -----------------------------------------------------------------------------
|
|
171 |
// IsSystemProcess
|
|
172 |
//
|
|
173 |
// -----------------------------------------------------------------------------
|
|
174 |
//
|
|
175 |
static TBool IsSystemProcess(
|
|
176 |
MFileManagerProcessObserver::TFileManagerProcess aProcess )
|
|
177 |
{
|
|
178 |
switch ( aProcess )
|
|
179 |
{
|
|
180 |
case MFileManagerProcessObserver::EFormatProcess:
|
|
181 |
case MFileManagerProcessObserver::EBackupProcess:
|
|
182 |
case MFileManagerProcessObserver::ERestoreProcess:
|
|
183 |
case MFileManagerProcessObserver::ESchBackupProcess:
|
|
184 |
{
|
|
185 |
return ETrue;
|
|
186 |
}
|
|
187 |
default:
|
|
188 |
{
|
|
189 |
break;
|
|
190 |
}
|
|
191 |
}
|
|
192 |
return EFalse;
|
|
193 |
}
|
|
194 |
|
|
195 |
// -----------------------------------------------------------------------------
|
|
196 |
// GetDeleteQueryPromptLC
|
|
197 |
// Chooses correct string for the delete note
|
|
198 |
// -----------------------------------------------------------------------------
|
|
199 |
//
|
|
200 |
static HBufC* GetDeleteQueryPromptLC( CFileManagerItemProperties& aProp, TInt aCount )
|
|
201 |
{
|
|
202 |
|
|
203 |
HBufC* prompt = NULL;
|
|
204 |
if ( aCount == 0 && aProp.ContainsAnyFilesOrFolders() )
|
|
205 |
{
|
|
206 |
prompt = StringLoader::LoadLC( R_QTN_FLDR_DEL_FULL_FLDRS_QUERY );
|
|
207 |
}
|
|
208 |
else if ( aCount <= 1 )
|
|
209 |
{
|
|
210 |
prompt = StringLoader::LoadLC( R_QTN_QUERY_COMMON_CONF_DELETE, aProp.NameAndExt() );
|
|
211 |
}
|
|
212 |
else // aCount > 1
|
|
213 |
{
|
|
214 |
prompt = StringLoader::LoadLC( R_QTN_FLDR_DEL_ITEMS_QUERY, aCount );
|
|
215 |
}
|
|
216 |
|
|
217 |
return prompt;
|
|
218 |
}
|
|
219 |
|
|
220 |
// -----------------------------------------------------------------------------
|
|
221 |
// MinIndex
|
|
222 |
//
|
|
223 |
// -----------------------------------------------------------------------------
|
|
224 |
//
|
|
225 |
static TInt MinIndex( CArrayFixFlat<TInt>& aIndexArray )
|
|
226 |
{
|
|
227 |
TInt count( aIndexArray.Count() );
|
|
228 |
if ( !count )
|
|
229 |
{
|
|
230 |
return 0;
|
|
231 |
}
|
|
232 |
// Find min index
|
|
233 |
TInt index( 0 );
|
|
234 |
TInt i( 0 );
|
|
235 |
TInt ret( aIndexArray.At( i ) );
|
|
236 |
++i;
|
|
237 |
for( ; i < count; ++i )
|
|
238 |
{
|
|
239 |
index = aIndexArray.At( i );
|
|
240 |
if ( index < ret )
|
|
241 |
{
|
|
242 |
ret = index;
|
|
243 |
}
|
|
244 |
}
|
|
245 |
return ret;
|
|
246 |
}
|
|
247 |
|
|
248 |
// -----------------------------------------------------------------------------
|
|
249 |
// SetCurrentYearMonthAndDay
|
|
250 |
//
|
|
251 |
// -----------------------------------------------------------------------------
|
|
252 |
//
|
|
253 |
static TTime SetCurrentYearMonthAndDay( const TTime& aTime )
|
|
254 |
{
|
|
255 |
TTime timeNow;
|
|
256 |
timeNow.HomeTime();
|
|
257 |
TDateTime dateTimeNow( timeNow.DateTime() );
|
|
258 |
TInt64 ret( timeNow.Int64() );
|
|
259 |
// Replace hours, minutes and seconds using given ones.
|
|
260 |
ret -= static_cast< TInt64 >( dateTimeNow.Hour() ) * KHourToMicroSecMultiplier;
|
|
261 |
ret -= static_cast< TInt64 >( dateTimeNow.Minute() ) * KMinToMicroSecMultiplier;
|
|
262 |
ret -= static_cast< TInt64 >( dateTimeNow.Second() ) * KMSecToMicroSecMultiplier;
|
|
263 |
ret -= dateTimeNow.MicroSecond();
|
|
264 |
TDateTime dateTime( aTime.DateTime() );
|
|
265 |
ret += static_cast< TInt64 >( dateTime.Hour() ) * KHourToMicroSecMultiplier;
|
|
266 |
ret += static_cast< TInt64 >( dateTime.Minute() ) * KMinToMicroSecMultiplier;
|
|
267 |
ret += static_cast< TInt64 >( dateTime.Second() ) * KMSecToMicroSecMultiplier;
|
|
268 |
return ret;
|
|
269 |
}
|
|
270 |
|
|
271 |
// ============================ MEMBER FUNCTIONS ===============================
|
|
272 |
|
|
273 |
// -----------------------------------------------------------------------------
|
|
274 |
// CFileManagerViewBase::CFileManagerViewBase
|
|
275 |
// C++ default constructor can NOT contain any code, that
|
|
276 |
// might leave.
|
|
277 |
// -----------------------------------------------------------------------------
|
|
278 |
//
|
|
279 |
CFileManagerViewBase::CFileManagerViewBase() :
|
|
280 |
iEngine( static_cast< CFileManagerDocument* >( AppUi()->Document() )->Engine() )
|
|
281 |
{
|
|
282 |
}
|
|
283 |
|
|
284 |
|
|
285 |
// -----------------------------------------------------------------------------
|
|
286 |
// CFileManagerViewBase::~CFileManagerViewBase
|
|
287 |
// Destructor
|
|
288 |
// -----------------------------------------------------------------------------
|
|
289 |
//
|
|
290 |
CFileManagerViewBase::~CFileManagerViewBase()
|
|
291 |
{
|
|
292 |
delete iWaitNoteWrapper;
|
|
293 |
delete iActiveDelete;
|
|
294 |
delete iPeriodic;
|
|
295 |
delete iMarkedArray;
|
|
296 |
delete iContainer;
|
|
297 |
delete iActiveExec;
|
|
298 |
delete iRefreshProgressDelayedStart;
|
|
299 |
delete iEjectQueryDialog;
|
|
300 |
}
|
|
301 |
|
|
302 |
// -----------------------------------------------------------------------------
|
|
303 |
// CFileManagerViewBase::GetSendFilesLC
|
|
304 |
//
|
|
305 |
// -----------------------------------------------------------------------------
|
|
306 |
//
|
|
307 |
CArrayFixFlat<TInt>* CFileManagerViewBase::GetSendFilesLC( TInt& aSize )
|
|
308 |
{
|
|
309 |
// Get index array and remove folders and play lists
|
|
310 |
CArrayFixFlat< TInt >* ret = MarkedArrayLC();
|
|
311 |
TInt i( ret->Count() );
|
|
312 |
while ( i > 0 )
|
|
313 |
{
|
|
314 |
--i;
|
|
315 |
// IconIdL() is slow if the icon is not cached yet.
|
|
316 |
// However, it is faster than FileTypeL().
|
|
317 |
switch ( iEngine.IconIdL( ret->At( i ) ) )
|
|
318 |
{
|
|
319 |
case EFileManagerFolderIcon: // FALLTHROUGH
|
|
320 |
case EFileManagerFolderSubIcon: // FALLTHROUGH
|
|
321 |
case EFileManagerFolderEmptyIcon: // FALLTHROUGH
|
|
322 |
case EFileManagerPlaylistFileIcon:
|
|
323 |
{
|
|
324 |
ret->Delete( i );
|
|
325 |
break;
|
|
326 |
}
|
|
327 |
default:
|
|
328 |
{
|
|
329 |
break;
|
|
330 |
}
|
|
331 |
}
|
|
332 |
}
|
|
333 |
aSize = Int64ToInt( iEngine.GetFileSizesL( *ret ) );
|
|
334 |
return ret;
|
|
335 |
}
|
|
336 |
|
|
337 |
// -----------------------------------------------------------------------------
|
|
338 |
// CFileManagerViewBase::ConstructL
|
|
339 |
//
|
|
340 |
// -----------------------------------------------------------------------------
|
|
341 |
//
|
|
342 |
void CFileManagerViewBase::ConstructL( TInt aResId )
|
|
343 |
{
|
|
344 |
BaseConstructL( aResId );
|
|
345 |
}
|
|
346 |
|
|
347 |
// -----------------------------------------------------------------------------
|
|
348 |
// CFileManagerViewBase::HandleCommandL
|
|
349 |
//
|
|
350 |
// -----------------------------------------------------------------------------
|
|
351 |
//
|
|
352 |
void CFileManagerViewBase::HandleCommandL( TInt aCommand )
|
|
353 |
{
|
|
354 |
if ( !iContainer ) return;
|
|
355 |
|
|
356 |
TBool updateCba( !iContainer->SelectionModeEnabled() );
|
|
357 |
|
|
358 |
switch( aCommand )
|
|
359 |
{
|
|
360 |
case EFileManagerOpen:
|
|
361 |
{
|
|
362 |
CmdOpenL();
|
|
363 |
break;
|
|
364 |
}
|
|
365 |
case EFileManagerDelete:
|
|
366 |
{
|
|
367 |
CmdDeleteL();
|
|
368 |
break;
|
|
369 |
}
|
|
370 |
case EFileManagerMoveToFolder:
|
|
371 |
{
|
|
372 |
CmdMoveToFolderL();
|
|
373 |
break;
|
|
374 |
}
|
|
375 |
case EFileManagerCopyToFolder:
|
|
376 |
{
|
|
377 |
CmdCopyToFolderL();
|
|
378 |
break;
|
|
379 |
}
|
|
380 |
case EFileManagerNewFolder:
|
|
381 |
{
|
|
382 |
CmdNewFolderL();
|
|
383 |
break;
|
|
384 |
}
|
|
385 |
case EFileManagerMarkOne: // FALLTHROUGH
|
|
386 |
case EFileManagerUnmarkOne: // FALLTHROUGH
|
|
387 |
case EFileManagerToggleMark:
|
|
388 |
{
|
|
389 |
CmdToggleMarkL();
|
|
390 |
break;
|
|
391 |
}
|
|
392 |
case EFileManagerMarkAll:
|
|
393 |
{
|
|
394 |
CmdMarkAllL();
|
|
395 |
break;
|
|
396 |
}
|
|
397 |
case EFileManagerUnmarkAll:
|
|
398 |
{
|
|
399 |
CmdUnmarkAllL();
|
|
400 |
break;
|
|
401 |
}
|
|
402 |
case EFileManagerRename:
|
|
403 |
{
|
|
404 |
CmdRenameL();
|
|
405 |
break;
|
|
406 |
}
|
|
407 |
case EFileManagerFindFile:
|
|
408 |
{
|
|
409 |
CmdFindL();
|
|
410 |
break;
|
|
411 |
}
|
|
412 |
case EFileManagerFileDetails: // FALLTHROUGH
|
|
413 |
case EFileManagerFolderDetails: // FALLTHROUGH
|
|
414 |
case EFileManagerViewInfo:
|
|
415 |
{
|
|
416 |
CmdViewInfoL();
|
|
417 |
break;
|
|
418 |
}
|
|
419 |
// case EFileManagerMemoryState:
|
|
420 |
// {
|
|
421 |
// CmdMemoryStateL();
|
|
422 |
// break;
|
|
423 |
// }
|
|
424 |
case EFileManagerReceiveViaIR:
|
|
425 |
{
|
|
426 |
CmdReceiveViaIRL();
|
|
427 |
break;
|
|
428 |
}
|
|
429 |
case EFileManagerCheckMark: // Suppress
|
|
430 |
{
|
|
431 |
break;
|
|
432 |
}
|
|
433 |
case EAknSoftkeyContextOptions: // FALLTHROUGH
|
|
434 |
case EFileManagerSelectionKey:
|
|
435 |
{
|
|
436 |
TInt count( iContainer->ListBoxSelectionIndexesCount() );
|
|
437 |
if ( !count )
|
|
438 |
{
|
|
439 |
HandleCommandL( EFileManagerOpen );
|
|
440 |
}
|
|
441 |
else if ( count > 0 )
|
|
442 |
{
|
|
443 |
ShowContextSensitiveMenuL();
|
|
444 |
}
|
|
445 |
break;
|
|
446 |
}
|
|
447 |
case EFileManagerSend:
|
|
448 |
{
|
|
449 |
if ( !iSendUiPopupOpened )
|
|
450 |
{
|
|
451 |
SendUiQueryL();
|
|
452 |
}
|
|
453 |
break;
|
|
454 |
}
|
|
455 |
case EFileManagerMoreInfoOnline:
|
|
456 |
{
|
|
457 |
OpenInfoUrlL( iContainer->ListBoxCurrentItemIndex() );
|
|
458 |
break;
|
|
459 |
}
|
|
460 |
case EFileManagerUnlockMemoryCard:
|
|
461 |
{
|
|
462 |
CmdUnlockDriveL();
|
|
463 |
break;
|
|
464 |
}
|
|
465 |
// case EFileManagerMemoryCardName:
|
|
466 |
// case EFileManagerMemoryCardRename: // Fall through
|
|
467 |
// {
|
|
468 |
// CmdRenameDriveL();
|
|
469 |
// break;
|
|
470 |
// }
|
|
471 |
//case EFileManagerMemoryCardFormat:
|
|
472 |
case EFileManagerMemoryStorageFormat:
|
|
473 |
case EFileManagerFormatMassStorage: // Fall through
|
|
474 |
{
|
|
475 |
CmdFormatDriveL();
|
|
476 |
break;
|
|
477 |
}
|
|
478 |
// case EFileManagerMemoryCardPasswordSet:
|
|
479 |
// {
|
|
480 |
// CmdSetDrivePasswordL();
|
|
481 |
// break;
|
|
482 |
// }
|
|
483 |
// case EFileManagerMemoryCardPasswordChange:
|
|
484 |
// {
|
|
485 |
// CmdChangeDrivePasswordL();
|
|
486 |
// break;
|
|
487 |
// }
|
|
488 |
// case EFileManagerMemoryCardPasswordRemove:
|
|
489 |
// {
|
|
490 |
// CmdRemoveDrivePasswordL();
|
|
491 |
// break;
|
|
492 |
// }
|
|
493 |
// case EFileManagerMemoryCardDetails:
|
|
494 |
// {
|
|
495 |
// CmdMemoryCardDetailsL();
|
|
496 |
// break;
|
|
497 |
// }
|
|
498 |
case EFileManagerConnectRemoveDrive:
|
|
499 |
{
|
|
500 |
SetRemoteDriveConnectionStateL( ETrue );
|
|
501 |
break;
|
|
502 |
}
|
|
503 |
case EFileManagerDisconnectRemoveDrive:
|
|
504 |
{
|
|
505 |
SetRemoteDriveConnectionStateL( EFalse );
|
|
506 |
break;
|
|
507 |
}
|
|
508 |
case EFileManagerRefreshRemoteDrive:
|
|
509 |
{
|
|
510 |
CmdRefreshDirectoryL();
|
|
511 |
break;
|
|
512 |
}
|
|
513 |
case EFileManagerSortByName:
|
|
514 |
case EFileManagerSortByType: // Fall through
|
|
515 |
case EFileManagerSortMostRecentFirst: // Fall through
|
|
516 |
case EFileManagerSortLargestFirst: // Fall through
|
|
517 |
case EFileManagerSortByMatch: // Fall through
|
|
518 |
{
|
|
519 |
CmdSortL( aCommand );
|
|
520 |
break;
|
|
521 |
}
|
|
522 |
default:
|
|
523 |
{
|
|
524 |
AppUi()->HandleCommandL( aCommand );
|
|
525 |
break;
|
|
526 |
}
|
|
527 |
}
|
|
528 |
|
|
529 |
if ( updateCba )
|
|
530 |
{
|
|
531 |
UpdateCbaL();
|
|
532 |
}
|
|
533 |
}
|
|
534 |
|
|
535 |
// -----------------------------------------------------------------------------
|
|
536 |
// CFileManagerViewBase::SendUiQueryL
|
|
537 |
//
|
|
538 |
// -----------------------------------------------------------------------------
|
|
539 |
//
|
|
540 |
void CFileManagerViewBase::SendUiQueryL()
|
|
541 |
{
|
|
542 |
//iSendUiPopupOpened = ETrue;
|
|
543 |
|
|
544 |
CSendUi& sendUi( static_cast< CFileManagerAppUi* >( AppUi() )->SendUiL() );
|
|
545 |
CMessageData* msgData = CMessageData::NewL();
|
|
546 |
CleanupStack::PushL( msgData );
|
|
547 |
TInt msgSize( KMessageSize );
|
|
548 |
CArrayFixFlat< TInt >* files = GetSendFilesLC( msgSize );
|
|
549 |
TInt count( files->Count() );
|
|
550 |
if ( count )
|
|
551 |
{
|
|
552 |
// Set dimmed services specified for FileManager by Send UI spec
|
|
553 |
const TInt KDimmedServices = 4;
|
|
554 |
CArrayFixFlat< TUid >* servicesToDim =
|
|
555 |
new ( ELeave ) CArrayFixFlat< TUid >( KDimmedServices );
|
|
556 |
CleanupStack::PushL( servicesToDim );
|
|
557 |
|
|
558 |
servicesToDim->AppendL( KSenduiMtmAudioMessageUid );
|
|
559 |
servicesToDim->AppendL( KMmsDirectUpload );
|
|
560 |
servicesToDim->AppendL( KMmsIndirectUpload );
|
|
561 |
servicesToDim->AppendL( KSenduiMtmPostcardUid );
|
|
562 |
|
|
563 |
TSendingCapabilities caps(
|
|
564 |
0, msgSize, TSendingCapabilities::ESupportsAttachments );
|
|
565 |
for( TInt i( 0 ); i < count ; i++ )
|
|
566 |
{
|
|
567 |
HBufC* fullPath = iEngine.IndexToFullPathLC( files->At( i ) );
|
|
568 |
msgData->AppendAttachmentL( *fullPath );
|
|
569 |
CleanupStack::PopAndDestroy( fullPath );
|
|
570 |
}
|
|
571 |
// Let SendUi handle protected files, queries and filtering
|
|
572 |
TRAPD( err, sendUi.ShowQueryAndSendL( msgData, caps, servicesToDim ) );
|
|
573 |
if ( err == KErrTooBig )
|
|
574 |
{
|
|
575 |
FileManagerDlgUtils::ShowErrorNoteL( R_QTN_FMGR_FILE_SIZE_TOO_LARGE );
|
|
576 |
}
|
|
577 |
else
|
|
578 |
{
|
|
579 |
User::LeaveIfError( err );
|
|
580 |
}
|
|
581 |
CleanupStack::PopAndDestroy( servicesToDim );
|
|
582 |
}
|
|
583 |
CleanupStack::PopAndDestroy( files );
|
|
584 |
CleanupStack::PopAndDestroy( msgData );
|
|
585 |
|
|
586 |
iSendUiPopupOpened = EFalse;
|
|
587 |
}
|
|
588 |
|
|
589 |
// -----------------------------------------------------------------------------
|
|
590 |
// CFileManagerViewBase::MarkMenuFilteringL
|
|
591 |
//
|
|
592 |
// -----------------------------------------------------------------------------
|
|
593 |
//
|
|
594 |
void CFileManagerViewBase::MarkMenuFilteringL( CEikMenuPane& aMenuPane )
|
|
595 |
{
|
|
596 |
TInt index( iContainer->ListBoxCurrentItemIndex() );
|
|
597 |
|
|
598 |
if ( iEngine.IsFolder( index ) )
|
|
599 |
{
|
|
600 |
aMenuPane.SetItemDimmed( EFileManagerMarkOne, ETrue );
|
|
601 |
aMenuPane.SetItemDimmed( EFileManagerUnmarkOne, ETrue );
|
|
602 |
}
|
|
603 |
else
|
|
604 |
{
|
|
605 |
if ( iContainer->ListBoxIsItemSelected( index ) )
|
|
606 |
{
|
|
607 |
aMenuPane.SetItemDimmed( EFileManagerMarkOne, ETrue );
|
|
608 |
}
|
|
609 |
else
|
|
610 |
{
|
|
611 |
aMenuPane.SetItemDimmed( EFileManagerUnmarkOne, ETrue );
|
|
612 |
}
|
|
613 |
}
|
|
614 |
TInt files( 0 );
|
|
615 |
if( iContainer->IsSearchFieldVisible() )
|
|
616 |
{
|
|
617 |
files = FilesCountInSearchField();
|
|
618 |
}
|
|
619 |
else
|
|
620 |
{
|
|
621 |
files = iEngine.FilesInFolderL();
|
|
622 |
}
|
|
623 |
TInt count( iContainer->ListBoxSelectionIndexesCount() );
|
|
624 |
if ( count == files )
|
|
625 |
{
|
|
626 |
aMenuPane.SetItemDimmed( EFileManagerMarkAll, ETrue );
|
|
627 |
}
|
|
628 |
|
|
629 |
if ( !count )
|
|
630 |
{
|
|
631 |
aMenuPane.SetItemDimmed( EFileManagerUnmarkAll, ETrue );
|
|
632 |
}
|
|
633 |
}
|
|
634 |
|
|
635 |
// -----------------------------------------------------------------------------
|
|
636 |
// CFileManagerViewBase::CmdOpenL
|
|
637 |
//
|
|
638 |
// -----------------------------------------------------------------------------
|
|
639 |
//
|
|
640 |
CFileManagerViewBase::TFileManagerOpenResult CFileManagerViewBase::CmdOpenL()
|
|
641 |
{
|
|
642 |
if ( !iContainer || iActiveProcess != ENoProcess )
|
|
643 |
{
|
|
644 |
return EOpenError; // Ignore to avoid mess up
|
|
645 |
}
|
|
646 |
TInt index( iContainer->ListBoxCurrentItemIndex() );
|
|
647 |
TInt err( KErrNone );
|
|
648 |
|
|
649 |
if ( index < 0 )
|
|
650 |
{
|
|
651 |
return EOpenError;
|
|
652 |
}
|
|
653 |
CFileManagerAppUi* appUi =
|
|
654 |
static_cast< CFileManagerAppUi* >( AppUi() );
|
|
655 |
TBool isFolder( iEngine.IsFolder( index ) );
|
|
656 |
StoreIndex();
|
|
657 |
TRAP( err, iEngine.OpenL( index ) );
|
|
658 |
if ( err == KErrNone )
|
|
659 |
{
|
|
660 |
if ( isFolder )
|
|
661 |
{
|
|
662 |
if ( !appUi->ActivateFoldersViewL() )
|
|
663 |
{
|
|
664 |
// Folders view is already open
|
|
665 |
// Refresh if this view is folders view
|
|
666 |
if ( Id() == CFileManagerAppUi::KFileManagerFoldersViewId )
|
|
667 |
{
|
|
668 |
iEngine.SetObserver( this );
|
|
669 |
iEngine.RefreshDirectory();
|
|
670 |
}
|
|
671 |
}
|
|
672 |
return EFolderOpened;
|
|
673 |
}
|
|
674 |
return EFileOpened;
|
|
675 |
}
|
|
676 |
if ( !HandleFileNotFoundL( err ) )
|
|
677 |
{
|
|
678 |
if ( !isFolder )
|
|
679 |
{
|
|
680 |
FileManagerDlgUtils::ShowErrorNoteL(
|
|
681 |
R_QTN_FMGR_ERROR_CANT_OPEN );
|
|
682 |
}
|
|
683 |
}
|
|
684 |
return EOpenError;
|
|
685 |
}
|
|
686 |
|
|
687 |
// ----------------------------------------------------------------------------
|
|
688 |
// CFileManagerViewBase::CmdDeleteL
|
|
689 |
//
|
|
690 |
// ----------------------------------------------------------------------------
|
|
691 |
//
|
|
692 |
void CFileManagerViewBase::CmdDeleteL()
|
|
693 |
{
|
|
694 |
|
|
695 |
if ( !iContainer->ListBoxNumberOfItems() )
|
|
696 |
{
|
|
697 |
// List box is empty, nothing to delete
|
|
698 |
return;
|
|
699 |
}
|
|
700 |
|
|
701 |
const TInt selectionCount(iContainer->ListBoxSelectionIndexesCount() );
|
|
702 |
TInt index( iContainer->ListBoxCurrentItemIndex() );
|
|
703 |
|
|
704 |
if ( selectionCount == 1 )
|
|
705 |
{
|
|
706 |
// One item marked
|
|
707 |
const CArrayFix< TInt >* items = iContainer->ListBoxSelectionIndexes();
|
|
708 |
index = items->At( 0 );
|
|
709 |
}
|
|
710 |
|
|
711 |
CFileManagerItemProperties* prop = iEngine.GetItemInfoL( index );
|
|
712 |
CleanupStack::PushL( prop );
|
|
713 |
|
|
714 |
if ( DeleteStatusNotOkL( *prop, selectionCount ) )
|
|
715 |
{
|
|
716 |
// It is not possible to continue delete operation
|
|
717 |
CleanupStack::PopAndDestroy( prop );
|
|
718 |
return;
|
|
719 |
}
|
|
720 |
|
|
721 |
HBufC* prompt = GetDeleteQueryPromptLC( *prop, selectionCount );
|
|
722 |
|
|
723 |
TBool ret( EFalse );
|
|
724 |
DenyDirectoryRefresh( ETrue );
|
|
725 |
TRAPD( err, ret = FileManagerDlgUtils::ShowConfirmQueryWithYesNoL( *prompt ) );
|
|
726 |
DenyDirectoryRefresh( EFalse );
|
|
727 |
User::LeaveIfError( err );
|
|
728 |
if ( ret )
|
|
729 |
{
|
|
730 |
if( IsDriveAvailable( DriveInfo().iDrive ) )
|
|
731 |
{
|
|
732 |
DeleteItemsL( index );
|
|
733 |
}
|
|
734 |
else
|
|
735 |
{
|
|
736 |
FileManagerDlgUtils::ShowInfoNoteL( R_QTN_MEMC_NOT_AVAILABLE );
|
|
737 |
CheckPostponedDirectoryRefresh();
|
|
738 |
}
|
|
739 |
}
|
|
740 |
else
|
|
741 |
{
|
|
742 |
CheckPostponedDirectoryRefresh();
|
|
743 |
}
|
|
744 |
CleanupStack::PopAndDestroy( prompt );
|
|
745 |
CleanupStack::PopAndDestroy( prop );
|
|
746 |
|
|
747 |
}
|
|
748 |
|
|
749 |
// -----------------------------------------------------------------------------
|
|
750 |
// CFileManagerViewBase::CmdMoveToFolderL
|
|
751 |
//
|
|
752 |
// -----------------------------------------------------------------------------
|
|
753 |
//
|
|
754 |
void CFileManagerViewBase::CmdMoveToFolderL()
|
|
755 |
{
|
|
756 |
|
|
757 |
if ( DriveReadOnlyMmcL( iEngine.CurrentDirectory() ) )
|
|
758 |
{
|
|
759 |
return;
|
|
760 |
}
|
|
761 |
|
|
762 |
// double KMaxFileName is needed if both source and target are KMaxFileName
|
|
763 |
HBufC* fileName = HBufC::NewLC( KFmgrDoubleMaxFileName );
|
|
764 |
TPtr ptrFileName = fileName->Des();
|
|
765 |
CFileManagerFileSelectionFilter* filter =
|
|
766 |
new( ELeave ) CFileManagerFileSelectionFilter( iEngine );
|
|
767 |
CleanupStack::PushL( filter );
|
|
768 |
|
|
769 |
TInt memType(
|
|
770 |
AknCommonDialogsDynMem::EMemoryTypePhone |
|
|
771 |
AknCommonDialogsDynMem::EMemoryTypeMMC );
|
|
772 |
|
|
773 |
if ( FeatureManager().IsRemoteStorageFwSupported() )
|
|
774 |
{
|
|
775 |
memType |= AknCommonDialogsDynMem::EMemoryTypeRemote;
|
|
776 |
}
|
|
777 |
|
|
778 |
DenyDirectoryRefresh( ETrue );
|
|
779 |
TBool ret( AknCommonDialogsDynMem::RunMoveDlgLD(
|
|
780 |
memType,
|
|
781 |
ptrFileName,
|
|
782 |
R_FILEMANAGER_MOVE_MEMORY_SELECTIONDIALOG,
|
|
783 |
filter ) );
|
|
784 |
DenyDirectoryRefresh( EFalse );
|
|
785 |
CleanupStack::PopAndDestroy( filter );
|
|
786 |
|
|
787 |
if ( ret && ptrFileName.Length() )
|
|
788 |
{
|
|
789 |
if ( !DriveReadOnlyMmcL( ptrFileName ) )
|
|
790 |
{
|
|
791 |
RunOperationL(
|
|
792 |
MFileManagerProcessObserver::EMoveProcess, ptrFileName );
|
|
793 |
}
|
|
794 |
}
|
|
795 |
if (!ret )
|
|
796 |
{
|
|
797 |
CheckPostponedDirectoryRefresh();
|
|
798 |
}
|
|
799 |
|
|
800 |
CleanupStack::PopAndDestroy( fileName );
|
|
801 |
}
|
|
802 |
|
|
803 |
// -----------------------------------------------------------------------------
|
|
804 |
// CFileManagerViewBase::CmdCopyToFolderL
|
|
805 |
//
|
|
806 |
// -----------------------------------------------------------------------------
|
|
807 |
//
|
|
808 |
void CFileManagerViewBase::CmdCopyToFolderL()
|
|
809 |
{
|
|
810 |
// double KMaxFileName is needed if both source and target are KMaxFileName
|
|
811 |
HBufC* fileName = HBufC::NewLC( KFmgrDoubleMaxFileName );
|
|
812 |
TPtr ptrFileName = fileName->Des();
|
|
813 |
CFileManagerFileSelectionFilter* filter =
|
|
814 |
new( ELeave ) CFileManagerFileSelectionFilter( iEngine );
|
|
815 |
CleanupStack::PushL( filter );
|
|
816 |
|
|
817 |
TInt memType(
|
|
818 |
AknCommonDialogsDynMem::EMemoryTypePhone |
|
|
819 |
AknCommonDialogsDynMem::EMemoryTypeMMC );
|
|
820 |
|
|
821 |
if ( FeatureManager().IsRemoteStorageFwSupported() )
|
|
822 |
{
|
|
823 |
memType |= AknCommonDialogsDynMem::EMemoryTypeRemote;
|
|
824 |
}
|
|
825 |
|
|
826 |
DenyDirectoryRefresh( ETrue );
|
|
827 |
TBool ret( AknCommonDialogsDynMem::RunCopyDlgLD(
|
|
828 |
memType,
|
|
829 |
ptrFileName,
|
|
830 |
R_FILEMANAGER_COPY_MEMORY_SELECTIONDIALOG,
|
|
831 |
filter ) );
|
|
832 |
DenyDirectoryRefresh( EFalse );
|
|
833 |
CleanupStack::PopAndDestroy( filter );
|
|
834 |
|
|
835 |
if ( ret && ptrFileName.Length() )
|
|
836 |
{
|
|
837 |
if ( !DriveReadOnlyMmcL( ptrFileName ) )
|
|
838 |
{
|
|
839 |
RunOperationL(
|
|
840 |
MFileManagerProcessObserver::ECopyProcess, ptrFileName );
|
|
841 |
}
|
|
842 |
}
|
|
843 |
if (!ret )
|
|
844 |
{
|
|
845 |
CheckPostponedDirectoryRefresh();
|
|
846 |
}
|
|
847 |
CleanupStack::PopAndDestroy( fileName );
|
|
848 |
}
|
|
849 |
|
|
850 |
// -----------------------------------------------------------------------------
|
|
851 |
// CFileManagerViewBase::CmdNewFolderL
|
|
852 |
//
|
|
853 |
// -----------------------------------------------------------------------------
|
|
854 |
//
|
|
855 |
void CFileManagerViewBase::CmdNewFolderL()
|
|
856 |
{
|
|
857 |
|
|
858 |
if ( DriveReadOnlyMmcL( iEngine.CurrentDirectory() ) )
|
|
859 |
{
|
|
860 |
return;
|
|
861 |
}
|
|
862 |
|
|
863 |
StoreIndex();
|
|
864 |
|
|
865 |
if ( !iEngine.EnoughSpaceL(
|
|
866 |
iEngine.CurrentDirectory(),
|
|
867 |
0,
|
|
868 |
MFileManagerProcessObserver::ENoProcess ) )
|
|
869 |
{
|
|
870 |
User::Leave( KErrDiskFull );
|
|
871 |
}
|
|
872 |
HBufC* folderNameBuf = HBufC::NewLC( KMaxFileName );
|
|
873 |
TPtr folderName( folderNameBuf->Des() );
|
|
874 |
|
|
875 |
if ( FileManagerDlgUtils::ShowFolderNameQueryL(
|
|
876 |
R_QTN_FLDR_NAME_PRMPT, folderName, iEngine, ETrue ) )
|
|
877 |
{
|
|
878 |
TBuf<KMaxPath> fullFolderName( iEngine.CurrentDirectory() );
|
|
879 |
fullFolderName.Append( folderName );
|
|
880 |
CFileManagerUtils::EnsureFinalBackslash( fullFolderName );
|
|
881 |
|
|
882 |
if ( iEngine.IsSystemFolder( fullFolderName ) )
|
|
883 |
{
|
|
884 |
FileManagerDlgUtils::ShowInfoNoteL( R_QTN_FLDR_NAME_ALREADY_USED, folderName );
|
|
885 |
}
|
|
886 |
else
|
|
887 |
{
|
|
888 |
iEngine.NewFolderL( folderName );
|
|
889 |
}
|
|
890 |
iEngine.SetObserver( this );
|
|
891 |
iEngine.RefreshDirectory();
|
|
892 |
}
|
|
893 |
else
|
|
894 |
{
|
|
895 |
if ( iContainer && iContainer->IsSearchFieldVisible() )
|
|
896 |
{
|
|
897 |
iContainer->DrawDeferred();
|
|
898 |
}
|
|
899 |
}
|
|
900 |
CleanupStack::PopAndDestroy( folderNameBuf );
|
|
901 |
}
|
|
902 |
|
|
903 |
// -----------------------------------------------------------------------------
|
|
904 |
// CFileManagerViewBase::CmdToggleMarkL
|
|
905 |
//
|
|
906 |
// -----------------------------------------------------------------------------
|
|
907 |
//
|
|
908 |
void CFileManagerViewBase::CmdToggleMarkL()
|
|
909 |
{
|
|
910 |
const TInt index( iContainer->ListBoxCurrentItemIndex() );
|
|
911 |
if ( iEngine.IsFolder( index ) )
|
|
912 |
{
|
|
913 |
iContainer->ListBoxDeselectItem( index );
|
|
914 |
}
|
|
915 |
else
|
|
916 |
{
|
|
917 |
iContainer->ListBoxToggleItemL( index );
|
|
918 |
}
|
|
919 |
}
|
|
920 |
|
|
921 |
// -----------------------------------------------------------------------------
|
|
922 |
// CFileManagerViewBase::CmdMarkAllL
|
|
923 |
//
|
|
924 |
// -----------------------------------------------------------------------------
|
|
925 |
//
|
|
926 |
void CFileManagerViewBase::CmdMarkAllL()
|
|
927 |
{
|
|
928 |
iContainer->ListBoxSelectAllL();
|
|
929 |
}
|
|
930 |
|
|
931 |
// -----------------------------------------------------------------------------
|
|
932 |
// CFileManagerViewBase::CmdUnmarkAllL
|
|
933 |
//
|
|
934 |
// -----------------------------------------------------------------------------
|
|
935 |
//
|
|
936 |
void CFileManagerViewBase::CmdUnmarkAllL()
|
|
937 |
{
|
|
938 |
iContainer->ListBoxClearSelection();
|
|
939 |
}
|
|
940 |
|
|
941 |
// -----------------------------------------------------------------------------
|
|
942 |
// CFileManagerViewBase::CmdRenameL
|
|
943 |
//
|
|
944 |
// -----------------------------------------------------------------------------
|
|
945 |
//
|
|
946 |
void CFileManagerViewBase::CmdRenameL()
|
|
947 |
{
|
|
948 |
TInt index( iContainer->ListBoxCurrentItemIndex() );
|
|
949 |
if ( index >= 0 )
|
|
950 |
{
|
|
951 |
StoreIndex();
|
|
952 |
CFileManagerItemProperties* prop =
|
|
953 |
iEngine.GetItemInfoL( index );
|
|
954 |
CleanupStack::PushL( prop );
|
|
955 |
|
|
956 |
if ( DriveReadOnlyMmcL( prop->FullPath() ) )
|
|
957 |
{
|
|
958 |
CleanupStack::PopAndDestroy( prop );
|
|
959 |
return;
|
|
960 |
}
|
|
961 |
|
|
962 |
HBufC* itemNameBuf = HBufC::NewLC( KMaxFileName );
|
|
963 |
TPtr itemName( itemNameBuf->Des() );
|
|
964 |
itemName.Append( prop->NameAndExt() );
|
|
965 |
|
|
966 |
TInt err( KErrNone );
|
|
967 |
TBool ret( EFalse );
|
|
968 |
if ( prop->TypeL() & CFileManagerItemProperties::EFolder )
|
|
969 |
{
|
|
970 |
DenyDirectoryRefresh( ETrue );
|
|
971 |
TRAP( err, ret = FileManagerDlgUtils::ShowFolderNameQueryL(
|
|
972 |
R_QTN_FLDR_ITEM_NAME_PRMPT, itemName, iEngine ) );
|
|
973 |
DenyDirectoryRefresh( EFalse );
|
|
974 |
User::LeaveIfError( err );
|
|
975 |
if ( ret )
|
|
976 |
{
|
|
977 |
if ( itemName.Length() > 1 )
|
|
978 |
{
|
|
979 |
if ( itemName[0] == '.' )
|
|
980 |
{
|
|
981 |
TInt j = 1;
|
|
982 |
for ( j; j < itemName.Length(); j++ )
|
|
983 |
{
|
|
984 |
if ( !( (itemName[j] <= 'Z') && (itemName[j] >= 'A') ) )
|
|
985 |
{
|
|
986 |
break;
|
|
987 |
}
|
|
988 |
}
|
|
989 |
if ( j == itemName.Length() )
|
|
990 |
{
|
|
991 |
itemName.Delete(0, 1);
|
|
992 |
}
|
|
993 |
}
|
|
994 |
}
|
|
995 |
TRAP( err, iEngine.RenameL( index, itemName ) );
|
|
996 |
if ( err == KErrAccessDenied ||
|
|
997 |
err == KErrInUse ||
|
|
998 |
err == KErrBadName ||
|
|
999 |
err == KErrAlreadyExists ||
|
|
1000 |
err == KErrNotReady )
|
|
1001 |
{
|
|
1002 |
err = KErrNone; // Set error as handled
|
|
1003 |
FileManagerDlgUtils::ShowInfoNoteL(
|
|
1004 |
R_QTN_FLDR_CANT_RENAME_ITEM,
|
|
1005 |
prop->NameAndExt() );
|
|
1006 |
}
|
|
1007 |
}
|
|
1008 |
}
|
|
1009 |
else
|
|
1010 |
{
|
|
1011 |
DenyDirectoryRefresh( ETrue );
|
|
1012 |
TRAP( err, ret = FileManagerDlgUtils::ShowFileNameQueryL(
|
|
1013 |
R_QTN_FLDR_ITEM_NAME_PRMPT, prop->FullPath(), itemName, iEngine ) );
|
|
1014 |
DenyDirectoryRefresh( EFalse );
|
|
1015 |
User::LeaveIfError( err );
|
|
1016 |
if ( ret )
|
|
1017 |
{
|
|
1018 |
TRAP( err, iEngine.RenameL( index, itemName ) );
|
|
1019 |
if ( err == KErrAccessDenied ||
|
|
1020 |
err == KErrInUse ||
|
|
1021 |
err == KErrBadName ||
|
|
1022 |
err == KErrAlreadyExists ||
|
|
1023 |
err == KErrNotReady )
|
|
1024 |
{
|
|
1025 |
err = KErrNone; // Set error as handled
|
|
1026 |
FileManagerDlgUtils::ShowInfoNoteL(
|
|
1027 |
R_QTN_FLDR_CANT_RENAME_ITEM,
|
|
1028 |
prop->NameAndExt() );
|
|
1029 |
}
|
|
1030 |
}
|
|
1031 |
}
|
|
1032 |
|
|
1033 |
CleanupStack::PopAndDestroy( itemNameBuf );
|
|
1034 |
CleanupStack::PopAndDestroy( prop );
|
|
1035 |
User::LeaveIfError( err );
|
|
1036 |
}
|
|
1037 |
iEngine.SetObserver( this );
|
|
1038 |
iEngine.RefreshDirectory();
|
|
1039 |
}
|
|
1040 |
|
|
1041 |
// -----------------------------------------------------------------------------
|
|
1042 |
// CFileManagerViewBase::CmdFindL
|
|
1043 |
//
|
|
1044 |
// -----------------------------------------------------------------------------
|
|
1045 |
//
|
|
1046 |
void CFileManagerViewBase::CmdFindL()
|
|
1047 |
{
|
|
1048 |
HBufC* path = HBufC::NewLC( KMaxFileName );
|
|
1049 |
TPtr ptrPath( path->Des() );
|
|
1050 |
if( AskPathL( ptrPath, R_QTN_FMGR_FIND_PRTX ) )
|
|
1051 |
{
|
|
1052 |
HBufC* searchStringBuf = HBufC::NewLC( KMaxFileName );
|
|
1053 |
TPtr searchString( searchStringBuf->Des() );
|
|
1054 |
HBufC* prompt = StringLoader::LoadLC( R_QTN_FMGR_FIND_DATAQ_PRTX );
|
|
1055 |
CAknTextQueryDialog *textQuery =
|
|
1056 |
new( ELeave ) CAknTextQueryDialog( searchString, *prompt );
|
|
1057 |
if ( textQuery->ExecuteLD( R_FILEMANAGER_SEARCH_QUERY ) )
|
|
1058 |
{
|
|
1059 |
iEngine.SetSearchStringL( searchString );
|
|
1060 |
iEngine.SetSearchFolderL( ptrPath );
|
|
1061 |
if ( Id() == CFileManagerAppUi::KFileManagerSearchResultsViewId )
|
|
1062 |
{
|
|
1063 |
// Start new search in the existing view
|
|
1064 |
iIndex = 0;
|
|
1065 |
iEngine.SetObserver( this );
|
|
1066 |
iEngine.RefreshDirectory();
|
|
1067 |
}
|
|
1068 |
else
|
|
1069 |
{
|
|
1070 |
// Open search view and start new search
|
|
1071 |
StoreIndex();
|
|
1072 |
// Ensure that current directory is set correctly.
|
|
1073 |
// If current view was opened from previous search results view,
|
|
1074 |
// backstep stack to current directory may be incomplete.
|
|
1075 |
iEngine.SetDirectoryWithBackstepsL( iEngine.CurrentDirectory() );
|
|
1076 |
CFileManagerAppUi* appUi =
|
|
1077 |
static_cast< CFileManagerAppUi* >( AppUi() );
|
|
1078 |
appUi->ActivateSearchResultsViewL();
|
|
1079 |
}
|
|
1080 |
}
|
|
1081 |
CleanupStack::PopAndDestroy( prompt );
|
|
1082 |
CleanupStack::PopAndDestroy( searchStringBuf );
|
|
1083 |
}
|
|
1084 |
CleanupStack::PopAndDestroy( path );
|
|
1085 |
}
|
|
1086 |
|
|
1087 |
// -----------------------------------------------------------------------------
|
|
1088 |
// CFileManagerViewBase::CmdViewInfoL
|
|
1089 |
//
|
|
1090 |
// -----------------------------------------------------------------------------
|
|
1091 |
//
|
|
1092 |
void CFileManagerViewBase::CmdViewInfoL()
|
|
1093 |
{
|
|
1094 |
TInt index( iContainer->ListBoxCurrentItemIndex() );
|
|
1095 |
if ( index >= 0 )
|
|
1096 |
{
|
|
1097 |
CFileManagerItemProperties* prop = iEngine.GetItemInfoL( index );
|
|
1098 |
CleanupStack::PushL( prop );
|
|
1099 |
FileManagerDlgUtils::ShowItemInfoPopupL( *prop, FeatureManager() );
|
|
1100 |
CleanupStack::PopAndDestroy( prop );
|
|
1101 |
}
|
|
1102 |
}
|
|
1103 |
|
|
1104 |
// -----------------------------------------------------------------------------
|
|
1105 |
// CFileManagerViewBase::CmdMemoryStateL
|
|
1106 |
//
|
|
1107 |
// -----------------------------------------------------------------------------
|
|
1108 |
//
|
|
1109 |
//void CFileManagerViewBase::CmdMemoryStateL()
|
|
1110 |
// {
|
|
1111 |
// TInt drv( iEngine.CurrentDrive() );
|
|
1112 |
// if ( drv != KErrNotFound )
|
|
1113 |
// {
|
|
1114 |
// HBufC* title = StringLoader::LoadLC( R_QTN_FMGR_MSTATE_HEADING );
|
|
1115 |
// CMemStatePopup::RunLD(
|
|
1116 |
// static_cast< TDriveNumber >( drv ), *title );
|
|
1117 |
// CleanupStack::PopAndDestroy( title );
|
|
1118 |
// }
|
|
1119 |
// }
|
|
1120 |
|
|
1121 |
// -----------------------------------------------------------------------------
|
|
1122 |
// CFileManagerViewBase::CmdReceiveViaIR
|
|
1123 |
//
|
|
1124 |
// -----------------------------------------------------------------------------
|
|
1125 |
//
|
|
1126 |
void CFileManagerViewBase::CmdReceiveViaIRL()
|
|
1127 |
{
|
|
1128 |
|
|
1129 |
if ( DriveReadOnlyMmcL( iEngine.CurrentDirectory() ) )
|
|
1130 |
{
|
|
1131 |
return;
|
|
1132 |
}
|
|
1133 |
|
|
1134 |
iEngine.SetObserver( this );
|
|
1135 |
|
|
1136 |
ClearProgressBarL();
|
|
1137 |
|
|
1138 |
iProgressDialog = new( ELeave ) CAknProgressDialog(
|
|
1139 |
reinterpret_cast< CEikDialog** >( &iProgressDialog ), ETrue );
|
|
1140 |
iProgressDialog->PrepareLC( R_FILE_RECEIVE_DIALOG );
|
|
1141 |
iProgressInfo = iProgressDialog->GetProgressInfoL();
|
|
1142 |
if ( iProgressInfo )
|
|
1143 |
{
|
|
1144 |
// final value is 100 percent
|
|
1145 |
iProgressInfo->SetFinalValue( KMaxPercentage );
|
|
1146 |
}
|
|
1147 |
iProgressDialog->RunLD();
|
|
1148 |
iProgressDialog->SetCallback( this );
|
|
1149 |
|
|
1150 |
HBufC* label = StringLoader::LoadLC( R_QTN_IR_CONNECTING );
|
|
1151 |
iProgressDialog->SetTextL( *label );
|
|
1152 |
CleanupStack::PopAndDestroy( label );
|
|
1153 |
|
|
1154 |
CFileManagerAppUi* appUi = static_cast< CFileManagerAppUi* >( AppUi() );
|
|
1155 |
TRAPD( err, appUi->StartIRReceiveL( *this ) );
|
|
1156 |
|
|
1157 |
if ( err == KErrNone )
|
|
1158 |
{
|
|
1159 |
iActiveProcess = MFileManagerProcessObserver::EIRReceiveProcess;
|
|
1160 |
}
|
|
1161 |
else
|
|
1162 |
{
|
|
1163 |
ClearProgressBarL();
|
|
1164 |
User::Leave( err );
|
|
1165 |
}
|
|
1166 |
}
|
|
1167 |
|
|
1168 |
|
|
1169 |
// -----------------------------------------------------------------------------
|
|
1170 |
// CFileManagerViewBase::DynInitMenuPaneL
|
|
1171 |
//
|
|
1172 |
// -----------------------------------------------------------------------------
|
|
1173 |
//
|
|
1174 |
void CFileManagerViewBase::DynInitMenuPaneL( TInt aResourceId,
|
|
1175 |
CEikMenuPane* aMenuPane)
|
|
1176 |
{
|
|
1177 |
TBool isHandled( ETrue );
|
|
1178 |
|
|
1179 |
switch( aResourceId )
|
|
1180 |
{
|
|
1181 |
// These menus are used by memory store and folders views
|
|
1182 |
case R_FILEMANAGER_MEMORY_STORE_VIEW_MENU:
|
|
1183 |
{
|
|
1184 |
MemoryStoreMenuFilteringL( *aMenuPane );
|
|
1185 |
break;
|
|
1186 |
}
|
|
1187 |
case R_FILEMANAGER_MARK_UNMARK_MENU:
|
|
1188 |
case R_FILEMANAGER_CONTEXT_SENSITIVE_MARK_UNMARK_MENU:
|
|
1189 |
{
|
|
1190 |
MarkMenuFilteringL( *aMenuPane );
|
|
1191 |
break;
|
|
1192 |
}
|
|
1193 |
case R_FILEMANAGER_ORGANISE_MENU:
|
|
1194 |
{
|
|
1195 |
OrganiseMenuFilteringL( *aMenuPane );
|
|
1196 |
break;
|
|
1197 |
}
|
|
1198 |
case R_FILEMANAGER_DETAILS_MENU:
|
|
1199 |
{
|
|
1200 |
DetailsMenuFilteringL( *aMenuPane );
|
|
1201 |
break;
|
|
1202 |
}
|
|
1203 |
// case R_FILEMANAGER_MEMORY_CARD_MENU:
|
|
1204 |
// {
|
|
1205 |
// MemoryCardMenuFilteringL( *aMenuPane );
|
|
1206 |
// break;
|
|
1207 |
// }
|
|
1208 |
// case R_FILEMANAGER_MEMORY_CARD_PASSWORD_MENU:
|
|
1209 |
// {
|
|
1210 |
// MemoryCardPasswordMenuFilteringL( *aMenuPane );
|
|
1211 |
// break;
|
|
1212 |
// }
|
|
1213 |
case R_FILEMANAGER_CONTEXT_SENSITIVE_MENU:
|
|
1214 |
{
|
|
1215 |
ContextSensitiveMenuFilteringL( *aMenuPane );
|
|
1216 |
break;
|
|
1217 |
}
|
|
1218 |
case R_FILEMANAGER_SORT_MENU:
|
|
1219 |
case R_FILEMANAGER_SEARCH_SORT_MENU: // Fall through
|
|
1220 |
{
|
|
1221 |
SortMenuFilteringL( *aMenuPane );
|
|
1222 |
break;
|
|
1223 |
}
|
|
1224 |
default:
|
|
1225 |
{
|
|
1226 |
isHandled = EFalse;
|
|
1227 |
break;
|
|
1228 |
}
|
|
1229 |
}
|
|
1230 |
|
|
1231 |
TBool isContextMenu( aResourceId == R_FILEMANAGER_CONTEXT_SENSITIVE_MENU );
|
|
1232 |
if ( isHandled || isContextMenu )
|
|
1233 |
{
|
|
1234 |
CEikMenuBar* menuBar = MenuBar();
|
|
1235 |
if ( menuBar )
|
|
1236 |
{
|
|
1237 |
if ( isContextMenu )
|
|
1238 |
{
|
|
1239 |
menuBar->SetMenuType( CEikMenuBar::EMenuContext );
|
|
1240 |
}
|
|
1241 |
else
|
|
1242 |
{
|
|
1243 |
menuBar->SetMenuType( CEikMenuBar::EMenuOptions );
|
|
1244 |
}
|
|
1245 |
}
|
|
1246 |
}
|
|
1247 |
}
|
|
1248 |
|
|
1249 |
// -----------------------------------------------------------------------------
|
|
1250 |
// CFileManagerViewBase::DoActivateL
|
|
1251 |
//
|
|
1252 |
// -----------------------------------------------------------------------------
|
|
1253 |
//
|
|
1254 |
void CFileManagerViewBase::DoActivateL( const TVwsViewId& /*aPrevViewId*/,
|
|
1255 |
TUid /*aCustomMessageId*/,
|
|
1256 |
const TDesC8& /*aCustomMessage*/ )
|
|
1257 |
{
|
|
1258 |
if ( !iContainer )
|
|
1259 |
{
|
|
1260 |
iContainer = CreateContainerL();
|
|
1261 |
iContainer->SetMopParent( this );
|
|
1262 |
AppUi()->AddToStackL( *this, iContainer );
|
|
1263 |
iEngine.SetObserver( this );
|
|
1264 |
iContainer->ActivateL();
|
|
1265 |
}
|
|
1266 |
|
|
1267 |
if ( iContainer )
|
|
1268 |
{
|
|
1269 |
iContainer->SetListEmptyL();
|
|
1270 |
}
|
|
1271 |
|
|
1272 |
// Set container to observe MSK commands
|
|
1273 |
CEikButtonGroupContainer* bgc = Cba();
|
|
1274 |
if ( bgc )
|
|
1275 |
{
|
|
1276 |
CEikCba* cba = static_cast< CEikCba* >( bgc->ButtonGroup() );
|
|
1277 |
cba->SetMSKCommandObserver( iContainer );
|
|
1278 |
}
|
|
1279 |
}
|
|
1280 |
|
|
1281 |
// -----------------------------------------------------------------------------
|
|
1282 |
// CFileManagerViewBase::DoDeactivate
|
|
1283 |
//
|
|
1284 |
// -----------------------------------------------------------------------------
|
|
1285 |
//
|
|
1286 |
void CFileManagerViewBase::DoDeactivate()
|
|
1287 |
{
|
|
1288 |
if ( iContainer )
|
|
1289 |
{
|
|
1290 |
AppUi()->RemoveFromStack( iContainer );
|
|
1291 |
delete iContainer;
|
|
1292 |
iContainer = NULL;
|
|
1293 |
}
|
|
1294 |
}
|
|
1295 |
|
|
1296 |
// -----------------------------------------------------------------------------
|
|
1297 |
// CFileManagerViewBase::MarkedArrayLC
|
|
1298 |
//
|
|
1299 |
// -----------------------------------------------------------------------------
|
|
1300 |
//
|
|
1301 |
CArrayFixFlat<TInt>* CFileManagerViewBase::MarkedArrayLC()
|
|
1302 |
{
|
|
1303 |
TInt count( iContainer->ListBoxSelectionIndexesCount() );
|
|
1304 |
CArrayFixFlat<TInt>* ret =
|
|
1305 |
new( ELeave ) CArrayFixFlat<TInt>( count ? count : 1 );
|
|
1306 |
|
|
1307 |
CleanupStack::PushL( ret );
|
|
1308 |
|
|
1309 |
if ( !count )
|
|
1310 |
{
|
|
1311 |
if ( iContainer->ListBoxNumberOfItems() > 0)
|
|
1312 |
{
|
|
1313 |
ret->AppendL( iContainer->ListBoxCurrentItemIndex() );
|
|
1314 |
}
|
|
1315 |
return ret;
|
|
1316 |
}
|
|
1317 |
|
|
1318 |
const CArrayFix< TInt >* items = iContainer->ListBoxSelectionIndexes();
|
|
1319 |
for( TInt i( 0 ); i < count; ++i )
|
|
1320 |
{
|
|
1321 |
ret->AppendL( items->At( i ) );
|
|
1322 |
}
|
|
1323 |
return ret;
|
|
1324 |
}
|
|
1325 |
|
|
1326 |
// -----------------------------------------------------------------------------
|
|
1327 |
// CFileManagerViewBase::DialogDismissedL
|
|
1328 |
//
|
|
1329 |
// -----------------------------------------------------------------------------
|
|
1330 |
//
|
|
1331 |
void CFileManagerViewBase::DialogDismissedL( TInt aButtonId )
|
|
1332 |
{
|
|
1333 |
FUNC_LOG
|
|
1334 |
|
|
1335 |
if ( aButtonId == EAknSoftkeyCancel )
|
|
1336 |
{
|
|
1337 |
TBool isHandled( ETrue );
|
|
1338 |
switch( iActiveProcess )
|
|
1339 |
{
|
|
1340 |
case ENoProcess:
|
|
1341 |
{
|
|
1342 |
if ( IsRefreshInProgress() )
|
|
1343 |
{
|
|
1344 |
// Already freed, just set to NULL
|
|
1345 |
iProgressDialogRefresh = NULL;
|
|
1346 |
iEngine.CancelRefresh();
|
|
1347 |
DirectoryChangedL(); // Ensure that view gets updated
|
|
1348 |
}
|
|
1349 |
break;
|
|
1350 |
}
|
|
1351 |
case EIRReceiveProcess:
|
|
1352 |
{
|
|
1353 |
// Already freed, just set to NULL
|
|
1354 |
iProgressDialog = NULL;
|
|
1355 |
iProgressInfo = NULL;
|
|
1356 |
|
|
1357 |
static_cast< CFileManagerAppUi* >( AppUi() )->StopIRReceive();
|
|
1358 |
break;
|
|
1359 |
}
|
|
1360 |
case ECopyProcess: // FALLTHROUGH
|
|
1361 |
case EMoveProcess:
|
|
1362 |
{
|
|
1363 |
// Already freed, just set to NULL
|
|
1364 |
iProgressDialog = NULL;
|
|
1365 |
iProgressInfo = NULL;
|
|
1366 |
|
|
1367 |
delete iPeriodic;
|
|
1368 |
iPeriodic = NULL;
|
|
1369 |
if ( iActiveExec )
|
|
1370 |
{
|
|
1371 |
iActiveExec->CancelExecution();
|
|
1372 |
}
|
|
1373 |
break;
|
|
1374 |
}
|
|
1375 |
case EFileOpenProcess: // FALLTHROUGH
|
|
1376 |
case EBackupProcess: // FALLTHROUGH
|
|
1377 |
case ERestoreProcess:
|
|
1378 |
{
|
|
1379 |
// Already freed, just set to NULL
|
|
1380 |
iProgressDialog = NULL;
|
|
1381 |
iProgressInfo = NULL;
|
|
1382 |
|
|
1383 |
iEngine.CancelProcess( iActiveProcess );
|
|
1384 |
if ( iActiveProcess == EBackupProcess ||
|
|
1385 |
iActiveProcess == ERestoreProcess )
|
|
1386 |
{
|
|
1387 |
CFileManagerAppUi* appUi = static_cast< CFileManagerAppUi* >( AppUi() );
|
|
1388 |
appUi->BackupOrRestoreEnded();
|
|
1389 |
}
|
|
1390 |
break;
|
|
1391 |
}
|
|
1392 |
case EFormatProcess: // FALLTHROUGH
|
|
1393 |
case EEjectProcess:
|
|
1394 |
{
|
|
1395 |
// Already freed, just set to NULL
|
|
1396 |
iProgressDialog = NULL;
|
|
1397 |
iProgressInfo = NULL;
|
|
1398 |
break;
|
|
1399 |
}
|
|
1400 |
default:
|
|
1401 |
{
|
|
1402 |
isHandled = EFalse;
|
|
1403 |
break;
|
|
1404 |
}
|
|
1405 |
}
|
|
1406 |
if ( isHandled )
|
|
1407 |
{
|
|
1408 |
iEikonEnv->SetSystem( EFalse );
|
|
1409 |
iActiveProcess = ENoProcess;
|
|
1410 |
}
|
|
1411 |
|
|
1412 |
#ifdef RD_FILE_MANAGER_BACKUP
|
|
1413 |
if ( iSchBackupPending )
|
|
1414 |
{
|
|
1415 |
StartSchBackupL();
|
|
1416 |
}
|
|
1417 |
#endif // RD_FILE_MANAGER_BACKUP
|
|
1418 |
|
|
1419 |
}
|
|
1420 |
}
|
|
1421 |
|
|
1422 |
// -----------------------------------------------------------------------------
|
|
1423 |
// CFileManagerViewBase::ProcessFinishedL
|
|
1424 |
//
|
|
1425 |
// -----------------------------------------------------------------------------
|
|
1426 |
//
|
|
1427 |
void CFileManagerViewBase::ProcessFinishedL( TInt aError, const TDesC& aName )
|
|
1428 |
{
|
|
1429 |
FUNC_LOG
|
|
1430 |
|
|
1431 |
TRAPD( err, DoProcessFinishedL( aError, aName ) );
|
|
1432 |
if( err != KErrNone )
|
|
1433 |
{
|
|
1434 |
// Clean up the active process before forwarding leave
|
|
1435 |
ERROR_LOG2(
|
|
1436 |
"CFileManagerViewBase::ProcessFinishedL-iActiveProcess=%d,err=%d",
|
|
1437 |
iActiveProcess, err )
|
|
1438 |
iEikonEnv->SetSystem( EFalse );
|
|
1439 |
iActiveProcess = ENoProcess;
|
|
1440 |
User::Leave( err );
|
|
1441 |
}
|
|
1442 |
}
|
|
1443 |
|
|
1444 |
// -----------------------------------------------------------------------------
|
|
1445 |
// CFileManagerViewBase::DoProcessFinishedL
|
|
1446 |
//
|
|
1447 |
// -----------------------------------------------------------------------------
|
|
1448 |
//
|
|
1449 |
void CFileManagerViewBase::DoProcessFinishedL( TInt aError, const TDesC& aName )
|
|
1450 |
{
|
|
1451 |
FUNC_LOG
|
|
1452 |
|
|
1453 |
TBool isHandled( ETrue );
|
|
1454 |
TBool doRefresh( ETrue );
|
|
1455 |
|
|
1456 |
LOG_IF_ERROR2( aError, "CFileManagerViewBase::DoProcessFinishedL-iActiveProcess=%d,aError=%d",
|
|
1457 |
iActiveProcess, aError )
|
|
1458 |
|
|
1459 |
if ( iPeriodic && iProgressInfo && iTotalTransferredBytes )
|
|
1460 |
{
|
|
1461 |
iProgressInfo->SetAndDraw( iTotalTransferredBytes );
|
|
1462 |
}
|
|
1463 |
if ( IsSystemProcess( iActiveProcess ) )
|
|
1464 |
{
|
|
1465 |
// Remove system status to allow app close from task switcher
|
|
1466 |
iEikonEnv->SetSystem( EFalse );
|
|
1467 |
}
|
|
1468 |
|
|
1469 |
ClearProgressBarL();
|
|
1470 |
|
|
1471 |
switch( iActiveProcess )
|
|
1472 |
{
|
|
1473 |
case EIRReceiveProcess: // FALLTHROUGH
|
|
1474 |
{
|
|
1475 |
static_cast< CFileManagerAppUi* >( AppUi() )->StopIRReceive();
|
|
1476 |
if ( aError != KErrNone && aError != KErrCancel )
|
|
1477 |
{
|
|
1478 |
if ( aError == KErrDiskFull )
|
|
1479 |
{
|
|
1480 |
ShowDiskSpaceErrorL( iEngine.CurrentDirectory() );
|
|
1481 |
}
|
|
1482 |
else
|
|
1483 |
{
|
|
1484 |
// Show general error note
|
|
1485 |
Error( aError );
|
|
1486 |
}
|
|
1487 |
}
|
|
1488 |
break;
|
|
1489 |
}
|
|
1490 |
case ECopyProcess: // FALLTHROUGH
|
|
1491 |
case EMoveProcess:
|
|
1492 |
{
|
|
1493 |
if ( aError != KErrNone && aError != KErrCancel && !aName.Length() )
|
|
1494 |
{
|
|
1495 |
// Show general error note if item name is unavailable
|
|
1496 |
if ( iActiveExec && aError == KErrDiskFull )
|
|
1497 |
{
|
|
1498 |
ShowDiskSpaceErrorL( iActiveExec->ToFolder() );
|
|
1499 |
}
|
|
1500 |
else
|
|
1501 |
{
|
|
1502 |
Error( aError );
|
|
1503 |
}
|
|
1504 |
}
|
|
1505 |
else if ( aError != KErrNone )
|
|
1506 |
{
|
|
1507 |
// If the copy process is cancelled, no error notes should be displayed
|
|
1508 |
if( aError != KErrCancel )
|
|
1509 |
{
|
|
1510 |
// Show more informative note first
|
|
1511 |
if ( iActiveExec && aError == KErrDiskFull )
|
|
1512 |
{
|
|
1513 |
ShowDiskSpaceErrorL( iActiveExec->ToFolder() );
|
|
1514 |
}
|
|
1515 |
else if ( aError == KErrNoMemory ||
|
|
1516 |
aError == KErrDiskFull ||
|
|
1517 |
aError == KErrDirFull )
|
|
1518 |
{
|
|
1519 |
Error( aError );
|
|
1520 |
}
|
|
1521 |
if ( iActiveProcess == EMoveProcess )
|
|
1522 |
{
|
|
1523 |
FileManagerDlgUtils::ShowErrorNoteL(
|
|
1524 |
R_QTN_FLDR_ITEM_CANNOT_BE_MOVED, aName );
|
|
1525 |
}
|
|
1526 |
else
|
|
1527 |
{
|
|
1528 |
FileManagerDlgUtils::ShowErrorNoteL(
|
|
1529 |
R_QTN_FLDR_ITEM_CANNOT_BE_COPIED, aName );
|
|
1530 |
}
|
|
1531 |
}
|
|
1532 |
delete iActiveExec;
|
|
1533 |
iActiveExec = NULL;
|
|
1534 |
}
|
|
1535 |
else if ( iActiveProcess == EMoveProcess && iMarkedArray )
|
|
1536 |
{
|
|
1537 |
// Set focus to the item after selection
|
|
1538 |
TInt newIndex( MinIndex( *iMarkedArray ) );
|
|
1539 |
if ( iContainer )
|
|
1540 |
{
|
|
1541 |
iContainer->SetIndex( newIndex );
|
|
1542 |
}
|
|
1543 |
StoreIndex();
|
|
1544 |
}
|
|
1545 |
|
|
1546 |
break;
|
|
1547 |
}
|
|
1548 |
case EFileOpenProcess:
|
|
1549 |
{
|
|
1550 |
if ( aError != KErrNone && aError != KErrCancel )
|
|
1551 |
{
|
|
1552 |
if ( aError == KErrNoMemory || aError == KErrDiskFull )
|
|
1553 |
{
|
|
1554 |
Error( aError );
|
|
1555 |
}
|
|
1556 |
else if ( aError == KErrNotSupported )
|
|
1557 |
{
|
|
1558 |
FileManagerDlgUtils::ShowErrorNoteL(
|
|
1559 |
R_QTN_FMGR_ERROR_UNSUPPORT );
|
|
1560 |
}
|
|
1561 |
else if ( aError == KErrFmgrNotSupportedRemotely )
|
|
1562 |
{
|
|
1563 |
FileManagerDlgUtils::ShowConfirmQueryWithOkL(
|
|
1564 |
FileManagerDlgUtils::EInfoIcons,
|
|
1565 |
R_QTN_FMGR_INFONOTE_UNABLE_OPEN_REMOTELY );
|
|
1566 |
}
|
|
1567 |
else if ( !HandleFileNotFoundL( aError ) )
|
|
1568 |
{
|
|
1569 |
FileManagerDlgUtils::ShowErrorNoteL(
|
|
1570 |
R_QTN_FMGR_ERROR_CANT_OPEN );
|
|
1571 |
}
|
|
1572 |
}
|
|
1573 |
else
|
|
1574 |
{
|
|
1575 |
// No refresh needed if open was successful or canceled
|
|
1576 |
doRefresh = EFalse;
|
|
1577 |
}
|
|
1578 |
break;
|
|
1579 |
}
|
|
1580 |
case EFormatProcess:
|
|
1581 |
{
|
|
1582 |
TFileManagerDriveInfo drvInfo;
|
|
1583 |
DriveInfoAtCurrentPosL( drvInfo );
|
|
1584 |
if ( aError == KErrNone )
|
|
1585 |
{
|
|
1586 |
#ifdef RD_MULTIPLE_DRIVE
|
|
1587 |
if ( drvInfo.iState & TFileManagerDriveInfo::EDriveMassStorage )
|
|
1588 |
{
|
|
1589 |
FileManagerDlgUtils::ShowInfoNoteL(
|
|
1590 |
R_QTN_FMGR_MASS_FORMAT_COMPLETED );
|
|
1591 |
}
|
|
1592 |
else
|
|
1593 |
{
|
|
1594 |
#endif // RD_MULTIPLE_DRIVE
|
|
1595 |
FileManagerDlgUtils::ShowInfoNoteL( R_QTN_FORMAT_COMPLETED );
|
|
1596 |
|
|
1597 |
// After formatting a name to the card can be given
|
|
1598 |
RenameDriveL( ETrue );
|
|
1599 |
#ifdef RD_MULTIPLE_DRIVE
|
|
1600 |
}
|
|
1601 |
#endif // RD_MULTIPLE_DRIVE
|
|
1602 |
}
|
|
1603 |
else if ( aError == KErrInUse || aError > 0 )
|
|
1604 |
{
|
|
1605 |
FileManagerDlgUtils::ShowErrorNoteL(
|
|
1606 |
R_QTN_FORMAT_FILES_IN_USE );
|
|
1607 |
}
|
|
1608 |
else if ( aError != KErrCancel )
|
|
1609 |
{
|
|
1610 |
FileManagerDlgUtils::ShowErrorNoteL(
|
|
1611 |
R_QTN_CRITICAL_ERROR );
|
|
1612 |
}
|
|
1613 |
break;
|
|
1614 |
}
|
|
1615 |
case EBackupProcess:
|
|
1616 |
{
|
|
1617 |
CFileManagerAppUi* appUi = static_cast< CFileManagerAppUi* >( AppUi() );
|
|
1618 |
appUi->BackupOrRestoreEnded();
|
|
1619 |
if ( aError == KErrNone )
|
|
1620 |
{
|
|
1621 |
FileManagerDlgUtils::ShowInfoNoteL(
|
|
1622 |
R_QTN_BACKUP_COMPLETED );
|
|
1623 |
}
|
|
1624 |
else if ( aError == KErrDiskFull )
|
|
1625 |
{
|
|
1626 |
#ifdef RD_FILE_MANAGER_BACKUP
|
|
1627 |
|
|
1628 |
CFileManagerBackupSettings& settings(
|
|
1629 |
iEngine.BackupSettingsL() );
|
|
1630 |
|
|
1631 |
FileManagerDlgUtils::ShowConfirmQueryWithOkL(
|
|
1632 |
FileManagerDlgUtils::EErrorIcons,
|
|
1633 |
R_QTN_FMGR_BACKUP_DESTINATION_FULL,
|
|
1634 |
iEngine.DriveName( settings.TargetDrive() ) );
|
|
1635 |
|
|
1636 |
#else // RD_FILE_MANAGER_BACKUP
|
|
1637 |
|
|
1638 |
FileManagerDlgUtils::ShowErrorNoteL(
|
|
1639 |
R_QTN_BACKUP_NO_SPACE );
|
|
1640 |
|
|
1641 |
#endif // RD_FILE_MANAGER_BACKUP
|
|
1642 |
}
|
|
1643 |
else if ( aError > 0 )
|
|
1644 |
{
|
|
1645 |
// No critical error, but some files not handled
|
|
1646 |
if ( aError > 1 )
|
|
1647 |
{
|
|
1648 |
FileManagerDlgUtils::ShowConfirmQueryWithOkL(
|
|
1649 |
FileManagerDlgUtils::EInfoIcons,
|
|
1650 |
R_QTN_FILES_NOT_BACKUPPED,
|
|
1651 |
aError );
|
|
1652 |
}
|
|
1653 |
else
|
|
1654 |
{
|
|
1655 |
FileManagerDlgUtils::ShowConfirmQueryWithOkL(
|
|
1656 |
FileManagerDlgUtils::EInfoIcons,
|
|
1657 |
R_QTN_ONE_FILE_NOT_BACKUPPED );
|
|
1658 |
}
|
|
1659 |
}
|
|
1660 |
else if ( aError != KErrCancel )
|
|
1661 |
{
|
|
1662 |
if ( aError == KErrNoMemory || aError == KErrDirFull )
|
|
1663 |
{
|
|
1664 |
// Show more informative note first
|
|
1665 |
Error( aError );
|
|
1666 |
}
|
|
1667 |
FileManagerDlgUtils::ShowErrorNoteL(
|
|
1668 |
R_QTN_CRITICAL_ERROR );
|
|
1669 |
}
|
|
1670 |
break;
|
|
1671 |
}
|
|
1672 |
case ERestoreProcess:
|
|
1673 |
{
|
|
1674 |
CFileManagerAppUi* appUi = static_cast< CFileManagerAppUi* >( AppUi() );
|
|
1675 |
appUi->BackupOrRestoreEnded();
|
|
1676 |
if ( aError == KErrNone )
|
|
1677 |
{
|
|
1678 |
FileManagerDlgUtils::ShowInfoNoteL(
|
|
1679 |
R_QTN_RESTORE_COMPLETED );
|
|
1680 |
}
|
|
1681 |
else if ( aError == KErrDiskFull )
|
|
1682 |
{
|
|
1683 |
FileManagerDlgUtils::ShowErrorNoteL(
|
|
1684 |
#ifdef RD_FILE_MANAGER_BACKUP
|
|
1685 |
R_QTN_FMGR_RESTORE_SPACE_ERROR
|
|
1686 |
#else // RD_FILE_MANAGER_BACKUP
|
|
1687 |
R_QTN_RESTORE_NO_SPACE
|
|
1688 |
#endif // RD_FILE_MANAGER_BACKUP
|
|
1689 |
);
|
|
1690 |
}
|
|
1691 |
#ifdef RD_FILE_MANAGER_BACKUP
|
|
1692 |
else if ( aError == KErrCorrupt )
|
|
1693 |
{
|
|
1694 |
FileManagerDlgUtils::ShowErrorNoteL(
|
|
1695 |
R_QTN_FMGR_ERROR_CORRUPTED_BACKUP_FILE );
|
|
1696 |
}
|
|
1697 |
#endif // RD_FILE_MANAGER_BACKUP
|
|
1698 |
else if ( aError > 0 )
|
|
1699 |
{
|
|
1700 |
// No critical error, but some files not handled
|
|
1701 |
if ( aError > 1 )
|
|
1702 |
{
|
|
1703 |
FileManagerDlgUtils::ShowInfoNoteL(
|
|
1704 |
R_QTN_FILES_NOT_RESTORED, aError );
|
|
1705 |
}
|
|
1706 |
else
|
|
1707 |
{
|
|
1708 |
FileManagerDlgUtils::ShowInfoNoteL(
|
|
1709 |
R_QTN_ONE_FILE_NOT_RESTORED );
|
|
1710 |
}
|
|
1711 |
}
|
|
1712 |
else
|
|
1713 |
{
|
|
1714 |
if ( aError == KErrNoMemory || aError == KErrDirFull )
|
|
1715 |
{
|
|
1716 |
// Show more informative note first
|
|
1717 |
Error( aError );
|
|
1718 |
}
|
|
1719 |
FileManagerDlgUtils::ShowErrorNoteL(
|
|
1720 |
R_QTN_CRITICAL_ERROR );
|
|
1721 |
}
|
|
1722 |
break;
|
|
1723 |
}
|
|
1724 |
case EEjectProcess:
|
|
1725 |
{
|
|
1726 |
TRAP_IGNORE( ShowEjectQueryL() );
|
|
1727 |
break;
|
|
1728 |
}
|
|
1729 |
#ifdef RD_FILE_MANAGER_BACKUP
|
|
1730 |
case ESchBackupProcess:
|
|
1731 |
{
|
|
1732 |
CFileManagerAppUi* appUi =
|
|
1733 |
static_cast< CFileManagerAppUi* >( AppUi() );
|
|
1734 |
appUi->SchBackupHandlerL().ProcessFinishedL( aError, aName );
|
|
1735 |
// No refresh needed, done by view activation
|
|
1736 |
doRefresh = EFalse;
|
|
1737 |
break;
|
|
1738 |
}
|
|
1739 |
#endif // RD_FILE_MANAGER_BACKUP
|
|
1740 |
default:
|
|
1741 |
{
|
|
1742 |
isHandled = EFalse;
|
|
1743 |
break;
|
|
1744 |
}
|
|
1745 |
}
|
|
1746 |
|
|
1747 |
if ( isHandled )
|
|
1748 |
{
|
|
1749 |
iEikonEnv->SetSystem( EFalse );
|
|
1750 |
iActiveProcess = ENoProcess;
|
|
1751 |
|
|
1752 |
if ( doRefresh )
|
|
1753 |
{
|
|
1754 |
iEngine.SetObserver( this );
|
|
1755 |
iEngine.RefreshDirectory();
|
|
1756 |
}
|
|
1757 |
}
|
|
1758 |
|
|
1759 |
#ifdef RD_FILE_MANAGER_BACKUP
|
|
1760 |
if ( iSchBackupPending )
|
|
1761 |
{
|
|
1762 |
StartSchBackupL();
|
|
1763 |
}
|
|
1764 |
#endif // RD_FILE_MANAGER_BACKUP
|
|
1765 |
|
|
1766 |
}
|
|
1767 |
|
|
1768 |
// -----------------------------------------------------------------------------
|
|
1769 |
// CFileManagerViewBase::ProcessAdvanceL
|
|
1770 |
//
|
|
1771 |
// -----------------------------------------------------------------------------
|
|
1772 |
//
|
|
1773 |
void CFileManagerViewBase::ProcessAdvanceL( TInt aValue )
|
|
1774 |
{
|
|
1775 |
FUNC_LOG
|
|
1776 |
|
|
1777 |
switch( iActiveProcess )
|
|
1778 |
{
|
|
1779 |
case EIRReceiveProcess:
|
|
1780 |
{
|
|
1781 |
if ( iProgressDialog )
|
|
1782 |
{
|
|
1783 |
HBufC* label = StringLoader::LoadLC(
|
|
1784 |
R_QTN_FMGR_NOTE_RECEIVE_IR, aValue );
|
|
1785 |
iProgressDialog->SetTextL( *label );
|
|
1786 |
CleanupStack::PopAndDestroy( label );
|
|
1787 |
// Incrementing progress of the process:
|
|
1788 |
if ( iProgressInfo )
|
|
1789 |
{
|
|
1790 |
iProgressInfo->SetAndDraw( aValue );
|
|
1791 |
}
|
|
1792 |
}
|
|
1793 |
break;
|
|
1794 |
}
|
|
1795 |
case EBackupProcess: // FALLTHROUGH
|
|
1796 |
case ERestoreProcess: // FALLTHROUGH
|
|
1797 |
case EFormatProcess:
|
|
1798 |
{
|
|
1799 |
#ifdef RD_FILE_MANAGER_BACKUP
|
|
1800 |
if ( iActiveProcess == EBackupProcess && iProgressDialog )
|
|
1801 |
{
|
|
1802 |
HBufC* label = StringLoader::LoadLC(
|
|
1803 |
R_QTN_BACKUP_INPROGRESS );
|
|
1804 |
iProgressDialog->SetTextL( *label );
|
|
1805 |
CleanupStack::PopAndDestroy( label );
|
|
1806 |
|
|
1807 |
iProgressDialog->ButtonGroupContainer().SetCommandSetL(R_AVKON_SOFTKEYS_CANCEL);
|
|
1808 |
iProgressDialog->ButtonGroupContainer().DrawDeferred();
|
|
1809 |
}
|
|
1810 |
else if ( iActiveProcess == ERestoreProcess && iProgressDialog )
|
|
1811 |
{
|
|
1812 |
HBufC* label = StringLoader::LoadLC(
|
|
1813 |
R_QTN_RESTORE_INPROGRESS );
|
|
1814 |
iProgressDialog->SetTextL( *label );
|
|
1815 |
CleanupStack::PopAndDestroy( label );
|
|
1816 |
}
|
|
1817 |
#endif // RD_FILE_MANAGER_BACKUP
|
|
1818 |
if ( iProgressInfo )
|
|
1819 |
{
|
|
1820 |
iProgressInfo->SetAndDraw( aValue );
|
|
1821 |
}
|
|
1822 |
break;
|
|
1823 |
}
|
|
1824 |
#ifdef RD_FILE_MANAGER_BACKUP
|
|
1825 |
case ESchBackupProcess:
|
|
1826 |
{
|
|
1827 |
CFileManagerAppUi* appUi =
|
|
1828 |
static_cast< CFileManagerAppUi* >( AppUi() );
|
|
1829 |
appUi->SchBackupHandlerL().ProcessAdvanceL( aValue );
|
|
1830 |
break;
|
|
1831 |
}
|
|
1832 |
#endif // RD_FILE_MANAGER_BACKUP
|
|
1833 |
default:
|
|
1834 |
{
|
|
1835 |
break;
|
|
1836 |
}
|
|
1837 |
}
|
|
1838 |
iTotalTransferredBytes = static_cast<TUint>(aValue); // to avoid over 2GB files looks likes minus value
|
|
1839 |
}
|
|
1840 |
|
|
1841 |
// -----------------------------------------------------------------------------
|
|
1842 |
// CFileManagerViewBase::ProcessStartedL
|
|
1843 |
//
|
|
1844 |
// -----------------------------------------------------------------------------
|
|
1845 |
//
|
|
1846 |
void CFileManagerViewBase::ProcessStartedL(
|
|
1847 |
MFileManagerProcessObserver::TFileManagerProcess aProcess,
|
|
1848 |
TInt aFinalValue )
|
|
1849 |
{
|
|
1850 |
FUNC_LOG
|
|
1851 |
|
|
1852 |
// For preventing shutter to close app during system process
|
|
1853 |
iEikonEnv->SetSystem( IsSystemProcess( aProcess ) );
|
|
1854 |
|
|
1855 |
switch( aProcess )
|
|
1856 |
{
|
|
1857 |
case EIRReceiveProcess:
|
|
1858 |
{
|
|
1859 |
if ( iProgressDialog )
|
|
1860 |
{
|
|
1861 |
HBufC* label = StringLoader::LoadLC(
|
|
1862 |
R_QTN_FMGR_NOTE_RECEIVE_IR, 0 );
|
|
1863 |
iProgressDialog->SetTextL( *label );
|
|
1864 |
CleanupStack::PopAndDestroy( label );
|
|
1865 |
}
|
|
1866 |
break;
|
|
1867 |
}
|
|
1868 |
case EFileOpenProcess:
|
|
1869 |
{
|
|
1870 |
ClearProgressBarL();
|
|
1871 |
LaunchProgressDialogL( 0, 0, aProcess );
|
|
1872 |
iActiveProcess = aProcess;
|
|
1873 |
break;
|
|
1874 |
}
|
|
1875 |
case ERestoreProcess:
|
|
1876 |
{
|
|
1877 |
CEikButtonGroupContainer* cba = Cba();
|
|
1878 |
cba->SetCommandSetL( R_AVKON_SOFTKEYS_EMPTY );
|
|
1879 |
cba->DrawDeferred();
|
|
1880 |
// FALLTHROUGH
|
|
1881 |
}
|
|
1882 |
case EBackupProcess: // FALLTHROUGH
|
|
1883 |
case EFormatProcess:
|
|
1884 |
{
|
|
1885 |
if ( iProgressDialog )
|
|
1886 |
{
|
|
1887 |
if ( !iProgressDialog->IsVisible() )
|
|
1888 |
{
|
|
1889 |
iProgressDialog->MakeVisible( ETrue );
|
|
1890 |
}
|
|
1891 |
}
|
|
1892 |
if ( iProgressInfo )
|
|
1893 |
{
|
|
1894 |
iProgressInfo->SetFinalValue( aFinalValue );
|
|
1895 |
}
|
|
1896 |
break;
|
|
1897 |
}
|
|
1898 |
#ifdef RD_FILE_MANAGER_BACKUP
|
|
1899 |
case ESchBackupProcess:
|
|
1900 |
{
|
|
1901 |
CFileManagerAppUi* appUi =
|
|
1902 |
static_cast< CFileManagerAppUi* >( AppUi() );
|
|
1903 |
appUi->SchBackupHandlerL().ProcessStartedL( aFinalValue );
|
|
1904 |
break;
|
|
1905 |
}
|
|
1906 |
#endif // RD_FILE_MANAGER_BACKUP
|
|
1907 |
default:
|
|
1908 |
{
|
|
1909 |
break;
|
|
1910 |
}
|
|
1911 |
}
|
|
1912 |
}
|
|
1913 |
|
|
1914 |
// -----------------------------------------------------------------------------
|
|
1915 |
// CFileManagerViewBase::RunOperationL
|
|
1916 |
//
|
|
1917 |
// -----------------------------------------------------------------------------
|
|
1918 |
//
|
|
1919 |
void CFileManagerViewBase::RunOperationL
|
|
1920 |
( MFileManagerProcessObserver::TFileManagerProcess aOperation,
|
|
1921 |
const TDesC& aToFolder )
|
|
1922 |
{
|
|
1923 |
|
|
1924 |
StoreIndex();
|
|
1925 |
delete iMarkedArray;
|
|
1926 |
iMarkedArray = NULL;
|
|
1927 |
iMarkedArray = MarkedArrayLC();
|
|
1928 |
CleanupStack::Pop( iMarkedArray );
|
|
1929 |
|
|
1930 |
// Check if marked source and destination folder are available
|
|
1931 |
if ( !iMarkedArray->Count() || !IsDriveAvailable( aToFolder ) )
|
|
1932 |
{
|
|
1933 |
return;
|
|
1934 |
}
|
|
1935 |
|
|
1936 |
CFileManagerItemProperties* prop =
|
|
1937 |
iEngine.GetItemInfoLC( iMarkedArray->At( 0 ) );
|
|
1938 |
|
|
1939 |
#ifdef __KEEP_DRM_CONTENT_ON_PHONE
|
|
1940 |
// When this flag is on all the selected items have to be gone through and checked
|
|
1941 |
// whether they are protected and the user has to be notified when moving or
|
|
1942 |
// copying file(s) is impossible. This only applies to processes from phone to MMC.
|
|
1943 |
TBool process( ETrue );
|
|
1944 |
if ( CFileManagerUtils::IsFromInternalToRemovableDrive(
|
|
1945 |
iEikonEnv->FsSession(), iEngine.CurrentDirectory(), aToFolder ) )
|
|
1946 |
{
|
|
1947 |
TInt fileAmount (iMarkedArray->Count());
|
|
1948 |
|
|
1949 |
// Only one folder can be selected at a time
|
|
1950 |
if (iEngine.IsFolder(iMarkedArray->At( 0 )))
|
|
1951 |
{
|
|
1952 |
if ( prop->FilesContainedL() == 0 && prop->FoldersContainedL() == 0)
|
|
1953 |
{
|
|
1954 |
process = ETrue;
|
|
1955 |
}
|
|
1956 |
else if (AreChosenFilesProtectedL( ETrue ))
|
|
1957 |
{
|
|
1958 |
if ( aOperation == EMoveProcess )
|
|
1959 |
{
|
|
1960 |
FileManagerDlgUtils::ShowInfoNoteL(
|
|
1961 |
R_QTN_DRM_INFO_MOVE_FOLDER_FORBID );
|
|
1962 |
}
|
|
1963 |
else
|
|
1964 |
{
|
|
1965 |
FileManagerDlgUtils::ShowInfoNoteL(
|
|
1966 |
R_QTN_DRM_INFO_COPY_FOLDER_FORBID );
|
|
1967 |
}
|
|
1968 |
process = EFalse;
|
|
1969 |
}
|
|
1970 |
else if (AreChosenFilesProtectedL( EFalse ))
|
|
1971 |
{
|
|
1972 |
TInt textId( 0 );
|
|
1973 |
if ( aOperation == EMoveProcess )
|
|
1974 |
{
|
|
1975 |
textId = R_QTN_DRM_QUERY_MOVE_FORBIDDEN;
|
|
1976 |
}
|
|
1977 |
else
|
|
1978 |
{
|
|
1979 |
textId = R_QTN_DRM_QUERY_COPY_FORBIDDEN;
|
|
1980 |
}
|
|
1981 |
if ( FileManagerDlgUtils::ShowConfirmQueryWithYesNoL(
|
|
1982 |
textId ) )
|
|
1983 |
{
|
|
1984 |
// Engine will not touch protected objects anyway
|
|
1985 |
process = ETrue;
|
|
1986 |
}
|
|
1987 |
else
|
|
1988 |
{
|
|
1989 |
process = EFalse;
|
|
1990 |
}
|
|
1991 |
}
|
|
1992 |
}
|
|
1993 |
else if ( fileAmount == 1 && AreChosenFilesProtectedL( ETrue ))
|
|
1994 |
{
|
|
1995 |
if ( aOperation == EMoveProcess )
|
|
1996 |
{
|
|
1997 |
FileManagerDlgUtils::ShowInfoNoteL(
|
|
1998 |
R_QTN_DRM_INFO_MOVE_ONE_FORBID );
|
|
1999 |
}
|
|
2000 |
else
|
|
2001 |
{
|
|
2002 |
FileManagerDlgUtils::ShowInfoNoteL(
|
|
2003 |
R_QTN_DRM_INFO_COPY_ONE_FORBID );
|
|
2004 |
}
|
|
2005 |
process= EFalse;
|
|
2006 |
}
|
|
2007 |
else if ( fileAmount > 1 && AreChosenFilesProtectedL( EFalse ))
|
|
2008 |
{
|
|
2009 |
if (AreChosenFilesProtectedL( ETrue ))
|
|
2010 |
{
|
|
2011 |
if ( aOperation == EMoveProcess )
|
|
2012 |
{
|
|
2013 |
FileManagerDlgUtils::ShowInfoNoteL(
|
|
2014 |
R_QTN_DRM_INFO_MOVE_MANY_FORBID );
|
|
2015 |
}
|
|
2016 |
else
|
|
2017 |
{
|
|
2018 |
FileManagerDlgUtils::ShowInfoNoteL(
|
|
2019 |
R_QTN_DRM_INFO_COPY_MANY_FORBID );
|
|
2020 |
}
|
|
2021 |
process= EFalse;
|
|
2022 |
}
|
|
2023 |
else
|
|
2024 |
{
|
|
2025 |
TInt textId( 0 );
|
|
2026 |
if ( aOperation == EMoveProcess )
|
|
2027 |
{
|
|
2028 |
textId = R_QTN_DRM_QUERY_MOVE_FORBIDDEN;
|
|
2029 |
}
|
|
2030 |
else
|
|
2031 |
{
|
|
2032 |
textId = R_QTN_DRM_QUERY_COPY_FORBIDDEN;
|
|
2033 |
}
|
|
2034 |
if ( FileManagerDlgUtils::ShowConfirmQueryWithYesNoL(
|
|
2035 |
textId ) )
|
|
2036 |
{
|
|
2037 |
// Engine will not touch protected objects anyway
|
|
2038 |
process = ETrue;
|
|
2039 |
}
|
|
2040 |
else
|
|
2041 |
{
|
|
2042 |
process = EFalse;
|
|
2043 |
}
|
|
2044 |
}
|
|
2045 |
}
|
|
2046 |
}
|
|
2047 |
if ( process )
|
|
2048 |
{
|
|
2049 |
#endif // __KEEP_DRM_CONTENT_ON_PHONE
|
|
2050 |
|
|
2051 |
TInt64 size( 0 );
|
|
2052 |
// Skip remote folder size counting because it may last very long time.
|
|
2053 |
// The content may also change during the operation what makes
|
|
2054 |
// the counting needless.
|
|
2055 |
if ( !( prop->IsRemoteDrive() &&
|
|
2056 |
( prop->TypeL() & CFileManagerItemProperties::EFolder ) ) )
|
|
2057 |
{
|
|
2058 |
size = iEngine.GetFileSizesL( *iMarkedArray ) ;
|
|
2059 |
}
|
|
2060 |
if ( size == KErrNotFound )
|
|
2061 |
{
|
|
2062 |
// User has cancelled size calculation, do nothing
|
|
2063 |
}
|
|
2064 |
else if ( iEngine.EnoughSpaceL( aToFolder, size, aOperation ))
|
|
2065 |
{
|
|
2066 |
iTotalTransferredBytes = 0;
|
|
2067 |
iEngine.SetObserver( this );
|
|
2068 |
if ( aOperation == EMoveProcess &&
|
|
2069 |
aToFolder.Left( KDriveLetterSize ) ==
|
|
2070 |
prop->FullPath().Left( KDriveLetterSize ) )
|
|
2071 |
{
|
|
2072 |
// If operation is move and it happens inside drive
|
|
2073 |
// set size to file amount
|
|
2074 |
// CFileMan is not calling notify if those conditions apply
|
|
2075 |
if ( iMarkedArray->Count() > 0 )
|
|
2076 |
{
|
|
2077 |
size = iMarkedArray->Count();
|
|
2078 |
}
|
|
2079 |
else
|
|
2080 |
{
|
|
2081 |
// Folder move time we cannot predict, so setting size to
|
|
2082 |
// 0 to show wait note, one file moves so fast that it
|
|
2083 |
// won't show wait note anyway
|
|
2084 |
size = 0;
|
|
2085 |
}
|
|
2086 |
}
|
|
2087 |
|
|
2088 |
if ( prop->IsRemoteDrive() ||
|
|
2089 |
CFileManagerUtils::IsRemoteDrive(
|
|
2090 |
iEikonEnv->FsSession(), aToFolder ) )
|
|
2091 |
{
|
|
2092 |
// Use wait note for remote drives
|
|
2093 |
// because real progress information is unavailable
|
|
2094 |
size = 0;
|
|
2095 |
}
|
|
2096 |
|
|
2097 |
LaunchProgressDialogL( size, 0, aOperation );
|
|
2098 |
delete iActiveExec;
|
|
2099 |
iActiveExec = NULL;
|
|
2100 |
iActiveExec = CFileManagerActiveExecute::NewL(
|
|
2101 |
iEngine, aOperation, *this, *iMarkedArray, aToFolder );
|
|
2102 |
iActiveProcess = aOperation;
|
|
2103 |
TRAPD( err, iActiveExec->ExecuteL( CFileManagerActiveExecute::ENoOverWrite ) );
|
|
2104 |
if ( err != KErrNone )
|
|
2105 |
{
|
|
2106 |
// Clean up the active process before forwarding leave
|
|
2107 |
ERROR_LOG2(
|
|
2108 |
"CFileManagerViewBase::RunOperationL-aOperation=%d,err=%d",
|
|
2109 |
aOperation, err )
|
|
2110 |
iActiveProcess = ENoProcess;
|
|
2111 |
User::Leave( err );
|
|
2112 |
}
|
|
2113 |
}
|
|
2114 |
else
|
|
2115 |
{
|
|
2116 |
ShowDiskSpaceErrorL( aToFolder );
|
|
2117 |
}
|
|
2118 |
|
|
2119 |
#ifdef __KEEP_DRM_CONTENT_ON_PHONE
|
|
2120 |
}
|
|
2121 |
#endif // __KEEP_DRM_CONTENT_ON_PHONE
|
|
2122 |
|
|
2123 |
CleanupStack::PopAndDestroy( prop );
|
|
2124 |
|
|
2125 |
}
|
|
2126 |
|
|
2127 |
// -----------------------------------------------------------------------------
|
|
2128 |
// CFileManagerViewBase::ProcessQueryOverWriteL
|
|
2129 |
//
|
|
2130 |
// -----------------------------------------------------------------------------
|
|
2131 |
//
|
|
2132 |
TBool CFileManagerViewBase::ProcessQueryOverWriteL
|
|
2133 |
( const TDesC& aOldName, TDes& aNewName, TFileManagerProcess aOperation )
|
|
2134 |
{
|
|
2135 |
|
|
2136 |
TParsePtrC name( aOldName );
|
|
2137 |
|
|
2138 |
// Stop progress note before showing the query to be restarted later.
|
|
2139 |
// Note that progress note may still exist after stop (to fill min time on screen)
|
|
2140 |
// and it gets deleted later by AVKON. Asynchronous restart is needed to prevent
|
|
2141 |
// mess up (if note still exists). Otherwise starting and stopping progress note too
|
|
2142 |
// quickly multiple times leads to mess up in AVKON's note handling.
|
|
2143 |
StopProgressDialogAndStoreValues();
|
|
2144 |
|
|
2145 |
TBool overWrite( FileManagerDlgUtils::ShowConfirmQueryWithYesNoL(
|
|
2146 |
R_QTN_FLDR_OVERWRITE_QUERY, name.NameAndExt() ) );
|
|
2147 |
if ( !overWrite )
|
|
2148 |
{
|
|
2149 |
if ( !FileManagerDlgUtils::ShowFileNameQueryL(
|
|
2150 |
R_QTN_FLDR_ITEM_NAME_PRMPT, aOldName, aNewName, iEngine ) )
|
|
2151 |
{
|
|
2152 |
aNewName.Zero();
|
|
2153 |
}
|
|
2154 |
}
|
|
2155 |
|
|
2156 |
if ( iActiveProcess == aOperation &&
|
|
2157 |
( aOperation == MFileManagerProcessObserver::ECopyProcess ||
|
|
2158 |
aOperation == MFileManagerProcessObserver::EMoveProcess ) )
|
|
2159 |
{
|
|
2160 |
// Progress note needs asynchronous start because of AVKON's note handling.
|
|
2161 |
delete iRefreshProgressDelayedStart;
|
|
2162 |
iRefreshProgressDelayedStart = NULL;
|
|
2163 |
iRefreshProgressDelayedStart = CPeriodic::NewL( CActive::EPriorityUserInput );
|
|
2164 |
iRefreshProgressDelayedStart->Start(
|
|
2165 |
KProgressBarAsyncStartDelay, KProgressBarAsyncStartDelay,
|
|
2166 |
TCallBack( LaunchProgressDialogAsync, this ) );
|
|
2167 |
}
|
|
2168 |
|
|
2169 |
return overWrite;
|
|
2170 |
}
|
|
2171 |
|
|
2172 |
// -----------------------------------------------------------------------------
|
|
2173 |
// CFileManagerViewBase::ProcessQueryRenameL
|
|
2174 |
//
|
|
2175 |
// -----------------------------------------------------------------------------
|
|
2176 |
//
|
|
2177 |
TBool CFileManagerViewBase::ProcessQueryRenameL
|
|
2178 |
( const TDesC& aOldName, TDes& aNewName, TFileManagerProcess aOperation )
|
|
2179 |
{
|
|
2180 |
TParsePtrC typeCheck( aOldName );
|
|
2181 |
TParse oldName;
|
|
2182 |
TBool folderRename( EFalse );
|
|
2183 |
|
|
2184 |
// Check is item file or folder
|
|
2185 |
if ( !typeCheck.NameOrExtPresent() )
|
|
2186 |
{
|
|
2187 |
oldName.Set( aOldName.Left( aOldName.Length() - 1 ), NULL, NULL );
|
|
2188 |
folderRename = ETrue;
|
|
2189 |
}
|
|
2190 |
else
|
|
2191 |
{
|
|
2192 |
oldName.Set( aOldName , NULL, NULL );
|
|
2193 |
}
|
|
2194 |
|
|
2195 |
// Stop progress note before showing the query to be restarted later.
|
|
2196 |
// Note that progress note may still exist after stop (to fill min time on screen)
|
|
2197 |
// and it gets deleted later by AVKON. Asynchronous restart is needed to prevent
|
|
2198 |
// mess up (if note still exists). Otherwise starting and stopping progress note too
|
|
2199 |
// quickly multiple times leads to mess up in AVKON's note handling.
|
|
2200 |
StopProgressDialogAndStoreValues();
|
|
2201 |
|
|
2202 |
TBool rename( FileManagerDlgUtils::ShowConfirmQueryWithOkCancelL(
|
|
2203 |
R_QTN_FLDR_RENAME_QUERY, oldName.NameAndExt() ) );
|
|
2204 |
if ( rename )
|
|
2205 |
{
|
|
2206 |
TBool done( 0 );
|
|
2207 |
if ( folderRename )
|
|
2208 |
{
|
|
2209 |
aNewName.Copy( aOldName );
|
|
2210 |
done = FileManagerDlgUtils::ShowFolderNameQueryL(
|
|
2211 |
R_QTN_FLDR_ITEM_NAME_PRMPT, aNewName, iEngine );
|
|
2212 |
}
|
|
2213 |
else
|
|
2214 |
{
|
|
2215 |
done = FileManagerDlgUtils::ShowFileNameQueryL(
|
|
2216 |
R_QTN_FLDR_ITEM_NAME_PRMPT, aOldName, aNewName, iEngine );
|
|
2217 |
}
|
|
2218 |
|
|
2219 |
if ( !done )
|
|
2220 |
{
|
|
2221 |
// User cancelled rename
|
|
2222 |
aNewName.Zero();
|
|
2223 |
}
|
|
2224 |
else
|
|
2225 |
{
|
|
2226 |
//file server doesn't support the space in the end of the folder/file name
|
|
2227 |
aNewName.TrimRight();
|
|
2228 |
}
|
|
2229 |
}
|
|
2230 |
|
|
2231 |
if ( iActiveProcess == aOperation &&
|
|
2232 |
( aOperation == MFileManagerProcessObserver::ECopyProcess ||
|
|
2233 |
aOperation == MFileManagerProcessObserver::EMoveProcess ) )
|
|
2234 |
{
|
|
2235 |
// Progress note needs asynchronous start because of AVKON's note handling.
|
|
2236 |
delete iRefreshProgressDelayedStart;
|
|
2237 |
iRefreshProgressDelayedStart = NULL;
|
|
2238 |
iRefreshProgressDelayedStart = CPeriodic::NewL( CActive::EPriorityUserInput );
|
|
2239 |
iRefreshProgressDelayedStart->Start(
|
|
2240 |
KProgressBarAsyncStartDelay, KProgressBarAsyncStartDelay,
|
|
2241 |
TCallBack( LaunchProgressDialogAsync, this ) );
|
|
2242 |
}
|
|
2243 |
|
|
2244 |
return rename;
|
|
2245 |
}
|
|
2246 |
|
|
2247 |
// -----------------------------------------------------------------------------
|
|
2248 |
// CFileManagerViewBase::LaunchProgressDialogL
|
|
2249 |
//
|
|
2250 |
// -----------------------------------------------------------------------------
|
|
2251 |
//
|
|
2252 |
void CFileManagerViewBase::LaunchProgressDialogL(
|
|
2253 |
TInt64 aFinalValue,
|
|
2254 |
TInt64 aInitialValue,
|
|
2255 |
MFileManagerProcessObserver::TFileManagerProcess aOperation,
|
|
2256 |
TBool aImmediatelyVisible )
|
|
2257 |
{
|
|
2258 |
TInt dialogId( 0 );
|
|
2259 |
TInt textId( 0 );
|
|
2260 |
TBool isPeriodic( EFalse );
|
|
2261 |
TInt value;
|
|
2262 |
value=Int64ToInt(aFinalValue);
|
|
2263 |
switch ( aOperation )
|
|
2264 |
{
|
|
2265 |
case ECopyProcess:
|
|
2266 |
{
|
|
2267 |
isPeriodic = ( value > 1 );
|
|
2268 |
if ( isPeriodic )
|
|
2269 |
{
|
|
2270 |
dialogId = R_FILEMANAGER_PROGRESS_NOTE_COPY;
|
|
2271 |
}
|
|
2272 |
else
|
|
2273 |
{
|
|
2274 |
dialogId = R_FILEMANAGER_WAIT_NOTE_COPY;
|
|
2275 |
}
|
|
2276 |
break;
|
|
2277 |
}
|
|
2278 |
case EMoveProcess:
|
|
2279 |
{
|
|
2280 |
isPeriodic = ( value > 1 );
|
|
2281 |
if ( isPeriodic )
|
|
2282 |
{
|
|
2283 |
dialogId = R_FILEMANAGER_PROGRESS_NOTE_MOVE;
|
|
2284 |
}
|
|
2285 |
else
|
|
2286 |
{
|
|
2287 |
dialogId = R_FILEMANAGER_WAIT_NOTE_MOVE;
|
|
2288 |
}
|
|
2289 |
break;
|
|
2290 |
}
|
|
2291 |
case EFormatProcess:
|
|
2292 |
{
|
|
2293 |
dialogId = R_FILEMANAGER_PROGRESS_NOTE;
|
|
2294 |
TFileManagerDriveInfo drvInfo;
|
|
2295 |
DriveInfoAtCurrentPosL( drvInfo );
|
|
2296 |
#ifdef RD_MULTIPLE_DRIVE
|
|
2297 |
if ( drvInfo.iState & TFileManagerDriveInfo::EDriveMassStorage
|
|
2298 |
|| drvInfo.iState & TFileManagerDriveInfo::EDriveUsbMemory )
|
|
2299 |
{
|
|
2300 |
textId = R_QTN_FMGR_MASS_FORMAT_INPROGRESS;
|
|
2301 |
}
|
|
2302 |
else
|
|
2303 |
{
|
|
2304 |
#endif // RD_MULTIPLE_DRIVE
|
|
2305 |
textId = R_QTN_FORMAT_INPROGRESS;
|
|
2306 |
#ifdef RD_MULTIPLE_DRIVE
|
|
2307 |
}
|
|
2308 |
#endif // RD_MULTIPLE_DRIVE
|
|
2309 |
break;
|
|
2310 |
}
|
|
2311 |
case EBackupProcess:
|
|
2312 |
{
|
|
2313 |
dialogId = R_FILEMANAGER_PROGRESS_NOTE_WITH_CANCEL;
|
|
2314 |
#ifdef RD_FILE_MANAGER_BACKUP
|
|
2315 |
textId = R_QTN_FMGR_PROGRESS_PREPARING_BACKUP;
|
|
2316 |
#else // RD_FILE_MANAGER_BACKUP
|
|
2317 |
textId = R_QTN_BACKUP_INPROGRESS;
|
|
2318 |
#endif // RD_FILE_MANAGER_BACKUP
|
|
2319 |
aImmediatelyVisible = ETrue;
|
|
2320 |
break;
|
|
2321 |
}
|
|
2322 |
case ERestoreProcess:
|
|
2323 |
{
|
|
2324 |
dialogId = R_FILEMANAGER_PROGRESS_NOTE;
|
|
2325 |
#ifdef RD_FILE_MANAGER_BACKUP
|
|
2326 |
textId = R_QTN_FMGR_PROGRESS_PREPARING_RESTORE;
|
|
2327 |
#else // RD_FILE_MANAGER_BACKUP
|
|
2328 |
textId = R_QTN_RESTORE_INPROGRESS;
|
|
2329 |
#endif // RD_FILE_MANAGER_BACKUP
|
|
2330 |
break;
|
|
2331 |
}
|
|
2332 |
case EEjectProcess:
|
|
2333 |
{
|
|
2334 |
dialogId = R_FILEMANAGER_WAIT_NOTE;
|
|
2335 |
textId = R_QTN_WAIT_EJECT;
|
|
2336 |
break;
|
|
2337 |
}
|
|
2338 |
case EFileOpenProcess:
|
|
2339 |
{
|
|
2340 |
dialogId = R_FILEMANAGER_WAIT_NOTE_OPEN_WITH_CANCEL;
|
|
2341 |
break;
|
|
2342 |
}
|
|
2343 |
default:
|
|
2344 |
{
|
|
2345 |
dialogId = R_FILEMANAGER_WAIT_NOTE_OPEN;
|
|
2346 |
break;
|
|
2347 |
}
|
|
2348 |
}
|
|
2349 |
LaunchProgressBarL(
|
|
2350 |
dialogId, textId, aFinalValue, aInitialValue, isPeriodic, aImmediatelyVisible );
|
|
2351 |
|
|
2352 |
#ifdef RD_FILE_MANAGER_BACKUP
|
|
2353 |
if ( aOperation == EBackupProcess && iProgressDialog )
|
|
2354 |
{
|
|
2355 |
iProgressDialog->ButtonGroupContainer().SetCommandSetL(R_AVKON_SOFTKEYS_EMPTY);
|
|
2356 |
iProgressDialog->ButtonGroupContainer().DrawDeferred();
|
|
2357 |
}
|
|
2358 |
#endif // RD_FILE_MANAGER_BACKUP
|
|
2359 |
}
|
|
2360 |
|
|
2361 |
// ------------------------------------------------------------------------------
|
|
2362 |
// CFileManagerViewBase::ShowWaitDialogL
|
|
2363 |
//
|
|
2364 |
// ------------------------------------------------------------------------------
|
|
2365 |
//
|
|
2366 |
void CFileManagerViewBase::ShowWaitDialogL( MAknBackgroundProcess& aProcess)
|
|
2367 |
{
|
|
2368 |
CAknWaitNoteWrapper* waitNoteWrapper = CAknWaitNoteWrapper::NewL();
|
|
2369 |
CleanupDeletePushL( waitNoteWrapper );
|
|
2370 |
waitNoteWrapper->ExecuteL( R_FILEMANAGER_WAIT_NOTE_PROCESS, aProcess );
|
|
2371 |
CleanupStack::PopAndDestroy( waitNoteWrapper );
|
|
2372 |
}
|
|
2373 |
|
|
2374 |
// ------------------------------------------------------------------------------
|
|
2375 |
// CFileManagerViewBase::DoUpdateProgressBar
|
|
2376 |
//
|
|
2377 |
// ------------------------------------------------------------------------------
|
|
2378 |
//
|
|
2379 |
void CFileManagerViewBase::DoUpdateProgressBar()
|
|
2380 |
{
|
|
2381 |
// Update progress indicator
|
|
2382 |
if ( iProgressDialog && iProgressInfo )
|
|
2383 |
{
|
|
2384 |
iProgressInfo->SetAndDraw( iTotalTransferredBytes / KMinificationFactor );
|
|
2385 |
}
|
|
2386 |
}
|
|
2387 |
|
|
2388 |
// ------------------------------------------------------------------------------
|
|
2389 |
// CFileManagerViewBase::UpdateProgressBar
|
|
2390 |
//
|
|
2391 |
// ------------------------------------------------------------------------------
|
|
2392 |
//
|
|
2393 |
TInt CFileManagerViewBase::UpdateProgressBar(TAny* aPtr )
|
|
2394 |
{
|
|
2395 |
static_cast< CFileManagerViewBase* >( aPtr )->DoUpdateProgressBar();
|
|
2396 |
return KErrNone;
|
|
2397 |
}
|
|
2398 |
|
|
2399 |
// ------------------------------------------------------------------------------
|
|
2400 |
// CFileManagerViewBase::RefreshStartedL
|
|
2401 |
//
|
|
2402 |
// ------------------------------------------------------------------------------
|
|
2403 |
//
|
|
2404 |
void CFileManagerViewBase::RefreshStartedL()
|
|
2405 |
{
|
|
2406 |
FUNC_LOG
|
|
2407 |
|
|
2408 |
DenyDirectoryRefresh( EFalse );
|
|
2409 |
|
|
2410 |
if ( static_cast< CFileManagerAppUi* >( AppUi() )->IsFmgrForeGround() )
|
|
2411 |
{
|
|
2412 |
if ( iContainer )
|
|
2413 |
{
|
|
2414 |
iContainer->SetListEmptyL();
|
|
2415 |
}
|
|
2416 |
|
|
2417 |
ClearProgressBarL();
|
|
2418 |
if ( Id() == CFileManagerAppUi::KFileManagerSearchResultsViewId )
|
|
2419 |
{
|
|
2420 |
// On remote drives local find progress note is sometimes
|
|
2421 |
// totally blocked if the note is not started directly here.
|
|
2422 |
iProgressDialogRefresh = new( ELeave ) CAknProgressDialog(
|
|
2423 |
reinterpret_cast< CEikDialog** >(
|
|
2424 |
&iProgressDialogRefresh ), EFalse );
|
|
2425 |
iProgressDialogRefresh->SetCallback( this );
|
|
2426 |
iProgressDialogRefresh->ExecuteLD( R_FILEMANAGER_FIND_WAIT_DIALOG );
|
|
2427 |
}
|
|
2428 |
else
|
|
2429 |
{
|
|
2430 |
// Start progress dialog using own timer, otherwise progress dialog
|
|
2431 |
// burns sometimes quite a lot CPU time even if it is not
|
|
2432 |
// visible at all.
|
|
2433 |
iRefreshProgressDelayedStart = CPeriodic::NewL(
|
|
2434 |
CActive::EPriorityUserInput );
|
|
2435 |
iRefreshProgressDelayedStart->Start(
|
|
2436 |
KRefreshProgressStartDelay,
|
|
2437 |
KRefreshProgressStartDelay,
|
|
2438 |
TCallBack( RefreshProgressDelayedStart, this ) );
|
|
2439 |
}
|
|
2440 |
}
|
|
2441 |
}
|
|
2442 |
|
|
2443 |
// ------------------------------------------------------------------------------
|
|
2444 |
// CFileManagerViewBase::RefreshStoppedL
|
|
2445 |
//
|
|
2446 |
// ------------------------------------------------------------------------------
|
|
2447 |
//
|
|
2448 |
void CFileManagerViewBase::RefreshStoppedL()
|
|
2449 |
{
|
|
2450 |
FUNC_LOG
|
|
2451 |
|
|
2452 |
ClearProgressBarL();
|
|
2453 |
|
|
2454 |
if( iContainer )
|
|
2455 |
{
|
|
2456 |
TInt index( iContainer->ListBoxCurrentItemIndex() );
|
|
2457 |
if ( index > 0 && index < iContainer->ListBoxNumberOfItems() )
|
|
2458 |
{
|
|
2459 |
iIndex = index;
|
|
2460 |
}
|
|
2461 |
DirectoryChangedL();
|
|
2462 |
UpdateCbaL();
|
|
2463 |
}
|
|
2464 |
}
|
|
2465 |
|
|
2466 |
// ------------------------------------------------------------------------------
|
|
2467 |
// CFileManagerViewBase::AreChosenFilesProtectedL
|
|
2468 |
//
|
|
2469 |
// ------------------------------------------------------------------------------
|
|
2470 |
//
|
|
2471 |
TBool CFileManagerViewBase::AreChosenFilesProtectedL( TBool aMode )
|
|
2472 |
{
|
|
2473 |
TBool ret = aMode;
|
|
2474 |
CArrayFixFlat<TInt>* indexArray = MarkedArrayLC();
|
|
2475 |
|
|
2476 |
TInt i( 0 );
|
|
2477 |
|
|
2478 |
#ifdef __KEEP_DRM_CONTENT_ON_PHONE
|
|
2479 |
TBool protectedFile( EFalse );
|
|
2480 |
#endif // __KEEP_DRM_CONTENT_ON_PHONE
|
|
2481 |
|
|
2482 |
while( ( ret == aMode ) && i < indexArray->Count() )
|
|
2483 |
{
|
|
2484 |
CFileManagerItemProperties* prop = iEngine.GetItemInfoL( indexArray->At( i ));
|
|
2485 |
CleanupStack::PushL( prop );
|
|
2486 |
|
|
2487 |
#ifdef __KEEP_DRM_CONTENT_ON_PHONE
|
|
2488 |
// Only one folder can be selected at a time
|
|
2489 |
if (iEngine.IsFolder(indexArray->At( i )))
|
|
2490 |
{
|
|
2491 |
|
|
2492 |
CDirScan *dirScan = CDirScan::NewLC( iEikonEnv->FsSession() );
|
|
2493 |
CDir *currentDir = NULL;
|
|
2494 |
// Go through the files only
|
|
2495 |
dirScan->SetScanDataL( prop->FullPath(), KEntryAttNormal, ESortNone );
|
|
2496 |
|
|
2497 |
dirScan->NextL( currentDir );
|
|
2498 |
while ( ( ret == aMode ) && currentDir )
|
|
2499 |
{
|
|
2500 |
CleanupStack::PushL( currentDir ); // currentDir won't be null
|
|
2501 |
// due to while loop conditional
|
|
2502 |
TInt j( 0 );
|
|
2503 |
while ( ( ret == aMode ) && j < currentDir->Count() )
|
|
2504 |
{
|
|
2505 |
const TEntry ¤tFile( ( *currentDir )[ j ] );
|
|
2506 |
TPtrC currentPath (dirScan->FullPath());
|
|
2507 |
HBufC* currentFilePath = HBufC::NewLC( KMaxFileName );
|
|
2508 |
TPtr completeFilePath = currentFilePath->Des();
|
|
2509 |
completeFilePath.Append(currentPath);
|
|
2510 |
completeFilePath.Append(currentFile.iName);
|
|
2511 |
|
|
2512 |
|
|
2513 |
// the following could leave if file is opened in exclusive
|
|
2514 |
// mode by another app- will cause 'in use' error dialog
|
|
2515 |
//to be displayed
|
|
2516 |
User::LeaveIfError( iEngine.IsDistributableFile( completeFilePath,
|
|
2517 |
protectedFile ));
|
|
2518 |
if( protectedFile == !aMode )
|
|
2519 |
{
|
|
2520 |
ret = !aMode;
|
|
2521 |
}
|
|
2522 |
++j;
|
|
2523 |
CleanupStack::PopAndDestroy( currentFilePath );
|
|
2524 |
currentFilePath = NULL;
|
|
2525 |
}
|
|
2526 |
CleanupStack::PopAndDestroy( currentDir );
|
|
2527 |
currentDir=NULL;
|
|
2528 |
dirScan->NextL( currentDir );
|
|
2529 |
}
|
|
2530 |
CleanupStack::PopAndDestroy( dirScan );
|
|
2531 |
dirScan = NULL;
|
|
2532 |
}
|
|
2533 |
else
|
|
2534 |
{
|
|
2535 |
|
|
2536 |
// the following could leave if file is opened in exclusive
|
|
2537 |
// mode by another app- will cause 'in use' error dialog
|
|
2538 |
//to be displayed
|
|
2539 |
User::LeaveIfError( iEngine.IsDistributableFile( prop->FullPath(),
|
|
2540 |
protectedFile ));
|
|
2541 |
if( protectedFile == !aMode )
|
|
2542 |
{
|
|
2543 |
ret = !aMode;
|
|
2544 |
}
|
|
2545 |
}
|
|
2546 |
|
|
2547 |
#else // __KEEP_DRM_CONTENT_ON_PHONE
|
|
2548 |
if ( ( (prop->TypeL() & CFileManagerItemProperties::EForwardLocked)
|
|
2549 |
== CFileManagerItemProperties::EForwardLocked ) == !aMode )
|
|
2550 |
{
|
|
2551 |
ret = !aMode;
|
|
2552 |
}
|
|
2553 |
#endif // __KEEP_DRM_CONTENT_ON_PHONE
|
|
2554 |
CleanupStack::PopAndDestroy( prop );
|
|
2555 |
++i;
|
|
2556 |
}
|
|
2557 |
CleanupStack::PopAndDestroy( indexArray );
|
|
2558 |
return ret;
|
|
2559 |
}
|
|
2560 |
|
|
2561 |
// ------------------------------------------------------------------------------
|
|
2562 |
// CFileManagerViewBase::ShowContextSensitiveMenuL
|
|
2563 |
//
|
|
2564 |
// ------------------------------------------------------------------------------
|
|
2565 |
//
|
|
2566 |
void CFileManagerViewBase::ShowContextSensitiveMenuL()
|
|
2567 |
{
|
|
2568 |
CEikMenuBar* menu = MenuBar();
|
|
2569 |
// set context sensitive menu
|
|
2570 |
menu->SetMenuTitleResourceId( R_FILEMANAGER_CONTEXT_SENSITIVE_MENUBAR );
|
|
2571 |
// show context sensitive menu
|
|
2572 |
TRAPD( err, menu->TryDisplayMenuBarL() );
|
|
2573 |
menu->SetMenuTitleResourceId( R_FILEMANAGER_MEMORY_STORE_MENUBAR );
|
|
2574 |
User::LeaveIfError( err );
|
|
2575 |
}
|
|
2576 |
|
|
2577 |
// ------------------------------------------------------------------------------
|
|
2578 |
// CFileManagerViewBase::ClearProgressBarL
|
|
2579 |
//
|
|
2580 |
// ------------------------------------------------------------------------------
|
|
2581 |
//
|
|
2582 |
void CFileManagerViewBase::ClearProgressBarL()
|
|
2583 |
{
|
|
2584 |
FUNC_LOG
|
|
2585 |
|
|
2586 |
iProgressInfo = NULL;
|
|
2587 |
|
|
2588 |
if ( iProgressDialog )
|
|
2589 |
{
|
|
2590 |
iProgressDialog->ProcessFinishedL();
|
|
2591 |
iProgressDialog = NULL;
|
|
2592 |
}
|
|
2593 |
if ( iProgressDialogRefresh )
|
|
2594 |
{
|
|
2595 |
iProgressDialogRefresh->ProcessFinishedL();
|
|
2596 |
iProgressDialogRefresh = NULL;
|
|
2597 |
}
|
|
2598 |
delete iPeriodic;
|
|
2599 |
iPeriodic = NULL;
|
|
2600 |
|
|
2601 |
delete iRefreshProgressDelayedStart;
|
|
2602 |
iRefreshProgressDelayedStart = NULL;
|
|
2603 |
|
|
2604 |
iTotalTransferredBytes = 0;
|
|
2605 |
}
|
|
2606 |
|
|
2607 |
// ------------------------------------------------------------------------------
|
|
2608 |
// CFileManagerViewBase::StoreIndex
|
|
2609 |
//
|
|
2610 |
// ------------------------------------------------------------------------------
|
|
2611 |
//
|
|
2612 |
TBool CFileManagerViewBase::StoreIndex()
|
|
2613 |
{
|
|
2614 |
if ( iContainer )
|
|
2615 |
{
|
|
2616 |
TInt index( iContainer->ListBoxCurrentItemIndex() );
|
|
2617 |
if ( index >= 0 &&
|
|
2618 |
index < iContainer->ListBoxNumberOfItems() )
|
|
2619 |
{
|
|
2620 |
iIndex = index; // Store view's internal index
|
|
2621 |
|
|
2622 |
// Store navigation index
|
|
2623 |
TUid viewId( Id() );
|
|
2624 |
if ( viewId == CFileManagerAppUi::KFileManagerMemoryStoreViewId ||
|
|
2625 |
viewId == CFileManagerAppUi::KFileManagerFoldersViewId )
|
|
2626 |
{
|
|
2627 |
iEngine.SetCurrentIndex( index );
|
|
2628 |
}
|
|
2629 |
}
|
|
2630 |
}
|
|
2631 |
else
|
|
2632 |
{
|
|
2633 |
return EFalse;
|
|
2634 |
}
|
|
2635 |
return ETrue;
|
|
2636 |
}
|
|
2637 |
|
|
2638 |
// ------------------------------------------------------------------------------
|
|
2639 |
// CFileManagerViewBase::DriveReadOnlyMmcL
|
|
2640 |
//
|
|
2641 |
// ------------------------------------------------------------------------------
|
|
2642 |
//
|
|
2643 |
TBool CFileManagerViewBase::DriveReadOnlyMmcL( const TInt aDrive ) const
|
|
2644 |
{
|
|
2645 |
TBool ret( EFalse );
|
|
2646 |
TUint32 drvState( 0 );
|
|
2647 |
TInt err( iEngine.DriveState( drvState, aDrive ) );
|
|
2648 |
if ( err == KErrNone &&
|
|
2649 |
( drvState & TFileManagerDriveInfo::EDriveWriteProtected ) )
|
|
2650 |
{
|
|
2651 |
ret = ETrue;
|
|
2652 |
}
|
|
2653 |
if ( ret )
|
|
2654 |
{
|
|
2655 |
#ifdef RD_MULTIPLE_DRIVE
|
|
2656 |
HBufC* text = iEngine.GetFormattedDriveNameLC(
|
|
2657 |
aDrive,
|
|
2658 |
R_QTN_MEMC_MULTIPLE_MEMC_READ_ONLY );
|
|
2659 |
FileManagerDlgUtils::ShowErrorNoteL( *text );
|
|
2660 |
CleanupStack::PopAndDestroy( text );
|
|
2661 |
#else // RD_MULTIPLE_DRIVE
|
|
2662 |
FileManagerDlgUtils::ShowErrorNoteL(
|
|
2663 |
R_QTN_MEMC_MEMORYCARD_READ_ONLY );
|
|
2664 |
#endif // RD_MULTIPLE_DRIVE
|
|
2665 |
}
|
|
2666 |
|
|
2667 |
return ret;
|
|
2668 |
}
|
|
2669 |
|
|
2670 |
|
|
2671 |
// ------------------------------------------------------------------------------
|
|
2672 |
// CFileManagerViewBase::DriveReadOnlyMmcL
|
|
2673 |
//
|
|
2674 |
// ------------------------------------------------------------------------------
|
|
2675 |
//
|
|
2676 |
TBool CFileManagerViewBase::DriveReadOnlyMmcL( const TDesC& aFullPath ) const
|
|
2677 |
{
|
|
2678 |
TBool ret( EFalse );
|
|
2679 |
if ( aFullPath.Length() )
|
|
2680 |
{
|
|
2681 |
TInt drive = TDriveUnit( aFullPath );
|
|
2682 |
ret = DriveReadOnlyMmcL( drive );
|
|
2683 |
}
|
|
2684 |
return ret;
|
|
2685 |
}
|
|
2686 |
|
|
2687 |
// ------------------------------------------------------------------------------
|
|
2688 |
// CFileManagerViewBase::CurrentProcess
|
|
2689 |
//
|
|
2690 |
// ------------------------------------------------------------------------------
|
|
2691 |
//
|
|
2692 |
MFileManagerProcessObserver::TFileManagerProcess CFileManagerViewBase::CurrentProcess()
|
|
2693 |
{
|
|
2694 |
return iActiveProcess;
|
|
2695 |
}
|
|
2696 |
|
|
2697 |
// ------------------------------------------------------------------------------
|
|
2698 |
// CFileManagerViewBase::Error
|
|
2699 |
//
|
|
2700 |
// ------------------------------------------------------------------------------
|
|
2701 |
//
|
|
2702 |
void CFileManagerViewBase::Error( TInt aError )
|
|
2703 |
{
|
|
2704 |
if ( aError != KErrNone )
|
|
2705 |
{
|
|
2706 |
ERROR_LOG1( "CFileManagerViewBase::Error()-aError=%d", aError )
|
|
2707 |
iEikonEnv->HandleError( aError );
|
|
2708 |
}
|
|
2709 |
}
|
|
2710 |
|
|
2711 |
// ------------------------------------------------------------------------------
|
|
2712 |
// CFileManagerViewBase::AddSendOptionL
|
|
2713 |
//
|
|
2714 |
// ------------------------------------------------------------------------------
|
|
2715 |
//
|
|
2716 |
void CFileManagerViewBase::AddSendOptionL(
|
|
2717 |
CEikMenuPane& aMenuPane,
|
|
2718 |
const TInt aCommandIdAfter )
|
|
2719 |
{
|
|
2720 |
CSendUi& sendUi( static_cast< CFileManagerAppUi* >( AppUi() )->SendUiL() );
|
|
2721 |
TInt pos( 0 );
|
|
2722 |
aMenuPane.ItemAndPos( aCommandIdAfter, pos );
|
|
2723 |
CArrayFixFlat< TInt >* indexArray = MarkedArrayLC();
|
|
2724 |
TInt msgSize( KMessageSize );
|
|
2725 |
if ( indexArray->Count() == 1 &&
|
|
2726 |
!iEngine.IsFolder( indexArray->At( 0 ) ) )
|
|
2727 |
{
|
|
2728 |
msgSize = Int64ToInt( iEngine.GetFileSizesL( *indexArray ) );
|
|
2729 |
}
|
|
2730 |
CleanupStack::PopAndDestroy( indexArray );
|
|
2731 |
TSendingCapabilities caps(
|
|
2732 |
0, msgSize, TSendingCapabilities::ESupportsAttachments );
|
|
2733 |
sendUi.AddSendMenuItemL( aMenuPane, pos, EFileManagerSend, caps );
|
|
2734 |
aMenuPane.SetItemSpecific(EFileManagerSend, ETrue);
|
|
2735 |
}
|
|
2736 |
|
|
2737 |
// ------------------------------------------------------------------------------
|
|
2738 |
// CFileManagerViewBase::DeleteStatusNotOk
|
|
2739 |
//
|
|
2740 |
// ------------------------------------------------------------------------------
|
|
2741 |
//
|
|
2742 |
TBool CFileManagerViewBase::DeleteStatusNotOkL(
|
|
2743 |
CFileManagerItemProperties& aProp, TInt aSelectionCount ) const
|
|
2744 |
{
|
|
2745 |
if ( DriveReadOnlyMmcL( aProp.FullPath() ) )
|
|
2746 |
{
|
|
2747 |
// Can't delete from read-only MMC card
|
|
2748 |
return ETrue;
|
|
2749 |
}
|
|
2750 |
|
|
2751 |
TUint32 itemType( aProp.TypeL() );
|
|
2752 |
if ( !aSelectionCount &&
|
|
2753 |
( itemType & KDefaultFolderMask ) == KDefaultFolderMask )
|
|
2754 |
{
|
|
2755 |
// Can't delete default folder
|
|
2756 |
FileManagerDlgUtils::ShowErrorNoteL(
|
|
2757 |
R_QTN_FMGR_ERROR_DEL_DEF_FLDR );
|
|
2758 |
return ETrue;
|
|
2759 |
}
|
|
2760 |
if ( aSelectionCount <= 1 &&
|
|
2761 |
( itemType & CFileManagerItemProperties::EOpen ) )
|
|
2762 |
{
|
|
2763 |
// Can't delete open file
|
|
2764 |
FileManagerDlgUtils::ShowErrorNoteL(
|
|
2765 |
R_QTN_FMGR_ERROR_DELETE_FILE_OPEN );
|
|
2766 |
return ETrue;
|
|
2767 |
}
|
|
2768 |
|
|
2769 |
return EFalse;
|
|
2770 |
}
|
|
2771 |
|
|
2772 |
// ------------------------------------------------------------------------------
|
|
2773 |
// CFileManagerViewBase::DeleteItemsL
|
|
2774 |
//
|
|
2775 |
// ------------------------------------------------------------------------------
|
|
2776 |
//
|
|
2777 |
void CFileManagerViewBase::DeleteItemsL( TInt aIndex )
|
|
2778 |
{
|
|
2779 |
|
|
2780 |
CArrayFixFlat<TInt>* deleteArray = MarkedArrayLC();
|
|
2781 |
TInt newIndex( MinIndex( *deleteArray ) );
|
|
2782 |
delete iActiveDelete;
|
|
2783 |
iActiveDelete = NULL;
|
|
2784 |
iActiveDelete = iEngine.CreateActiveDeleteL( *deleteArray );
|
|
2785 |
delete iWaitNoteWrapper;
|
|
2786 |
iWaitNoteWrapper = NULL;
|
|
2787 |
iWaitNoteWrapper = CAknWaitNoteWrapper::NewL();
|
|
2788 |
iActiveProcess = EDeleteProcess;
|
|
2789 |
TRAPD( err, iWaitNoteWrapper->ExecuteL(
|
|
2790 |
R_FILEMANAGER_DELETE_WAIT_DIALOG, *iActiveDelete ) );
|
|
2791 |
iActiveProcess = ENoProcess;
|
|
2792 |
User::LeaveIfError( err );
|
|
2793 |
|
|
2794 |
HBufC* fileNameBuf = HBufC::NewLC( KMaxFileName );
|
|
2795 |
TPtr fileName( fileNameBuf->Des() );
|
|
2796 |
|
|
2797 |
err = iActiveDelete->GetError( fileName );
|
|
2798 |
|
|
2799 |
switch ( err )
|
|
2800 |
{
|
|
2801 |
case KErrInUse:
|
|
2802 |
case KErrFmgrSeveralFilesInUse:
|
|
2803 |
{
|
|
2804 |
ERROR_LOG1( "CFileManagerViewBase::DeleteItemsL()-err=%d", err )
|
|
2805 |
if ( iEngine.IsFolder( aIndex ) )
|
|
2806 |
{
|
|
2807 |
if ( err == KErrFmgrSeveralFilesInUse )
|
|
2808 |
{
|
|
2809 |
FileManagerDlgUtils::ShowErrorNoteL(
|
|
2810 |
R_QTN_FMGR_ERROR_DEL_FLDR_OPEN_SE );
|
|
2811 |
}
|
|
2812 |
else
|
|
2813 |
{
|
|
2814 |
FileManagerDlgUtils::ShowErrorNoteL(
|
|
2815 |
R_QTN_FMGR_ERROR_DEL_FLDR_OPEN_1 );
|
|
2816 |
}
|
|
2817 |
}
|
|
2818 |
else
|
|
2819 |
{
|
|
2820 |
FileManagerDlgUtils::ShowErrorNoteL(
|
|
2821 |
R_QTN_FMGR_ERROR_DELETE_FILE_OPEN );
|
|
2822 |
}
|
|
2823 |
break;
|
|
2824 |
}
|
|
2825 |
case KErrNone:
|
|
2826 |
{
|
|
2827 |
if ( iContainer )
|
|
2828 |
{
|
|
2829 |
//CEikListBox& listBox( iContainer->ListBox() );
|
|
2830 |
//AknSelectionService::HandleItemRemovalAndPositionHighlightL(
|
|
2831 |
// &listBox, listBox.CurrentItemIndex(), *deleteArray);
|
|
2832 |
|
|
2833 |
#ifndef RD_DRM_RIGHTS_MANAGER_REMOVAL
|
|
2834 |
if ( FeatureManager().IsDrmFullSupported() )
|
|
2835 |
{
|
|
2836 |
TInt deletedItems( 0 );
|
|
2837 |
TInt deletedDrmItems( iActiveDelete->DeletedDrmItems( deletedItems ) );
|
|
2838 |
if( deletedDrmItems )
|
|
2839 |
{
|
|
2840 |
if( deletedDrmItems > 1 )
|
|
2841 |
{
|
|
2842 |
FileManagerDlgUtils::ShowInfoQueryL(
|
|
2843 |
R_QTN_DRM_MOS_DELETED, deletedDrmItems );
|
|
2844 |
}
|
|
2845 |
else
|
|
2846 |
{
|
|
2847 |
FileManagerDlgUtils::ShowInfoQueryL(
|
|
2848 |
R_QTN_DRM_MO_DELETED, fileName );
|
|
2849 |
}
|
|
2850 |
}
|
|
2851 |
}
|
|
2852 |
#endif // RD_DRM_RIGHTS_MANAGER_REMOVAL
|
|
2853 |
|
|
2854 |
// Set focus to the item after selection
|
|
2855 |
iContainer->SetIndex( newIndex );
|
|
2856 |
}
|
|
2857 |
break;
|
|
2858 |
}
|
|
2859 |
default:
|
|
2860 |
{
|
|
2861 |
ERROR_LOG1( "CFileManagerViewBase::DeleteItemsL()-err=%d", err )
|
|
2862 |
FileManagerDlgUtils::ShowErrorNoteL(
|
|
2863 |
R_QTN_FLDR_CANT_DELETE_ITEM, fileName );
|
|
2864 |
break;
|
|
2865 |
}
|
|
2866 |
}
|
|
2867 |
CleanupStack::PopAndDestroy( fileNameBuf );
|
|
2868 |
CleanupStack::PopAndDestroy( deleteArray );
|
|
2869 |
StoreIndex();
|
|
2870 |
iEngine.SetObserver( this );
|
|
2871 |
iEngine.RefreshDirectory();
|
|
2872 |
}
|
|
2873 |
|
|
2874 |
// ------------------------------------------------------------------------------
|
|
2875 |
// CFileManagerViewBase::HasInfoUrlL
|
|
2876 |
//
|
|
2877 |
// ------------------------------------------------------------------------------
|
|
2878 |
//
|
|
2879 |
TBool CFileManagerViewBase::HasInfoUrlL( TInt aIndex )
|
|
2880 |
{
|
|
2881 |
if ( iEngine.IsFolder( aIndex ) )
|
|
2882 |
{
|
|
2883 |
return EFalse;
|
|
2884 |
}
|
|
2885 |
TBool hasUrl( EFalse );
|
|
2886 |
HBufC8* url = NULL;
|
|
2887 |
HBufC* fullPath = iEngine.IndexToFullPathLC( aIndex );
|
|
2888 |
CDRMHelper* drmHelper = CDRMHelper::NewLC( *iEikonEnv );
|
|
2889 |
|
|
2890 |
TRAPD( err, hasUrl = drmHelper->HasInfoUrlL( *fullPath, url ) );
|
|
2891 |
if ( hasUrl && url && err == KErrNone )
|
|
2892 |
{
|
|
2893 |
hasUrl = url->Length() > 0;
|
|
2894 |
}
|
|
2895 |
else
|
|
2896 |
{
|
|
2897 |
hasUrl = EFalse;
|
|
2898 |
}
|
|
2899 |
|
|
2900 |
ERROR_LOG2( "CFileManagerViewBase::HasInfoUrlL()-hasUrl=%d,err=%d", hasUrl, err )
|
|
2901 |
|
|
2902 |
delete url;
|
|
2903 |
CleanupStack::PopAndDestroy( drmHelper );
|
|
2904 |
CleanupStack::PopAndDestroy( fullPath );
|
|
2905 |
return hasUrl;
|
|
2906 |
}
|
|
2907 |
|
|
2908 |
// ------------------------------------------------------------------------------
|
|
2909 |
// CFileManagerViewBase::OpenInfoUrlL
|
|
2910 |
//
|
|
2911 |
// ------------------------------------------------------------------------------
|
|
2912 |
//
|
|
2913 |
void CFileManagerViewBase::OpenInfoUrlL( TInt aIndex )
|
|
2914 |
{
|
|
2915 |
if ( iEngine.IsFolder( aIndex ) )
|
|
2916 |
{
|
|
2917 |
return;
|
|
2918 |
}
|
|
2919 |
HBufC* fullPath = iEngine.IndexToFullPathLC( aIndex );
|
|
2920 |
CDRMHelper* drmHelper = CDRMHelper::NewLC( *iEikonEnv );
|
|
2921 |
|
|
2922 |
// Call returns after browser has been closed
|
|
2923 |
#ifdef FILE_MANAGER_ERROR_LOG_ENABLED
|
|
2924 |
TRAPD( err, drmHelper->OpenInfoUrlL( *fullPath ) );
|
|
2925 |
ERROR_LOG1( "CFileManagerViewBase::OpenInfoUrlL()-err=%d", err )
|
|
2926 |
#else // FILE_MANAGER_ERROR_LOG_ENABLED
|
|
2927 |
TRAP_IGNORE( drmHelper->OpenInfoUrlL( *fullPath ) );
|
|
2928 |
#endif // FILE_MANAGER_ERROR_LOG_ENABLED
|
|
2929 |
|
|
2930 |
CleanupStack::PopAndDestroy( drmHelper );
|
|
2931 |
CleanupStack::PopAndDestroy( fullPath );
|
|
2932 |
}
|
|
2933 |
|
|
2934 |
// ------------------------------------------------------------------------------
|
|
2935 |
// CFileManagerViewBase::CheckFileRightsAndInformIfExpiredL
|
|
2936 |
//
|
|
2937 |
// ------------------------------------------------------------------------------
|
|
2938 |
//
|
|
2939 |
TBool CFileManagerViewBase::CheckFileRightsAndInformIfExpiredL(
|
|
2940 |
const TDesC& aFullPath )
|
|
2941 |
{
|
|
2942 |
if ( !FeatureManager().IsDrmFullSupported() )
|
|
2943 |
{
|
|
2944 |
return ETrue;
|
|
2945 |
}
|
|
2946 |
TBool expired( EFalse );
|
|
2947 |
TBool wmDrm( IsWmDrmFile( aFullPath ) );
|
|
2948 |
if ( !wmDrm ) // Ignore WM DRM files
|
|
2949 |
{
|
|
2950 |
TBool dummy( EFalse );
|
|
2951 |
CDRMHelperRightsConstraints* dummy2 = NULL;
|
|
2952 |
CDRMHelperRightsConstraints* dummy3 = NULL;
|
|
2953 |
CDRMHelperRightsConstraints* dummy4 = NULL;
|
|
2954 |
CDRMHelperRightsConstraints* dummy5 = NULL;
|
|
2955 |
CDRMHelper* drmHelper = CDRMHelper::NewLC( *iEikonEnv );
|
|
2956 |
TRAPD( err, drmHelper->GetRightsDetailsL(
|
|
2957 |
aFullPath, 0, expired, dummy, dummy2, dummy3, dummy4, dummy5 ) );
|
|
2958 |
delete dummy2;
|
|
2959 |
delete dummy3;
|
|
2960 |
delete dummy4;
|
|
2961 |
delete dummy5;
|
|
2962 |
if ( expired )
|
|
2963 |
{
|
|
2964 |
err = KErrCANoPermission;
|
|
2965 |
}
|
|
2966 |
if ( err == KErrCANoRights || err == KErrCANoPermission )
|
|
2967 |
{
|
|
2968 |
// Rights expired or missing, show note or try get silent rights
|
|
2969 |
expired = ETrue;
|
|
2970 |
ERROR_LOG1( "CFileManagerViewBase::CheckFileRightsAndInformIfExpiredL-err=%d",
|
|
2971 |
err )
|
|
2972 |
HBufC8* previewUri = NULL;
|
|
2973 |
if ( drmHelper->HandleErrorOrPreviewL( err, aFullPath, previewUri ) == KErrNone )
|
|
2974 |
{
|
|
2975 |
expired = EFalse;
|
|
2976 |
}
|
|
2977 |
delete previewUri; // Not needed
|
|
2978 |
}
|
|
2979 |
CleanupStack::PopAndDestroy( drmHelper );
|
|
2980 |
}
|
|
2981 |
ERROR_LOG2(
|
|
2982 |
"CFileManagerViewBase::CheckFileRightsAndInformIfExpiredL-expired=%d,wmDrm=%d",
|
|
2983 |
expired, wmDrm )
|
|
2984 |
return !expired;
|
|
2985 |
}
|
|
2986 |
|
|
2987 |
// ------------------------------------------------------------------------------
|
|
2988 |
// CFileManagerViewBase::HandleFileNotFoundL
|
|
2989 |
//
|
|
2990 |
// ------------------------------------------------------------------------------
|
|
2991 |
//
|
|
2992 |
TBool CFileManagerViewBase::HandleFileNotFoundL( TInt aError )
|
|
2993 |
{
|
|
2994 |
if ( aError == KErrNotFound )
|
|
2995 |
{
|
|
2996 |
iEngine.SetObserver( this );
|
|
2997 |
iEngine.RefreshDirectory();
|
|
2998 |
return ETrue;
|
|
2999 |
}
|
|
3000 |
if ( aError == KErrPathNotFound )
|
|
3001 |
{
|
|
3002 |
TInt count( iEngine.FolderLevel() );
|
|
3003 |
TBool connectedRemoteDrive( EFalse );
|
|
3004 |
RefreshDriveInfoL();
|
|
3005 |
|
|
3006 |
TFileManagerDriveInfo& drvInfo( DriveInfo() );
|
|
3007 |
TBool remoteDrive( EFalse );
|
|
3008 |
// Check if drive is remote drive and is it connected or not
|
|
3009 |
if ( drvInfo.iState & TFileManagerDriveInfo::EDriveRemote )
|
|
3010 |
{
|
|
3011 |
remoteDrive = ETrue;
|
|
3012 |
if ( drvInfo.iState & TFileManagerDriveInfo::EDriveConnected )
|
|
3013 |
{
|
|
3014 |
connectedRemoteDrive = ETrue;
|
|
3015 |
}
|
|
3016 |
}
|
|
3017 |
// Check if drive has been disconnected and reconnect canceled
|
|
3018 |
if ( remoteDrive && !connectedRemoteDrive )
|
|
3019 |
{
|
|
3020 |
// Do only root refresh if user is already got back in main view
|
|
3021 |
if ( Id() == CFileManagerAppUi::KFileManagerMainViewId &&
|
|
3022 |
iEngine.NavigationLevel() < 0 )
|
|
3023 |
{
|
|
3024 |
iEngine.SetObserver( this );
|
|
3025 |
iEngine.RefreshDirectory();
|
|
3026 |
}
|
|
3027 |
// Open memory store view to show not connected.
|
|
3028 |
else if ( Id() != CFileManagerAppUi::KFileManagerMemoryStoreViewId )
|
|
3029 |
{
|
|
3030 |
iIndex = 0;
|
|
3031 |
static_cast< CFileManagerAppUi* >( AppUi() )->ActivateMemoryStoreViewL();
|
|
3032 |
}
|
|
3033 |
else
|
|
3034 |
{
|
|
3035 |
iIndex = 0;
|
|
3036 |
if ( iContainer )
|
|
3037 |
{
|
|
3038 |
iContainer->SetListEmptyL();
|
|
3039 |
}
|
|
3040 |
DirectoryChangedL();
|
|
3041 |
}
|
|
3042 |
}
|
|
3043 |
// Check if fetch was canceled in connected memory store view
|
|
3044 |
else if ( connectedRemoteDrive &&
|
|
3045 |
Id() == CFileManagerAppUi::KFileManagerMemoryStoreViewId )
|
|
3046 |
{
|
|
3047 |
static_cast< CFileManagerAppUi* >( AppUi() )->ActivateMainViewL();
|
|
3048 |
}
|
|
3049 |
else if ( count > 0 &&
|
|
3050 |
( connectedRemoteDrive ||
|
|
3051 |
!BaflUtils::PathExists(
|
|
3052 |
iEikonEnv->FsSession(), iEngine.CurrentDirectory() ) ) )
|
|
3053 |
{
|
|
3054 |
// Go back to last valid folder
|
|
3055 |
CFileManagerAppUi* appUi =
|
|
3056 |
static_cast< CFileManagerAppUi* >( AppUi() );
|
|
3057 |
TInt err( KErrNone );
|
|
3058 |
for ( TInt i( 0 ); i < count; i++ )
|
|
3059 |
{
|
|
3060 |
TRAP( err, iEngine.BackstepL() );
|
|
3061 |
if ( err == KErrNone )
|
|
3062 |
{
|
|
3063 |
break;
|
|
3064 |
}
|
|
3065 |
}
|
|
3066 |
if ( iEngine.FolderLevel() ||
|
|
3067 |
iEngine.State() == CFileManagerEngine::ESearch )
|
|
3068 |
{
|
|
3069 |
iEngine.SetObserver( this );
|
|
3070 |
iEngine.RefreshDirectory();
|
|
3071 |
}
|
|
3072 |
else
|
|
3073 |
{
|
|
3074 |
appUi->CloseFoldersViewL();
|
|
3075 |
}
|
|
3076 |
}
|
|
3077 |
else
|
|
3078 |
{
|
|
3079 |
// Refresh root folder
|
|
3080 |
iEngine.SetObserver( this );
|
|
3081 |
iEngine.RefreshDirectory();
|
|
3082 |
}
|
|
3083 |
return ETrue;
|
|
3084 |
}
|
|
3085 |
return EFalse;
|
|
3086 |
}
|
|
3087 |
|
|
3088 |
// ------------------------------------------------------------------------------
|
|
3089 |
// CFileManagerViewBase::ScreenDeviceChanged
|
|
3090 |
//
|
|
3091 |
// ------------------------------------------------------------------------------
|
|
3092 |
//
|
|
3093 |
void CFileManagerViewBase::ScreenDeviceChanged()
|
|
3094 |
{
|
|
3095 |
if ( iContainer )
|
|
3096 |
{
|
|
3097 |
iContainer->SetRect( ClientRect() );
|
|
3098 |
iContainer->DrawDeferred();
|
|
3099 |
}
|
|
3100 |
}
|
|
3101 |
|
|
3102 |
// ------------------------------------------------------------------------------
|
|
3103 |
// CFileManagerViewBase::NotifyL
|
|
3104 |
//
|
|
3105 |
// ------------------------------------------------------------------------------
|
|
3106 |
//
|
|
3107 |
TInt CFileManagerViewBase::NotifyL( TFileManagerNotify aType,
|
|
3108 |
TInt aData, const TDesC& aName )
|
|
3109 |
{
|
|
3110 |
TInt ret( KErrNone );
|
|
3111 |
switch ( aType )
|
|
3112 |
{
|
|
3113 |
case ENotifyDisksChanged:
|
|
3114 |
{
|
|
3115 |
if ( iDirectoryRefreshDenied )
|
|
3116 |
{
|
|
3117 |
iDirectoryRefreshPostponed = ETrue;
|
|
3118 |
}
|
|
3119 |
else if ( iActiveProcess == ENoProcess && !IsRefreshInProgress() )
|
|
3120 |
{
|
|
3121 |
StoreIndex();
|
|
3122 |
iEngine.SetObserver( this );
|
|
3123 |
iEngine.RefreshDirectory();
|
|
3124 |
}
|
|
3125 |
#ifndef RD_MULTIPLE_DRIVE
|
|
3126 |
else if ( iActiveProcess == EEjectProcess )
|
|
3127 |
{
|
|
3128 |
// Memory card was put back, complete query
|
|
3129 |
if ( iEngine.AnyEjectableDrivePresent() )
|
|
3130 |
{
|
|
3131 |
delete iEjectQueryDialog;
|
|
3132 |
iEjectQueryDialog = NULL;
|
|
3133 |
}
|
|
3134 |
}
|
|
3135 |
#endif // RD_MULTIPLE_DRIVE
|
|
3136 |
break;
|
|
3137 |
}
|
|
3138 |
case ENotifyBackupMemoryLow:
|
|
3139 |
{
|
|
3140 |
if( aData < KEstimateLowerLimit )
|
|
3141 |
{
|
|
3142 |
ret = KErrDiskFull;
|
|
3143 |
}
|
|
3144 |
else if( aData < KEstimateUpperLimit )
|
|
3145 |
{
|
|
3146 |
|
|
3147 |
#ifdef RD_FILE_MANAGER_BACKUP
|
|
3148 |
CFileManagerBackupSettings& settings( iEngine.BackupSettingsL() );
|
|
3149 |
#endif // RD_FILE_MANAGER_BACKUP
|
|
3150 |
|
|
3151 |
if ( !FileManagerDlgUtils::ShowConfirmQueryWithYesNoL(
|
|
3152 |
#ifdef RD_FILE_MANAGER_BACKUP
|
|
3153 |
R_QTN_FMGR_BACKUP_TIGHT_MEMORY,
|
|
3154 |
iEngine.DriveName( settings.TargetDrive() )
|
|
3155 |
#else // RD_FILE_MANAGER_BACKUP
|
|
3156 |
R_QTN_CONFIRM_BACKUP_LEVEL1
|
|
3157 |
#endif // RD_FILE_MANAGER_BACKUP
|
|
3158 |
) )
|
|
3159 |
{
|
|
3160 |
ret = KErrCancel;
|
|
3161 |
}
|
|
3162 |
}
|
|
3163 |
break;
|
|
3164 |
}
|
|
3165 |
case ENotifyForcedFormat:
|
|
3166 |
{
|
|
3167 |
StopProgressDialogAndStoreValues();
|
|
3168 |
|
|
3169 |
TInt textId( R_QTN_CONFIRM_FORMAT_TEXT2 );
|
|
3170 |
#ifdef RD_MULTIPLE_DRIVE
|
|
3171 |
if ( DriveInfo().iState & TFileManagerDriveInfo::EDriveMassStorage )
|
|
3172 |
{
|
|
3173 |
textId = R_QTN_FMGR_FORMAT_MASS_QUERY2;
|
|
3174 |
}
|
|
3175 |
#endif // RD_MULTIPLE_DRIVE
|
|
3176 |
|
|
3177 |
TBool query( FileManagerDlgUtils::ShowConfirmQueryWithYesNoL( textId ) );
|
|
3178 |
LaunchProgressDialogL(
|
|
3179 |
iProgressFinalValue, iProgressCurrentValue, iActiveProcess );
|
|
3180 |
return query;
|
|
3181 |
}
|
|
3182 |
case ENotifyFileOpenDenied:
|
|
3183 |
{
|
|
3184 |
TBool launchProgress( StopProgressDialogAndStoreValues() );
|
|
3185 |
|
|
3186 |
ret = !CheckFileRightsAndInformIfExpiredL( aName );
|
|
3187 |
if ( launchProgress )
|
|
3188 |
{
|
|
3189 |
LaunchProgressDialogL(
|
|
3190 |
iProgressFinalValue, iProgressCurrentValue, iActiveProcess );
|
|
3191 |
}
|
|
3192 |
break;
|
|
3193 |
}
|
|
3194 |
default:
|
|
3195 |
{
|
|
3196 |
break;
|
|
3197 |
}
|
|
3198 |
}
|
|
3199 |
return ret;
|
|
3200 |
}
|
|
3201 |
|
|
3202 |
// ------------------------------------------------------------------------------
|
|
3203 |
// CFileManagerViewBase::MemoryStoreMenuFilteringL
|
|
3204 |
//
|
|
3205 |
// ------------------------------------------------------------------------------
|
|
3206 |
//
|
|
3207 |
void CFileManagerViewBase::MemoryStoreMenuFilteringL(
|
|
3208 |
CEikMenuPane& aMenuPane )
|
|
3209 |
{
|
|
3210 |
TBool isSearchOn( iEngine.State() == CFileManagerEngine::ESearch );
|
|
3211 |
TRAP_IGNORE ( RefreshDriveInfoL() );
|
|
3212 |
TFileManagerDriveInfo& drvInfo( DriveInfo() );
|
|
3213 |
TInt driveNumber = drvInfo.iDrive;
|
|
3214 |
iEngine.GetDriveInfoL(driveNumber,drvInfo);
|
|
3215 |
|
|
3216 |
// Common remote drive filtering
|
|
3217 |
RemoteDriveCommonFilteringL( aMenuPane );
|
|
3218 |
if( iContainer->IsSearchFieldVisible() &&
|
|
3219 |
!FilesCountInSearchField() )
|
|
3220 |
{
|
|
3221 |
aMenuPane.SetItemDimmed( EFileManagerMark, ETrue );
|
|
3222 |
}
|
|
3223 |
if ( iContainer->ListBoxNumberOfItems() )
|
|
3224 |
{
|
|
3225 |
if ( !iContainer->ListBoxSelectionIndexesCount() )
|
|
3226 |
{
|
|
3227 |
TUint32 fileType( iEngine.FileTypeL(
|
|
3228 |
iContainer->ListBoxCurrentItemIndex() ) );
|
|
3229 |
if ( ( fileType & KDefaultFolderMask ) == KDefaultFolderMask )
|
|
3230 |
{
|
|
3231 |
aMenuPane.SetItemDimmed( EFileManagerMoveToFolder, ETrue );
|
|
3232 |
}
|
|
3233 |
}
|
|
3234 |
}
|
|
3235 |
else
|
|
3236 |
{
|
|
3237 |
aMenuPane.SetItemDimmed( EFileManagerMoveToFolder, ETrue );
|
|
3238 |
aMenuPane.SetItemDimmed( EFileManagerCopyToFolder, ETrue );
|
|
3239 |
}
|
|
3240 |
TInt index(iContainer->ListBoxCurrentItemIndex());
|
|
3241 |
TUint32 fileType(iEngine.FileTypeL(index));
|
|
3242 |
if (!(fileType & CFileManagerItemProperties::EFolder))
|
|
3243 |
{
|
|
3244 |
aMenuPane.SetItemDimmed(EFileManagerMoveToFolder, ETrue);
|
|
3245 |
}
|
|
3246 |
CFileManagerFeatureManager& featureManager( FeatureManager() );
|
|
3247 |
|
|
3248 |
#ifdef RD_MULTIPLE_DRIVE
|
|
3249 |
// No format item for mass storage in embedded mode dimming
|
|
3250 |
if ( !( drvInfo.iState & TFileManagerDriveInfo::EDriveFormattable ) )
|
|
3251 |
{
|
|
3252 |
aMenuPane.SetItemDimmed( EFileManagerFormatMassStorage, ETrue );
|
|
3253 |
}
|
|
3254 |
#endif // RD_MULTIPLE_DRIVE
|
|
3255 |
|
|
3256 |
// Memory store specific remote drive filtering
|
|
3257 |
if ( !featureManager.IsRemoteStorageFwSupported() ||
|
|
3258 |
!( drvInfo.iState & TFileManagerDriveInfo::EDriveRemote ) ||
|
|
3259 |
!( drvInfo.iState & TFileManagerDriveInfo::EDriveConnected ) )
|
|
3260 |
{
|
|
3261 |
// For disconnected or non remote drive
|
|
3262 |
aMenuPane.SetItemDimmed( EFileManagerRefreshRemoteDrive, ETrue );
|
|
3263 |
}
|
|
3264 |
|
|
3265 |
if ( !featureManager.IsHelpSupported() )
|
|
3266 |
{
|
|
3267 |
// No help item dimming
|
|
3268 |
aMenuPane.SetItemDimmed( EAknCmdHelp, ETrue );
|
|
3269 |
}
|
|
3270 |
if ( !featureManager.IsIrdaSupported() )
|
|
3271 |
{
|
|
3272 |
// No infra red item dimming
|
|
3273 |
aMenuPane.SetItemDimmed( EFileManagerReceiveViaIR, ETrue );
|
|
3274 |
}
|
|
3275 |
if ( isSearchOn )
|
|
3276 |
{
|
|
3277 |
// Search view item dimming
|
|
3278 |
aMenuPane.SetItemDimmed( EFileManagerRename, ETrue );
|
|
3279 |
aMenuPane.SetItemDimmed( EFileManagerReceiveViaIR, ETrue );
|
|
3280 |
aMenuPane.SetItemDimmed( EFileManagerOrganise, ETrue );
|
|
3281 |
// aMenuPane.SetItemDimmed( EFileManagerMemoryCard, ETrue );
|
|
3282 |
// aMenuPane.SetItemDimmed( EFileManagerMemoryCardPassword, ETrue );
|
|
3283 |
//aMenuPane.SetItemDimmed( EFileManagerUnlockMemoryCard, ETrue );
|
|
3284 |
aMenuPane.SetItemDimmed( EFileManagerRefreshRemoteDrive, ETrue );
|
|
3285 |
#ifdef RD_MULTIPLE_DRIVE
|
|
3286 |
aMenuPane.SetItemDimmed( EFileManagerFormatMassStorage, ETrue );
|
|
3287 |
#endif // RD_MULTIPLE_DRIVE
|
|
3288 |
aMenuPane.SetItemDimmed( EFileManagerSort, ETrue );
|
|
3289 |
}
|
|
3290 |
else
|
|
3291 |
{
|
|
3292 |
aMenuPane.SetItemDimmed( EFileManagerSearchSort, ETrue );
|
|
3293 |
}
|
|
3294 |
//dim the item unconditionally
|
|
3295 |
aMenuPane.SetItemDimmed( EFileManagerFormatMassStorage, ETrue );
|
|
3296 |
if ( drvInfo.iState & TFileManagerDriveInfo::EDriveWriteProtected )
|
|
3297 |
{
|
|
3298 |
// Write protected item dimming
|
|
3299 |
aMenuPane.SetItemDimmed( EFileManagerRename, ETrue );
|
|
3300 |
aMenuPane.SetItemDimmed( EFileManagerDelete, ETrue );
|
|
3301 |
aMenuPane.SetItemDimmed( EFileManagerReceiveViaIR, ETrue );
|
|
3302 |
// aMenuPane.SetItemDimmed( EFileManagerMemoryCard, ETrue );
|
|
3303 |
// aMenuPane.SetItemDimmed( EFileManagerMemoryCardPassword, ETrue );
|
|
3304 |
#ifdef RD_MULTIPLE_DRIVE
|
|
3305 |
aMenuPane.SetItemDimmed( EFileManagerFormatMassStorage, ETrue );
|
|
3306 |
#endif // RD_MULTIPLE_DRIVE
|
|
3307 |
}
|
|
3308 |
|
|
3309 |
#ifdef RD_MULTIPLE_DRIVE
|
|
3310 |
if ( drvInfo.iState & TFileManagerDriveInfo::EDriveMassStorage )
|
|
3311 |
{
|
|
3312 |
// Mass storage item dimming
|
|
3313 |
// aMenuPane.SetItemDimmed( EFileManagerMemoryCard, ETrue );
|
|
3314 |
// aMenuPane.SetItemDimmed( EFileManagerMemoryCardPassword, ETrue );
|
|
3315 |
aMenuPane.SetItemDimmed( EFileManagerUnlockMemoryCard, ETrue );
|
|
3316 |
|
|
3317 |
if ( !( drvInfo.iState & TFileManagerDriveInfo::EDrivePresent ) )
|
|
3318 |
{
|
|
3319 |
aMenuPane.SetItemDimmed( EFileManagerFormatMassStorage, ETrue );
|
|
3320 |
}
|
|
3321 |
}
|
|
3322 |
else
|
|
3323 |
#endif // RD_MULTIPLE_DRIVE
|
|
3324 |
if ( drvInfo.iState & TFileManagerDriveInfo::EDriveRemovable )
|
|
3325 |
{
|
|
3326 |
// Memory card item dimming
|
|
3327 |
if ( !( drvInfo.iState & TFileManagerDriveInfo::EDrivePresent ) ||
|
|
3328 |
( drvInfo.iState & ( TFileManagerDriveInfo::EDriveCorrupted |
|
|
3329 |
TFileManagerDriveInfo::EDriveLocked ) ) )
|
|
3330 |
{
|
|
3331 |
// aMenuPane.SetItemDimmed( EFileManagerMemoryCardPassword, ETrue );
|
|
3332 |
aMenuPane.SetItemDimmed( EFileManagerDetails, ETrue );
|
|
3333 |
}
|
|
3334 |
if ( ( drvInfo.iState & TFileManagerDriveInfo::EDriveCorrupted ) ||
|
|
3335 |
!( drvInfo.iState & TFileManagerDriveInfo::EDriveLocked ) )
|
|
3336 |
{
|
|
3337 |
aMenuPane.SetItemDimmed( EFileManagerUnlockMemoryCard, ETrue );
|
|
3338 |
}
|
|
3339 |
// if ( !( drvInfo.iState & TFileManagerDriveInfo::EDriveLockable ) )
|
|
3340 |
// {
|
|
3341 |
// aMenuPane.SetItemDimmed( EFileManagerMemoryCardPassword, ETrue );
|
|
3342 |
// }
|
|
3343 |
if ( !featureManager.IsMmcPassWdSupported() )
|
|
3344 |
{
|
|
3345 |
//aMenuPane.SetItemDimmed( EFileManagerMemoryCardPassword, ETrue );
|
|
3346 |
aMenuPane.SetItemDimmed( EFileManagerUnlockMemoryCard, ETrue );
|
|
3347 |
}
|
|
3348 |
#ifdef RD_MULTIPLE_DRIVE
|
|
3349 |
aMenuPane.SetItemDimmed( EFileManagerFormatMassStorage, ETrue );
|
|
3350 |
#endif // RD_MULTIPLE_DRIVE
|
|
3351 |
}
|
|
3352 |
else
|
|
3353 |
{
|
|
3354 |
// No mass storage or memory card item dimming
|
|
3355 |
// aMenuPane.SetItemDimmed( EFileManagerMemoryCard, ETrue );
|
|
3356 |
// aMenuPane.SetItemDimmed( EFileManagerMemoryCardPassword, ETrue );
|
|
3357 |
aMenuPane.SetItemDimmed( EFileManagerUnlockMemoryCard, ETrue );
|
|
3358 |
#ifdef RD_MULTIPLE_DRIVE
|
|
3359 |
aMenuPane.SetItemDimmed( EFileManagerFormatMassStorage, ETrue );
|
|
3360 |
#endif // RD_MULTIPLE_DRIVE
|
|
3361 |
}
|
|
3362 |
|
|
3363 |
// CEikListBox& listBox = iContainer->ListBox();
|
|
3364 |
TBool dimSend( EFalse );
|
|
3365 |
|
|
3366 |
if ( iContainer->ListBoxSelectionIndexesCount() )
|
|
3367 |
{
|
|
3368 |
// Selections in list
|
|
3369 |
aMenuPane.SetItemDimmed( EFileManagerOpen, ETrue );
|
|
3370 |
aMenuPane.SetItemDimmed( EFileManagerRename, ETrue );
|
|
3371 |
aMenuPane.SetItemDimmed( EFileManagerDetails, ETrue );
|
|
3372 |
|
|
3373 |
if ( !featureManager.IsDrmFullSupported() &&
|
|
3374 |
AreChosenFilesProtectedL( ETrue ) )
|
|
3375 |
{
|
|
3376 |
dimSend = ETrue;
|
|
3377 |
}
|
|
3378 |
|
|
3379 |
|
|
3380 |
// Hide empty details if no item or memory specific details
|
|
3381 |
// can be shown.
|
|
3382 |
if ( isSearchOn ||
|
|
3383 |
( drvInfo.iState & TFileManagerDriveInfo::EDriveRemote ) )
|
|
3384 |
{
|
|
3385 |
aMenuPane.SetItemDimmed( EFileManagerDetails, ETrue );
|
|
3386 |
}
|
|
3387 |
|
|
3388 |
if ( !( drvInfo.iState & TFileManagerDriveInfo::EDrivePresent ) ||
|
|
3389 |
( ( drvInfo.iState & TFileManagerDriveInfo::EDriveRemote ) &&
|
|
3390 |
!( drvInfo.iState & TFileManagerDriveInfo::EDriveConnected ) ) )
|
|
3391 |
{
|
|
3392 |
// Handle unavailable drive OR disconnected remote drive
|
|
3393 |
dimSend = ETrue;
|
|
3394 |
aMenuPane.SetItemDimmed( EFileManagerSort, ETrue );
|
|
3395 |
aMenuPane.SetItemDimmed( EFileManagerOrganise, ETrue );
|
|
3396 |
aMenuPane.SetItemDimmed( EFileManagerMark, ETrue );
|
|
3397 |
}
|
|
3398 |
}
|
|
3399 |
else if ( iContainer->ListBoxNumberOfItems() )
|
|
3400 |
{
|
|
3401 |
// Check if there is files on the list
|
|
3402 |
TInt files( iEngine.FilesInFolderL() );
|
|
3403 |
if ( !files )
|
|
3404 |
{
|
|
3405 |
dimSend = ETrue;
|
|
3406 |
aMenuPane.SetItemDimmed( EFileManagerMark, ETrue );
|
|
3407 |
}
|
|
3408 |
|
|
3409 |
// There is items in list, check selection type
|
|
3410 |
TUint32 fileType( iEngine.FileTypeL(
|
|
3411 |
iContainer->ListBoxCurrentItemIndex() ) );
|
|
3412 |
if ( ( fileType & KDefaultFolderMask ) == KDefaultFolderMask )
|
|
3413 |
{
|
|
3414 |
dimSend = ETrue;
|
|
3415 |
aMenuPane.SetItemDimmed( EFileManagerDelete, ETrue );
|
|
3416 |
aMenuPane.SetItemDimmed( EFileManagerRename, ETrue );
|
|
3417 |
}
|
|
3418 |
else if ( fileType & CFileManagerItemProperties::EFolder )
|
|
3419 |
{
|
|
3420 |
dimSend = ETrue;
|
|
3421 |
}
|
|
3422 |
|
|
3423 |
if ( fileType & CFileManagerItemProperties::EPlaylist )
|
|
3424 |
{
|
|
3425 |
dimSend = ETrue;
|
|
3426 |
}
|
|
3427 |
|
|
3428 |
// When full OMA DRM is in use, it is ok to show send option
|
|
3429 |
if( ( fileType & CFileManagerItemProperties::EForwardLocked ) &&
|
|
3430 |
!featureManager.IsDrmFullSupported() )
|
|
3431 |
{
|
|
3432 |
dimSend = ETrue;
|
|
3433 |
}
|
|
3434 |
if ( ( drvInfo.iState & TFileManagerDriveInfo::EDriveRemote ) &&
|
|
3435 |
!( drvInfo.iState & TFileManagerDriveInfo::EDriveConnected ) )
|
|
3436 |
{
|
|
3437 |
// Handle disconnected remote drive
|
|
3438 |
dimSend = ETrue;
|
|
3439 |
}
|
|
3440 |
}
|
|
3441 |
else
|
|
3442 |
{
|
|
3443 |
// List is empty
|
|
3444 |
aMenuPane.SetItemDimmed( EFileManagerOpen, ETrue );
|
|
3445 |
aMenuPane.SetItemDimmed( EFileManagerDelete, ETrue );
|
|
3446 |
aMenuPane.SetItemDimmed( EFileManagerMark, ETrue );
|
|
3447 |
aMenuPane.SetItemDimmed( EFileManagerRename, ETrue );
|
|
3448 |
aMenuPane.SetItemDimmed( EFileManagerSort, ETrue );
|
|
3449 |
aMenuPane.SetItemDimmed( EFileManagerSearchSort, ETrue );
|
|
3450 |
aMenuPane.SetItemDimmed( EFileManagerDetails, ETrue );
|
|
3451 |
dimSend = ETrue;
|
|
3452 |
|
|
3453 |
if ( drvInfo.iState & TFileManagerDriveInfo::EDriveWriteProtected )
|
|
3454 |
{
|
|
3455 |
// Handle write protected drive
|
|
3456 |
aMenuPane.SetItemDimmed( EFileManagerOrganise, ETrue );
|
|
3457 |
}
|
|
3458 |
if ( drvInfo.iState & TFileManagerDriveInfo::EDriveRemote )
|
|
3459 |
{
|
|
3460 |
// Handle empty remote folder
|
|
3461 |
aMenuPane.SetItemDimmed( EFileManagerDetails, ETrue );
|
|
3462 |
}
|
|
3463 |
|
|
3464 |
if ( ( drvInfo.iState & TFileManagerDriveInfo::EDriveRemote ) &&
|
|
3465 |
!( drvInfo.iState & TFileManagerDriveInfo::EDriveConnected ) )
|
|
3466 |
{
|
|
3467 |
// Handle disconnected remote drive
|
|
3468 |
aMenuPane.SetItemDimmed( EFileManagerReceiveViaIR, ETrue );
|
|
3469 |
aMenuPane.SetItemDimmed( EFileManagerOrganise, ETrue );
|
|
3470 |
// aMenuPane.SetItemDimmed( EFileManagerDetails, ETrue );
|
|
3471 |
}
|
|
3472 |
else if ( !( drvInfo.iState & TFileManagerDriveInfo::EDrivePresent ) ||
|
|
3473 |
( drvInfo.iState & (
|
|
3474 |
TFileManagerDriveInfo::EDriveCorrupted |
|
|
3475 |
TFileManagerDriveInfo::EDriveLocked ) ) )
|
|
3476 |
{
|
|
3477 |
// Handle unavailable drive
|
|
3478 |
// aMenuPane.SetItemDimmed( EFileManagerDetails, ETrue );
|
|
3479 |
aMenuPane.SetItemDimmed( EFileManagerReceiveViaIR, ETrue );
|
|
3480 |
aMenuPane.SetItemDimmed( EFileManagerOrganise, ETrue );
|
|
3481 |
// aMenuPane.SetItemDimmed( EFileManagerMemoryCardPassword, ETrue );
|
|
3482 |
|
|
3483 |
if ( drvInfo.iState & TFileManagerDriveInfo::EDriveRemovable &&
|
|
3484 |
!( drvInfo.iState & TFileManagerDriveInfo::EDriveLocked ) )
|
|
3485 |
{
|
|
3486 |
aMenuPane.SetItemDimmed( EFileManagerUnlockMemoryCard, ETrue );
|
|
3487 |
}
|
|
3488 |
}
|
|
3489 |
else if ( isSearchOn ||
|
|
3490 |
!BaflUtils::PathExists(
|
|
3491 |
iEikonEnv->FsSession(), iEngine.CurrentDirectory() ) )
|
|
3492 |
{
|
|
3493 |
// Handle empty search results and invalid path
|
|
3494 |
if ( isSearchOn || !iEngine.CurrentDirectory().Length() )
|
|
3495 |
{
|
|
3496 |
aMenuPane.SetItemDimmed( EFileManagerReceiveViaIR, ETrue );
|
|
3497 |
aMenuPane.SetItemDimmed( EFileManagerOrganise, ETrue );
|
|
3498 |
// aMenuPane.SetItemDimmed( EFileManagerMemoryCardPassword, ETrue );
|
|
3499 |
// aMenuPane.SetItemDimmed( EFileManagerMemoryCard, ETrue );
|
|
3500 |
aMenuPane.SetItemDimmed( EFileManagerUnlockMemoryCard, ETrue );
|
|
3501 |
// aMenuPane.SetItemDimmed( EFileManagerDetails, ETrue );
|
|
3502 |
}
|
|
3503 |
else
|
|
3504 |
{
|
|
3505 |
// BaflUtils::PathExists does not work for remote drive root dirs.
|
|
3506 |
if( drvInfo.iState & TFileManagerDriveInfo::EDriveRemote )
|
|
3507 |
{
|
|
3508 |
_LIT( KRootFolder, "?:\\" );
|
|
3509 |
if ( iEngine.CurrentDirectory().MatchF( KRootFolder ) )
|
|
3510 |
{
|
|
3511 |
User::Leave( KErrPathNotFound );
|
|
3512 |
}
|
|
3513 |
}
|
|
3514 |
else
|
|
3515 |
{
|
|
3516 |
User::Leave( KErrPathNotFound );
|
|
3517 |
}
|
|
3518 |
}
|
|
3519 |
}
|
|
3520 |
}
|
|
3521 |
|
|
3522 |
if ( !dimSend )
|
|
3523 |
{
|
|
3524 |
AddSendOptionL( aMenuPane, EFileManagerDelete );
|
|
3525 |
}
|
|
3526 |
}
|
|
3527 |
|
|
3528 |
// ------------------------------------------------------------------------------
|
|
3529 |
// CFileManagerViewBase::OrganiseMenuFilteringL
|
|
3530 |
//
|
|
3531 |
// ------------------------------------------------------------------------------
|
|
3532 |
//
|
|
3533 |
void CFileManagerViewBase::OrganiseMenuFilteringL( CEikMenuPane& aMenuPane )
|
|
3534 |
{
|
|
3535 |
// CEikListBox& listBox( iContainer->ListBox() );
|
|
3536 |
|
|
3537 |
|
|
3538 |
// Search view item dimming
|
|
3539 |
if( iEngine.State() == CFileManagerEngine::ESearch )
|
|
3540 |
{
|
|
3541 |
aMenuPane.SetItemDimmed( EFileManagerNewFolder, ETrue );
|
|
3542 |
}
|
|
3543 |
|
|
3544 |
TFileManagerDriveInfo& drvInfo( DriveInfo() );
|
|
3545 |
if ( drvInfo.iState & TFileManagerDriveInfo::EDriveWriteProtected )
|
|
3546 |
{
|
|
3547 |
// Write protected item dimming
|
|
3548 |
aMenuPane.SetItemDimmed( EFileManagerNewFolder, ETrue );
|
|
3549 |
|
|
3550 |
}
|
|
3551 |
}
|
|
3552 |
|
|
3553 |
// ------------------------------------------------------------------------------
|
|
3554 |
// CFileManagerViewBase::DetailsMenuFilteringL
|
|
3555 |
//
|
|
3556 |
// ------------------------------------------------------------------------------
|
|
3557 |
//
|
|
3558 |
void CFileManagerViewBase::DetailsMenuFilteringL( CEikMenuPane& aMenuPane )
|
|
3559 |
{
|
|
3560 |
TInt index( iContainer->ListBoxCurrentItemIndex() );
|
|
3561 |
TUint32 fileType( iEngine.FileTypeL( index ) );
|
|
3562 |
if ( fileType & CFileManagerItemProperties::EFolder )
|
|
3563 |
{
|
|
3564 |
aMenuPane.SetItemDimmed( EFileManagerFileDetails, ETrue );
|
|
3565 |
}
|
|
3566 |
else
|
|
3567 |
{
|
|
3568 |
aMenuPane.SetItemDimmed( EFileManagerFolderDetails, ETrue );
|
|
3569 |
}
|
|
3570 |
if ( !FeatureManager().IsDrmFullSupported() ||
|
|
3571 |
!( fileType & CFileManagerItemProperties::EDrmProtected ) ||
|
|
3572 |
!HasInfoUrlL( index ) )
|
|
3573 |
{
|
|
3574 |
aMenuPane.SetItemDimmed( EFileManagerMoreInfoOnline, ETrue );
|
|
3575 |
}
|
|
3576 |
}
|
|
3577 |
|
|
3578 |
//// ------------------------------------------------------------------------------
|
|
3579 |
//// CFileManagerViewBase::MemoryCardMenuFilteringL
|
|
3580 |
////
|
|
3581 |
//// ------------------------------------------------------------------------------
|
|
3582 |
////
|
|
3583 |
//void CFileManagerViewBase::MemoryCardMenuFilteringL( CEikMenuPane& aMenuPane )
|
|
3584 |
// {
|
|
3585 |
// TFileManagerDriveInfo& drvInfo( DriveInfo() );
|
|
3586 |
//
|
|
3587 |
// if ( drvInfo.iState & ( TFileManagerDriveInfo::EDriveCorrupted |
|
|
3588 |
// TFileManagerDriveInfo::EDriveLocked |
|
|
3589 |
// TFileManagerDriveInfo::EDriveMassStorage ) )
|
|
3590 |
// {
|
|
3591 |
// aMenuPane.SetItemDimmed( EFileManagerMemoryCardName, ETrue );
|
|
3592 |
// aMenuPane.SetItemDimmed( EFileManagerMemoryCardRename, ETrue );
|
|
3593 |
// }
|
|
3594 |
// else
|
|
3595 |
// {
|
|
3596 |
// if ( drvInfo.iName.Length() )
|
|
3597 |
// {
|
|
3598 |
// aMenuPane.SetItemDimmed( EFileManagerMemoryCardName, ETrue );
|
|
3599 |
// }
|
|
3600 |
// else
|
|
3601 |
// {
|
|
3602 |
// aMenuPane.SetItemDimmed( EFileManagerMemoryCardRename, ETrue );
|
|
3603 |
// }
|
|
3604 |
// }
|
|
3605 |
//
|
|
3606 |
// if ( !( drvInfo.iState & TFileManagerDriveInfo::EDriveFormattable ) )
|
|
3607 |
// {
|
|
3608 |
// aMenuPane.SetItemDimmed( EFileManagerMemoryCardFormat, ETrue );
|
|
3609 |
// }
|
|
3610 |
// }
|
|
3611 |
//
|
|
3612 |
//// ------------------------------------------------------------------------------
|
|
3613 |
//// CFileManagerViewBase::MemoryCardPasswordMenuFilteringL
|
|
3614 |
////
|
|
3615 |
//// ------------------------------------------------------------------------------
|
|
3616 |
////
|
|
3617 |
//void CFileManagerViewBase::MemoryCardPasswordMenuFilteringL( CEikMenuPane& aMenuPane )
|
|
3618 |
// {
|
|
3619 |
// TFileManagerDriveInfo& drvInfo( DriveInfo() );
|
|
3620 |
//
|
|
3621 |
// if ( drvInfo.iState & TFileManagerDriveInfo::EDrivePasswordProtected )
|
|
3622 |
// {
|
|
3623 |
// aMenuPane.SetItemDimmed( EFileManagerMemoryCardPasswordSet, ETrue );
|
|
3624 |
// }
|
|
3625 |
// else
|
|
3626 |
// {
|
|
3627 |
// aMenuPane.SetItemDimmed( EFileManagerMemoryCardPasswordChange, ETrue );
|
|
3628 |
// aMenuPane.SetItemDimmed( EFileManagerMemoryCardPasswordRemove, ETrue );
|
|
3629 |
// }
|
|
3630 |
// }
|
|
3631 |
|
|
3632 |
// ------------------------------------------------------------------------------
|
|
3633 |
// CFileManagerViewBase::ContextSensitiveMenuFilteringL
|
|
3634 |
//
|
|
3635 |
// ------------------------------------------------------------------------------
|
|
3636 |
//
|
|
3637 |
void CFileManagerViewBase::ContextSensitiveMenuFilteringL( CEikMenuPane& aMenuPane )
|
|
3638 |
{
|
|
3639 |
TFileManagerDriveInfo& drvInfo( DriveInfo() );
|
|
3640 |
TInt driveNumber = drvInfo.iDrive;
|
|
3641 |
iEngine.GetDriveInfoL(driveNumber,drvInfo);
|
|
3642 |
|
|
3643 |
// Check if there are files to send
|
|
3644 |
TInt dummy( 0 );
|
|
3645 |
CArrayFixFlat< TInt >* files = GetSendFilesLC( dummy );
|
|
3646 |
|
|
3647 |
TBool dimSend( EFalse );
|
|
3648 |
if ( ( drvInfo.iState & TFileManagerDriveInfo::EDriveRemote ) &&
|
|
3649 |
!( drvInfo.iState & TFileManagerDriveInfo::EDriveConnected ) )
|
|
3650 |
{
|
|
3651 |
dimSend = ETrue;
|
|
3652 |
}
|
|
3653 |
|
|
3654 |
if ( files->Count() && !dimSend )
|
|
3655 |
{
|
|
3656 |
AddSendOptionL( aMenuPane, EFileManagerOrganise );
|
|
3657 |
}
|
|
3658 |
CleanupStack::PopAndDestroy( files );
|
|
3659 |
|
|
3660 |
if ( drvInfo.iState & TFileManagerDriveInfo::EDriveWriteProtected )
|
|
3661 |
{
|
|
3662 |
// Write protected item dimming
|
|
3663 |
aMenuPane.SetItemDimmed( EFileManagerMemoryStorageFormat, ETrue );
|
|
3664 |
}
|
|
3665 |
|
|
3666 |
if ( iEngine.State() == CFileManagerEngine::ESearch ||
|
|
3667 |
!( drvInfo.iState & TFileManagerDriveInfo::EDriveRemovable ) )
|
|
3668 |
{
|
|
3669 |
// No memory card item dimming
|
|
3670 |
aMenuPane.SetItemDimmed( EFileManagerUnlockMemoryCard, ETrue );
|
|
3671 |
aMenuPane.SetItemDimmed( EFileManagerMemoryStorageFormat, ETrue );
|
|
3672 |
}
|
|
3673 |
else
|
|
3674 |
{
|
|
3675 |
// Memory card item dimming
|
|
3676 |
if ( !( drvInfo.iState & TFileManagerDriveInfo::EDriveLocked ) )
|
|
3677 |
{
|
|
3678 |
aMenuPane.SetItemDimmed( EFileManagerUnlockMemoryCard, ETrue );
|
|
3679 |
}
|
|
3680 |
if ( !( drvInfo.iState & TFileManagerDriveInfo::EDriveCorrupted ) ||
|
|
3681 |
!( drvInfo.iState & TFileManagerDriveInfo::EDriveFormattable ) )
|
|
3682 |
{
|
|
3683 |
aMenuPane.SetItemDimmed( EFileManagerMemoryStorageFormat, ETrue );
|
|
3684 |
}
|
|
3685 |
}
|
|
3686 |
}
|
|
3687 |
|
|
3688 |
// -----------------------------------------------------------------------------
|
|
3689 |
// CFileManagerViewBase::DriveInfo
|
|
3690 |
//
|
|
3691 |
// -----------------------------------------------------------------------------
|
|
3692 |
//
|
|
3693 |
TFileManagerDriveInfo& CFileManagerViewBase::DriveInfo() const
|
|
3694 |
{
|
|
3695 |
return static_cast< CFileManagerAppUi* >( AppUi() )->DriveInfo();
|
|
3696 |
}
|
|
3697 |
|
|
3698 |
// -----------------------------------------------------------------------------
|
|
3699 |
// CFileManagerViewBase::RefreshDriveInfoL
|
|
3700 |
//
|
|
3701 |
// -----------------------------------------------------------------------------
|
|
3702 |
//
|
|
3703 |
void CFileManagerViewBase::RefreshDriveInfoL()
|
|
3704 |
{
|
|
3705 |
if ( !iEngine.CurrentDirectory().Length() )
|
|
3706 |
{
|
|
3707 |
return;
|
|
3708 |
}
|
|
3709 |
iEngine.GetDriveInfoL( DriveInfo() );
|
|
3710 |
}
|
|
3711 |
|
|
3712 |
// ------------------------------------------------------------------------------
|
|
3713 |
// CFileManagerViewBase::StartProcessL
|
|
3714 |
//
|
|
3715 |
// ------------------------------------------------------------------------------
|
|
3716 |
//
|
|
3717 |
void CFileManagerViewBase::StartProcessL(
|
|
3718 |
MFileManagerProcessObserver::TFileManagerProcess aProcess,
|
|
3719 |
TInt aValue )
|
|
3720 |
{
|
|
3721 |
if ( iActiveProcess != ENoProcess )
|
|
3722 |
{
|
|
3723 |
return;
|
|
3724 |
}
|
|
3725 |
LaunchProgressDialogL( KMaxTInt, 0, aProcess );
|
|
3726 |
iEngine.SetObserver( this );
|
|
3727 |
iActiveProcess = aProcess;
|
|
3728 |
TInt err( KErrNone );
|
|
3729 |
switch ( aProcess )
|
|
3730 |
{
|
|
3731 |
case EFormatProcess:
|
|
3732 |
{
|
|
3733 |
TRAP( err, iEngine.StartFormatProcessL( aValue ) );
|
|
3734 |
break;
|
|
3735 |
}
|
|
3736 |
case EBackupProcess:
|
|
3737 |
case ERestoreProcess: // FALLTHROUGH
|
|
3738 |
{
|
|
3739 |
CFileManagerAppUi* appUi = static_cast< CFileManagerAppUi* >( AppUi() );
|
|
3740 |
appUi->BackupOrRestoreStarted();
|
|
3741 |
|
|
3742 |
TRAP( err, iEngine.StartBackupProcessL( aProcess ) );
|
|
3743 |
break;
|
|
3744 |
}
|
|
3745 |
case EEjectProcess:
|
|
3746 |
{
|
|
3747 |
TRAP( err, iEngine.StartEjectProcessL( aValue ) );
|
|
3748 |
break;
|
|
3749 |
}
|
|
3750 |
default:
|
|
3751 |
{
|
|
3752 |
TRAP( err, ClearProgressBarL() );
|
|
3753 |
iActiveProcess = ENoProcess;
|
|
3754 |
break;
|
|
3755 |
}
|
|
3756 |
}
|
|
3757 |
if ( err != KErrNone )
|
|
3758 |
{
|
|
3759 |
// Clean up the active process before forwarding leave
|
|
3760 |
ERROR_LOG2(
|
|
3761 |
"CFileManagerViewBase::StartProcessL-aProcess=%d,err=%d",
|
|
3762 |
aProcess, err )
|
|
3763 |
iActiveProcess = ENoProcess;
|
|
3764 |
User::Leave( err );
|
|
3765 |
}
|
|
3766 |
}
|
|
3767 |
|
|
3768 |
// ------------------------------------------------------------------------------
|
|
3769 |
// CFileManagerViewBase::CmdUnlockDriveL
|
|
3770 |
//
|
|
3771 |
// ------------------------------------------------------------------------------
|
|
3772 |
//
|
|
3773 |
void CFileManagerViewBase::CmdUnlockDriveL()
|
|
3774 |
{
|
|
3775 |
TFileManagerDriveInfo drvInfo;
|
|
3776 |
if ( DriveInfoAtCurrentPosL( drvInfo ) < 0 )
|
|
3777 |
{
|
|
3778 |
return; // No drive selected
|
|
3779 |
}
|
|
3780 |
|
|
3781 |
if ( !UnlockRemovePasswordL( drvInfo.iDrive, EFalse ) ) // Unlock only
|
|
3782 |
{
|
|
3783 |
RefreshDriveInfoL();
|
|
3784 |
iEngine.SetObserver( this );
|
|
3785 |
iEngine.RefreshDirectory();
|
|
3786 |
}
|
|
3787 |
}
|
|
3788 |
|
|
3789 |
// ------------------------------------------------------------------------------
|
|
3790 |
// CFileManagerViewBase::CmdFormatDriveL
|
|
3791 |
//
|
|
3792 |
// ------------------------------------------------------------------------------
|
|
3793 |
//
|
|
3794 |
void CFileManagerViewBase::CmdFormatDriveL()
|
|
3795 |
{
|
|
3796 |
StoreIndex();
|
|
3797 |
TFileManagerDriveInfo drvInfo;
|
|
3798 |
if ( DriveInfoAtCurrentPosL( drvInfo ) < 0 )
|
|
3799 |
{
|
|
3800 |
return; // No drive selected
|
|
3801 |
}
|
|
3802 |
|
|
3803 |
if ( !( drvInfo.iState & ( TFileManagerDriveInfo::EDriveRemovable |
|
|
3804 |
TFileManagerDriveInfo::EDriveFormattable ) ) ||
|
|
3805 |
( drvInfo.iState & TFileManagerDriveInfo::EDriveWriteProtected ) )
|
|
3806 |
{
|
|
3807 |
FileManagerDlgUtils::ShowErrorNoteL(
|
|
3808 |
R_QTN_MEMORYCARD_READONLY );
|
|
3809 |
return;
|
|
3810 |
}
|
|
3811 |
|
|
3812 |
TBool query( EFalse );
|
|
3813 |
#ifdef RD_MULTIPLE_DRIVE
|
|
3814 |
if ( drvInfo.iState & TFileManagerDriveInfo::EDriveUsbMemory )
|
|
3815 |
{
|
|
3816 |
HBufC* text = iEngine.GetFormattedDriveNameLC(
|
|
3817 |
drvInfo.iDrive, R_QTN_FMGR_USB_MEMORY_FORMAT_QUERY );
|
|
3818 |
query = FileManagerDlgUtils::ShowConfirmQueryWithYesNoL( *text );
|
|
3819 |
CleanupStack::PopAndDestroy( text );
|
|
3820 |
}
|
|
3821 |
else if ( drvInfo.iState & TFileManagerDriveInfo::EDriveMassStorage )
|
|
3822 |
{
|
|
3823 |
HBufC* text = iEngine.GetFormattedDriveNameLC(
|
|
3824 |
drvInfo.iDrive, R_QTN_FMGR_FORMAT_MASS_QUERY1 );
|
|
3825 |
query = FileManagerDlgUtils::ShowConfirmQueryWithYesNoL( *text );
|
|
3826 |
CleanupStack::PopAndDestroy( text );
|
|
3827 |
}
|
|
3828 |
else
|
|
3829 |
{
|
|
3830 |
#endif // RD_MULTIPLE_DRIVE
|
|
3831 |
query = FileManagerDlgUtils::ShowConfirmQueryWithYesNoL(
|
|
3832 |
R_QTN_CONFIRM_FORMAT_TEXT );
|
|
3833 |
#ifdef RD_MULTIPLE_DRIVE
|
|
3834 |
}
|
|
3835 |
#endif // RD_MULTIPLE_DRIVE
|
|
3836 |
|
|
3837 |
if ( query )
|
|
3838 |
{
|
|
3839 |
StartProcessL( EFormatProcess, drvInfo.iDrive );
|
|
3840 |
}
|
|
3841 |
}
|
|
3842 |
|
|
3843 |
//// ------------------------------------------------------------------------------
|
|
3844 |
//// CFileManagerViewBase::CmdRenameDriveL
|
|
3845 |
////
|
|
3846 |
//// ------------------------------------------------------------------------------
|
|
3847 |
////
|
|
3848 |
//void CFileManagerViewBase::CmdRenameDriveL()
|
|
3849 |
// {
|
|
3850 |
// TFileManagerDriveInfo& drvInfo( DriveInfo() );
|
|
3851 |
// if ( drvInfo.iState & TFileManagerDriveInfo::EDriveWriteProtected )
|
|
3852 |
// {
|
|
3853 |
// FileManagerDlgUtils::ShowErrorNoteL( R_QTN_MEMORYCARD_READONLY );
|
|
3854 |
// return;
|
|
3855 |
// }
|
|
3856 |
// StoreIndex();
|
|
3857 |
// RenameDriveL( EFalse );
|
|
3858 |
// iEngine.SetObserver( this );
|
|
3859 |
// iEngine.RefreshDirectory();
|
|
3860 |
// }
|
|
3861 |
//
|
|
3862 |
//// ------------------------------------------------------------------------------
|
|
3863 |
//// CFileManagerViewBase::CmdSetDrivePasswordL
|
|
3864 |
////
|
|
3865 |
//// ------------------------------------------------------------------------------
|
|
3866 |
////
|
|
3867 |
//void CFileManagerViewBase::CmdSetDrivePasswordL()
|
|
3868 |
// {
|
|
3869 |
// TBuf< KFmgrMaxMediaPassword > nullPwd;
|
|
3870 |
// TBuf< KFmgrMaxMediaPassword > pwd;
|
|
3871 |
// TInt ret( KErrNone );
|
|
3872 |
// if( FileManagerDlgUtils::ShowPasswordQueryL( pwd ) )
|
|
3873 |
// {
|
|
3874 |
// EmptyPwd( nullPwd );
|
|
3875 |
// ret = UpdatePasswordL( nullPwd, pwd );
|
|
3876 |
// if( ret == KErrNone )
|
|
3877 |
// {
|
|
3878 |
// FileManagerDlgUtils::ShowConfirmNoteL( R_QTN_PASSWORD_SET_TEXT );
|
|
3879 |
// RefreshDriveInfoL();
|
|
3880 |
// }
|
|
3881 |
// else
|
|
3882 |
// {
|
|
3883 |
// FileManagerDlgUtils::ShowErrorNoteL( R_QTN_CRITICAL_ERROR );
|
|
3884 |
// }
|
|
3885 |
// }
|
|
3886 |
// }
|
|
3887 |
//
|
|
3888 |
//// ------------------------------------------------------------------------------
|
|
3889 |
//// CFileManagerViewBase::CmdChangeDrivePasswordL
|
|
3890 |
////
|
|
3891 |
//// ------------------------------------------------------------------------------
|
|
3892 |
////
|
|
3893 |
//void CFileManagerViewBase::CmdChangeDrivePasswordL()
|
|
3894 |
// {
|
|
3895 |
// TBuf< KFmgrMaxMediaPassword > pwd;
|
|
3896 |
// TBuf< KFmgrMaxMediaPassword > oldPwd;
|
|
3897 |
// TBool isDone( EFalse );
|
|
3898 |
// TBool isCanceled( EFalse );
|
|
3899 |
// TInt err( KErrNone );
|
|
3900 |
//
|
|
3901 |
// // Ask for the old password until the correct one is given
|
|
3902 |
// while( !isDone )
|
|
3903 |
// {
|
|
3904 |
// EmptyPwd( oldPwd );
|
|
3905 |
// if( FileManagerDlgUtils::ShowSimplePasswordQueryL(
|
|
3906 |
// R_QTN_PASSWORD_OLD_TEXT, oldPwd ) )
|
|
3907 |
// {
|
|
3908 |
// err = UpdatePasswordL( oldPwd, oldPwd );
|
|
3909 |
// if( err == KErrNone )
|
|
3910 |
// {
|
|
3911 |
// isDone = ETrue;
|
|
3912 |
// }
|
|
3913 |
// else
|
|
3914 |
// {
|
|
3915 |
// FileManagerDlgUtils::ShowErrorNoteL(
|
|
3916 |
// R_QTN_PASSWORDS_WRONG_TEXT );
|
|
3917 |
// }
|
|
3918 |
// }
|
|
3919 |
// else
|
|
3920 |
// {
|
|
3921 |
// isDone = ETrue;
|
|
3922 |
// isCanceled = ETrue;
|
|
3923 |
// }
|
|
3924 |
// }
|
|
3925 |
//
|
|
3926 |
// // Then query for the new password
|
|
3927 |
// if( !isCanceled )
|
|
3928 |
// {
|
|
3929 |
// if( FileManagerDlgUtils::ShowPasswordQueryL( pwd ) )
|
|
3930 |
// {
|
|
3931 |
// err = UpdatePasswordL( oldPwd, pwd );
|
|
3932 |
// if( err == KErrNone )
|
|
3933 |
// {
|
|
3934 |
// FileManagerDlgUtils::ShowConfirmNoteL(
|
|
3935 |
// R_QTN_PASSWORD_CHANGED_TEXT );
|
|
3936 |
// }
|
|
3937 |
// else
|
|
3938 |
// {
|
|
3939 |
// FileManagerDlgUtils::ShowErrorNoteL(
|
|
3940 |
// R_QTN_CRITICAL_ERROR );
|
|
3941 |
// }
|
|
3942 |
// }
|
|
3943 |
// }
|
|
3944 |
// }
|
|
3945 |
//
|
|
3946 |
//// ------------------------------------------------------------------------------
|
|
3947 |
//// CFileManagerViewBase::CmdRemoveDrivePasswordL
|
|
3948 |
////
|
|
3949 |
//// ------------------------------------------------------------------------------
|
|
3950 |
////
|
|
3951 |
//void CFileManagerViewBase::CmdRemoveDrivePasswordL()
|
|
3952 |
// {
|
|
3953 |
// if( !UnlockRemovePasswordL( ETrue ) )
|
|
3954 |
// {
|
|
3955 |
// FileManagerDlgUtils::ShowConfirmNoteL( R_QTN_PASSWORD_REMOVED_TEXT );
|
|
3956 |
// RefreshDriveInfoL();
|
|
3957 |
// }
|
|
3958 |
// }
|
|
3959 |
//
|
|
3960 |
//// ------------------------------------------------------------------------------
|
|
3961 |
//// CFileManagerViewBase::CmdMemoryCardDetailsL
|
|
3962 |
////
|
|
3963 |
//// ------------------------------------------------------------------------------
|
|
3964 |
////
|
|
3965 |
//void CFileManagerViewBase::CmdMemoryCardDetailsL()
|
|
3966 |
// {
|
|
3967 |
// TFileManagerDriveInfo drvInfo;
|
|
3968 |
// iEngine.GetDriveInfoL( iEngine.CurrentDrive(), drvInfo );
|
|
3969 |
// FileManagerDlgUtils::ShowMemoryStoreInfoPopupL( drvInfo );
|
|
3970 |
// }
|
|
3971 |
|
|
3972 |
// ------------------------------------------------------------------------------
|
|
3973 |
// CFileManagerViewBase::UpdatePasswordL
|
|
3974 |
//
|
|
3975 |
// ------------------------------------------------------------------------------
|
|
3976 |
//
|
|
3977 |
TInt CFileManagerViewBase::UpdatePassword(
|
|
3978 |
TInt aDrive, const TDesC& aOldPwd, const TDesC& aPwd )
|
|
3979 |
{
|
|
3980 |
TMediaPassword mPwdNew;
|
|
3981 |
TMediaPassword mPwdOld;
|
|
3982 |
|
|
3983 |
ConvertCharsToPwd( aOldPwd, mPwdOld );
|
|
3984 |
ConvertCharsToPwd( aPwd, mPwdNew );
|
|
3985 |
|
|
3986 |
return iEngine.SetDrivePassword( aDrive, mPwdOld, mPwdNew );
|
|
3987 |
}
|
|
3988 |
|
|
3989 |
// ------------------------------------------------------------------------------
|
|
3990 |
// CFileManagerViewBase::UnlockRemovePasswordL
|
|
3991 |
//
|
|
3992 |
// ------------------------------------------------------------------------------
|
|
3993 |
//
|
|
3994 |
TInt CFileManagerViewBase::UnlockRemovePasswordL(
|
|
3995 |
TInt aDrive, TBool aRemove )
|
|
3996 |
{
|
|
3997 |
TBuf< KFmgrMaxMediaPassword > oldPwd;
|
|
3998 |
TInt err( KErrNone );
|
|
3999 |
TMediaPassword pwd;
|
|
4000 |
TInt res( R_QTN_UNLOCK_PASSWORD_TEXT );
|
|
4001 |
TInt resWrong( R_QTN_UNLOCK_PWD_WRONG_TEXT );
|
|
4002 |
HBufC* text = NULL;
|
|
4003 |
|
|
4004 |
if( aRemove )
|
|
4005 |
{
|
|
4006 |
// Confirm the action
|
|
4007 |
if( !FileManagerDlgUtils::ShowConfirmQueryWithYesNoL(
|
|
4008 |
R_QTN_PASSWORD_REMOVE_TEXT ) )
|
|
4009 |
{
|
|
4010 |
return KErrCancel; // Skip the rest if not accepted
|
|
4011 |
}
|
|
4012 |
res = R_QTN_PASSWORD_OLD_TEXT;
|
|
4013 |
resWrong = R_QTN_PASSWORDS_WRONG_TEXT;
|
|
4014 |
}
|
|
4015 |
else
|
|
4016 |
{
|
|
4017 |
// Just unlock
|
|
4018 |
#ifdef RD_MULTIPLE_DRIVE
|
|
4019 |
text = iEngine.GetFormattedDriveNameLC(
|
|
4020 |
aDrive,
|
|
4021 |
R_QTN_MEMC_UNLOCK_PASSWORD_MULTIPLE_DEFAULTNAME,
|
|
4022 |
R_QTN_MEMC_UNLOCK_PASSWORD_MULTIPLE );
|
|
4023 |
#else // RD_MULTIPLE_DRIVE
|
|
4024 |
text = StringLoader::LoadLC( R_QTN_UNLOCK_PASSWORD_TEXT );
|
|
4025 |
#endif // RD_MULTIPLE_DRIVE
|
|
4026 |
}
|
|
4027 |
|
|
4028 |
// Show until correct pwd is given or canceled
|
|
4029 |
TBool isDone( EFalse );
|
|
4030 |
while( !isDone )
|
|
4031 |
{
|
|
4032 |
// Empty first
|
|
4033 |
EmptyPwd( oldPwd );
|
|
4034 |
TBool pwdGiven( EFalse );
|
|
4035 |
if ( text )
|
|
4036 |
{
|
|
4037 |
pwdGiven = FileManagerDlgUtils::ShowSimplePasswordQueryL( *text, oldPwd );
|
|
4038 |
}
|
|
4039 |
else
|
|
4040 |
{
|
|
4041 |
pwdGiven = FileManagerDlgUtils::ShowSimplePasswordQueryL( res, oldPwd );
|
|
4042 |
}
|
|
4043 |
|
|
4044 |
if( pwdGiven )
|
|
4045 |
{
|
|
4046 |
ConvertCharsToPwd( oldPwd, pwd );
|
|
4047 |
if( aRemove )
|
|
4048 |
{
|
|
4049 |
err = iEngine.RemoveDrivePassword( aDrive, pwd );
|
|
4050 |
}
|
|
4051 |
else
|
|
4052 |
{
|
|
4053 |
err = iEngine.UnlockDrive( aDrive, pwd );
|
|
4054 |
}
|
|
4055 |
|
|
4056 |
if ( err == KErrNone )
|
|
4057 |
{
|
|
4058 |
isDone = ETrue;
|
|
4059 |
}
|
|
4060 |
else if ( err == KErrAccessDenied )
|
|
4061 |
{
|
|
4062 |
FileManagerDlgUtils::ShowErrorNoteL( resWrong );
|
|
4063 |
}
|
|
4064 |
else if ( err == KErrNotReady )
|
|
4065 |
{
|
|
4066 |
isDone = ETrue;
|
|
4067 |
FileManagerDlgUtils::ShowErrorNoteL( R_QTN_MEMC_NOT_AVAILABLE );
|
|
4068 |
}
|
|
4069 |
else
|
|
4070 |
{
|
|
4071 |
isDone = ETrue;
|
|
4072 |
FileManagerDlgUtils::ShowErrorNoteL( R_QTN_CRITICAL_ERROR );
|
|
4073 |
}
|
|
4074 |
}
|
|
4075 |
else
|
|
4076 |
{
|
|
4077 |
err = KErrCancel;
|
|
4078 |
isDone = ETrue;
|
|
4079 |
}
|
|
4080 |
}
|
|
4081 |
|
|
4082 |
if ( text )
|
|
4083 |
{
|
|
4084 |
CleanupStack::PopAndDestroy( text );
|
|
4085 |
}
|
|
4086 |
return err;
|
|
4087 |
}
|
|
4088 |
|
|
4089 |
// ------------------------------------------------------------------------------
|
|
4090 |
// CFileManagerViewBase::SetRemoteDriveConnectionStateL
|
|
4091 |
//
|
|
4092 |
// ------------------------------------------------------------------------------
|
|
4093 |
//
|
|
4094 |
void CFileManagerViewBase::SetRemoteDriveConnectionStateL( TBool aState )
|
|
4095 |
{
|
|
4096 |
TInt drv( 0 );
|
|
4097 |
|
|
4098 |
StoreIndex();
|
|
4099 |
if ( !iEngine.CurrentDirectory().Length() )
|
|
4100 |
{
|
|
4101 |
TInt index( iContainer->ListBoxCurrentItemIndex() );
|
|
4102 |
CFileManagerItemProperties* prop = iEngine.GetItemInfoL( index );
|
|
4103 |
CleanupStack::PushL( prop );
|
|
4104 |
drv = TDriveUnit( prop->FullPath() );
|
|
4105 |
CleanupStack::PopAndDestroy( prop );
|
|
4106 |
}
|
|
4107 |
else
|
|
4108 |
{
|
|
4109 |
TFileManagerDriveInfo& drvInfo( DriveInfo() );
|
|
4110 |
drv = drvInfo.iDrive;
|
|
4111 |
}
|
|
4112 |
iEngine.SetRemoteDriveConnection( drv, aState );
|
|
4113 |
}
|
|
4114 |
|
|
4115 |
// ------------------------------------------------------------------------------
|
|
4116 |
// CFileManagerViewBase::OpenRemoteDriveSettingsL
|
|
4117 |
//
|
|
4118 |
// ------------------------------------------------------------------------------
|
|
4119 |
//
|
|
4120 |
void CFileManagerViewBase::OpenRemoteDriveSettingsL(
|
|
4121 |
const TDesC& aDriveName )
|
|
4122 |
{
|
|
4123 |
CFileManagerAppUi* appUi = static_cast< CFileManagerAppUi* >( AppUi() );
|
|
4124 |
appUi->ActivateRemoteDriveSettingsViewL( aDriveName );
|
|
4125 |
}
|
|
4126 |
|
|
4127 |
// ------------------------------------------------------------------------------
|
|
4128 |
// CFileManagerViewBase::IsDisconnectedRemoteDrive
|
|
4129 |
//
|
|
4130 |
// ------------------------------------------------------------------------------
|
|
4131 |
//
|
|
4132 |
TBool CFileManagerViewBase::IsDisconnectedRemoteDrive(
|
|
4133 |
CFileManagerItemProperties& aProp )
|
|
4134 |
{
|
|
4135 |
TUint32 drvState( 0 );
|
|
4136 |
if ( iEngine.DriveState( drvState, aProp.FullPath() ) == KErrNone )
|
|
4137 |
{
|
|
4138 |
if ( ( drvState & TFileManagerDriveInfo::EDriveRemote ) &&
|
|
4139 |
!( drvState & TFileManagerDriveInfo::EDriveConnected ) )
|
|
4140 |
{
|
|
4141 |
return ETrue;
|
|
4142 |
}
|
|
4143 |
}
|
|
4144 |
return EFalse;
|
|
4145 |
}
|
|
4146 |
|
|
4147 |
// ------------------------------------------------------------------------------
|
|
4148 |
// CFileManagerViewBase::RemoteDriveCommonFilteringL
|
|
4149 |
//
|
|
4150 |
// ------------------------------------------------------------------------------
|
|
4151 |
//
|
|
4152 |
void CFileManagerViewBase::RemoteDriveCommonFilteringL( CEikMenuPane& aMenuPane )
|
|
4153 |
{
|
|
4154 |
TBool dimAll( EFalse );
|
|
4155 |
if ( !FeatureManager().IsRemoteStorageFwSupported() )
|
|
4156 |
{
|
|
4157 |
dimAll = ETrue;
|
|
4158 |
}
|
|
4159 |
else
|
|
4160 |
{
|
|
4161 |
// CEikListBox& listBox = iContainer->ListBox();
|
|
4162 |
if ( iContainer->ListBoxNumberOfItems() )
|
|
4163 |
{
|
|
4164 |
TInt index( iContainer->ListBoxCurrentItemIndex() );
|
|
4165 |
CFileManagerItemProperties* prop = iEngine.GetItemInfoL( index );
|
|
4166 |
|
|
4167 |
TUint32 drvState( 0 );
|
|
4168 |
TInt err( iEngine.DriveState( drvState, prop->FullPath() ) );
|
|
4169 |
if ( err == KErrNone &&
|
|
4170 |
( drvState & TFileManagerDriveInfo::EDriveRemote ) )
|
|
4171 |
{
|
|
4172 |
if ( drvState & TFileManagerDriveInfo::EDriveConnected )
|
|
4173 |
{
|
|
4174 |
aMenuPane.SetItemDimmed( EFileManagerConnectRemoveDrive, ETrue );
|
|
4175 |
}
|
|
4176 |
else
|
|
4177 |
{
|
|
4178 |
aMenuPane.SetItemDimmed( EFileManagerDisconnectRemoveDrive, ETrue );
|
|
4179 |
}
|
|
4180 |
}
|
|
4181 |
else
|
|
4182 |
{
|
|
4183 |
dimAll = ETrue;
|
|
4184 |
}
|
|
4185 |
delete prop;
|
|
4186 |
}
|
|
4187 |
else
|
|
4188 |
{
|
|
4189 |
// List is empty
|
|
4190 |
TFileManagerDriveInfo& drvInfo( DriveInfo() );
|
|
4191 |
|
|
4192 |
if ( drvInfo.iState & TFileManagerDriveInfo::EDriveRemote )
|
|
4193 |
{
|
|
4194 |
if ( drvInfo.iState & TFileManagerDriveInfo::EDriveConnected )
|
|
4195 |
{
|
|
4196 |
aMenuPane.SetItemDimmed( EFileManagerConnectRemoveDrive, ETrue );
|
|
4197 |
}
|
|
4198 |
else
|
|
4199 |
{
|
|
4200 |
aMenuPane.SetItemDimmed( EFileManagerDisconnectRemoveDrive, ETrue );
|
|
4201 |
}
|
|
4202 |
}
|
|
4203 |
else
|
|
4204 |
{
|
|
4205 |
dimAll = ETrue;
|
|
4206 |
}
|
|
4207 |
}
|
|
4208 |
}
|
|
4209 |
|
|
4210 |
if ( dimAll )
|
|
4211 |
{
|
|
4212 |
aMenuPane.SetItemDimmed( EFileManagerConnectRemoveDrive, ETrue );
|
|
4213 |
aMenuPane.SetItemDimmed( EFileManagerDisconnectRemoveDrive, ETrue );
|
|
4214 |
}
|
|
4215 |
}
|
|
4216 |
|
|
4217 |
// -----------------------------------------------------------------------------
|
|
4218 |
// CFileManagerViewBase::LaunchProgressBarL
|
|
4219 |
//
|
|
4220 |
// -----------------------------------------------------------------------------
|
|
4221 |
//
|
|
4222 |
void CFileManagerViewBase::LaunchProgressBarL(
|
|
4223 |
TInt aDialogId,
|
|
4224 |
TInt aTextId,
|
|
4225 |
TInt64 aFinalValue,
|
|
4226 |
TInt64 aInitialValue,
|
|
4227 |
TBool aPeriodic,
|
|
4228 |
TBool aImmediatelyVisible )
|
|
4229 |
{
|
|
4230 |
ClearProgressBarL(); // Clear previous
|
|
4231 |
|
|
4232 |
if ( aFinalValue )
|
|
4233 |
{
|
|
4234 |
iProgressDialog = new (ELeave) CAknProgressDialog(
|
|
4235 |
( reinterpret_cast< CEikDialog** >( &iProgressDialog ) ), aImmediatelyVisible );
|
|
4236 |
iProgressDialog->PrepareLC( aDialogId );
|
|
4237 |
|
|
4238 |
if ( aPeriodic )
|
|
4239 |
{
|
|
4240 |
iPeriodic = CPeriodic::NewL( CActive::EPriorityStandard );
|
|
4241 |
iPeriodic->Start(
|
|
4242 |
KProgressBarUpdateInterval, KProgressBarUpdateInterval,
|
|
4243 |
TCallBack( UpdateProgressBar, this ) );
|
|
4244 |
}
|
|
4245 |
}
|
|
4246 |
else
|
|
4247 |
{
|
|
4248 |
iProgressDialog = new (ELeave) CAknWaitDialog(
|
|
4249 |
( reinterpret_cast< CEikDialog** >( &iProgressDialog ) ), aImmediatelyVisible );
|
|
4250 |
iProgressDialog->PrepareLC( aDialogId );
|
|
4251 |
}
|
|
4252 |
|
|
4253 |
if ( aTextId )
|
|
4254 |
{
|
|
4255 |
HBufC* text = StringLoader::LoadLC( aTextId );
|
|
4256 |
iProgressDialog->SetTextL( *text );
|
|
4257 |
CleanupStack::PopAndDestroy( text );
|
|
4258 |
}
|
|
4259 |
|
|
4260 |
iProgressDialog->SetCallback(this);
|
|
4261 |
iProgressInfo = iProgressDialog->GetProgressInfoL();
|
|
4262 |
if ( iProgressInfo )
|
|
4263 |
{
|
|
4264 |
iProgressInfo->SetFinalValue( static_cast<TInt>( aFinalValue / KMinificationFactor ) );
|
|
4265 |
iProgressInfo->SetAndDraw( static_cast<TInt>( aInitialValue / KMinificationFactor ) );
|
|
4266 |
}
|
|
4267 |
iProgressDialog->RunLD();
|
|
4268 |
}
|
|
4269 |
|
|
4270 |
// ------------------------------------------------------------------------------
|
|
4271 |
// CFileManagerViewBase::RefreshProgressDelayedStart
|
|
4272 |
//
|
|
4273 |
// ------------------------------------------------------------------------------
|
|
4274 |
//
|
|
4275 |
TInt CFileManagerViewBase::RefreshProgressDelayedStart( TAny* aPtr )
|
|
4276 |
{
|
|
4277 |
CFileManagerViewBase* view = static_cast< CFileManagerViewBase* > ( aPtr );
|
|
4278 |
TRAP_IGNORE( view->RefreshProgressDelayedStartL() );
|
|
4279 |
return KErrNone;
|
|
4280 |
}
|
|
4281 |
|
|
4282 |
// ------------------------------------------------------------------------------
|
|
4283 |
// CFileManagerViewBase::RefreshProgressDelayedStartL
|
|
4284 |
//
|
|
4285 |
// ------------------------------------------------------------------------------
|
|
4286 |
//
|
|
4287 |
void CFileManagerViewBase::RefreshProgressDelayedStartL()
|
|
4288 |
{
|
|
4289 |
CFileManagerAppUi* app = static_cast< CFileManagerAppUi* >( AppUi() );
|
|
4290 |
|
|
4291 |
delete iRefreshProgressDelayedStart;
|
|
4292 |
iRefreshProgressDelayedStart = NULL;
|
|
4293 |
|
|
4294 |
if( iProgressDialogRefresh )
|
|
4295 |
{
|
|
4296 |
iProgressDialogRefresh->ProcessFinishedL();
|
|
4297 |
iProgressDialogRefresh = NULL;
|
|
4298 |
}
|
|
4299 |
iProgressDialogRefresh = new( ELeave ) CAknProgressDialog(
|
|
4300 |
reinterpret_cast< CEikDialog** >( &iProgressDialogRefresh ),
|
|
4301 |
EFalse );
|
|
4302 |
iProgressDialogRefresh->SetCallback( this );
|
|
4303 |
|
|
4304 |
if ( Id() == CFileManagerAppUi::KFileManagerSearchResultsViewId )
|
|
4305 |
{
|
|
4306 |
iProgressDialogRefresh->ExecuteLD( R_FILEMANAGER_FIND_WAIT_DIALOG );
|
|
4307 |
}
|
|
4308 |
else
|
|
4309 |
{
|
|
4310 |
iProgressDialogRefresh->ExecuteLD( R_FILEMANAGER_WAIT_NOTE_OPEN );
|
|
4311 |
}
|
|
4312 |
}
|
|
4313 |
|
|
4314 |
// ------------------------------------------------------------------------------
|
|
4315 |
// CFileManagerViewBase::IsRefreshInProgress
|
|
4316 |
//
|
|
4317 |
// ------------------------------------------------------------------------------
|
|
4318 |
//
|
|
4319 |
TBool CFileManagerViewBase::IsRefreshInProgress()
|
|
4320 |
{
|
|
4321 |
if ( iRefreshProgressDelayedStart || iProgressDialogRefresh )
|
|
4322 |
{
|
|
4323 |
return ETrue;
|
|
4324 |
}
|
|
4325 |
return EFalse;
|
|
4326 |
}
|
|
4327 |
|
|
4328 |
// ------------------------------------------------------------------------------
|
|
4329 |
// CFileManagerViewBase::ProcessCommandL
|
|
4330 |
//
|
|
4331 |
// ------------------------------------------------------------------------------
|
|
4332 |
//
|
|
4333 |
void CFileManagerViewBase::ProcessCommandL( TInt aCommand )
|
|
4334 |
{
|
|
4335 |
// Suppress commands during refresh
|
|
4336 |
if ( IsRefreshInProgress() )
|
|
4337 |
{
|
|
4338 |
switch ( aCommand )
|
|
4339 |
{
|
|
4340 |
case EAknSoftkeyOptions: // FALLTHROUGH
|
|
4341 |
case EAknSoftkeyBack: // FALLTHROUGH
|
|
4342 |
case EAknSoftkeyContextOptions: // FALLTHROUGH
|
|
4343 |
case EAknSoftkeyMark: // FALLTHROUGH
|
|
4344 |
case EAknSoftkeyUnmark: // FALLTHROUGH
|
|
4345 |
case EAknSoftkeySelect:
|
|
4346 |
{
|
|
4347 |
return;
|
|
4348 |
}
|
|
4349 |
default:
|
|
4350 |
{
|
|
4351 |
break;
|
|
4352 |
}
|
|
4353 |
}
|
|
4354 |
}
|
|
4355 |
|
|
4356 |
// Handle commands directly
|
|
4357 |
switch ( aCommand )
|
|
4358 |
{
|
|
4359 |
case EAknSoftkeyContextOptions: // FALLTHROUGH
|
|
4360 |
case EAknSoftkeyMark:
|
|
4361 |
{
|
|
4362 |
HandleCommandL( aCommand );
|
|
4363 |
break;
|
|
4364 |
}
|
|
4365 |
default:
|
|
4366 |
{
|
|
4367 |
CAknView::ProcessCommandL( aCommand );
|
|
4368 |
break;
|
|
4369 |
}
|
|
4370 |
}
|
|
4371 |
}
|
|
4372 |
|
|
4373 |
// ------------------------------------------------------------------------------
|
|
4374 |
// CFileManagerViewBase::AskPathL
|
|
4375 |
//
|
|
4376 |
// ------------------------------------------------------------------------------
|
|
4377 |
//
|
|
4378 |
TBool CFileManagerViewBase::AskPathL( TDes& aPath, TInt aTextId )
|
|
4379 |
{
|
|
4380 |
TBool ret( EFalse );
|
|
4381 |
TInt memType(
|
|
4382 |
AknCommonDialogsDynMem::EMemoryTypePhone |
|
|
4383 |
AknCommonDialogsDynMem::EMemoryTypeMMC );
|
|
4384 |
|
|
4385 |
if ( FeatureManager().IsRemoteStorageFwSupported() )
|
|
4386 |
{
|
|
4387 |
memType |= AknCommonDialogsDynMem::EMemoryTypeRemote;
|
|
4388 |
}
|
|
4389 |
|
|
4390 |
HBufC* title = StringLoader::LoadLC( aTextId );
|
|
4391 |
CFileManagerFileSelectionFilter* filter =
|
|
4392 |
new( ELeave ) CFileManagerFileSelectionFilter( iEngine );
|
|
4393 |
CleanupStack::PushL( filter );
|
|
4394 |
|
|
4395 |
ret = AknCommonDialogsDynMem::RunFolderSelectDlgLD(
|
|
4396 |
memType,
|
|
4397 |
aPath,
|
|
4398 |
KNullDesC,
|
|
4399 |
R_FILEMANAGER_FIND_MEMORY_SELECTIONDIALOG,
|
|
4400 |
R_FILEMANAGER_FIND_FOLDER_SELECTIONDIALOG,
|
|
4401 |
*title,
|
|
4402 |
filter );
|
|
4403 |
|
|
4404 |
CleanupStack::PopAndDestroy( filter );
|
|
4405 |
CleanupStack::PopAndDestroy( title );
|
|
4406 |
return ret;
|
|
4407 |
}
|
|
4408 |
|
|
4409 |
#ifdef RD_FILE_MANAGER_BACKUP
|
|
4410 |
// ------------------------------------------------------------------------------
|
|
4411 |
// CFileManagerViewBase::StartSchBackupL
|
|
4412 |
//
|
|
4413 |
// ------------------------------------------------------------------------------
|
|
4414 |
//
|
|
4415 |
void CFileManagerViewBase::StartSchBackupL()
|
|
4416 |
{
|
|
4417 |
FUNC_LOG
|
|
4418 |
|
|
4419 |
CFileManagerAppUi* appUi = static_cast< CFileManagerAppUi* >( AppUi() );
|
|
4420 |
CFileManagerSchBackupHandler& handler( appUi->SchBackupHandlerL() );
|
|
4421 |
|
|
4422 |
if ( FeatureManager().IsFeatureSupported(
|
|
4423 |
EFileManagerFeatureScheduledBackupDisabled ) )
|
|
4424 |
{
|
|
4425 |
// Scheduled backup is disabled, disable scheduler and cancel backup
|
|
4426 |
INFO_LOG( "CFileManagerViewBase::StartSchBackupL-Backup disabled" )
|
|
4427 |
|
|
4428 |
handler.CancelBackupStarter();
|
|
4429 |
CFileManagerTaskScheduler& scheduler( appUi->TaskSchedulerL() );
|
|
4430 |
scheduler.EnableBackupScheduleL( EFalse );
|
|
4431 |
appUi->SchBackupFinishedL( KErrCancel );
|
|
4432 |
return;
|
|
4433 |
}
|
|
4434 |
|
|
4435 |
// Start scheduled backup if no process in progress
|
|
4436 |
// Otherwise wait process to finish
|
|
4437 |
if ( iActiveProcess == ENoProcess )
|
|
4438 |
{
|
|
4439 |
CFileManagerBackupSettings& settings( iEngine.BackupSettingsL() );
|
|
4440 |
TTime schTime( SetCurrentYearMonthAndDay( settings.Time() ) );
|
|
4441 |
|
|
4442 |
TTime manualBackupOrRestoreStarted = appUi->BackupOrRestoreStartTime();
|
|
4443 |
TTime manualBackupOrRestoreEnded = appUi->BackupOrRestoreEndTime();
|
|
4444 |
|
|
4445 |
if ( manualBackupOrRestoreStarted.Int64() > 0 &&
|
|
4446 |
schTime >= manualBackupOrRestoreStarted &&
|
|
4447 |
schTime <= manualBackupOrRestoreEnded )
|
|
4448 |
{
|
|
4449 |
INFO_LOG( "CFileManagerViewBase::StartSchBackupL-Backup canceled due to manual op" )
|
|
4450 |
|
|
4451 |
handler.CancelBackupStarter();
|
|
4452 |
|
|
4453 |
appUi->ResetBackupOrRestoreEndTime();// Cancel required only once
|
|
4454 |
}
|
|
4455 |
else
|
|
4456 |
{
|
|
4457 |
INFO_LOG( "CFileManagerViewBase::StartSchBackupL-Start backup" )
|
|
4458 |
|
|
4459 |
iSchBackupPending = EFalse;
|
|
4460 |
iActiveProcess = ESchBackupProcess;
|
|
4461 |
iEngine.SetObserver( this );
|
|
4462 |
handler.StartBackupWithConfirm();
|
|
4463 |
}
|
|
4464 |
}
|
|
4465 |
// Ignore scheduled backup if backup or restore is in progress
|
|
4466 |
else if ( iActiveProcess == ESchBackupProcess ||
|
|
4467 |
iActiveProcess == EBackupProcess ||
|
|
4468 |
iActiveProcess == ERestoreProcess )
|
|
4469 |
{
|
|
4470 |
INFO_LOG( "CFileManagerViewBase::StartSchBackupL-Backup canceled" )
|
|
4471 |
|
|
4472 |
handler.CancelBackupStarter();
|
|
4473 |
}
|
|
4474 |
else
|
|
4475 |
{
|
|
4476 |
INFO_LOG( "CFileManagerViewBase::StartSchBackupL-Backup pending" )
|
|
4477 |
|
|
4478 |
iSchBackupPending = ETrue;
|
|
4479 |
}
|
|
4480 |
}
|
|
4481 |
|
|
4482 |
// ------------------------------------------------------------------------------
|
|
4483 |
// CFileManagerViewBase::SchBackupFinishedL
|
|
4484 |
//
|
|
4485 |
// ------------------------------------------------------------------------------
|
|
4486 |
//
|
|
4487 |
void CFileManagerViewBase::SchBackupFinishedL()
|
|
4488 |
{
|
|
4489 |
FUNC_LOG
|
|
4490 |
|
|
4491 |
if ( iActiveProcess == ESchBackupProcess )
|
|
4492 |
{
|
|
4493 |
iActiveProcess = ENoProcess;
|
|
4494 |
iSchBackupPending = EFalse;
|
|
4495 |
}
|
|
4496 |
}
|
|
4497 |
|
|
4498 |
#endif // RD_FILE_MANAGER_BACKUP
|
|
4499 |
|
|
4500 |
// ------------------------------------------------------------------------------
|
|
4501 |
// CFileManagerViewBase::SetCbaMskTextL
|
|
4502 |
//
|
|
4503 |
// ------------------------------------------------------------------------------
|
|
4504 |
//
|
|
4505 |
void CFileManagerViewBase::SetCbaMskTextL( const TInt aTextId )
|
|
4506 |
{
|
|
4507 |
HBufC* text = StringLoader::LoadLC( aTextId );
|
|
4508 |
CEikButtonGroupContainer* cba = Cba();
|
|
4509 |
if ( cba->ButtonCount() == KFmgrMSK )
|
|
4510 |
{
|
|
4511 |
TInt cmdId( cba->ButtonGroup()->CommandId( KFmgrMSK ) );
|
|
4512 |
cba->SetCommandL( KFmgrMSK, cmdId, *text );
|
|
4513 |
cba->DrawDeferred();
|
|
4514 |
}
|
|
4515 |
CleanupStack::PopAndDestroy( text );
|
|
4516 |
}
|
|
4517 |
|
|
4518 |
// ------------------------------------------------------------------------------
|
|
4519 |
// CFileManagerViewBase::UpdateCbaL
|
|
4520 |
//
|
|
4521 |
// ------------------------------------------------------------------------------
|
|
4522 |
//
|
|
4523 |
void CFileManagerViewBase::UpdateCbaL()
|
|
4524 |
{
|
|
4525 |
}
|
|
4526 |
|
|
4527 |
// ------------------------------------------------------------------------------
|
|
4528 |
// CFileManagerViewBase::UpdateCommonCbaL
|
|
4529 |
//
|
|
4530 |
// ------------------------------------------------------------------------------
|
|
4531 |
//
|
|
4532 |
void CFileManagerViewBase::UpdateCommonCbaL()
|
|
4533 |
{
|
|
4534 |
if ( !iContainer || IsRefreshInProgress() )
|
|
4535 |
{
|
|
4536 |
return;
|
|
4537 |
}
|
|
4538 |
|
|
4539 |
CEikButtonGroupContainer* cba = Cba();
|
|
4540 |
|
|
4541 |
if ( !iContainer->ListBoxNumberOfItems() )
|
|
4542 |
{
|
|
4543 |
cba->SetCommandSetL(
|
|
4544 |
R_FILEMANAGER_SOFTKEYS_OPTIONS_BACK__EMPTY );
|
|
4545 |
}
|
|
4546 |
else if ( iContainer->ListBoxSelectionIndexesCount() )
|
|
4547 |
{
|
|
4548 |
cba->SetCommandSetL(
|
|
4549 |
R_FILEMANAGER_SOFTKEYS_CONTEXT_OPTIONS_BACK__OPTIONS );
|
|
4550 |
}
|
|
4551 |
else
|
|
4552 |
{
|
|
4553 |
cba->SetCommandSetL(
|
|
4554 |
R_FILEMANAGER_SOFTKEYS_OPTIONS_BACK__OPEN );
|
|
4555 |
}
|
|
4556 |
|
|
4557 |
// Restore right cancel softkey if it has been set by search field
|
|
4558 |
TBool restoreCancel( ETrue );
|
|
4559 |
if ( iContainer->IsSearchFieldVisible() &&
|
|
4560 |
cba->ButtonCount() >= CEikButtonGroupContainer::ERightSoftkeyPosition )
|
|
4561 |
{
|
|
4562 |
restoreCancel = ( cba->ButtonGroup()->CommandId(
|
|
4563 |
CEikButtonGroupContainer::ERightSoftkeyPosition ) == EAknSoftkeyCancel );
|
|
4564 |
}
|
|
4565 |
if ( !restoreCancel )
|
|
4566 |
{
|
|
4567 |
HBufC* cancelText = StringLoader::LoadLC( R_AVKON_SOFTKEY_CANCEL );
|
|
4568 |
cba->SetCommandL(
|
|
4569 |
CEikButtonGroupContainer::ERightSoftkeyPosition,
|
|
4570 |
EAknSoftkeyCancel,
|
|
4571 |
*cancelText );
|
|
4572 |
CleanupStack::PopAndDestroy( cancelText );
|
|
4573 |
}
|
|
4574 |
|
|
4575 |
cba->DrawDeferred();
|
|
4576 |
}
|
|
4577 |
|
|
4578 |
// ------------------------------------------------------------------------------
|
|
4579 |
// CFileManagerViewBase::RenameDriveL
|
|
4580 |
//
|
|
4581 |
// ------------------------------------------------------------------------------
|
|
4582 |
//
|
|
4583 |
void CFileManagerViewBase::RenameDriveL( TBool aForceDefaultName )
|
|
4584 |
{
|
|
4585 |
TFileManagerDriveInfo drvInfo;
|
|
4586 |
if ( DriveInfoAtCurrentPosL( drvInfo ) < 0 )
|
|
4587 |
{
|
|
4588 |
return; // No drive selected
|
|
4589 |
}
|
|
4590 |
|
|
4591 |
if ( drvInfo.iState & TFileManagerDriveInfo::EDriveMassStorage )
|
|
4592 |
{
|
|
4593 |
return; // Name not allowed
|
|
4594 |
}
|
|
4595 |
|
|
4596 |
HBufC* drvName = HBufC::NewLC( KMaxVolumeName );
|
|
4597 |
TPtr name( drvName->Des() );
|
|
4598 |
// 16-bit chars are required for non western volume names
|
|
4599 |
const TInt KMaxNonWesternVolumeName( KMaxVolumeName / 2 );
|
|
4600 |
|
|
4601 |
// Setup query according to variant type, western or non western
|
|
4602 |
TInt resId( R_FILEMANAGER_DRIVE_NAME_QUERY );
|
|
4603 |
TInt maxLen( KMaxVolumeName );
|
|
4604 |
if ( !FeatureManager().IsWesternVariant() )
|
|
4605 |
{
|
|
4606 |
resId = R_FILEMANAGER_DRIVE_NAME_QUERY_NON_WESTERN;
|
|
4607 |
maxLen = KMaxNonWesternVolumeName;
|
|
4608 |
}
|
|
4609 |
|
|
4610 |
if ( aForceDefaultName || !drvInfo.iName.Length() )
|
|
4611 |
{
|
|
4612 |
HBufC* defaultName = NULL;
|
|
4613 |
if ( drvInfo.iState & TFileManagerDriveInfo::EDriveUsbMemory )
|
|
4614 |
{
|
|
4615 |
defaultName = StringLoader::LoadLC(
|
|
4616 |
R_QTN_FMGR_USB_MEMORY_DEFAULT_NAME );
|
|
4617 |
}
|
|
4618 |
else
|
|
4619 |
{
|
|
4620 |
defaultName = StringLoader::LoadLC( R_QTN_MMC_DEFAULT_NAME );
|
|
4621 |
}
|
|
4622 |
if ( defaultName->Length() > maxLen )
|
|
4623 |
{
|
|
4624 |
name.Copy( defaultName->Des().Left( maxLen ) );
|
|
4625 |
}
|
|
4626 |
else
|
|
4627 |
{
|
|
4628 |
name.Copy( *defaultName );
|
|
4629 |
}
|
|
4630 |
CleanupStack::PopAndDestroy( defaultName );
|
|
4631 |
}
|
|
4632 |
else
|
|
4633 |
{
|
|
4634 |
if ( drvInfo.iName.Length() > maxLen )
|
|
4635 |
{
|
|
4636 |
name.Copy( drvInfo.iName.Left( maxLen ) );
|
|
4637 |
}
|
|
4638 |
else
|
|
4639 |
{
|
|
4640 |
name.Copy( drvInfo.iName );
|
|
4641 |
}
|
|
4642 |
}
|
|
4643 |
|
|
4644 |
// Loop until canceled, accepted or an error occurs
|
|
4645 |
TBool isDone( EFalse );
|
|
4646 |
while( !isDone )
|
|
4647 |
{
|
|
4648 |
CAknTextQueryDialog* renameDlg =
|
|
4649 |
CAknTextQueryDialog::NewL( name, CAknQueryDialog::ENoTone );
|
|
4650 |
renameDlg->SetMaxLength( maxLen );
|
|
4651 |
TBool ret( EFalse );
|
|
4652 |
if ( renameDlg->ExecuteLD( resId ) )
|
|
4653 |
{
|
|
4654 |
ret = ETrue;
|
|
4655 |
}
|
|
4656 |
if( ret && name.Compare( drvInfo.iName ) )
|
|
4657 |
{
|
|
4658 |
TInt err( iEngine.RenameDrive( drvInfo.iDrive, name ) );
|
|
4659 |
if( err == KErrNone )
|
|
4660 |
{
|
|
4661 |
FileManagerDlgUtils::ShowConfirmNoteL(
|
|
4662 |
R_QTN_FMGR_CONFIRM_MEMORY_NAME_CHANGED );
|
|
4663 |
RefreshDriveInfoL();
|
|
4664 |
isDone = ETrue;
|
|
4665 |
}
|
|
4666 |
else if( err == KErrBadName )
|
|
4667 |
{
|
|
4668 |
FileManagerDlgUtils::ShowInfoNoteL(
|
|
4669 |
R_QTN_INVALID_DRIVE_NAME );
|
|
4670 |
}
|
|
4671 |
else
|
|
4672 |
{
|
|
4673 |
FileManagerDlgUtils::ShowErrorNoteL(
|
|
4674 |
R_QTN_CRITICAL_ERROR );
|
|
4675 |
isDone = ETrue;
|
|
4676 |
}
|
|
4677 |
}
|
|
4678 |
else
|
|
4679 |
{
|
|
4680 |
// Canceled
|
|
4681 |
isDone = ETrue;
|
|
4682 |
}
|
|
4683 |
}
|
|
4684 |
CleanupStack::PopAndDestroy( drvName );
|
|
4685 |
}
|
|
4686 |
|
|
4687 |
// ------------------------------------------------------------------------------
|
|
4688 |
// CFileManagerViewBase::CmdRefreshDirectoryL
|
|
4689 |
//
|
|
4690 |
// ------------------------------------------------------------------------------
|
|
4691 |
//
|
|
4692 |
void CFileManagerViewBase::CmdRefreshDirectoryL()
|
|
4693 |
{
|
|
4694 |
StoreIndex();
|
|
4695 |
iEngine.SetObserver( this );
|
|
4696 |
iEngine.ForcedRefreshDirectory();
|
|
4697 |
}
|
|
4698 |
|
|
4699 |
// ------------------------------------------------------------------------------
|
|
4700 |
// CFileManagerViewBase::ShowEjectQueryL
|
|
4701 |
//
|
|
4702 |
// ------------------------------------------------------------------------------
|
|
4703 |
//
|
|
4704 |
void CFileManagerViewBase::ShowEjectQueryL()
|
|
4705 |
{
|
|
4706 |
delete iEjectQueryDialog;
|
|
4707 |
iEjectQueryDialog = NULL;
|
|
4708 |
|
|
4709 |
iEjectDone = EFalse;
|
|
4710 |
iEjectQueryDialog = CAknQueryDialog::NewL();
|
|
4711 |
HBufC* text = NULL;
|
|
4712 |
TInt index( iContainer->ListBoxCurrentItemIndex() );
|
|
4713 |
CFileManagerItemProperties* prop = iEngine.GetItemInfoLC( index );
|
|
4714 |
#ifdef RD_MULTIPLE_DRIVE
|
|
4715 |
text = iEngine.GetFormattedDriveNameLC(
|
|
4716 |
prop->DriveId(),
|
|
4717 |
R_QTN_MEMC_INFO_EJECT_MULTIPLE_DEFAULTNAME,
|
|
4718 |
R_QTN_MEMC_INFO_EJECT_MULTIPLE );
|
|
4719 |
#else // RD_MULTIPLE_DRIVE
|
|
4720 |
text = StringLoader::LoadLC( R_QTN_INFO_EJECT );
|
|
4721 |
#endif // RD_MULTIPLE_DRIVE
|
|
4722 |
TRAP_IGNORE( iEjectQueryDialog->ExecuteLD(
|
|
4723 |
R_FILEMANAGER_EJECT_CONFIRM_QUERY, *text ) );
|
|
4724 |
CleanupStack::PopAndDestroy( text );
|
|
4725 |
CleanupStack::PopAndDestroy( prop );
|
|
4726 |
iEjectQueryDialog = NULL;
|
|
4727 |
}
|
|
4728 |
|
|
4729 |
// ------------------------------------------------------------------------------
|
|
4730 |
// CFileManagerViewBase::IsDriveAvailable
|
|
4731 |
//
|
|
4732 |
// ------------------------------------------------------------------------------
|
|
4733 |
//
|
|
4734 |
TBool CFileManagerViewBase::IsDriveAvailable( const TDesC& aPath ) const
|
|
4735 |
{
|
|
4736 |
TBool ret( EFalse );
|
|
4737 |
if ( aPath.Length() )
|
|
4738 |
{
|
|
4739 |
TInt drive = TDriveUnit( aPath );
|
|
4740 |
ret = IsDriveAvailable( drive );
|
|
4741 |
}
|
|
4742 |
return ret;
|
|
4743 |
}
|
|
4744 |
|
|
4745 |
// ------------------------------------------------------------------------------
|
|
4746 |
// CFileManagerViewBase::IsDriveAvailable
|
|
4747 |
//
|
|
4748 |
// ------------------------------------------------------------------------------
|
|
4749 |
//
|
|
4750 |
TBool CFileManagerViewBase::IsDriveAvailable( const TInt aDrive ) const
|
|
4751 |
{
|
|
4752 |
TUint32 drvState( 0 );
|
|
4753 |
if ( iEngine.DriveState( drvState, aDrive ) != KErrNone )
|
|
4754 |
{
|
|
4755 |
return EFalse;
|
|
4756 |
}
|
|
4757 |
if ( drvState & ( TFileManagerDriveInfo::EDriveLocked |
|
|
4758 |
TFileManagerDriveInfo::EDriveCorrupted |
|
|
4759 |
TFileManagerDriveInfo::EDriveInUse ) )
|
|
4760 |
{
|
|
4761 |
return EFalse; // Drive is unavailable
|
|
4762 |
}
|
|
4763 |
if ( !( drvState & TFileManagerDriveInfo::EDriveRemote ) &&
|
|
4764 |
!( drvState & TFileManagerDriveInfo::EDrivePresent ) )
|
|
4765 |
{
|
|
4766 |
return EFalse; // Drive is not present
|
|
4767 |
}
|
|
4768 |
return ETrue;
|
|
4769 |
}
|
|
4770 |
|
|
4771 |
// ----------------------------------------------------------------------------
|
|
4772 |
// CFileManagerViewBase::CheckPhoneState
|
|
4773 |
//
|
|
4774 |
// ----------------------------------------------------------------------------
|
|
4775 |
//
|
|
4776 |
TBool CFileManagerViewBase::CheckPhoneState() const
|
|
4777 |
{
|
|
4778 |
// Check here all operations, which are supposed
|
|
4779 |
// to prevent manual backup or restore.
|
|
4780 |
TBool err( ETrue );
|
|
4781 |
TInt syncErr( 0 );
|
|
4782 |
TInt syncStat( 0 );
|
|
4783 |
TInt burErr( 0 );
|
|
4784 |
TInt burStat( 0 );
|
|
4785 |
|
|
4786 |
// Check synchronization state
|
|
4787 |
syncErr = RProperty::Get(
|
|
4788 |
KPSUidDataSynchronizationInternalKeys,
|
|
4789 |
KDataSyncStatus, syncStat );
|
|
4790 |
|
|
4791 |
// Check backup/restore (e.g. PC Suite initiated) state
|
|
4792 |
burErr = RProperty::Get(
|
|
4793 |
KUidSystemCategory,
|
|
4794 |
KUidBackupRestoreKey, burStat );
|
|
4795 |
const TBURPartType partType = static_cast< TBURPartType >
|
|
4796 |
( burStat & KBURPartTypeMask );
|
|
4797 |
|
|
4798 |
if ( (syncErr == KErrNone && syncStat > 0)
|
|
4799 |
|| (burErr == KErrNone && partType != EBURUnset && partType != EBURNormal ) )
|
|
4800 |
{
|
|
4801 |
err = EFalse;
|
|
4802 |
}
|
|
4803 |
|
|
4804 |
return err;
|
|
4805 |
}
|
|
4806 |
|
|
4807 |
// ----------------------------------------------------------------------------
|
|
4808 |
// CFileManagerViewBase::StopProgressDialogAndStoreValues
|
|
4809 |
//
|
|
4810 |
// ----------------------------------------------------------------------------
|
|
4811 |
//
|
|
4812 |
TBool CFileManagerViewBase::StopProgressDialogAndStoreValues()
|
|
4813 |
{
|
|
4814 |
TBool ret( EFalse );
|
|
4815 |
if ( iProgressDialog && iProgressInfo )
|
|
4816 |
{
|
|
4817 |
CEikProgressInfo::SInfo info( iProgressInfo->Info() );
|
|
4818 |
iProgressFinalValue = ( info.iFinalValue ) * KMinificationFactor;
|
|
4819 |
iProgressCurrentValue = ( iProgressInfo->CurrentValue() ) * KMinificationFactor;
|
|
4820 |
if ( !iProgressCurrentValue && iTotalTransferredBytes <= iProgressFinalValue )
|
|
4821 |
{
|
|
4822 |
iProgressCurrentValue = iTotalTransferredBytes;
|
|
4823 |
}
|
|
4824 |
TRAP_IGNORE( iProgressDialog->ProcessFinishedL() );
|
|
4825 |
iProgressDialog = NULL;
|
|
4826 |
iProgressInfo = NULL;
|
|
4827 |
ret = ETrue;
|
|
4828 |
}
|
|
4829 |
|
|
4830 |
delete iRefreshProgressDelayedStart;
|
|
4831 |
iRefreshProgressDelayedStart = NULL;
|
|
4832 |
delete iPeriodic;
|
|
4833 |
iPeriodic = NULL;
|
|
4834 |
|
|
4835 |
return ret;
|
|
4836 |
}
|
|
4837 |
|
|
4838 |
|
|
4839 |
// ----------------------------------------------------------------------------
|
|
4840 |
// CFileManagerViewBase::CheckPostponedDirectoryRefresh
|
|
4841 |
//
|
|
4842 |
// ----------------------------------------------------------------------------
|
|
4843 |
//
|
|
4844 |
void CFileManagerViewBase::CheckPostponedDirectoryRefresh()
|
|
4845 |
{
|
|
4846 |
if ( iDirectoryRefreshPostponed )
|
|
4847 |
{
|
|
4848 |
// Delete was canceled but directory was changed during query
|
|
4849 |
StoreIndex();
|
|
4850 |
iEngine.SetObserver( this );
|
|
4851 |
iEngine.RefreshDirectory();
|
|
4852 |
}
|
|
4853 |
iDirectoryRefreshPostponed = EFalse;
|
|
4854 |
}
|
|
4855 |
|
|
4856 |
// ----------------------------------------------------------------------------
|
|
4857 |
// CFileManagerViewBase::DenyDirectoryRefresh
|
|
4858 |
//
|
|
4859 |
// ----------------------------------------------------------------------------
|
|
4860 |
//
|
|
4861 |
void CFileManagerViewBase::DenyDirectoryRefresh( TBool aDeny )
|
|
4862 |
{
|
|
4863 |
iDirectoryRefreshDenied = aDeny;
|
|
4864 |
if ( aDeny )
|
|
4865 |
{
|
|
4866 |
iDirectoryRefreshPostponed = EFalse; // Reset previous value
|
|
4867 |
}
|
|
4868 |
}
|
|
4869 |
|
|
4870 |
// ----------------------------------------------------------------------------
|
|
4871 |
// CFileManagerViewBase::SortMenuFilteringL
|
|
4872 |
//
|
|
4873 |
// ----------------------------------------------------------------------------
|
|
4874 |
//
|
|
4875 |
void CFileManagerViewBase::SortMenuFilteringL( CEikMenuPane& aMenuPane )
|
|
4876 |
{
|
|
4877 |
TInt selected( EFileManagerSortByName );
|
|
4878 |
switch ( iEngine.SortMethod() )
|
|
4879 |
{
|
|
4880 |
case CFileManagerEngine::EByMatch:
|
|
4881 |
{
|
|
4882 |
if ( iEngine.State() == CFileManagerEngine::ESearch )
|
|
4883 |
{
|
|
4884 |
selected = EFileManagerSortByMatch;
|
|
4885 |
}
|
|
4886 |
break;
|
|
4887 |
}
|
|
4888 |
case CFileManagerEngine::EByName:
|
|
4889 |
{
|
|
4890 |
selected = EFileManagerSortByName;
|
|
4891 |
break;
|
|
4892 |
}
|
|
4893 |
case CFileManagerEngine::EByType:
|
|
4894 |
{
|
|
4895 |
selected = EFileManagerSortByType;
|
|
4896 |
break;
|
|
4897 |
}
|
|
4898 |
case CFileManagerEngine::EMostRecentFirst:
|
|
4899 |
{
|
|
4900 |
selected = EFileManagerSortMostRecentFirst;
|
|
4901 |
break;
|
|
4902 |
}
|
|
4903 |
case CFileManagerEngine::ELargestFirst:
|
|
4904 |
{
|
|
4905 |
selected = EFileManagerSortLargestFirst;
|
|
4906 |
break;
|
|
4907 |
}
|
|
4908 |
default:
|
|
4909 |
{
|
|
4910 |
break;
|
|
4911 |
}
|
|
4912 |
}
|
|
4913 |
TInt position = 0;
|
|
4914 |
if ( aMenuPane.MenuItemExists( selected, position ) )
|
|
4915 |
{
|
|
4916 |
aMenuPane.SetItemButtonState( selected, EEikMenuItemSymbolOn );
|
|
4917 |
}
|
|
4918 |
}
|
|
4919 |
|
|
4920 |
// ----------------------------------------------------------------------------
|
|
4921 |
// CFileManagerViewBase::CmdSortL
|
|
4922 |
//
|
|
4923 |
// ----------------------------------------------------------------------------
|
|
4924 |
//
|
|
4925 |
void CFileManagerViewBase::CmdSortL( TInt aCommand )
|
|
4926 |
{
|
|
4927 |
CFileManagerEngine::TSortMethod sortMethod( CFileManagerEngine::EByName );
|
|
4928 |
switch ( aCommand )
|
|
4929 |
{
|
|
4930 |
case EFileManagerSortByName:
|
|
4931 |
{
|
|
4932 |
sortMethod = CFileManagerEngine::EByName;
|
|
4933 |
break;
|
|
4934 |
}
|
|
4935 |
case EFileManagerSortByType:
|
|
4936 |
{
|
|
4937 |
sortMethod = CFileManagerEngine::EByType;
|
|
4938 |
break;
|
|
4939 |
}
|
|
4940 |
case EFileManagerSortMostRecentFirst:
|
|
4941 |
{
|
|
4942 |
sortMethod = CFileManagerEngine::EMostRecentFirst;
|
|
4943 |
break;
|
|
4944 |
}
|
|
4945 |
case EFileManagerSortLargestFirst:
|
|
4946 |
{
|
|
4947 |
sortMethod = CFileManagerEngine::ELargestFirst;
|
|
4948 |
break;
|
|
4949 |
}
|
|
4950 |
case EFileManagerSortByMatch:
|
|
4951 |
{
|
|
4952 |
sortMethod = CFileManagerEngine::EByMatch;
|
|
4953 |
break;
|
|
4954 |
}
|
|
4955 |
default:
|
|
4956 |
{
|
|
4957 |
return;
|
|
4958 |
}
|
|
4959 |
}
|
|
4960 |
if ( iEngine.SortMethod() != sortMethod )
|
|
4961 |
{
|
|
4962 |
iIndex = 0;
|
|
4963 |
if ( iContainer )
|
|
4964 |
{
|
|
4965 |
iContainer->SetCurrentItemIndexAfterSearch( 0 );
|
|
4966 |
}
|
|
4967 |
iEngine.SetCurrentIndex( 0 );
|
|
4968 |
iEngine.SetSortMethod( sortMethod );
|
|
4969 |
iEngine.RefreshSort();
|
|
4970 |
}
|
|
4971 |
}
|
|
4972 |
|
|
4973 |
// -----------------------------------------------------------------------------
|
|
4974 |
// CFileManagerViewBase::FeatureManager
|
|
4975 |
//
|
|
4976 |
// -----------------------------------------------------------------------------
|
|
4977 |
//
|
|
4978 |
CFileManagerFeatureManager& CFileManagerViewBase::FeatureManager() const
|
|
4979 |
{
|
|
4980 |
return iEngine.FeatureManager();
|
|
4981 |
}
|
|
4982 |
|
|
4983 |
// -----------------------------------------------------------------------------
|
|
4984 |
// CFileManagerViewBase::NotifyForegroundStatusChange
|
|
4985 |
//
|
|
4986 |
// -----------------------------------------------------------------------------
|
|
4987 |
//
|
|
4988 |
void CFileManagerViewBase::NotifyForegroundStatusChange( TBool /*aForeground*/ )
|
|
4989 |
{
|
|
4990 |
}
|
|
4991 |
|
|
4992 |
// -----------------------------------------------------------------------------
|
|
4993 |
// CFileManagerViewBase::ShowDiskSpaceErrorL
|
|
4994 |
//
|
|
4995 |
// -----------------------------------------------------------------------------
|
|
4996 |
//
|
|
4997 |
#ifdef RD_MULTIPLE_DRIVE
|
|
4998 |
|
|
4999 |
void CFileManagerViewBase::ShowDiskSpaceErrorL( const TDesC& aFolder )
|
|
5000 |
{
|
|
5001 |
TInt defaultNameResId( 0 );
|
|
5002 |
TInt namedResId( 0 );
|
|
5003 |
TInt drv( KErrNotFound );
|
|
5004 |
if ( aFolder.Length() )
|
|
5005 |
{
|
|
5006 |
TFileManagerDriveInfo drvInfo;
|
|
5007 |
drv = TDriveUnit( aFolder );
|
|
5008 |
iEngine.GetDriveInfoL( drv, drvInfo );
|
|
5009 |
if ( drvInfo.iState & TFileManagerDriveInfo::EDriveMassStorage )
|
|
5010 |
{
|
|
5011 |
defaultNameResId = R_QTN_MEMLO_NOT_ENOUGH_MASS_MEMORY;
|
|
5012 |
}
|
|
5013 |
else if ( drvInfo.iState & TFileManagerDriveInfo::EDriveUsbMemory )
|
|
5014 |
{
|
|
5015 |
defaultNameResId = R_QTN_MEMLO_NOT_ENOUGH_MEMORY_CARD_NAME;
|
|
5016 |
namedResId = R_QTN_MEMLO_NOT_ENOUGH_MEMORY_CARD_NAME;
|
|
5017 |
}
|
|
5018 |
else if ( drvInfo.iState & TFileManagerDriveInfo::EDriveRemovable )
|
|
5019 |
{
|
|
5020 |
defaultNameResId = R_QTN_MEMLO_NOT_ENOUGH_MEMORY_CARD_DEFAULTNAME;
|
|
5021 |
namedResId = R_QTN_MEMLO_NOT_ENOUGH_MEMORY_CARD_NAME;
|
|
5022 |
}
|
|
5023 |
else if ( !( drvInfo.iState & TFileManagerDriveInfo::EDriveRemote ) )
|
|
5024 |
{
|
|
5025 |
defaultNameResId = R_QTN_MEMLO_NOT_ENOUGH_DEVICE_MEMORY;
|
|
5026 |
}
|
|
5027 |
}
|
|
5028 |
if ( defaultNameResId )
|
|
5029 |
{
|
|
5030 |
HBufC* text = iEngine.GetFormattedDriveNameLC(
|
|
5031 |
drv, defaultNameResId, namedResId );
|
|
5032 |
FileManagerDlgUtils::ShowConfirmQueryWithOkL(
|
|
5033 |
FileManagerDlgUtils::EErrorIcons, *text );
|
|
5034 |
CleanupStack::PopAndDestroy( text );
|
|
5035 |
}
|
|
5036 |
else
|
|
5037 |
{
|
|
5038 |
Error( KErrDiskFull ); // Show general error
|
|
5039 |
}
|
|
5040 |
}
|
|
5041 |
|
|
5042 |
#else // RD_MULTIPLE_DRIVE
|
|
5043 |
|
|
5044 |
void CFileManagerViewBase::ShowDiskSpaceErrorL( const TDesC& /*aFolder*/ )
|
|
5045 |
{
|
|
5046 |
Error( KErrDiskFull ); // Show general error
|
|
5047 |
}
|
|
5048 |
|
|
5049 |
#endif // RD_MULTIPLE_DRIVE
|
|
5050 |
|
|
5051 |
// -----------------------------------------------------------------------------
|
|
5052 |
// CFileManagerViewBase::DoLaunchProgressDialogAsync
|
|
5053 |
//
|
|
5054 |
// -----------------------------------------------------------------------------
|
|
5055 |
//
|
|
5056 |
void CFileManagerViewBase::DoLaunchProgressDialogAsync()
|
|
5057 |
{
|
|
5058 |
// Store the bytes value to be restored after new launch
|
|
5059 |
TInt64 prevBytes = iTotalTransferredBytes;
|
|
5060 |
|
|
5061 |
// Ensure that current progress value is up to date
|
|
5062 |
if ( iTotalTransferredBytes > iProgressCurrentValue &&
|
|
5063 |
iTotalTransferredBytes <= iProgressFinalValue )
|
|
5064 |
{
|
|
5065 |
iProgressCurrentValue = iTotalTransferredBytes;
|
|
5066 |
}
|
|
5067 |
|
|
5068 |
TRAP_IGNORE( LaunchProgressDialogL(
|
|
5069 |
iProgressFinalValue, iProgressCurrentValue, iActiveProcess, ETrue ) );
|
|
5070 |
|
|
5071 |
iTotalTransferredBytes = prevBytes;
|
|
5072 |
}
|
|
5073 |
|
|
5074 |
// -----------------------------------------------------------------------------
|
|
5075 |
// CFileManagerViewBase::LaunchProgressDialogAsync
|
|
5076 |
//
|
|
5077 |
// -----------------------------------------------------------------------------
|
|
5078 |
//
|
|
5079 |
TInt CFileManagerViewBase::LaunchProgressDialogAsync( TAny* aPtr )
|
|
5080 |
{
|
|
5081 |
static_cast< CFileManagerViewBase* >( aPtr )->DoLaunchProgressDialogAsync();
|
|
5082 |
return KErrNone;
|
|
5083 |
}
|
|
5084 |
|
|
5085 |
// -----------------------------------------------------------------------------
|
|
5086 |
// CFileManagerViewBase::FilesCountInSearchField()
|
|
5087 |
//
|
|
5088 |
// -----------------------------------------------------------------------------
|
|
5089 |
//
|
|
5090 |
TInt CFileManagerViewBase::FilesCountInSearchField()
|
|
5091 |
{
|
|
5092 |
TInt count = 0;
|
|
5093 |
|
|
5094 |
if( iContainer->IsSearchFieldVisible() )
|
|
5095 |
{
|
|
5096 |
TInt listBoxIndex =0;
|
|
5097 |
for(TInt i(0); i<iContainer->ListBoxNumberOfItems();i++ )
|
|
5098 |
{
|
|
5099 |
listBoxIndex = iContainer->SearchFieldToListBoxIndex( i );
|
|
5100 |
if( !iEngine.IsFolder( listBoxIndex ) )
|
|
5101 |
{
|
|
5102 |
count++;
|
|
5103 |
}
|
|
5104 |
}
|
|
5105 |
}
|
|
5106 |
return count;
|
|
5107 |
}
|
|
5108 |
|
|
5109 |
// -----------------------------------------------------------------------------
|
|
5110 |
// CFileManagerViewBase::HandleServerAppExit
|
|
5111 |
//
|
|
5112 |
// -----------------------------------------------------------------------------
|
|
5113 |
//
|
|
5114 |
void CFileManagerViewBase::HandleServerAppExit( TInt /*aReason*/ )
|
|
5115 |
{
|
|
5116 |
iEngine.SetAppExitOb( NULL );
|
|
5117 |
iEngine.SetObserver( this );
|
|
5118 |
iEngine.RefreshDirectory();
|
|
5119 |
}
|
|
5120 |
|
|
5121 |
// -----------------------------------------------------------------------------
|
|
5122 |
// CFileManagerViewBase::EmptyPwd
|
|
5123 |
//
|
|
5124 |
// -----------------------------------------------------------------------------
|
|
5125 |
//
|
|
5126 |
void CFileManagerViewBase::EmptyPwd( TDes& aPwd )
|
|
5127 |
{
|
|
5128 |
aPwd.FillZ( aPwd.MaxLength( ) );
|
|
5129 |
aPwd.Zero();
|
|
5130 |
}
|
|
5131 |
|
|
5132 |
// -----------------------------------------------------------------------------
|
|
5133 |
// CFileManagerViewBase::ConvertCharsToPwd
|
|
5134 |
//
|
|
5135 |
// -----------------------------------------------------------------------------
|
|
5136 |
//
|
|
5137 |
void CFileManagerViewBase::ConvertCharsToPwd(
|
|
5138 |
const TDesC& aWord, TDes8& aConverted )
|
|
5139 |
{
|
|
5140 |
// Make sure the target password is empty ( can't use the function here )
|
|
5141 |
aConverted.FillZ( aConverted.MaxLength() );
|
|
5142 |
aConverted.Zero();
|
|
5143 |
TInt size( aWord.Size() );
|
|
5144 |
if ( size )
|
|
5145 |
{
|
|
5146 |
if ( size > aConverted.MaxLength() )
|
|
5147 |
{
|
|
5148 |
size = aConverted.MaxLength();
|
|
5149 |
}
|
|
5150 |
aConverted.Copy( (TUint8*)aWord.Ptr(), size );
|
|
5151 |
}
|
|
5152 |
}
|
|
5153 |
|
|
5154 |
// ------------------------------------------------------------------------------
|
|
5155 |
// CFileManagerViewBase::DriveInfoAtCurrentPosL
|
|
5156 |
//
|
|
5157 |
// ------------------------------------------------------------------------------
|
|
5158 |
//
|
|
5159 |
TInt CFileManagerViewBase::DriveInfoAtCurrentPosL(
|
|
5160 |
TFileManagerDriveInfo& aInfo )
|
|
5161 |
{
|
|
5162 |
TUid viewId( Id() );
|
|
5163 |
if ( viewId == CFileManagerAppUi::KFileManagerMemoryStoreViewId ||
|
|
5164 |
viewId == CFileManagerAppUi::KFileManagerFoldersViewId )
|
|
5165 |
{
|
|
5166 |
INFO_LOG1("CFileManagerViewBase::DriveInfoAtCurrentPosL viewId=%D", viewId.iUid)
|
|
5167 |
// Use cached info
|
|
5168 |
aInfo = DriveInfo();
|
|
5169 |
return aInfo.iDrive;
|
|
5170 |
}
|
|
5171 |
|
|
5172 |
// Fetch info
|
|
5173 |
if ( !iContainer )
|
|
5174 |
{
|
|
5175 |
return KErrNotFound;
|
|
5176 |
}
|
|
5177 |
if ( !iContainer->ListBoxNumberOfItems() )
|
|
5178 |
{
|
|
5179 |
return KErrNotFound;
|
|
5180 |
}
|
|
5181 |
CFileManagerItemProperties* prop = iEngine.GetItemInfoLC(
|
|
5182 |
iContainer->ListBoxCurrentItemIndex() );
|
|
5183 |
TInt ret( KErrNotFound );
|
|
5184 |
TPtrC fullPath( prop->FullPath() );
|
|
5185 |
if ( fullPath.Length() )
|
|
5186 |
{
|
|
5187 |
ret = TDriveUnit( fullPath );
|
|
5188 |
iEngine.GetDriveInfoL( ret, aInfo );
|
|
5189 |
}
|
|
5190 |
CleanupStack::PopAndDestroy( prop );
|
|
5191 |
return ret;
|
|
5192 |
}
|
|
5193 |
|
|
5194 |
// End of File
|