From: vsr Date: Mon, 27 Jul 2009 06:59:00 +0000 (+0000) Subject: Issue 20334 : [CEA 336] Open/SaveAs should show current directory X-Git-Tag: V5_1_3rc1~44 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=cd5efc8ac37d2e2e350b2419d311ad5a210195f2;p=modules%2Fgui.git Issue 20334 : [CEA 336] Open/SaveAs should show current directory --- diff --git a/src/LightApp/resources/LightApp.xml b/src/LightApp/resources/LightApp.xml index 0b7cc506b..ebfc4ab4b 100644 --- a/src/LightApp/resources/LightApp.xml +++ b/src/LightApp/resources/LightApp.xml @@ -91,6 +91,7 @@
+
diff --git a/src/SUIT/SUIT_FileDlg.cxx b/src/SUIT/SUIT_FileDlg.cxx index cadb8fa96..c60f4b6fc 100755 --- a/src/SUIT/SUIT_FileDlg.cxx +++ b/src/SUIT/SUIT_FileDlg.cxx @@ -119,6 +119,8 @@ SUIT_FileDlg::SUIT_FileDlg( QWidget* parent, bool open, bool showQuickDir, bool myQuickButton( 0 ), myCheckPermissions( true ) { + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + setModal( modal ); setSizeGripEnabled( true ); if ( parent ) @@ -137,9 +139,8 @@ SUIT_FileDlg::SUIT_FileDlg( QWidget* parent, bool open, bool showQuickDir, bool // retrieve directories list from the resources QStringList dirList; - SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); if ( resMgr ) - dirList = resMgr->stringValue( "FileDlg", QString( "QuickDirList" ) ).split( ';', QString::SkipEmptyParts ); + dirList = resMgr->stringValue( "FileDlg", "QuickDirList" ).split( ';', QString::SkipEmptyParts ); if ( dirList.isEmpty() ) dirList << QDir::homePath(); @@ -157,11 +158,16 @@ SUIT_FileDlg::SUIT_FileDlg( QWidget* parent, bool open, bool showQuickDir, bool setAcceptMode( open ? AcceptOpen: AcceptSave ); setWindowTitle( open ? tr( "INF_DESK_DOC_OPEN" ) : tr( "INF_DESK_DOC_SAVE" ) ); + bool showCurrentDirInitial = resMgr ? resMgr->booleanValue( "FileDlg", "ShowCurDirInitial", false ) : false; + // If last visited path doesn't exist -> switch to the first preferred path if ( !myLastVisitedPath.isEmpty() ) { if ( !processPath( myLastVisitedPath ) && showQuickDir ) processPath( myQuickCombo->itemText( 0 ) ); } + else if ( showCurrentDirInitial ) { + processPath( QDir::currentPath() ); + } else if ( showQuickDir ) { processPath( myQuickCombo->itemText( 0 ) ); } @@ -562,11 +568,11 @@ bool SUIT_FileDlg::processPath( const QString& path ) setDirectory( path ); return true; } - else if ( QFileInfo( SUIT_Tools::dir( path ) ).exists() ) { - setDirectory( SUIT_Tools::dir( path ) ); - selectFile( path ); - return true; - } + QString dirPath = SUIT_Tools::dir( path, false ); + if ( !dirPath.isEmpty() && QFileInfo( dirPath ).exists() ) + setDirectory( dirPath ); + selectFile( SUIT_Tools::file( path ) ); + return true; } return false; } @@ -640,7 +646,7 @@ void SUIT_FileDlg::addQuickDir() SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); if ( resMgr ) - dirList = resMgr->stringValue( "FileDlg", QString( "QuickDirList" ) ).split( ';', QString::SkipEmptyParts ); + dirList = resMgr->stringValue( "FileDlg", "QuickDirList" ).split( ';', QString::SkipEmptyParts ); bool found = false; bool emptyAndHome = false; @@ -660,7 +666,7 @@ void SUIT_FileDlg::addQuickDir() if ( !found ) { dirList.append( dp ); - resMgr->setValue( "FileDlg", QString( "QuickDirList" ), dirList.join( ";" ) ); + resMgr->setValue( "FileDlg", "QuickDirList", dirList.join( ";" ) ); if ( !emptyAndHome ) myQuickCombo->addItem( dp ); } diff --git a/src/SalomeApp/resources/SalomeApp.xml b/src/SalomeApp/resources/SalomeApp.xml index a0d6846f4..7864376bf 100644 --- a/src/SalomeApp/resources/SalomeApp.xml +++ b/src/SalomeApp/resources/SalomeApp.xml @@ -192,6 +192,7 @@
+