mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-24 04:24:09 +00:00
rename scheme handler
This commit is contained in:
parent
3bdb1aabb5
commit
bdb9561ec9
|
@ -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();
|
||||||
|
|
||||||
|
|
|
@ -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:
|
||||||
|
|
|
@ -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();
|
||||||
|
|
||||||
|
|
|
@ -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"};
|
||||||
|
|
Loading…
Reference in a new issue