qt: Fix filename handling in cryptoconfig
* src/qgpgmenewcryptoconfig.cpp (QGpgMENewCryptoConfigEntry::urlValue): Build url from local file. (QGpgMENewCryptoConfigEntry::setURLValue): Set native seperated path. -- This fixes setting files through cryptoconfig on Windows. GnuPG-Bug-Id: T3939
This commit is contained in:
parent
7706fa2c92
commit
6b267c56fd
@ -42,6 +42,7 @@
|
|||||||
#include "gpgme_backend_debug.h"
|
#include "gpgme_backend_debug.h"
|
||||||
|
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
#include <QDir>
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
@ -521,8 +522,7 @@ QUrl QGpgMENewCryptoConfigEntry::urlValue() const
|
|||||||
Q_ASSERT(type == FilenameType || type == LdapServerType);
|
Q_ASSERT(type == FilenameType || type == LdapServerType);
|
||||||
Q_ASSERT(!isList());
|
Q_ASSERT(!isList());
|
||||||
if (type == FilenameType) {
|
if (type == FilenameType) {
|
||||||
QUrl url;
|
QUrl url = QUrl::fromLocalFile(m_option.currentValue().stringValue());
|
||||||
url.setPath(QFile::decodeName(m_option.currentValue().stringValue()));
|
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
return parseURL(type, stringValue());
|
return parseURL(type, stringValue());
|
||||||
@ -635,7 +635,7 @@ void QGpgMENewCryptoConfigEntry::setURLValue(const QUrl &url)
|
|||||||
if (str.isEmpty() && !isOptional()) {
|
if (str.isEmpty() && !isOptional()) {
|
||||||
m_option.resetToDefaultValue();
|
m_option.resetToDefaultValue();
|
||||||
} else if (type == FilenameType) {
|
} else if (type == FilenameType) {
|
||||||
m_option.setNewValue(m_option.createStringArgument(QFile::encodeName(str).constData()));
|
m_option.setNewValue(m_option.createStringArgument(QDir::toNativeSeparators(url.toLocalFile()).toUtf8().constData()));
|
||||||
} else {
|
} else {
|
||||||
m_option.setNewValue(m_option.createStringArgument(str.toUtf8().constData()));
|
m_option.setNewValue(m_option.createStringArgument(str.toUtf8().constData()));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user