rename scheme handler

This commit is contained in:
xiaoyifang 2021-10-02 20:48:49 +08:00
parent 3bdb1aabb5
commit bdb9561ec9
4 changed files with 5 additions and 27 deletions

View file

@ -547,10 +547,10 @@ void BlockedNetworkReply::finishedSlot()
emit finished(); 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(); QUrl url = requestJob->requestUrl();

View file

@ -202,11 +202,11 @@ private slots:
}; };
class MySchemeHandler : public QWebEngineUrlSchemeHandler class LocalSchemeHandler : public QWebEngineUrlSchemeHandler
{ {
Q_OBJECT Q_OBJECT
public: public:
MySchemeHandler(ArticleNetworkAccessManager &articleNetMgr); LocalSchemeHandler(ArticleNetworkAccessManager &articleNetMgr);
void requestStarted(QWebEngineUrlRequestJob *requestJob); void requestStarted(QWebEngineUrlRequestJob *requestJob);
protected: protected:

View file

@ -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 selectedText = ui.definition->selectedText();
QString text = selectedText.trimmed(); QString text = selectedText.trimmed();

View file

@ -146,7 +146,7 @@ MainWindow::MainWindow( Config::Class & cfg_ ):
#endif #endif
MySchemeHandler *handler = new MySchemeHandler(articleNetMgr); LocalSchemeHandler *handler = new LocalSchemeHandler(articleNetMgr);
QWebEngineProfile::defaultProfile()->installUrlSchemeHandler("gdlookup", handler); QWebEngineProfile::defaultProfile()->installUrlSchemeHandler("gdlookup", handler);
QStringList localSchemes={"gdau","gico","qrcx","bres"}; QStringList localSchemes={"gdau","gico","qrcx","bres"};