From bdb9561ec9ef4e8c37fc57b623c4794c6590b95f Mon Sep 17 00:00:00 2001 From: xiaoyifang Date: Sat, 2 Oct 2021 20:48:49 +0800 Subject: [PATCH] rename scheme handler --- article_netmgr.cc | 4 ++-- article_netmgr.hh | 4 ++-- articleview.cc | 22 ---------------------- mainwindow.cc | 2 +- 4 files changed, 5 insertions(+), 27 deletions(-) diff --git a/article_netmgr.cc b/article_netmgr.cc index 8270e37f..5bab747d 100644 --- a/article_netmgr.cc +++ b/article_netmgr.cc @@ -547,10 +547,10 @@ void BlockedNetworkReply::finishedSlot() emit finished(); } -MySchemeHandler::MySchemeHandler(ArticleNetworkAccessManager& articleNetMgr):mManager(articleNetMgr){ +LocalSchemeHandler::LocalSchemeHandler(ArticleNetworkAccessManager& articleNetMgr):mManager(articleNetMgr){ } -void MySchemeHandler::requestStarted(QWebEngineUrlRequestJob *requestJob) +void LocalSchemeHandler::requestStarted(QWebEngineUrlRequestJob *requestJob) { QUrl url = requestJob->requestUrl(); diff --git a/article_netmgr.hh b/article_netmgr.hh index 3eeb6f73..af45ff0b 100644 --- a/article_netmgr.hh +++ b/article_netmgr.hh @@ -202,11 +202,11 @@ private slots: }; -class MySchemeHandler : public QWebEngineUrlSchemeHandler +class LocalSchemeHandler : public QWebEngineUrlSchemeHandler { Q_OBJECT public: - MySchemeHandler(ArticleNetworkAccessManager &articleNetMgr); + LocalSchemeHandler(ArticleNetworkAccessManager &articleNetMgr); void requestStarted(QWebEngineUrlRequestJob *requestJob); protected: diff --git a/articleview.cc b/articleview.cc index 5813958e..10f3db3f 100644 --- a/articleview.cc +++ b/articleview.cc @@ -1801,28 +1801,6 @@ void ArticleView::contextMenuRequested( QPoint const & pos ) } } -#if QT_VERSION >= 0x040600 && QT_VERSION <= 0x050500 - QWebElement el = r.element(); - QUrl imageUrl; - if( !popupView && el.tagName().compare( "img", Qt::CaseInsensitive ) == 0 ) - { - imageUrl = QUrl::fromPercentEncoding( el.attribute( "src" ).toLatin1() ); - if( !imageUrl.isEmpty() ) - { - menu.addAction( ui.definition->pageAction( QWebEnginePage::CopyImageToClipboard ) ); - saveImageAction = new QAction( tr( "Save &image..." ), &menu ); - menu.addAction( saveImageAction ); - } - } - - if( !popupView && ( targetUrl.scheme() == "gdau" - || Dictionary::WebMultimediaDownload::isAudioUrl( targetUrl ) ) ) - { - saveSoundAction = new QAction( tr( "Save s&ound..." ), &menu ); - menu.addAction( saveSoundAction ); - } -#endif - QString selectedText = ui.definition->selectedText(); QString text = selectedText.trimmed(); diff --git a/mainwindow.cc b/mainwindow.cc index 41aa3aff..0185a5c4 100644 --- a/mainwindow.cc +++ b/mainwindow.cc @@ -146,7 +146,7 @@ MainWindow::MainWindow( Config::Class & cfg_ ): #endif - MySchemeHandler *handler = new MySchemeHandler(articleNetMgr); + LocalSchemeHandler *handler = new LocalSchemeHandler(articleNetMgr); QWebEngineProfile::defaultProfile()->installUrlSchemeHandler("gdlookup", handler); QStringList localSchemes={"gdau","gico","qrcx","bres"};