]> git.lyx.org Git - lyx.git/commitdiff
* FileDialog.C: always return POSIX-like path names ('/' instead of '\' on Windows)
authorMichael Schmitt <michael.schmitt@teststep.org>
Tue, 5 Dec 2006 19:51:50 +0000 (19:51 +0000)
committerMichael Schmitt <michael.schmitt@teststep.org>
Tue, 5 Dec 2006 19:51:50 +0000 (19:51 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16186 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/FileDialog.C

index 2204abd2f87eda712bab4190cda9994218eba22b..55521842189e0eb04090b3c445daee61feb21adb 100644 (file)
@@ -20,6 +20,7 @@
 #include "gettext.h"
 
 #include "support/filefilterlist.h"
+#include "support/os.h"
 
 /** when this is defined, the code will use
  * QFileDialog::getOpenFileName and friends to create filedialogs.
@@ -44,6 +45,7 @@ using lyx::support::makeAbsPath;
 namespace lyx {
 
 using support::FileFilterList;
+using support::os::internal_path;
 using std::endl;
 
 
@@ -82,9 +84,9 @@ FileDialog::Result const FileDialog::save(docstring const & path,
 #ifdef USE_NATIVE_FILEDIALOG
        docstring const startsWith
                = lyx::from_utf8(makeAbsPath(lyx::to_utf8(suggested), lyx::to_utf8(path)));
-       result.second = qstring_to_ucs4(QFileDialog::getSaveFileName(
-               qApp->focusWidget(),
-               toqstr(title_), toqstr(startsWith), toqstr(filters.as_string()) ));
+       result.second = lyx::from_utf8(internal_path(fromqstr(
+               QFileDialog::getSaveFileName(qApp->focusWidget(),
+               toqstr(title_), toqstr(startsWith), toqstr(filters.as_string()) ))));
 #else
        LyXFileDialog dlg(title_, path, filters, private_->b1, private_->b2);
        dlg.setFileMode(QFileDialog::AnyFile);
@@ -97,7 +99,8 @@ FileDialog::Result const FileDialog::save(docstring const & path,
        int res = dlg.exec();
        lyxerr[Debug::GUI] << "result " << res << endl;
        if (res == QDialog::Accepted)
-               result.second = qstring_to_ucs4(dlg.selectedFiles()[0]);
+               result.second = lyx::from_utf8(internal_path(
+                                       fromqstr(dlg.selectedFiles()[0])));
        dlg.hide();
 #endif
        return result;
@@ -117,9 +120,9 @@ FileDialog::Result const FileDialog::open(docstring const & path,
 #ifdef USE_NATIVE_FILEDIALOG
        docstring const startsWith =
                lyx::from_utf8(makeAbsPath(lyx::to_utf8(suggested), lyx::to_utf8(path)));
-       result.second = qstring_to_ucs4(QFileDialog::getOpenFileName(
-               qApp->focusWidget(), 
-               toqstr(title_), toqstr(startsWith), toqstr(filters.as_string()) ));
+       result.second = lyx::from_utf8(internal_path(fromqstr(
+               QFileDialog::getOpenFileName(qApp->focusWidget(), 
+               toqstr(title_), toqstr(startsWith), toqstr(filters.as_string()) ))));
 #else
        LyXFileDialog dlg(title_, path, filters, private_->b1, private_->b2);
 
@@ -130,7 +133,8 @@ FileDialog::Result const FileDialog::open(docstring const & path,
        int res = dlg.exec();
        lyxerr[Debug::GUI] << "result " << res << endl;
        if (res == QDialog::Accepted)
-               result.second = qstring_to_ucs4(dlg.selectedFiles()[0]);
+               result.second = lyx::from_utf8(internal_path(
+                                       fromqstr(dlg.selectedFiles()[0])));
        dlg.hide();
 #endif
        return result;
@@ -148,9 +152,9 @@ FileDialog::Result const FileDialog::opendir(docstring const & path,
 #ifdef USE_NATIVE_FILEDIALOG
        docstring const startsWith
                = lyx::from_utf8(makeAbsPath(lyx::to_utf8(suggested), lyx::to_utf8(path)));
-       result.second = qstring_to_ucs4(QFileDialog::getExistingDirectory(
-               qApp->focusWidget(),
-               toqstr(title_),toqstr(startsWith) ));
+       result.second = lyx::from_utf8(internal_path(fromqstr(
+               QFileDialog::getExistingDirectory(qApp->focusWidget(),
+               toqstr(title_),toqstr(startsWith)))));
 #else
        FileFilterList const filter(_("Directories"));
 
@@ -165,7 +169,8 @@ FileDialog::Result const FileDialog::opendir(docstring const & path,
        int res = dlg.exec();
        lyxerr[Debug::GUI] << "result " << res << endl;
        if (res == QDialog::Accepted)
-               result.second = qstring_to_ucs4(dlg.selectedFiles()[0]);
+               result.second = lyx::from_utf8(internal_path(
+                                       fromqstr(dlg.selectedFiles()[0])));
        dlg.hide();
 #endif
        return result;