From 6a17ab9be24ddad30f3634f97df0dfc0369c6c9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20=C3=81ngel=20San=20Mart=C3=ADn?= Date: Sat, 21 Jun 2014 16:27:34 +0200 Subject: [PATCH] fix for issue #11 (Author mechtex) --- YACReaderLibrary/YACReaderLibrary.pro | 3 ++- YACReaderLibrary/library_window.cpp | 11 +++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/YACReaderLibrary/YACReaderLibrary.pro b/YACReaderLibrary/YACReaderLibrary.pro index 342e72b1..d96a7965 100644 --- a/YACReaderLibrary/YACReaderLibrary.pro +++ b/YACReaderLibrary/YACReaderLibrary.pro @@ -17,7 +17,8 @@ DEFINES += SERVER_RELEASE NOMINMAX win32 { -LIBS += -L../dependencies/poppler/lib -loleaut32 -lole32 +LIBS += -L../dependencies/poppler/lib -loleaut32 -lole32 -lshell32 + isEqual(QT_MAJOR_VERSION, 5) { LIBS += -lpoppler-qt5 diff --git a/YACReaderLibrary/library_window.cpp b/YACReaderLibrary/library_window.cpp index b1dc3f9f..1159507d 100644 --- a/YACReaderLibrary/library_window.cpp +++ b/YACReaderLibrary/library_window.cpp @@ -62,6 +62,10 @@ #include "QsLog.h" +#ifdef Q_OS_WIN + #include +#endif + #ifdef Q_OS_MAC //#include #endif @@ -1606,10 +1610,9 @@ QFileInfo file = QDir::cleanPath(currentPath() + dmCV->getComicPath(modelIndex)) #endif #ifdef Q_OS_WIN - QString filePath = file.absoluteFilePath(); - QStringList args; - args << "/select," << QDir::toNativeSeparators(filePath); - QProcess::startDetached("explorer", args); + QString filePath = file.absoluteFilePath(); + QString cmdArgs = QString("/select,\"") + QDir::toNativeSeparators(filePath) + QStringLiteral("\""); + ShellExecuteW(0, L"open", L"explorer.exe", reinterpret_cast(cmdArgs.utf16()), 0, SW_NORMAL); #endif }