Commit 343d8595 authored by Carlos Alves's avatar Carlos Alves
Browse files

Remove deprecated functions

Konsole minimum required version is QT 5.14 and KF5 5.71, there is no
need to keep support for those deprecated functions.
parent 3438b94e
......@@ -12,7 +12,6 @@
// KDE
#include <KActionCollection>
#include <kbookmarks_version.h>
#include <KBookmarkManager>
#include <KBookmark>
......@@ -23,20 +22,12 @@
#include <algorithm> // std::any_of
BookmarkMenu::BookmarkMenu (KBookmarkManager *mgr, KBookmarkOwner *owner, QMenu *parentMenu, KActionCollection *collection) :
#if KBOOKMARKS_VERSION < QT_VERSION_CHECK(5, 69, 0)
KBookmarkMenu (mgr, owner, parentMenu, collection)
#else
KBookmarkMenu (mgr, owner, parentMenu)
#endif
{
QAction *bookmarkAction;
#if KBOOKMARKS_VERSION < QT_VERSION_CHECK(5, 69, 0)
bookmarkAction = collection->action(QStringLiteral("add_bookmark"));
#else
collection->addActions(parentMenu->actions());
bookmarkAction = addBookmarkAction();
#endif
Q_ASSERT(bookmarkAction);
......
......@@ -548,13 +548,9 @@ bool MainWindow::queryClose()
// Check what processes are running, excluding the shell
QStringList processesRunning;
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
// Need to make a local copy so the begin() and end() point to the same QList
const QList<Session*> sessionList = _viewManager->sessions();
const QSet<Session*> uniqueSessions(sessionList.begin(), sessionList.end());
#else
const QSet<Session*> uniqueSessions = QSet<Session*>::fromList(_viewManager->sessions());
#endif
for (Session *session : uniqueSessions) {
if ((session == nullptr) || !session->isForegroundProcessActive()) {
......
......@@ -123,13 +123,9 @@ QSet<QString> ProcessInfo::commonDirNames()
if (forTheFirstTime) {
const KSharedConfigPtr &config = KSharedConfig::openConfig();
const KConfigGroup &configGroup = config->group("ProcessInfo");
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
// Need to make a local copy so the begin() and end() point to the same QList
const QStringList commonDirsList = configGroup.readEntry("CommonDirNames", QStringList());
_commonDirNames = QSet<QString>(commonDirsList.begin(), commonDirsList.end());
#else
_commonDirNames = QSet<QString>::fromList(configGroup.readEntry("CommonDirNames", QStringList()));
#endif
forTheFirstTime = false;
}
......
......@@ -7,13 +7,8 @@
#include "EscapeSequenceUrlFilterHotSpot.h"
#include <kio_version.h>
#if KIO_VERSION < QT_VERSION_CHECK(5, 71, 0)
#include <KRun>
#else
#include <KIO/JobUiDelegate>
#include <KIO/OpenUrlJob>
#endif
#include <QApplication>
#include <QMouseEvent>
......@@ -41,11 +36,7 @@ void EscapeSequenceUrlHotSpot::activate(QObject *obj)
{
Q_UNUSED(obj)
#if KIO_VERSION < QT_VERSION_CHECK(5, 71, 0)
new KRun(QUrl(_url), QApplication::activeWindow());
#else
auto *job = new KIO::OpenUrlJob(QUrl(_url));
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, QApplication::activeWindow()));
job->start();
#endif
}
......@@ -121,14 +121,9 @@ void FileFilter::process()
// Do not re-process.
if (_dirPath != dir.canonicalPath() + QLatin1Char('/')) {
_dirPath = dir.canonicalPath() + QLatin1Char('/');
#if QT_VERSION >= QT_VERSION_CHECK(5,14,0)
const auto tmpList = dir.entryList(QDir::Dirs | QDir::Files);
_currentDirContents = QSet<QString>(std::begin(tmpList), std::end(tmpList));
#else
_currentDirContents = QSet<QString>::fromList(dir.entryList(QDir::Dirs | QDir::Files));
#endif
}
RegExpFilter::process();
......
......@@ -18,13 +18,8 @@
#include <QKeyEvent>
#include <QRegularExpression>
#include <kio_version.h>
#if KIO_VERSION < QT_VERSION_CHECK(5, 71, 0)
#include <KRun>
#else
#include <KIO/ApplicationLauncherJob>
#include <KIO/OpenUrlJob>
#endif
#include <KIO/JobUiDelegate>
#include <KLocalizedString>
......@@ -56,14 +51,10 @@ void FileFilterHotSpot::activate(QObject *)
{
// Used to fallback to opening the url with the system default application
auto openUrl = [](const QString &filePath) {
#if KIO_VERSION < QT_VERSION_CHECK(5, 71, 0)
new KRun(QUrl::fromLocalFile(filePath), QApplication::activeWindow());
#else
auto *job = new KIO::OpenUrlJob(QUrl::fromLocalFile(filePath));
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, QApplication::activeWindow()));
job->setRunExecutables(false); // Always open, e.g. shell scripts, as text
job->start();
#endif
};
// Output of e.g.:
......@@ -105,12 +96,6 @@ void FileFilterHotSpot::activate(QObject *)
KService::Ptr service(new KService(QString(), editorCmd, QString()));
#if KIO_VERSION < QT_VERSION_CHECK(5, 71, 0)
const bool success = KRun::runService(*service, {}, QApplication::activeWindow());
if (!success) {
openUrl(path);
}
#else
// ApplicationLauncherJob is better at reporting errors to the user than
// CommandLauncherJob; no need to call job->setUrls() because the url is
// already part of editorCmd
......@@ -126,7 +111,6 @@ void FileFilterHotSpot::activate(QObject *)
}
});
job->start();
#endif
return;
}
......
......@@ -7,13 +7,8 @@
#include "UrlFilterHotspot.h"
#include <kio_version.h>
#if KIO_VERSION < QT_VERSION_CHECK(5, 71, 0)
#include <KRun>
#else
#include <KIO/JobUiDelegate>
#include <KIO/OpenUrlJob>
#endif
#include <QAction>
#include <QApplication>
......@@ -85,13 +80,9 @@ void UrlFilterHotSpot::activate(QObject *object)
url.prepend(QLatin1String("mailto:"));
}
#if KIO_VERSION < QT_VERSION_CHECK(5, 71, 0)
new KRun(QUrl(url), QApplication::activeWindow());
#else
auto *job = new KIO::OpenUrlJob(QUrl(url));
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, QApplication::activeWindow()));
job->start();
#endif
}
}
......
......@@ -43,19 +43,10 @@
#include <KCodecAction>
#include <KNotification>
#include <kio_version.h>
#if KIO_VERSION > QT_VERSION_CHECK(5, 68, 0)
#include <KIO/CommandLauncherJob>
#else
#include <KToolInvocation>
#endif
#if KIO_VERSION < QT_VERSION_CHECK(5, 71, 0)
#include <KRun>
#else
#include <KIO/JobUiDelegate>
#include <KIO/OpenUrlJob>
#endif
// Konsole
#include "CopyInputDialog.h"
......@@ -537,24 +528,16 @@ void SessionController::handleWebShortcutAction()
if (KUriFilter::self()->filterUri(filterData, { QStringLiteral("kurisearchfilter") })) {
const QUrl url = filterData.uri();
#if KIO_VERSION < QT_VERSION_CHECK(5, 71, 0)
new KRun(url, QApplication::activeWindow());
#else
auto *job = new KIO::OpenUrlJob(url);
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, QApplication::activeWindow()));
job->start();
#endif
}
}
void SessionController::configureWebShortcuts()
{
#if KIO_VERSION > QT_VERSION_CHECK(5, 68, 0)
auto job = new KIO::CommandLauncherJob(QStringLiteral("kcmshell5"), { QStringLiteral("webshortcuts") });
job->start();
#else
KToolInvocation::kdeinitExec(QStringLiteral("kcmshell5"), { QStringLiteral("webshortcuts") });
#endif
}
void SessionController::sendSignal(QAction* action)
......@@ -1077,13 +1060,9 @@ void SessionController::openBrowser()
{
const QUrl currentUrl = url().isLocalFile() ? url() : QUrl::fromLocalFile(QDir::homePath());
#if KIO_VERSION < QT_VERSION_CHECK(5, 71, 0)
new KRun(currentUrl, QApplication::activeWindow(), true);
#else
auto *job = new KIO::OpenUrlJob(currentUrl);
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, QApplication::activeWindow()));
job->start();
#endif
}
void SessionController::copy()
......@@ -1163,11 +1142,7 @@ void SessionController::copyInputToAllTabs()
const KXmlGuiWindow* myWindow = findWindow(view());
const QList<Session *> sessionsList = SessionManager::instance()->sessions();
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
QSet<Session*> group(sessionsList.begin(), sessionsList.end());
#else
QSet<Session*> group = QSet<Session*>::fromList(sessionsList);
#endif
for (auto session : group) {
// First, ensure that the session is removed
// (necessary to avoid duplicates on addSession()!)
......@@ -1198,11 +1173,7 @@ void SessionController::copyInputToSelectedTabs()
dialog->setMasterSession(session());
const QList<Session*> sessionsList = _copyToGroup->sessions();
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
QSet<Session*> currentGroup(sessionsList.begin(), sessionsList.end());
#else
QSet<Session*> currentGroup = QSet<Session*>::fromList(sessionsList);
#endif
currentGroup.remove(session());
......@@ -1242,11 +1213,7 @@ void SessionController::copyInputToNone()
// Once Qt5.14+ is the mininum, change to use range constructors
const QList<Session*> groupList = SessionManager::instance()->sessions();
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
QSet<Session*> group(groupList.begin(), groupList.end());
#else
QSet<Session*> group = QSet<Session*>::fromList(groupList);
#endif
for (auto iterator : group) {
Session *s = iterator;
......
......@@ -1725,11 +1725,7 @@ void TerminalDisplay::wheelEvent(QWheelEvent* ev)
} else if (_usesMouseTracking) {
// terminal program wants notification of mouse activity
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
auto [charLine, charColumn] = getCharacterPosition(ev->position().toPoint(), !_usesMouseTracking);
#else
auto [charLine, charColumn] = getCharacterPosition(ev->pos(), !_usesMouseTracking);
#endif
const int steps = _scrollWheelState.consumeLegacySteps(ScrollState::DEFAULT_ANGLE_SCROLL_LINE);
const int button = (steps > 0) ? 4 : 5;
for (int i = 0; i < abs(steps); ++i) {
......
Markdown is supported
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