201035
authorhgs
Thu, 02 Sep 2010 17:00:51 +0800
changeset 40 4167eb56f30d
parent 33 328cf6fbe40c
child 47 12b82dc0e8db
201035
filemanager/rom/bld.inf
filemanager/src/filemanager/burconfig.xml
filemanager/src/filemanager/filemanager.pri
filemanager/src/filemanager/filemanager.pro
filemanager/src/filemanager/filemanager.qrc
filemanager/src/filemanager/resources/hblistviewitem.css
filemanager/src/filemanager/resources/hblistviewitem.widgetml
filemanager/src/filemanager/src/backuprestore/fmbackuprestorehandler.cpp
filemanager/src/filemanager/src/backuprestore/fmbackupwidget.cpp
filemanager/src/filemanager/src/components/fmdrivedetailstype.cpp
filemanager/src/filemanager/src/components/fmdrivedetailstype.h
filemanager/src/filemanager/src/components/fmsingletextquery.h
filemanager/src/filemanager/src/components/fmtimequery.cpp
filemanager/src/filemanager/src/components/fmtimequery.h
filemanager/src/filemanager/src/components/fmviewdetailsdialog.cpp
filemanager/src/filemanager/src/components/fmviewdetailsdialog.h
filemanager/src/filemanager/src/fmdriverlistwidget.cpp
filemanager/src/filemanager/src/fmdriverlistwidget.h
filemanager/src/filemanager/src/fmdriverview.cpp
filemanager/src/filemanager/src/fmdriverview.h
filemanager/src/filemanager/src/fmfilebrowsewidget.cpp
filemanager/src/filemanager/src/fmfilebrowsewidget.h
filemanager/src/filemanager/src/fmfileview.cpp
filemanager/src/filemanager/src/fmfileview.h
filemanager/src/filemanager/src/fmfindresultmodel.cpp
filemanager/src/filemanager/src/fmfindresultmodel.h
filemanager/src/filemanager/src/fmfindthread.cpp
filemanager/src/filemanager/src/fmfindthread.h
filemanager/src/filemanager/src/fmfindview.cpp
filemanager/src/filemanager/src/fmfindview.h
filemanager/src/filemanager/src/fmfindwidget.cpp
filemanager/src/filemanager/src/fmfindwidget.h
filemanager/src/filemanager/src/fmmainwindow.cpp
filemanager/src/filemanager/src/fmviewbase.cpp
filemanager/src/filemanager/src/fmviewbase.h
filemanager/src/filemanager/src/fmviewmanager.cpp
filemanager/src/filemanager/src/fmviewmanager.h
filemanager/src/filemanager/src/listviewitems.cpp
filemanager/src/filemanager/src/listviewitems.h
filemanager/src/filemanager/src/main.cpp
filemanager/src/filemanager/src/operationservice/fmoperationbase.cpp
filemanager/src/filemanager/src/operationservice/fmoperationbase.h
filemanager/src/filemanager/src/operationservice/fmoperationcopyormove.cpp
filemanager/src/filemanager/src/operationservice/fmoperationcopyormove.h
filemanager/src/filemanager/src/operationservice/fmoperationformat_win.cpp
filemanager/src/filemanager/src/operationservice/fmoperationresultprocesser.cpp
filemanager/src/filemanager/src/operationservice/fmoperationservice.cpp
filemanager/src/fmfiledialog/fmfiledialog.pro
filemanager/src/fmfiledialog/src/fmfilewidget.cpp
filemanager/src/inc/commonutils.pri
filemanager/src/inc/fmcommon.h
filemanager/src/inc/fmdefine.h
filemanager/src/inc/fmdrivemodel.cpp
filemanager/src/inc/fmdrivemodel.h
filemanager/src/inc/fmdrivewatcher/private/symbian/fmdriveevent.cpp
filemanager/src/inc/fmfileiconprovider.cpp
filemanager/src/inc/fmfiletyperecognizer.h
filemanager/src/inc/fmutils.cpp
filemanager/src/inc/fmutils.h
filemanager/src/inc/fmutils_s60.cpp
filemanager/src/inc/fmutils_win.cpp
package_definition.xml
package_map.xml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/filemanager/rom/bld.inf	Thu Sep 02 17:00:51 2010 +0800
@@ -0,0 +1,25 @@
+/*
+* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0""
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Rom exports for FileManager
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+
+
+#include<platform_paths.hrh>
+filemngr.iby          CORE_APP_LAYER_IBY_EXPORT_PATH(filemngr.iby)
+filemngr_resources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(filemngr_resources.iby)
--- a/filemanager/src/filemanager/burconfig.xml	Thu Aug 05 11:30:07 2010 +0800
+++ b/filemanager/src/filemanager/burconfig.xml	Thu Sep 02 17:00:51 2010 +0800
@@ -54,7 +54,7 @@
             <exclude_uids>0x2001FE79</exclude_uids> <!--Messaging 101 (EBUCatMessages)-->   
             <exclude_uids>0x2002A542</exclude_uids> <!--CsServer.exe (EBUCatMessages)-->    
             <exclude_uids>0x10003a73</exclude_uids> <!--Contacts model (EBUCatContacts)-->  
-            <exclude_uids>0x101f4cce</exclude_uids> <!--Phonebook-app (EBUCatContacts)-->   
+            <exclude_uids>0x20022EF9</exclude_uids> <!--Phonebook-app (EBUCatContacts) changed from 0x101f4cce-->   
             <exclude_uids>0x10003a5b</exclude_uids> <!--Agenda model (EBUCatCalendar)-->    
             <exclude_uids>0x10005901</exclude_uids> <!--Calendar-app (EBUCatCalendar)-->    
             <exclude_uids>0x10008d38</exclude_uids> <!--Bookmarks (EBUCatBookmarks)-->      
@@ -86,7 +86,7 @@
             <special_flags>EBUCatSpecNone</special_flags>                                   
             <exclude_special_flags>EBUCatSpecNone</exclude_special_flags>                   
             <uids>0x10003a73</uids><!--Contacts model-->                                    
-            <uids>0x101f4cce</uids><!--Phonebook-app-->                                     
+            <uids>0x20022EF9</uids><!--Phonebook-app changed from 0x101f4cce-->                                     
             <exclude_uids></exclude_uids>                                                   
         </backupCategory>                                                                   
                                                                                             
--- a/filemanager/src/filemanager/filemanager.pri	Thu Aug 05 11:30:07 2010 +0800
+++ b/filemanager/src/filemanager/filemanager.pri	Thu Sep 02 17:00:51 2010 +0800
@@ -19,8 +19,7 @@
 INCLUDEPATH += ./src/backuprestore
 INCLUDEPATH += ./src/operationservice
 
-HEADERS += src/fmdriverlistwidget.h \
-           src/listviewitems.h \
+HEADERS += src/fmdriverlistwidget.h \           
            src/fmfileview.h \
            src/fmfilebrowsewidget.h \
            src/fmdriverview.h \
@@ -62,8 +61,7 @@
            src/components/fmdrivequery.h
 
 SOURCES += src/main.cpp \
-           src/fmdriverlistwidget.cpp \
-           src/listviewitems.cpp \
+           src/fmdriverlistwidget.cpp \           
            src/fmfileview.cpp \
            src/fmfilebrowsewidget.cpp \
            src/fmdriverview.cpp \
--- a/filemanager/src/filemanager/filemanager.pro	Thu Aug 05 11:30:07 2010 +0800
+++ b/filemanager/src/filemanager/filemanager.pro	Thu Sep 02 17:00:51 2010 +0800
@@ -41,8 +41,8 @@
             -lshareui \
             -lefsrv \
             -lapgrfx \
-	    -lcone \
-            -ldirectorylocalizer
+    	    -lcone \
+            -lsysutil
 
     TARGET.UID3 = 0x2002BCC0
     TARGET.EPOCHEAPSIZE = 0x020000 0x1000000
--- a/filemanager/src/filemanager/filemanager.qrc	Thu Aug 05 11:30:07 2010 +0800
+++ b/filemanager/src/filemanager/filemanager.qrc	Thu Sep 02 17:00:51 2010 +0800
@@ -6,6 +6,8 @@
         <file>image/qgn_prop_fmgr_mmc_no_sub.svg</file>
         <file>image/qgn_prop_phone_memc.svg</file>
         <file>image/qgn_prop_usb_memc.svg</file>
-        <file>image/qgn_prop_fmgr_ms.svg</file>
+        <file>image/qgn_prop_fmgr_ms.svg</file>        
+        <file>resources/hblistviewitem.css</file>        
+        <file>resources/hblistviewitem.widgetml</file>
     </qresource>    
 </RCC>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/filemanager/src/filemanager/resources/hblistviewitem.css	Thu Sep 02 17:00:51 2010 +0800
@@ -0,0 +1,57 @@
+	
+HbListViewItem[layoutName="drive"]:portrait{
+    layout: drive-portrait;
+}
+
+
+HbListViewItem[layoutName="drive"]:landscape{
+    layout: drive-landscape;
+}
+
+HbListViewItem::text-1[layoutName="drive"]:portrait{
+ 	top: -var(hb-param-margin-gene-middle-vertical);
+	font-variant: primary;
+	text-align: left;
+}
+
+HbListViewItem::text-2[layoutName="drive"]:portrait{
+	font-variant: secondary;
+	text-align: left;
+}
+HbListViewItem::text-3[layoutName="drive"]:portrait{
+ 	bottom: var(hb-param-margin-gene-middle-vertical);
+	font-variant: secondary-small;
+	text-align: left;
+}
+HbListViewItem::icon-1[layoutName="drive"]:portrait{
+ 	top: -var(hb-param-margin-gene-top);
+    left: -var(hb-param-margin-gene-middle-horizontal);
+
+	fixed-height: var(hb-param-graphic-size-primary-large);
+	fixed-width: var(hb-param-graphic-size-primary-large);
+}
+
+HbListViewItem::text-1[layoutName="drive"]:landscape{
+ 	top: -var(hb-param-margin-gene-top);
+	font-variant: primary;
+	text-align: left;
+}
+
+HbListViewItem::text-2[layoutName="drive"]:landscape {
+	top: -var(hb-param-margin-gene-top);
+	font-variant: secondary;
+	text-align: left;
+}
+HbListViewItem::text-3[layoutName="drive"]:landscape{
+ 	bottom: var(hb-param-margin-gene-top);
+	font-variant: secondary-small;
+	text-align: left;
+}
+HbListViewItem::icon-1[layoutName="drive"]:landscape{
+    top: -var(hb-param-margin-gene-top);
+    left: -var(hb-param-margin-gene-middle-horizontal);
+    bottom: var(hb-param-margin-gene-bottom);
+    fixed-height: var(hb-param-graphic-size-primary-large);
+    fixed-width: var(hb-param-graphic-size-primary-large);
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/filemanager/src/filemanager/resources/hblistviewitem.widgetml	Thu Sep 02 17:00:51 2010 +0800
@@ -0,0 +1,46 @@
+<hbwidget version="0.1" type="HbListViewItem">
+    <layout name="drive-portrait" type="mesh">
+
+ 	  <meshitem src="icon-1" srcEdge="LEFT" dst="" dstEdge="LEFT" />
+      <meshitem src="icon-1" srcEdge="TOP" dst="" dstEdge="TOP" />      
+      
+      
+      <meshitem src="text-1" srcEdge="LEFT" dst="icon-1" dstEdge="RIGHT" />
+      <meshitem src="text-1" srcEdge="TOP" dst="" dstEdge="TOP" />
+      <meshitem src="text-1" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
+      
+	  
+	  <meshitem src="text-2" srcEdge="LEFT" dst="text-1" dstEdge="LEFT" />
+	  <meshitem src="text-2" srcEdge="TOP" dst="text-1" dstEdge="BOTTOM" />
+	  <meshitem src="text-2" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
+	  
+
+ 	  <meshitem src="text-3" srcEdge="LEFT" dst="text-1" dstEdge="LEFT" />
+ 	  <meshitem src="text-3" srcEdge="TOP" dst="text-2" dstEdge="BOTTOM" /> 	  
+      <meshitem src="text-3" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
+      <meshitem src="text-3" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
+      
+	  
+  </layout>
+  <layout name="drive-landscape" type="mesh">
+
+    <meshitem src="icon-1" srcEdge="LEFT" dst="" dstEdge="LEFT" />
+    <meshitem src="icon-1" srcEdge="TOP" dst="" dstEdge="TOP" />
+    
+
+    <meshitem src="text-1" srcEdge="LEFT" dst="icon-1" dstEdge="RIGHT" spacing ="-3un"/>
+    <meshitem src="text-1" srcEdge="TOP" dst="" dstEdge="TOP" />    
+
+
+    <meshitem src="text-2" srcEdge="LEFT" dst="text-1" dstEdge="RIGHT" spacing ="-4un"/>
+    <meshitem src="text-2" srcEdge="TOP" dst="" dstEdge="TOP" />
+    <meshitem src="text-2" srcEdge="RIGHT" dst="" dstEdge="RIGHT" spacing ="20un"/>
+
+
+    <meshitem src="text-3" srcEdge="LEFT" dst="text-2" dstEdge="LEFT" />
+    <meshitem src="text-3" srcEdge="TOP" dst="text-2" dstEdge="BOTTOM" />
+    <meshitem src="text-3" srcEdge="RIGHT" dst="" dstEdge="RIGHT" spacing ="20un"/>
+    <meshitem src="text-3" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
+
+  </layout>
+</hbwidget>
\ No newline at end of file
--- a/filemanager/src/filemanager/src/backuprestore/fmbackuprestorehandler.cpp	Thu Aug 05 11:30:07 2010 +0800
+++ b/filemanager/src/filemanager/src/backuprestore/fmbackuprestorehandler.cpp	Thu Sep 02 17:00:51 2010 +0800
@@ -72,8 +72,8 @@
     mCurrentProcess = ProcessBackup;
     bool ret = mBkupEngine->startBackup( backupConfigLoader()->driversAndOperationList(),
         backupConfigLoader()->backupCategoryList(), 
-        mBkupEngine->BackupSettingsL()->availableTargetDrive(),
-        mBkupEngine->BackupSettingsL()->content() );
+        operationBackup->targetDrive(), // targetDrive is stored in FmOperationBackup
+        operationBackup->content() );   // content     is stored in FmOperationBackup
 
     if( !ret ) {
         mCurrentProcess = ProcessNone;
--- a/filemanager/src/filemanager/src/backuprestore/fmbackupwidget.cpp	Thu Aug 05 11:30:07 2010 +0800
+++ b/filemanager/src/filemanager/src/backuprestore/fmbackupwidget.cpp	Thu Sep 02 17:00:51 2010 +0800
@@ -131,10 +131,12 @@
     mContentsItem = mModel->appendDataFormItem(
         HbDataFormModelItem::TextItem, QString( "" ), mContentsGroup );
     mContentsItem->setContentWidgetData( QString("readOnly"), QString("true") );
+    mContentsItem->setContentWidgetData( QString("objectName"), QString("backupContentItem") );
 
     mTargetItem = mModel->appendDataFormItem(
         HbDataFormModelItem::TextItem, QString( "" ), mContentsGroup );
     mTargetItem->setContentWidgetData( QString("readOnly"), QString("true") );
+    mTargetItem->setContentWidgetData( QString("objectName"), QString("backupTargetItem") );
 
     mSchedulingGroup = mModel->appendDataFormGroup(
         QString( hbTrId( "Scheduling" ) ), mModel->invisibleRootItem());
@@ -142,19 +144,22 @@
     mSchedulingItem = mModel->appendDataFormItem(
         HbDataFormModelItem::TextItem, QString( "" ), mSchedulingGroup );
     mSchedulingItem->setContentWidgetData( QString("readOnly"), QString("true") );
+    mSchedulingItem->setContentWidgetData( QString("objectName"), QString("backupSchedulingItem") );
 
     mWeekdayItem = mModel->appendDataFormItem(
         HbDataFormModelItem::TextItem, QString( "" ), mSchedulingGroup );
     mWeekdayItem->setContentWidgetData( QString("readOnly"), QString("true") );
+    mWeekdayItem->setContentWidgetData( QString("objectName"), QString("backupWeekdayItem") );
 
     mTimeItem = mModel->appendDataFormItem(
         HbDataFormModelItem::TextItem, QString( "" ), mSchedulingGroup );
     mTimeItem->setContentWidgetData( QString("readOnly"), QString("true") );
+    mTimeItem->setContentWidgetData( QString("objectName"), QString("backupTimeItem") );
     
     mLastBackupDateItem = mModel->appendDataFormItem(
         HbDataFormModelItem::TextItem, QString( ( "" )), mModel->invisibleRootItem() );
     mLastBackupDateItem->setContentWidgetData( QString("readOnly"), QString("true") );   
-    
+    mLastBackupDateItem->setContentWidgetData( QString("objectName"), QString("backupLastBackupDateItem") );
 }
 
 
--- a/filemanager/src/filemanager/src/components/fmdrivedetailstype.cpp	Thu Aug 05 11:30:07 2010 +0800
+++ b/filemanager/src/filemanager/src/components/fmdrivedetailstype.cpp	Thu Sep 02 17:00:51 2010 +0800
@@ -36,13 +36,21 @@
     
     QStringList dataPathList;
     dataPathList.append( QString( FmViewDetail_Contacts ) );    
-    FmDriveDetailsDataGroup driveDetailsDataGroup( FmDriveDetailsSize::ETypeContacts, dataPathList );
+    FmDriveDetailsDataGroup driveDetailsDataGroupForContacts( FmDriveDetailsSize::ETypeContacts, dataPathList );
     
-    err = getDataSizeByAbsolutePath(driveName, driveDetailsDataGroup, detailsSizeList, isStopped);
+    err = getDataSizeByAbsolutePath(driveName, driveDetailsDataGroupForContacts, detailsSizeList, isStopped);
     if( err != FmErrNone ) {
         return err;
     }
     
+    dataPathList.clear();
+    dataPathList.append( QString( FmViewDetail_Messages ) );    
+    FmDriveDetailsDataGroup driveDetailsDataGroupForMessage( FmDriveDetailsSize::ETypeMessages, dataPathList );
+    
+    err = getDataSizeByAbsolutePath(driveName, driveDetailsDataGroupForMessage, detailsSizeList, isStopped);
+    if( err != FmErrNone ) {
+        return err;
+    }
     return FmErrNone;
 }
 int FmDriveDetailsContent::getDataSizeByTraversePath( const QString &driveName,
@@ -134,7 +142,30 @@
         QString driver(FmUtils::removePathSplash(FmUtils::getDriveNameFromPath(driveName)));
         QFileInfo fileInfo(QString(driver + (*it)));
         if (fileInfo.exists()) {
-            totalSize += fileInfo.size();
+            if (fileInfo.isFile()) {
+                totalSize += fileInfo.size();    
+            } else if (fileInfo.isDir()) {
+                QList<QDir> dirs;
+                dirs.append(QDir(fileInfo.absolutePath()));
+                // traverse the whole path
+                while (!dirs.isEmpty()) {
+                    QDir::Filters filter = QDir::NoDotAndDotDot | QDir::AllEntries;
+                    QFileInfoList infoList = dirs.first().entryInfoList( filter );
+                    for ( QFileInfoList::const_iterator it = infoList.begin(); it != infoList.end(); ++it ) {
+                        if ( *isStopped ){
+                            return FmErrCancel;
+                        }                        
+                        if ( it->isFile() ) {
+                            totalSize += it->size();  
+                        }
+                        else if ( it->isDir() ) {
+                            dirs.append( QDir( it->absoluteFilePath() ) );
+                        } 
+                    }
+                    dirs.removeFirst();
+                }
+            }
+            
         }
     }
  
--- a/filemanager/src/filemanager/src/components/fmdrivedetailstype.h	Thu Aug 05 11:30:07 2010 +0800
+++ b/filemanager/src/filemanager/src/components/fmdrivedetailstype.h	Thu Sep 02 17:00:51 2010 +0800
@@ -148,7 +148,8 @@
             QList<FmDriveDetailsSize*> &detailsSizeList, volatile bool *isStopped );
     
     /*!
-     Gets data size for single FmDriveDetailsDataGroup, the method is find file of absolute path
+     Gets data size for single FmDriveDetailsDataGroup
+     The method will find file or traverse all folders of absolute path
      \a driveName which drive is searching
      \a dataGroup which dataGroup is searching, for example, EGroupContacts...
      \a detailsSizeList if got result, new FmDriveDetailsSize will be appended to detailsSizeList
--- a/filemanager/src/filemanager/src/components/fmsingletextquery.h	Thu Aug 05 11:30:07 2010 +0800
+++ b/filemanager/src/filemanager/src/components/fmsingletextquery.h	Thu Sep 02 17:00:51 2010 +0800
@@ -29,7 +29,7 @@
 Q_OBJECT
 public:
     
-    FmSingleTextQuery( HbLineEdit::EchoMode echoMode = HbLineEdit::Normal, QGraphicsItem *parent = 0 );
+    explicit FmSingleTextQuery( HbLineEdit::EchoMode echoMode = HbLineEdit::Normal, QGraphicsItem *parent = 0 );
     ~FmSingleTextQuery();
 
 public:
@@ -49,7 +49,7 @@
     HbLineEdit  *mTextEdit;
     HbLineEdit::EchoMode mEchoMode;
 
-    // used to check if input text is vaild. Disable primary action when text is not vaild
+    // used to check if input text is valid. Disable primary action when text is not valid
     QStringList mRegExpStringList;
 };
 
--- a/filemanager/src/filemanager/src/components/fmtimequery.cpp	Thu Aug 05 11:30:07 2010 +0800
+++ b/filemanager/src/filemanager/src/components/fmtimequery.cpp	Thu Sep 02 17:00:51 2010 +0800
@@ -21,7 +21,7 @@
 #include <QGraphicsItem>
 #include <QGraphicsLinearLayout>
 
-#include <hbdatetimeedit.h>
+#include <hbdatetimepicker.h>
 
 
 FmTimeQuery::FmTimeQuery( QGraphicsItem *parent ) : FmDialog( parent )
@@ -33,7 +33,7 @@
 	QGraphicsLinearLayout *vLayout = new QGraphicsLinearLayout();
     vLayout->setOrientation( Qt::Vertical );
 
-    mTimeWidget = new HbDateTimeEdit();
+    mTimeWidget = new HbDateTimePicker();
     mTimeWidget->setObjectName( "timeQueryTimeWidget" );
 	vLayout->addItem( mTimeWidget );
 
--- a/filemanager/src/filemanager/src/components/fmtimequery.h	Thu Aug 05 11:30:07 2010 +0800
+++ b/filemanager/src/filemanager/src/components/fmtimequery.h	Thu Sep 02 17:00:51 2010 +0800
@@ -25,7 +25,7 @@
 #include <QTime>
 
 class QGraphicsWidget;
-class HbDateTimeEdit;
+class HbDateTimePicker;
 class FmTimeQuery : public FmDialog
 {
 public:
@@ -46,7 +46,7 @@
 
 private:
     QGraphicsWidget *mContentWidget;
-    HbDateTimeEdit  *mTimeWidget;
+    HbDateTimePicker *mTimeWidget;
 
 };
 
--- a/filemanager/src/filemanager/src/components/fmviewdetailsdialog.cpp	Thu Aug 05 11:30:07 2010 +0800
+++ b/filemanager/src/filemanager/src/components/fmviewdetailsdialog.cpp	Thu Sep 02 17:00:51 2010 +0800
@@ -26,7 +26,6 @@
 #include <QDateTime>
 #include <QStandardItemModel>
 #include <QStringList>
-#include <QFileInfo>
 
 #include <hblabel.h>
 #include <hblistview.h>
@@ -44,7 +43,8 @@
       mSizeofNativeFiles( 0 ),
       mSizeofDocument( 0 ),
       mSizeofCalendar( 0 ),
-      mSizeofContacts( 0 )
+      mSizeofContacts( 0 ),
+      mSizeofMessages( 0 )
 {
     init();
     
@@ -170,6 +170,13 @@
     sizeOfOthers -= mSizeofContacts;
     
     dataList.clear();
+    dataList << hbTrId ( "Messages:" );
+    dataList << FmUtils::formatStorageSize( mSizeofMessages );
+    mDataListModel->setData(  mDataListModel->index( EMemoryMessages, 0 ), dataList, Qt::DisplayRole );  
+    
+    sizeOfOthers -= mSizeofMessages;
+    
+    dataList.clear();
     dataList << hbTrId ( "Others:" );
     dataList << FmUtils::formatStorageSize( sizeOfOthers );
     mDataListModel->setData(  mDataListModel->index( EMemoryOthers, 0 ), dataList, Qt::DisplayRole );     
@@ -289,6 +296,7 @@
     mSizeofDocument = 0;
     mSizeofCalendar = 0;
     mSizeofContacts = 0;
+    mSizeofMessages = 0;
     
     for( QList< FmDriveDetailsSize* >::const_iterator it = detailsSizeList.begin(); 
             it!= detailsSizeList.end(); ++it ){
@@ -334,6 +342,11 @@
                 mSizeofContacts = ( *it )->size();
                 break;
             }
+            case FmDriveDetailsSize::ETypeMessages:
+            {
+                mSizeofMessages = ( *it )->size();
+                break;
+            } 
             default:
                 break;
         }
--- a/filemanager/src/filemanager/src/components/fmviewdetailsdialog.h	Thu Aug 05 11:30:07 2010 +0800
+++ b/filemanager/src/filemanager/src/components/fmviewdetailsdialog.h	Thu Sep 02 17:00:51 2010 +0800
@@ -45,6 +45,7 @@
         EMemoryDocuments,
         EMemoryCalendar,
         EMemoryContacts,
+        EMemoryMessages,
         EMemoryOthers,
         EDriveDetailEntryEnd
     };
@@ -109,6 +110,7 @@
     quint64 mSizeofDocument;
     quint64 mSizeofCalendar;
     quint64 mSizeofContacts;
+    quint64 mSizeofMessages;
 };
 
 #endif /* FMVIEWDETAILSDIALOG_H_ */
--- a/filemanager/src/filemanager/src/fmdriverlistwidget.cpp	Thu Aug 05 11:30:07 2010 +0800
+++ b/filemanager/src/filemanager/src/fmdriverlistwidget.cpp	Thu Sep 02 17:00:51 2010 +0800
@@ -16,7 +16,6 @@
  *     The driver model file for file manager
  */
 #include "fmdriverlistwidget.h"
-#include "listviewitems.h"
 #include "fmutils.h"
 #include "fmdlgutils.h"
 #include "fmviewmanager.h"
@@ -24,7 +23,8 @@
 #include "fmoperationbase.h"
 #include "fmdrivemodel.h"
 #include "fmfiledialog.h"
-
+#include "fmoperationservice.h"
+#include <hbabstractviewitem.h>
 #include <QDir>
 #include <QGraphicsLinearLayout>
 #include <QFileSystemWatcher>
@@ -36,12 +36,10 @@
 
 FmDriverListWidget::FmDriverListWidget( QGraphicsItem *parent )
 : HbWidget( parent ), mListView(0), mModel(0),
-  mCurrentItem(0), mSearchPanel(0),  mOperationService(0),
+  mCurrentItem(0), mSearchPanel(0),
   mFileSystemWatcher(0), mLayout(0), mContextMenu(0), mListLongPressed( false )
 {
-	init();
-	mOperationService = FmViewManager::viewManager()->operationService();
-
+	init();	
     mFileSystemWatcher = new QFileSystemWatcher( this );
     connect( mFileSystemWatcher, SIGNAL( directoryChanged ( const QString & ) ), 
             this, SLOT( on_directoryChanged( const QString & ) ) ); 
@@ -72,23 +70,18 @@
 	mLayout = new QGraphicsLinearLayout( this );
 	mLayout->setOrientation( Qt::Vertical );
 
-	mListView = new HbListView( this );
-	mListView->setSelectionMode( HbAbstractItemView::SingleSelection );
-
+	mListView = new HbListView( this );	
+	mListView->setLayoutName( "drive" );
 	mModel = new FmDriveModel( this,
-         FmDriveModel::FillWithVolume | FmDriveModel::FillWithDefaultVolume );
+         FmDriveModel::FillWithVolume | FmDriveModel::FillWithDefaultVolume |
+         FmDriveModel::FillWithTotalSize | FmDriveModel::FillWithFreeSize );
 	mListView->setModel( mModel );
-
-	mLayout->addItem( mListView );
-	
+	mLayout->addItem( mListView );	
 	mSearchPanel = new HbSearchPanel( this );
 	mSearchPanel->setObjectName( "searchPanel" );
-	mSearchPanel->setSearchOptionsEnabled( true );
-	mSearchPanel->setProgressive( false );
+	mSearchPanel->setSearchOptionsEnabled( false );
+	mSearchPanel->setProgressive( true );
 	mSearchPanel->hide();
-//	mLayout->addItem( mSearchPanel );
-    
-	mListView->setItemPrototype( new DiskListViewItem(this) );
 	connect( mListView, SIGNAL( activated( const QModelIndex & ) ),
 		     this, SLOT( on_list_activated( const QModelIndex & ) ) );
 	connect( mListView, SIGNAL( pressed( const QModelIndex & ) ),
@@ -97,11 +90,8 @@
     connect( mListView, SIGNAL( longPressed( HbAbstractViewItem *, const QPointF & ) ),
         this, SLOT( on_list_longPressed( HbAbstractViewItem *, const QPointF & ) ) );
     
-    connect( mSearchPanel, SIGNAL( searchOptionsClicked() ),
-        this, SLOT( on_searchPanel_searchOptionsClicked() ), Qt::QueuedConnection );
-    
     connect( mSearchPanel, SIGNAL( criteriaChanged( const QString & ) ),
-        this, SLOT( on_searchPanel_criteriaChanged( const QString & ) ) );
+        this, SLOT( on_searchPanel_criteriaChanged( const QString & ) ), Qt::QueuedConnection );
        
     connect( mSearchPanel, SIGNAL( exitClicked() ),
         this, SLOT( on_searchPanel_exitClicked() ) );
@@ -188,19 +178,20 @@
                          this, SLOT( on_setPwdAction_triggered() ), Qt::QueuedConnection );
                     }
                 }
-                
-                // Eject action
-                if( state & FmDriverInfo::EDriveEjectable ){
-                    HbAction *ejectAction = new HbAction();
-                    ejectAction->setObjectName( "ejectAction" );
-                    ejectAction->setText( hbTrId( "txt_fmgr_menu_eject" ) );
-                    mContextMenu->addAction( ejectAction );
-                    
-                    connect( ejectAction, SIGNAL( triggered() ),
-                    this, SLOT( on_ejectAction_triggered() ), Qt::QueuedConnection );
-                }  
-            }
-        }
+            } //if( driveType == FmDriverInfo::EDriveTypeMemoryCard || driveType == FmDriverInfo::EDriveTypeUsbMemory )
+        } //if( state & FmDriverInfo::EDriveAvailable )
+        
+        // Eject action
+        // put outside of EDriveAvailable so that removable drive which is corrupted or locked can be removed
+        if( state & FmDriverInfo::EDriveEjectable ){
+            HbAction *ejectAction = new HbAction();
+            ejectAction->setObjectName( "ejectAction" );
+            ejectAction->setText( hbTrId( "txt_fmgr_menu_eject" ) );
+            mContextMenu->addAction( ejectAction );
+            
+            connect( ejectAction, SIGNAL( triggered() ),
+            this, SLOT( on_ejectAction_triggered() ), Qt::QueuedConnection );
+        } 
         
         // Format action
         if ( ( state & FmDriverInfo::EDriveRemovable ) || ( state & FmDriverInfo::EDriveCorrupted )
@@ -213,10 +204,10 @@
                 connect( formatAction, SIGNAL( triggered() ),
                     this, SLOT( on_formatAction_triggered() ), Qt::QueuedConnection );
         }
-    }
+    } //if( !( state & FmDriverInfo::EDriveNotPresent ) )
     
     // Unlock action
-    // put ouside of !EDriveNotPresent judgement so that
+    // put ouside of !EDriveNotPresent judgment so that
     // user could unlock drive if connected to PC with mass storage mode
     if( state & FmDriverInfo::EDriveLocked ){
         HbAction *unLockedAction = new HbAction();
@@ -239,13 +230,14 @@
 
 void FmDriverListWidget::on_list_pressed( const QModelIndex &  index )
 {
+    Q_UNUSED( index );
     mListLongPressed = false;
 }
 
 void FmDriverListWidget::on_viewAction_triggered()
 {
-    QString diskName = mModel->driveName( mCurrentItem->modelIndex() );
-    mOperationService->asyncViewDriveDetails( diskName );
+    QString diskName = mModel->driveName( mCurrentItem->modelIndex() );    
+    FmViewManager::viewManager()->operationService()->asyncViewDriveDetails( diskName );
 }
 
 void FmDriverListWidget::on_renameAction_triggered()
@@ -408,7 +400,7 @@
     QString diskName = mModel->driveName( mCurrentItem->modelIndex() );
     
     if( FmDlgUtils::question( hbTrId( "Format? Data will be deleted during formatting." ) ) ){
-        if( FmErrNone != mOperationService->asyncFormat( diskName ) )
+        if( FmErrNone != FmViewManager::viewManager()->operationService()->asyncFormat( diskName ) )
             FmDlgUtils::information( hbTrId( "Formatting failed." ) );
         }
 }
@@ -430,31 +422,21 @@
 
 void FmDriverListWidget::activeSearchPanel()
 {
-    QStringList driveList;
-    FmUtils::getDriveList( driveList, true );
-    if(driveList.count() > 0 ) {
-        mFindTargetPath =  driveList.first();
-        if( FmUtils::isDriveC( mFindTargetPath ) ) {
-            mFindTargetPath =  QString( Folder_C_Data );
-        }
-    } else {
-        mFindTargetPath.clear();
-    }
     mLayout->addItem( mSearchPanel );
     mSearchPanel->show();
 }
 
-void FmDriverListWidget::on_searchPanel_searchOptionsClicked()
-{
-    mFindTargetPath = FmUtils::fillPathWithSplash( FmFileDialog::getExistingDirectory( 0, hbTrId( "Look in:" ),
-        QString(""), QStringList() ) );
-}
-
 void FmDriverListWidget::on_searchPanel_criteriaChanged( const QString &criteria )
 {
-    emit startSearch( mFindTargetPath, criteria );
+    emit startSearch( criteria );
     mSearchPanel->hide();
     mLayout->removeItem( mSearchPanel );
+
+    // clear keywords in searchpanel without signal criteriaChanged triggered again
+    mSearchPanel->setProgressive( false );
+    mSearchPanel->setCriteria( QString() );
+    mSearchPanel->setProgressive( true );
+    
 }
 
 void FmDriverListWidget::on_searchPanel_exitClicked()
--- a/filemanager/src/filemanager/src/fmdriverlistwidget.h	Thu Aug 05 11:30:07 2010 +0800
+++ b/filemanager/src/filemanager/src/fmdriverlistwidget.h	Thu Sep 02 17:00:51 2010 +0800
@@ -20,7 +20,6 @@
 #define FMDRIVERLISTWIDGET_H
 
 #include "fmcommon.h"
-#include "fmoperationservice.h"
 #include <hbwidget.h>
 
 class FmDriveModel;
@@ -46,7 +45,7 @@
 
 signals:
 	void activated( const QString &path );
-	void startSearch( const QString &targetPath, const QString &criteria );
+	void startSearch( const QString &criteria );
     
 private slots:
 	void on_list_activated( const QModelIndex &index );
@@ -64,7 +63,6 @@
     void on_ejectAction_triggered();
     void on_directoryChanged( const QString &path );
     
-    void on_searchPanel_searchOptionsClicked();
     void on_searchPanel_criteriaChanged( const QString &criteria );
     void on_searchPanel_exitClicked();
 private:
@@ -76,10 +74,8 @@
     HbAbstractViewItem* mCurrentItem;
     HbSearchPanel* mSearchPanel;
     
-    FmOperationService *mOperationService;
     QFileSystemWatcher *mFileSystemWatcher;
     
-    QString mFindTargetPath;
     QGraphicsLinearLayout *mLayout;
 	HbMenu *mContextMenu;
     
--- a/filemanager/src/filemanager/src/fmdriverview.cpp	Thu Aug 05 11:30:07 2010 +0800
+++ b/filemanager/src/filemanager/src/fmdriverview.cpp	Thu Sep 02 17:00:51 2010 +0800
@@ -20,7 +20,9 @@
 #include "fmdriverlistwidget.h"
 #include "fmviewmanager.h"
 #include "fmcommon.h"
+#include "fmutils.h"
 
+#include <QDir>
 #include <QApplication>
 
 #include <hbmenu.h>
@@ -80,11 +82,11 @@
 void FmDriverView::initDiskListWidget()
 {
     mDriverList = new FmDriverListWidget( this );
-    connect( mDriverList, SIGNAL( activated( const QString& ) ),
-             this, SLOT( activated( const QString& ) ), Qt::QueuedConnection );
+    connect( mDriverList, SIGNAL( activated( QString ) ),
+             this, SLOT( activated( QString ) ), Qt::QueuedConnection );
     
-    connect( mDriverList, SIGNAL( startSearch( const QString&,  const QString& ) ),
-             this, SLOT( startSearch( const QString&, const QString& ) ) );
+    connect( mDriverList, SIGNAL( startSearch( QString ) ),
+        this, SLOT( startSearch( QString ) ) );
     
     setWidget( mDriverList );
 }
@@ -158,10 +160,22 @@
     mDriverList->activeSearchPanel();  
 }
 
-void FmDriverView::startSearch( const QString &targetPath, const QString &criteria )
+void FmDriverView::startSearch( const QString &criteria )
 {    
-    if ( !criteria.isEmpty() && !targetPath.isEmpty() ) {
-        FmViewManager::viewManager()->createFindView( criteria, targetPath );
+    // search all drives when start find in drive view
+    QStringList findTargetPathList;           
+    QStringList driveList;
+    FmUtils::getDriveList( driveList, true );
+    foreach( const QString &drive, driveList ) {
+        QString targetPath =  FmUtils::fillPathWithSplash( drive );
+        if( FmUtils::isDriveC( targetPath ) ) {
+            targetPath =  QString( Folder_C_Data );
+        }
+        findTargetPathList.append( targetPath );
+    }
+
+    if ( !criteria.isEmpty() ) {
+        FmViewManager::viewManager()->createFindView( criteria, findTargetPathList );
     }
 }
 
--- a/filemanager/src/filemanager/src/fmdriverview.h	Thu Aug 05 11:30:07 2010 +0800
+++ b/filemanager/src/filemanager/src/fmdriverview.h	Thu Sep 02 17:00:51 2010 +0800
@@ -44,7 +44,7 @@
 
     void activated( const QString &pathName );
     void refreshDrive();
-    void startSearch( const QString &targetPath, const QString &criteria );
+    void startSearch( const QString &criteria );
 
 #ifdef FM_CHANGE_ORIENT_ENABLE
     void on_rotateAction_triggered();
--- a/filemanager/src/filemanager/src/fmfilebrowsewidget.cpp	Thu Aug 05 11:30:07 2010 +0800
+++ b/filemanager/src/filemanager/src/fmfilebrowsewidget.cpp	Thu Sep 02 17:00:51 2010 +0800
@@ -39,6 +39,8 @@
 #include <hbsearchpanel.h>
 #include <hblabel.h>
 
+#include <shareui.h>
+
 // These define comes from implementation of QFileSystemModel
 #define QFileSystemSortName 0
 #define QFileSystemSortSize 1 
@@ -335,16 +337,18 @@
         this, SLOT( on_renameAction_triggered() ), Qt::QueuedConnection );
     }
     
-//    if( fileInfo.isFile() ){
-//        HbAction *sendAction = new HbAction();
-//        sendAction->setObjectName( "sendAction" );
-//        sendAction->setText( hbTrId( "txt_fmgr_menu_send" ) );
-//        contextMenu->addAction( sendAction );
-//        
-//        connect( sendAction, SIGNAL( triggered() ),
-//        this, SLOT( on_sendAction_triggered() ) );
-//    }
+    if( fileInfo.isFile() ){
+        HbAction *sendAction = new HbAction();
+        sendAction->setObjectName( "sendAction" );
+        sendAction->setText( hbTrId( "txt_fmgr_menu_send" ) );
+        contextMenu->addAction( sendAction );
+        
+        connect( sendAction, SIGNAL( triggered() ),
+        this, SLOT( on_sendAction_triggered() ), Qt::QueuedConnection );
+    }
     
+    // delete itself when close
+    contextMenu->setAttribute(Qt::WA_DeleteOnClose);
     contextMenu->setPreferredPos( coords );
     contextMenu->open();
 }
@@ -427,15 +431,12 @@
 {
     mSearchPanel = new HbSearchPanel( this );
     mSearchPanel->setObjectName( "searchPanel" );
-    mSearchPanel->setSearchOptionsEnabled( true );
-    mSearchPanel->setProgressive( false );
+    mSearchPanel->setSearchOptionsEnabled( false );
+    mSearchPanel->setProgressive( true );
     mSearchPanel->hide();
     
-    connect( mSearchPanel, SIGNAL( searchOptionsClicked() ),
-        this, SLOT( on_searchPanel_searchOptionsClicked() ), Qt::QueuedConnection );
-    
-    connect( mSearchPanel, SIGNAL( criteriaChanged( const QString & ) ),
-        this, SLOT( on_searchPanel_criteriaChanged( const QString & ) ) );
+    connect( mSearchPanel, SIGNAL( criteriaChanged( QString ) ),
+        this, SLOT( on_searchPanel_criteriaChanged( QString ) ), Qt::QueuedConnection );
     
     connect( mSearchPanel, SIGNAL( exitClicked() ),
         this, SLOT( on_searchPanel_exitClicked() ) );
@@ -572,21 +573,16 @@
     mSearchPanel->show();
 }
 
-void FmFileBrowseWidget::on_searchPanel_searchOptionsClicked()
-{
-    mFindTargetPath = FmUtils::fillPathWithSplash( FmFileDialog::getExistingDirectory( 0, hbTrId( "Look in:" ), QString(""),
-        QStringList() ) );
-}
-
 void FmFileBrowseWidget::on_searchPanel_criteriaChanged( const QString &criteria )
 {
-    if( mFindTargetPath.isEmpty() ){
-        mFindTargetPath = currentPath().filePath();
-    }
-    emit startSearch( mFindTargetPath, criteria );
-    
+    emit startSearch( criteria );
     mSearchPanel->hide();
     mLayout->removeItem( mSearchPanel );
+	
+    // clear keywords in searchpanel without signal criteriaChanged triggered again
+    mSearchPanel->setProgressive( false );
+    mSearchPanel->setCriteria( QString() );
+    mSearchPanel->setProgressive( true );
 }
 
 void FmFileBrowseWidget::on_searchPanel_exitClicked()
@@ -600,7 +596,7 @@
     QString filePath = mModel->filePath( mCurrentItem->modelIndex() );
     QStringList list;
     list.append( filePath );
-    FmUtils::sendFiles( list );
+    FmViewManager::viewManager()->shareUi()->send( list, true );
 }
 
 void FmFileBrowseWidget::on_viewAction_triggered()
--- a/filemanager/src/filemanager/src/fmfilebrowsewidget.h	Thu Aug 05 11:30:07 2010 +0800
+++ b/filemanager/src/filemanager/src/fmfilebrowsewidget.h	Thu Sep 02 17:00:51 2010 +0800
@@ -82,13 +82,12 @@
     // triggered when drive is ejected/inserted
     void on_driveChanged();
     
-    void on_searchPanel_searchOptionsClicked();
     void on_searchPanel_criteriaChanged( const QString &criteria );
     void on_searchPanel_exitClicked();
 
 signals:
     void currentPathChanged( const QString& );
-    void startSearch( const QString &targetPath, const QString &criteria );
+    void startSearch( const QString &criteria );
     void setEmptyMenu( bool isMenuEmpty );
     void setTitle( const QString &title );
     void listActivated();
--- a/filemanager/src/filemanager/src/fmfileview.cpp	Thu Aug 05 11:30:07 2010 +0800
+++ b/filemanager/src/filemanager/src/fmfileview.cpp	Thu Sep 02 17:00:51 2010 +0800
@@ -199,12 +199,12 @@
 
 	setLayout( vLayout );
 	
-    connect( mWidget, SIGNAL( startSearch( const QString&,  const QString& ) ),
-             this, SLOT( startSearch( const QString&, const QString& ) ) );
+    connect( mWidget, SIGNAL( startSearch( QString ) ),
+             this, SLOT( startSearch( QString ) ) );
     connect( mWidget, SIGNAL( setEmptyMenu( bool ) ),
              this, SLOT( on_mainWidget_setEmptyMenu( bool ) ) );
-    connect( mWidget, SIGNAL( setTitle( const QString & ) ),
-             this, SLOT( on_mainWidget_setTitle( const QString & ) ) );
+    connect( mWidget, SIGNAL( setTitle( QString ) ),
+             this, SLOT( on_mainWidget_setTitle( QString ) ) );
 }
 
 void FmFileView::initToolBar()
@@ -471,10 +471,11 @@
     mWidget->sortFiles( FmFileBrowseWidget::ESortByType );
 }
 
-void FmFileView::startSearch( const QString &targetPath, const QString &criteria )
+void FmFileView::startSearch( const QString &criteria )
 {    
-    if ( !criteria.isEmpty() && !targetPath.isEmpty() ) {
-        FmViewManager::viewManager()->createFindView( criteria, targetPath );
+    if ( !criteria.isEmpty() ) {
+        QString targetPath( mWidget->currentPath().filePath() );
+        FmViewManager::viewManager()->createFindView( criteria, QStringList()<<targetPath );
     }
 }
 
--- a/filemanager/src/filemanager/src/fmfileview.h	Thu Aug 05 11:30:07 2010 +0800
+++ b/filemanager/src/filemanager/src/fmfileview.h	Thu Sep 02 17:00:51 2010 +0800
@@ -66,7 +66,7 @@
 	void on_sortSizeAction_triggered();
 	void on_sortTypeAction_triggered();
 	
-    void startSearch( const QString &targetPath, const QString &criteria );
+    void startSearch( const QString &criteria );
     void on_mainWidget_setEmptyMenu( bool isMenuEmpty );
     void on_mainWidget_setTitle( const QString &title );
 
--- a/filemanager/src/filemanager/src/fmfindresultmodel.cpp	Thu Aug 05 11:30:07 2010 +0800
+++ b/filemanager/src/filemanager/src/fmfindresultmodel.cpp	Thu Sep 02 17:00:51 2010 +0800
@@ -19,11 +19,21 @@
 #include "fmfindresultmodel.h"
 #include "fmfindthread.h"
 #include "fmfileiconprovider.h"
+#include "fmcommon.h"
 
 #include <QDateTime>
 
 #include <hbglobal.h>
 
+// wait \a circularWaitingTimeForStartFind microsecond to try to start find again
+// Since find can not be started while last find is not stopped.
+const int circularWaitingTimeForStartFind = 200;
+
+// wait \a firstWaitingTimeForStartFind microsecond to start find when accept find from caller.
+// Means user can continuously input words for search, so that find will not immediately start after accept each input event.
+// Search will be started after \a firstWaitingTimeForStartFind time of last user input
+const int firstWaitingTimeForStartFind = 750;
+
 /*!
     \fn void finished()
     This signal is emitted when find is finished.
@@ -39,14 +49,92 @@
 FmFindResultModel::FmFindResultModel( QObject *parent )
     : QAbstractListModel( parent )
 {
+    FM_LOG("FmFindResultModel::FmFindResultModel");
     init();
-    connect( mFindThread, SIGNAL(finished()), this, SIGNAL(finished()) );
+    connect( mFindThread, SIGNAL( finished()), this, SLOT(onThreadFinished()) );
 	connect( mFindThread, SIGNAL(found(QStringList)), this, SLOT(on_findThread_found( QStringList) ), Qt::BlockingQueuedConnection ); 
+    connect( &mTimer, SIGNAL(timeout()), this, SLOT(startFind()));
 }
 
 FmFindResultModel::~FmFindResultModel()
 {
+    FM_LOG("FmFindResultModel::~FmFindResultModel START");
+    mFindThread->stop();
+    if( mFindThread->isRunning() ) {
+        mStopEventLoop.exec();
+    }
 	delete mIconProvider;
+    FM_LOG("FmFindResultModel::~FmFindResultModel END");
+}
+
+/*!
+    Send find \a regExp and \a pathList to find queue
+    last un-stopped find will be stopped and start new find in 0 - 2 seconeds.
+*/
+void FmFindResultModel::find( const QRegExp &regExp, const QStringList &pathList )
+{
+    mFindPath   = pathList;
+    mRegExp     = regExp;
+
+    mTimer.stop();
+
+	if (mFindThread->isRunning()) {
+        mFindThread->stop();
+    }
+    mTimer.start( firstWaitingTimeForStartFind );
+}
+
+/*!
+    Internal start entrance, will be triggered by timer
+    Wait till last find stopped and start new find.
+*/
+void FmFindResultModel::startFind()
+{
+    mTimer.stop();
+    if (mFindThread->isRunning()) {
+        mFindThread->stop();
+        mTimer.start( circularWaitingTimeForStartFind );
+		return;
+    }
+
+    // Find starting. Initialize context.
+    mFindThread->setFindPathList( mFindPath );
+    mFindThread->setPattern( mRegExp );
+	removeRows( 0, rowCount() );
+    emit findStarted();
+    mFindThread->start();
+}
+
+/*!
+    Return if find is inprogress
+*/
+bool FmFindResultModel::isFinding() const
+{
+    return mFindThread->isRunning();
+}
+
+/*!
+    Stop find
+*/
+void FmFindResultModel::stopFind()
+{
+    mFindThread->stop();
+    if( mFindThread->isRunning() ) {
+        mStopEventLoop.exec();
+    }
+}
+
+/*
+    Find finish slot.
+*/
+void FmFindResultModel::onThreadFinished()
+{
+    FM_LOG("FmFindResultModel::onThreadFinished");
+
+    // close event loop so that blocked destructor and stopFind() can be released.
+    mStopEventLoop.exit();
+
+    emit findFinished();
 }
 
 /*!
@@ -67,6 +155,9 @@
     return 0;
 }
 
+/*!
+   Get model column count
+*/
 int FmFindResultModel::columnCount( const QModelIndex &parent ) const
 {
     if ( !parent.isValid() )
@@ -75,6 +166,9 @@
     return 0;
 }
 
+/*!
+   Get model data
+*/
 QVariant FmFindResultModel::data( const QModelIndex &index, int role ) const
 {
     if (!indexValid( index ))
@@ -105,11 +199,17 @@
     return QVariant();
 }
 
+/*!
+   Get filePath by \a index
+*/
 QString FmFindResultModel::filePath ( const QModelIndex & index ) const
 {
    return fileInfo( index ).filePath();
 }
 
+/*!
+   Get header data by column number \a section
+*/
 QVariant FmFindResultModel::headerData( int section, Qt::Orientation orientation, int role ) const
 {
     if (orientation == Qt::Horizontal) {
@@ -184,6 +284,9 @@
 	return true;
 }
 
+/*!
+    Get QFileInfo by \a index
+*/
 QFileInfo FmFindResultModel::fileInfo( const QModelIndex &index ) const
 {
     if (index.row() >= 0 && index.row() < mFindResult.size())
@@ -192,49 +295,6 @@
         return QFileInfo();
 }
 
-QString FmFindResultModel::findPath() const
-{
-    return mFindThread->findPath();
-}
-
-void FmFindResultModel::setFindPath( const QString &path )
-{
-    mFindThread->setFindPath( path );
-}
-
-QRegExp FmFindResultModel::pattern() const
-{
-    return mFindThread->pattern();
-}
-
-void FmFindResultModel::setPattern( const QRegExp &regExp )
-{
-    mFindThread->setPattern( regExp );
-}
-
-void FmFindResultModel::find()
-{
-	if(mFindThread->isRunning())
-		return;
-
-    if( findPath().isEmpty() ){
-        mFindThread->setLastResult( mFindResult );
-    }
-	removeRows( 0, rowCount() );
-    mFindThread->start();
-}
-
-void FmFindResultModel::stop()
-{
-    mFindThread->stop();
-    mFindThread->wait();
-}
-
-bool FmFindResultModel::isFinding() const
-{
-    return mFindThread->isRunning();
-}
-
 /*
     Receive \a dataList as some found result
     Then insert dataList to model
@@ -247,12 +307,23 @@
     insertRows( rowCount(), dataList );
 }
 
+/*
+    Get if \a index is valid
+*/
 bool FmFindResultModel::indexValid( const QModelIndex &index ) const
 {
-    Q_UNUSED( index );
-    return true;
+    if( ( index.row() < 0 ) || ( index.row() >= rowCount() ) ) {
+        return false;
+    } else if( ( index.column() < 0 ) || ( index.column() >= columnCount() ) ) {
+        return false;
+    } else {
+        return true;
+    }
 }
 
+/*
+    Init model
+*/
 void FmFindResultModel::init()
 {
     mFindThread = new FmFindThread( this );
@@ -260,6 +331,9 @@
     mIconProvider = new FmFileIconProvider();
 }
 
+/*
+    Sort by name
+*/
 bool FmFindResultModel::caseNameLessThan(const QPair<QString,int> &s1,
                                          const QPair<QString,int> &s2)
 {
@@ -269,6 +343,9 @@
     return info1.fileName() < info2.fileName();
 }
 
+/*
+    Sort by time
+*/
 bool FmFindResultModel::caseTimeLessThan(const QPair<QString,int> &s1,
                                          const QPair<QString,int> &s2)
 {
@@ -278,6 +355,9 @@
     return info1.lastModified() < info2.lastModified();
 }
 
+/*
+    Sort by size
+*/
 bool FmFindResultModel::caseSizeLessThan(const QPair<QString,int> &s1,
                                          const QPair<QString,int> &s2)
 {
@@ -287,6 +367,9 @@
     return info1.size() < info2.size();
 }
 
+/*
+    Sort by type
+*/
 bool FmFindResultModel::caseTypeLessThan(const QPair<QString,int> &s1,
                                          const QPair<QString,int> &s2)
 {
--- a/filemanager/src/filemanager/src/fmfindresultmodel.h	Thu Aug 05 11:30:07 2010 +0800
+++ b/filemanager/src/filemanager/src/fmfindresultmodel.h	Thu Sep 02 17:00:51 2010 +0800
@@ -25,6 +25,8 @@
 #include <QFileInfo>
 #include <QStringList>
 #include <QAbstractListModel>
+#include <QTimer>
+#include <QEventLoop>
 
 class FmFindThread;
 class FmFileIconProvider;
@@ -57,14 +59,8 @@
 
     QFileInfo fileInfo( const QModelIndex &index ) const;
 
-    QString findPath() const;
-    void setFindPath( const QString &path );
-
-    QRegExp pattern() const;
-    void setPattern( const QRegExp &regExp );
-
-    void find();
-    void stop();
+    void find( const QRegExp &regExp, const QStringList &pathList );
+    void stopFind();
     bool isFinding() const;
 
     virtual void sort ( int column, Qt::SortOrder order = Qt::AscendingOrder );
@@ -79,19 +75,39 @@
                                   const QPair<QString,int> &s2 );
 
 signals:
-    void finished();
+
+    // pass modelCountChanged signal to parent widget
+    // so parent widget could change contentWiget between emptyTipsWidget and listWidget
     void modelCountChanged( int count );
 
+    // emit when start find thread. view can set empty menu for itself(sort).
+    // because sort while search inprogress may cause data synchornous problem in model.
+    void findStarted();
+
+    // emit when finished find thread. view can set normal menu for itself(sort).
+    void findFinished();
+
 private slots:
     void on_findThread_found( const QStringList &dataList );
+    void startFind();
+    void onThreadFinished();
 
 private:
     bool indexValid( const QModelIndex &index ) const;
     void init();
+    
 
     FmFindThread *mFindThread;
     QStringList mFindResult;
     FmFileIconProvider *mIconProvider;
+
+    QStringList mFindPath;
+    QRegExp     mRegExp;
+    bool        mIsFindRequestPending;
+    QTimer      mTimer;
+
+    QEventLoop  mStopEventLoop;
+
 };
 
 #endif
--- a/filemanager/src/filemanager/src/fmfindthread.cpp	Thu Aug 05 11:30:07 2010 +0800
+++ b/filemanager/src/filemanager/src/fmfindthread.cpp	Thu Sep 02 17:00:51 2010 +0800
@@ -17,6 +17,7 @@
  */
 
 #include "fmfindthread.h"
+#include "fmcommon.h"
 
 #include <QDir>
 
@@ -27,10 +28,10 @@
 #define ParentDir QString( ".." )
 
 // if got 5 result and have not send notify event, then send notify event
-#define notifyPerCount 5
+const int notifyPerCount = 5;
 
 // if got notifyPerElapsedTime milliseconds and have not send notify event, then send notify event.
-#define notifyPerElapsedTime 500
+const int notifyPerElapsedTime = 500;
 
 /*!
     \fn void found( const QStringList &dataList )
@@ -38,64 +39,81 @@
     Please connect this signal by Qt::BlockingQueuedConnection as dataList will be cleared immediately
 */
 
+/*!
+    Constructor, set thread LowPriority
+*/
 FmFindThread::FmFindThread( QObject *parent )
     : QThread( parent )
 {
     setPriority( LowPriority );
 }
 
+/*!
+    Destructor
+*/
 FmFindThread::~FmFindThread()
 {
-}
-
-QString FmFindThread::findPath() const
-{
-    return mFindPath;
+    FM_LOG("FmFindThread::~FmFindThread()");
 }
 
-void FmFindThread::setFindPath( const QString &path )
+/*!
+    Set find path list \a pathList
+*/
+void FmFindThread::setFindPathList( const QStringList &pathList )
 {
-    mFindPath = path;
+    mFindPathList.clear();
+    mFindPathList = pathList;
 }
 
-QRegExp FmFindThread::pattern() const
-{
-    return findPattern;
-}
-
+/*!
+    Set find pattern
+*/
 void FmFindThread::setPattern( const QRegExp &regExp )
 {
     findPattern = regExp;
 }
 
+/*!
+    Stop find
+*/
 void FmFindThread::stop()
 {
+    FM_LOG("FmFindThread::stop()");
     mStop = true;
 }
 
+/*
+    Thread function
+*/
 void FmFindThread::run()
 {
+    FM_LOG( "FmFindThread::run() started ");
     mStop = false;
-    tempResultList.clear();
-    if (findPattern.isEmpty() || !findPattern.isValid())
-        return;
-
-    QDir dir( mFindPath );
-    if (!dir.exists())
-        return;
-    
-    if( mFindPath.isEmpty() ){
-        findInResult();
+    if (findPattern.isEmpty() || !findPattern.isValid()) {
+        FM_LOG( "FmFindThread::run() canceled because error param ");
         return;
     }
-
+ 
     QList<QDir> findDirs;
-    findDirs.append( dir );
+    foreach( const QString &path, mFindPathList ) {
+        QDir dir( path );
+        findDirs.append( dir );
+    }
+
+    count = 0;
     time.restart();
     mStop = false;
     while (!findDirs.isEmpty()) {
+        if (mStop) {
+            FM_LOG("FmFindThread::run() stopped");
+            return;
+        }
         QFileInfoList infoList = findDirs.first().entryInfoList();
         for (QFileInfoList::Iterator it = infoList.begin(); it != infoList.end(); ++it) {
+            if (mStop) {
+                FM_LOG("FmFindThread::run() stopped");
+                return;
+            }
 			QString name = it->fileName();
 			QString absolutPath = it->absoluteFilePath();
             if (findPattern.exactMatch( it->fileName() )) {
@@ -107,14 +125,6 @@
                 }
             }
 
-            //We are stopped;
-            if (mStop) {
-                if( tempResultList.count() > 0 ) {
-                    emitFound();
-                }
-                return;
-            }
-
             // exclude directory named ".." and "."
             if (it->isDir() && it->fileName() != ParentDir && it->fileName() != CurrentDir ) {
                 findDirs.append( QDir( it->absoluteFilePath() ) );
@@ -132,42 +142,13 @@
 */
 void FmFindThread::emitFound()
 {
+    if (mStop) {
+        FM_LOG("FmFindThread::emitFound() return because stopped");
+        return;
+    }
     if( tempResultList.count() > 0 ) {
         emit found( tempResultList );
         tempResultList.clear();
         time.restart();
     }
 }
-
-void FmFindThread::setLastResult( QStringList r )
-{
-    mLastResult = r;
-}
-
-/*
-    Find keyword in last result
-    \sa setLastResult, this function must be called to set last result for findInResult
-*/
-void FmFindThread::findInResult()
-{
-    if( mFindPath.isEmpty() ){
-        for (QStringList::Iterator it = mLastResult.begin(); it != mLastResult.end(); ++it) { 
-            if (mStop){
-                return;
-            }
-            QString absolutPath = (*it);
-            QFileInfo fileInfo( absolutPath );
-            QString fileName = fileInfo.fileName();
-            
-            if (findPattern.exactMatch( fileName ) ) {
-                tempResultList.append( absolutPath );
-                if ( tempResultList.count() > notifyPerCount ) {
-                    emitFound();
-                } else if (time.elapsed() > notifyPerElapsedTime && tempResultList.count() > 0) {
-                    emitFound();
-                }
-            }
-        }    
-    }
-    emitFound();
-}
--- a/filemanager/src/filemanager/src/fmfindthread.h	Thu Aug 05 11:30:07 2010 +0800
+++ b/filemanager/src/filemanager/src/fmfindthread.h	Thu Sep 02 17:00:51 2010 +0800
@@ -33,14 +33,9 @@
     explicit FmFindThread( QObject *parent = 0 );
     ~FmFindThread();
 
-    QString findPath() const;
-    void setFindPath( const QString &path );
-
-    QRegExp pattern() const;
+    void setFindPathList( const QStringList &pathList );
     void setPattern( const QRegExp &regExp );
-    
-    void setLastResult( QStringList r );
-
+	
     void stop();
 
 signals:
@@ -51,14 +46,13 @@
 
 private:
     void emitFound();
-    void findInResult();
 
     volatile bool mStop;
     int count;
-    QString mFindPath;
+    QStringList mFindPathList;
     QTime time;
     QRegExp findPattern;
-    QStringList mLastResult;
+
     // Used to store temp search result. if emit found, the result will be cleared.
     QStringList tempResultList;
 };
--- a/filemanager/src/filemanager/src/fmfindview.cpp	Thu Aug 05 11:30:07 2010 +0800
+++ b/filemanager/src/filemanager/src/fmfindview.cpp	Thu Sep 02 17:00:51 2010 +0800
@@ -26,20 +26,17 @@
 #include <hbmenu.h>
 
 FmFindView::FmFindView() : FmViewBase( EFindView ),
-                           mWaitNote( 0 ),
                            mMenu( 0 )
 {
     initMenu();
     initMainWidget();
     initToolBar();
-
+    setTitle( hbTrId("find") );
     QMetaObject::connectSlotsByName( this );
 }
 
 FmFindView::~FmFindView()
 {
-    delete mWaitNote;
-    mWaitNote = 0;
 }
 
 void FmFindView::activated( const QString& pathName )
@@ -48,33 +45,13 @@
     FmViewManager::viewManager()->createFileView( pathName, true, true );
 }
 
-void FmFindView::find( const QString &keyword, const QString &path )
-{
-    setTitle( keyword );
-    mFindWidget->find( keyword, path );
-    mWaitNote->open();
-}
-
-void FmFindView::stopFind()
+void FmFindView::find( const QString &keyword, const QStringList &pathList )
 {
-    mFindWidget->stopFind();
-}
-
-void FmFindView::findFinished()
-{
-    if( mWaitNote ){
-        mWaitNote->close();
-    }
-//    mFindWidget->activeSearchPanel();
+    mFindWidget->find( keyword, pathList );
 }
 
 void FmFindView::initMenu()
 {
-    HbAction *findAction = new HbAction( this );
-    findAction->setObjectName( "findAction" );
-    findAction->setText( hbTrId( "Find" ) );
-    menu()->addAction( findAction ); 
-    
     HbMenu *subMenu = new HbMenu( hbTrId( "Sort" ) );
     
     HbAction *sortNameAction = new HbAction( subMenu );
@@ -99,8 +76,6 @@
     
     menu()->addMenu( subMenu );
     
-    connect( findAction, SIGNAL( triggered() ),
-             this, SLOT( on_findAction_triggered() ) );
     connect( sortNameAction, SIGNAL( triggered() ),
              this, SLOT( on_sortNameAction_triggered() ) );
     connect( sortTimeAction, SIGNAL( triggered() ),
@@ -116,17 +91,9 @@
 void FmFindView::initMainWidget()
 {
     mFindWidget = new FmFindWidget( this );
-    connect( mFindWidget, SIGNAL(finished()), this, SLOT(findFinished()) );
     setWidget( mFindWidget );
 
-    if( !mWaitNote ){
-        mWaitNote = new HbProgressDialog( HbProgressDialog::WaitDialog );
-        mWaitNote->setText( hbTrId( "Finding..." ) );
-    }
-    connect( mWaitNote, SIGNAL(cancelled()), this, SLOT(stopFind()) );
     connect( mFindWidget, SIGNAL(activated( const QString&)), this, SLOT( activated(const QString&)) );
-    connect( mFindWidget, SIGNAL( startSearch( const QString&,  const QString& ) ),
-             this, SLOT( startSearch( const QString&, const QString& ) ) );
     connect( mFindWidget, SIGNAL( setEmptyMenu( bool ) ),
              this, SLOT( on_findWidget_setEmptyMenu( bool ) ) );
 }
@@ -155,18 +122,6 @@
     mFindWidget->sortFiles( FmFindResultModel::Type  );
 }
 
-void FmFindView::startSearch( const QString &targetPath, const QString &criteria )
-{  
-    if ( !criteria.isEmpty( ) ) {
-        find( criteria, targetPath );  
-    }
-}
-
-void FmFindView::on_findAction_triggered()
-{
-    mFindWidget->activeSearchPanel();
-}
-
 void FmFindView::on_findWidget_setEmptyMenu( bool isMenuEmpty )
 {
     if( isMenuEmpty ){
@@ -181,3 +136,8 @@
         }
     }
 }
+
+void FmFindView::aboutToClose()
+{
+    mFindWidget->stopFind();
+}
--- a/filemanager/src/filemanager/src/fmfindview.h	Thu Aug 05 11:30:07 2010 +0800
+++ b/filemanager/src/filemanager/src/fmfindview.h	Thu Sep 02 17:00:51 2010 +0800
@@ -34,22 +34,17 @@
     FmFindView();
     virtual ~FmFindView();
 
-    void find( const QString &keyword, const QString &path );
+    void find( const QString &keyword, const QStringList &pathList );
 
 public slots:
     void activated( const QString &pathName );
-    void stopFind();
-
+    
 private slots:
-    void findFinished();
-    void on_findAction_triggered();
     void on_sortNameAction_triggered();
     void on_sortTimeAction_triggered();
     void on_sortSizeAction_triggered();
     void on_sortTypeAction_triggered();
     
-    void startSearch( const QString &targetPath, const QString &criteria );
-    
     void on_findWidget_setEmptyMenu( bool isMenuEmpty );
     
 private:
@@ -57,8 +52,10 @@
     void initMainWidget();
     void initToolBar();
 
+    // from FmViewBase
+    virtual void aboutToClose();
+
     FmFindWidget *mFindWidget;
-    HbProgressDialog *mWaitNote;
     HbMenu *mMenu;
 };
 
--- a/filemanager/src/filemanager/src/fmfindwidget.cpp	Thu Aug 05 11:30:07 2010 +0800
+++ b/filemanager/src/filemanager/src/fmfindwidget.cpp	Thu Sep 02 17:00:51 2010 +0800
@@ -29,15 +29,20 @@
 #include <hbsearchpanel.h>
 #include <hblabel.h>
 #include <hbwidget.h>
+#include <hbstackedwidget.h>
 
 FmFindWidget::FmFindWidget( QGraphicsItem *parent )
     : HbWidget( parent )
 {
+    FM_LOG("FmFindWidget::FmFindWidget()");
     init();
 }
 
 FmFindWidget::~FmFindWidget()
 {
+    FM_LOG("FmFindWidget::~FmFindWidget() START");
+    delete mModel;
+    FM_LOG("FmFindWidget::~FmFindWidget() END");
 }
 
 void FmFindWidget::itemActivated(const QModelIndex &index)
@@ -55,88 +60,59 @@
     }
 }
 
-void FmFindWidget::find( const QString &keyword, const QString &path )
+void FmFindWidget::find( const QString &keyword, const QStringList &pathList )
 {
-    mModel->setFindPath( path );
-    
-    QRegExp regExp( '*' + keyword + '*' );
-    regExp.setPatternSyntax( QRegExp::Wildcard );
-    regExp.setCaseSensitivity( Qt::CaseInsensitive );
-    mModel->setPattern( regExp );
-
-    mModel->find();
+    mPathList = pathList;
+    // find will auto-start after receive criteria change event.
+    mSearchPanel->setCriteria( keyword );
 }
 
 void FmFindWidget::stopFind()
 {
-    mModel->stop();
-}
-
-void FmFindWidget::on_resultModel_finished()
-{
-    emit finished();
+    mModel->stopFind();
 }
 
 void FmFindWidget::on_resultModel_modelCountChanged( int count )
 {
     if( count > 0 ) {
-        activateContentWidget( ResultListView );
+        mContentWidget->setCurrentWidget( mListView );
     } else {
-        activateContentWidget( EmptyTipWidget );
+        mContentWidget->setCurrentWidget( mEmptyTipWidget );
     }
 }
 
-void FmFindWidget::activateContentWidget( ContentWidgetType contentWidgetType )
+void FmFindWidget::on_resultModel_findStarted()
 {
-    switch( contentWidgetType )
-    {
-    case EmptyTipWidget:
-        {
-        if( mLayout->count() > 0 ) {
-            if( mLayout->itemAt( 0 ) == mListView ) {
-                mLayout->removeItem( mListView );
-                mLayout->addItem( mEmptyTipWidget );
-            } 
-        } else {
-            mLayout->addItem( mEmptyTipWidget );
-        }
-        mListView->hide();
-        mEmptyTipWidget->show();
-        deActiveSearchPanel();
-        emit setEmptyMenu( true );
-        }
-        break;
-    case ResultListView:
-        {
-        if( mLayout->count() > 0 ) {
-            if( mLayout->itemAt( 0 ) == mEmptyTipWidget ) {
-                mLayout->removeItem( mEmptyTipWidget );
-                mLayout->addItem( mListView );
-            } 
-        } else {
-            mLayout->addItem( mListView );
-        }
-        mEmptyTipWidget->hide();
-        mListView->show();
-        activeSearchPanel();
-        emit setEmptyMenu( false );
-        }
-        break;
-    }
+    emit setEmptyMenu( true );
+}
+
+void FmFindWidget::on_resultModel_findFinished()
+{
+    emit setEmptyMenu( false );
 }
 
 void FmFindWidget::init()
 {
     mLayout = new QGraphicsLinearLayout( this );
     mLayout->setOrientation( Qt::Vertical );
+ 
+    mContentWidget = new HbStackedWidget( this );
+    mLayout->addItem( mContentWidget );
+    initSearchPanel();
+    mLayout->addItem( mSearchPanel );
+    setLayout( mLayout );
 
     mModel = new FmFindResultModel( this );
     mModel->setObjectName( "resultModel" );
 
-    connect( mModel, SIGNAL(finished()), this, SLOT( on_resultModel_finished()) );
+    connect( mModel, SIGNAL( modelCountChanged( int )),
+        this, SLOT( on_resultModel_modelCountChanged( int )), Qt::QueuedConnection );
 
-    connect( mModel, SIGNAL( modelCountChanged( int )),
-        this, SLOT( on_resultModel_modelCountChanged( int )) );
+    connect( mModel, SIGNAL( findStarteded()),
+        this, SLOT( on_resultModel_findStarted()) );
+
+    connect( mModel, SIGNAL( findFinished()),
+        this, SLOT( on_resultModel_findFinished()) );
     
     mListView = new HbListView( this );
     mListView->setModel( mModel );
@@ -146,11 +122,10 @@
     HbLabel *emptyTipLable = new HbLabel( hbTrId( "No found files or folders" ), mEmptyTipWidget );
     emptyTipLayout->addItem( emptyTipLable );
  
-    initSearchPanel();
-    activateContentWidget( EmptyTipWidget );
+    mContentWidget->addWidget( mListView );
+    mContentWidget->addWidget( mEmptyTipWidget );
     
-    setLayout( mLayout );
-
+    mContentWidget->setCurrentWidget( mEmptyTipWidget );
     connect( mListView, SIGNAL(activated(QModelIndex)), this, SLOT(itemActivated(QModelIndex)));
 }
 
@@ -158,15 +133,14 @@
 {
     mSearchPanel = new HbSearchPanel( this );
     mSearchPanel->setObjectName( "searchPanel" );
-//    mSearchPanel->setSearchOptionsEnabled( true );
-    mSearchPanel->setProgressive( false );
-    mSearchPanel->hide();
+    mSearchPanel->setSearchOptionsEnabled( false );
+    mSearchPanel->setProgressive( true );
     
     connect( mSearchPanel, SIGNAL( criteriaChanged( const QString & ) ),
-        this, SLOT( on_searchPanel_criteriaChanged( const QString & ) ) );
+        this, SLOT( on_searchPanel_criteriaChanged( const QString & ) ), Qt::QueuedConnection  );
     
     connect( mSearchPanel, SIGNAL( exitClicked() ),
-        this, SLOT( on_searchPanel_exitClicked() ) );
+        this, SLOT( on_searchPanel_exitClicked() ), Qt::QueuedConnection );
 }
 
 void FmFindWidget::sortFiles( FmFindResultModel::SortFlag sortFlag )
@@ -174,29 +148,23 @@
     mModel->sort( sortFlag );
 }
 
-void FmFindWidget::activeSearchPanel()
-{
-    mLayout->addItem( mSearchPanel );
-    mSearchPanel->show();
-}
-
 void FmFindWidget::on_searchPanel_criteriaChanged( const QString &criteria )
 {
-    mFindTargetPath.clear();
-    emit startSearch( mFindTargetPath, criteria );
+    QRegExp regExp;
+    if( !criteria.isEmpty() ) {
+        regExp.setPattern( '*' + criteria + '*' );
+    }
+    // if criteria is empty, then keep regExp empty. find thread will return empty result.
+    
+    regExp.setPatternSyntax( QRegExp::Wildcard );
+    regExp.setCaseSensitivity( Qt::CaseInsensitive );
+
+    mModel->find( regExp, mPathList );
 }
 
 void FmFindWidget::on_searchPanel_exitClicked()
 {
-    mSearchPanel->hide();
-    mLayout->removeItem( mSearchPanel );
-}
-
-void FmFindWidget::deActiveSearchPanel()
-{
-    mSearchPanel->hide();
-    mLayout->removeItem( mSearchPanel );
-
+    FmViewManager::viewManager()->popViewAndShow();
 }
 
 
--- a/filemanager/src/filemanager/src/fmfindwidget.h	Thu Aug 05 11:30:07 2010 +0800
+++ b/filemanager/src/filemanager/src/fmfindwidget.h	Thu Sep 02 17:00:51 2010 +0800
@@ -28,6 +28,7 @@
 class HbListView;
 class HbSearchPanel;
 class HbWidget;
+class HbStackedWidget;
 
 class QGraphicsLinearLayout;
 
@@ -35,26 +36,15 @@
 {
     Q_OBJECT
 public:
-    enum ContentWidgetType
-    {
-        EmptyTipWidget,
-        ResultListView
-    };
     FmFindWidget( QGraphicsItem *parent = 0 );
     ~FmFindWidget();
 
-    void find( const QString &keyword, const QString &path );
+    void find( const QString &keyword, const QStringList &pathList );
     void stopFind();
     void sortFiles( FmFindResultModel::SortFlag sortFlag );
-    
-    void activeSearchPanel();
-    void deActiveSearchPanel();
 
 signals:
-    void finished();
     void activated( const QString &pathName );
-    
-    void startSearch( const QString &targetPath, const QString &criteria );
     void setEmptyMenu( bool isMenuEmpty );
 
 private slots:
@@ -63,13 +53,14 @@
     void on_searchPanel_criteriaChanged( const QString &criteria );
     void on_searchPanel_exitClicked();
 
-    void on_resultModel_finished();
     void on_resultModel_modelCountChanged( int count );
+
+    void on_resultModel_findStarted();
+    void on_resultModel_findFinished();
     
 private:
     void init();
     void initSearchPanel();
-    void activateContentWidget( ContentWidgetType contentWidgetType );
 
 private:
     HbListView          *mListView;
@@ -77,8 +68,16 @@
     HbWidget            *mEmptyTipWidget;
     
     QGraphicsLinearLayout *mLayout;
-    HbSearchPanel* mSearchPanel;
-    QString mFindTargetPath;
+	
+	// used to stack emptytip widget and list view.
+	// only one widget can be shown at the same time.
+    HbStackedWidget  *mContentWidget;
+	
+    HbSearchPanel*  mSearchPanel;
+	
+	// store the find path list
+	// for example, if start find from drive view. All available drive will be used to find
+    QStringList     mPathList;
 };
 
 #endif
--- a/filemanager/src/filemanager/src/fmmainwindow.cpp	Thu Aug 05 11:30:07 2010 +0800
+++ b/filemanager/src/filemanager/src/fmmainwindow.cpp	Thu Sep 02 17:00:51 2010 +0800
@@ -23,11 +23,14 @@
 
 FmMainWindow::FmMainWindow() : mViewManager( 0 ), mFirstViewLoaded( false )
 {
-    connect(this, SIGNAL(viewReady()), this, SLOT(delayedLoading()));
+   // connect(this, SIGNAL(viewReady()), this, SLOT(delayedLoading()));
+    init();
 }
 
 FmMainWindow::~FmMainWindow()
 {
+   //save file manager activity to activity manager.
+    mViewManager->saveActivity();   
     FmViewManager::RemoveViewManager();
 }
 
@@ -48,6 +51,8 @@
     FM_LOG("FmMainWindow::init start");
     mViewManager = FmViewManager::CreateViewManager( this );
     mViewManager->createDriverView();
+    connect(this, SIGNAL(aboutToChangeView(HbView *, HbView *)), 
+            mViewManager, SLOT(onAboutToChangeView(HbView *, HbView *)));
     connect( this, SIGNAL( orientationChanged( Qt::Orientation ) ),
              this, SLOT( onOrientationChanged( Qt::Orientation ) ) );
     
--- a/filemanager/src/filemanager/src/fmviewbase.cpp	Thu Aug 05 11:30:07 2010 +0800
+++ b/filemanager/src/filemanager/src/fmviewbase.cpp	Thu Sep 02 17:00:51 2010 +0800
@@ -44,3 +44,10 @@
     FmViewManager::viewManager()->popViewAndShow();
 }
 
+/*!
+    called when about to close. used to close some resource before deleted.
+ */
+void FmViewBase::aboutToClose()
+{
+
+}
\ No newline at end of file
--- a/filemanager/src/filemanager/src/fmviewbase.h	Thu Aug 05 11:30:07 2010 +0800
+++ b/filemanager/src/filemanager/src/fmviewbase.h	Thu Sep 02 17:00:51 2010 +0800
@@ -47,7 +47,7 @@
     {
         return mViewType;
     }
-     
+    virtual void aboutToClose();
 private slots:
     void on_backAction_triggered();
 	
@@ -56,6 +56,7 @@
     
 private:
     void init();
+
 private:
     TViewType mViewType;
     
--- a/filemanager/src/filemanager/src/fmviewmanager.cpp	Thu Aug 05 11:30:07 2010 +0800
+++ b/filemanager/src/filemanager/src/fmviewmanager.cpp	Thu Sep 02 17:00:51 2010 +0800
@@ -32,9 +32,14 @@
 #include "fmdlgutils.h"
 
 #include <hbview.h>
+#include <hbmainwindow.h>
+#include <hbapplication.h>
+#include <hbactivitymanager.h>
 #include <QFileSystemWatcher>
 #include <QFileInfo>
+#include <QPixmap>
 
+#include <shareui.h>
 
 FmViewManager *FmViewManager::mViewManager = 0;
 
@@ -70,12 +75,9 @@
 	return mDialog;
 }
 
-FmViewManager::FmViewManager( FmMainWindow* mainWindow )
+FmViewManager::FmViewManager( FmMainWindow* mainWindow ) : mOperationService( 0 ), mShareUi( 0 )
 {
     mMainWindow = mainWindow;
-    mOperationService = new FmOperationService( this );
-    mOperationService->setObjectName( "operationService" );
-
     mDriveWatcher = new FmDriveWatcher( this );
     mDriveWatcher->setObjectName( "driveWatcher" );
     mDriveWatcher->startWatch();
@@ -85,7 +87,6 @@
 
 FmViewManager::~FmViewManager(void)
 {
-    
     FmViewBase *view = static_cast<FmViewBase *>( mMainWindow->currentView() );
     while( view ) {
         mMainWindow->removeView( view );
@@ -99,6 +100,9 @@
     mDriveWatcher->cancelWatch();
     delete mDriveWatcher;
     mDriveWatcher = 0;
+    
+    delete mShareUi;
+    mShareUi = 0;
 
 }
 
@@ -123,15 +127,39 @@
 
 FmOperationService *FmViewManager::operationService()
 {
+    if ( !mOperationService ) {
+        mOperationService = new FmOperationService( this );
+        mOperationService->setObjectName( "operationService" );
+    }    
     return mOperationService;
 }
 
+/*
+   return \a shareUi which is used to send files. 
+ */
+ShareUi *FmViewManager::shareUi()
+{
+    if( !mShareUi ) {
+        mShareUi = new ShareUi;
+    }
+    return mShareUi;
+}
+
 void FmViewManager::popViewAndShow()
 {
     FmViewBase *view = static_cast<FmViewBase *>( mMainWindow->currentView() );
     view->setNavigationAction( 0 );
-
-    mMainWindow->removeView( view );   
+    // grap the screen when only the drive view is in view stack.
+    if( viewCount() == 1 ) {
+        mScreenShot = QPixmap::grabWidget(mMainWindow, mMainWindow->rect());
+    }
+    mMainWindow->removeView( view );  
+	// If call QEventLoop in destructor of HbView, it will panic
+	// So add aboutToClose function to do some prepare when view will be closed
+	// for example, close find view while find is inprogress.
+    // stop find thread in destructor of FmFindView(called by delete container->model...)
+    // and use QEventLoop to wait till thread exit.
+    view->aboutToClose();
     delete view;
 
     if( viewCount() < 1 )
@@ -175,11 +203,17 @@
 
     mMainWindow->addView( driverView );
     mMainWindow->setCurrentView( driverView );
+    HbActivityManager* activityManager = qobject_cast<HbApplication*>(qApp)->activityManager();        
+    bool ok = activityManager->removeActivity("FMMemoryStoragesList");
 
     connect( this, SIGNAL( driveSpaceChanged() ), 
         driverView, SLOT( refreshDrive() ) );
+    // Refresh drive view when gaining foreground
+    // ( switch back to filemanager from home screen or any other applications )
+    connect( mMainWindow, SIGNAL( revealed() ), 
+        driverView, SLOT( refreshDrive() ) );
     
-    // use Qt::QueuedConnection becuase synchronous refresh is not work well while
+    // use Qt::QueuedConnection because synchronous refresh is not work well while
     // connected with another OTG device which have more than one external drive in it.
     // File server only give driveChanged event once, but two drive is inserted.
     // Synchronous refresh will miss another drive.
@@ -224,14 +258,17 @@
         this, SLOT( popViewAndShow() ), Qt::QueuedConnection );
 }
 
-void FmViewManager::createFindView( const QString &keyword, const QString &path )
+/*
+    Create fild view and search \a keyword in \a pathList
+*/
+void FmViewManager::createFindView( const QString &keyword, const QStringList &pathList )
 {
     FmFindView *findView= new FmFindView();
     
     mMainWindow->addView( findView );
     mMainWindow->setCurrentView( findView );
 
-    findView->find( keyword, path );
+    findView->find( keyword, pathList );
  }
 
 void FmViewManager::createSplitView()
@@ -302,3 +339,29 @@
 		}
 	}
 }
+
+void FmViewManager::saveActivity()
+{    
+    //grap the screen when current view is drive view.
+    FmDriverView *driveView = qobject_cast<FmDriverView *>(mMainWindow->currentView());
+    if ( ( driveView != 0 ) && ( driveView->viewType() == FmViewBase::EDriverView ) ) {
+        mScreenShot = QPixmap::grabWidget(mMainWindow, mMainWindow->rect());
+    }
+    QVariantHash metadata;
+    metadata.insert("screenshot", mScreenShot);
+    HbActivityManager* activityManager = qobject_cast<HbApplication*>(qApp)->activityManager();     
+    // add the activity to the activity manager
+    bool ok = activityManager->addActivity("FMMemoryStoragesList", QVariant(), metadata);
+    // do not need check return value
+
+}
+
+void FmViewManager::onAboutToChangeView(HbView * oldView, HbView *newView)
+{
+    Q_UNUSED(newView);
+    //grap the screen when oldView is drive view.
+    FmDriverView *driveView = qobject_cast<FmDriverView *>(oldView);
+    if ( ( driveView != 0 ) && ( driveView->viewType() == FmViewBase::EDriverView ) ) {        
+        mScreenShot = QPixmap::grabWidget(mMainWindow, mMainWindow->rect());
+    }
+}
--- a/filemanager/src/filemanager/src/fmviewmanager.h	Thu Aug 05 11:30:07 2010 +0800
+++ b/filemanager/src/filemanager/src/fmviewmanager.h	Thu Sep 02 17:00:51 2010 +0800
@@ -22,6 +22,7 @@
 #include <QObject>
 #include <QList>
 #include "fmcommon.h"
+#include <QPixmap>
 
 class FmMainWindow;
 class HbView;
@@ -31,10 +32,11 @@
 class QFileSystemWatcher;
 class FmDriveWatcher;
 class FmDialog;
+class ShareUi;
 
 /*
  * this class is used to record relationship between dialog and drive name 
- * FmViewManager will auto-close dialog which releated drive is not available again.
+ * FmViewManager will auto-close dialog which related drive is not available again.
  * for example. set name to MMC will pop a dialog, if add the dialog to FmViewManager::addDlgCloseUnit 
  * then after eject MMC, the dialog will be auto-closed by FmViewManager::checkDlgCloseUnit()
  */
@@ -64,19 +66,20 @@
     static void RemoveViewManager();
     static FmViewManager *viewManager();
     FmOperationService *operationService();
+    ShareUi *shareUi();
     
     Qt::Orientation orientation(); 
 
     void createFileView( const QString &path,
-        bool enableBackPathCheck = true, bool disableFind = false );
-    void createFindView( const QString &keyword, const QString &path );
+    bool enableBackPathCheck = true, bool disableFind = false );
+    void createFindView( const QString &keyword, const QStringList &pathList );
     void createDriverView();
     void createSplitView();
 	void createBackupView();
 	void createRestoreView();
     void createDeleteBackupView();
-
-	// add a close unit. this is used to auto-close dialog which releated drive is not available again.
+    void saveActivity();    
+	// add a close unit. this is used to auto-close dialog which related drive is not available again.
 	void addDlgCloseUnit( FmDlgCloseUnit* unit )
 	{
 		FM_LOG( "FmViewManager::addDlgCloseUnit_" + unit->associatedDrives() );
@@ -110,6 +113,8 @@
     // so this is the central controller function
     void on_operationService_notifyFinish( FmOperationBase *operationBase );
     
+    void onAboutToChangeView(HbView * oldView, HbView *newView);
+    
 signals:
     // emit when drive space is changed by some operation inside filemanager.
     void driveSpaceChanged();
@@ -124,7 +129,7 @@
     // when drive is ejected, this function will be called and exam dialogs in mDlgCloseUnitList
     // it will colse dialogs if related drive is not available
 	void checkDlgCloseUnit();
-    
+	    
 private:
      static FmViewManager *mViewManager;
 
@@ -141,6 +146,11 @@
     // used to record some dialogs that related to drive
     // the dialog should be closed in checkDlgCloseUnit if drive is not available 
 	QList<FmDlgCloseUnit*> mDlgCloseUnitList;
+	
+	QPixmap mScreenShot;
+	
+	// used to send files
+    ShareUi *mShareUi;
 };
 
 
--- a/filemanager/src/filemanager/src/listviewitems.cpp	Thu Aug 05 11:30:07 2010 +0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,143 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*     Zhiqiang Yang <zhiqiang.yang@nokia.com>
-*     Steven Yao <steven.yao@nokia.com>
-* 
-* Description:
-*     The source file of the disk list view item
-*
-*/
-#include "listviewitems.h"
-#include "fmutils.h"
-
-#include <QGraphicsLinearLayout>
-
-#include <hblabel.h>
-#include <hbcheckbox.h>
-#include <hbpushbutton.h>
-#include <hbabstractitemview.h>
-
-DiskListViewItem::DiskListViewItem( QGraphicsItem *parent )
-    : HbListViewItem( parent ),
-      mIconLabel( 0 ),
-      mDiskNameLabel( 0 ),
-      mFirstLabel( 0 ),
-      mSecondLabel( 0 ),
-      mCheckBox( 0 ),
-      hLayout( 0 )
-
-{
-    //init();
-}
-
-DiskListViewItem::~DiskListViewItem()
-{
-}
-
-void DiskListViewItem::polish(HbStyleParameters& params)
-{
-    Q_UNUSED(params);
-}
-
-bool DiskListViewItem::canSetModelIndex( const QModelIndex &index ) const
-{
-    Q_UNUSED( index );
-	return true;
-}
-
-
-HbAbstractViewItem *DiskListViewItem::createItem()
-{
-	return new DiskListViewItem( *this );
-}
-
-void DiskListViewItem::updateChildItems()
-{
-    //HbListViewItem::updateChildItems();
-    if( !hLayout ) {
-        init();
-    }
-	QVariant variant = modelIndex().data( Qt::DecorationRole );
-	QIcon icon = qvariant_cast<QIcon>( variant );
-    // FmFileIconProvider in FmDriveModel already handle null icon issue
-    QString displayString = modelIndex().data( Qt::DisplayRole ).toString();
-	QString diskName = modelIndex().data( Qt::UserRole ).toString();
-
-    diskName = FmUtils::fillPathWithSplash( diskName );
-
-	mIconLabel->setIcon( HbIcon( icon ) );
-	
-	FmDriverInfo driverInfo = FmUtils::queryDriverInfo( diskName );
-
-    mDiskNameLabel->setPlainText( displayString );
-	if( driverInfo.driveState() & FmDriverInfo::EDriveAvailable ) {
-		mFirstLabel->setPlainText( hbTrId ( "Size: " ) + FmUtils::formatStorageSize( driverInfo.size() ) );
-		mSecondLabel->setPlainText( hbTrId ( "Free: " ) + FmUtils::formatStorageSize( driverInfo.freeSize() ) );
-	} else if( driverInfo.driveState() & FmDriverInfo::EDriveLocked ) {
-		mFirstLabel->setPlainText( hbTrId ( "Locked" ) );
-		mSecondLabel->setPlainText( QString(" ") );
-	} else if( driverInfo.driveState() & FmDriverInfo::EDriveCorrupted ) {
-		mFirstLabel->setPlainText( hbTrId ( "Corrupted" ) );
-		mSecondLabel->setPlainText( QString(" ") );
-	} else if( driverInfo.driveState() & FmDriverInfo::EDriveNotPresent ) {
-		mFirstLabel->setPlainText( hbTrId ( "Not Ready" ) );
-		mSecondLabel->setPlainText( QString(" ") );
-	}
-
-//    mCheckBox->setCheckState( checkState() );
-}
-
-void DiskListViewItem::setCheckedState( int state )
-{
-	HbAbstractViewItem::setCheckState( static_cast<Qt::CheckState>(state) );
-}
-
-void DiskListViewItem::init()
-{
-    hLayout = new QGraphicsLinearLayout();
-
-	hLayout->setOrientation( Qt::Horizontal );
-	hLayout->addItem(layout());
-	
-	mIconLabel = new HbLabel();
-	mIconLabel->setMinimumWidth(32);
-	hLayout->addItem( mIconLabel );
-	hLayout->setAlignment( mIconLabel, Qt::AlignTop );
-	hLayout->setStretchFactor( mIconLabel, 1 );
-
-	QGraphicsLinearLayout *vLayout = new QGraphicsLinearLayout();
-	vLayout->setOrientation( Qt::Vertical );
-
-	mDiskNameLabel = new HbLabel();
-	mDiskNameLabel->setFontSpec( HbFontSpec( HbFontSpec::Primary ) );
-	vLayout->addItem( mDiskNameLabel );
-	vLayout->setAlignment( mDiskNameLabel, Qt::AlignLeft );
-
-	mFirstLabel = new HbLabel();
-	mFirstLabel->setFontSpec( HbFontSpec( HbFontSpec::Secondary ) );
-	vLayout->addItem( mFirstLabel );
-	vLayout->setAlignment( mFirstLabel, Qt::AlignLeft );
-
-	mSecondLabel = new HbLabel();
-	mSecondLabel->setFontSpec( HbFontSpec( HbFontSpec::Secondary ) );
-	vLayout->addItem( mSecondLabel );
-	vLayout->setAlignment( mSecondLabel, Qt::AlignLeft );
-
-	HbWidget *labelsWidget = new HbWidget();
-	labelsWidget->setLayout(vLayout);
-
-	hLayout->addItem( labelsWidget );
-	hLayout->setStretchFactor( labelsWidget, 5 );
-
-	setLayout( hLayout );
-}
--- a/filemanager/src/filemanager/src/listviewitems.h	Thu Aug 05 11:30:07 2010 +0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,85 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*     Zhiqiang Yang <zhiqiang.yang@nokia.com>
-* 
-* Description:
-*     The header file of the disk list view item
-*
-*/
-
-#ifndef LISTVIEWITEMS_H
-#define LISTVIEWITEMS_H
-
-#include "fmcommon.h"
-
-#include <hblistviewitem.h>
-
-class HbCheckBox;
-class HbLabel;
-class QGraphicsLinearLayout;
-
-class DiskListViewItem : public HbListViewItem
-{
-    Q_OBJECT
-
-public:
-    DiskListViewItem( QGraphicsItem *parent = 0 );
-    ~DiskListViewItem();
-
-    virtual bool canSetModelIndex( const QModelIndex &index ) const;
-    virtual HbAbstractViewItem *createItem();
-    virtual void updateChildItems();
-private slots:
-	void setCheckedState( int state );
-
-private:
-    virtual void polish(HbStyleParameters& params);
-
-private:
-    void init();
-
-    HbLabel *mIconLabel;
-    HbLabel *mDiskNameLabel;
-    HbLabel *mFirstLabel;
-    HbLabel *mSecondLabel;
-    HbCheckBox *mCheckBox;
-    QGraphicsLinearLayout *hLayout;
-};
-
-/* not used
-class FileListViewItem : public HbListViewItem
-{
-	Q_OBJECT
-
-public:
-    FileListViewItem( QGraphicsItem *parent = 0 );
-    ~FileListViewItem();
-
-    virtual bool canSetModelIndex( const QModelIndex &index ) const;
-    virtual HbAbstractViewItem *createItem();
-    virtual void updateChildItems();
-
-    virtual void polish(HbStyleParameters& params);
-private slots:
-	void setCheckedState( int state );
-
-private:
-    void init();
-
-    HbLabel *mIconLabel;
-    HbLabel *mNameLabel;
-    HbCheckBox *mCheckBox;
-};
-*/
-
-#endif //LISTVIEWITEMS_H
--- a/filemanager/src/filemanager/src/main.cpp	Thu Aug 05 11:30:07 2010 +0800
+++ b/filemanager/src/filemanager/src/main.cpp	Thu Sep 02 17:00:51 2010 +0800
@@ -23,23 +23,23 @@
 #include "fmmainwindow.h"
 
 #include <hbapplication.h>
-
+#include <hbstyleloader.h>
+#include <hbtranslator.h>
 #include <QTranslator>
 #include <QLocale>
 
 int main( int argc, char *argv[] )
 {
     FM_LOG( "main start" );
-    HbApplication app( argc, argv );
-
-    QTranslator translator;
-    QString lang = QLocale::system().name(); 
-    QString path = "z:/resource/qt/translations/"; 
-    translator.load( path + "filemanager_" + lang );
-    app.installTranslator(&translator);
-
+    HbApplication app( argc, argv );  
+    
+    HbTranslator translator("filemanager");
+    translator.loadCommon();    
     app.setApplicationName( hbTrId("txt_fmgr_title_file_manager") );
     
+    HbStyleLoader::registerFilePath(":/resources/hblistviewitem.css");    
+    HbStyleLoader::registerFilePath(":/resources/hblistviewitem.widgetml");                                                
+    
     FM_LOG( "main_createMainwindow start" );
     FmMainWindow mw;
     FM_LOG( "main_createMainwindow end" );
--- a/filemanager/src/filemanager/src/operationservice/fmoperationbase.cpp	Thu Aug 05 11:30:07 2010 +0800
+++ b/filemanager/src/filemanager/src/operationservice/fmoperationbase.cpp	Thu Sep 02 17:00:51 2010 +0800
@@ -107,9 +107,12 @@
 /*
   Constructs a backup operation with
   \a parent parent
+  \a targetDrive backup target drive
+  backup \a content is mask for contents want to backup. Refer to mContent in FmBackupSettings
 */
-FmOperationBackup::FmOperationBackup( QObject *parent )
-    : FmOperationBase( parent, FmOperationService::EOperationTypeBackup )
+FmOperationBackup::FmOperationBackup( QObject *parent, const QString &targetDrive, quint32 content )
+    : FmOperationBase( parent, FmOperationService::EOperationTypeBackup ),
+      mTargetDrive( targetDrive ), mContent( content )
 {
 }
 
@@ -122,6 +125,22 @@
 }
 
 /*
+  Get target backup drive
+*/
+QString FmOperationBackup::targetDrive() const 
+{
+    return mTargetDrive;
+}
+
+/*
+  Get backup content mask. Refer to mContent in FmBackupSettings
+*/
+quint32 FmOperationBackup::content() const
+{
+    return mContent;
+}
+
+/*
   Constructs a restore operation with
   \a parent parent
   \a selection the selected backup items
@@ -141,7 +160,7 @@
 /*
   Returns the backup items
 */
-quint64 FmOperationRestore::selection()
+quint64 FmOperationRestore::selection() const
 {
     return mSelection;
 }
--- a/filemanager/src/filemanager/src/operationservice/fmoperationbase.h	Thu Aug 05 11:30:07 2010 +0800
+++ b/filemanager/src/filemanager/src/operationservice/fmoperationbase.h	Thu Sep 02 17:00:51 2010 +0800
@@ -52,18 +52,29 @@
 
 class FmOperationBackup : public FmOperationBase
 {
+Q_OBJECT
 public:
-    explicit FmOperationBackup( QObject *parent );
+    explicit FmOperationBackup( QObject *parent, const QString &targetDrive, quint32 content );
     virtual ~FmOperationBackup();
+    
+    QString targetDrive() const;
+    quint32 content() const ;
+private:
+    // used to save backup target drive
+    QString mTargetDrive;
+    
+    // used to save FmBackupSettings::content()
+    quint32 mContent;
 };
 
 class FmOperationRestore : public FmOperationBase
 {
+Q_OBJECT
 public:
     explicit FmOperationRestore( QObject *parent, quint64 selection );
     virtual ~FmOperationRestore();
 
-    quint64 selection();
+    quint64 selection() const;
 private:
     quint64                 mSelection;
 };
--- a/filemanager/src/filemanager/src/operationservice/fmoperationcopyormove.cpp	Thu Aug 05 11:30:07 2010 +0800
+++ b/filemanager/src/filemanager/src/operationservice/fmoperationcopyormove.cpp	Thu Sep 02 17:00:51 2010 +0800
@@ -100,12 +100,11 @@
     mCopiedOrMovedSize  = 0;
     mCurrentStep = 0;
 
-    if( mSourceList.empty() ) {
+    if ( mSourceList.empty() ) {
         emit notifyError( FmErrWrongParam, mErrString );    
         return ;
     }
-
-    emit notifyPreparing( true );
+	emit notifyPreparing( true );
 
     int numofFolders = 0;
     int numofFiles      = 0;
@@ -115,8 +114,11 @@
     if( ret != FmErrNone ) {
         emit notifyError( ret, mErrString );
         return;        
-    }
-
+    }    
+    if ( !targetHasEnoughSpace() ) {
+        emit notifyError( FmErrDiskFull, mErrString );
+        return;
+        }    
     emit notifyStart( true, mTotalSteps );
 
     foreach( const QString& source, mSourceList ) {
@@ -210,6 +212,13 @@
     int ret = FmErrNone;
     
     if ( fi.isFile() ) {
+        if ( FmUtils::getDriveLetterFromPath( source ) == 
+                FmUtils::getDriveLetterFromPath( targetPath ) && 
+                operationType() == FmOperationService::EOperationTypeMove ) 
+            {
+            return FmUtils::moveInsideDrive( source, newName );
+            
+            }
         quint64 fileSize = fi.size();
         ret = copyOneFile( source, newName );
         if (ret != FmErrNone) {
@@ -364,7 +373,7 @@
 }
 
 /*
- * Copys one file from \a srcFile to \a desFile
+ * Copies one file from \a srcFile to \a desFile
  */
 int FmOperationCopyOrMove::copyOneFile( const QString &srcFile, const QString &desFile )
 {
@@ -424,3 +433,14 @@
     }
 }
 
+bool FmOperationCopyOrMove::targetHasEnoughSpace()
+{
+    QString sourceDrive = FmUtils::getDriveLetterFromPath( mSourceList.front() );
+    QString targetDrive = FmUtils::getDriveLetterFromPath( mTargetPath );
+    if ( sourceDrive == targetDrive &&
+            operationType() == FmOperationService::EOperationTypeMove ) {
+        return true;
+    } else {
+        return FmUtils::hasEnoughSpace( targetDrive, mTotalSize );
+    }
+}
--- a/filemanager/src/filemanager/src/operationservice/fmoperationcopyormove.h	Thu Aug 05 11:30:07 2010 +0800
+++ b/filemanager/src/filemanager/src/operationservice/fmoperationcopyormove.h	Thu Sep 02 17:00:51 2010 +0800
@@ -46,6 +46,7 @@
     void increaseProgress( quint64 size );
     void queryForRename( const QString &srcFile, QString *destFile );
     int copyOneFile( const QString &srcFile, const QString &desFile );
+    bool targetHasEnoughSpace();
 
 private:
     FmOperationService *mOperationService;
--- a/filemanager/src/filemanager/src/operationservice/fmoperationformat_win.cpp	Thu Aug 05 11:30:07 2010 +0800
+++ b/filemanager/src/filemanager/src/operationservice/fmoperationformat_win.cpp	Thu Sep 02 17:00:51 2010 +0800
@@ -54,13 +54,13 @@
  * Starts to format.
  * \a isStopped not used
  */
-void FmOperationFormat::start( volatile bool */*isStopped*/ );
+void FmOperationFormat::start( volatile bool */*isStopped*/ )
 { 
     QString logString = "FmOperationFormat::start";
     FM_LOG( logString );
     
     if( mDriverName.isEmpty() ) {
-        emit notifyError( FmErrWrongParam );
+        emit notifyError( FmErrWrongParam, QString() );
         return;
     }
     int totalCount( 100 );
--- a/filemanager/src/filemanager/src/operationservice/fmoperationresultprocesser.cpp	Thu Aug 05 11:30:07 2010 +0800
+++ b/filemanager/src/filemanager/src/operationservice/fmoperationresultprocesser.cpp	Thu Sep 02 17:00:51 2010 +0800
@@ -18,6 +18,9 @@
 #include "fmoperationbase.h"
 #include "fmoperationservice.h"
 #include "fmoperationformat.h"
+#include "fmbkupengine.h"
+#include "fmbackupsettings.h"
+#include "fmbackuprestorehandler.h"
 #include "fmoperationviewdetails.h"
 #include "fmviewdetailsdialog.h"
 #include "fmdlgutils.h"
@@ -314,25 +317,63 @@
     {
         case FmErrCancel:
             cancelProgress();
-            FmDlgUtils::information( QString( hbTrId("Operation Canceled!") ) );
+            // Do not pop up general cancel note as it is not needed( according to TB9.2 ).
+            // If it should be added later, please do not use blocking note. 
+            // Blocking note will cause second backup operaion freeze after cancel previous backup operation
+            // as QEventLoop::exec will cause some problem when used for blocking dialog.
+			// HbDialog has already removed exec function which is implemented with QEventLoop::exec.
+			// If need use QEventLoop::exec to block code execute sequence, It should be invoked in a Qt::QueuedConnection slot.
             return;
         case FmErrAlreadyStarted:
             FmDlgUtils::information( QString( hbTrId("Operation already started!")) );
             return;
         case FmErrLocked:
-            FmDlgUtils::information( QString( hbTrId("Operation failed because drive is locked!")) );
-            return;
+            {
+                FmOperationBackup *operationBackup = qobject_cast<FmOperationBackup*>(operationBase);
+                if( operationBackup ) {
+                    // special error note for backup
+                    QString targetDrive( operationBackup->targetDrive() );
+                    QString defaultDriveVolume( FmUtils::getDefaultVolumeName( targetDrive ) );
+                    QString driveString( defaultDriveVolume.isEmpty()? targetDrive:defaultDriveVolume );
+                    FmDlgUtils::information( QString( hbTrId("txt_fmgr_info_backup_locked") ).arg( driveString ) );
+                } else {
+                    FmDlgUtils::information( QString( hbTrId("Operation failed because drive is locked!")) );
+                }
+                return;
+            }
         case FmErrPathNotFound:
             FmDlgUtils::information( QString( hbTrId("Operation failed because can not find target path or drive is not available!") ) );
             return;
         case FmErrCorrupt:
-            FmDlgUtils::information( QString( hbTrId("Operation failed because target media is corrupted!") ) );
-            return;
+            {
+                FmOperationBackup *operationBackup = qobject_cast<FmOperationBackup*>(operationBase);
+                if( operationBackup ) {
+                    // special error note for backup
+                    QString targetDrive( operationBackup->targetDrive() );
+                    QString defaultDriveVolume( FmUtils::getDefaultVolumeName( targetDrive ) );
+                    QString driveString( defaultDriveVolume.isEmpty()? targetDrive:defaultDriveVolume );
+                    FmDlgUtils::information( QString( hbTrId("txt_fmgr_info_backup_corrupted") ).arg( driveString ) );
+                } else {
+                    FmDlgUtils::information( QString( hbTrId("Operation failed because target media is corrupted!") ) );
+                }
+                return;
+            }
         case FmErrNotReady: // Caused when MMC & OTG is not inserted when start backup
-            FmDlgUtils::information( QString( hbTrId("Operation failed because device is not ready!") ) );
-            return;
-        case FmErrDisMounted: // Caused by eject MMC when preparing backup
-            FmDlgUtils::information( QString( hbTrId("Operation failed because device has been removed!") ) );
+            {
+                FmOperationBackup *operationBackup = qobject_cast<FmOperationBackup*>(operationBase);
+                if( operationBackup ) {
+                    // special error note for backup
+                    QString targetDrive( operationBackup->targetDrive() );
+                    QString defaultDriveVolume( FmUtils::getDefaultVolumeName( targetDrive ) );
+                    QString driveString( defaultDriveVolume.isEmpty()? targetDrive:defaultDriveVolume );
+                    FmDlgUtils::information( QString( hbTrId("txt_fmgr_info_backup_unavailable") ).arg( driveString ) );
+                } else {
+                    FmDlgUtils::information( QString( hbTrId("Operation failed because device is not ready!") ) );
+                }
+                return;
+            }
+        case FmErrDisMounted: // Caused by eject MMC when preparing backup, will be localized later
+            FmDlgUtils::information( QString( hbTrId("Operation failed because backup target drive has been removed!") ) );
             return;
         case FmErrDiskFull:
             FmDlgUtils::information( QString( hbTrId("Not enough space. Operation cancelled!")) );
@@ -414,6 +455,7 @@
 //        mNote->setProgressDialogType( HbProgressDialog::WaitNote );
 //    }
     mNote->setText( title );
+    //KRAZY: ignore krazy warning because QAction must be used.
     QList<QAction *> actionList = mNote->actions();
     if (actionList.size() > 0) {        
         QAction *cancelAction = actionList.at(0);
@@ -453,6 +495,7 @@
     mNote->setMaximum( 65535 );
     mNote->setProgressValue( 0 );
     mNote->setText( title );
+    //KRAZY: ignore krazy warning because QAction must be used.
     QList<QAction *> actionList = mNote->actions();
     if (actionList.size() > 0) {        
         QAction *cancelAction = actionList.at(0);
@@ -493,6 +536,7 @@
     mNote->setMaximum( maxValue );
 
     mNote->setProgressValue( 0 );
+    //KRAZY: ignore krazy warning because QAction must be used.
     QList<QAction *> actionList = mNote->actions();
     if (actionList.size() > 0) {        
         QAction *cancelAction = actionList.at(0);
--- a/filemanager/src/filemanager/src/operationservice/fmoperationservice.cpp	Thu Aug 05 11:30:07 2010 +0800
+++ b/filemanager/src/filemanager/src/operationservice/fmoperationservice.cpp	Thu Sep 02 17:00:51 2010 +0800
@@ -20,6 +20,7 @@
 #include "fmoperationthread.h"
 #include "fmbackupconfigloader.h"
 #include "fmbkupengine.h"
+#include "fmbackupsettings.h"
 #include "fmviewdetailsdialog.h"
 #include "fmoperationresultprocesser.h"
 #include "fmoperationcopyormove.h"
@@ -65,13 +66,10 @@
  * Constructs one operation Service with \a parent.
  */
 FmOperationService::FmOperationService( QObject *parent ) : QObject( parent ),
-        mCurrentOperation( 0 )
+        mCurrentOperation( 0 ), mBackupRestoreHandler( 0 )
 {
     mThread = new FmOperationThread( this );
     mThread->setObjectName( "operationThread" );
-    mBackupRestoreHandler = new FmBackupRestoreHandler( this );
-    mBackupRestoreHandler->setObjectName( "backupRestore" ) ;
-
     mOperationResultProcesser = new FmOperationResultProcesser( this );
     
     QMetaObject::connectSlotsByName( this );
@@ -83,7 +81,9 @@
 FmOperationService::~FmOperationService()
 {
     delete mThread;    
+    mThread = 0;
     delete mBackupRestoreHandler;
+    mBackupRestoreHandler = 0;
 }
 
 /*
@@ -95,7 +95,7 @@
 }
 
 /*
- * Copys the file or foler \a targetPath asynchronously. 
+ * Copies the file or foler \a targetPath asynchronously. 
  */
 int FmOperationService::asyncCopy( const QStringList &sourceList, const QString &targetPath )
 {    
@@ -204,7 +204,11 @@
         return FmErrAlreadyStarted;
     Q_ASSERT( !mCurrentOperation );
 
-    FmOperationBackup *operationBackup = new FmOperationBackup( mBackupRestoreHandler );
+    // BackupSettingsL will not leave, coding convention will be improvied in another task.
+    QString targetDrive( backupRestoreHandler()->bkupEngine()->BackupSettingsL()->availableTargetDrive() );
+    quint32 content( backupRestoreHandler()->bkupEngine()->BackupSettingsL()->content() );
+    FmOperationBackup *operationBackup = 
+            new FmOperationBackup( backupRestoreHandler(), targetDrive, content );
     mCurrentOperation = operationBackup;
     int ret = backupRestoreHandler()->startBackup( operationBackup );
     if( ret ){
@@ -242,7 +246,7 @@
  */
 int FmOperationService::syncDeleteBackup( quint64 selection )
 {
-    return mBackupRestoreHandler->deleteBackup( selection );
+    return backupRestoreHandler()->deleteBackup( selection );
 }
 
 /*
@@ -325,7 +329,8 @@
 FmBackupRestoreHandler *FmOperationService::backupRestoreHandler()
 {
     if( !mBackupRestoreHandler ) {
-        mBackupRestoreHandler = new FmBackupRestoreHandler( this );
+        mBackupRestoreHandler = new FmBackupRestoreHandler( this );        
+        mBackupRestoreHandler->setObjectName( "backupRestore" ) ;
         QMetaObject::connectSlotsByName( this );
     }
     return mBackupRestoreHandler;
--- a/filemanager/src/fmfiledialog/fmfiledialog.pro	Thu Aug 05 11:30:07 2010 +0800
+++ b/filemanager/src/fmfiledialog/fmfiledialog.pro	Thu Sep 02 17:00:51 2010 +0800
@@ -28,8 +28,8 @@
             -lshareui \
             -lefsrv \
             -lapgrfx \
-	    -lcone \
-            -ldirectorylocalizer
+            -lcone \
+            -lsysutil
             
     TARGET.UID3 = 0x2002BCC3
 
--- a/filemanager/src/fmfiledialog/src/fmfilewidget.cpp	Thu Aug 05 11:30:07 2010 +0800
+++ b/filemanager/src/fmfiledialog/src/fmfilewidget.cpp	Thu Sep 02 17:00:51 2010 +0800
@@ -96,7 +96,7 @@
 {
     FM_LOG("FmFileWidget::on_list_activated start" );
     if( mCurrentModel == mDriveModel ) {
-    //If currenty model is DriveModel, open drive and set path
+    //If current model is DriveModel, open drive and set path
         QString driveName = mDriveModel->driveName( mActivatedModelIndex );
         QString checkedPath = FmUtils::checkDriveToFolderFilter( driveName );
         if( checkedPath.isEmpty() ) {
@@ -113,7 +113,7 @@
         FM_LOG("FmFileWidget::on_list_activated finish emit pathChanged" );
     }
     else if( mCurrentModel == mFileSystemModel ) {
-    //If currenty model is FileSystemModel, open path or emit file activate signal.
+    //If current model is FileSystemModel, open path or emit file activate signal.
         if ( mFileSystemModel->isDir( mActivatedModelIndex ) ) {
             FM_LOG("FmFileWidget::on_list_activated start changeRootIndex" );
             changeRootIndex( mActivatedModelIndex );
@@ -221,7 +221,7 @@
     QString path( FmUtils::checkFolderToDriveFilter( currentPath().absoluteFilePath() ) );
     QFileInfo fileInfo( path );
     QString cdUpPath;
-    // path length>3 means currenty path is a sub folder, then get up level path and navigate to it
+    // path length>3 means current path is a sub folder, then get up level path and navigate to it
     // Otherwise means current path is a top level drive path, Should navigate to drive view. So setRootPath with empty path string.
     if( path.length() > 3 ) {
         cdUpPath = fileInfo.dir().absolutePath();
--- a/filemanager/src/inc/commonutils.pri	Thu Aug 05 11:30:07 2010 +0800
+++ b/filemanager/src/inc/commonutils.pri	Thu Sep 02 17:00:51 2010 +0800
@@ -23,7 +23,8 @@
 INTERNAL_SOURCES += $$PWD/fmdrivemodel.cpp \
                     $$PWD/fmfileiconprovider.cpp \
                     $$PWD/fmdrivewatcher/fmdrivewatcher.cpp \
-                    $$PWD/fmfiletyperecognizer.cpp
+                    $$PWD/fmfiletyperecognizer.cpp \
+                    $$PWD/fmutils.cpp
 
 symbian {
     INTERNAL_HEADERS += $$PWD/fms60utils.h \
--- a/filemanager/src/inc/fmcommon.h	Thu Aug 05 11:30:07 2010 +0800
+++ b/filemanager/src/inc/fmcommon.h	Thu Sep 02 17:00:51 2010 +0800
@@ -22,26 +22,11 @@
 // MACRO for enable actions for change orientation
 // #define FM_CHANGE_ORIENT_ENABLE
 
-// MACRO for launch find view quickly from driver view and search "b" in "c:\ruby"
-//#define _DEBUG_SPEED_FINDVIEW_
-
-// #define _DEBUG_ENABLE_FORMATMENU_
-
+// MACRO for enable debug log
+// #define _DEBUG_LOG_ENABLE_
 
-// MARCO for hide d, z, folder except C:\data in windows for debug
-//#define _DEBUG_HIDE_VIEWFOLDER_WINDOWS_
-
-//#define _DEBUG_LOG_ENABLE_
-
-//used to test drive hide which drive could be listed but not available
-// #define _DEBUG_DISABLE_DRIVE_D_TEST_DRIVEHIDE_
-
-//used to test locked drive
-// #define _DEBUG_LOCKED_DRIVE_Z
 
 #include "fmlogger.h"
 #include "fmdefine.h"
 
-
-
 #endif
--- a/filemanager/src/inc/fmdefine.h	Thu Aug 05 11:30:07 2010 +0800
+++ b/filemanager/src/inc/fmdefine.h	Thu Sep 02 17:00:51 2010 +0800
@@ -67,6 +67,8 @@
 
 // define  contact data path for view details.
 #define FmViewDetail_Contacts ( "\\private\\10003a73\\SQLite__Contacts.cdb" )
+// define message data path for view details
+#define FmViewDetail_Messages ( "\\private\\1000484b\\Mail2" )
 
 #define FmMaxLengthofDriveName           11
 #define FmMaxLengthofDrivePassword       8
@@ -77,13 +79,13 @@
 // used to match un-empty string, and is not totally empty characters.
 #define Regex_ValidUnEmpty QString( "^.*[^\\s].*$" )
 
-// this is regexp for vaild file/folder name: no \/:*?"<>| and is not totally empty characters.
+// this is regexp for valid file/folder name: no \/:*?"<>| and is not totally empty characters.
 // file name can not end with "." , but it is not include in this RegExp. It should be checked in Regex_ValidNotEndWithDot
 // this expression is composed by two expressions:
 // ^.*[^\\s].*$  used to match un-empty string and is not totally empty characters.
 // [^\\\\/:*?\"<>|] used to math valid file/folder name
 // merge the two regex together:
-// vaild file/folder name and is not totally empty.
+// valid file/folder name and is not totally empty.
 #define Regex_ValidFileFolderName QString( "^[^\\\\/:*?\"<>|]*[^\\\\/:*?\"<>|\\s][^\\\\/:*?\"<>|]*$" )
 
 // is not end with dot( trim blank characters in the end first )
--- a/filemanager/src/inc/fmdrivemodel.cpp	Thu Aug 05 11:30:07 2010 +0800
+++ b/filemanager/src/inc/fmdrivemodel.cpp	Thu Sep 02 17:00:51 2010 +0800
@@ -84,10 +84,7 @@
 
     if (role == Qt::DisplayRole ) {
        return displayString( index );
-    } else if (role == Qt::UserRole ) {
-       return driveName( index );
-    }
-
+    } 
     if (index.column() == 0) {
         if (role == Qt::DecorationRole ) {
             QString path = driveName( index );
@@ -139,17 +136,39 @@
     return data;
 }
 
-QString FmDriveModel::displayString( const QModelIndex &index ) const
+QVariant FmDriveModel::displayString( const QModelIndex &index ) const
 {
-    QString data;
+    QStringList data;
     if (index.row() >= 0 && index.row() < mDriveList.size()) {
         int row = index.row();
         QString diskName = mDriveList[ row ];
 
         if( mOptions & FillWithVolume ) {
-            data = FmUtils::fillDriveVolume( diskName, mOptions & FillWithDefaultVolume );
+            data << FmUtils::fillDriveVolume( diskName, mOptions & FillWithDefaultVolume );
         } else {
-            data = FmUtils::removePathSplash( diskName );
+            data << FmUtils::removePathSplash( diskName );
+        }
+        diskName = FmUtils::fillPathWithSplash( diskName );
+        FmDriverInfo driverInfo = FmUtils::queryDriverInfo( diskName );
+        if ( mOptions & FillWithTotalSize ) {                    
+            if( driverInfo.driveState() & FmDriverInfo::EDriveAvailable ) {
+                data << QString( hbTrId ( "Size: " ) + FmUtils::formatStorageSize( driverInfo.size() ) );                
+            } else if( driverInfo.driveState() & FmDriverInfo::EDriveLocked ) {
+                data << QString( hbTrId ( "Locked" ) );                
+            } else if( driverInfo.driveState() & FmDriverInfo::EDriveCorrupted ) {
+                data << QString( hbTrId ( "Corrupted" ) );                
+            } else if( driverInfo.driveState() & FmDriverInfo::EDriveNotPresent ) {
+                data << QString( hbTrId ( "Not Ready" ) );                
+            }            
+        }
+        if ( mOptions & FillWithFreeSize ) {        
+            if( driverInfo.driveState() & FmDriverInfo::EDriveAvailable ) {                
+                data << QString( hbTrId ( "Free: " ) + FmUtils::formatStorageSize( driverInfo.freeSize() ) );
+            } else if( ( driverInfo.driveState() & FmDriverInfo::EDriveLocked ) ||
+                    ( driverInfo.driveState() & FmDriverInfo::EDriveCorrupted ) ||
+                    ( driverInfo.driveState() & FmDriverInfo::EDriveNotPresent )) {                
+                data << QString( QString(" ") );
+            }            
         }
     }
     return data;
--- a/filemanager/src/inc/fmdrivemodel.h	Thu Aug 05 11:30:07 2010 +0800
+++ b/filemanager/src/inc/fmdrivemodel.h	Thu Sep 02 17:00:51 2010 +0800
@@ -51,9 +51,11 @@
 public:
     enum Option
     {
-        FillWithVolume        = 0x00000001, // add volume behind disname
-        FillWithDefaultVolume = 0x00000002, // add default diskname while enable FillWithVolume and volume is empty
-        HideUnAvailableDrive  = 0x00000004  // for example: drive F when no MMC card inserted.
+        FillWithVolume        = 0x00000001,  // add volume behind disname
+        FillWithDefaultVolume = 0x00000002,  // add default diskname while enable FillWithVolume and volume is empty
+        HideUnAvailableDrive  = 0x00000004,  // for example: drive F when no MMC card inserted.
+        FillWithTotalSize     = 0x00000008,  // show the drive's total size.
+        FillWithFreeSize      = 0x00000010   //show the drive's free size.
     };
     Q_DECLARE_FLAGS(Options, Option)
 
@@ -68,7 +70,7 @@
     QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const;
     bool indexValid( const QModelIndex &index ) const;
     QString driveName( const QModelIndex &index ) const;
-    QString displayString( const QModelIndex &index ) const;
+    QVariant displayString( const QModelIndex &index ) const;
     
 private:
     QStringList         mFindResult;
--- a/filemanager/src/inc/fmdrivewatcher/private/symbian/fmdriveevent.cpp	Thu Aug 05 11:30:07 2010 +0800
+++ b/filemanager/src/inc/fmdrivewatcher/private/symbian/fmdriveevent.cpp	Thu Sep 02 17:00:51 2010 +0800
@@ -18,8 +18,8 @@
 
 
 // INCLUDE FILES
+#include "fmdriveevent.h"
 #include <e32std.h>
-#include "fmdriveevent.h"
 #include "fmcommon.h"
 
 #include <aknnotewrappers.h> 
--- a/filemanager/src/inc/fmfileiconprovider.cpp	Thu Aug 05 11:30:07 2010 +0800
+++ b/filemanager/src/inc/fmfileiconprovider.cpp	Thu Sep 02 17:00:51 2010 +0800
@@ -38,7 +38,7 @@
 #define usbMemoryIcon   "qtg_large_usb_memory"
 
 //TODO: UI_Update: mmcl locked icon have not provided in icon spec
-// Just use orignal custom-defined icon
+// Just use original custom-defined icon
 #define mmcLockedIcon   ":image/qgn_prop_mmc_locked.svg"
 
 
@@ -95,10 +95,10 @@
                 case FmDriverInfo::EDriveTypePhoneMemory:
                     retIcon = HbIcon( phoneMemoryIcon ).qicon();
                     break;
-                default:
-                    Q_ASSERT_X( false, "FmFileIconProvider::icon", "please handle drive type");
+                case FmDriverInfo::EDriveTypeNotExist: // drive not exist, let QFileIconProvider to judge icon
+                default:  // filemanger do not provide icon for other drive types, let QFileIconProvider to judge icon
                     break;
-                }
+               }
             break;
             }
         case FmFileTypeRecognizer::FileTypeFolder:
@@ -167,8 +167,6 @@
         }
     
     // if cannot get icon, return icon from QFileIconProvider
-    // this will be mostly used in win32 platform,
-    // because path for HbIcon only existed in hb theme of symbian 
     if( retIcon.isNull() ) {
         retIcon = QFileIconProvider::icon( info );
     }
--- a/filemanager/src/inc/fmfiletyperecognizer.h	Thu Aug 05 11:30:07 2010 +0800
+++ b/filemanager/src/inc/fmfiletyperecognizer.h	Thu Sep 02 17:00:51 2010 +0800
@@ -16,8 +16,8 @@
  *      The header file of the file type recognizer
  */
 
-#ifndef FMFILERECOGNIZER_H
-#define FMFILERECOGNIZER_H
+#ifndef FMFILETYPERECOGNIZER_H
+#define FMFILETYPERECOGNIZER_H
 
 #include "fmcommon.h"
 #include <QString>
@@ -63,5 +63,5 @@
     QMap<QString, FileType>     mFileExtensionMap;
 };
 
-#endif /* FMDRIVEDETAILSTYPE_H */
+#endif /* FMFILETYPERECOGNIZER_H */
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/filemanager/src/inc/fmutils.cpp	Thu Sep 02 17:00:51 2010 +0800
@@ -0,0 +1,412 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*     Zhiqiang Yang <zhiqiang.yang@nokia.com>
+* 
+* Description:
+*     The source file of the file manager utilities
+*/
+
+#include "fmutils.h"
+
+#include <QDir>
+#include <QFileInfo>
+
+#include <hbglobal.h>
+
+/*!
+    Used to get drive type for convenience.
+*/
+FmDriverInfo::DriveType FmDriverInfo::driveType()
+{
+    FmDriverInfo::DriveType driveType;
+    if( mDriveState & FmDriverInfo::EDriveRemovable ) {
+        // if drive is removable, it may be mass, usb, or remote drive
+        if( mDriveState & FmDriverInfo::EDriveMassStorage ) {
+            driveType = FmDriverInfo::EDriveTypeMassStorage;
+        } else if( mDriveState & FmDriverInfo::EDriveUsbMemory ) {
+            driveType = FmDriverInfo::EDriveTypeUsbMemory;
+        } else if( mDriveState & FmDriverInfo::EDriveRemote ){
+            driveType = FmDriverInfo::EDriveTypeRemote;
+        } else {
+            driveType = FmDriverInfo::EDriveTypeMemoryCard;
+        }
+    } else if( mDriveState & FmDriverInfo::EDriveRom ) {
+        driveType = FmDriverInfo::EDriveTypeRom;
+    } else if( mDriveState & FmDriverInfo::EDriveRam ) {
+        driveType = FmDriverInfo::EDriveTypeRam;
+    } else {
+        // if drive type is not recognized in previous condition,
+        // it should be an un-existed drive or phone memory
+        if( mDriveState & EDriveNotPresent ){
+            // if come here, means 2 conditions:
+            //  1 this drive is not exist( FmUtils::queryDriverInfo will give EDriveNotPresent to mDriveState )
+            //  2 un-mounted removable drive
+            // removable drive filted in previous condifiton. So, give EDriveTypeNotExist 
+            driveType = FmDriverInfo::EDriveTypeNotExist;
+        } else {
+            // drive is existed, only remain the type of EDriveTypePhoneMemory
+            driveType = FmDriverInfo::EDriveTypePhoneMemory;
+        }
+    }
+    
+    return driveType;
+}
+
+/*!
+    return drive name for \a path
+*/
+QString FmUtils::getDriveNameFromPath( const QString &path )
+{
+    // fillPathWithSplash make sure path length will be at least 3 if it is not empty.
+    QString checkedPath( fillPathWithSplash( path ) );
+    if( checkedPath.length() < 3 ) {
+        return QString();
+    }
+    return checkedPath.left( 3 );
+}
+
+/*!
+    return drive letter for \a path
+*/
+QString FmUtils::getDriveLetterFromPath( const QString &path )
+{
+	if( path.length() <2 ) {
+        return QString();
+    }
+    return path.left( 1 );
+}
+
+/*!
+    return formatted string for size.
+*/
+QString FmUtils::formatStorageSize( quint64 size )
+{
+	if ( size < 1000 ) {
+		return QString::number( size ) + " B";
+	} else if ( size < 1000 * 1000 ) {
+		return QString::number( size / 1024.0, 'f', 2 ) + " KB";
+	} else if ( size < 1000 * 1000 * 1000 ) {
+		return QString::number( size / (1024.0 * 1024.0), 'f', 1 ) + " MB";
+	} else {
+	    return QString::number( size / ( 1024.0 * 1024.0 * 1024.0 ), 'f', 1 ) + " GB";	    
+	}
+}
+
+/*!
+    Judge if a path is drive path, not a folder or a file.
+    For example, true for C:\ while false for C:\data
+*/
+bool FmUtils::isDrive( const QString &path )
+{
+   bool ret( false );
+   if( path.length() <= 3 && path.length() >=2 ) {
+       ret = true;
+   }
+   
+   return ret;   
+}
+
+/*!
+    All "/" and "\" in \a path will be changed to QDir::separator
+    \sa fillPathWithSplash, fillPathWithSplash will append QDir::separator in the end
+*/
+QString FmUtils::formatPath( const QString &path  )
+{
+    QString formatPath;
+    if( path.isEmpty() ) {
+        return formatPath;
+    }
+    
+    foreach( const QChar &ch, path ) {
+        if( ch == QChar('\\') || ch == QChar('/') ) {
+            formatPath.append( QDir::separator() );
+        } else {
+            formatPath.append( ch );
+        }
+    }
+
+    return formatPath;
+}
+
+/*!
+    Fill splash in the end of \a filePath. And all "/" and "\" will be changed to QDir::separator
+    Please do not call this function if path is a file.
+    Use \a formatPath instead, \a formatPath will not append QDir::separator in the end.
+    \sa formatPath only changed "/" and "\" to QDir::separator
+*/
+QString FmUtils::fillPathWithSplash( const QString &filePath )
+{
+    QString newFilePath;
+    if( filePath.isEmpty() ) {
+        return newFilePath;
+    }
+
+    newFilePath = formatPath( filePath );
+    
+    if( newFilePath.right( 1 )!= QDir::separator() ){
+        newFilePath.append( QDir::separator() );
+    }
+    return newFilePath;
+}
+
+/*!
+    Remove splash in the end of \a filePath.
+*/
+QString FmUtils::removePathSplash( const QString &filePath )
+{
+    QString newFilePath( filePath );
+    if( filePath.right( 1 ) == QChar( '/' ) || filePath.right(1) == QString( "\\" ) ) {
+        newFilePath = filePath.left( filePath.length() - 1 );
+    }
+    return newFilePath;
+}
+
+/*!
+    fill \a driveList of drives can be shown in driveListView
+*/
+void FmUtils::getDriveList( QStringList &driveList, bool isHideUnAvailableDrive )
+{
+    if( isHideUnAvailableDrive ) {
+        FM_LOG( QString( "getDriveList HideUnAvailableDrive_true" ) );
+    } else {
+        FM_LOG( QString( "getDriveList HideUnAvailableDrive_false" ) );
+    }
+    QFileInfoList infoList = QDir::drives();
+
+    foreach( const QFileInfo &fileInfo, infoList ) {
+        QString driveName = fileInfo.absolutePath();
+        if( checkDriveAccessFilter( driveName ) ) {
+            if( !isHideUnAvailableDrive ) {
+                driveList.append( driveName );
+            }
+            else if ( isDriveAvailable( driveName ) ) {
+                driveList.append( driveName );
+            }
+        }
+    }
+    return;
+}
+
+/*!
+    return the combined string of drive name and volume( e.g. C: Phone memory for C drive)
+    \a driveName the drive name.
+    If set \a isFillWithDefaultVolume true, fill result with default volume if drive volume is empty.
+*/
+QString FmUtils::fillDriveVolume( QString driveName, bool isFillWithDefaultVolume )
+{
+    QString ret;
+    if( driveName.isEmpty() ) {
+        return ret;
+    }
+    QString tempDriveName = fillPathWithSplash( driveName );
+
+    QString checkedDriveName( removePathSplash( driveName ) );
+    
+    FmDriverInfo driverInfo = FmUtils::queryDriverInfo( tempDriveName );
+    QString volumeName = driverInfo.volumeName();
+    
+    if( volumeName.isEmpty() && isFillWithDefaultVolume ){
+        switch ( driverInfo.driveType() )
+            {
+            case FmDriverInfo::EDriveTypeMassStorage:
+                ret = hbTrId( "txt_fmgr_dblist_1_mass_storage" ).arg( checkedDriveName );
+                break;
+            case FmDriverInfo::EDriveTypeUsbMemory:
+                ret = hbTrId( "txt_fmgr_dblist_1_usb_memory" ).arg( checkedDriveName );
+                break;
+            case FmDriverInfo::EDriveTypeMemoryCard:
+                ret = hbTrId( "txt_fmgr_dblist_1_memory_card" ).arg( checkedDriveName );
+                break;
+            case FmDriverInfo::EDriveTypePhoneMemory:
+                ret = hbTrId( "txt_fmgr_dblist_1_device_memory" ).arg( checkedDriveName );
+                break;
+            case FmDriverInfo::EDriveTypeNotExist:// no such drive
+            default:// do not need get volume for other drive types, e.g. Ram, Rom
+                break;
+            }    
+    }
+    
+    if( ret.isEmpty() ) {
+        // ret is not got. fill ret as default method
+        // txt_fmgr_dblist_1_2 is not correct, can not use.
+        ret = hbTrId( "%1 %2" ).arg( checkedDriveName ).arg( volumeName );
+    }
+    return ret;
+}
+
+/*!
+    return the default volume for drive
+    \a driveName the drive.
+    \sa getVolumeNameWithDefaultNameIfNull
+*/
+QString FmUtils::getDefaultVolumeName( const QString &driveName )
+{
+    QString defaultVolumeName;
+    FmDriverInfo driverInfo = FmUtils::queryDriverInfo( driveName );
+          
+    switch ( driverInfo.driveType() )
+        {
+        case FmDriverInfo::EDriveTypeMassStorage:
+            defaultVolumeName = hbTrId("Mass storage"); 
+            break;
+        case FmDriverInfo::EDriveTypeUsbMemory:
+            defaultVolumeName = hbTrId("USB memory"); 
+            break;
+        case FmDriverInfo::EDriveTypeMemoryCard:
+            defaultVolumeName = hbTrId("Memory card");
+            break;
+        case FmDriverInfo::EDriveTypePhoneMemory:
+            defaultVolumeName = hbTrId("Device memory");
+            break;
+        case FmDriverInfo::EDriveTypeNotExist:// no such drive, break and return empty string
+        default:// do not have default volume for other drive types, e.g. Ram, Rom
+            break;
+        }   
+    return defaultVolumeName;
+}
+
+/*!
+    get the volume name of the drive, if it is null, then return the default name.
+    \a driveName the drive letter.
+    \a defaultName whether it is the default name.
+    return the volume name.
+*/
+QString FmUtils::getVolumeNameWithDefaultNameIfNull( const QString &driveName, bool &defaultName )
+{
+    // do not re-use FmUtils::getDefaultVolumeName to save one time for call FmUtils::queryDriverInfo
+    FmDriverInfo driverInfo = FmUtils::queryDriverInfo( driveName );
+          
+    QString volumeName = driverInfo.volumeName();    
+    //save the volume status, whether it is default name
+    defaultName = false;
+    //volume name may be null if not set, it will be set at least for one time in the following while cycling.
+    if ( volumeName.isEmpty() ) {
+        switch ( driverInfo.driveType() )
+            {
+            case FmDriverInfo::EDriveTypeMassStorage:
+                volumeName = hbTrId("Mass storage"); 
+                break;
+            case FmDriverInfo::EDriveTypeUsbMemory:
+                volumeName = hbTrId("USB memory"); 
+                break;
+            case FmDriverInfo::EDriveTypeMemoryCard:
+                volumeName = hbTrId("Memory card");
+                break;
+            case FmDriverInfo::EDriveTypePhoneMemory:
+                volumeName = hbTrId("Device memory");
+                break;
+            case FmDriverInfo::EDriveTypeNotExist:// no such drive
+            default:// do not need get volume for other drive types, e.g. Ram, Rom
+                break;
+            }   
+        if( !volumeName.isEmpty() ) {
+             defaultName = true;
+        }
+    }
+    return volumeName;
+}
+
+/*!
+    Check if two path are the same.
+*/
+bool FmUtils::isPathEqual( const QString &pathFst, const QString &pathLast )
+{
+    QString fst( fillPathWithSplash( pathFst ) );
+    QString last( fillPathWithSplash( pathLast ) );
+    if( fst.compare( last, Qt::CaseInsensitive ) == 0 ) {
+        return true;
+    }
+    return false;
+}
+
+/*!
+    Check if a name is illegal for folder/file naming rule.
+*/
+bool FmUtils::checkFolderFileName( const QString& name )
+{
+    // trim space firest, because there may be some spaces after "." ,  it is also not valid
+    QString trimmedName( name.trimmed() );
+	if( trimmedName.isEmpty() ) {
+		return false;
+	}
+    if( trimmedName.endsWith( QChar('.'),  Qt::CaseInsensitive ) ) {
+        return false;
+    }
+    if( trimmedName.contains( QChar('\\'), Qt::CaseInsensitive ) ||
+        trimmedName.contains( QChar('/'),  Qt::CaseInsensitive ) ||
+        trimmedName.contains( QChar(':'),  Qt::CaseInsensitive ) ||
+        trimmedName.contains( QChar('*'),  Qt::CaseInsensitive ) ||
+        trimmedName.contains( QChar('?'),  Qt::CaseInsensitive ) ||
+        trimmedName.contains( QChar('\"'), Qt::CaseInsensitive ) ||
+        trimmedName.contains( QChar('<'),  Qt::CaseInsensitive ) ||
+        trimmedName.contains( QChar('>'),  Qt::CaseInsensitive ) ||
+        trimmedName.contains( QChar('|'),  Qt::CaseInsensitive ) ){
+        return false;
+    }
+    // use original name to exam max size of file name
+    if( name.length() > getMaxFileNameLength() ) {
+        return false;
+    }
+    return true;
+}
+
+/*!
+    check file or folder path is illegal or not.
+    \a fileName file/folder name, used to check illegal characters
+    \a path file/folder path, used to check if path is available to use.
+    \a errString if return false, errString will be set for error note.
+    return true for not illegal and false for illegal path.
+*/
+bool FmUtils::checkNewFolderOrFile( const QString &fileName, const QString &path, QString &errString )
+{
+    // first check if fileName is valid, then check if path length is valid, and check if file/foler is existed at last
+    QFileInfo fileInfo( path );
+    bool ret( true );   
+    if (!FmUtils::checkFolderFileName( fileName ) ) {
+        errString = hbTrId( "Invalid file or folder name!" );
+        ret = false;
+    } else if( !FmUtils::checkMaxPathLength( path ) ) {
+        errString = hbTrId( "the path you specified is too long!" );
+        ret = false;
+    } else if (fileInfo.exists()) {
+        errString = hbTrId( "%1 already exist!" ).arg( fileInfo.fileName() );
+        ret = false;
+    }
+    return ret;
+}
+
+/*!
+    Check if \a dest is sub level path of \a src
+    Used to check True/False when copy a folder to itself or its subfolder
+    For example, c:\data\test is sub path of c:\data.
+    But c:\data123\test is not sub path of c:\data.
+    So after got right part of path, the first char must be \ or /
+*/
+bool FmUtils::isSubLevelPath( const QString &src, const QString &dest )
+{
+    FM_LOG("FmUtils::isSubFolder: src=" + src + " dest=" + dest);
+    QString checkedSrc( FmUtils::fillPathWithSplash( src ) );
+    QString checkedDest( FmUtils::fillPathWithSplash( dest ) );
+    
+    if( checkedDest.contains( checkedSrc, Qt::CaseInsensitive) &&
+            checkedDest.length() > checkedSrc.length() ) {
+        // for example c:\data\ vs c:\data\123\ 
+        FM_LOG("FmUtils::isSubFolder: true");
+        return true;
+    }
+    // for example c:\data\ vs c:\data\ 
+    // for example c:\data\ vs c:\data123\ 
+
+    FM_LOG("FmUtils::isSubFolder: false");
+    return false;
+}
--- a/filemanager/src/inc/fmutils.h	Thu Aug 05 11:30:07 2010 +0800
+++ b/filemanager/src/inc/fmutils.h	Thu Sep 02 17:00:51 2010 +0800
@@ -23,6 +23,10 @@
 
 #include <QString>
 
+/*!
+    \class FmDriverInfo
+    \brief The class FmDriverInfo provide drive info data
+ */
 class FmDriverInfo
 {
 public:
@@ -58,6 +62,7 @@
     */
     enum DriveType
     {
+        EDriveTypeNotExist = -1, // specified drive is not existed in device
         EDriveTypeRom,
         EDriveTypeRam,
         EDriveTypePhoneMemory,
@@ -85,13 +90,36 @@
         this->mDriveState = rhs.mDriveState;
         return *this;
     }
-
+    
+    /*!
+        Total size for drive
+    */
     quint64 size() const { return mSize; }
+    
+    /*!
+        Free size for drive
+    */
     quint64 freeSize() const { return mFreeSize; }
+    
+    /*!
+        path for drive
+    */
     QString name() const { return mName; }
+    
+    /*!
+        volume for drive
+    */
     QString volumeName() const { return mVolumeName; }
+    
+    /*!
+        status for drive
+    */
     DriveState driveState() const { return mDriveState; }
-    FmDriverInfo::DriveType driveType();
+    
+    /*!
+        drive type
+    */
+    DriveType driveType();
     
 private:
     quint64 mSize;
@@ -103,70 +131,79 @@
 };
 Q_DECLARE_OPERATORS_FOR_FLAGS( FmDriverInfo::DriveState )
 
+/*!
+    \class FmUtils
+    \brief The class FmUtils provide util functions
+    This class is implemented by three parts:
+    fmutils.cpp for Qt Based functions
+    fmutils_s60.cpp is symbian implement version for platform based functions
+    fmutils_win.cpp is win32 implement version for platform based functions( a simple wrapper )
+ */
 class FmUtils
 {
 public:
-    static QString getDriveNameFromPath( const QString &path );
-	static QString getDriveLetterFromPath( const QString &path );
+    //////////////////////////////////////////////////////////////////
+    // <QtBasedFunctions>
+    static QString  getDriveNameFromPath( const QString &path );
+    static QString  getDriveLetterFromPath( const QString &path );
+    static QString  formatStorageSize( quint64 size );
+    static bool     isDrive( const QString &path );
+    static QString  formatPath( const QString &path  );
+    static QString  fillPathWithSplash( const QString &filePath );
+    static QString  removePathSplash( const QString &filePath );
+    static void     getDriveList( QStringList &driveList, bool isHideUnAvailableDrive );
+    static QString  fillDriveVolume( QString driveName, bool isFillWithDefaultVolume );
+    static QString  getDefaultVolumeName( const QString &driveName );
+    static QString  getVolumeNameWithDefaultNameIfNull( const QString &diskName, bool &defaultName );
+    static bool     isPathEqual( const QString &pathFst, const QString &pathLast );
+    static bool     checkFolderFileName( const QString& name );
+    static bool     checkNewFolderOrFile( const QString& fileName, const QString &path, QString &errString );
+    static bool     isSubLevelPath( const QString &src, const QString &dest );
+    // </QtBasedFunctions>
+    //////////////////////////////////////////////////////////////////
+    
+    
+    //////////////////////////////////////////////////////////////////
+    // <platformBasedFunctions>
     static FmDriverInfo queryDriverInfo( const QString &driverName );
-    static QString formatStorageSize( quint64 size );
-    static int removeDrivePwd( const QString &driverName, const QString &Pwd );
-    static int unlockDrive( const QString &driverName, const QString &Pwd );
-    static int checkDrivePwd( const QString &driverName, const QString &pwd);
-    static int setDrivePwd( const QString &driverName, const QString &oldPwd, const QString &newPwd);
-    static void emptyPwd( QString &pwd );
-    static int renameDrive( const QString &driverName, const QString &newVolumeName);
-    static int ejectDrive( const QString &driverName );
-    static QString getFileType( const QString &filePath  );
-    static quint64 getDriveDetailsResult( const QString &folderPath, const QString &extension );
-    static bool isDriveC( const QString &driverName );
-    static bool isDrive( const QString &path );
-	static void createDefaultFolders( const QString &driverName );
-    static QString fillPathWithSplash( const QString &filePath );
-    static QString removePathSplash( const QString &filePath );
-    static QString formatPath( const QString &path  );
-    static bool checkDriveAccessFilter( const QString &driveName );
-    static QString checkDriveToFolderFilter( const QString &path );
-    static QString checkFolderToDriveFilter( const QString &path );
-    static int isPathAccessabel( const QString &path );
-    static bool isDriveAvailable( const QString &path );
-    static bool isPathEqual( const QString &pathFst, const QString &pathLast );
-
-    /// fill driveList of drives can be shown in driveListView
-    static void getDriveList( QStringList &driveList, bool isHideUnAvailableDrive );
-    static QString fillDriveVolume( QString driveName, bool isFillWithDefaultVolume );
-
-    static int launchFile( const QString &filePath );
-    static void sendFiles( QStringList &filePathList );
-    static QString getBurConfigPath( QString appPath );
-    static bool isDefaultFolder( const QString &folderPath  );
-    static QString Localize( const QString &path );
+    
+    // password related functions
+    static int      removeDrivePwd( const QString &driverName, const QString &Pwd );
+    static int      unlockDrive( const QString &driverName, const QString &Pwd );
+    static int      checkDrivePwd( const QString &driverName, const QString &pwd);
+    static int      setDrivePwd( const QString &driverName, const QString &oldPwd, const QString &newPwd);
+    static void     emptyPwd( QString &pwd );
+    
+    // external drive related functions
+    static int      renameDrive( const QString &driverName, const QString &newVolumeName);
+    static int      ejectDrive( const QString &driverName );
+    
+    // drive security related functions
+    static bool     checkDriveAccessFilter( const QString &driveName );
+    static QString  checkDriveToFolderFilter( const QString &path );
+    static QString  checkFolderToDriveFilter( const QString &path );
+    static int      isPathAccessabel( const QString &path );
+    static bool     isDriveAvailable( const QString &path );
     
-    static int getMaxFileNameLength();
-    static bool checkMaxPathLength( const QString& path );
-    static bool checkFolderFileName( const QString& name );
-    
-    /**
-     * check file or folder path is illegal or not.
-     *
-	 * @param  fileName file/folder name, used to check illegal characters
-     * @param  path file/folder path, used to check if path is available to use.
-     * @param  errString if return false, errString will be set for error note.
-     * @return true for not illegal and false for illegal path.
-     */
-    static bool checkNewFolderOrFile( const QString& fileName, const QString &path, QString &errString );
-    
-    /*
-     * get the volume name of the disk, if it is null, then return the default name.
-     * @param diskName the driver letter.
-     * @param defaultName whether it is the default name.
-     * @return the volume name.
-     */
-    static QString getVolumeNameWithDefaultNameIfNull( const QString &diskName, bool &defaultName );
-
-    static bool isSubLevelPath( const QString &src, const QString &dest );
-
-	static int setFileAttributes( const QString &srcFile, const QString &desFile ); 
+    // system default folder related functions
+    static bool     isDefaultFolder( const QString &folderPath  );
+    static void     createDefaultFolders( const QString &driverName );
+    static QString  localize( const QString &path );
+        
+    // copy move related functions
+    static int      setFileAttributes( const QString &srcFile, const QString &desFile );
+    static bool     hasEnoughSpace( const QString &targetDrive, qint64 size );
+    static int      moveInsideDrive( const QString &source, const QString &target );
+	
+    // other fucntions
+    static int      launchFile( const QString &filePath );
+    static QString  getBurConfigPath( QString appPath );
+    static QString  getFileType( const QString &filePath  );
+    static bool     isDriveC( const QString &driverName );
+    static int      getMaxFileNameLength();
+    static bool     checkMaxPathLength( const QString& path );
+    // </platformBasedFunctions>
+    //////////////////////////////////////////////////////////////////
 };
 
 #endif
--- a/filemanager/src/inc/fmutils_s60.cpp	Thu Aug 05 11:30:07 2010 +0800
+++ b/filemanager/src/inc/fmutils_s60.cpp	Thu Sep 02 17:00:51 2010 +0800
@@ -13,99 +13,56 @@
 *     Zhiqiang Yang <zhiqiang.yang@nokia.com>
 * 
 * Description:
-*     The source file of the file manager utilities
+*     The source file of the file manager utilities on Symbian
 */
 
 
 #include "fmutils.h"
+#include "fmcommon.h"
 #include "fms60utils.h"
-#include "fmcommon.h"
 
-#include <QRegExp>
-
+#include <apgcli.h>
+#include <sysutil.h>
+#include <f32file.h>
 #include <coemain.h>
+#include <pathinfo.h>
 #include <driveinfo.h>
 #include <e32property.h>
 #include <coreapplicationuisdomainpskeys.h>
-#include <f32file.h>
-#include <apgcli.h>
-#include <pathinfo.h>
-#include <CDirectoryLocalizer.h>
-#include <XQConversions>
-#include <QStringList>
-#include <QFileInfoList>
+
 #include <QDir>
 #include <QFile>
-#include <QIODevice>
-#include <XQConversions>
-#include <hbglobal.h>
+#include <QRegExp>
+#include <QStringList>
+#include <QFileInfoList>
 
+#include <xqappmgr.h>
+#include <XQConversions>
 #include <xqaiwrequest.h>
-#include <xqappmgr.h>
 
-#include <shareui.h>
+#include <hbglobal.h>
+#include <hbdirectorynamelocalizer.h>
 
 #define BURCONFIGFILE  "z:/private/2002BCC0/burconfig.xml"
 
-
 /*!
-    Used to get drive type for convenience.
+    query drive info and status for \a driveName
+    return \a FmDriverInfo
 */
-FmDriverInfo::DriveType FmDriverInfo::driveType()
+FmDriverInfo FmUtils::queryDriverInfo( const QString &driveName )
 {
-    FmDriverInfo::DriveType driveType;
-    if( mDriveState & FmDriverInfo::EDriveRemovable ) {
-        if( mDriveState & FmDriverInfo::EDriveMassStorage ) {
-            driveType = FmDriverInfo::EDriveTypeMassStorage;
-        } else if( mDriveState & FmDriverInfo::EDriveUsbMemory ) {
-            driveType = FmDriverInfo::EDriveTypeUsbMemory;
-        } else if( mDriveState & FmDriverInfo::EDriveRemote ){
-            driveType = FmDriverInfo::EDriveTypeRemote;
-        } else {
-            driveType = FmDriverInfo::EDriveTypeMemoryCard;
-        }
-    } else if( mDriveState & FmDriverInfo::EDriveRom ) {
-        driveType = FmDriverInfo::EDriveTypeRom;
-    } else if( mDriveState & FmDriverInfo::EDriveRam ) {
-        driveType = FmDriverInfo::EDriveTypeRam;
-    } else {
-        driveType = FmDriverInfo::EDriveTypePhoneMemory;
-    }
-    
-    return driveType;
-}
-
-QString FmUtils::getDriveNameFromPath( const QString &path )
-{
-    // fillPathWithSplash make sure path length will be at least 3 if it is not empty.
-    QString checkedPath( fillPathWithSplash( path ) );
-    if( checkedPath.length() < 3 ) {
-        return QString();
-    }
-    return checkedPath.left( 3 );
-}
-
-QString FmUtils::getDriveLetterFromPath( const QString &path )
-{
-	if( path.length() <2 ) {
-        return QString();
-    }
-    return path.left( 1 );
-}
-
-FmDriverInfo FmUtils::queryDriverInfo( const QString &driverName )
-{
-    if( driverName.isEmpty() ) {
-        return FmDriverInfo( 0, 0, driverName, QString(), FmDriverInfo::EDriveNotPresent );
+    if( driveName.isEmpty() ) {
+        return FmDriverInfo( 0, 0, driveName, QString(), FmDriverInfo::EDriveNotPresent );
     }
     CCoeEnv *env = CCoeEnv::Static();
     RFs& fs = env->FsSession();
 
     TVolumeInfo volumeInfo;
     TInt drive = 0;
-    drive = driverName[0].toUpper().toAscii() - 'A' + EDriveA;
+    drive = driveName[0].toUpper().toAscii() - 'A' + EDriveA;
 
     quint32 state( 0 );
+    
     int volumeInfoErr( KErrNone );
     int driveInfoErr( KErrNone );
     int errorCode( KErrNone );
@@ -133,7 +90,6 @@
             if ( ( drvStatus & DriveInfo::EDriveInternal ) &&
                  ( drvStatus & DriveInfo::EDriveExternallyMountable ) ){
                 // Handle mass storage bits here
-        
                 state |= FmDriverInfo::EDriveMassStorage | FmDriverInfo::EDriveRemovable;
             }
         
@@ -224,34 +180,25 @@
         state |= FmDriverInfo::EDriveNotPresent;
         break;
     }
-    QString logString ( "FmUtils::queryDriverInfo_" + driverName + 
+    QString logString ( "FmUtils::queryDriverInfo_" + driveName + 
             "_volumeInfoErr:" + QString::number( volumeInfoErr ) +
             "_driveInfoErr:" + QString::number( driveInfoErr ) +
             "_errorCode:" + QString::number( errorCode ) + 
             "_driveSatus:" + QString::number( state ) );
     FM_LOG( logString );
-    return FmDriverInfo( volumeInfo.iSize, volumeInfo.iFree, driverName, volumeName, state );
+    return FmDriverInfo( volumeInfo.iSize, volumeInfo.iFree, driveName, volumeName, state );
 }
 
-QString FmUtils::formatStorageSize( quint64 size )
+/*!
+    remove drive password for \a driveName
+    \a Pwd is original password.
+*/
+int FmUtils::removeDrivePwd( const QString &driveName,  const QString &Pwd )
 {
-	if ( size < 1000 ) {
-		return QString::number( size ) + " B";
-	} else if ( size < 1000 * 1000 ) {
-		return QString::number( size / 1024.0, 'f', 2 ) + " KB";
-	} else if ( size < 1000 * 1000 * 1000 ) {
-		return QString::number( size / (1024.0 * 1024.0), 'f', 1 ) + " MB";
-	} else {
-	    return QString::number( size / ( 1024.0 * 1024.0 * 1024.0 ), 'f', 1 ) + " GB";	    
-	}
-}
-
-int FmUtils::removeDrivePwd( const QString &driverName,  const QString &Pwd )
-{
-    if( driverName.isEmpty() || Pwd.length() > FmMaxLengthofDrivePassword ) {
+    if( driveName.isEmpty() || Pwd.length() > FmMaxLengthofDrivePassword ) {
         return FmErrWrongParam;
     }
-    QString logString = "Drive name:" + driverName;
+    QString logString = "Drive name:" + driveName;
     FM_LOG( logString );
     logString = "Password:" + Pwd;
     FM_LOG( logString );
@@ -261,7 +208,7 @@
 
     TInt drive = 0;
 
-    drive = driverName[0].toUpper().toAscii() - 'A' + EDriveA;
+    drive = driveName[0].toUpper().toAscii() - 'A' + EDriveA;
 
     HBufC* password16 = XQConversions::qStringToS60Desc( Pwd );
     TMediaPassword password;   
@@ -289,12 +236,15 @@
     }
 }
 
-int FmUtils::unlockDrive( const QString &driverName,  const QString &Pwd )
+/*!
+    Unlock drive \a driveName with provided password \a Pwd
+*/
+int FmUtils::unlockDrive( const QString &driveName,  const QString &Pwd )
 {
-    if( driverName.isEmpty() || Pwd.length() > FmMaxLengthofDrivePassword ) {
+    if( driveName.isEmpty() || Pwd.length() > FmMaxLengthofDrivePassword ) {
         return FmErrWrongParam;
     }
-    QString logString = "Drive name:" + driverName;
+    QString logString = "Drive name:" + driveName;
     FM_LOG( logString );
     logString = "Password:" + Pwd;
     FM_LOG( logString );
@@ -303,7 +253,7 @@
 	RFs& fs = env->FsSession();
 
     TInt drive = 0;
-	drive = driverName[0].toUpper().toAscii() - 'A' + EDriveA;
+	drive = driveName[0].toUpper().toAscii() - 'A' + EDriveA;
     
     HBufC* password16 = XQConversions::qStringToS60Desc( Pwd );
     TMediaPassword password;   
@@ -336,25 +286,31 @@
     }
 }
 
-int FmUtils::checkDrivePwd( const QString &driverName, const QString &pwd )
+/*!
+    Check if \a pwd is the right password for drive \a driveName
+*/
+int FmUtils::checkDrivePwd( const QString &driveName, const QString &pwd )
 {
-    if( driverName.isEmpty() || pwd.length() > FmMaxLengthofDrivePassword ) {
+    if( driveName.isEmpty() || pwd.length() > FmMaxLengthofDrivePassword ) {
         return FmErrWrongParam;
     }
-    QString logString = "checkDrivePwd Drive name:" + driverName;
+    QString logString = "checkDrivePwd Drive name:" + driveName;
     logString += " password:" + pwd;
     FM_LOG( logString );
 
-    return setDrivePwd( driverName, pwd, pwd );
+    return setDrivePwd( driveName, pwd, pwd );
 }
 
-int FmUtils::setDrivePwd( const QString &driverName, const QString &oldPwd, const QString &newPwd)
+/*!
+    Set new password \a newPwd for drive \a driveName. \a oldPwd is old password
+*/
+int FmUtils::setDrivePwd( const QString &driveName, const QString &oldPwd, const QString &newPwd)
 {
-    if( driverName.isEmpty() || 
+    if( driveName.isEmpty() || 
         oldPwd.length() > FmMaxLengthofDrivePassword || newPwd.length() > FmMaxLengthofDrivePassword  ) {
         return FmErrWrongParam;
     }
-    QString logString = "setDrivePwd Drive name:" + driverName ;
+    QString logString = "setDrivePwd Drive name:" + driveName ;
     logString += " Old password:" + oldPwd;
     logString += " New password:" + newPwd;
     FM_LOG( logString );
@@ -363,7 +319,7 @@
 	RFs& fs = env->FsSession();
 
     TInt drive = 0;
-	drive = driverName[0].toUpper().toAscii() - 'A' + EDriveA;
+	drive = driveName[0].toUpper().toAscii() - 'A' + EDriveA;
 	
     HBufC* newPassword16 = XQConversions::qStringToS60Desc( newPwd);
     HBufC* oldPassword16 = XQConversions::qStringToS60Desc( oldPwd );
@@ -397,6 +353,9 @@
     }
 }
 
+/*!
+    Set \a pwd as empty password
+*/
 void FmUtils::emptyPwd( QString &pwd )
 {
     TBuf< FmMaxLengthofDrivePassword > nullPwd;
@@ -405,9 +364,12 @@
     pwd = XQConversions::s60DescToQString( nullPwd );
 }
 
-int FmUtils::renameDrive( const QString &driverName, const QString &newVolumeName)
+/*!
+    Set drive volume for drive \a driveName
+*/
+int FmUtils::renameDrive( const QString &driveName, const QString &newVolumeName)
 {
-    if( driverName.isEmpty() ) {
+    if( driveName.isEmpty() ) {
         return FmErrWrongParam;
     }
     foreach( const QChar &ch, newVolumeName )
@@ -425,7 +387,7 @@
 	RFs& fs = env->FsSession();
 
     TInt drive = 0;
-	drive = driverName[0].toUpper().toAscii() - 'A' + EDriveA;
+	drive = driveName[0].toUpper().toAscii() - 'A' + EDriveA;
 
     TPtr newName ( ( XQConversions::qStringToS60Desc( newVolumeName ) )->Des() );
 
@@ -445,16 +407,19 @@
     }
 }
 
-int FmUtils::ejectDrive( const QString &driverName )
+/*!
+    Eject drive \a driveName
+*/
+int FmUtils::ejectDrive( const QString &driveName )
 {
-    if( driverName.isEmpty() ) {
+    if( driveName.isEmpty() ) {
         return FmErrWrongParam;
     }
     QString logString = "FmUtils::ejectDrive start";
     FM_LOG( logString );
 
     TInt drive = 0;
-	drive = driverName[0].toUpper().toAscii() - 'A' + EDriveA;
+	drive = driveName[0].toUpper().toAscii() - 'A' + EDriveA;
 
     const int KDriveShift = 16;
 
@@ -467,119 +432,166 @@
     return FmErrNone;
 }
 
-QString FmUtils::getFileType( const QString &filePath  )
+/*!
+    Check if drive \a driveName is accessable for user
+*/
+bool FmUtils::checkDriveAccessFilter( const QString &driveName )
+{
+    if( driveName.isEmpty() ) {
+        return false;
+    }
+    FmDriverInfo driveInfo = queryDriverInfo( driveName );
+    if( ( driveInfo.driveState()& FmDriverInfo::EDriveRam ) ||
+        ( driveInfo.driveState()& FmDriverInfo::EDriveRom ) ) {
+        return false;
+    }
+    return true;
+}
+
+/*!
+    This function should be called to adjust path if user goto a drive.
+    data folder will be append to C:\ becuase user could only view C:\data instead C:\ 
+*/
+QString FmUtils::checkDriveToFolderFilter( const QString &path )
 {
-    RApaLsSession apaSession;
-    TDataType dataType;
-    TUid appUid;
-    
-    TBuf<128> mimeTypeBuf;
-        
-    int err = apaSession.Connect();
+    QString checkedPath = fillPathWithSplash( path );
+    if( checkedPath.compare( Drive_C, Qt::CaseInsensitive ) == 0 ) {
+        checkedPath += QString( "data" ) + QDir::separator();
+        return checkedPath;
+    }
+    return path;
+
+}
+
+/*!
+    This function should be called to adjust path if user back to up level path.
+    If user is at C:\data then path level should be returned as C:\
+    Becuase C:\data is root path for C drive 
+*/
+QString FmUtils::checkFolderToDriveFilter( const QString &path )
+{
+    QString logString;
+    logString = QString( "checkFolderToDriveFilter: " ) + path;
+    FM_LOG( logString );
+    QString checkedPath = fillPathWithSplash( path );
+
+    logString = QString( "checkFolderToDriveFilter_fillPathWithSplash: " ) + checkedPath;
+    FM_LOG( logString );
     
-    if ( err == KErrNone ){   
-        err = apaSession.AppForDocument( XQConversions::qStringToS60Desc( filePath )->Des(), 
-                                         appUid, dataType );
-        
-        if( err == KErrNone ){
-            mimeTypeBuf.Copy(dataType.Des8());
-        }  
+    if( checkedPath.compare( Folder_C_Data, Qt::CaseInsensitive ) == 0 ) {
+        FM_LOG( QString( " change from c:/data/ to C:/" ) );
+        return Drive_C;
     }
-    
-    apaSession.Close();
-    return XQConversions::s60DescToQString( mimeTypeBuf );
+    return path;
+
 }
 
-quint64 FmUtils::getDriveDetailsResult( const QString &folderPath, const QString &extension )
+/*!
+    Check if \a path is accessable for user
+*/
+int FmUtils::isPathAccessabel( const QString &path )
 {
-    int err;
-    
-    RFs fs;
-    err = fs.Connect();
-    
-    QString string( fillPathWithSplash( folderPath ) );
+    // Used to check if path is accessable, very important feature
+    // and will return filemanager error.
+    FM_LOG( QString( "isPathAccessabel:" ) + path );
+    if( path.isEmpty() ) {
+        return FmErrPathNotExist;
+    }
 
-    TPtrC desFolderPath( XQConversions::qStringToS60Desc( string )->Des() );
-    TPtrC ptrExtension( XQConversions::qStringToS60Desc( extension )->Des() );
-    
-    CDir* results = 0;
-    TParse parse;
-    
-    quint64 size = 0;
-    
-    const TInt pathlength = ptrExtension.Length() + desFolderPath.Length();
-    
-    if ( pathlength > KMaxFileName ){
-        err = KErrNotFound;   
+    // used to filter locked/ejected/corrupted drive
+    // check if drive is available, no matter if it is a drive, a folder, or a file.
+    if( !isDriveAvailable( path ) ) {
+        FM_LOG( QString( "isPathAccessabel false: path is drive and not available" ) );
+        return FmErrDriveNotAvailable;
     }
-    else{
-        err = fs.Parse( ptrExtension, desFolderPath, parse );
-        err = fs.GetDir( parse.FullName(), KEntryAttMaskSupported|KEntryAttAllowUid, 
-            ESortNone, results );
-        
-        TDesC des = parse.FullName();
-        
-        if (err == KErrNotFound)
-            {
-            return 0;
-            }
-    }
-    
-    if ( results ){
-        CleanupStack::PushL(results);
+
+    QFileInfo fileInfo( path );
 
-        // Go through all files in the list and tell subclass
-        TFileName file;
-        const TInt count = results->Count();
-        for( TInt i=0; i<count; ++i ){
-            const TEntry& entry = (*results)[i];
-            file = desFolderPath;
-            file += entry.iName;
-            size += entry.iSize;          
-        }
-        CleanupStack::PopAndDestroy(results);
+    if( fileInfo.absoluteFilePath().contains( Drive_C, Qt::CaseInsensitive ) &&
+        !fileInfo.absoluteFilePath().contains( Folder_C_Data, Qt::CaseInsensitive ) ) {
+        FM_LOG( QString( "isPathAccessabel false: path contain C and not in data folder" ) );
+        return FmErrPathDenied;
     }
-    
-    fs.Close();
-    
-    return size;  
+    if( !checkDriveAccessFilter( FmUtils::getDriveNameFromPath( fileInfo.absoluteFilePath() ) ) ){
+        return FmErrDriveDenied;
+    }
+    if( !fileInfo.exists() ) {
+        FM_LOG( QString( "isPathAccessabel false: path not exist" ) );
+        return FmErrPathNotExist;
+    }
+    FM_LOG( QString( "isPathAccessabel FmErrNone" ) );
+    return FmErrNone;
 }
 
-bool FmUtils::isDriveC( const QString &driverName )
+/*!
+    Check if drive related to \a path is available.
+    This function should not check if path is available. Only responsible for checking drive  
+    When MMC is not inserted, also return false
+*/
+bool FmUtils::isDriveAvailable( const QString &path )
 {
-    if( driverName.isEmpty() ) {
-        return false;
-    }
-    TInt drive = 0;
-    drive = driverName[0].toUpper().toAscii() - 'A' + EDriveA;
-    if( drive == EDriveC ){
-        return true;
-    }
-    else{
+    FM_LOG( QString( "isDriveAvailable:" ) + path );
+    if( path.isEmpty() ) {
         return false;
     }
-   
+    FmDriverInfo::DriveState driveState = queryDriverInfo( path ).driveState();
+    if( ( driveState & FmDriverInfo::EDriveAvailable ) ) {
+        FM_LOG( QString( "isDriveAvailable true" ) );
+        return true;
+    }
+    FM_LOG( QString( "isDriveAvailable false" ) );
+    return false;
 }
 
-bool FmUtils::isDrive( const QString &path )
+/*!
+    Check if \a folderPath is default folder for system
+*/
+bool FmUtils::isDefaultFolder( const QString &folderPath  )
 {
-   bool ret( false );
-   if( path.length() <= 3 && path.length() >=2 ) {
-       ret = true;
-   }
-   
-   return ret;   
+    HBufC *path = XQConversions::qStringToS60Desc( folderPath );
+    TPtrC desFolderPath( path->Des() );
+    
+    bool ret( true );
+    TInt pathType( PathInfo::PathType( desFolderPath ) );
+    switch( pathType ){
+       case PathInfo::ENotSystemPath:{
+           QString locString( localize( folderPath ) );
+            if ( locString.isEmpty() ){
+                ret = false;
+                break;
+            }
+            ret = true;
+            break;
+            }
+        case PathInfo::EPhoneMemoryRootPath: // FALL THROUGH
+        case PathInfo::EMemoryCardRootPath: // FALL THROUGH
+        case PathInfo::ERomRootPath:{
+            ret = false;
+            break;
+        }
+        // Accept other folders
+        default:{
+            ret = true;
+            break;
+        }
+    }
+    delete path;
+    return ret;
 }
 
-void FmUtils::createDefaultFolders( const QString &driverName )
+/*!
+    Create system default folders for drive \a driveName.
+    Default folders should be created after format a drive.
+*/
+void FmUtils::createDefaultFolders( const QString &driveName )
 {
-    if( driverName.isEmpty() ) {
+    if( driveName.isEmpty() ) {
         return;
     }
     int err;
     
     TInt drive = 0;
-    drive = driverName[0].toUpper().toAscii() - 'A' + EDriveA;
+    drive = driveName[0].toUpper().toAscii() - 'A' + EDriveA;
     
     RFs fs;
     err = fs.Connect();
@@ -643,440 +655,17 @@
 }
 
 /*!
-    fill splash in the end of \a filePath if the path is not a file
-    All "/" and "\" will be changed to QDir::separator
-    \sa formatPath only changed "/" and "\" to QDir::separator
+    In Symbian system, default folders will be localized.
+    So localize is used to check if a path is a default folder
+    \sa isDefaultFolder
 */
-QString FmUtils::fillPathWithSplash( const QString &filePath )
-{
-	QString newFilePath;
-    if( filePath.isEmpty() ) {
-        return newFilePath;
-    }
-
-    newFilePath = formatPath( filePath );
-    
-    if( newFilePath.right( 1 )!= QDir::separator() ){
-        newFilePath.append( QDir::separator() );
-    }
-    return newFilePath;
-}
-
-QString FmUtils::removePathSplash( const QString &filePath )
-{
-    QString newFilePath( filePath );
-    if( filePath.right( 1 ) == QChar( '/' ) || filePath.right(1) == QString( "\\" ) ) {
-        newFilePath = filePath.left( filePath.length() - 1 );
-    }
-    return newFilePath;
-}
-
-// filter un-accessable drive
-bool FmUtils::checkDriveAccessFilter( const QString &driveName )
-{
-    if( driveName.isEmpty() ) {
-        return false;
-    }
-    FmDriverInfo driveInfo = queryDriverInfo( driveName );
-    if( ( driveInfo.driveState()& FmDriverInfo::EDriveRam ) ||
-        ( driveInfo.driveState()& FmDriverInfo::EDriveRom ) ) {
-        return false;
-    }
-    return true;
-}
-
-QString FmUtils::checkDriveToFolderFilter( const QString &path )
-{
-    /*
-    QFileInfo fileInfo( path );
-    if( !fileInfo.exists() ) {
-            return QString();
-        }
-    */
-    QString checkedPath = fillPathWithSplash( path );
-    if( checkedPath.compare( Drive_C, Qt::CaseInsensitive ) == 0 ) {
-        checkedPath += QString( "data" ) + QDir::separator();
-        return checkedPath;
-    }
-    return path;
-
-}
-
-QString FmUtils::checkFolderToDriveFilter( const QString &path )
-{
-    QString logString;
-    logString = QString( "checkFolderToDriveFilter: " ) + path;
-    FM_LOG( logString );
-    QString checkedPath = fillPathWithSplash( path );
-
-    logString = QString( "checkFolderToDriveFilter_fillPathWithSplash: " ) + checkedPath;
-    FM_LOG( logString );
-    
-    if( checkedPath.compare( Folder_C_Data, Qt::CaseInsensitive ) == 0 ) {
-        FM_LOG( QString( " change from c:/data/ to C:/" ) );
-        return Drive_C;
-    }
-    return path;
-
-}
-
-int FmUtils::isPathAccessabel( const QString &path )
-{
-    // Used to check if path is accessable, very important feature
-    // and will return filemanager error.
-    FM_LOG( QString( "isPathAccessabel:" ) + path );
-    if( path.isEmpty() ) {
-        return FmErrPathNotExist;
-    }
-
-    // used to filter locked/ejected/corrupted drive
-    // check if drive is available, no matter if it is a drive, a folder, or a file.
-    if( !isDriveAvailable( path ) ) {
-        FM_LOG( QString( "isPathAccessabel false: path is drive and not available" ) );
-        return FmErrDriveNotAvailable;
-    }
-
-    QFileInfo fileInfo( path );
-    if( fileInfo.absoluteFilePath().contains( Drive_C, Qt::CaseInsensitive ) &&
-        !fileInfo.absoluteFilePath().contains( Folder_C_Data, Qt::CaseInsensitive ) ) {
-        FM_LOG( QString( "isPathAccessabel false: path contain C and not in data folder" ) );
-        return FmErrPathDenied;
-    }
-    if( !checkDriveAccessFilter( FmUtils::getDriveNameFromPath( fileInfo.absoluteFilePath() ) ) ){
-        return FmErrDriveDenied;
-    }
-    if( !fileInfo.exists() ) {
-        FM_LOG( QString( "isPathAccessabel false: path not exist" ) );
-        return FmErrPathNotExist;
-    }
-    FM_LOG( QString( "isPathAccessabel FmErrNone" ) );
-    return FmErrNone;
-}
-
-// only used to check drive, when MMC is not inserted, also return false
-bool FmUtils::isDriveAvailable( const QString &path )
-{
-    FM_LOG( QString( "isDriveAvailable:" ) + path );
-    if( path.isEmpty() ) {
-        return false;
-    }
-    FmDriverInfo::DriveState driveState = queryDriverInfo( path ).driveState();
-    if( ( driveState & FmDriverInfo::EDriveAvailable ) ) {
-        FM_LOG( QString( "isDriveAvailable true" ) );
-        return true;
-    }
-    FM_LOG( QString( "isDriveAvailable false" ) );
-    return false;
-}
-
-void FmUtils::getDriveList( QStringList &driveList, bool isHideUnAvailableDrive )
-{
-    if( isHideUnAvailableDrive ) {
-        FM_LOG( QString( "getDriveList HideUnAvailableDrive_true" ) );
-    } else {
-        FM_LOG( QString( "getDriveList HideUnAvailableDrive_false" ) );
-    }
-    QFileInfoList infoList = QDir::drives();
-
-    foreach( QFileInfo fileInfo, infoList ) {
-        QString driveName = fileInfo.absolutePath();
-        if( checkDriveAccessFilter( driveName ) ) {
-            if( !isHideUnAvailableDrive ) {
-                driveList.append( driveName );
-            }
-            else if ( isDriveAvailable( driveName ) ) {
-                driveList.append( driveName );
-            }
-        }
-    }
-    return;
-}
-
-/*!
-    fill volume name for \a driveName, with drive letter at the front, for example, C: Phone memory
-    if \a isFillWithDefaultVolume is true, default volume is provided for non-volume drive.
-*/
-QString FmUtils::fillDriveVolume( QString driveName, bool isFillWithDefaultVolume )
-{
-    QString ret;
-    if( driveName.isEmpty() ) {
-        return ret;
-    }
-    QString tempDriveName = fillPathWithSplash( driveName );
-
-    QString checkedDriveName( removePathSplash( driveName ) );
-    
-    FmDriverInfo driverInfo = FmUtils::queryDriverInfo( tempDriveName );
-    QString volumeName = driverInfo.volumeName();
-    
-    if( volumeName.isEmpty() && isFillWithDefaultVolume ){
-        switch ( driverInfo.driveType() )
-            {
-            case FmDriverInfo::EDriveTypeMassStorage:
-                ret = hbTrId( "txt_fmgr_dblist_1_mass_storage" ).arg( checkedDriveName );
-                break;
-            case FmDriverInfo::EDriveTypeUsbMemory:
-                ret = hbTrId( "txt_fmgr_dblist_1_usb_memory" ).arg( checkedDriveName );
-                break;
-            case FmDriverInfo::EDriveTypeMemoryCard:
-                ret = hbTrId( "txt_fmgr_dblist_1_memory_card" ).arg( checkedDriveName );
-                break;
-            case FmDriverInfo::EDriveTypePhoneMemory:
-                ret = hbTrId( "txt_fmgr_dblist_1_device_memory" ).arg( checkedDriveName );
-                break;
-            default:
-                Q_ASSERT_X( false, "FmUtils::fillDriveVolume", "please handle drive type");
-                break;
-            }    
-    }
-    
-    if( ret.isEmpty() ) {
-        // ret is not got. fill ret as default method
-        // txt_fmgr_dblist_1_2 is not correct, can not use.
-        ret = hbTrId( "%1 %2" ).arg( checkedDriveName ).arg( volumeName );
-    }
-    return ret;
-}
-
-
-/*!
-    return volume name for \a driveName. without drive letter at the front.
-    \a defaultName is set true if default volume name is return for volume name
-*/
-QString FmUtils::getVolumeNameWithDefaultNameIfNull( const QString &diskName, bool &defaultName )
+QString FmUtils::localize( const QString &path )
 {
-    FmDriverInfo driverInfo = FmUtils::queryDriverInfo( diskName );
-          
-    QString volumeName = driverInfo.volumeName();    
-    //save the volume status, whether it is default name
-    defaultName = false;
-    //volume name may be null if not set, it will be set at least for one time in the following while cycling.
-    if ( volumeName.isEmpty() ) {
-        defaultName = true;
-        switch ( driverInfo.driveType() )
-            {
-            case FmDriverInfo::EDriveTypeMassStorage:
-                volumeName = hbTrId("Mass storage"); 
-                break;
-            case FmDriverInfo::EDriveTypeUsbMemory:
-                volumeName = hbTrId("USB memory"); 
-                break;
-            case FmDriverInfo::EDriveTypeMemoryCard:
-                volumeName = hbTrId("Memory card");
-                break;
-            case FmDriverInfo::EDriveTypePhoneMemory:
-                volumeName = hbTrId("Device memory");
-                break;
-            default:
-                Q_ASSERT_X( false, "FmUtils::getVolumeNameWithDefaultNameIfNull", "please handle drive type" );
-                break;
-            }   
-    }
-    return volumeName;
-}
-
-int FmUtils::launchFile( const QString &filePath )
-{
-    QFile file( filePath );
-    if( !file.exists() ) {
-        return false;
-    }
-        
-    XQApplicationManager mAiwMgr;
-    XQAiwRequest *request = mAiwMgr.create(file);
-    if ( request == 0 ) {
-        // No handlers for the URI
-        return FmErrUnKnown;
-    }
-    
-    // Set function parameters
-    QList<QVariant> args;
-    args << file.fileName();
-    request->setArguments(args);
-    
-    // Send the request
-    bool res = request->send();
-    if  (!res) 
-    {
-       // Request failed. 
-      int error = request->lastError();
-      
-      delete request;
-      return FmErrUnKnown;
-    }
-    
-    delete request;
-    return FmErrNone;
-}
-
-void FmUtils::sendFiles( QStringList &filePathList )
-{
-    ShareUi shareui;
-    shareui.send( filePathList, false );
-}
-
-QString FmUtils::getBurConfigPath( QString appPath )
-{
-    Q_UNUSED( appPath );
-    QString path( BURCONFIGFILE );
-    return path;
-}
-
-bool FmUtils::isPathEqual( const QString &pathFst, const QString &pathLast )
-{
-    QString fst( fillPathWithSplash( pathFst ) );
-    QString last( fillPathWithSplash( pathLast ) );
-    if( fst.compare( last, Qt::CaseInsensitive ) == 0 ) {
-        return true;
-    }
-    return false;
-}
-
-bool FmUtils::isDefaultFolder( const QString &folderPath  )
-{
-    TPtrC desFolderPath( XQConversions::qStringToS60Desc( folderPath )->Des() );
+    // HbDirectoryNameLocalizer can not recognize path with \ in the end
+    QString locPath( removePathSplash( path ) );
     
-    TInt pathType( PathInfo::PathType( desFolderPath ) );
-    switch( pathType ){
-       case PathInfo::ENotSystemPath:{
-           QString locString( Localize( folderPath ) );
-            if ( locString.isEmpty() ){
-                return false;
-            }
-            return true;
-            }
-        case PathInfo::EPhoneMemoryRootPath: // FALL THROUGH
-        case PathInfo::EMemoryCardRootPath: // FALL THROUGH
-        case PathInfo::ERomRootPath:{
-            return false;
-        }
-        // Accept other folders
-        default:{
-            return true;
-        }
-    }
-}
-
-QString FmUtils::Localize( const QString &path )
-{
-    QString locPath = fillPathWithSplash( path );
-
-    TPtrC desPath( XQConversions::qStringToS60Desc( locPath )->Des() );
-    CDirectoryLocalizer *localizer = CDirectoryLocalizer::NewL();
-
-    localizer->SetFullPath( desPath );
-    if( localizer->IsLocalized() ){   
-        return XQConversions::s60DescToQString( localizer->LocalizedName() );
-    }
-    
-    return QString();
-}
-
-/*!
-    All "/" and "\" in \a path will be changed to QDir::separator
-    \sa fillPathWithSplash, fillPathWithSplash will append QDir::separator in the end if path is no a file
-*/
-QString FmUtils::formatPath( const QString &path  )
-{
-    QString formatPath;
-    if( path.isEmpty() ) {
-        return formatPath;
-    }
-    
-	foreach( QChar ch, path ) {
-		if( ch == QChar('\\') || ch == QChar('/') ) {
-			formatPath.append( QDir::separator() );
-		} else {
-			formatPath.append( ch );
-		}
-    }
-
-    return formatPath;
-}
-
-int FmUtils::getMaxFileNameLength()
-{
-    return KMaxFileName;
-}
-
-bool FmUtils::checkMaxPathLength( const QString& path )
-{
-    if( path.length() > KMaxPath ) {
-        return false;
-    }
-    return true;
-}
-
-bool FmUtils::checkFolderFileName( const QString& name )
-{
-    // trim space firest, because there may be some spaces after "." ,  it is also not valid
-    QString trimmedName( name.trimmed() );
-	if( trimmedName.isEmpty() ) {
-		return false;
-	}
-    if( trimmedName.endsWith( QChar('.'),  Qt::CaseInsensitive ) ) {
-        return false;
-    }
-    if( trimmedName.contains( QChar('\\'), Qt::CaseInsensitive ) ||
-        trimmedName.contains( QChar('/'),  Qt::CaseInsensitive ) ||
-        trimmedName.contains( QChar(':'),  Qt::CaseInsensitive ) ||
-        trimmedName.contains( QChar('*'),  Qt::CaseInsensitive ) ||
-        trimmedName.contains( QChar('?'),  Qt::CaseInsensitive ) ||
-        trimmedName.contains( QChar('\"'), Qt::CaseInsensitive ) ||
-        trimmedName.contains( QChar('<'),  Qt::CaseInsensitive ) ||
-        trimmedName.contains( QChar('>'),  Qt::CaseInsensitive ) ||
-        trimmedName.contains( QChar('|'),  Qt::CaseInsensitive ) ){
-        return false;
-    }
-    // use orignal name to exam max size of file name
-    if( name.length() > KMaxFileName ) {
-        return false;
-    }
-    return true;
-}
-
-bool FmUtils::checkNewFolderOrFile( const QString &fileName, const QString &path, QString &errString )
-{
-    // first check if fileName is valid, then check if path length is valid, and check if file/foler is existed at last
-    QFileInfo fileInfo( path );
-    bool ret( true );   
-    if (!FmUtils::checkFolderFileName( fileName ) ) {
-        errString = hbTrId( "Invalid file or folder name!" );
-        ret = false;
-    } else if( !FmUtils::checkMaxPathLength( path ) ) {
-        errString = hbTrId( "the path you specified is too long!" );
-        ret = false;
-    } else if (fileInfo.exists()) {
-        errString = hbTrId( "%1 already exist!" ).arg( fileInfo.fileName() );
-        ret = false;
-    }
-    return ret;
-}
-
-/*!
-    Check if \a dest is sub level path of \a src
-    Used to check True/False when copy a folder to itself or its subfolder
-    For example, c:\data\test is sub path of c:\data.
-    But c:\data123\test is not sub path of c:\data.
-    So after got right part of path, the first char must be \ or /
-*/
-bool FmUtils::isSubLevelPath( const QString &src, const QString &dest )
-{
-    FM_LOG("FmUtils::isSubFolder: src=" + src + " dest=" + dest);
-    QString checkedSrc( FmUtils::fillPathWithSplash( src ) );
-    QString checkedDest( FmUtils::fillPathWithSplash( dest ) );
-    
-    if( checkedDest.contains( checkedSrc, Qt::CaseInsensitive) &&
-            checkedDest.length() > checkedSrc.length() ) {
-        // for example c:\data\ vs c:\data\123\ 
-        FM_LOG("FmUtils::isSubFolder: true");
-        return true;
-    }
-    // for example c:\data\ vs c:\data\ 
-    // for example c:\data\ vs c:\data123\ 
-
-    FM_LOG("FmUtils::isSubFolder: false");
-    return false;
+    HbDirectoryNameLocalizer localizer;
+    return localizer.translate( locPath );
 }
 
 /*!
@@ -1111,3 +700,150 @@
     CleanupStack::PopAndDestroy(); // fsSession
     return err;
 }
+
+/*!
+    judge whether there is enough space on \a targetDrive for \a size.
+    return true if has, false if not.
+*/
+bool FmUtils::hasEnoughSpace( const QString &targetDrive, qint64 size )
+{
+    RFs fsSession;
+    QT_TRAP_THROWING( fsSession.Connect() ); 
+    CleanupClosePushL( fsSession );
+    TInt dstDrv(0);
+    HBufC* hbuf = XQConversions::qStringToS60Desc( targetDrive );
+    QT_TRAP_THROWING( RFs::CharToDrive( hbuf->operator [](0), dstDrv ) );
+    bool ret = !SysUtil::DiskSpaceBelowCriticalLevelL( &fsSession,  size , dstDrv );
+    CleanupStack::PopAndDestroy(); // fsSession
+    return ret;
+    
+}
+
+/*!
+    move one file insice the same drive, from \a source to \a target.
+    return KErrNone if successful, otherwise one of the other system-wide error codes.
+*/
+int FmUtils::moveInsideDrive( const QString &source, const QString &target )
+{
+    RFs fsSession;
+    QT_TRAP_THROWING( fsSession.Connect() ); 
+    CleanupClosePushL( fsSession );
+    HBufC* oldName = XQConversions::qStringToS60Desc( source );
+    HBufC* newName = XQConversions::qStringToS60Desc( target );
+    int ret = fsSession.Rename( *oldName, *newName );
+    CleanupStack::PopAndDestroy(); // fsSession
+    return ret;    
+}
+
+/*!
+   Launch a file with associated application.
+*/
+int FmUtils::launchFile( const QString &filePath )
+
+{
+    QFile file( filePath );
+    if( !file.exists() ) {
+        return false;
+    }
+        
+    XQApplicationManager mAiwMgr;
+    XQAiwRequest *request = mAiwMgr.create(file);
+    if ( request == 0 ) {
+        // No handlers for the URI
+        return FmErrUnKnown;
+    }
+    
+    // Set function parameters
+    QList<QVariant> args;
+    args << file.fileName();
+    request->setArguments(args);
+    
+    // Send the request
+    bool res = request->send();
+    if  (!res) 
+    {
+       // Request failed. 
+      int error = request->lastError();
+      
+      delete request;
+      return FmErrUnKnown;
+    }
+    
+    delete request;
+    return FmErrNone;
+}
+
+/*!
+    return path for backup restore config file.
+    Currently \a appPath is not used.
+*/
+QString FmUtils::getBurConfigPath( QString appPath )
+{
+    Q_UNUSED( appPath );
+    QString path( BURCONFIGFILE );
+    return path;
+}
+
+/*!
+    return MetaData string for \a filePath
+*/
+QString FmUtils::getFileType( const QString &filePath  )
+{
+    RApaLsSession apaSession;
+    TDataType dataType;
+    TUid appUid;
+    
+    TBuf<128> mimeTypeBuf;
+        
+    int err = apaSession.Connect();
+    
+    if ( err == KErrNone ){   
+        err = apaSession.AppForDocument( XQConversions::qStringToS60Desc( filePath )->Des(), 
+                                         appUid, dataType );
+        
+        if( err == KErrNone ){
+            mimeTypeBuf.Copy(dataType.Des8());
+        }  
+    }
+    
+    apaSession.Close();
+    return XQConversions::s60DescToQString( mimeTypeBuf );
+}
+
+/*!
+    Check if drive \a driveName is drive C
+*/
+bool FmUtils::isDriveC( const QString &driveName )
+{
+    if( driveName.isEmpty() ) {
+        return false;
+    }
+    TInt drive = 0;
+    drive = driveName[0].toUpper().toAscii() - 'A' + EDriveA;
+    if( drive == EDriveC ){
+        return true;
+    }
+    else{
+        return false;
+    }
+   
+}
+
+/*!
+    return max file name length
+*/
+int FmUtils::getMaxFileNameLength()
+{
+    return KMaxFileName;
+}
+
+/*!
+    Check if length of \a path is exceed max path length. 
+*/
+bool FmUtils::checkMaxPathLength( const QString& path )
+{
+    if( path.length() > KMaxPath ) {
+        return false;
+    }
+    return true;
+}
--- a/filemanager/src/inc/fmutils_win.cpp	Thu Aug 05 11:30:07 2010 +0800
+++ b/filemanager/src/inc/fmutils_win.cpp	Thu Sep 02 17:00:51 2010 +0800
@@ -16,14 +16,15 @@
 *     The source file of the file manager utilities on windows
 */
 
+#include "fmutils.h"
+
 #include <windows.h>
 
-#include "fmutils.h"
 #include <QDir>
+#include <QUrl>
+#include <QVariant>
 #include <QFileInfo>
 #include <QDesktopServices>
-#include <QUrl>
-#include <QVariant>
 
 #include <hbglobal.h>
 
@@ -31,39 +32,23 @@
 const int KMaxFileName=0x100;
 const int KMaxPath=0x100;
 
-QString FmUtils::getDriveNameFromPath( const QString &path )
-{
-    if( path.length() <3 ) {
-        return QString();
-    }
-    return path.left( 3 );
-}
-
-QString FmUtils::getDriveLetterFromPath( const QString &path )
-{
-	if( path.length() <3 ) {
-        return QString();
-    }
-    return path.left( 1 );
-}
-
-FmDriverInfo FmUtils::queryDriverInfo( const QString &driverName )
+FmDriverInfo FmUtils::queryDriverInfo( const QString &driveName )
 {
     quint64 size = 0;
     quint64 freeSize = 0;
-    QString driver = driverName;
+    QString drive = driveName;
     
-    driver.replace( '/', "\\" );
-    if ( driver.right(1) != "\\" ) {
-        driver.append( "\\" );
+    drive.replace( '/', "\\" );
+    if ( drive.right(1) != "\\" ) {
+        drive.append( "\\" );
     }
-    GetDiskFreeSpaceEx( (LPCWSTR)driver.constData(),
+    GetDiskFreeSpaceEx( (LPCWSTR)drive.constData(),
                         (PULARGE_INTEGER)&freeSize,
                         (PULARGE_INTEGER)&size,
                         0 );
 
     TCHAR volumeName[MAX_PATH + 1] = { 0 };
-    GetVolumeInformation( (LPCWSTR)driver.constData(),
+    GetVolumeInformation( (LPCWSTR)drive.constData(),
                           &volumeName[0],
                           MAX_PATH + 1,
                           0,
@@ -73,87 +58,42 @@
                           0 );
 
     quint32 state( 0 );
-    quint32 drvStatus = GetDriveType( (LPCWSTR)driver.constData() );
+    quint32 drvStatus = GetDriveType( (LPCWSTR)drive.constData() );
     if ( drvStatus == DRIVE_REMOVABLE  ) {
         state |= FmDriverInfo::EDriveRemovable;
     }
-#ifdef _DEBUG_DISABLE_DRIVE_D_TEST_DRIVEHIDE_
-	if ( driverName.contains( Drive_D, Qt::CaseInsensitive )  ) {
-		state |= FmDriverInfo::EDriveNotPresent;
-    }
-#endif
 
-#ifdef _DEBUG_LOCKED_DRIVE_Z
-	if ( driverName.contains( Drive_Z, Qt::CaseInsensitive )  ) {
-		state |= FmDriverInfo::EDriveLocked;
-    }
-#endif
 	if( !(state&FmDriverInfo::EDriveNotPresent) && !(state&FmDriverInfo::EDriveLocked) &&
 		!(state&FmDriverInfo::EDriveCorrupted) ) {
 		state |= FmDriverInfo::EDriveAvailable;
 	}
-    return FmDriverInfo( size, freeSize, driverName, QString::fromWCharArray( &volumeName[0] ), state );
-}
-
-QString FmUtils::formatStorageSize( quint64 size )
-{
-	if ( size < 1000 ) {
-		return QString::number( size ) + " B";
-	} else if ( size < 1000 * 1000 ) {
-		return QString::number( size / 1024.0, 'f', 2 ) + " KB";
-	} else if ( size < 1000 * 1000 * 1000 ) {
-		return QString::number( size / (1024.0 * 1024.0), 'f', 1 ) + " MB";
-	} else {
-	    return QString::number( size / ( 1024.0 * 1024.0 * 1024.0 ), 'f', 1 ) + " GB";	    
-	}
+    return FmDriverInfo( size, freeSize, driveName, QString::fromWCharArray( &volumeName[0] ), state );
 }
 
-/*
-quint32 FmUtils::getDriverState( const QString &driverName )
+int FmUtils::removeDrivePwd( const QString &driveName,  const QString &Pwd )
 {
-    quint32 state( 0 );
-
-    QString driver = driverName;
-    
-    driver.replace( '/', "\\" );
-    if ( driver.right(1) != "\\" ) {
-        driver.append( "\\" );
-    }
-
-    quint32 drvStatus = GetDriveType( (LPCWSTR)driver.constData() );
-
-    if ( drvStatus == DRIVE_REMOVABLE  ) {
-        state |= FmDriverInfo::EDriveRemovable;
-    }
-
-    return state;
-
-}
-*/
-int FmUtils::removeDrivePwd( const QString &driverName,  const QString &Pwd )
-{
-    Q_UNUSED( driverName );
+    Q_UNUSED( driveName );
     Q_UNUSED( Pwd );
     return 0;
 }
 
-int FmUtils::unlockDrive( const QString &driverName,  const QString &Pwd )
+int FmUtils::unlockDrive( const QString &driveName,  const QString &Pwd )
 {
-    Q_UNUSED( driverName );
+    Q_UNUSED( driveName );
     Q_UNUSED( Pwd );
     return 0;
 }
 
-int FmUtils::checkDrivePwd( const QString &driverName, const QString &pwd)
+int FmUtils::checkDrivePwd( const QString &driveName, const QString &pwd)
 {
-    Q_UNUSED( driverName );
+    Q_UNUSED( driveName );
     Q_UNUSED( pwd );
     return 0;
 }
 
-int FmUtils::setDrivePwd( const QString &driverName, const QString &oldPwd, const QString &newPwd)
+int FmUtils::setDrivePwd( const QString &driveName, const QString &oldPwd, const QString &newPwd)
 {
-    Q_UNUSED( driverName );
+    Q_UNUSED( driveName );
     Q_UNUSED( oldPwd );
     Q_UNUSED( newPwd );
     return 0;
@@ -164,9 +104,9 @@
     Q_UNUSED( pwd );
 }
 
-int FmUtils::renameDrive( const QString &driverName, const QString &newVolumeName)
+int FmUtils::renameDrive( const QString &driveName, const QString &newVolumeName)
 {
-    Q_UNUSED( driverName );
+    Q_UNUSED( driveName );
     foreach( const QChar &ch, newVolumeName )
     {
         // If not alphadigit or space, return error
@@ -178,221 +118,85 @@
     return 0;
 }
 
-int FmUtils::ejectDrive( const QString &driverName )
-{
-    Q_UNUSED( driverName );
-	return FmErrNone; 
-}
-
-QString FmUtils::getFileType( const QString &filePath  )
-{
-    Q_UNUSED( filePath );
-    return QString( "" );
-}
-
-quint64 FmUtils::getDriveDetailsResult( const QString &folderPath, const QString &extension )
-{
-    Q_UNUSED( folderPath );
-    Q_UNUSED( extension );
-    return 0;
-}
-
-bool FmUtils::isDriveC( const QString &driverName )
-{
-	if( driverName.contains(Drive_C,Qt::CaseInsensitive) ){
-        return true;
-    }
-    else{
-        return false;
-    }
-}
-
-bool FmUtils::isDrive( const QString &path )
+int FmUtils::ejectDrive( const QString &driveName )
 {
-   bool ret( false );
-   if( path.length() <= 3 && path.length() >=2 ) {
-       ret = true;
-   }
-   
-   return ret;   
-}
-
-void FmUtils::createDefaultFolders( const QString &driverName )
-{
-    Q_UNUSED( driverName );
-}
-
-/*!
-    fill splash in the end of \a filePath if the path is not a file
-    All "/" and "\" will be changed to QDir::separator
-    \sa formatPath only changed "/" and "\" to QDir::separator
-*/
-QString FmUtils::fillPathWithSplash( const QString &filePath )
-{
-    QString newFilePath;
-    if( filePath.isEmpty() ) {
-        return newFilePath;
-    }
-
-    newFilePath = formatPath( filePath );
-    
-    if( newFilePath.right( 1 )!= QDir::separator() ){
-        newFilePath.append( QDir::separator() );
-    }
-    return newFilePath;
-}
-
-QString FmUtils::removePathSplash( const QString &filePath )
-{
-    QString newFilePath( filePath );
-    if( filePath.right( 1 ) == QChar( '/' ) || filePath.right(1) == QString( "\\" ) ) {
-        newFilePath = filePath.left( filePath.length() - 1 );
-    }
-    return newFilePath;
+    Q_UNUSED( driveName );
+	return FmErrNone; 
 }
 
 bool FmUtils::checkDriveAccessFilter( const QString &driveName )
 {
-#ifdef _DEBUG_HIDE_VIEWFOLDER_WINDOWS_
-    if( driveName.contains( Drive_D, Qt::CaseInsensitive ) || driveName.contains( Drive_Z, Qt::CaseInsensitive ) ) {
-        return false;
-    }
-#endif
+    Q_UNUSED( driveName );
     return true;
 }
 
 QString FmUtils::checkDriveToFolderFilter( const QString &path )
 {
-    QFileInfo fileInfo( path );
-    if( !fileInfo.exists() ) {
-            return QString();
-        }
-
-#ifdef _DEBUG_HIDE_VIEWFOLDER_WINDOWS_
-    QString checkedPath = fillPathWithSplash( path );
-    if( checkedPath.compare( QString( "C:/"), Qt::CaseInsensitive ) == 0 ) {
-        checkedPath += QString( "data/" );
-        QFileInfo fileInfo( checkedPath );
-        if( !fileInfo.exists() ) {
-            return QString();
-        }
-        return checkedPath;
-    }
-#endif
+    Q_UNUSED( path );
     return path;
 
 }
 
 QString FmUtils::checkFolderToDriveFilter( const QString &path )
 {
-#ifdef _DEBUG_HIDE_VIEWFOLDER_WINDOWS_
-    QString logString;
-    logString = QString( "checkFolderToDriveFilter: " ) + path;
-    FM_LOG( logString );
-    QString checkedPath = fillPathWithSplash( path );
-
-    logString = QString( "checkFolderToDriveFilter_fillPathWithSplash: " ) + checkedPath;
-    FM_LOG( logString );
-    
-    if( checkedPath.compare( QString( "C:/data/"), Qt::CaseInsensitive ) == 0 ) {
-        FM_LOG( QString( " change from c:/data/ to C:/" ) );
-        return QString( "C:/" );
-    }
-#endif
+    Q_UNUSED( path );
     return path;
 
 }
 
 int FmUtils::isPathAccessabel( const QString &path )
 {
-    if(!isDriveAvailable( path ) ) { //used to filter locked drive
-        return FmErrDriveNotAvailable;
-    }
-
-    QFileInfo fileInfo( path );
-
-#ifdef _DEBUG_HIDE_VIEWFOLDER_WINDOWS_
-    if( fileInfo.absoluteFilePath().contains( QString( Drive_C ), Qt::CaseInsensitive ) &&
-        !fileInfo.absoluteFilePath().contains( QString( Folder_C_Data ), Qt::CaseInsensitive ) ) {
-        return false;
-    }
-    if( fileInfo.absoluteFilePath().contains( QString( Drive_D ), Qt::CaseInsensitive ) ) {
-        return false;
-    }
-    if( fileInfo.absoluteFilePath().contains( QString( Drive_Z ), Qt::CaseInsensitive ) ) {
-        return false;
-    }
-#endif
-    if( !fileInfo.exists() ) {
-        return FmErrPathNotExist;
-    }
+    Q_UNUSED( path );
     return FmErrNone;
 }
 
 bool FmUtils::isDriveAvailable( const QString &path )
 {
-#ifdef _DEBUG_DISABLE_DRIVE_D_TEST_DRIVEHIDE_
-	if(path.contains(Drive_D, Qt::CaseInsensitive))
-		return false;
-#endif
-#ifdef _DEBUG_LOCKED_DRIVE_Z
-	if(path.contains(Drive_Z, Qt::CaseInsensitive))
-		return false;
-#endif
+    Q_UNUSED( path );
 	return true;
 }
 
-void FmUtils::getDriveList( QStringList &driveList, bool isHideUnAvailableDrive )
+bool FmUtils::isDefaultFolder( const QString &folderPath  )
 {
-    QFileInfoList infoList = QDir::drives();
+    Q_UNUSED( folderPath );
+    return false;
+}
 
-    foreach( QFileInfo fileInfo, infoList ) {
-        QString driveName = fileInfo.absolutePath();
-        if( checkDriveAccessFilter( driveName ) ) {
-            if( !isHideUnAvailableDrive ) {
-                driveList.append( driveName );
-            }
-            else if ( isDriveAvailable( driveName ) ) {
-                driveList.append( driveName );
-            }
-        }
-    }
-    return;
+void FmUtils::createDefaultFolders( const QString &driveName )
+{
+    Q_UNUSED( driveName );
+}
+
+/*!
+    set the \a desFile attributes as the same with \a srcFile
+*/
+int FmUtils::setFileAttributes( const QString &srcFile, const QString &desFile )
+{
+    Q_UNUSED( srcFile );
+    Q_UNUSED( desFile );
+    return FmErrNone;
 }
 
-QString FmUtils::fillDriveVolume( QString driveName, bool isFillWithDefaultVolume )
+/*!
+    judge whether there is enough space on \a targetDrive for \a size.
+    return true if has, false if not.
+*/
+bool FmUtils::hasEnoughSpace( const QString &targetDrive, qint64 size )
 {
-    QString ret;
-    QString tempDriveName = fillPathWithSplash( driveName );
-
-    QString checkedDriveName( removePathSplash( driveName ) );
-    
-    FmDriverInfo driverInfo = FmUtils::queryDriverInfo( tempDriveName );
-    QString volumeName = driverInfo.volumeName();
+    Q_UNUSED( targetDrive );
+    Q_UNUSED( size );
+    return true;
+}
 
-    if( volumeName.isEmpty() && isFillWithDefaultVolume ){
-    FmDriverInfo::DriveState driveState = queryDriverInfo( tempDriveName ).driveState();
-        if( driveState & FmDriverInfo::EDriveAvailable ){
-            if( driveState & FmDriverInfo::EDriveRemovable ) {
-                if( driveState & FmDriverInfo::EDriveMassStorage ) {
-                    // Mass Storage
-                    ret = hbTrId( "txt_fmgr_dblist_1_mass_storage" ).arg( checkedDriveName );  
-                } else if( driveState & FmDriverInfo::EDriveUsbMemory ) {
-                    // USB Memory
-                    ret = hbTrId( "txt_fmgr_dblist_1_usb_memory" ).arg( checkedDriveName );
-                } else{
-                    // Memory Card
-                    ret = hbTrId( "txt_fmgr_dblist_1_memory_card" ).arg( checkedDriveName );
-                }
-            } else{
-				// phone memory
-				ret = hbTrId( "txt_fmgr_dblist_1_device_memory" ).arg( checkedDriveName );
-            }
-        }
-    } else {
-        ret = hbTrId( "txt_fmgr_dblist_1_2" ).arg( checkedDriveName ).arg( volumeName );
-    }
-    return ret;
+/*!
+    move one file insice the same drive, from \a source to \a target.
+    return KErrNone if successful, otherwise one of the other system-wide error codes.
+*/
+int FmUtils::moveInsideDrive( const QString &source, const QString &target )
+{
+    Q_UNUSED( source );
+    Q_UNUSED( target );
+    return FmErrNone;
 }
 
 int FmUtils::launchFile( const QString &filePath )
@@ -404,11 +208,6 @@
     }
 }
 
-void FmUtils::sendFiles( QStringList &filePathList )
-{
-
-}
-
 QString FmUtils::getBurConfigPath( QString appPath )
 {
     QFileInfo fileInfo( appPath );
@@ -419,139 +218,31 @@
     return path;
 }
 
-bool FmUtils::isPathEqual( const QString &pathFst, const QString &pathLast )
+QString FmUtils::getFileType( const QString &filePath  )
 {
-    QString fst( fillPathWithSplash( pathFst ) );
-    QString last( fillPathWithSplash( pathLast ) );
-    if( fst.compare( last, Qt::CaseInsensitive ) == 0 ) {
-        return true;
-    }
-    return false;
-}
-
-bool FmUtils::isDefaultFolder( const QString &folderPath  )
-{
-    Q_UNUSED( folderPath );
-    return false;
+    Q_UNUSED( filePath );
+    return QString( "" );
 }
 
-/*!
-    All "/" and "\" in \a path will be changed to QDir::separator
-    \sa fillPathWithSplash, fillPathWithSplash will append QDir::separator in the end if path is no a file
-*/
-QString FmUtils::formatPath( const QString &path  )
+bool FmUtils::isDriveC( const QString &driveName )
 {
-    QString formatPath;
-    if( path.isEmpty() ) {
-        return formatPath;
+	if( driveName.contains(Drive_C,Qt::CaseInsensitive) ){
+        return true;
     }
-    
-    foreach( QChar ch, path ) {
-        if( ch == QChar('\\') || ch == QChar('/') ) {
-            formatPath.append( QDir::separator() );
-        } else {
-            formatPath.append( ch );
-        }
+    else{
+        return false;
     }
-
-    return formatPath;
 }
 
 int FmUtils::getMaxFileNameLength()
 {
-	return KMaxFileName;
+    return KMaxFileName;
 }
 
 bool FmUtils::checkMaxPathLength( const QString& path )
 {
-	if( path.length() > KMaxPath ) {
-		return false;
-	}
-	return true;
-}
-
-bool FmUtils::checkFolderFileName( const QString& name )
-{
-    // trim space firest, because there may be some spaces after "." ,  it is also not valid
-    // or there may only have spaces in name
-    QString trimmedName( name.trimmed() );
-	if( trimmedName.isEmpty() ) {
-		return false;
-	}
-    if( trimmedName.endsWith( QChar('.'),  Qt::CaseInsensitive ) ) {
-        return false;
-    }
-    if( trimmedName.contains( QChar('\\'), Qt::CaseInsensitive ) ||
-        trimmedName.contains( QChar('/'),  Qt::CaseInsensitive ) ||
-        trimmedName.contains( QChar(':'),  Qt::CaseInsensitive ) ||
-        trimmedName.contains( QChar('*'),  Qt::CaseInsensitive ) ||
-        trimmedName.contains( QChar('?'),  Qt::CaseInsensitive ) ||
-        trimmedName.contains( QChar('\"'), Qt::CaseInsensitive ) ||
-        trimmedName.contains( QChar('<'),  Qt::CaseInsensitive ) ||
-        trimmedName.contains( QChar('>'),  Qt::CaseInsensitive ) ||
-        trimmedName.contains( QChar('|'),  Qt::CaseInsensitive ) ){
-        return false;
-    }
-    // use orignal name to exam max size of file name
-    if( name.length() > KMaxFileName ) {
+    if( path.length() > KMaxPath ) {
         return false;
     }
     return true;
 }
-
-bool FmUtils::checkNewFolderOrFile( const QString &fileName, const QString &path, QString &errString )
-{
-    // first check if fileName is valid, then check if path length is valid, and check if file/foler is existed at last
-    QFileInfo fileInfo( path );
-    bool ret( true );   
-    if (!FmUtils::checkFolderFileName( fileName ) ) {
-        errString = hbTrId( "Invalid file or folder name, try again!" );
-        ret = false;
-    } else if( !FmUtils::checkMaxPathLength( path ) ) {
-        errString = hbTrId( "the path you specified is too long, try again!" );
-        ret = false;
-    } else if (fileInfo.exists()) {
-        errString = hbTrId( "%1 already exist!" ).arg( fileInfo.fileName() );
-        ret = false;
-    }
-    return ret;
-}
-
-QString FmUtils::getVolumeNameWithDefaultNameIfNull( const QString &diskName, bool &defaultName )
-{
-    FmDriverInfo driverInfo = FmUtils::queryDriverInfo( diskName );
-
-    // do not add default volume for win32 version as this is only the dummy implememnt for debug on windows
-    return driverInfo.volumeName();
-}
-
-/*!
-    Check if \a dest is sub level path of \a src
-    Used to check True/False when copy a folder to itself or its subfolder
-    For example, c:\data\test is sub path of c:\data.
-    But c:\data123\test is not sub path of c:\data.
-    So after got right part of path, the first char must be \ or /
-*/
-bool FmUtils::isSubLevelPath( const QString &src, const QString &dest )
-{
-    FM_LOG("FmUtils::isSubFolder: src=" + src + " dest=" + dest);
-    QString checkedSrc( FmUtils::fillPathWithSplash( src ) );
-    QString checkedDest( FmUtils::fillPathWithSplash( dest ) );
-    
-    if( checkedDest.contains( checkedSrc, Qt::CaseInsensitive) &&
-            checkedDest.length() > checkedSrc.length() ) {
-        // for example c:\data\ vs c:\data\123\ 
-        FM_LOG("FmUtils::isSubFolder: true");
-        return true;
-    }
-    // for example c:\data\ vs c:\data\ 
-    // for example c:\data\ vs c:\data123\ 
-
-    FM_LOG("FmUtils::isSubFolder: false");
-    return false;
-}
-
-int FmUtils::setFileAttributes( const QString &srcFile, const QString &desFile )
-{
-    return FmErrNone;
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/package_definition.xml	Thu Sep 02 17:00:51 2010 +0800
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<SystemDefinition schema="3.0.0" xmlns:qt="http://www.nokia.com/qt">
+ <package id="files" name="File Manager Apps" levels="support apps">
+  <collection id="filemanager" name="File Manager" level="apps">
+   <component id="filemanager_plat" name="File Manager Platform Interfaces" class="api" filter="s60" introduced="^4">
+    <unit base="filemanager/filemanager_plat"/>
+   </component>
+   <component id="fmbkupengine" filter="s60,bldfirst" name="File Manager Backup Engine" introduced="^4">
+       <unit bldFile="filemanager/src/fmbkupengine/group"/>
+   </component>
+   <component id="fmfiledialog" filter="s60,bldfirst" name="File Manager File Dialog" introduced="^4">
+       <unit bldFile="filemanager/src/fmfiledialog" qt:proFile="fmfiledialog.pro" qt:qmakeArgs="-r -config rom"/>
+   </component>
+   <component id="filemanager_rom" filter="s60" name="File Manager ROM" class="config"  introduced="^4">
+    <unit bldFile="filemanager/rom"/>
+   </component>
+   <component id="fmbkupenginewrapper" filter="s60" name="File Manager Build"  introduced="^4">
+    <unit bldFile="filemanager/src/fmbkupenginewrapper" qt:proFile="fmbkupenginewrapper.pro"/>
+   </component>
+   <component id="filemanager_src" filter="s60" name="File Manager Build"  introduced="^4">
+    <unit bldFile="filemanager/src/filemanager" qt:proFile="filemanager.pro"/>
+   </component>
+   <component id="filemanager_tests" name="File Manager Tests" filter="s60,test,qt_unit_test">
+     <unit bldFile="filemanager/tsrc" qt:proFile="tsrc.pro"/>
+   </component>
+  </collection>
+ </package>
+</SystemDefinition>
+        
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/package_map.xml	Thu Sep 02 17:00:51 2010 +0800
@@ -0,0 +1,1 @@
+<PackageMap root="sf" layer="app"/>