Windows: handle wchar/utf-8 conversions in some other places.

This commit is contained in:
Jean-Francois Dockes
2020-01-13 12:02:22 +01:00
parent 6efd91c057
commit c5a1208457
7 changed files with 189 additions and 107 deletions
+20
View File
@@ -336,7 +336,11 @@ static QString myGetFileName(bool isdir, QString caption, bool filenosave)
void ConfParamW::setValue(const QString& value)
{
if (m_fsencoding) {
#ifdef _WIN32
m_cflink->set(string((const char *)value.toUtf8()));
#else
m_cflink->set(string((const char *)value.toLocal8Bit()));
#endif
} else {
m_cflink->set(string((const char *)value.toUtf8()));
}
@@ -462,7 +466,11 @@ void ConfParamStrW::loadValue()
string s;
m_cflink->get(s);
if (m_fsencoding) {
#ifdef _WIN32
m_le->setText(m_origvalue = QString::fromUtf8(s.c_str()));
#else
m_le->setText(m_origvalue = QString::fromLocal8Bit(s.c_str()));
#endif
} else {
m_le->setText(m_origvalue = QString::fromUtf8(s.c_str()));
}
@@ -513,7 +521,11 @@ void ConfParamCStrW::loadValue()
m_cflink->get(s);
QString cs;
if (m_fsencoding) {
#ifdef _WIN32
cs = QString::fromUtf8(s.c_str());
#else
cs = QString::fromLocal8Bit(s.c_str());
#endif
} else {
cs = QString::fromUtf8(s.c_str());
}
@@ -619,7 +631,11 @@ void ConfParamFNW::loadValue()
{
string s;
m_cflink->get(s);
#ifdef _WIN32
m_le->setText(m_origvalue = QString::fromUtf8(s.c_str()));
#else
m_le->setText(m_origvalue = QString::fromLocal8Bit(s.c_str()));
#endif
}
void ConfParamFNW::showBrowserDialog()
@@ -765,7 +781,11 @@ void ConfParamSLW::loadValue()
QStringList qls;
for (const auto& str : ls) {
if (m_fsencoding) {
#ifdef _WIN32
qls.push_back(QString::fromUtf8(str.c_str()));
#else
qls.push_back(QString::fromLocal8Bit(str.c_str()));
#endif
} else {
qls.push_back(QString::fromUtf8(str.c_str()));
}
+1 -1
View File
@@ -77,7 +77,7 @@ void multiSave(QWidget *p, vector<Rcl::Doc>& docs)
*/
set<string> existingNames;
string reason;
if (!readdir(dir, reason, existingNames)) {
if (!listdir(dir, reason, existingNames)) {
QMessageBox::warning(0, "Recoll",
QWidget::tr("Could not read directory: ") +
QString::fromLocal8Bit(reason.c_str()));