mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-23 18:32:55 +00:00
partially revert a551f78d11
fixes Plasma::RunnerContext test failure Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
30d532b8a0
commit
4474d26443
1 changed files with 27 additions and 2 deletions
|
@ -3196,7 +3196,15 @@ QUrl QUrl::fromLocalFile(const QString &localFile)
|
|||
{
|
||||
QUrl url;
|
||||
url.setScheme(QLatin1String("file"));
|
||||
url.setPath(localFile);
|
||||
// magic for authority path-abempty
|
||||
if (localFile.startsWith(QLatin1String("//"))) {
|
||||
int indexOfPath = localFile.indexOf(QLatin1Char('/'), 2);
|
||||
url.setHost(localFile.mid(2, indexOfPath - 2));
|
||||
if (indexOfPath > 2)
|
||||
url.setPath(localFile.right(localFile.length() - indexOfPath));
|
||||
} else {
|
||||
url.setPath(localFile);
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
|
@ -3205,6 +3213,10 @@ QUrl QUrl::fromLocalFile(const QString &localFile)
|
|||
returned will use forward slashes, even if it was originally created
|
||||
from one with backslashes.
|
||||
|
||||
If this URL contains a non-empty hostname, it will be encoded in the
|
||||
returned value in the form found on SMB networks (for example,
|
||||
"//servername/path/to/file.txt").
|
||||
|
||||
If this is a relative URL, in Qt 4.x this function returns the path to
|
||||
maintain backward compatability. This will change from 5.0 onwards. Then
|
||||
the path is returned only for URLs where the scheme is "file", and for
|
||||
|
@ -3220,7 +3232,20 @@ QString QUrl::toLocalFile() const
|
|||
if (!isLocalFile() && !scheme().isEmpty())
|
||||
return QString();
|
||||
|
||||
return path();
|
||||
QString tmp;
|
||||
QString ourPath = path();
|
||||
|
||||
QMutexLocker lock(&d->mutex); // for d->host
|
||||
|
||||
// magic for authority path-abempty
|
||||
if (!d->host.isEmpty()) {
|
||||
tmp = QLatin1String("//") + d->host + (ourPath.length() > 0 && ourPath.at(0) != QLatin1Char('/')
|
||||
? QLatin1Char('/') + ourPath : ourPath);
|
||||
} else {
|
||||
tmp = ourPath;
|
||||
}
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
Loading…
Add table
Reference in a new issue