aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarald Sitter <[email protected]>2017-03-31 09:25:20 +0200
committerHarald Sitter <[email protected]>2017-03-31 09:25:20 +0200
commitc0008f9ca5600f27675d0a8d5aa5f36f516835fa (patch)
tree74d2f72f403f305614123af5378fbc830a5d7a98
parenta137784a963ebe370f1c4d4f010ebb280a08b5df (diff)
use toLocalFile instead of path of the QUrl to fix Win32 compat
path() would be /foo irregardless of platform, on Windows that's /C:/ which is not correct as the local representation is C:/. toLocalFile handles this for us. I've also changed the var name to be more representitive of what it contains and is used for i.e. checking the localPath. should remote URL validation be introduced at a later point it would then be obvious that one should not be using that particular variable ;)
-rw-r--r--src/mainWindow.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/mainWindow.cpp b/src/mainWindow.cpp
index 4f98b37..54fde22 100644
--- a/src/mainWindow.cpp
+++ b/src/mainWindow.cpp
@@ -364,7 +364,7 @@ bool MainWindow::openUrl(const QUrl &u)
#define KMSG(s) KMessageBox::information(widget(), s)
QUrl uri = u.adjusted(QUrl::NormalizePathSegments);
- const QString path = uri.path();
+ const QString localPath = uri.toLocalFile();
const bool isLocal = uri.isLocalFile();
if (uri.isEmpty())
@@ -375,17 +375,17 @@ bool MainWindow::openUrl(const QUrl &u)
{
KMSG(i18n("The entered URL cannot be parsed; it is invalid."));
}
- else if ((!isLocal && path[0] != QLatin1Char('/')) || (isLocal && !QDir::isAbsolutePath(path)))
+ else if ((!isLocal && localPath[0] != QLatin1Char('/')) || (isLocal && !QDir::isAbsolutePath(localPath)))
{
- KMSG(i18n("Filelight only accepts absolute paths, eg. /%1", path));
+ KMSG(i18n("Filelight only accepts absolute paths, eg. /%1", localPath));
}
- else if (isLocal && !QDir(path).exists())
+ else if (isLocal && !QDir(localPath).exists())
{
- KMSG(i18n("Folder not found: %1", path));
+ KMSG(i18n("Folder not found: %1", localPath));
}
- else if (isLocal && !QDir(path).isReadable())
+ else if (isLocal && !QDir(localPath).isReadable())
{
- KMSG(i18n("Unable to enter: %1\nYou do not have access rights to this location.", path));
+ KMSG(i18n("Unable to enter: %1\nYou do not have access rights to this location.", localPath));
}
else
{