From da234230f051a933fa450ce434fa1278b1a6aeeb Mon Sep 17 00:00:00 2001 From: imn Date: Wed, 20 Nov 2013 13:29:03 +0000 Subject: [PATCH] Commit on V7_main: Update dialog File-Preferences-Import --- src/LightApp/LightApp_PreferencesDlg.cxx | 20 ++++++++------------ src/LightApp/resources/LightApp_msg_en.ts | 4 ++++ src/LightApp/resources/LightApp_msg_fr.ts | 4 ++++ 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/LightApp/LightApp_PreferencesDlg.cxx b/src/LightApp/LightApp_PreferencesDlg.cxx index c9b5535dc..2c2458f70 100644 --- a/src/LightApp/LightApp_PreferencesDlg.cxx +++ b/src/LightApp/LightApp_PreferencesDlg.cxx @@ -29,6 +29,7 @@ #include "QtxResourceMgr.h" #include +#include #include #include @@ -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(); diff --git a/src/LightApp/resources/LightApp_msg_en.ts b/src/LightApp/resources/LightApp_msg_en.ts index c1c0f2a50..1295bba41 100644 --- a/src/LightApp/resources/LightApp_msg_en.ts +++ b/src/LightApp/resources/LightApp_msg_en.ts @@ -924,6 +924,10 @@ File does not exist IMPORT_PREFERENCES Import preferences + + XML_FILES_FILTER + XML Files (*.xml) + CAPTION Preferences diff --git a/src/LightApp/resources/LightApp_msg_fr.ts b/src/LightApp/resources/LightApp_msg_fr.ts index b53b992f8..e9f864f59 100755 --- a/src/LightApp/resources/LightApp_msg_fr.ts +++ b/src/LightApp/resources/LightApp_msg_fr.ts @@ -924,6 +924,10 @@ Le fichier n'existe pas IMPORT_PREFERENCES Importer les préférences + + XML_FILES_FILTER + XML Files (*.xml) + CAPTION Préférences -- 2.39.2