mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Convert internal_path() to unicode (partially). Fix bug 3114:
http://bugzilla.lyx.org/show_bug.cgi?id=3114 * os.h - new docstring adapted internal_path() * qt_helpers.[Ch]: - new QString adapted internal_path() All other files: use that. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16744 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
3d2184730a
commit
0c496dc535
@ -455,7 +455,8 @@ void QExternal::apply()
|
|||||||
{
|
{
|
||||||
InsetExternalParams params = controller().params();
|
InsetExternalParams params = controller().params();
|
||||||
|
|
||||||
params.filename.set(internal_path(fromqstr(dialog_->fileED->text())),
|
// FIXME: UNICODE
|
||||||
|
params.filename.set(to_utf8(internal_path(dialog_->fileED->text())),
|
||||||
kernel().bufferFilepath());
|
kernel().bufferFilepath());
|
||||||
|
|
||||||
params.settemplate(controller().getTemplate(
|
params.settemplate(controller().getTemplate(
|
||||||
|
@ -270,7 +270,8 @@ void QGraphics::apply()
|
|||||||
{
|
{
|
||||||
InsetGraphicsParams & igp = controller().params();
|
InsetGraphicsParams & igp = controller().params();
|
||||||
|
|
||||||
igp.filename.set(internal_path(fromqstr(dialog_->filename->text())),
|
// FIXME: UNICODE
|
||||||
|
igp.filename.set(to_utf8(internal_path(dialog_->filename->text())),
|
||||||
kernel().bufferFilepath());
|
kernel().bufferFilepath());
|
||||||
|
|
||||||
// the bb section
|
// the bb section
|
||||||
|
@ -103,7 +103,7 @@ void QInclude::apply()
|
|||||||
{
|
{
|
||||||
InsetCommandParams params = controller().params();
|
InsetCommandParams params = controller().params();
|
||||||
|
|
||||||
params["filename"] = from_utf8(internal_path(fromqstr(dialog_->filenameED->text())));
|
params["filename"] = internal_path(dialog_->filenameED->text());
|
||||||
params.preview(dialog_->previewCB->isChecked());
|
params.preview(dialog_->previewCB->isChecked());
|
||||||
|
|
||||||
int const item = dialog_->typeCO->currentIndex();
|
int const item = dialog_->typeCO->currentIndex();
|
||||||
|
@ -176,12 +176,6 @@ QString const external_path_list(string const & input)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string const internal_path(QString const & input)
|
|
||||||
{
|
|
||||||
return lyx::support::os::internal_path(fromqstr(input));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
string const internal_path_list(QString const & input)
|
string const internal_path_list(QString const & input)
|
||||||
{
|
{
|
||||||
return lyx::support::os::internal_path_list(fromqstr(input));
|
return lyx::support::os::internal_path_list(fromqstr(input));
|
||||||
@ -254,8 +248,10 @@ void PrefKeyboard::apply(LyXRC & rc) const
|
|||||||
{
|
{
|
||||||
// FIXME: can derive CB from the two EDs
|
// FIXME: can derive CB from the two EDs
|
||||||
rc.use_kbmap = keymapCB->isChecked();
|
rc.use_kbmap = keymapCB->isChecked();
|
||||||
rc.primary_kbmap = internal_path(firstKeymapED->text());
|
|
||||||
rc.secondary_kbmap = internal_path(secondKeymapED->text());
|
// FIXME: UNICODE
|
||||||
|
rc.primary_kbmap = to_utf8(internal_path(firstKeymapED->text()));
|
||||||
|
rc.secondary_kbmap = to_utf8(internal_path(secondKeymapED->text()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -683,13 +679,14 @@ PrefPaths::PrefPaths(QPrefs * form, QWidget * parent)
|
|||||||
|
|
||||||
void PrefPaths::apply(LyXRC & rc) const
|
void PrefPaths::apply(LyXRC & rc) const
|
||||||
{
|
{
|
||||||
rc.document_path = internal_path(workingDirED->text());
|
// FIXME: UNICODE
|
||||||
rc.template_path = internal_path(templateDirED->text());
|
rc.document_path = to_utf8(internal_path(workingDirED->text()));
|
||||||
rc.backupdir_path = internal_path(backupDirED->text());
|
rc.template_path = to_utf8(internal_path(templateDirED->text()));
|
||||||
rc.tempdir_path = internal_path(tempDirED->text());
|
rc.backupdir_path = to_utf8(internal_path(backupDirED->text()));
|
||||||
|
rc.tempdir_path = to_utf8(internal_path(tempDirED->text()));
|
||||||
rc.path_prefix = internal_path_list(pathPrefixED->text());
|
rc.path_prefix = internal_path_list(pathPrefixED->text());
|
||||||
// FIXME: should be a checkbox only
|
// FIXME: should be a checkbox only
|
||||||
rc.lyxpipes = internal_path(lyxserverDirED->text());
|
rc.lyxpipes = to_utf8(internal_path(lyxserverDirED->text()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -707,7 +704,7 @@ void PrefPaths::update(LyXRC const & rc)
|
|||||||
void PrefPaths::select_templatedir()
|
void PrefPaths::select_templatedir()
|
||||||
{
|
{
|
||||||
docstring file(form_->controller().browsedir(
|
docstring file(form_->controller().browsedir(
|
||||||
qstring_to_ucs4(templateDirED->text()),
|
internal_path(templateDirED->text()),
|
||||||
_("Select a document templates directory")));
|
_("Select a document templates directory")));
|
||||||
if (!file.empty())
|
if (!file.empty())
|
||||||
templateDirED->setText(toqstr(file));
|
templateDirED->setText(toqstr(file));
|
||||||
@ -717,7 +714,7 @@ void PrefPaths::select_templatedir()
|
|||||||
void PrefPaths::select_tempdir()
|
void PrefPaths::select_tempdir()
|
||||||
{
|
{
|
||||||
docstring file(form_->controller().browsedir(
|
docstring file(form_->controller().browsedir(
|
||||||
qstring_to_ucs4(tempDirED->text()),
|
internal_path(tempDirED->text()),
|
||||||
_("Select a temporary directory")));
|
_("Select a temporary directory")));
|
||||||
if (!file.empty())
|
if (!file.empty())
|
||||||
tempDirED->setText(toqstr(file));
|
tempDirED->setText(toqstr(file));
|
||||||
@ -727,7 +724,7 @@ void PrefPaths::select_tempdir()
|
|||||||
void PrefPaths::select_backupdir()
|
void PrefPaths::select_backupdir()
|
||||||
{
|
{
|
||||||
docstring file(form_->controller().browsedir(
|
docstring file(form_->controller().browsedir(
|
||||||
qstring_to_ucs4(backupDirED->text()),
|
internal_path(backupDirED->text()),
|
||||||
_("Select a backups directory")));
|
_("Select a backups directory")));
|
||||||
if (!file.empty())
|
if (!file.empty())
|
||||||
backupDirED->setText(toqstr(file));
|
backupDirED->setText(toqstr(file));
|
||||||
@ -737,7 +734,7 @@ void PrefPaths::select_backupdir()
|
|||||||
void PrefPaths::select_workingdir()
|
void PrefPaths::select_workingdir()
|
||||||
{
|
{
|
||||||
docstring file(form_->controller().browsedir(
|
docstring file(form_->controller().browsedir(
|
||||||
qstring_to_ucs4(workingDirED->text()),
|
internal_path(workingDirED->text()),
|
||||||
_("Select a document directory")));
|
_("Select a document directory")));
|
||||||
if (!file.empty())
|
if (!file.empty())
|
||||||
workingDirED->setText(toqstr(file));
|
workingDirED->setText(toqstr(file));
|
||||||
@ -747,7 +744,7 @@ void PrefPaths::select_workingdir()
|
|||||||
void PrefPaths::select_lyxpipe()
|
void PrefPaths::select_lyxpipe()
|
||||||
{
|
{
|
||||||
docstring file(form_->controller().browse(
|
docstring file(form_->controller().browse(
|
||||||
qstring_to_ucs4(lyxserverDirED->text()),
|
internal_path(lyxserverDirED->text()),
|
||||||
_("Give a filename for the LyX server pipe")));
|
_("Give a filename for the LyX server pipe")));
|
||||||
if (!file.empty())
|
if (!file.empty())
|
||||||
lyxserverDirED->setText(toqstr(file));
|
lyxserverDirED->setText(toqstr(file));
|
||||||
@ -810,8 +807,9 @@ void PrefSpellchecker::apply(LyXRC & rc) const
|
|||||||
// FIXME: remove isp_use_esc_chars
|
// FIXME: remove isp_use_esc_chars
|
||||||
rc.isp_esc_chars = fromqstr(escapeCharactersED->text());
|
rc.isp_esc_chars = fromqstr(escapeCharactersED->text());
|
||||||
rc.isp_use_esc_chars = !rc.isp_esc_chars.empty();
|
rc.isp_use_esc_chars = !rc.isp_esc_chars.empty();
|
||||||
|
// FIXME: UNICODE
|
||||||
// FIXME: remove isp_use_pers_dict
|
// FIXME: remove isp_use_pers_dict
|
||||||
rc.isp_pers_dict = internal_path(persDictionaryED->text());
|
rc.isp_pers_dict = to_utf8(internal_path(persDictionaryED->text()));
|
||||||
rc.isp_use_pers_dict = !rc.isp_pers_dict.empty();
|
rc.isp_use_pers_dict = !rc.isp_pers_dict.empty();
|
||||||
rc.isp_accept_compound = compoundWordCB->isChecked();
|
rc.isp_accept_compound = compoundWordCB->isChecked();
|
||||||
rc.isp_use_input_encoding = inputEncodingCB->isChecked();
|
rc.isp_use_input_encoding = inputEncodingCB->isChecked();
|
||||||
@ -849,7 +847,8 @@ void PrefSpellchecker::update(LyXRC const & rc)
|
|||||||
|
|
||||||
void PrefSpellchecker::select_dict()
|
void PrefSpellchecker::select_dict()
|
||||||
{
|
{
|
||||||
docstring file(form_->controller().browsedict(qstring_to_ucs4(persDictionaryED->text())));
|
docstring file(form_->controller().browsedict(
|
||||||
|
internal_path(persDictionaryED->text())));
|
||||||
if (!file.empty())
|
if (!file.empty())
|
||||||
persDictionaryED->setText(toqstr(file));
|
persDictionaryED->setText(toqstr(file));
|
||||||
}
|
}
|
||||||
@ -1606,7 +1605,8 @@ void PrefPrinter::apply(LyXRC & rc) const
|
|||||||
rc.print_oddpage_flag = fromqstr(printerOddED->text());
|
rc.print_oddpage_flag = fromqstr(printerOddED->text());
|
||||||
rc.print_collcopies_flag = fromqstr(printerCollatedED->text());
|
rc.print_collcopies_flag = fromqstr(printerCollatedED->text());
|
||||||
rc.print_landscape_flag = fromqstr(printerLandscapeED->text());
|
rc.print_landscape_flag = fromqstr(printerLandscapeED->text());
|
||||||
rc.print_to_file = internal_path(printerToFileED->text());
|
// FIXME: UNICODE
|
||||||
|
rc.print_to_file = to_utf8(internal_path(printerToFileED->text()));
|
||||||
rc.print_extra_options = fromqstr(printerExtraED->text());
|
rc.print_extra_options = fromqstr(printerExtraED->text());
|
||||||
rc.print_spool_printerprefix = fromqstr(printerSpoolPrefixED->text());
|
rc.print_spool_printerprefix = fromqstr(printerSpoolPrefixED->text());
|
||||||
rc.print_paper_dimension_flag = fromqstr(printerPaperSizeED->text());
|
rc.print_paper_dimension_flag = fromqstr(printerPaperSizeED->text());
|
||||||
@ -1677,8 +1677,9 @@ PrefUserInterface::PrefUserInterface(QPrefs * form, QWidget * parent)
|
|||||||
|
|
||||||
void PrefUserInterface::apply(LyXRC & rc) const
|
void PrefUserInterface::apply(LyXRC & rc) const
|
||||||
{
|
{
|
||||||
rc.ui_file = internal_path(uiFileED->text());
|
// FIXME: UNICODE
|
||||||
rc.bind_file = internal_path(bindFileED->text());
|
rc.ui_file = to_utf8(internal_path(uiFileED->text()));
|
||||||
|
rc.bind_file = to_utf8(internal_path(bindFileED->text()));
|
||||||
rc.use_lastfilepos = restoreCursorCB->isChecked();
|
rc.use_lastfilepos = restoreCursorCB->isChecked();
|
||||||
rc.load_session = loadSessionCB->isChecked();
|
rc.load_session = loadSessionCB->isChecked();
|
||||||
if (loadWindowSizeCB->isChecked()) {
|
if (loadWindowSizeCB->isChecked()) {
|
||||||
@ -1723,7 +1724,9 @@ void PrefUserInterface::update(LyXRC const & rc)
|
|||||||
|
|
||||||
void PrefUserInterface::select_ui()
|
void PrefUserInterface::select_ui()
|
||||||
{
|
{
|
||||||
docstring file(form_->controller().browseUI(qstring_to_ucs4(uiFileED->text())));
|
docstring const name =
|
||||||
|
internal_path(uiFileED->text());
|
||||||
|
docstring file(form_->controller().browseUI(name));
|
||||||
if (!file.empty())
|
if (!file.empty())
|
||||||
uiFileED->setText(toqstr(file));
|
uiFileED->setText(toqstr(file));
|
||||||
}
|
}
|
||||||
@ -1731,7 +1734,9 @@ void PrefUserInterface::select_ui()
|
|||||||
|
|
||||||
void PrefUserInterface::select_bind()
|
void PrefUserInterface::select_bind()
|
||||||
{
|
{
|
||||||
docstring file(form_->controller().browsebind(qstring_to_ucs4(bindFileED->text())));
|
docstring const name =
|
||||||
|
internal_path(bindFileED->text());
|
||||||
|
docstring file(form_->controller().browsebind(name));
|
||||||
if (!file.empty())
|
if (!file.empty())
|
||||||
bindFileED->setText(toqstr(file));
|
bindFileED->setText(toqstr(file));
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include "lengthcommon.h"
|
#include "lengthcommon.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
|
|
||||||
|
#include "support/os.h"
|
||||||
#include "support/lstrings.h"
|
#include "support/lstrings.h"
|
||||||
#include "support/convert.h"
|
#include "support/convert.h"
|
||||||
|
|
||||||
@ -179,4 +180,10 @@ docstring const formatted(docstring const & text, int w)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
docstring const internal_path(QString const & input)
|
||||||
|
{
|
||||||
|
return lyx::support::os::internal_path(qstring_to_ucs4(input));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace lyx
|
} // namespace lyx
|
||||||
|
@ -59,6 +59,9 @@ QString const qt_(char const * str, const char * comment = 0);
|
|||||||
*/
|
*/
|
||||||
QString const qt_(std::string const & str);
|
QString const qt_(std::string const & str);
|
||||||
|
|
||||||
|
///
|
||||||
|
docstring const internal_path(QString const & input);
|
||||||
|
|
||||||
} // namespace lyx
|
} // namespace lyx
|
||||||
|
|
||||||
#endif // QTHELPERS_H
|
#endif // QTHELPERS_H
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
#ifndef OS_H
|
#ifndef OS_H
|
||||||
#define OS_H
|
#define OS_H
|
||||||
|
|
||||||
|
#include "support/docstring.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
|
||||||
@ -50,6 +52,9 @@ std::string external_path(std::string const & p);
|
|||||||
/// Converts a host OS style path to unix style.
|
/// Converts a host OS style path to unix style.
|
||||||
std::string internal_path(std::string const & p);
|
std::string internal_path(std::string const & p);
|
||||||
|
|
||||||
|
/// Converts a host OS style path to unix style.
|
||||||
|
docstring internal_path(docstring const & p);
|
||||||
|
|
||||||
/// Converts a unix style path list to host OS style.
|
/// Converts a unix style path list to host OS style.
|
||||||
std::string external_path_list(std::string const & p);
|
std::string external_path_list(std::string const & p);
|
||||||
|
|
||||||
|
@ -211,6 +211,13 @@ string internal_path(string const & p)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
docstring internal_path(docstring const & p)
|
||||||
|
{
|
||||||
|
// FIXME UNICODE
|
||||||
|
return from_utf8(convert_path(to_utf8(p), PathStyle(posix)));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
string external_path_list(string const & p)
|
string external_path_list(string const & p)
|
||||||
{
|
{
|
||||||
return convert_path_list(p, PathStyle(posix));
|
return convert_path_list(p, PathStyle(posix));
|
||||||
|
@ -70,6 +70,12 @@ string internal_path(string const & p)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
docstring internal_path(docstring const & p)
|
||||||
|
{
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
string external_path_list(string const & p)
|
string external_path_list(string const & p)
|
||||||
{
|
{
|
||||||
return p;
|
return p;
|
||||||
|
@ -240,6 +240,13 @@ string internal_path(string const & p)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
docstring internal_path(docstring const & p)
|
||||||
|
{
|
||||||
|
// FIXME UNICODE
|
||||||
|
return from_utf8(subst(get_long_path(to_utf8(p)), "\\", "/"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
string external_path_list(string const & p)
|
string external_path_list(string const & p)
|
||||||
{
|
{
|
||||||
return subst(p, '/', '\\');
|
return subst(p, '/', '\\');
|
||||||
|
Loading…
Reference in New Issue
Block a user