forked from openkylin/ukui-search
Feat:Clear cache after web searching.
This commit is contained in:
parent
8d54f02e09
commit
47f67ffdd0
|
@ -129,6 +129,7 @@ void SearchDetailView::setWebWidget(const QString& keyword)
|
|||
}
|
||||
} else {
|
||||
m_webView = new QWebEngineView(this);
|
||||
m_engineProfile = m_webView->page()->profile();
|
||||
m_webView->settings()->setAttribute(QWebEngineSettings::PluginsEnabled, true);
|
||||
m_webView->setAttribute(Qt::WA_DeleteOnClose);
|
||||
m_webView->move(0, 0);
|
||||
|
@ -136,11 +137,12 @@ void SearchDetailView::setWebWidget(const QString& keyword)
|
|||
|
||||
connect(m_webView,&QWebEngineView::loadFinished, this, [ = ](){
|
||||
m_reload = true;
|
||||
if (m_engineProfile) m_engineProfile->clearHttpCache();
|
||||
});
|
||||
connect(m_webView, &QWebEngineView::urlChanged, this, [ = ](const QUrl& url) {
|
||||
if (m_reload) {
|
||||
closeWebWidget();
|
||||
QDesktopServices::openUrl(url);
|
||||
closeWebWidget();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include <QWidget>
|
||||
#include <QWebEngineView>
|
||||
#include <QWebEngineSettings>
|
||||
//#include <QWebEngineProfile>
|
||||
#include <QWebEngineProfile>
|
||||
//#include <QWebEngineUrlRequestInterceptor>
|
||||
#include <QDesktopServices>
|
||||
#include "option-view.h"
|
||||
|
@ -91,6 +91,7 @@ private:
|
|||
OptionView * m_optionView = nullptr;
|
||||
|
||||
QWebEngineView * m_webView = nullptr;
|
||||
QWebEngineProfile * m_engineProfile = nullptr;
|
||||
bool m_reload = false;
|
||||
QString m_currentKeyword;
|
||||
|
||||
|
|
Loading…
Reference in New Issue