# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1271249230 -10800 # Node ID 875fd7f60fdf02c382a9f2106795db20e0783a04 # Parent 60626d4943462bf8fbf6a80d175991a8de16225b Revision: 201013 Kit: 201015 diff -r 60626d494346 -r 875fd7f60fdf filemanager/App/inc/CFileManagerContainerBase.h --- a/filemanager/App/inc/CFileManagerContainerBase.h Wed Mar 31 21:15:58 2010 +0300 +++ b/filemanager/App/inc/CFileManagerContainerBase.h Wed Apr 14 15:47:10 2010 +0300 @@ -227,7 +227,12 @@ */ virtual void ListBoxSetSelectionIndexesL(const CArrayFixFlat* aSelectionIndexes); - + /** + * search filed index to listbox index + * @param aIndex index in search filed + * @return index in listbox + */ + virtual TInt SearchFieldToListBoxIndex( TInt aIndex ); protected: /** * Standard C++ constructor. diff -r 60626d494346 -r 875fd7f60fdf filemanager/App/inc/CFileManagerFileListContainer.h --- a/filemanager/App/inc/CFileManagerFileListContainer.h Wed Mar 31 21:15:58 2010 +0300 +++ b/filemanager/App/inc/CFileManagerFileListContainer.h Wed Apr 14 15:47:10 2010 +0300 @@ -105,6 +105,8 @@ void ListBoxSelectItemL( TInt aIndex ); void ListBoxDeselectItem( TInt aIndex ); + + TInt SearchFieldToListBoxIndex(TInt aIndex ); private: // From MCoeFocusObserver void HandleChangeInFocus(); diff -r 60626d494346 -r 875fd7f60fdf filemanager/App/inc/CFileManagerSchBackupHandler.h --- a/filemanager/App/inc/CFileManagerSchBackupHandler.h Wed Mar 31 21:15:58 2010 +0300 +++ b/filemanager/App/inc/CFileManagerSchBackupHandler.h Wed Apr 14 15:47:10 2010 +0300 @@ -116,7 +116,7 @@ TBool IsPowerSavingModeOnL(); - TBool IsTargetDriveAvailableL(); + TBool IsTargetDriveAvailableL( const TFileManagerDriveInfo& aDrvInfo ); private: // Data /** diff -r 60626d494346 -r 875fd7f60fdf filemanager/App/inc/CFileManagerViewBase.h --- a/filemanager/App/inc/CFileManagerViewBase.h Wed Mar 31 21:15:58 2010 +0300 +++ b/filemanager/App/inc/CFileManagerViewBase.h Wed Apr 14 15:47:10 2010 +0300 @@ -648,6 +648,7 @@ static TInt LaunchProgressDialogAsync( TAny* aPtr ); + TInt FilesCountInSearchField(); protected: // Data /// Own: Container that this view handles. diff -r 60626d494346 -r 875fd7f60fdf filemanager/App/src/CFileManagerContainerBase.cpp --- a/filemanager/App/src/CFileManagerContainerBase.cpp Wed Mar 31 21:15:58 2010 +0300 +++ b/filemanager/App/src/CFileManagerContainerBase.cpp Wed Apr 14 15:47:10 2010 +0300 @@ -578,5 +578,14 @@ { iListBox->View()->SetSelectionIndexesL( aSelectionIndexes ); } - + +// ----------------------------------------------------------------------------- +// CFileManagerContainerBase::SearchFieldToListBoxIndex +// +// ----------------------------------------------------------------------------- +// +TInt CFileManagerContainerBase::SearchFieldToListBoxIndex( TInt aIndex ) + { + return 0; + } // End of File diff -r 60626d494346 -r 875fd7f60fdf filemanager/App/src/CFileManagerFileListContainer.cpp --- a/filemanager/App/src/CFileManagerFileListContainer.cpp Wed Mar 31 21:15:58 2010 +0300 +++ b/filemanager/App/src/CFileManagerFileListContainer.cpp Wed Apr 14 15:47:10 2010 +0300 @@ -875,5 +875,18 @@ aIndex = ListToSearchFieldIndex( aIndex ); CFileManagerContainerBase::ListBoxDeselectItem( aIndex ); } - + +// ----------------------------------------------------------------------------- +// CFileManagerFileListContainer::SearchFieldToListBoxIndex +// +// ----------------------------------------------------------------------------- +// +TInt CFileManagerFileListContainer::SearchFieldToListBoxIndex( TInt aIndex ) + { + if ( !iSearchField || !iSearchField->IsVisible() ) + { + return 0; + } + return SearchFieldToListIndex( aIndex ); + } // End of File diff -r 60626d494346 -r 875fd7f60fdf filemanager/App/src/CFileManagerSchBackupHandler.cpp --- a/filemanager/App/src/CFileManagerSchBackupHandler.cpp Wed Mar 31 21:15:58 2010 +0300 +++ b/filemanager/App/src/CFileManagerSchBackupHandler.cpp Wed Apr 14 15:47:10 2010 +0300 @@ -16,7 +16,7 @@ */ -// #define FILE_MANAGER_POWER_SAVING_MODE + #define FILE_MANAGER_POWER_SAVING_MODE // INCLUDE FILES #include @@ -175,9 +175,30 @@ // void CFileManagerSchBackupHandler::StartBackupL() { - TBool drvAvailable( ETrue ); - TRAPD( err, drvAvailable = IsTargetDriveAvailableL() ); - if ( !drvAvailable && err == KErrNone ) + CFileManagerBackupSettings& settings( iEngine.BackupSettingsL() ); + TFileManagerDriveInfo drvInfo; + iEngine.GetDriveInfoL( settings.TargetDrive(), drvInfo ); + TBool drvAvailable( EFalse ); + + if( !IsTargetDriveAvailableL(drvInfo ) ) + { + for( TInt i ( EDriveA ); i <= EDriveZ; i++ ) + { + iEngine.GetDriveInfoL( i , drvInfo ); + if( ( IsTargetDriveAvailableL( drvInfo ) ) && ( drvInfo.iState & TFileManagerDriveInfo::EDriveEjectable ) ) + { + settings.SetTargetDrive( i ); + settings.SaveL(); + drvAvailable = ETrue; + break; + } + } + } + else + { + drvAvailable = ETrue; + } + if ( !drvAvailable ) { iGlobalDlg->ShowDialogL( CFileManagerGlobalDlg::EQueryWithWarningIcon, @@ -187,7 +208,6 @@ return; } - CFileManagerBackupSettings& settings( iEngine.BackupSettingsL() ); HBufC* text = StringLoader::LoadLC( R_QTN_FMGR_SCHEDULED_BACKUP_PROGRESS, iEngine.DriveName( settings.TargetDrive() ) ); @@ -380,24 +400,21 @@ // CFileManagerSchBackupHandler::IsTargetDriveAvailableL // ---------------------------------------------------------------------------- // -TBool CFileManagerSchBackupHandler::IsTargetDriveAvailableL() +TBool CFileManagerSchBackupHandler::IsTargetDriveAvailableL( const TFileManagerDriveInfo& aDrvInfo ) { // Start backup with cancelable global progress dialog - CFileManagerBackupSettings& settings( iEngine.BackupSettingsL() ); // Check is target drive available TBool ret( ETrue ); - TFileManagerDriveInfo info; - iEngine.GetDriveInfoL( settings.TargetDrive(), info ); - if ( !( info.iState & TFileManagerDriveInfo::EDrivePresent ) || - ( info.iState & + if ( !( aDrvInfo.iState & TFileManagerDriveInfo::EDrivePresent ) || + ( aDrvInfo.iState & ( TFileManagerDriveInfo::EDriveLocked | TFileManagerDriveInfo::EDriveCorrupted | TFileManagerDriveInfo::EDriveWriteProtected ) ) ) { ERROR_LOG1( "CFileManagerSchBackupHandler::IsTargetDriveAvailableL-DrvState=%d", - info.iState ) + aDrvInfo.iState ) ret = EFalse; } return ret; diff -r 60626d494346 -r 875fd7f60fdf filemanager/App/src/CFileManagerViewBase.cpp --- a/filemanager/App/src/CFileManagerViewBase.cpp Wed Mar 31 21:15:58 2010 +0300 +++ b/filemanager/App/src/CFileManagerViewBase.cpp Wed Apr 14 15:47:10 2010 +0300 @@ -603,8 +603,15 @@ aMenuPane.SetItemDimmed( EFileManagerUnmarkOne, ETrue ); } } - - TInt files( iEngine.FilesInFolderL() ); + TInt files( 0 ); + if( iContainer->IsSearchFieldVisible() ) + { + files = FilesCountInSearchField(); + } + else + { + files = iEngine.FilesInFolderL(); + } TInt count( iContainer->ListBoxSelectionIndexesCount() ); if ( count == files ) { @@ -712,7 +719,15 @@ User::LeaveIfError( err ); if ( ret ) { - DeleteItemsL( index ); + if( IsDriveAvailable( DriveInfo().iDrive ) ) + { + DeleteItemsL( index ); + } + else + { + FileManagerDlgUtils::ShowInfoNoteL( R_QTN_MEMC_NOT_AVAILABLE ); + CheckPostponedDirectoryRefresh(); + } } else { @@ -3192,7 +3207,11 @@ // Common remote drive filtering RemoteDriveCommonFilteringL( aMenuPane ); - + if( iContainer->IsSearchFieldVisible() && + !FilesCountInSearchField() ) + { + aMenuPane.SetItemDimmed( EFileManagerMark, ETrue ); + } if ( iContainer->ListBoxNumberOfItems() ) { if ( !iContainer->ListBoxSelectionIndexesCount() ) @@ -5051,6 +5070,30 @@ } // ----------------------------------------------------------------------------- +// CFileManagerViewBase::FilesCountInSearchField() +// +// ----------------------------------------------------------------------------- +// +TInt CFileManagerViewBase::FilesCountInSearchField() + { + TInt count = 0; + + if( iContainer->IsSearchFieldVisible() ) + { + TInt listBoxIndex =0; + for(TInt i(0); iListBoxNumberOfItems();i++ ) + { + listBoxIndex = iContainer->SearchFieldToListBoxIndex( i ); + if( !iEngine.IsFolder( listBoxIndex ) ) + { + count++; + } + } + } + return count; + } + +// ----------------------------------------------------------------------------- // CFileManagerViewBase::HandleServerAppExit // // -----------------------------------------------------------------------------