Commit 90807e9f authored by Nicolas Fella's avatar Nicolas Fella
Browse files

Clean up version ifdefs for old KF5 versions

We require 5.91 currently
parent 8b24c53a
Pipeline #204358 passed with stage
in 8 minutes and 25 seconds
......@@ -33,9 +33,7 @@
#include <KIO/CommandLauncherJob>
#include <kio_version.h>
#include <KIO/OpenUrlJob>
#if KIO_VERSION >= QT_VERSION_CHECK(5, 84, 0)
#include <KTerminalLauncherJob>
#endif
#include <KFileCopyToMenu>
#include <KJobWidgets>
#include <KJobUiDelegate>
......@@ -388,27 +386,19 @@ void KonqPopupMenuPrivate::populate()
}
// Second block, builtin + user
#if KIO_VERSION < QT_VERSION_CHECK(5, 77, 0)
m_menuActions.addServiceActionsTo(q);
#else
QList<QAction *> additionalActions;
if (isDirectory && m_popupItemProperties.items().count() == 1) {
QAction *openTerminalHere = new QAction(QIcon::fromTheme("utilities-terminal"), i18n("Open Terminal Here"), m_parentWidget);
QObject::connect(openTerminalHere, &QAction::triggered, q, [this]() {
const QString localPath = m_popupItemProperties.urlList().constFirst().toLocalFile();
// 5.84 because the header wasn't usable in 5.83
#if KIO_VERSION >= QT_VERSION_CHECK(5, 84, 0)
auto *job = new KTerminalLauncherJob(QString{});
job->setWorkingDirectory(localPath);
job->start();
#else
KToolInvocation::invokeTerminal(QString(), localPath);
#endif
});
additionalActions << openTerminalHere;
}
m_menuActions.addActionsTo(q, KFileItemActions::MenuActionSource::Services, additionalActions);
#endif
q->addSeparator();
......
......@@ -43,11 +43,7 @@ PluginBabelFish::PluginBabelFish(QObject *parent,
m_menu = new KActionMenu(QIcon::fromTheme(QStringLiteral("babelfish")), i18n("Translate Web &Page"),
actionCollection());
actionCollection()->addAction(QStringLiteral("translatewebpage"), m_menu);
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 77, 0)
m_menu->setPopupMode(QToolButton::InstantPopup);
#else
m_menu->setDelayed(false);
#endif
connect(m_menu->menu(), SIGNAL(aboutToShow()),
this, SLOT(slotAboutToShow()));
......
......@@ -19,11 +19,7 @@
#include <kfileitem.h>
#include <kpluginfactory.h>
#if KPARTS_VERSION >= QT_VERSION_CHECK(5, 77, 0)
#include <KPluginMetaData>
#else
#include <kaboutdata.h>
#endif
#include <kprotocolmanager.h>
#include <kio/copyjob.h>
......@@ -82,22 +78,11 @@ void FSJob::progressSlot(int percent, int dirs, const QString &cDir)
FSViewPart::FSViewPart(QWidget *parentWidget,
QObject *parent,
#if KPARTS_VERSION >= QT_VERSION_CHECK(5, 77, 0)
const KPluginMetaData& metaData,
#endif
const QList<QVariant> & /* args */)
: KParts::ReadOnlyPart(parent)
{
#if KPARTS_VERSION >= QT_VERSION_CHECK(5, 77, 0)
setMetaData(metaData);
#else
KAboutData aboutData(QStringLiteral("fsview"), i18n("FSView"), QStringLiteral("0.1"),
i18n("Filesystem Viewer"),
KAboutLicense::GPL,
i18n("(c) 2002, Josef Weidendorfer"));
setComponentData(aboutData);
#endif
_view = new FSView(new Inode(), parentWidget);
_view->setWhatsThis(i18n("<p>This is the FSView plugin, a graphical "
"browsing mode showing filesystem utilization "
......
......@@ -79,9 +79,7 @@ class FSViewPart : public KParts::ReadOnlyPart
public:
FSViewPart(QWidget *parentWidget,
QObject *parent,
#if KPARTS_VERSION >= QT_VERSION_CHECK(5, 77, 0)
const KPluginMetaData& metaData,
#endif
const QList<QVariant> &args);
~FSViewPart() override;
......
......@@ -13,11 +13,7 @@
#include <QMenu>
#include <kprotocolmanager.h>
#include <kpluginfactory.h>
#if KPARTS_VERSION >= QT_VERSION_CHECK(5, 77, 0)
#include <KPluginMetaData>
#else
#include <kaboutdata.h>
#endif
#include <ktoggleaction.h>
#include <kactioncollection.h>
#include <kselectaction.h>
......@@ -37,24 +33,14 @@
K_PLUGIN_CLASS_WITH_JSON(SettingsPlugin, "khtmlsettingsplugin.json")
SettingsPlugin::SettingsPlugin(QObject *parent,
#if KPARTS_VERSION >= QT_VERSION_CHECK(5, 77, 0)
const KPluginMetaData& metaData,
#endif
const QVariantList &)
: KonqParts::Plugin(parent), mConfig(nullptr)
{
#if KPARTS_VERSION >= QT_VERSION_CHECK(5, 77, 0)
setMetaData(metaData);
#else
setComponentData(KAboutData(QStringLiteral("khtmlsettingsplugin"), i18n("HTML Settings"), QStringLiteral("1.0")));
#endif
KActionMenu *menu = new KActionMenu(QIcon::fromTheme(QStringLiteral("configure")), i18n("HTML Settings"), actionCollection());
actionCollection()->addAction(QStringLiteral("action menu"), menu);
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 77, 0)
menu->setPopupMode(QToolButton::InstantPopup);
#else
menu->setDelayed(false);
#endif
KToggleAction *action = actionCollection()->add<KToggleAction>(QStringLiteral("javascript"));
action->setText(i18n("Java&Script"));
......@@ -100,11 +86,7 @@ SettingsPlugin::SettingsPlugin(QObject *parent,
policies += i18n("&Use Cache if Possible");
policies += i18n("&Offline Browsing Mode");
sAction->setItems(policies);
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 78, 0)
connect(sAction, &KSelectAction::indexTriggered, this, &SettingsPlugin::cachePolicyChanged);
#else
connect(sAction, SIGNAL(triggered(int)), SLOT(cachePolicyChanged(int)));
#endif
menu->addAction(sAction);
......
......@@ -17,9 +17,7 @@ class SettingsPlugin : public KonqParts::Plugin
Q_OBJECT
public:
SettingsPlugin(QObject *parent,
#if KPARTS_VERSION >= QT_VERSION_CHECK(5, 77, 0)
const KPluginMetaData& metaData,
#endif
const QVariantList &);
~SettingsPlugin() override;
......
......@@ -107,12 +107,7 @@ void KIGPDialog::setupLookPage(const QString &path)
m_fontName = new QComboBox(page);
m_fontName->setSizePolicy(QSizePolicy::MinimumExpanding, m_fontName->sizePolicy().verticalPolicy());
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 86, 0)
const QStringList standardFonts = KFontChooser::createFontList(KFontChooser::NoDisplayFlags);
#else
QStringList standardFonts;
KFontChooser::getFontList(standardFonts, 0);
#endif
m_fontName->addItems(standardFonts);
m_fontName->setItemText(m_fontName->currentIndex(), look.readEntry("FontName", QFontDatabase::systemFont(QFontDatabase::GeneralFont).family()));
......
......@@ -43,11 +43,7 @@ UAChangerPlugin::UAChangerPlugin(QObject *parent,
i18n("Change Browser Identification"),
actionCollection());
actionCollection()->addAction("changeuseragent", m_pUAMenu);
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 77, 0)
m_pUAMenu->setPopupMode(QToolButton::InstantPopup);
#else
m_pUAMenu->setDelayed(false);
#endif
connect(m_pUAMenu->menu(), &QMenu::aboutToShow, this, &UAChangerPlugin::slotAboutToShow);
if (parent!=nullptr) {
......
......@@ -5,11 +5,7 @@
#include "sidebar_part.h"
#if KPARTS_VERSION >= QT_VERSION_CHECK(5, 77, 0)
#include <KPluginMetaData>
#else
#include <kaboutdata.h>
#endif
#include <QApplication>
......@@ -19,22 +15,10 @@
K_PLUGIN_CLASS_WITH_JSON(KonqSidebarPart, "konq_sidebartng.json")
#if KPARTS_VERSION >= QT_VERSION_CHECK(5, 77, 0)
KonqSidebarPart::KonqSidebarPart(QWidget *parentWidget, QObject *parent, const KPluginMetaData& metaData, const QVariantList &)
#else
KonqSidebarPart::KonqSidebarPart(QWidget *parentWidget, QObject *parent, const QVariantList &)
#endif
: KParts::ReadOnlyPart(parent)
{
#if KPARTS_VERSION >= QT_VERSION_CHECK(5, 77, 0)
setMetaData(metaData);
#else
KAboutData aboutData("konqsidebartng", i18n("Extended Sidebar"), "0.2");
aboutData.addAuthor(i18n("Joseph Wenninger"), "", "jowenn@kde.org");
aboutData.addAuthor(i18n("David Faure"), "", "faure@kde.org");
aboutData.addAuthor(i18n("Raphael Rosch"), "", "kde-dev@insaner.com");
setComponentData(aboutData);
#endif
QString currentProfile = parentWidget->window()->property("currentProfile").toString();
if (currentProfile.isEmpty()) {
......
......@@ -68,11 +68,7 @@ public:
/**
* Default constructor
*/
#if KPARTS_VERSION >= QT_VERSION_CHECK(5, 77, 0)
KonqSidebarPart(QWidget *parentWidget, QObject *parent, const KPluginMetaData& metaData, const QVariantList &);
#else
KonqSidebarPart(QWidget *parentWidget, QObject *parent, const QVariantList &);
#endif
/**
* Destructor
......
......@@ -31,12 +31,7 @@ KonqSidebarDirTreeModule::~KonqSidebarDirTreeModule()
{
// KDirLister may still emit canceled while being deleted.
if (m_dirLister) {
#if KIO_VERSION < QT_VERSION_CHECK(5, 79, 0)
disconnect(m_dirLister, SIGNAL(canceled(QUrl)),
this, SLOT(slotListingStopped(QUrl)));
#else
disconnect(m_dirLister, &KCoreDirLister::listingDirCanceled, this, &KonqSidebarDirTreeModule::slotListingStopped);
#endif
delete m_dirLister;
}
}
......@@ -291,15 +286,8 @@ void KonqSidebarDirTreeModule::openSubFolder(KonqSidebarTreeItem *item)
connect(m_dirLister, SIGNAL(deleteItem(KFileItem)),
this, SLOT(slotDeleteItem(KFileItem)));
#if KIO_VERSION < QT_VERSION_CHECK(5, 79, 0)
connect(m_dirLister, SIGNAL(completed(QUrl)),
this, SLOT(slotListingStopped(QUrl)));
connect(m_dirLister, SIGNAL(canceled(QUrl)),
this, SLOT(slotListingStopped(QUrl)));
#else
connect(m_dirLister, &KCoreDirLister::listingDirCompleted, this, &KonqSidebarDirTreeModule::slotListingStopped);
connect(m_dirLister, &KCoreDirLister::listingDirCanceled, this, &KonqSidebarDirTreeModule::slotListingStopped);
#endif
connect(m_dirLister, SIGNAL(redirection(QUrl,QUrl)),
this, SLOT(slotRedirection(QUrl,QUrl)));
......
......@@ -34,23 +34,15 @@ void KonqMainWindowAdaptor::newTab(const QString &url, bool tempFile)
void KonqMainWindowAdaptor::newTabASN(const QString &url, const QByteArray &startup_id, bool tempFile)
{
#if KWINDOWSYSTEM_VERSION >= QT_VERSION_CHECK(5,62,0)
m_pMainWindow->setAttribute(Qt::WA_NativeWindow, true);
KStartupInfo::setNewStartupId(m_pMainWindow->windowHandle(), startup_id);
#else
KStartupInfo::setNewStartupId(m_pMainWindow, startup_id);
#endif
m_pMainWindow->openFilteredUrl(url, true, tempFile);
}
void KonqMainWindowAdaptor::newTabASNWithMimeType(const QString &url, const QString &mimetype, const QByteArray &startup_id, bool tempFile)
{
#if KWINDOWSYSTEM_VERSION >= QT_VERSION_CHECK(5,62,0)
m_pMainWindow->setAttribute(Qt::WA_NativeWindow, true);
KStartupInfo::setNewStartupId(m_pMainWindow->windowHandle(), startup_id);
#else
KStartupInfo::setNewStartupId(m_pMainWindow, startup_id);
#endif
m_pMainWindow->openFilteredUrl(url, mimetype, true, tempFile);
}
......
......@@ -75,12 +75,7 @@ KonqMostOftenURLSAction::KonqMostOftenURLSAction(const QString &text,
: KActionMenu(QIcon::fromTheme(QStringLiteral("go-jump")), text, parent),
m_parsingDone(false)
{
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 77, 0)
setPopupMode(QToolButton::InstantPopup);
#else
setDelayed(false);
#endif
connect(menu(), SIGNAL(aboutToShow()), SLOT(slotFillMenu()));
connect(menu(), SIGNAL(triggered(QAction*)), SLOT(slotActivated(QAction*)));
// Need to do all this upfront for a correct initial state
......@@ -210,11 +205,7 @@ void KonqMostOftenURLSAction::slotActivated(QAction *action)
KonqHistoryAction::KonqHistoryAction(const QString &text, QObject *parent)
: KActionMenu(QIcon::fromTheme(QStringLiteral("go-jump")), text, parent)
{
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 77, 0)
setPopupMode(QToolButton::InstantPopup);
#else
setDelayed(false);
#endif
connect(menu(), SIGNAL(aboutToShow()), SLOT(slotFillMenu()));
connect(menu(), SIGNAL(triggered(QAction*)), SLOT(slotActivated(QAction*)));
setEnabled(!KonqHistoryManager::kself()->entries().isEmpty());
......
......@@ -182,11 +182,7 @@ void KBookmarkBar::fillBookmarkBar(const KBookmarkGroup &parent)
}
} else {
KBookmarkActionMenu *action = new KBookmarkActionMenu(bm, nullptr);
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 77, 0)
action->setPopupMode(QToolButton::InstantPopup);
#else
action->setDelayed(false);
#endif
if (m_toolBar) {
m_toolBar->addAction(action);
}
......
......@@ -49,10 +49,6 @@ public:
KonqBookmarkMenu(KBookmarkManager *mgr, KBookmarkOwner *owner, KBookmarkActionMenu *parentMenu, QString parentAddress)
: KBookmarkMenu(mgr, owner, parentMenu->menu(), parentAddress)
{
//KBookmarkMenu doesn't create an action collection only in version 5.69.0
#if KBOOKMARKS_VERSION == QT_VERSION_CHECK(5, 69, 0)
m_actionCollection = new KActionCollection(this);
#endif
}
protected:
......
......@@ -86,9 +86,7 @@
#include <QLineEdit>
#include <QNetworkProxy>
#if KPARTS_VERSION >= QT_VERSION_CHECK(5, 77, 0)
#include <KPluginMetaData>
#endif
#include <kaboutdata.h>
#include <ktoolbar.h>
#include <konqbookmarkmenu.h>
......@@ -215,12 +213,8 @@ KonqMainWindow::KonqMainWindow(const QUrl &initialURL)
Qt::QueuedConnection); // Queued so that we don't delete the action from the code that triggered it.
// This has to be called before any action is created for this mainwindow
#if KPARTS_VERSION >= QT_VERSION_CHECK(5, 77, 0)
const KAboutData applicationData = KAboutData::applicationData();
setComponentName(applicationData.componentName(), applicationData.displayName());
#else
setComponentData(KAboutData::applicationData(), false /*don't load plugins yet*/);
#endif
m_pViewManager = new KonqViewManager(this);
m_viewModeMenu = nullptr;
......@@ -1853,12 +1847,7 @@ void KonqMainWindow::slotViewCompleted(KonqView *view)
void KonqMainWindow::slotPartActivated(KParts::Part *part)
{
#if KPARTS_VERSION >= QT_VERSION_CHECK(5, 77, 0)
qCDebug(KONQUEROR_LOG) << part << (part ? part->metaData().pluginId() : QString());
#else
qCDebug(KONQUEROR_LOG) << part << (part ? part->componentData().componentName() : QLatin1String(""));
#endif
KonqView *newView = nullptr;
KonqView *oldView = m_currentView;
......@@ -3447,11 +3436,7 @@ void KonqMainWindow::initActions()
actionCollection()->addAction(KStandardAction::Preferences, this, SLOT(slotConfigure()));
#if KXMLGUI_VERSION >= QT_VERSION_CHECK(5, 84, 0)
KStandardAction::keyBindings(guiFactory(), &KXMLGUIFactory::showConfigureShortcutsDialog, actionCollection());
#else
actionCollection()->addAction(KStandardAction::KeyBindings, guiFactory(), SLOT(configureShortcuts()));
#endif
actionCollection()->addAction(KStandardAction::ConfigureToolbars, this, SLOT(slotConfigureToolbars()));
......@@ -3641,11 +3626,7 @@ void KonqMainWindow::initActions()
m_pamBookmarks = new KBookmarkActionMenu(s_bookmarkManager->root(),
i18n("&Bookmarks"), this);
actionCollection()->addAction(QStringLiteral("bookmarks"), m_pamBookmarks);
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 77, 0)
m_pamBookmarks->setPopupMode(QToolButton::InstantPopup);
#else
m_pamBookmarks->setDelayed(false);
#endif
// The actual menu needs a different action collection, so that the bookmarks
// don't appear in kedittoolbar
......
......@@ -363,11 +363,7 @@ void KonqView::connectPart()
this, SLOT(slotStarted(KIO::Job*)));
connect(m_pPart, SIGNAL(completed()),
this, SLOT(slotCompleted()));
#if KPARTS_VERSION < QT_VERSION_CHECK(5, 81, 0)
connect(m_pPart, QOverload<bool>::of(&KParts::ReadOnlyPart::completed), this, QOverload<bool>::of(&KonqView::slotCompleted));
#else
connect(m_pPart, &KParts::ReadOnlyPart::completedWithPendingAction, this, [this](){slotCompleted(true);});
#endif
connect(m_pPart, SIGNAL(canceled(QString)),
this, SLOT(slotCanceled(QString)));
connect(m_pPart, SIGNAL(setWindowCaption(QString)),
......
......@@ -17,8 +17,6 @@
#include <QWebEngineView>
#include <QJsonDocument>
#if KPARTS_VERSION >= QT_VERSION_CHECK(5, 77, 0)
namespace {
KPluginMetaData dummyMetaData()
{
......@@ -31,7 +29,6 @@ KPluginMetaData dummyMetaData()
return KPluginMetaData(jo, QString());
}
}
#endif
class WebEnginePartApiTest : public QObject
{
......@@ -53,11 +50,7 @@ void WebEnginePartApiTest::initTestCase()
void WebEnginePartApiTest::shouldHaveBrowserExtension()
{
// GIVEN
#if KPARTS_VERSION >= QT_VERSION_CHECK(5, 77, 0)
WebEnginePart part(nullptr, nullptr, dummyMetaData());
#else
WebEnginePart part;
#endif
// WHEN
KParts::BrowserExtension *ext = KParts::BrowserExtension::childObject(&part);
......@@ -69,11 +62,7 @@ void WebEnginePartApiTest::shouldHaveBrowserExtension()
void WebEnginePartApiTest::shouldEmitStartedAndCompleted()
{
// GIVEN
#if KPARTS_VERSION >= QT_VERSION_CHECK(5, 77, 0)
WebEnginePart part(nullptr, nullptr, dummyMetaData());
#else
WebEnginePart part;
#endif
QSignalSpy spyStarted(&part, &KParts::ReadOnlyPart::started);
QSignalSpy spyCompleted(&part, SIGNAL(completed(bool)));
QSignalSpy spySetWindowCaption(&part, &KParts::ReadOnlyPart::setWindowCaption);
......@@ -96,11 +85,7 @@ void WebEnginePartApiTest::shouldEmitStartedAndCompleted()
void WebEnginePartApiTest::shouldEmitSetWindowCaption()
{
// GIVEN
#if KPARTS_VERSION >= QT_VERSION_CHECK(5, 77, 0)
WebEnginePart part(nullptr, nullptr, dummyMetaData());
#else
WebEnginePart part;
#endif
QSignalSpy spyStarted(&part, &KParts::ReadOnlyPart::started);
QSignalSpy spyCompleted(&part, SIGNAL(completed(bool)));
QSignalSpy spySetWindowCaption(&part, &KParts::ReadOnlyPart::setWindowCaption);
......@@ -119,11 +104,7 @@ void WebEnginePartApiTest::shouldEmitSetWindowCaption()
void WebEnginePartApiTest::shouldEmitOpenUrlNotifyOnClick()
{
// GIVEN
#if KPARTS_VERSION >= QT_VERSION_CHECK(5, 77, 0)
WebEnginePart part(nullptr, nullptr, dummyMetaData());
#else
WebEnginePart part;
#endif
QSignalSpy spyStarted(&part, &KParts::ReadOnlyPart::started);
QSignalSpy spyCompleted(&part, SIGNAL(completed(bool)));
QSignalSpy spySetWindowCaption(&part, &KParts::ReadOnlyPart::setWindowCaption);
......
......@@ -45,11 +45,7 @@
#include <KIO/Global>
#include <KActionCollection>
#if KPARTS_VERSION >= QT_VERSION_CHECK(5, 77, 0)
#include <KPluginMetaData>
#else
#include <KAboutData>
#endif
#include <KUrlLabel>
#include <KMessageBox>
#include <KStringHandler>
......@@ -96,9 +92,7 @@ QWebEngineScript WebEnginePart::detectRefreshScript() {
}
WebEnginePart::WebEnginePart(QWidget *parentWidget, QObject *parent,
#if KPARTS_VERSION >= QT_VERSION_CHECK(5, 77, 0)
const KPluginMetaData& metaData,
#endif
const QByteArray& cachedHistory, const QStringList& /*args*/)
:KParts::ReadOnlyPart(parent),
m_emitOpenUrlNotify(true),
......@@ -113,28 +107,7 @@ WebEnginePart::WebEnginePart(QWidget *parentWidget, QObject *parent,
WebEnginePartControls::self()->setup(QWebEngineProfile::defaultProfile());
}
#if KPARTS_VERSION >= QT_VERSION_CHECK(5, 77, 0)
setMetaData(metaData);
#else
KAboutData about = KAboutData(QStringLiteral("webenginepart"),
i18nc("Program Name", "WebEnginePart"),
/*version*/ QStringLiteral("1.3.0"),
i18nc("Short Description", "QtWebEngine Browser Engine Component"),
KAboutLicense::LGPL,
i18n("(C) 2009-2010 Dawit Alemayehu\n"
"(C) 2008-2010 Urs Wolfer\n"
"(C) 2007 Trolltech ASA"));
about.addAuthor(i18n("Sune Vuorela"), i18n("Maintainer, Developer"), QStringLiteral("sune@kde.org"));
about.addAuthor(i18n("Dawit Alemayehu"), i18n("Developer"), QStringLiteral("adawit@kde.org"));
about.addAuthor(i18n("Urs Wolfer"), i18n("Maintainer, Developer"), QStringLiteral("uwolfer@kde.org"));
about.addAuthor(i18n("Michael Howell"), i18n("Developer"), QStringLiteral("mhowell123@gmail.com"));
about.addAuthor(i18n("Laurent Montel"), i18n("Developer"), QStringLiteral("montel@kde.org"));
about.addAuthor(i18n("Dirk Mueller"), i18n("Developer"), QStringLiteral("mueller@kde.org"));
about.setProductName("webenginepart/general");
// KComponentData componentData(&about);
setComponentData(about, false /*don't load plugins yet*/);
#endif
#if 0
// NOTE: If the application does not set its version number, we automatically
......@@ -295,12 +268,7 @@ void WebEnginePart::initActions()
KCodecAction *codecAction = new KCodecAction( QIcon::fromTheme(QStringLiteral("character-set")), i18n( "Set &Encoding" ), this, true );
actionCollection()->addAction( QStringLiteral("setEncoding"), codecAction );
#if KCONFIGWIDGETS_VERSION >= QT_VERSION_CHECK(5, 78, 0)
connect(codecAction, &KCodecAction::codecTriggered, this, &WebEnginePart::slotSetTextEncoding);
#else
connect(codecAction, QOverload<QTextCodec *>::of(&KCodecAction::triggered), this, &WebEnginePart::slotSetTextEncoding);
#endif
action = new QAction(i18n("View Do&cument Source"), this);
actionCollection()->addAction(QStringLiteral("viewDocumentSource"), action);
actionCollection()->setDefaultShortcut(action, QKeySequence(Qt::CTRL | Qt::Key_U));
......@@ -553,11 +521,7 @@ void WebEnginePart::slotLoadFinished (bool ok)
auto callback = [this](const QVariant &res) {
bool hasRefresh = res.toBool();
#if KPARTS_VERSION < QT_VERSION_CHECK(5, 81, 0)
emit completed(hasRefresh);
#else
emit hasRefresh ? completedWithPendingAction() : completed();
#endif
};
page()->runJavaScript("hasRefreshAttribute()", QWebEngineScript::ApplicationWorld, callback);
updateActions();
......
......@@ -53,9 +53,7 @@ class KWEBENGINEPARTLIB_EXPORT WebEnginePart : public KParts::ReadOnlyPart
Q_PROPERTY( bool modified READ isModified )
public:
explicit WebEnginePart(QWidget* parentWidget, QObject* parent,
#if KPARTS_VERSION >= QT_VERSION_CHECK(5, 77, 0)
const KPluginMetaData& metaData,
#endif
const QByteArray& cachedHistory = QByteArray(),
const QStringList& = QStringList());
~WebEnginePart() override;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment