Skip to content

Commit

Permalink
Port KTorrent to QWebEngine
Browse files Browse the repository at this point in the history
Summary:
Ports KTorrent Search Plugin to QWebEngine
Ports KTorrent Syndication Plugin to QWebEngine

Test Plan:
Use search Plugin:

  - Search for torrent
  - Start download automatically from magnet link
  - Start download automatically from torrent file
  - Save torrent file to disk

Reviewers: stikonas, trufanov, mlaurent

Reviewed By: stikonas, trufanov, mlaurent

Subscribers: mlaurent

Maniphest Tasks: T11609

Differential Revision: https://phabricator.kde.org/D25314
  • Loading branch information
ripper2256 committed Nov 28, 2019
1 parent fa18fc6 commit f5a1958
Show file tree
Hide file tree
Showing 18 changed files with 145 additions and 418 deletions.
8 changes: 4 additions & 4 deletions CMakeLists.txt
Expand Up @@ -110,14 +110,14 @@ if(KF5Syndication_FOUND)
set(HAVE_KF5Syndication 1)
endif()

find_package(KF5WebKit ${KF5_REQUIRED_VERSION})
set_package_properties(KF5WebKit
find_package(Qt5WebEngineWidgets ${QT_MIN_VERSION})
set_package_properties(Qt5WebEngineWidgets
PROPERTIES
TYPE OPTIONAL
PURPOSE "Required for KTorrent's search and syndication plugins"
)
if(KF5WebKit_FOUND)
set(HAVE_KF5WebKit 1)
if(Qt5WebEngineWidgets_FOUND)
set(HAVE_Qt5WebEngineWidgets 1)
endif()

find_package(KF5DNSSD ${KF5_REQUIRED_VERSION})
Expand Down
1 change: 1 addition & 0 deletions ktorrent/main.cpp
Expand Up @@ -107,6 +107,7 @@ int main(int argc, char** argv)
bt::SetClientInfo(QStringLiteral("KTorrent"), kt::MAJOR, kt::MINOR, kt::RELEASE, kt::VERSION_TYPE, QStringLiteral("KT"));

QGuiApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
KLocalizedString::setApplicationDomain("ktorrent");

QApplication app(argc, argv);
Expand Down
4 changes: 2 additions & 2 deletions plugins/CMakeLists.txt
Expand Up @@ -13,7 +13,7 @@ macro_kt_plugin(ENABLE_INFOWIDGET_PLUGIN infowidget infowidget)
if (HAVE_KF5Completion)
macro_kt_plugin(ENABLE_UPNP_PLUGIN upnp upnp)
endif()
if (HAVE_KF5WebKit)
if (HAVE_Qt5WebEngineWidgets)
macro_kt_plugin(ENABLE_SEARCH_PLUGIN search search)
endif()
#macro_kt_plugin(ENABLE_WEBINTERFACE_PLUGIN webinterface webinterface)
Expand All @@ -34,7 +34,7 @@ endif()
if (HAVE_KF5Archive AND HAVE_KF5ItemViews AND HAVE_KF5Kross)
macro_kt_plugin(ENABLE_SCRIPTING_PLUGIN scripting scripting)
endif()
if (HAVE_KF5Syndication AND HAVE_KF5WebKit)
if (HAVE_KF5Syndication AND HAVE_Qt5WebEngineWidgets)
macro_kt_plugin(ENABLE_SYNDICATION_PLUGIN syndication syndication)
endif()
macro_kt_plugin(ENABLE_DOWNLOADORDER_PLUGIN downloadorder downloadorder)
Expand Down
8 changes: 3 additions & 5 deletions plugins/search/CMakeLists.txt
@@ -1,7 +1,5 @@
set(ktsearchplugin_SRC
webview.cpp
localfilenetworkreply.cpp
buffernetworkreply.cpp
searchenginelist.cpp
searchprefpage.cpp
searchwidget.cpp
Expand All @@ -10,7 +8,8 @@ set(ktsearchplugin_SRC
searchengine.cpp
opensearchdownloadjob.cpp
searchactivity.cpp
proxy_helper.cpp)
proxy_helper.cpp
magneturlschemehandler.cpp)

ki18n_wrap_ui(ktsearchplugin_SRC searchpref.ui)
kconfig_add_kcfg_files(ktsearchplugin_SRC searchpluginsettings.kcfgc)
Expand All @@ -21,7 +20,7 @@ kcoreaddons_desktop_to_json(ktorrent_search ktorrent_search.desktop)
target_link_libraries(
ktorrent_search
ktcore
Qt5::WebKitWidgets
Qt5::WebEngineWidgets
KF5::Torrent
KF5::CoreAddons
KF5::Completion
Expand All @@ -32,7 +31,6 @@ target_link_libraries(
KF5::KIOCore
KF5::KIOWidgets
KF5::Notifications
KF5::WebKit
KF5::WidgetsAddons
KF5::XmlGui
)
Expand Down
65 changes: 0 additions & 65 deletions plugins/search/buffernetworkreply.cpp

This file was deleted.

57 changes: 0 additions & 57 deletions plugins/search/buffernetworkreply.h

This file was deleted.

79 changes: 0 additions & 79 deletions plugins/search/localfilenetworkreply.cpp

This file was deleted.

52 changes: 0 additions & 52 deletions plugins/search/localfilenetworkreply.h

This file was deleted.

34 changes: 34 additions & 0 deletions plugins/search/magneturlschemehandler.cpp
@@ -0,0 +1,34 @@
/*
* Copyright 2019 <Gilbert Assaf> gassaf@gmx.de
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#include "magneturlschemehandler.h"
#include <QWebEngineUrlSchemeHandler>
#include <QWebEngineUrlRequestJob>

MagnetUrlSchemeHandler::MagnetUrlSchemeHandler(QObject *parent ) : QWebEngineUrlSchemeHandler(parent) {

}

void MagnetUrlSchemeHandler::requestStarted(QWebEngineUrlRequestJob *request) {
request->fail(QWebEngineUrlRequestJob::RequestAborted);
const QUrl url = request->requestUrl();

emit magnetUrlDetected(url);
}

0 comments on commit f5a1958

Please sign in to comment.