From: gdd Date: Tue, 27 Mar 2012 09:20:03 +0000 (+0000) Subject: The study and script names were converted from QString to char* by using toLatin1... X-Git-Tag: V6_5_0a1~12 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3719e021f0f700a32cd64ad48c3a96a5b83933f9;p=modules%2Fgui.git The study and script names were converted from QString to char* by using toLatin1 or toStdString. Now they are converted using toUtf8 in order to be able to read/write studies and scripts with non ascii characters in their full path. --- diff --git a/src/PyConsole/PyConsole_Editor.cxx b/src/PyConsole/PyConsole_Editor.cxx index b4b8f1084..83f7a7f8b 100644 --- a/src/PyConsole/PyConsole_Editor.cxx +++ b/src/PyConsole/PyConsole_Editor.cxx @@ -176,7 +176,7 @@ protected: { if ( myCommand != "" ) { - int ret = getInterp()->run( myCommand.toLatin1() ); + int ret = getInterp()->run( myCommand.toUtf8().data() ); if ( ret < 0 ) myState = PyInterp_Event::ES_ERROR; else if ( ret > 0 ) diff --git a/src/SalomeApp/SalomeApp_Study.cxx b/src/SalomeApp/SalomeApp_Study.cxx index 2a9e5053b..3d5f2ac50 100644 --- a/src/SalomeApp/SalomeApp_Study.cxx +++ b/src/SalomeApp/SalomeApp_Study.cxx @@ -423,7 +423,7 @@ bool SalomeApp_Study::createDocument( const QString& theStr ) // initialize myStudyDS, read HDF file QString aName = newStudyName(); - _PTR(Study) study ( SalomeApp_Application::studyMgr()->NewStudy( aName.toStdString() ) ); + _PTR(Study) study ( SalomeApp_Application::studyMgr()->NewStudy( aName.toUtf8().data() ) ); if ( !study ) return false; @@ -458,7 +458,7 @@ bool SalomeApp_Study::openDocument( const QString& theFileName ) MESSAGE( "openDocument" ); // initialize myStudyDS, read HDF file - _PTR(Study) study ( SalomeApp_Application::studyMgr()->Open( (char*) theFileName.toStdString().c_str() ) ); + _PTR(Study) study ( SalomeApp_Application::studyMgr()->Open( theFileName.toUtf8().data() ) ); if ( !study ) return false; @@ -510,7 +510,7 @@ bool SalomeApp_Study::loadDocument( const QString& theStudyName ) MESSAGE( "loadDocument" ); // obtain myStudyDS from StudyManager - _PTR(Study) study ( SalomeApp_Application::studyMgr()->GetStudyByName( (char*) theStudyName.toStdString().c_str() ) ); + _PTR(Study) study ( SalomeApp_Application::studyMgr()->GetStudyByName( theStudyName.toUtf8().data() ) ); if ( !study ) return false; @@ -588,8 +588,8 @@ bool SalomeApp_Study::saveDocumentAs( const QString& theFileName ) bool isMultiFile = resMgr->booleanValue( "Study", "multi_file", false ); bool isAscii = resMgr->booleanValue( "Study", "ascii_file", false ); bool res = (isAscii ? - SalomeApp_Application::studyMgr()->SaveAsASCII( theFileName.toStdString(), studyDS(), isMultiFile ) : - SalomeApp_Application::studyMgr()->SaveAs ( theFileName.toStdString(), studyDS(), isMultiFile )) + SalomeApp_Application::studyMgr()->SaveAsASCII( theFileName.toUtf8().data(), studyDS(), isMultiFile ) : + SalomeApp_Application::studyMgr()->SaveAs ( theFileName.toUtf8().data(), studyDS(), isMultiFile )) && CAM_Study::saveDocumentAs( theFileName ); res = res && saveStudyData(theFileName); @@ -721,8 +721,8 @@ bool SalomeApp_Study::dump( const QString& theFileName, // Now dump SALOMEDS part that also involves SalomeApp_Engine in case if // any light module is present in the current configuration QFileInfo aFileInfo( theFileName ); - bool res = aStudy->DumpStudy( aFileInfo.absolutePath().toStdString(), - aFileInfo.baseName().toStdString(), + bool res = aStudy->DumpStudy( aFileInfo.absolutePath().toUtf8().data(), + aFileInfo.baseName().toUtf8().data(), toPublish, isMultiFile); if ( toSaveGUI ) @@ -786,7 +786,7 @@ void SalomeApp_Study::saveModuleData( QString theModuleName, QStringList theList for ( QStringList::Iterator it = theListOfFiles.begin(); it != theListOfFiles.end(); ++it ) { if ( (*it).isEmpty() ) continue; - aListOfFiles[anIndex] = (*it).toStdString(); + aListOfFiles[anIndex] = (*it).toUtf8().data(); anIndex++; } SetListOfFiles(theModuleName.toStdString().c_str(), aListOfFiles);