Commit 1b6ba1e8 authored by Jonathan Marten's avatar Jonathan Marten Committed by Stefano Crocco
Browse files

Port and update the WebEnginePart

kDebug(), qDebug() -> qCDebug() with logging category
Use Qt5 signal connection syntax
KSslInfoDialog::errorsFromString() -> certificatErrorsFromString()
Comment out unused KParts::SelectorInterface functions
QHostAddress::operator=(QString) -> QHostAddress(QString)
parent 7830a5a0
......@@ -7,13 +7,14 @@
#include <QTextCodec>
#include <QTextStream>
#include <QUrl>
#include <QDebug>
#include <QBuffer>
#include <QWebEngineUrlRequestJob>
#include <kiconloader.h>
#include <KI18n/KLocalizedString>
#include <webenginepart_debug.h>
Q_GLOBAL_STATIC(KonqAboutPageSingleton, s_staticData)
static QString loadFile(const QString &file)
......@@ -101,7 +102,7 @@ QString KonqAboutPageSingleton::launch()
i18n("Search the Web");//i18n for possible future use
m_launch_html = res;
qDebug()<<" HTML : "<<res;
qCDebug(WEBENGINEPART_LOG) << " HTML : "<<res;
return res;
}
......
......@@ -52,15 +52,15 @@ struct KPerDomainSettings {
#ifdef DEBUG_SETTINGS
void dump(const QString &infix = QString()) const {
kDebug() << "KPerDomainSettings " << infix << " @" << this << ":";
kDebug() << " m_bEnableJava: " << m_bEnableJava;
kDebug() << " m_bEnableJavaScript: " << m_bEnableJavaScript;
kDebug() << " m_bEnablePlugins: " << m_bEnablePlugins;
kDebug() << " m_windowOpenPolicy: " << m_windowOpenPolicy;
kDebug() << " m_windowStatusPolicy: " << m_windowStatusPolicy;
kDebug() << " m_windowFocusPolicy: " << m_windowFocusPolicy;
kDebug() << " m_windowMovePolicy: " << m_windowMovePolicy;
kDebug() << " m_windowResizePolicy: " << m_windowResizePolicy;
qCDebug(WEBENGINEPART_LOG) << "KPerDomainSettings " << infix << " @" << this << ":";
qCDebug(WEBENGINEPART_LOG) << " m_bEnableJava: " << m_bEnableJava;
qCDebug(WEBENGINEPART_LOG) << " m_bEnableJavaScript: " << m_bEnableJavaScript;
qCDebug(WEBENGINEPART_LOG) << " m_bEnablePlugins: " << m_bEnablePlugins;
qCDebug(WEBENGINEPART_LOG) << " m_windowOpenPolicy: " << m_windowOpenPolicy;
qCDebug(WEBENGINEPART_LOG) << " m_windowStatusPolicy: " << m_windowStatusPolicy;
qCDebug(WEBENGINEPART_LOG) << " m_windowFocusPolicy: " << m_windowFocusPolicy;
qCDebug(WEBENGINEPART_LOG) << " m_windowMovePolicy: " << m_windowMovePolicy;
qCDebug(WEBENGINEPART_LOG) << " m_windowResizePolicy: " << m_windowResizePolicy;
}
#endif
};
......@@ -146,7 +146,7 @@ public:
QTextStream ts(&file);
QString line = ts.readLine();
while (!line.isEmpty()) {
//kDebug() << "Adding filter:" << line;
//qCDebug(WEBENGINEPART_LOG) << "Adding filter:" << line;
/** white list lines start with "@@" */
if (line.startsWith(QLatin1String("@@")))
adWhiteList.addFilter(line);
......@@ -387,9 +387,9 @@ void WebEngineSettings::init( KConfig * config, bool reset )
if (!fileInfo.exists() || fileInfo.lastModified().daysTo(QDateTime::currentDateTime()) > htmlFilterListMaxAgeDays)
{
/** ... in this case, refetch list asynchronously */
// kDebug() << "Fetching filter list from" << url << "to" << localFile;
// qCDebug(WEBENGINEPART_LOG) << "Fetching filter list from" << url << "to" << localFile;
KIO::StoredTransferJob *job = KIO::storedGet( url, KIO::Reload, KIO::HideProgressInfo );
QObject::connect( job, SIGNAL(result(KJob*)), d, SLOT(adblockFilterResult(KJob*)) );
QObject::connect( job, &KJob::result, d, &WebEngineSettingsPrivate::adblockFilterResult);
/** for later reference, store name of cache file */
job->setProperty("webenginesettings_adBlock_filename", localFile);
}
......@@ -761,7 +761,7 @@ static const KPerDomainSettings& lookup_hostname_policy(const WebEngineSettingsP
const QString& hostname)
{
#ifdef DEBUG_SETTINGS
kDebug() << "lookup_hostname_policy(" << hostname << ")";
qCDebug(WEBENGINEPART_LOG) << "lookup_hostname_policy(" << hostname << ")";
#endif
if (hostname.isEmpty()) {
#ifdef DEBUG_SETTINGS
......@@ -776,7 +776,7 @@ static const KPerDomainSettings& lookup_hostname_policy(const WebEngineSettingsP
PolicyMap::const_iterator it = d->domainPolicy.find(hostname);
if( it != notfound ) {
#ifdef DEBUG_SETTINGS
kDebug() << "perfect match";
qCDebug(WEBENGINEPART_LOG) << "perfect match";
(*it).dump(hostname);
#endif
// yes, use it (unless dunno)
......@@ -793,7 +793,7 @@ static const KPerDomainSettings& lookup_hostname_policy(const WebEngineSettingsP
Q_ASSERT(notfound == d->domainPolicy.end());
if( it != notfound ) {
#ifdef DEBUG_SETTINGS
kDebug() << "partial match";
qCDebug(WEBENGINEPART_LOG) << "partial match";
(*it).dump(host_part);
#endif
return *it;
......@@ -804,7 +804,7 @@ static const KPerDomainSettings& lookup_hostname_policy(const WebEngineSettingsP
// No domain-specific entry: use global domain
#ifdef DEBUG_SETTINGS
kDebug() << "no match";
qCDebug(WEBENGINEPART_LOG) << "no match";
d->global.dump("global");
#endif
return d->global;
......
......@@ -34,11 +34,11 @@ FeaturePermissionBar::FeaturePermissionBar(QWidget *parent)
setMessageType(KMessageWidget::Information);
QAction* action = new QAction(i18nc("@action:deny access", "&Deny access"), this);
connect(action, SIGNAL(triggered()), this, SLOT(onDeniedButtonClicked()));
connect(action, &QAction::triggered, this, &FeaturePermissionBar::onDeniedButtonClicked);
addAction(action);
action = new QAction(i18nc("@action:grant access", "&Grant access"), this);
connect(action, SIGNAL(triggered()), this, SLOT(onGrantedButtonClicked()));
connect(action, &QAction::triggered, this, &FeaturePermissionBar::onGrantedButtonClicked);
addAction(action);
// FIXME: Add option to allow and remember for this site.
......
......@@ -38,15 +38,15 @@ PasswordBar::PasswordBar(QWidget *parent)
setMessageType(KMessageWidget::Information);
QAction* action = new QAction(i18nc("@action:remember password", "&Remember"), this);
connect(action, SIGNAL(triggered()), this, SLOT(onRememberButtonClicked()));
connect(action, &QAction::triggered, this, &PasswordBar::onRememberButtonClicked);
addAction(action);
action = new QAction(i18nc("@action:never for this site", "Ne&ver for this site"), this);
connect(action, SIGNAL(triggered()), this, SLOT(onNeverButtonClicked()));
connect(action, &QAction::triggered, this, &PasswordBar::onNeverButtonClicked);
addAction(action);
action = new QAction(i18nc("@action:not now", "N&ot now"), this);
connect(action, SIGNAL(triggered()), this, SLOT(onNotNowButtonClicked()));
connect(action, &QAction::triggered, this, &PasswordBar::onNotNowButtonClicked);
addAction(action);
}
......
......@@ -54,14 +54,10 @@ SearchBar::SearchBar(QWidget *parent)
setFocusProxy(m_ui.searchComboBox);
connect(m_ui.nextButton, SIGNAL(clicked()),
this, SLOT(findNext()));
connect(m_ui.previousButton, SIGNAL(clicked()),
this, SLOT(findPrevious()));
connect(m_ui.searchComboBox, SIGNAL(returnPressed()),
this, SLOT(findNext()));
connect(m_ui.searchComboBox, SIGNAL(editTextChanged(QString)),
this, SLOT(textChanged(QString)));
connect(m_ui.nextButton, &QAbstractButton::clicked, this, &SearchBar::findNext);
connect(m_ui.previousButton, &QAbstractButton::clicked, this, &SearchBar::findPrevious);
connect(m_ui.searchComboBox, QOverload<>::of(&KComboBox::returnPressed), this, &SearchBar::findNext);
connect(m_ui.searchComboBox, &QComboBox::editTextChanged, this, &SearchBar::textChanged);
// Start off hidden by default...
setVisible(false);
......@@ -115,7 +111,7 @@ void SearchBar::setSearchText(const QString& text)
void SearchBar::setFoundMatch(bool match)
{
//kDebug() << match;
//qCDebug(WEBENGINEPART_LOG) << match;
if (m_ui.searchComboBox->currentText().isEmpty()) {
m_ui.searchComboBox->setPalette(QPalette());
return;
......
......@@ -103,7 +103,7 @@ WebEnginePage::WebEnginePage(WebEnginePart *part, QWidget *parent)
WebEnginePage::~WebEnginePage()
{
//kDebug() << this;
//qCDebug(WEBENGINEPART_LOG) << this;
}
const WebSslInfo& WebEnginePage::sslInfo() const
......@@ -144,7 +144,7 @@ void WebEnginePage::download(const QUrl& url, bool newWindow)
QString managerExe;
checkForDownloadManager(view(), managerExe);
if (!managerExe.isEmpty()) {
//qDebug() << "Calling command" << cmd;
//qCDebug(WEBENGINEPART_LOG) << "Calling command" << cmd;
KIO::CommandLauncherJob *job = new KIO::CommandLauncherJob(managerExe, {url.toString()});
job->setUiDelegate(new KDialogJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, view()));
job->start();
......@@ -250,7 +250,7 @@ bool WebEnginePage::acceptNavigationRequest(const QUrl& url, NavigationType type
qCDebug(WEBENGINEPART_LOG) << "Rejected history navigation because 'HistoryNavigationLocked' property is set!";
return false;
}
//kDebug() << "Navigating to item (" << history()->currentItemIndex()
//qCDebug(WEBENGINEPART_LOG) << "Navigating to item (" << history()->currentItemIndex()
// << "of" << history()->count() << "):" << history()->currentItem().url();
inPageRequest = false;
break;
......@@ -356,8 +356,8 @@ void WebEnginePage::slotLoadFinished(bool ok)
{
QUrl requestUrl = url();
requestUrl.setUserInfo(QString());
const bool shouldResetSslInfo = (m_sslInfo.isValid() && !domainSchemeMatch(requestUrl, m_sslInfo.url()));
#if 0
const bool shouldResetSslInfo = (m_sslInfo.isValid() && !domainSchemeMatch(requestUrl, m_sslInfo.url()));
QWebFrame* frame = qobject_cast<QWebFrame *>(reply->request().originatingObject());
if (!frame)
return;
......@@ -378,7 +378,7 @@ void WebEnginePage::slotLoadFinished(bool ok)
}
const int errCode = errorCodeFromReply(reply);
kDebug() << frame << "is main frame request?" << isMainFrameRequest << requestUrl;
qCDebug(WEBENGINEPART_LOG) << frame << "is main frame request?" << isMainFrameRequest << requestUrl;
#endif
if (ok) {
......@@ -398,7 +398,7 @@ void WebEnginePage::slotLoadFinished(bool ok)
break;
case KIO::ERR_ABORTED:
case KIO::ERR_USER_CANCELED: // Do nothing if request is cancelled/aborted
//kDebug() << "User aborted request!";
//qCDebug(WEBENGINEPART_LOG) << "User aborted request!";
m_ignoreError = true;
emit loadAborted(QUrl());
return;
......@@ -429,7 +429,7 @@ void WebEnginePage::slotLoadFinished(bool ok)
void WebEnginePage::slotUnsupportedContent(QNetworkReply* reply)
{
#if 0
//kDebug() << reply->url();
//qCDebug(WEBENGINEPART_LOG) << reply->url();
QString mimeType;
KIO::MetaData metaData;
......@@ -453,7 +453,7 @@ void WebEnginePage::slotUnsupportedContent(QNetworkReply* reply)
return;
}
//kDebug() << "mimetype=" << mimeType << "metadata:" << metaData;
//qCDebug(WEBENGINEPART_LOG) << "mimetype=" << mimeType << "metadata:" << metaData;
if (reply->request().originatingObject() == this->mainFrame()) {
KParts::OpenUrlArguments args;
......@@ -528,7 +528,7 @@ void WebEnginePage::slotGeometryChangeRequested(const QRect & rect)
}
if (WebEngineSettings::self()->windowResizePolicy(host) == KParts::HtmlSettingsInterface::JSWindowResizeAllow) {
//kDebug() << "resizing to " << width << "x" << height;
//qCDebug(WEBENGINEPART_LOG) << "resizing to " << width << "x" << height;
emit m_part->browserExtension()->resizeTopLevelWidget(width, height);
}
......@@ -551,7 +551,7 @@ bool WebEnginePage::checkLinkSecurity(const QNetworkRequest &req, NavigationType
// Check whether the request is authorized or not...
if (!KUrlAuthorized::authorizeUrlAction(QStringLiteral("redirect"), url(), req.url())) {
//kDebug() << "*** Failed security check: base-url=" << mainFrame()->url() << ", dest-url=" << req.url();
//qCDebug(WEBENGINEPART_LOG) << "*** Failed security check: base-url=" << mainFrame()->url() << ", dest-url=" << req.url();
QString buttonText, title, message;
int response = KMessageBox::Cancel;
......@@ -688,7 +688,7 @@ bool WebEnginePage::handleMailToUrl (const QUrl &url, NavigationType type) const
break;
}
//kDebug() << "Emitting openUrlRequest with " << mailtoUrl;
//qCDebug(WEBENGINEPART_LOG) << "Emitting openUrlRequest with " << mailtoUrl;
emit m_part->browserExtension()->openUrlRequest(mailtoUrl);
return true;
}
......@@ -738,13 +738,14 @@ NewWindowPage::NewWindowPage(WebWindowType type, WebEnginePart* part, QWidget* p
{
Q_ASSERT_X (part, "NewWindowPage", "Must specify a valid KPart");
// FIXME: are these 3 signals actually defined or used?
connect(this, SIGNAL(menuBarVisibilityChangeRequested(bool)),
this, SLOT(slotMenuBarVisibilityChangeRequested(bool)));
connect(this, SIGNAL(toolBarVisibilityChangeRequested(bool)),
this, SLOT(slotToolBarVisibilityChangeRequested(bool)));
connect(this, SIGNAL(statusBarVisibilityChangeRequested(bool)),
this, SLOT(slotStatusBarVisibilityChangeRequested(bool)));
connect(this, SIGNAL(loadFinished(bool)), this, SLOT(slotLoadFinished(bool)));
connect(this, &QWebEnginePage::loadFinished, this, &NewWindowPage::slotLoadFinished);
#if QTWEBENGINE_VERSION >= QT_VERSION_CHECK(5, 7, 0)
if (m_type == WebBrowserBackgroundTab) {
m_windowArgs.setLowerWindow(true);
......@@ -888,19 +889,19 @@ void NewWindowPage::slotGeometryChangeRequested(const QRect & rect)
void NewWindowPage::slotMenuBarVisibilityChangeRequested(bool visible)
{
//kDebug() << visible;
//qCDebug(WEBENGINEPART_LOG) << visible;
m_windowArgs.setMenuBarVisible(visible);
}
void NewWindowPage::slotStatusBarVisibilityChangeRequested(bool visible)
{
//kDebug() << visible;
//qCDebug(WEBENGINEPART_LOG) << visible;
m_windowArgs.setStatusBarVisible(visible);
}
void NewWindowPage::slotToolBarVisibilityChangeRequested(bool visible)
{
//kDebug() << visible;
//qCDebug(WEBENGINEPART_LOG) << visible;
m_windowArgs.setToolBarsVisible(visible);
}
......
......@@ -245,8 +245,8 @@ const WebEnginePage* WebEnginePart::page() const
void WebEnginePart::initActions()
{
actionCollection()->addAction(KStandardAction::SaveAs, QStringLiteral("saveDocument"),
m_browserExtension, SLOT(slotSaveDocument()));
KStandardAction::create(KStandardAction::SaveAs, m_browserExtension, &WebEngineBrowserExtension::slotSaveDocument,
actionCollection());
QAction* action = new QAction(i18n("Save &Frame As..."), this);
actionCollection()->addAction(QStringLiteral("saveFrame"), action);
......@@ -286,14 +286,15 @@ void WebEnginePart::initActions()
actionCollection()->addAction(QStringLiteral("zoomToDPI"), action);
connect(action, &QAction::triggered, m_browserExtension, &WebEngineBrowserExtension::toogleZoomToDPI);
action = actionCollection()->addAction(KStandardAction::SelectAll, QStringLiteral("selectAll"),
m_browserExtension, SLOT(slotSelectAll()));
action = KStandardAction::create(KStandardAction::SelectAll, m_browserExtension, &WebEngineBrowserExtension::slotSelectAll,
actionCollection());
action->setShortcutContext(Qt::WidgetShortcut);
m_webView->addAction(action);
KCodecAction *codecAction = new KCodecAction( QIcon::fromTheme(QStringLiteral("character-set")), i18n( "Set &Encoding" ), this, true );
actionCollection()->addAction( QStringLiteral("setEncoding"), codecAction );
connect(codecAction, SIGNAL(triggered(QTextCodec*)), SLOT(slotSetTextEncoding(QTextCodec*)));
connect(codecAction, QOverload<QTextCodec *>::of(&KCodecAction::triggered), this, &WebEnginePart::slotSetTextEncoding);
action = new QAction(i18n("View Do&cument Source"), this);
actionCollection()->addAction(QStringLiteral("viewDocumentSource"), action);
......@@ -304,7 +305,8 @@ void WebEnginePart::initActions()
actionCollection()->addAction(QStringLiteral("security"), action);
connect(action, &QAction::triggered, this, &WebEnginePart::slotShowSecurity);
action = actionCollection()->addAction(KStandardAction::Find, QStringLiteral("find"), this, SLOT(slotShowSearchBar()));
action = KStandardAction::create(KStandardAction::Find, this,
&WebEnginePart::slotShowSearchBar, actionCollection());
action->setWhatsThis(i18nc("find action \"whats this\" text", "<h3>Find text</h3>"
"Shows a dialog that allows you to find text on the displayed page."));
}
......@@ -331,20 +333,16 @@ void WebEnginePart::connectWebEnginePageSignals(WebEnginePage* page)
if (!page)
return;
connect(page, SIGNAL(loadStarted()),
this, SLOT(slotLoadStarted()));
connect(page, SIGNAL(loadAborted(QUrl)),
this, SLOT(slotLoadAborted(QUrl)));
connect(page, &QWebEnginePage::linkHovered,
this, &WebEnginePart::slotLinkHovered);
connect(page, &QWebEnginePage::loadStarted, this, &WebEnginePart::slotLoadStarted);
connect(page, &WebEnginePage::loadAborted, this, &WebEnginePart::slotLoadAborted);
connect(page, &QWebEnginePage::linkHovered, this, &WebEnginePart::slotLinkHovered);
// connect(page, SIGNAL(saveFrameStateRequested(QWebFrame*,QWebHistoryItem*)),
// this, SLOT(slotSaveFrameState(QWebFrame*,QWebHistoryItem*)));
// connect(page, SIGNAL(restoreFrameStateRequested(QWebFrame*)),
// this, SLOT(slotRestoreFrameState(QWebFrame*)));
// connect(page, SIGNAL(statusBarMessage(QString)),
// this, SLOT(slotSetStatusBarText(QString)));
connect(page, SIGNAL(windowCloseRequested()),
this, SLOT(slotWindowCloseRequested()));
connect(page, &QWebEnginePage::windowCloseRequested, this, &WebEnginePart::slotWindowCloseRequested);
// connect(page, SIGNAL(printRequested(QWebFrame*)),
// m_browserExtension, SLOT(slotPrintRequested(QWebFrame*)));
// connect(page, SIGNAL(frameCreated(QWebFrame*)),
......@@ -353,10 +351,8 @@ void WebEnginePart::connectWebEnginePageSignals(WebEnginePage* page)
// connect(m_webView, SIGNAL(linkShiftClicked(QUrl)),
// page, SLOT(downloadUrl(QUrl)));
connect(page, SIGNAL(loadProgress(int)),
m_browserExtension, SIGNAL(loadingProgress(int)));
connect(page, SIGNAL(selectionChanged()),
m_browserExtension, SLOT(updateEditActions()));
connect(page, &QWebEnginePage::loadProgress, m_browserExtension, &KParts::BrowserExtension::loadingProgress);
connect(page, &QWebEnginePage::selectionChanged, m_browserExtension, &WebEngineBrowserExtension::updateEditActions);
// connect(m_browserExtension, SIGNAL(saveUrl(QUrl)),
// page, SLOT(downloadUrl(QUrl)));
......@@ -587,7 +583,7 @@ void WebEnginePart::slotUrlChanged(const QUrl& url)
// Do not update the location bar with about:blank
if (!Utils::isBlankUrl(url)) {
//kDebug() << "Setting location bar to" << u.prettyUrl() << "current URL:" << this->url();
//qCDebug(WEBENGINEPART_LOG) << "Setting location bar to" << u.prettyUrl() << "current URL:" << this->url();
emit m_browserExtension->setLocationBarUrl(u.toDisplayString());
}
}
......@@ -613,7 +609,7 @@ void WebEnginePart::slotShowSecurity()
sslInfo.ciphers(),
sslInfo.usedChiperBits(),
sslInfo.supportedChiperBits(),
KSslInfoDialog::errorsFromString(sslInfo.certificateErrors()));
KSslInfoDialog::certificateErrorsFromString(sslInfo.certificateErrors()));
dlg->open();
}
......@@ -635,7 +631,7 @@ void WebEnginePart::slotSaveFrameState(QWebFrame *frame, QWebHistoryItem *item)
// slotRestoreFrameState.
const QPoint scrollPos (frame->scrollPosition());
if (!scrollPos.isNull()) {
// kDebug() << "Saving scroll position:" << scrollPos;
// qCDebug(WEBENGINEPART_LOG) << "Saving scroll position:" << scrollPos;
item->setUserData(scrollPos);
}
}
......@@ -693,7 +689,7 @@ void WebEnginePart::slotLinkHovered(const QString& _link)
for(int i = 0; i < count; ++i) {
const QPair<QString, QString> queryItem (queryItems.at(i));
//kDebug() << "query: " << queryItem.first << queryItem.second;
//qCDebug(WEBENGINEPART_LOG) << "query: " << queryItem.first << queryItem.second;
if (queryItem.first.contains(QL1C('@')) && queryItem.second.isEmpty())
fields[QStringLiteral("to")] << queryItem.first;
if (QString::compare(queryItem.first, QL1S("to"), Qt::CaseInsensitive) == 0)
......@@ -750,7 +746,7 @@ void WebEnginePart::slotSearchForText(const QString &text, bool backward)
if (m_searchBar->caseSensitive())
flags |= QWebEnginePage::FindCaseSensitively;
//kDebug() << "search for text:" << text << ", backward ?" << backward;
//qCDebug(WEBENGINEPART_LOG) << "search for text:" << text << ", backward ?" << backward;
page()->findText(text, flags, [this](bool found) {
m_searchBar->setFoundMatch(found);
});
......@@ -761,13 +757,13 @@ void WebEnginePart::slotShowSearchBar()
if (!m_searchBar) {
// Create the search bar...
m_searchBar = new SearchBar(widget());
connect(m_searchBar, SIGNAL(searchTextChanged(QString,bool)),
this, SLOT(slotSearchForText(QString,bool)));
connect(m_searchBar, &SearchBar::searchTextChanged, this, &WebEnginePart::slotSearchForText);
actionCollection()->addAction(KStandardAction::FindNext, QStringLiteral("findnext"),
m_searchBar, SLOT(findNext()));
actionCollection()->addAction(KStandardAction::FindPrev, QStringLiteral("findprev"),
m_searchBar, SLOT(findPrevious()));
// This essentially duplicates the use of
// KActionCollection::addAction(KStandardAction::StandardAction actionType, const QObject *receiver, const char *member)
// with the Qt5 connect syntax.
KStandardAction::create(KStandardAction::FindNext, m_searchBar, &SearchBar::findNext, actionCollection());
KStandardAction::create(KStandardAction::FindPrev, m_searchBar, &SearchBar::findPrevious, actionCollection());
QBoxLayout* lay = qobject_cast<QBoxLayout*>(widget()->layout());
if (lay) {
......@@ -814,13 +810,13 @@ void WebEnginePart::slotShowWalletMenu()
QMenu *menu = new QMenu(nullptr);
if (m_webView && WebEngineSettings::self()->isNonPasswordStorableSite(m_webView->url().host()))
menu->addAction(i18n("&Allow password caching for this site"), this, SLOT(slotDeleteNonPasswordStorableSite()));
menu->addAction(i18n("&Allow password caching for this site"), this, &WebEnginePart::slotDeleteNonPasswordStorableSite);
if (m_hasCachedFormData)
menu->addAction(i18n("Remove all cached passwords for this site"), this, SLOT(slotRemoveCachedPasswords()));
menu->addAction(i18n("Remove all cached passwords for this site"), this, &WebEnginePart::slotRemoveCachedPasswords);
menu->addSeparator();
menu->addAction(i18n("&Close Wallet"), this, SLOT(slotWalletClosed()));
menu->addAction(i18n("&Close Wallet"), this, &WebEnginePart::slotWalletClosed);
KAcceleratorManager::manage(menu);
menu->popup(QCursor::pos());
......@@ -895,12 +891,12 @@ void WebEnginePart::slotShowFeaturePermissionBar(QWebEnginePage::Feature feature
if (!m_featurePermissionBar) {
m_featurePermissionBar = new FeaturePermissionBar(widget());
connect(m_featurePermissionBar, SIGNAL(permissionGranted(QWebEnginePage::Feature)),
this, SLOT(slotFeaturePermissionGranted(QWebEnginePage::Feature)));
connect(m_featurePermissionBar, SIGNAL(permissionDenied(QWebEnginePage::Feature)),
this, SLOT(slotFeaturePermissionDenied(QWebEnginePage::Feature)));
connect(m_passwordBar, SIGNAL(done()),
this, SLOT(slotSaveFormDataDone()));
connect(m_featurePermissionBar, &FeaturePermissionBar::permissionGranted,
this, &WebEnginePart::slotFeaturePermissionGranted);
connect(m_featurePermissionBar, &FeaturePermissionBar::permissionDenied,
this, &WebEnginePart::slotFeaturePermissionDenied);
connect(m_passwordBar, &PasswordBar::done,
this, &WebEnginePart::slotSaveFormDataDone);
QBoxLayout* lay = qobject_cast<QBoxLayout*>(widget()->layout());
if (lay)
lay->insertWidget(0, m_featurePermissionBar);
......@@ -943,12 +939,11 @@ void WebEnginePart::slotSaveFormDataRequested (const QString& key, const QUrl& u
qCWarning(WEBENGINEPART_LOG) << "No m_wallet instance found! This should never happen!";
return;
}
connect(m_passwordBar, SIGNAL(saveFormDataAccepted(QString)),
m_wallet, SLOT(acceptSaveFormDataRequest(QString)));
connect(m_passwordBar, SIGNAL(saveFormDataRejected(QString)),
m_wallet, SLOT(rejectSaveFormDataRequest(QString)));
connect(m_passwordBar, SIGNAL(done()),
this, SLOT(slotSaveFormDataDone()));
connect(m_passwordBar, &PasswordBar::saveFormDataAccepted,
m_wallet, &WebEngineWallet::acceptSaveFormDataRequest);
connect(m_passwordBar, &PasswordBar::saveFormDataRejected,
m_wallet, &WebEngineWallet::rejectSaveFormDataRequest);
connect(m_passwordBar, &PasswordBar::done, this, &WebEnginePart::slotSaveFormDataDone);
}
Q_ASSERT(m_passwordBar);
......@@ -986,8 +981,8 @@ void WebEnginePart::addWalletStatusBarIcon ()
m_statusBarWalletLabel->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum));
m_statusBarWalletLabel->setUseCursor(false);
m_statusBarWalletLabel->setPixmap(QIcon::fromTheme(QStringLiteral("wallet-open")).pixmap(QSize(16,16)));
connect(m_statusBarWalletLabel, SIGNAL(leftClickedUrl()), SLOT(slotLaunchWalletManager()));
connect(m_statusBarWalletLabel, SIGNAL(rightClickedUrl()), SLOT(slotShowWalletMenu()));
connect(m_statusBarWalletLabel, QOverload<>::of(&KUrlLabel::leftClickedUrl), this, &WebEnginePart::slotLaunchWalletManager);
connect(m_statusBarWalletLabel, QOverload<>::of(&KUrlLabel::rightClickedUrl), this, &WebEnginePart::slotShowWalletMenu);
}
m_statusBarExtension->addStatusBarItem(m_statusBarWalletLabel, 0, false);
}
......
......@@ -182,7 +182,7 @@ void WebEngineBrowserExtension::restoreState(QDataStream &stream)
if (QCoreApplication::applicationName() == QLatin1String("konqueror")) {
history->clear();
}
//kDebug() << "Restoring URL:" << currentItem.url();
//qCDebug(WEBENGINEPART_LOG) << "Restoring URL:" << currentItem.url();
m_part->setProperty("NoEmitOpenUrlNotification", true);
history->goToItem(currentItem);
}
......@@ -190,10 +190,10 @@ void WebEngineBrowserExtension::restoreState(QDataStream &stream)
}
success = (history->count() > 0);
} else { // Handle navigation: back and forward button navigation.
//kDebug() << "history count:" << history->count() << "request index:" << historyItemIndex;
//qCDebug(WEBENGINEPART_LOG) << "history count:" << history->count() << "request index:" << historyItemIndex;
if (history->count() > historyItemIndex && historyItemIndex > -1) {
QWebEngineHistoryItem item (history->itemAt(historyItemIndex));
//kDebug() << "URL:" << u << "Item URL:" << item.url();
//qCDebug(WEBENGINEPART_LOG) << "URL:" << u << "Item URL:" << item.url();
if (u == item.url()) {
if (item.isValid() && (xOfs != -1 || yOfs != -1)) {
const QPoint scrollPos (xOfs, yOfs);
......@@ -708,8 +708,8 @@ void WebEngineBrowserExtension::slotCheckSpelling()
backgroundSpellCheck->setParent(spellDialog);
spellDialog->setAttribute(Qt::WA_DeleteOnClose, true);
spellDialog->showSpellCheckCompletionMessage(true);
connect(spellDialog, SIGNAL(replace(QString,int,QString)), this, SLOT(spellCheckerCorrected(QString,int,QString)));
connect(spellDialog, SIGNAL(misspelling(QString,int)), this, SLOT(spellCheckerMisspelling(QString,int)));
connect(spellDialog, &Sonnet::Dialog::replace, this, &WebEngineBrowserExtension::spellCheckerCorrected);
connect(spellDialog, &Sonnet::Dialog::misspelling, this, &WebEngineBrowserExtension::spellCheckerMisspelling);
spellDialog->setBuffer(text);
spellDialog->show();
}
......@@ -726,16 +726,16 @@ void WebEngineBrowserExtension::slotSpellCheckSelection()
const int pos = values.indexOf(' ');
m_spellTextSelectionStart = qMax(0, values.leftRef(pos).toInt());
m_spellTextSelectionEnd = qMax(0, values.midRef(pos + 1).toInt());
// kDebug() << "selection start:" << m_spellTextSelectionStart << "end:" << m_spellTextSelectionEnd;
// qCDebug(WEBENGINEPART_LOG) << "selection start:" << m_spellTextSelectionStart << "end:" << m_spellTextSelectionEnd;
Sonnet::BackgroundChecker *backgroundSpellCheck = new Sonnet::BackgroundChecker;
Sonnet::Dialog* spellDialog = new Sonnet::Dialog(backgroundSpellCheck, view());
backgroundSpellCheck->setParent(spellDialog);
spellDialog->setAttribute(Qt::WA_DeleteOnClose, true);
spellDialog->showSpellCheckCompletionMessage(true);
connect(spellDialog, SIGNAL(replace(QString,int,QString)), this, SLOT(spellCheckerCorrected(QString,int,QString)));
connect(spellDialog, SIGNAL(misspelling(QString,int)), this, SLOT(spellCheckerMisspelling(QString,int)));
connect(spellDialog, SIGNAL(done(QString)), this, SLOT(slotSpellCheckDone(QString)));
connect(spellDialog, &Sonnet::Dialog::replace, this, &WebEngineBrowserExtension::spellCheckerCorrected);
connect(spellDialog, &Sonnet::Dialog::misspelling, this, &WebEngineBrowserExtension::spellCheckerMisspelling);
connect(spellDialog, &Sonnet::Dialog::spellCheckDone, this, &WebEngineBrowserExtension::slotSpellCheckDone);
spellDialog->setBuffer(text.mid(m_spellTextSelectionStart, (m_spellTextSelectionEnd - m_spellTextSelectionStart)));
spellDialog->show();
});
......@@ -759,13 +759,13 @@ void WebEngineBrowserExtension::spellCheckerCorrected(const QString& original, i
script += QString::number(index + original.length());
script += QL1S(")");
//kDebug() << "**** script:" << script;
//qCDebug(WEBENGINEPART_LOG) << "**** script:" << script;
view()->page()->runJavaScript(script);
}
void WebEngineBrowserExtension::spellCheckerMisspelling(const QString& text, int pos)
{
// kDebug() << text << pos;
// qCDebug(WEBENGINEPART_LOG) << text << pos;
QString selectionScript (QL1S("this.setSelectionRange("));
selectionScript += QString::number(pos + m_spellTextSelectionStart);
selectionScript += QL1C(',');
......@@ -793,7 +793,7 @@ void WebEngineBrowserExtension::saveHistory()
QWebEngineHistory* history = (view() ? view()->history() : nullptr);
if (history && history->count() > 0) {
//kDebug() << "Current history: index=" << history->currentItemIndex() << "url=" << history->currentItem().url();
//qCDebug(WEBENGINEPART_LOG) << "Current history: index=" << history->currentItemIndex() << "url=" << history->currentItem().url();
QByteArray histData;
QBuffer buff (&histData);
m_historyData.clear();
......@@ -806,7 +806,7 @@ void WebEngineBrowserExtension::saveHistory()
QWidget* frameWidget = mainWidget ? mainWidget->parentWidget() : nullptr;
if (frameWidget) {
emit saveHistory(frameWidget, m_historyData);
// kDebug() << "# of items:" << history->count() << "current item:" << history->currentItemIndex() << "url:" << history->currentItem().url();