Revision: 201013 RCL_3
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Wed, 14 Apr 2010 15:47:10 +0300
branchRCL_3
changeset 13 875fd7f60fdf
parent 12 60626d494346
child 15 649c558486f0
Revision: 201013 Kit: 201015
filemanager/App/inc/CFileManagerContainerBase.h
filemanager/App/inc/CFileManagerFileListContainer.h
filemanager/App/inc/CFileManagerSchBackupHandler.h
filemanager/App/inc/CFileManagerViewBase.h
filemanager/App/src/CFileManagerContainerBase.cpp
filemanager/App/src/CFileManagerFileListContainer.cpp
filemanager/App/src/CFileManagerSchBackupHandler.cpp
filemanager/App/src/CFileManagerViewBase.cpp
--- 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<TInt>* 
                                                           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.
--- 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();
--- 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
     /**
--- 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.
--- 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  
--- 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  
--- 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 <StringLoader.h>
@@ -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;
--- 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); i<iContainer->ListBoxNumberOfItems();i++ )
+            {
+            listBoxIndex = iContainer->SearchFieldToListBoxIndex( i );
+            if( !iEngine.IsFolder( listBoxIndex ) )
+                {
+                count++;
+                }
+            }
+        }
+    return count;
+    }
+
+// -----------------------------------------------------------------------------
 // CFileManagerViewBase::HandleServerAppExit
 // 
 // -----------------------------------------------------------------------------