From 2352454bdcc33f5914a245fd318e1591c3301711 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Mon, 20 Jul 2009 11:58:29 +0200 Subject: QDesktopServices::openUrl failed for local file paths with a file schema OpenUrl couldn't open relative urls because we were passing 'file:///' schema to the ShellExecute on Windows Reviewed-by: Prasanth Ullattil # with '#' will be ignored, and an empty message aborts the commit. --- src/gui/util/qdesktopservices_win.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gui/util/qdesktopservices_win.cpp b/src/gui/util/qdesktopservices_win.cpp index 00cb4ae..dc016b6 100644 --- a/src/gui/util/qdesktopservices_win.cpp +++ b/src/gui/util/qdesktopservices_win.cpp @@ -66,8 +66,10 @@ static bool openDocument(const QUrl &file) { if (!file.isValid()) return false; - - quintptr returnValue = (quintptr)ShellExecute(0, 0, (wchar_t*)file.toString().utf16(), 0, 0, SW_SHOWNORMAL); + QString filePath = file.toLocalFile(); + if (filePath.isEmpty() + filePath = file.toString(); + quintptr returnValue = (quintptr)ShellExecute(0, 0, (wchar_t*)filePath.utf16(), 0, 0, SW_SHOWNORMAL); return (returnValue > 32); //ShellExecute returns a value greater than 32 if successful } -- cgit v0.12