Commit 02b56633 authored by David Faure's avatar David Faure
Browse files

Fix kio-extras compilation with -DQT_NO_CAST_TO_ASCII

Summary:
D27804 broke compilation for me because I have the above flag set ;-)
It showed rather some rather nasty QString -> QByteArray conversions in this code.

Test Plan: Now it builds.

Reviewers: thiago, sitter

Reviewed By: sitter

Subscribers: meven, kde-frameworks-devel, kfm-devel

Tags: #dolphin, #frameworks

Differential Revision: https://phabricator.kde.org/D29149
parent 12e03aa5
......@@ -57,7 +57,7 @@ include(ECMMarkAsTest)
include(ECMOptionalAddSubdirectory)
include(ECMQtDeclareLoggingCategory)
add_definitions(-DQT_NO_URL_CAST_FROM_STRING)
add_definitions(-DQT_NO_URL_CAST_FROM_STRING -DQT_NO_CAST_TO_ASCII)
find_package(KF5Activities QUIET)
set_package_properties(KF5Activities PROPERTIES
......
......@@ -142,14 +142,15 @@ void SMBUrl::updateCache()
query.removeQueryItem("kio-workgroup");
sambaUrl.setQuery(query);
m_surl = "smb://";
QString url;
url = "smb://";
if (!sambaUrl.userInfo().isEmpty()) {
m_surl += sambaUrl.userInfo() + "@";
url += sambaUrl.userInfo() + "@";
}
m_surl += workgroup;
url += workgroup;
// Workgroups can have ports per the IANA definition of smb.
if (sambaUrl.port() != -1) {
m_surl += ':' + QString::number(sambaUrl.port());
url += ':' + QString::number(sambaUrl.port());
}
// Make sure to only use clear paths. libsmbc is allergic to excess slashes.
......@@ -160,14 +161,15 @@ void SMBUrl::updateCache()
if (!sambaUrl.path().isEmpty()) {
path += sambaUrl.path();
}
m_surl += QDir::cleanPath(path);
url += QDir::cleanPath(path);
if (!sambaUrl.query().isEmpty()) {
m_surl += '?' + sambaUrl.query();
url += '?' + sambaUrl.query();
}
if (!sambaUrl.fragment().isEmpty()) {
m_surl += '#' + sambaUrl.fragment();
url += '#' + sambaUrl.fragment();
}
m_surl = QUrl(url).toString(QUrl::PrettyDecoded).toUtf8();
}
m_type = SMBURLTYPE_UNKNOWN;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment