From 1ca8b39624a40ef86ebe33b1a32158126fa51e95 Mon Sep 17 00:00:00 2001 From: Renaud Barate Date: Thu, 10 Jul 2014 11:57:17 +0200 Subject: [PATCH 1/1] Support of non-ASCII filenames (to some extent) Non-ASCII filenames can be used to load and save schemas. Function SaveAs still strips the accents. Windows compatibility is not tested yet. --- src/genericgui/GenericGui.cxx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/genericgui/GenericGui.cxx b/src/genericgui/GenericGui.cxx index 9dd62d4d6..31d51b782 100644 --- a/src/genericgui/GenericGui.cxx +++ b/src/genericgui/GenericGui.cxx @@ -1291,7 +1291,7 @@ void GenericGui::loadSchema(const std::string& filename,bool edit, bool arrangeL { DEBTRACE(logger->getStr()); } - QString fn=QString::fromStdString(filename); + QString fn=QString::fromUtf8(filename.c_str()); if(edit) createContext(proc, fn, "", true); else @@ -1331,11 +1331,11 @@ void GenericGui::onImportSchema() if (!fi.exists() && fi.suffix() != "xml") fn += ".xml"; - DEBTRACE("file loaded : " <load(fn.toLatin1()); + proc = _loader->load(fn.toUtf8().constData()); } catch (...) { } @@ -1529,12 +1529,12 @@ void GenericGui::onExportSchema() } if (fn.isEmpty()) return; - DEBTRACE("GenericGui::onExportSchema: " << fn.toStdString()); + DEBTRACE("GenericGui::onExportSchema: " << fn.toUtf8().constData()); //to be sure that all pending changes are effective _parent->setFocus(); QtGuiContext::getQtCurrent()->setFileName(fn); VisitorSaveGuiSchema aWriter(proc); - aWriter.openFileSchema( fn.toStdString() ); + aWriter.openFileSchema( fn.toUtf8().constData() ); aWriter.visitProc(); aWriter.closeFileSchema(); QtGuiContext::getQtCurrent()->setNotSaved(false); @@ -1555,10 +1555,10 @@ void GenericGui::onExportSchemaAs() QString fn = getSaveFileName(fo); if (fn.isEmpty()) return; - DEBTRACE("GenericGui::onExportSchemaAs: " << fn.toStdString()); + DEBTRACE("GenericGui::onExportSchemaAs: " << fn.toUtf8().constData()); QtGuiContext::getQtCurrent()->setFileName(fn); VisitorSaveGuiSchema aWriter(proc); - aWriter.openFileSchema(fn.toStdString()); + aWriter.openFileSchema(fn.toUtf8().constData()); aWriter.visitProc(); aWriter.closeFileSchema(); _isSaved = true; -- 2.39.2