Salome HOME
Commit on V7_main: Update dialog File-Preferences-Import
authorimn <imn@opencascade.com>
Wed, 20 Nov 2013 13:29:03 +0000 (13:29 +0000)
committerimn <imn@opencascade.com>
Wed, 20 Nov 2013 13:29:03 +0000 (13:29 +0000)
src/LightApp/LightApp_PreferencesDlg.cxx
src/LightApp/resources/LightApp_msg_en.ts
src/LightApp/resources/LightApp_msg_fr.ts

index c9b5535dc691ce36a6b2d06cd18a38ef264c66fb..2c2458f70d0a83b5141ee861b47fb234f88102f2 100644 (file)
@@ -29,6 +29,7 @@
 #include "QtxResourceMgr.h"
 
 #include <SUIT_MessageBox.h>
+#include <SUIT_FileDlg.h>
 
 #include <QAbstractButton>
 #include <QVBoxLayout>
@@ -152,20 +153,15 @@ void LightApp_PreferencesDlg::onDefault()
 void LightApp_PreferencesDlg::onImportPref()
 {
   QtxResourceMgr* mgr = myPrefs->resourceMgr();
-  if( !mgr )
-    return;
-
-  QFileDialog dlg( this, tr("IMPORT_PREFERENCES"), ".", "*" );
-  dlg.setObjectName( "" );
-  //dlg.setShowHiddenFiles( true );
-  dlg.exec();
+  QStringList filtersList;
+  filtersList.append(tr("XML_FILES_FILTER"));
+  QString anInitialPath = "";
+  if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() )
+    anInitialPath = QDir::currentPath();
 
-  QStringList files = dlg.selectedFiles();
-  if ( files.isEmpty() )
-    return;
+  QString aName = SUIT_FileDlg::getFileName( this, anInitialPath, filtersList, tr("IMPORT_PREFERENCES"), true, true );
 
-  QString fname = files[0];
-  if( mgr->import( fname ) )
+  if( mgr->import( aName ) )
   {
     myPrefs->retrieve();
     myPrefs->toBackup();
index c1c0f2a50460761d8ba3a968ef551602bf1537d8..1295bba41c2edac75d135bac195bc370b5e64cef 100644 (file)
@@ -924,6 +924,10 @@ File does not exist</translation>
         <source>IMPORT_PREFERENCES</source>
         <translation>Import preferences</translation>
     </message>
+    <message>
+        <source>XML_FILES_FILTER</source>
+        <translation>XML Files (*.xml)</translation>
+    </message>
     <message>
         <source>CAPTION</source>
         <translation>Preferences</translation>
index b53b992f8c5e59c92f8132f88ab984b4b0c29739..e9f864f59d45b4a61e96e4f87b50453a1ee8e299 100755 (executable)
@@ -924,6 +924,10 @@ Le fichier n&apos;existe pas</translation>
         <source>IMPORT_PREFERENCES</source>
         <translation>Importer les préférences</translation>
     </message>
+    <message>
+        <source>XML_FILES_FILTER</source>
+        <translation type="unfinished">XML Files (*.xml)</translation>
+    </message>
     <message>
         <source>CAPTION</source>
         <translation>Préférences</translation>