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