diff --git a/CMakeLists.txt b/CMakeLists.txt index 32b356c1e..93331fcfa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -107,9 +107,6 @@ if (EXISTS "${CMAKE_SOURCE_DIR}/po") find_package(KF6I18n REQUIRED) endif() -# Mandatory: KIO -find_package(KF6KIO ${KF_MIN_VERSION} REQUIRED) - # Optional: GnomeKeyring find_package(PkgConfig) if (PKG_CONFIG_FOUND) @@ -119,9 +116,11 @@ if (PKG_CONFIG_FOUND) endif() endif() -# Optional: KWallet, KCrash, KCoreAddons +# Optional: KWallet, KIO, KCrash, KCoreAddons find_package(KF6Wallet ${KF_MIN_VERSION} CONFIG) set_package_properties(KF6Wallet PROPERTIES DESCRIPTION "KDE Frameworks Integration plugin" TYPE OPTIONAL) +find_package(KF6KIO ${KF_MIN_VERSION} CONFIG) +set_package_properties(KF6KIO PROPERTIES DESCRIPTION "KDE Frameworks Integration plugin" TYPE OPTIONAL) find_package(KF6Crash ${KF_MIN_VERSION} CONFIG) set_package_properties(KF6Crash PROPERTIES DESCRIPTION "KDE Frameworks Integration plugin" TYPE OPTIONAL) find_package(KF6CoreAddons ${KF_MIN_VERSION} CONFIG) @@ -130,7 +129,7 @@ find_package(KF6Purpose ${KF_MIN_VERSION} CONFIG) set_package_properties(KF6Purpose PROPERTIES DESCRIPTION "KDE Frameworks Integration plugin" TYPE OPTIONAL) find_package(KF6JobWidgets ${KF_MIN_VERSION} CONFIG) set_package_properties(KF6JobWidgets PROPERTIES DESCRIPTION "KDE Frameworks Integration plugin" TYPE OPTIONAL) -if (KF6Wallet_FOUND AND KF6Crash_FOUND AND KF6CoreAddons_FOUND AND KF6Purpose_FOUND AND KF6JobWidgets_FOUND) +if (KF6Wallet_FOUND AND KF6KIO_FOUND AND KF6Crash_FOUND AND KF6CoreAddons_FOUND AND KF6Purpose_FOUND AND KF6JobWidgets_FOUND) set(ENABLE_KDE_FRAMEWORKS_INTEGRATION_PLUGIN TRUE) endif() diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt index 19d6d410c..b484e940d 100644 --- a/src/lib/CMakeLists.txt +++ b/src/lib/CMakeLists.txt @@ -603,7 +603,6 @@ target_link_libraries(FalkonPrivate Qt6::WebChannel Qt6::Core5Compat KF6::Archive - KF6::KIOGui ${OPENSSL_CRYPTO_LIBRARY} ) diff --git a/src/lib/downloads/downloaditem.cpp b/src/lib/downloads/downloaditem.cpp index c018c1bf6..126740fab 100644 --- a/src/lib/downloads/downloaditem.cpp +++ b/src/lib/downloads/downloaditem.cpp @@ -39,6 +39,11 @@ #include #include +#ifdef Q_OS_WIN +#include "Shlwapi.h" +#include "shellapi.h" +#endif + //#define DOWNMANAGER_DEBUG DownloadItem::DownloadItem(QListWidgetItem *item, QWebEngineDownloadRequest* downloadItem, const QString &path, const QString &fileName, bool openFile, DownloadManager* manager) @@ -349,12 +354,19 @@ void DownloadItem::openFile() void DownloadItem::openFolder() { - QString fileName = m_fileName; +#ifdef Q_OS_WIN + QString winFileName = QSL("%1/%2").arg(m_path, m_fileName); + if (m_downloading) { - fileName.append(QSL(".download")); + winFileName.append(QSL(".download")); } - QFileInfo info(m_path, fileName); - QzTools::openFolder({QUrl::fromLocalFile(info.absoluteFilePath())}); + + winFileName.replace(QLatin1Char('/'), QSL("\\")); + QString shExArg = QSL("/e,/select,\"") + winFileName + QSL("\""); + ShellExecute(NULL, NULL, TEXT("explorer.exe"), shExArg.toStdWString().c_str(), NULL, SW_SHOW); +#else + QDesktopServices::openUrl(QUrl::fromLocalFile(m_path)); +#endif } QUrl DownloadItem::url() const diff --git a/src/lib/tools/qztools.cpp b/src/lib/tools/qztools.cpp index d2acc011d..6d85dd49c 100644 --- a/src/lib/tools/qztools.cpp +++ b/src/lib/tools/qztools.cpp @@ -45,8 +45,6 @@ #include #include -#include - #ifdef QZ_WS_X11 #include #endif @@ -1039,31 +1037,3 @@ void QzTools::paintDropIndicator(QWidget *widget, const QRect &r) p.drawLine(x + i, r.top(), x + i, r.bottom()); } } - -void QzTools::openFolder(const QList &urls) -{ - /* Filter the URL list for existing files, otherwise it will cause crash */ - QList validUrls; - for (const QUrl &url : urls) { - if (QFileInfo::exists(url.toLocalFile())) { - validUrls.append(url); - } - else { - qWarning() << "OpenFolder Filtered:" << url; - } - } - - if (validUrls.isEmpty()) { - return; - } - - auto *job = new KIO::OpenFileManagerWindowJob(); - job->setHighlightUrls(validUrls); - job->start(); - - QObject::connect(job, &KJob::result, job, [&](KJob *job) { - if (job->error() != 0) { - qWarning() << "OpenFileManagerWindowJob:" << job->errorString(); - } - }); -} diff --git a/src/lib/tools/qztools.h b/src/lib/tools/qztools.h index a2f292436..9dd18dbbc 100644 --- a/src/lib/tools/qztools.h +++ b/src/lib/tools/qztools.h @@ -98,8 +98,6 @@ public: } static void paintDropIndicator(QWidget *widget, const QRect &r); - - static void openFolder(const QList &urls); }; #endif // QZTOOLS_H