]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Fix for bos #18341: HOME environment variable jfa/18341_HOME
authorjfa <jfa@opencascade.com>
Fri, 10 Apr 2020 11:38:06 +0000 (14:38 +0300)
committerjfa <jfa@opencascade.com>
Fri, 10 Apr 2020 11:38:06 +0000 (14:38 +0300)
src/GUI_PY/selectvars.py
src/SUIT/SUIT_LicenseDlg.cxx
src/SVTK/SVTK_RecorderDlg.cxx

index fec49160a2578096efbc6dee958941decb28b763..fe0d467262c2a2d81d137ba1591b0c9d950c618c 100644 (file)
@@ -126,7 +126,7 @@ class MySelectVarsDialog(Ui_SelectVarsDialog, QDialog):
 
     def loadVars(self):
         filename = QFileDialog.getOpenFileName(self, self.tr("Import variables from file"),
-                                                     os.getenv("HOME"),
+                                                     os.path.expanduser("~"),
                                                      self.tr("XML Files (*.xml)"))
         if not filename:
             return
@@ -139,7 +139,7 @@ class MySelectVarsDialog(Ui_SelectVarsDialog, QDialog):
                                  self.tr("Cannot load file %s:\n%s" % (filename, e)))
 
     def saveVars(self):
-        default = os.path.join(os.getenv("HOME"), "vars.xml")
+        default = os.path.join(os.path.expanduser("~"), "vars.xml")
         filename = QFileDialog.getSaveFileName(self, self.tr("Export variables to file"),
                                                      default, self.tr("XML Files (*.xml)"))
         if not filename:
index efd266adc72e5b20157b5fccc5dc12f2b0bc49ec..a6faec6dfd4d3dce7f75758deb393253e237159a 100644 (file)
@@ -25,6 +25,7 @@
 #include <QPushButton>
 #include <QTextStream> 
 #include <QFile>
+#include <QDir>
 #include <QPrinter>
 //#include <QSimpleRichText>
 #include <QTextDocument>
@@ -115,6 +116,7 @@ SUIT_LicenseDlg::~SUIT_LicenseDlg()
 
 void SUIT_LicenseDlg::onAgree()
 {
+  /*
   QString env;
 #ifdef WIN32
   DWORD aLen=1024;
@@ -138,6 +140,11 @@ void SUIT_LicenseDlg::onAgree()
   QFile file( env + "/ReadLicense.log" ); // Read the text from a file
 
   file.open( QIODevice::WriteOnly );
+  */
+  QString env = QDir::homePath();
+  QFile file( env + "/ReadLicense.log" );
+  if (!file.open( QIODevice::WriteOnly ))
+    reject();
 
   QTextStream ts( &file );
   ts << "OK" << endl;
index b8816ad77eda3ad372a422055bdc8670677f70aa..346b9057751e3a8bb7284b43414de7c4e3c9be79 100644 (file)
@@ -38,6 +38,7 @@
 #include <QLayout>
 #include <QLineEdit>
 #include <QPushButton>
+#include <QDir>
 
 /*!
  * Constructor
@@ -175,7 +176,7 @@ bool SVTK_RecorderDlg::onBrowseFile()
   aFilter.append( tr( "FLT_AVI_FILES" ) );
   aFilter.append( tr( "FLT_ALL_FILES" ) );
 
-  QString aFileName = SUIT_FileDlg::getFileName( this, Qtx::getenv( "HOME" ), aFilter,
+  QString aFileName = SUIT_FileDlg::getFileName( this, QDir::homePath(), aFilter,
                                                  tr( "FILE_NAME" ), false );
 
   if( aFileName.isNull() )