filemanager/src/filemanager/src/fmdriverlistwidget.cpp
changeset 46 d58987eac7e8
parent 37 15bc28c9dd51
--- a/filemanager/src/filemanager/src/fmdriverlistwidget.cpp	Tue Aug 24 10:24:14 2010 +0800
+++ b/filemanager/src/filemanager/src/fmdriverlistwidget.cpp	Wed Sep 29 10:37:03 2010 +0800
@@ -79,8 +79,8 @@
 	mLayout->addItem( mListView );	
 	mSearchPanel = new HbSearchPanel( this );
 	mSearchPanel->setObjectName( "searchPanel" );
-	mSearchPanel->setSearchOptionsEnabled( true );
-	mSearchPanel->setProgressive( false );
+	mSearchPanel->setSearchOptionsEnabled( false );
+	mSearchPanel->setProgressive( true );
 	mSearchPanel->hide();
 	connect( mListView, SIGNAL( activated( const QModelIndex & ) ),
 		     this, SLOT( on_list_activated( const QModelIndex & ) ) );
@@ -90,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() ) );
@@ -251,7 +248,7 @@
     FmDriverInfo driverInfo = FmUtils::queryDriverInfo( diskName );
 
     if ( state & FmDriverInfo::EDriveWriteProtected ){
-        FmDlgUtils::information( hbTrId( "Unable to perform operation. Memory card is read only." ) );
+        FmDlgUtils::warning( hbTrId( "Unable to perform operation. Memory card is read only." ) );
         return;
         }
 
@@ -270,13 +267,13 @@
         }
         int err = FmUtils::renameDrive( diskName, volumeName );
         if ( err == FmErrNone ) {
-            FmDlgUtils::information( hbTrId( "The name has been changed!" ) );
+            FmDlgUtils::information( hbTrId( "The name has been changed!" ), HbMessageBox::Ok, true );
             mModel->refresh();
             break;
         } else if( err == FmErrBadName ) {
-            FmDlgUtils::information( hbTrId( "Illegal characters! Use only letters and numbers." ) );
+            FmDlgUtils::warning( hbTrId( "Illegal characters! Use only letters and numbers." ), HbMessageBox::Ok, true );
         } else{
-            FmDlgUtils::information( hbTrId( "Error occurred, operation cancelled!" ) );
+            FmDlgUtils::warning( hbTrId( "Error occurred, operation cancelled!" ) );
             break;
         }                
     }
@@ -302,10 +299,10 @@
     QString associatedDrives( FmUtils::getDriveLetterFromPath( diskName ) );
     if( FmDlgUtils::showMultiPasswordQuery( firstLabel, secondLabel, newPwd, FmMaxLengthofDrivePassword, associatedDrives ) ) {
        if ( FmUtils::setDrivePwd( diskName, oldPwd, newPwd ) == 0 ){
-            FmDlgUtils::information( hbTrId( "The password has been set!" ) );
+            FmDlgUtils::information( hbTrId( "The password has been set!" ), HbMessageBox::Ok, true );
         }
         else{
-            FmDlgUtils::information( hbTrId( "Error occurred, operation cancelled!" ) );
+            FmDlgUtils::warning( hbTrId( "Error occurred, operation cancelled!" ) );
         }
     }
 }
@@ -328,7 +325,7 @@
                 if ( FmUtils::setDrivePwd( diskName, oldPwd, newPwd ) == 0 ){
                     FmDlgUtils::information( hbTrId( "The password has been changed!" ) );
                 } else {
-                    FmDlgUtils::information( hbTrId( "Error occurred, operation cancelled!" ) );
+                    FmDlgUtils::warning( hbTrId( "Error occurred, operation cancelled!" ) );
                 }
                 break;
             } else {  
@@ -357,12 +354,12 @@
                     FmDlgUtils::information( hbTrId( "The password has been removed!" ) );
                 }
                 else{
-                    FmDlgUtils::information( hbTrId( "Error occurred, operation cancelled!" ) );
+                    FmDlgUtils::warning( hbTrId( "Error occurred, operation cancelled!" ) );
                 }
                 break;
             }
             else {
-                FmDlgUtils::information( hbTrId( "The password is incorrect, try again!" ) );
+                FmDlgUtils::warning( hbTrId( "The password is incorrect, try again!" ), HbMessageBox::Ok, true );
             }
             
         }
@@ -381,18 +378,18 @@
     while( FmDlgUtils::showSinglePasswordQuery( title, oldPwd, FmMaxLengthofDrivePassword ) ) {
         int err = FmUtils::unlockDrive( diskName, oldPwd );
         if( err == FmErrNone ) {
-            FmDlgUtils::information( hbTrId( "The memory is unlocked!" ) );
+            FmDlgUtils::warning( hbTrId( "The memory is unlocked!" ) );
             break;
         } else if ( err == FmErrAccessDenied ) {
-            FmDlgUtils::information( hbTrId( "The password is incorrect, try again!" ) );
+            FmDlgUtils::warning( hbTrId( "The password is incorrect, try again!" ), HbMessageBox::Ok, true );
         } else if (err == FmErrAlreadyExists ) {
             FmDlgUtils::information( hbTrId( "The disk has already been unlocked!" ) );
             break;
         } else if( err == FmErrNotSupported ) {
-            FmDlgUtils::information( hbTrId( "The media does not support password locking!" ) );
+            FmDlgUtils::warning( hbTrId( "The media does not support password locking!" ) );
             break;
         } else {
-            FmDlgUtils::information( hbTrId( "Error occurred, operation cancelled!" ) );
+            FmDlgUtils::warning( hbTrId( "Error occurred, operation cancelled!" ) );
             break;
         }
     }
@@ -425,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()