From 1e136d63f23269f8e2bd67f7d954196f2ea56b90 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Mon, 18 Sep 2023 09:00:14 +0500 Subject: [PATCH] move konsole to kf6 --- .gitlab-ci.yml | 5 +- .kde-ci.yml | 29 ------ CMakeLists.txt | 35 +++---- desktop/CMakeLists.txt | 19 +--- kconf_update/CMakeLists.txt | 10 +- src/AppColorSchemeChooser.cpp | 70 -------------- src/AppColorSchemeChooser.h | 42 --------- src/CMakeLists.txt | 94 +++++++++---------- src/FontDialog.cpp | 4 - src/MainWindow.cpp | 84 +++++------------ src/Part.cpp | 8 -- src/Part.h | 4 - src/ProcessInfo.cpp | 20 ++-- src/Pty.cpp | 30 ------ src/Pty.h | 11 --- src/Vt102Emulation.cpp | 24 +---- src/WindowSystemInfo.cpp | 10 -- src/autotests/CMakeLists.txt | 6 +- src/autotests/PartTest.cpp | 23 ----- src/autotests/PtyTest.cpp | 5 - src/autotests/TerminalInterfaceTest.cpp | 21 ----- src/colorscheme/ColorScheme.cpp | 72 ++++++-------- src/colorscheme/ColorScheme.h | 7 -- .../EscapeSequenceUrlFilterHotSpot.cpp | 9 -- src/filterHotSpots/FileFilterHotspot.cpp | 26 ----- .../KeyboardTranslatorReader.cpp | 5 - src/main.cpp | 38 -------- .../QuickCommands/quickcommandswidget.cpp | 23 +---- .../SSHManager/sshmanagerpluginwidget.cpp | 8 -- src/pluginsystem/PluginManager.cpp | 23 ----- src/profile/Profile.cpp | 9 +- src/profile/Profile.h | 4 - src/session/Session.cpp | 17 ---- src/session/SessionController.cpp | 73 +------------- src/terminalDisplay/TerminalDisplay.cpp | 18 ---- src/terminalDisplay/TerminalDisplay.h | 7 -- src/terminalDisplay/TerminalFonts.cpp | 28 +----- src/tests/CMakeLists.txt | 2 +- src/tests/PartManualTest.cpp | 18 +--- src/tests/demo_konsolepart/CMakeLists.txt | 4 +- src/tests/demo_konsolepart/src/CMakeLists.txt | 14 +-- .../demo_konsolepart/src/demo_konsolepart.cpp | 21 +---- src/widgets/EditProfileDialog.cpp | 52 +--------- src/widgets/EditProfileDialog.h | 15 +-- src/widgets/IncrementalSearchBar.cpp | 9 +- src/widgets/TabTitleFormatButton.cpp | 25 ----- src/widgets/TabTitleFormatButton.h | 8 +- tools/uni2characterwidth/CMakeLists.txt | 6 +- 48 files changed, 161 insertions(+), 934 deletions(-) delete mode 100644 src/AppColorSchemeChooser.cpp delete mode 100644 src/AppColorSchemeChooser.h diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f025ea660..0597882da 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,10 +3,7 @@ include: # - https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/reuse-lint.yml - - https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/linux.yml - - https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/freebsd.yml - - https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/windows.yml - https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/linux-qt6.yml - https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/freebsd-qt6.yml - https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/windows-qt6.yml - - https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/flatpak.yml + # - https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/flatpak.yml diff --git a/.kde-ci.yml b/.kde-ci.yml index be9f7522b..e5d24a9cc 100644 --- a/.kde-ci.yml +++ b/.kde-ci.yml @@ -2,30 +2,6 @@ # SPDX-License-Identifier: CC0-1.0 Dependencies: -- 'on': ['Linux/Qt5', 'FreeBSD/Qt5', 'Windows/Qt5'] - 'require': - 'frameworks/extra-cmake-modules': '@stable' - 'frameworks/kconfig': '@stable' - 'frameworks/knotifications': '@stable' - 'frameworks/ki18n': '@stable' - 'frameworks/kcoreaddons': '@stable' - 'frameworks/kdbusaddons': '@stable' - 'frameworks/kbookmarks': '@stable' - 'frameworks/kconfigwidgets': '@stable' - 'frameworks/kcrash': '@stable' - 'frameworks/kguiaddons': '@stable' - 'frameworks/kiconthemes': '@stable' - 'frameworks/kio': '@stable' - 'frameworks/knewstuff': '@stable' - 'frameworks/knotifyconfig': '@stable' - 'frameworks/kparts': '@stable' - 'frameworks/kservice': '@stable' - 'frameworks/ktextwidgets': '@stable' - 'frameworks/kwidgetsaddons': '@stable' - 'frameworks/kwindowsystem': '@stable' - 'frameworks/kxmlgui': '@stable' - 'frameworks/kdoctools': '@stable' - - 'on': ['Linux/Qt6', 'FreeBSD/Qt6', 'Windows/Qt6'] 'require': 'frameworks/extra-cmake-modules': '@latest-kf6' @@ -50,11 +26,6 @@ Dependencies: 'frameworks/kxmlgui': '@latest-kf6' 'frameworks/kdoctools': '@latest-kf6' -- 'on': ['Linux/Qt5', 'FreeBSD/Qt5'] - 'require': - 'frameworks/kpty': '@stable' - 'frameworks/kglobalaccel': '@stable' - - 'on': ['Linux/Qt6', 'FreeBSD/Qt6'] 'require': 'frameworks/kpty': '@latest-kf6' diff --git a/CMakeLists.txt b/CMakeLists.txt index 9fd6f4f01..6b50f85af 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,15 +13,15 @@ set (RELEASE_SERVICE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE # See comments in https://invent.kde.org/utilities/konsole/-/commit/9d8e47298c81fc1e47c998eda1b6e980589274eb cmake_minimum_required(VERSION 3.16 FATAL_ERROR) -# Match KDE Frameworks update Apr 2021 -set (QT_MIN_VERSION "5.15.0") - -set (KF_MIN_VERSION "5.71.0") +set(QT_MIN_VERSION "6.5.0") +set(KF5_DEP_VERSION "5.240.0") +set(QT_MAJOR_VERSION "6") +set(KF_MAJOR_VERSION "6") # Release script will create bugzilla versions project(konsole VERSION ${RELEASE_SERVICE_VERSION}) -find_package(ECM ${KF_MIN_VERSION} REQUIRED NO_MODULE) +find_package(ECM ${KF5_DEP_VERSION} REQUIRED NO_MODULE) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH}) include(KDEInstallDirs) @@ -44,28 +44,19 @@ include(CheckIncludeFiles) # Allows passing e.g. -DECM_ENABLE_SANITIZERS='address;undefined' to cmake. include(ECMEnableSanitizers) -if(ECM_GLOBAL_FIND_VERSION VERSION_LESS "5.82.0") - if(NOT QT_MAJOR_VERSION) - set(QT_MAJOR_VERSION "5") - endif() -endif() - -if(QT_MAJOR_VERSION STREQUAL "6") - find_package(Qt6Core5Compat ${QT_MIN_VERSION} CONFIG REQUIRED) -endif() - ecm_setup_version(${RELEASE_SERVICE_VERSION} VARIABLE_PREFIX KONSOLEPRIVATE SOVERSION 1 ) -find_package(Qt${QT_MAJOR_VERSION} ${QT_MIN_VERSION} CONFIG REQUIRED +find_package(Qt6 ${QT_MIN_VERSION} CONFIG REQUIRED Core DBus Multimedia PrintSupport Widgets + Core5Compat ) -find_package(KF${QT_MAJOR_VERSION} ${KF_MIN_VERSION} REQUIRED +find_package(KF6 ${KF5_DEP_VERSION} REQUIRED Bookmarks Config ConfigWidgets @@ -88,14 +79,14 @@ find_package(KF${QT_MAJOR_VERSION} ${KF_MIN_VERSION} REQUIRED ) if (NOT WIN32) - find_package(KF${QT_MAJOR_VERSION} ${KF_MIN_VERSION} REQUIRED + find_package(KF6 ${KF5_DEP_VERSION} REQUIRED GlobalAccel Pty ) endif() -find_package(KF${QT_MAJOR_VERSION}DocTools ${KF_MIN_VERSION}) -set_package_properties(KF${QT_MAJOR_VERSION}DocTools PROPERTIES DESCRIPTION +find_package(KF6DocTools ${KF5_DEP_VERSION}) +set_package_properties(KF6DocTools PROPERTIES DESCRIPTION "Tools to generate documentation" TYPE OPTIONAL ) @@ -142,7 +133,7 @@ if (NOT WIN32) add_subdirectory( kconf_update ) endif() -if (KF${QT_MAJOR_VERSION}DocTools_FOUND) +if (KF6DocTools_FOUND) add_subdirectory( doc/manual ) endif() @@ -162,7 +153,7 @@ ecm_qt_install_logging_categories( ) ki18n_install( po ) -if (KF${QT_MAJOR_VERSION}DocTools_FOUND) +if (KF6DocTools_FOUND) kdoctools_install( po ) endif() diff --git a/desktop/CMakeLists.txt b/desktop/CMakeLists.txt index 3466fd065..0e69d2841 100644 --- a/desktop/CMakeLists.txt +++ b/desktop/CMakeLists.txt @@ -6,20 +6,5 @@ install( PROGRAMS org.kde.konsole.desktop DESTINATION ${KDE_INSTALL_APPDIR} ) install( FILES org.kde.konsole.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR} ) install( FILES org.kde.konsole.desktop DESTINATION ${KDE_INSTALL_DATADIR}/kglobalaccel) -if(ECM_VERSION VERSION_GREATER_EQUAL "5.89.0") - if(QT_MAJOR_VERSION STREQUAL "5") - install(FILES terminalemulator.desktop DESTINATION ${KDE_INSTALL_KSERVICETYPESDIR}) - install(FILES konsolepart.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR}) - endif() - install(FILES konsole.notifyrc DESTINATION ${KDE_INSTALL_KNOTIFYRCDIR}) -else() - install(FILES terminalemulator.desktop DESTINATION ${KDE_INSTALL_KSERVICETYPES5DIR}) - install(FILES konsolepart.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}) - install(FILES konsole.notifyrc DESTINATION ${KDE_INSTALL_KNOTIFY5RCDIR}) -endif() - -if(KF${QT_MAJOR_VERSION}KIO_VERSION VERSION_GREATER_EQUAL "5.85.0") - install( PROGRAMS konsolerun.desktop DESTINATION ${KDE_INSTALL_DATADIR}/kio/servicemenus ) -else() - install( FILES konsolerun.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}/ServiceMenus ) -endif() +install(FILES konsole.notifyrc DESTINATION ${KDE_INSTALL_KNOTIFYRCDIR}) +install( PROGRAMS konsolerun.desktop DESTINATION ${KDE_INSTALL_DATADIR}/kio/servicemenus ) diff --git a/kconf_update/CMakeLists.txt b/kconf_update/CMakeLists.txt index b79eb02aa..bc77bfbfc 100644 --- a/kconf_update/CMakeLists.txt +++ b/kconf_update/CMakeLists.txt @@ -3,9 +3,9 @@ add_executable(konsole_globalaccel ) target_link_libraries(konsole_globalaccel PRIVATE - KF${QT_MAJOR_VERSION}::ConfigCore - KF${QT_MAJOR_VERSION}::GlobalAccel - KF${QT_MAJOR_VERSION}::Service + KF6::ConfigCore + KF6::GlobalAccel + KF6::Service ) @@ -15,8 +15,8 @@ qt_add_resources(konsole_show_menubar_SRCS ../desktop/konsole.qrc) add_executable(konsole_show_menubar ${konsole_show_menubar_SRCS}) target_link_libraries(konsole_show_menubar - KF${QT_MAJOR_VERSION}::XmlGui - KF${QT_MAJOR_VERSION}::CoreAddons + KF6::XmlGui + KF6::CoreAddons ) diff --git a/src/AppColorSchemeChooser.cpp b/src/AppColorSchemeChooser.cpp deleted file mode 100644 index 565bae801..000000000 --- a/src/AppColorSchemeChooser.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/************************************************************************************* - * SPDX-FileCopyrightText: 2016 Zhigalin Alexander - * SPDX-FileCopyrightText: 2021 DI DIO Maximilien - * - * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL - *************************************************************************************/ - -#include "AppColorSchemeChooser.h" -#include "konsoledebug.h" - -#include -#include - -#include -#include -#include -#include -#if QT_VERSION > QT_VERSION_CHECK(6, 0, 0) -#include -#endif - -AppColorSchemeChooser::AppColorSchemeChooser(QObject *parent) - : QAction(parent) -{ - auto *manager = new KColorSchemeManager(parent); - -#if KCONFIGWIDGETS_VERSION < QT_VERSION_CHECK(5, 93, 0) - const QString scheme(currentSchemeName()); - qCDebug(KonsoleDebug) << "Color scheme : " << scheme; - auto *selectionMenu = manager->createSchemeSelectionMenu(scheme, this); - connect(selectionMenu->menu(), &QMenu::triggered, this, &AppColorSchemeChooser::slotSchemeChanged); - manager->activateScheme(manager->indexForScheme(scheme)); -#else - manager->setAutosaveChanges(true); -#if QT_VERSION > QT_VERSION_CHECK(6, 0, 0) - KActionMenu *selectionMenu = KColorSchemeMenu::createMenu(manager, this); -#else - KActionMenu *selectionMenu = manager->createSchemeSelectionMenu(this); -#endif -#endif - - setMenu(selectionMenu->menu()); - menu()->setIcon(QIcon::fromTheme(QStringLiteral("preferences-desktop-color"))); - menu()->setTitle(i18n("&Window Color Scheme")); -} - -#if KCONFIGWIDGETS_VERSION < QT_VERSION_CHECK(5, 93, 0) -QString AppColorSchemeChooser::currentSchemeName() const -{ - if (!menu()) { - KSharedConfigPtr config = KSharedConfig::openConfig(); - KConfigGroup cg(config, "UiSettings"); - return cg.readEntry("WindowColorScheme", QString()); - } - - if (QAction *const action = menu()->activeAction()) { - return KLocalizedString::removeAcceleratorMarker(action->text()); - } - - return QString(); -} - -void AppColorSchemeChooser::slotSchemeChanged(QAction *triggeredAction) -{ - KSharedConfigPtr config = KSharedConfig::openConfig(); - KConfigGroup cg(config, "UiSettings"); - cg.writeEntry("WindowColorScheme", KLocalizedString::removeAcceleratorMarker(triggeredAction->text())); - cg.sync(); -} -#endif diff --git a/src/AppColorSchemeChooser.h b/src/AppColorSchemeChooser.h deleted file mode 100644 index 7eb12195d..000000000 --- a/src/AppColorSchemeChooser.h +++ /dev/null @@ -1,42 +0,0 @@ -/************************************************************************************* - * SPDX-FileCopyrightText: 2016 Zhigalin Alexander - * SPDX-FileCopyrightText: 2021 DI DIO Maximilien - * - * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL - *************************************************************************************/ - -#ifndef KONSOLE_COLOR_SCHEME_CHOOSER_H -#define KONSOLE_COLOR_SCHEME_CHOOSER_H - -#include -#include - -#include -#include - -// Konsole -#include "konsoleprivate_export.h" - -class KActionCollection; - -/** - * Provides a menu that will offer to change the color scheme - * - * Furthermore, it will save the selection in the user configuration. - */ -// TODO: Once the minimum KF version is changed to >= 5.93, remove this whole -// class and move the couple of lines of code from the constructor to MainWindow -class KONSOLEPRIVATE_EXPORT AppColorSchemeChooser : public QAction -{ -public: - explicit AppColorSchemeChooser(QObject *parent); - - // Not needed with KF >= 5.93 -#if KCONFIGWIDGETS_VERSION < QT_VERSION_CHECK(5, 93, 0) - QString currentSchemeName() const; -private Q_SLOTS: - void slotSchemeChanged(QAction *triggeredAction); -#endif -}; - -#endif diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4e50698d2..7ecfd4435 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -9,10 +9,6 @@ else() set(HAVE_OS_DRAGONFLYBSD 0) endif() -IF(NOT (${KF${QT_MAJOR_VERSION}_VERSION} VERSION_LESS "5.60.0")) - set(USE_TERMINALINTERFACEV2 1) -endif() - include(CheckIncludeFiles) include(ECMAddAppIcon) @@ -22,7 +18,7 @@ configure_file(config-konsole.h.cmake ### Tests if(BUILD_TESTING) if (NOT WIN32) - find_package(Qt${QT_MAJOR_VERSION}Test ${QT_MIN_VERSION} CONFIG REQUIRED) + find_package(Qt6Test ${QT_MIN_VERSION} CONFIG REQUIRED) add_subdirectory(autotests) add_subdirectory(tests) endif() @@ -62,26 +58,26 @@ qt_add_dbus_adaptor( ) set(konsole_LIBS - KF${QT_MAJOR_VERSION}::XmlGui + KF6::XmlGui Qt::Multimedia Qt::PrintSupport Qt::Xml - KF${QT_MAJOR_VERSION}::Notifications - KF${QT_MAJOR_VERSION}::WindowSystem - KF${QT_MAJOR_VERSION}::TextWidgets - KF${QT_MAJOR_VERSION}::GuiAddons - KF${QT_MAJOR_VERSION}::IconThemes - KF${QT_MAJOR_VERSION}::Bookmarks - KF${QT_MAJOR_VERSION}::I18n - KF${QT_MAJOR_VERSION}::KIOWidgets - KF${QT_MAJOR_VERSION}::DBusAddons - KF${QT_MAJOR_VERSION}::NewStuffCore + KF6::Notifications + KF6::WindowSystem + KF6::TextWidgets + KF6::GuiAddons + KF6::IconThemes + KF6::Bookmarks + KF6::I18n + KF6::KIOWidgets + KF6::DBusAddons + KF6::NewStuffCore ) if (NOT WIN32) list(APPEND konsole_LIBS - KF${QT_MAJOR_VERSION}::Pty - KF${QT_MAJOR_VERSION}::GlobalAccel + KF6::Pty + KF6::GlobalAccel ) endif() @@ -109,7 +105,7 @@ ecm_qt_declare_logging_category( add_library(konsoleprivate_core STATIC ${konsoleprivate_core_SRCS}) # Needed to link this static lib to shared libs set_target_properties(konsoleprivate_core PROPERTIES POSITION_INDEPENDENT_CODE ON) -target_link_libraries(konsoleprivate_core KF${QT_MAJOR_VERSION}::CoreAddons) +target_link_libraries(konsoleprivate_core KF6::CoreAddons) set(konsolehelpers_SRCS LabelsAligner.cpp @@ -134,7 +130,6 @@ if (WIN32) endif() set(konsoleprivate_SRCS ${windowadaptors_SRCS} - AppColorSchemeChooser.cpp BookmarkHandler.cpp BookmarkMenu.cpp CheckableSessionModel.cpp @@ -276,23 +271,21 @@ target_link_libraries(konsoleprivate konsolehelpers konsolecharacters konsoledecoders - KF${QT_MAJOR_VERSION}::NewStuffCore - KF${QT_MAJOR_VERSION}::NewStuffWidgets + KF6::NewStuffCore + KF6::NewStuffWidgets ${konsole_LIBS} ZLIB::ZLIB ICU::uc ICU::i18n ) -if(QT_MAJOR_VERSION STREQUAL "6") - target_link_libraries(konsoleprivate - PUBLIC - Qt6::Core5Compat - PRIVATE - KF6::IconWidgets - KF6::BookmarksWidgets - ) -endif() +target_link_libraries(konsoleprivate + PUBLIC + Qt6::Core5Compat + PRIVATE + KF6::IconWidgets + KF6::BookmarksWidgets +) set_target_properties(konsoleprivate PROPERTIES VERSION ${KONSOLEPRIVATE_VERSION} @@ -322,13 +315,13 @@ target_compile_definitions(konsoleapp PRIVATE -DRELEASE_SERVICE_VERSION="${RELEA target_link_libraries(konsoleapp konsoleprivate - KF${QT_MAJOR_VERSION}::XmlGui - KF${QT_MAJOR_VERSION}::WindowSystem - KF${QT_MAJOR_VERSION}::Bookmarks - KF${QT_MAJOR_VERSION}::I18n - KF${QT_MAJOR_VERSION}::KIOWidgets - KF${QT_MAJOR_VERSION}::NotifyConfig - KF${QT_MAJOR_VERSION}::Crash + KF6::XmlGui + KF6::WindowSystem + KF6::Bookmarks + KF6::I18n + KF6::KIOWidgets + KF6::NotifyConfig + KF6::Crash ) set_target_properties(konsoleapp PROPERTIES @@ -349,13 +342,13 @@ add_executable(konsole ${konsole_SRCS} ${ICONS_SOURCES}) target_link_libraries(konsole konsoleprivate konsoleapp - KF${QT_MAJOR_VERSION}::XmlGui - KF${QT_MAJOR_VERSION}::WindowSystem - KF${QT_MAJOR_VERSION}::Bookmarks - KF${QT_MAJOR_VERSION}::I18n - KF${QT_MAJOR_VERSION}::KIOWidgets - KF${QT_MAJOR_VERSION}::NotifyConfig - KF${QT_MAJOR_VERSION}::Crash + KF6::XmlGui + KF6::WindowSystem + KF6::Bookmarks + KF6::I18n + KF6::KIOWidgets + KF6::NotifyConfig + KF6::Crash ) if(APPLE) @@ -384,15 +377,12 @@ add_library(konsolepart MODULE ${konsolepart_PART_SRCS}) generate_export_header(konsolepart BASE_NAME konsole) set_target_properties(konsolepart PROPERTIES DEFINE_SYMBOL KONSOLE_PART) target_link_libraries(konsolepart - KF${QT_MAJOR_VERSION}::Parts - KF${QT_MAJOR_VERSION}::XmlGui + KF6::Parts + KF6::XmlGui konsoleprivate ) -if(QT_MAJOR_VERSION STREQUAL "6") - install(TARGETS konsolepart DESTINATION ${KDE_INSTALL_PLUGINDIR}/kf6/parts) -else() - install(TARGETS konsolepart DESTINATION ${KDE_INSTALL_PLUGINDIR}) -endif() + +install(TARGETS konsolepart DESTINATION ${KDE_INSTALL_PLUGINDIR}/kf6/parts) # Add cmake-options -DBUILD_COVERAGE=ON -DCOVERAGE_GENERATE_HTML=ON if(COVERAGE_GENERATE_HTML) diff --git a/src/FontDialog.cpp b/src/FontDialog.cpp index a5925f2ac..9792d08ed 100644 --- a/src/FontDialog.cpp +++ b/src/FontDialog.cpp @@ -28,7 +28,6 @@ FontDialog::FontDialog(QWidget *parent, bool emoji, const QFont font) KFontChooser::DisplayFlag onlyFixed = _emoji ? KFontChooser::FixedFontsOnly : KFontChooser::FixedFontsOnly; -#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 86, 0) _fontChooser = new KFontChooser(onlyFixed, this); if (_emoji) { QStringList list = KFontChooser::createFontList(0).filter(QStringLiteral("emoji"), Qt::CaseInsensitive); @@ -36,9 +35,6 @@ FontDialog::FontDialog(QWidget *parent, bool emoji, const QFont font) _fontChooser->setFontListItems(KFontChooser::createFontList(0).filter(QStringLiteral("emoji"), Qt::CaseInsensitive)); _fontChooser->setFont(font); } -#else - _fontChooser = new KFontChooser(this, onlyFixed); -#endif _showAllFonts = new QCheckBox(i18nc("@action:button", "Show all fonts"), this); _showAllFontsWarningButton = new QToolButton(this); diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 361acd0dd..ee75c81b2 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -6,7 +6,6 @@ // Own #include "MainWindow.h" -#include "AppColorSchemeChooser.h" // Qt #include @@ -19,31 +18,26 @@ #include #include #include +#include +#include #include #include #include #include -#include -#include -#include - -#include -#if HAVE_X11 -#if KWINDOWSYSTEM_VERSION >= QT_VERSION_CHECK(5, 101, 0) -#include -#endif -#endif - #include #include +#include #include #include +#include #include +#include #include #include -#include -#include +#if HAVE_X11 +#include +#endif // Konsole #include "BookmarkHandler.h" @@ -226,7 +220,6 @@ void MainWindow::activationRequest(const QString &xdgActivationToken) { KWindowSystem::setCurrentXdgActivationToken(xdgActivationToken); -#if KWINDOWSYSTEM_VERSION >= QT_VERSION_CHECK(5, 101, 0) if (KWindowSystem::isPlatformX11()) { #if HAVE_X11 KX11Extras::forceActiveWindow(winId()); @@ -234,9 +227,6 @@ void MainWindow::activationRequest(const QString &xdgActivationToken) } else { KWindowSystem::activateWindow(windowHandle()); } -#else - KWindowSystem::forceActiveWindow(winId()); -#endif } void MainWindow::rememberMenuAccelerators() @@ -441,7 +431,14 @@ void MainWindow::setupActions() }); // Set up themes - actionCollection()->addAction(QStringLiteral("window-colorscheme-menu"), new AppColorSchemeChooser(actionCollection())); + auto *manager = new KColorSchemeManager(actionCollection()); + manager->setAutosaveChanges(true); + KActionMenu *selectionMenu = KColorSchemeMenu::createMenu(manager, this); + auto winColorSchemeMenu = new QAction(this); + winColorSchemeMenu->setMenu(selectionMenu->menu()); + winColorSchemeMenu->menu()->setIcon(QIcon::fromTheme(QStringLiteral("preferences-desktop-color"))); + winColorSchemeMenu->menu()->setTitle(i18n("&Window Color Scheme")); + actionCollection()->addAction(QStringLiteral("window-colorscheme-menu"), winColorSchemeMenu); // Full Screen menuAction = KStandardAction::fullScreen(this, &MainWindow::viewFullScreen, this, collection); @@ -530,7 +527,8 @@ void MainWindow::updateHamburgerMenu() menu->addSeparator(); - auto monitorMenu = menu->addMenu(QIcon::fromTheme(QStringLiteral("visibility")), static_cast(factory()->container(QStringLiteral("view"), nullptr))->title()); + auto monitorMenu = + menu->addMenu(QIcon::fromTheme(QStringLiteral("visibility")), static_cast(factory()->container(QStringLiteral("view"), nullptr))->title()); monitorMenu->addAction(controllerCollection->action(QStringLiteral("monitor-silence"))); monitorMenu->addAction(controllerCollection->action(QStringLiteral("monitor-activity"))); monitorMenu->addAction(controllerCollection->action(QStringLiteral("monitor-process-finish"))); @@ -545,7 +543,8 @@ void MainWindow::updateHamburgerMenu() pluginsMenu->setIcon(QIcon::fromTheme(QStringLiteral("plugins"))); // Icon will be removed again when the menu bar is enabled. menu->addMenu(pluginsMenu); - auto configureMenu = menu->addMenu(QIcon::fromTheme(QStringLiteral("configure")), static_cast(factory()->container(QStringLiteral("settings"), nullptr))->title()); + auto configureMenu = + menu->addMenu(QIcon::fromTheme(QStringLiteral("configure")), static_cast(factory()->container(QStringLiteral("settings"), nullptr))->title()); configureMenu->addAction(toolBarMenuAction()); configureMenu->addSeparator(); #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) @@ -693,8 +692,7 @@ Session *MainWindow::createSession(Profile::Ptr profile, const QString &director auto newView = _viewManager->createView(session); _viewManager->activeContainer()->addView(newView); - _viewManager->activeViewController()->actionCollection()->addActions( - {_hamburgerMenu}); + _viewManager->activeViewController()->actionCollection()->addActions({_hamburgerMenu}); return session; } @@ -785,21 +783,13 @@ bool MainWindow::queryClose() #if HAVE_X11 // make sure the window is shown on current desktop and is not minimized -#if KWINDOWSYSTEM_VERSION >= QT_VERSION_CHECK(5, 101, 0) KX11Extras::setOnDesktop(winId(), KX11Extras::currentDesktop()); -#else - KWindowSystem::setOnDesktop(winId(), KWindowSystem::currentDesktop()); -#endif #endif int result; if (!processesRunning.isEmpty()) { if (openTabs == 1) { -#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0) result = KMessageBox::warningTwoActionsList(this, -#else - result = KMessageBox::warningYesNoList(this, -#endif i18ncp("@info", "There is a process running in this window. " "Do you still want to quit?", @@ -813,18 +803,10 @@ bool MainWindow::queryClose() // don't ask again name is wrong but I can't update. // this is not about tabs anymore. it's about empty tabs *or* splits. QStringLiteral("CloseAllTabs")); -#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0) if (result == KMessageBox::SecondaryAction) // SecondaryAction is equal to cancel closing -#else - if (result == KMessageBox::No) // No is equal to cancel closing -#endif result = KMessageBox::Cancel; } else { -#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0) result = KMessageBox::warningTwoActionsCancelList(this, -#else - result = KMessageBox::warningYesNoCancelList(this, -#endif i18ncp("@info", "There is a process running in this window. " "Do you still want to quit?", @@ -841,11 +823,7 @@ bool MainWindow::queryClose() QStringLiteral("CloseAllTabs")); } } else { -#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0) result = KMessageBox::warningTwoActionsCancel(this, -#else - result = KMessageBox::warningYesNoCancel(this, -#endif i18nc("@info", "There are %1 open terminals in this window. " "Do you still want to quit?", @@ -860,17 +838,9 @@ bool MainWindow::queryClose() } switch (result) { -#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0) case KMessageBox::PrimaryAction: -#else - case KMessageBox::Yes: -#endif return true; -#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0) case KMessageBox::SecondaryAction: -#else - case KMessageBox::No: -#endif if ((!_pluggedController.isNull()) && (!_pluggedController->session().isNull())) { if (!(_pluggedController->session()->closeInNormalWay())) { if (_pluggedController->confirmForceClose()) { @@ -1074,15 +1044,11 @@ void MainWindow::setBlur(bool blur) _blurEnabled = blur; if (!_pluggedController->isKonsolePart()) { -#if KWINDOWSYSTEM_VERSION < QT_VERSION_CHECK(5, 82, 0) - KWindowEffects::enableBlurBehind(winId(), blur); -#else if (QWindow *window = windowHandle()) { KWindowEffects::enableBlurBehind(window, blur); } else { qCWarning(KonsoleDebug) << "Blur effect couldn't be enabled."; } -#endif } } @@ -1107,11 +1073,7 @@ void MainWindow::setRemoveWindowTitleBarAndFrame(bool frameless) const auto oldGeometry = saveGeometry(); // This happens for every Konsole window. It depends on // the fact that every window is processed in single thread -#if KWINDOWSYSTEM_VERSION >= QT_VERSION_CHECK(5, 101, 0) const auto oldActiveWindow = KX11Extras::activeWindow(); -#else - const auto oldActiveWindow = KWindowSystem::activeWindow(); -#endif setWindowFlags(newFlags); @@ -1119,11 +1081,7 @@ void MainWindow::setRemoveWindowTitleBarAndFrame(bool frameless) // with previous geometry restoreGeometry(oldGeometry); setVisible(true); -#if KWINDOWSYSTEM_VERSION >= QT_VERSION_CHECK(5, 101, 0) KX11Extras::activateWindow(oldActiveWindow); -#else - KWindowSystem::activateWindow(oldActiveWindow); -#endif #endif } else { // Restoring geometry ourselves doesn't work on Wayland diff --git a/src/Part.cpp b/src/Part.cpp index 0cf7cea05..1476e741a 100644 --- a/src/Part.cpp +++ b/src/Part.cpp @@ -38,11 +38,7 @@ using namespace Konsole; K_PLUGIN_FACTORY_WITH_JSON(KonsolePartFactory, "konsolepart.json", registerPlugin();) -#if QT_VERSION > QT_VERSION_CHECK(6, 0, 0) Part::Part(QObject *parent, const QVariantList &) -#else -Part::Part(QWidget *parentWidget, QObject *parent, const QVariantList &) -#endif : KParts::ReadOnlyPart(parent) , _viewManager(nullptr) , _pluggedController(nullptr) @@ -55,11 +51,7 @@ Part::Part(QWidget *parentWidget, QObject *parent, const QVariantList &) connect(_viewManager, &Konsole::ViewManager::empty, this, &Konsole::Part::terminalExited); connect(_viewManager, &Konsole::ViewManager::newViewRequest, this, &Konsole::Part::newTab); -#if QT_VERSION > QT_VERSION_CHECK(6, 0, 0) _viewManager->widget()->setParent(widget()); -#else - _viewManager->widget()->setParent(parentWidget); -#endif setWidget(_viewManager->widget()); actionCollection()->addAssociatedWidget(_viewManager->widget()); diff --git a/src/Part.h b/src/Part.h index 413a6c080..42e23408b 100644 --- a/src/Part.h +++ b/src/Part.h @@ -45,11 +45,7 @@ class Part : public KParts::ReadOnlyPart, public TerminalInterface #endif public: /** Constructs a new Konsole part with the specified parent. */ -#if QT_VERSION > QT_VERSION_CHECK(6, 0, 0) explicit Part(QObject *parent, const QVariantList &); -#else - explicit Part(QWidget *parentWidget, QObject *parent, const QVariantList &); -#endif ~Part() override; /** Reimplemented from TerminalInterface. */ diff --git a/src/ProcessInfo.cpp b/src/ProcessInfo.cpp index 0b4be89bb..89593b2a9 100644 --- a/src/ProcessInfo.cpp +++ b/src/ProcessInfo.cpp @@ -27,10 +27,10 @@ // Qt #include #include -#include #include #include #include +#include // KDE #include @@ -624,7 +624,7 @@ private: const QString appUnitName(QStringLiteral("transientKonsole.scope")); // check if systemd dbus services exist - if (!QDBusConnection::sessionBus().interface()->isServiceRegistered("org.freedesktop.systemd1")) { + if (!QDBusConnection::sessionBus().interface()->isServiceRegistered(QStringLiteral("org.freedesktop.systemd1"))) { return false; } @@ -664,7 +664,7 @@ private: return false; } - const QStringList conts(QString(appCGroupContsFile.readAll()).split(' ')); + const QStringList conts(QString::fromUtf8(appCGroupContsFile.readAll()).split(QLatin1Char(' '))); QString contsToEnable; for (auto cont : conts) { @@ -689,18 +689,19 @@ private: return QString(); } - const QString data(cGroupFile.readAll()); + const QString data = QString::fromUtf8(cGroupFile.readAll()); const QString cGroupPath(data.mid(data.lastIndexOf(QLatin1Char(':')) + 1)); - return (QStringLiteral("/sys/fs/cgroup") + cGroupPath).trimmed(); + return QString(QStringLiteral("/sys/fs/cgroup") + cGroupPath).trimmed(); } bool createSystemdUnit(const QString &name, const VariantList &propList) { const QList args({name, QStringLiteral("fail"), QVariant::fromValue(propList), QVariant::fromValue(EmptyArray())}); - return callSmdDBus("/org/freedesktop/systemd1", "Manager", "StartTransientUnit", args).type() != QDBusMessage::ErrorMessage; + return callSmdDBus(QStringLiteral("/org/freedesktop/systemd1"), QStringLiteral("Manager"), QStringLiteral("StartTransientUnit"), args).type() + != QDBusMessage::ErrorMessage; } bool createCGroup(const QString &name, int initialPid) @@ -1097,8 +1098,7 @@ private: bool ok = false; const int fpid = foregroundPid(&ok); if (ok) { - ret = proc_pidinfo(fpid, PROC_PIDT_SHORTBSDINFO, 0, - &bsdinfo, sizeof(bsdinfo)); + ret = proc_pidinfo(fpid, PROC_PIDT_SHORTBSDINFO, 0, &bsdinfo, sizeof(bsdinfo)); if (ret == sizeof(bsdinfo)) { setUserId(bsdinfo.pbsi_uid); } @@ -1124,7 +1124,7 @@ private: // It is not clear on why this fails for some commands if (sysctl(managementInfoBase, 3, nullptr, &size, nullptr, 0) == -1) { - qWarning()<<"OS_MACOS: unable to obtain argument size for "<= QT_VERSION_CHECK(6, 0, 0) // Must call parent class child process modifier, as it sets file descriptors ...etc auto parentChildProcModifier = KPtyProcess::childProcessModifier(); setChildProcessModifier([parentChildProcModifier = std::move(parentChildProcModifier)]() { @@ -55,7 +54,6 @@ Pty::Pty(int masterFd, QObject *aParent) sigaction(signal, &action, nullptr); } }); -#endif _windowColumns = 0; _windowLines = 0; @@ -109,16 +107,7 @@ void Pty::setWindowSize(int columns, int lines, int width, int height) _windowHeight = height; if (pty()->masterFd() >= 0) { -#if KPTY_VERSION >= QT_VERSION_CHECK(5, 93, 0) pty()->setWinSize(_windowLines, _windowColumns, _windowHeight, _windowWidth); -#else - struct winsize w; - w.ws_xpixel = _windowWidth; - w.ws_ypixel = _windowHeight; - w.ws_col = _windowColumns; - w.ws_row = _windowLines; - ioctl(pty()->masterFd(), TIOCSWINSZ, &w); -#endif } } @@ -329,25 +318,6 @@ int Pty::foregroundProcessGroup() const return 0; } -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) -void Pty::setupChildProcess() -{ - KPtyProcess::setupChildProcess(); - - // reset all signal handlers - // this ensures that terminal applications respond to - // signals generated via key sequences such as Ctrl+C - // (which sends SIGINT) - struct sigaction action; - sigemptyset(&action.sa_mask); - action.sa_handler = SIG_DFL; - action.sa_flags = 0; - for (int signal = 1; signal < NSIG; signal++) { - sigaction(signal, &action, nullptr); - } -} -#endif // QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - #else // Windows backend #include "ptyqt/conptyprocess.h" diff --git a/src/Pty.h b/src/Pty.h index bb0a17e01..fafda01c5 100644 --- a/src/Pty.h +++ b/src/Pty.h @@ -40,10 +40,8 @@ namespace Konsole * with the program name and appropriate arguments. */ #ifdef Q_OS_WIN -#define _k_override_ #define ParentClass QObject #else -#define _k_override_ override #define ParentClass KPtyProcess #endif @@ -221,15 +219,6 @@ Q_SIGNALS: */ void receivedData(const char *buffer, int length); -protected: - // TODO: remove this; the method is removed from QProcess in Qt6 - // instead use setChildProcessModifier() in the constructor -#ifndef Q_OS_WIN -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - void setupChildProcess() _k_override_; -#endif // QT_VERSION < QT_VERSION_CHECK(6, 0, 0) -#endif // Q_OS_WIN - private Q_SLOTS: // called when data is received from the terminal process void dataReceived(); diff --git a/src/Vt102Emulation.cpp b/src/Vt102Emulation.cpp index bebd5e399..d2a37fba5 100644 --- a/src/Vt102Emulation.cpp +++ b/src/Vt102Emulation.cpp @@ -600,7 +600,7 @@ void Vt102Emulation::osc_end(const uint cc) // do not. if (tokenBuffer[0] == XTERM_EXTENDED::URL_LINK) { // printf '\e]8;;https://example.com\e\\This is a link\e]8;;\e\\\n' - emit toggleUrlExtractionRequest(); + Q_EMIT toggleUrlExtractionRequest(); } processSessionAttributeRequest(tokenBufferPos, cc); @@ -881,7 +881,7 @@ void Vt102Emulation::receiveChars(const QVector &chars) case DcsPassthrough: if (cc <= 0x7E || cc >= 0xA0) { // 0x18, 0x1A, 0x1B already taken care of put(cc); - // 0x9C already taken care of. + // 0x9C already taken care of. } else if (cc == 0x7F) { // ignore } @@ -1039,9 +1039,9 @@ void Vt102Emulation::processSessionAttributeRequest(const int tokenSize, const u if (tokenBuffer[i] != ';') { // No arguments - switch(attribute) { + switch (attribute) { case 104: // 104 without any argument means clear entire color table - for (int i=0; i<256; i++) { + for (int i = 0; i < 256; i++) { colorTable[i] = QColor(); } break; @@ -1180,12 +1180,8 @@ void Vt102Emulation::processSessionAttributeRequest(const int tokenSize, const u const QLatin1String customCursorColorStr("CustomCursorColor="); QString newValue; - #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) const auto items = QStringView(value).split(QLatin1Char(';')); - #else - const auto items = value.splitRef(QLatin1Char(';')); - #endif - for (const auto &item: items) { + for (const auto &item : items) { if (item.startsWith(cursorShapeStr)) { const int s = item.at(cursorShapeStr.size()).digitValue(); shape = static_cast(s != -1 ? s : 0); @@ -1296,14 +1292,8 @@ void Vt102Emulation::processSessionAttributeRequest(const int tokenSize, const u QBuffer *buffer = new QBuffer(player); buffer->setData(tokenData); buffer->open(QIODevice::ReadOnly); -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - delete (QIODevice *)(player->mediaStream()); - player->setMedia(QMediaContent(), buffer); - -#else delete (QIODevice *)(player->sourceDevice()); player->setSourceDevice(buffer); -#endif player->play(); return; } @@ -1335,11 +1325,7 @@ void Vt102Emulation::processSessionAttributeRequest(const int tokenSize, const u void Vt102Emulation::deletePlayer(QMediaPlayer::MediaStatus mediaStatus) { if (mediaStatus == QMediaPlayer::EndOfMedia || mediaStatus == QMediaPlayer::InvalidMedia) { -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - QIODevice *buffer = (QIODevice *)(player->mediaStream()); -#else QIODevice *buffer = (QIODevice *)(player->sourceDevice()); -#endif buffer->deleteLater(); player->deleteLater(); player = nullptr; diff --git a/src/WindowSystemInfo.cpp b/src/WindowSystemInfo.cpp index 24c8f8630..6fdcad0b9 100644 --- a/src/WindowSystemInfo.cpp +++ b/src/WindowSystemInfo.cpp @@ -9,17 +9,11 @@ #include "config-konsole.h" -#include - #include -#include - #if HAVE_X11 -#if KWINDOWSYSTEM_VERSION >= QT_VERSION_CHECK(5, 101, 0) #include #endif -#endif using Konsole::WindowSystemInfo; @@ -27,13 +21,9 @@ bool WindowSystemInfo::HAVE_TRANSPARENCY = false; bool WindowSystemInfo::compositingActive() { -#if KWINDOWSYSTEM_VERSION >= QT_VERSION_CHECK(5, 101, 0) #if HAVE_X11 return KX11Extras::compositingActive(); #else return true; #endif -#else - return KWindowSystem::compositingActive(); -#endif } diff --git a/src/autotests/CMakeLists.txt b/src/autotests/CMakeLists.txt index 0e8f1c6f4..423691831 100644 --- a/src/autotests/CMakeLists.txt +++ b/src/autotests/CMakeLists.txt @@ -30,7 +30,7 @@ endif(BUILD_SHARED_LIBS) if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") ecm_add_test( PartTest.cpp - LINK_LIBRARIES KF${QT_MAJOR_VERSION}::XmlGui KF${QT_MAJOR_VERSION}::Parts KF${QT_MAJOR_VERSION}::Pty ${KONSOLE_TEST_LIBS} + LINK_LIBRARIES KF6::XmlGui KF6::Parts KF6::Pty ${KONSOLE_TEST_LIBS} ) endif() @@ -49,12 +49,12 @@ ecm_add_tests( Vt102EmulationTest.cpp LINK_LIBRARIES ${KONSOLE_TEST_LIBS} ) -target_link_libraries(PtyTest KF${QT_MAJOR_VERSION}::Pty ${KONSOLE_TEST_LIBS}) +target_link_libraries(PtyTest KF6::Pty ${KONSOLE_TEST_LIBS}) ecm_add_tests( HistoryTest.cpp SessionTest.cpp TerminalInterfaceTest.cpp TerminalTest.cpp - LINK_LIBRARIES ${KONSOLE_TEST_LIBS} KF${QT_MAJOR_VERSION}::Parts + LINK_LIBRARIES ${KONSOLE_TEST_LIBS} KF6::Parts ) diff --git a/src/autotests/PartTest.cpp b/src/autotests/PartTest.cpp index b32717d60..b23ef8ae7 100644 --- a/src/autotests/PartTest.cpp +++ b/src/autotests/PartTest.cpp @@ -19,11 +19,6 @@ #include #include -#include -#if KCOREADDONS_VERSION < QT_VERSION_CHECK(5, 86, 0) -#include -#endif - // Konsole #include "../Pty.h" @@ -50,10 +45,8 @@ void PartTest::initTestCase() void PartTest::testFdShell() { // Maybe https://bugreports.qt.io/browse/QTBUG-82351 ??? -#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0) QSKIP("Skipping on CI suse_tumbelweed_qt64", SkipSingle); return; -#endif testFd(true); } @@ -132,7 +125,6 @@ void PartTest::testFd(bool runShell) KParts::Part *PartTest::createPart() { -#if KCOREADDONS_VERSION >= QT_VERSION_CHECK(5, 86, 0) const KPluginMetaData metaData(QStringLiteral("konsolepart")); Q_ASSERT(metaData.isValid()); @@ -140,21 +132,6 @@ KParts::Part *PartTest::createPart() Q_ASSERT(result); return result.plugin; -#else - auto konsolePartPlugin = KPluginLoader::findPlugin(QStringLiteral("konsolepart")); - if (konsolePartPlugin.isNull()) { - return nullptr; - } - - KPluginFactory *factory = KPluginLoader(konsolePartPlugin).factory(); - if (factory == nullptr) { // not found - return nullptr; - } - - auto *terminalPart = factory->create(this); - - return terminalPart; -#endif } QTEST_MAIN(PartTest) diff --git a/src/autotests/PtyTest.cpp b/src/autotests/PtyTest.cpp index 7d4158e4a..40febbbf1 100644 --- a/src/autotests/PtyTest.cpp +++ b/src/autotests/PtyTest.cpp @@ -13,7 +13,6 @@ // KDE #include -#include using namespace Konsole; @@ -55,10 +54,8 @@ void PtyTest::testUseUtmp() void PtyTest::testWindowSize() { // Maybe https://bugreports.qt.io/browse/QTBUG-82351 ??? -#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0) QSKIP("Skipping on CI suse_tumbelweed_qt64", SkipSingle); return; -#endif Pty pty; QSize input(80, 40); @@ -73,10 +70,8 @@ void PtyTest::testWindowSize() void PtyTest::testRunProgram() { // Maybe https://bugreports.qt.io/browse/QTBUG-82351 ??? -#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0) QSKIP("Skipping on CI suse_tumbelweed_qt64", SkipSingle); return; -#endif Pty pty; QString program = QStringLiteral("sh"); diff --git a/src/autotests/TerminalInterfaceTest.cpp b/src/autotests/TerminalInterfaceTest.cpp index ecb254a27..17e023433 100644 --- a/src/autotests/TerminalInterfaceTest.cpp +++ b/src/autotests/TerminalInterfaceTest.cpp @@ -17,9 +17,6 @@ // KDE #include #include -#if KCOREADDONS_VERSION < QT_VERSION_CHECK(5, 86, 0) -#include -#endif // Others #if defined(Q_OS_LINUX) @@ -98,10 +95,8 @@ void TerminalInterfaceTest::testTerminalInterfaceNoShell() void TerminalInterfaceTest::testTerminalInterface() { // Maybe https://bugreports.qt.io/browse/QTBUG-82351 ??? -#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0) QSKIP("Skipping on CI suse_tumbelweed_qt64", SkipSingle); return; -#endif QString currentDirectory; @@ -281,7 +276,6 @@ void TerminalInterfaceTest::testTerminalInterfaceV2() KParts::Part *TerminalInterfaceTest::createPart() { -#if KCOREADDONS_VERSION >= QT_VERSION_CHECK(5, 86, 0) const KPluginMetaData metaData(QStringLiteral("konsolepart")); Q_ASSERT(metaData.isValid()); @@ -289,21 +283,6 @@ KParts::Part *TerminalInterfaceTest::createPart() Q_ASSERT(result); return result.plugin; -#else - auto konsolePartPlugin = KPluginLoader::findPlugin(QStringLiteral("konsolepart")); - if (konsolePartPlugin.isNull()) { - return nullptr; - } - - KPluginFactory *factory = KPluginLoader(konsolePartPlugin).factory(); - if (factory == nullptr) { // not found - return nullptr; - } - - auto *terminalPart = factory->create(this); - - return terminalPart; -#endif } QTEST_MAIN(TerminalInterfaceTest) diff --git a/src/colorscheme/ColorScheme.cpp b/src/colorscheme/ColorScheme.cpp index fdab18388..b4e315aaf 100644 --- a/src/colorscheme/ColorScheme.cpp +++ b/src/colorscheme/ColorScheme.cpp @@ -30,10 +30,6 @@ #include #endif -#if KI18N_VERSION >= QT_VERSION_CHECK(5, 89, 0) -#undef I18N_NOOP2 -#define I18N_NOOP2 kli18nc -#endif namespace { const int FGCOLOR_INDEX = 0; @@ -123,41 +119,37 @@ const char *const ColorScheme::colorNames[TABLE_COLORS] = { "Color7Faint", }; -#if KI18N_VERSION >= QT_VERSION_CHECK(5, 89, 0) const KLazyLocalizedString ColorScheme::translatedColorNames[TABLE_COLORS] = { -#else -const char *const ColorScheme::translatedColorNames[TABLE_COLORS] = { -#endif - I18N_NOOP2("@item:intable palette", "Foreground"), - I18N_NOOP2("@item:intable palette", "Background"), - I18N_NOOP2("@item:intable palette", "Color 1"), - I18N_NOOP2("@item:intable palette", "Color 2"), - I18N_NOOP2("@item:intable palette", "Color 3"), - I18N_NOOP2("@item:intable palette", "Color 4"), - I18N_NOOP2("@item:intable palette", "Color 5"), - I18N_NOOP2("@item:intable palette", "Color 6"), - I18N_NOOP2("@item:intable palette", "Color 7"), - I18N_NOOP2("@item:intable palette", "Color 8"), - I18N_NOOP2("@item:intable palette", "Foreground (Intense)"), - I18N_NOOP2("@item:intable palette", "Background (Intense)"), - I18N_NOOP2("@item:intable palette", "Color 1 (Intense)"), - I18N_NOOP2("@item:intable palette", "Color 2 (Intense)"), - I18N_NOOP2("@item:intable palette", "Color 3 (Intense)"), - I18N_NOOP2("@item:intable palette", "Color 4 (Intense)"), - I18N_NOOP2("@item:intable palette", "Color 5 (Intense)"), - I18N_NOOP2("@item:intable palette", "Color 6 (Intense)"), - I18N_NOOP2("@item:intable palette", "Color 7 (Intense)"), - I18N_NOOP2("@item:intable palette", "Color 8 (Intense)"), - I18N_NOOP2("@item:intable palette", "Foreground (Faint)"), - I18N_NOOP2("@item:intable palette", "Background (Faint)"), - I18N_NOOP2("@item:intable palette", "Color 1 (Faint)"), - I18N_NOOP2("@item:intable palette", "Color 2 (Faint)"), - I18N_NOOP2("@item:intable palette", "Color 3 (Faint)"), - I18N_NOOP2("@item:intable palette", "Color 4 (Faint)"), - I18N_NOOP2("@item:intable palette", "Color 5 (Faint)"), - I18N_NOOP2("@item:intable palette", "Color 6 (Faint)"), - I18N_NOOP2("@item:intable palette", "Color 7 (Faint)"), - I18N_NOOP2("@item:intable palette", "Color 8 (Faint)"), + kli18nc("@item:intable palette", "Foreground"), + kli18nc("@item:intable palette", "Background"), + kli18nc("@item:intable palette", "Color 1"), + kli18nc("@item:intable palette", "Color 2"), + kli18nc("@item:intable palette", "Color 3"), + kli18nc("@item:intable palette", "Color 4"), + kli18nc("@item:intable palette", "Color 5"), + kli18nc("@item:intable palette", "Color 6"), + kli18nc("@item:intable palette", "Color 7"), + kli18nc("@item:intable palette", "Color 8"), + kli18nc("@item:intable palette", "Foreground (Intense)"), + kli18nc("@item:intable palette", "Background (Intense)"), + kli18nc("@item:intable palette", "Color 1 (Intense)"), + kli18nc("@item:intable palette", "Color 2 (Intense)"), + kli18nc("@item:intable palette", "Color 3 (Intense)"), + kli18nc("@item:intable palette", "Color 4 (Intense)"), + kli18nc("@item:intable palette", "Color 5 (Intense)"), + kli18nc("@item:intable palette", "Color 6 (Intense)"), + kli18nc("@item:intable palette", "Color 7 (Intense)"), + kli18nc("@item:intable palette", "Color 8 (Intense)"), + kli18nc("@item:intable palette", "Foreground (Faint)"), + kli18nc("@item:intable palette", "Background (Faint)"), + kli18nc("@item:intable palette", "Color 1 (Faint)"), + kli18nc("@item:intable palette", "Color 2 (Faint)"), + kli18nc("@item:intable palette", "Color 3 (Faint)"), + kli18nc("@item:intable palette", "Color 4 (Faint)"), + kli18nc("@item:intable palette", "Color 5 (Faint)"), + kli18nc("@item:intable palette", "Color 6 (Faint)"), + kli18nc("@item:intable palette", "Color 7 (Faint)"), + kli18nc("@item:intable palette", "Color 8 (Faint)"), }; QString ColorScheme::colorNameForIndex(int index) @@ -170,11 +162,7 @@ QString ColorScheme::colorNameForIndex(int index) QString ColorScheme::translatedColorNameForIndex(int index) { Q_ASSERT(index >= 0 && index < TABLE_COLORS); -#if KI18N_VERSION >= QT_VERSION_CHECK(5, 89, 0) return translatedColorNames[index].toString(); -#else - return i18nc("@item:intable palette", translatedColorNames[index]); -#endif } ColorScheme::ColorScheme() diff --git a/src/colorscheme/ColorScheme.h b/src/colorscheme/ColorScheme.h index 6c17f4c45..908352024 100644 --- a/src/colorscheme/ColorScheme.h +++ b/src/colorscheme/ColorScheme.h @@ -19,10 +19,7 @@ // Konsole #include "ColorSchemeWallpaper.h" -#include -#if KI18N_VERSION >= QT_VERSION_CHECK(5, 89, 0) #include -#endif class KConfig; class QPixmap; @@ -196,11 +193,7 @@ private: ColorSchemeWallpaper::Ptr _wallpaper; static const char *const colorNames[TABLE_COLORS]; -#if KI18N_VERSION >= QT_VERSION_CHECK(5, 89, 0) static const KLazyLocalizedString translatedColorNames[TABLE_COLORS]; -#else - static const char *const translatedColorNames[TABLE_COLORS]; -#endif }; } diff --git a/src/filterHotSpots/EscapeSequenceUrlFilterHotSpot.cpp b/src/filterHotSpots/EscapeSequenceUrlFilterHotSpot.cpp index 0e8032c4a..41414930f 100644 --- a/src/filterHotSpots/EscapeSequenceUrlFilterHotSpot.cpp +++ b/src/filterHotSpots/EscapeSequenceUrlFilterHotSpot.cpp @@ -7,12 +7,7 @@ #include "EscapeSequenceUrlFilterHotSpot.h" -#include -#if KIO_VERSION >= QT_VERSION_CHECK(5, 98, 0) #include -#else -#include -#endif #include #include @@ -36,10 +31,6 @@ void EscapeSequenceUrlHotSpot::activate(QObject *obj) Q_UNUSED(obj) auto *job = new KIO::OpenUrlJob(QUrl(_url)); -#if KIO_VERSION >= QT_VERSION_CHECK(5, 98, 0) job->setUiDelegate(KIO::createDefaultJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, QApplication::activeWindow())); -#else - job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, QApplication::activeWindow())); -#endif job->start(); } diff --git a/src/filterHotSpots/FileFilterHotspot.cpp b/src/filterHotSpots/FileFilterHotspot.cpp index 4da964a03..988a2ed6d 100644 --- a/src/filterHotSpots/FileFilterHotspot.cpp +++ b/src/filterHotSpots/FileFilterHotspot.cpp @@ -25,12 +25,7 @@ #include #include -#include -#if KIO_VERSION >= QT_VERSION_CHECK(5, 98, 0) #include -#else -#include -#endif #include #include #include @@ -132,11 +127,7 @@ void FileFilterHotSpot::activate(QObject *) void FileFilterHotSpot::openWithSysDefaultApp(const QString &filePath) const { auto *job = new KIO::OpenUrlJob(QUrl::fromLocalFile(filePath)); -#if KIO_VERSION >= QT_VERSION_CHECK(5, 98, 0) job->setUiDelegate(KIO::createDefaultJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, QApplication::activeWindow())); -#else - job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, QApplication::activeWindow())); -#endif job->setRunExecutables(false); // Always open scripts, shell/python/perl... etc, as text job->start(); } @@ -199,26 +190,9 @@ QList FileFilterHotSpot::setupMenu(QMenu *menu) const KFileItemListProperties itemProperties(itemList); _menuActions->setParent(this); _menuActions->setItemListProperties(itemProperties); -#if KIO_VERSION < QT_VERSION_CHECK(5, 82, 0) - _menuActions->addOpenWithActionsTo(menu); - // Here we added the actions to the last part of the menu, but we need to move them up. - // TODO: As soon as addOpenWithActionsTo accepts a index, change this. - // https://bugs.kde.org/show_bug.cgi?id=423765 - QAction *firstAction = menu->actions().at(0); - for (auto *action : menu->actions()) { - if (action->text().toLower().remove(QLatin1Char('&')).contains(i18n("open with"))) { - menu->removeAction(action); - menu->insertAction(firstAction, action); - } - } - auto *separator = new QAction(this); - separator->setSeparator(true); - menu->insertAction(firstAction, separator); -#else const QList actionList = menu->actions(); _menuActions->insertOpenWithActionsTo(!actionList.isEmpty() ? actionList.at(0) : nullptr, menu, QStringList()); -#endif QList addedActions = menu->actions(); // addedActions will only contain the open-with actions diff --git a/src/keyboardtranslator/KeyboardTranslatorReader.cpp b/src/keyboardtranslator/KeyboardTranslatorReader.cpp index 16a6669c7..9a0bf129d 100644 --- a/src/keyboardtranslator/KeyboardTranslatorReader.cpp +++ b/src/keyboardtranslator/KeyboardTranslatorReader.cpp @@ -245,12 +245,7 @@ bool KeyboardTranslatorReader::parseAsKeyCode(const QString &item, int &keyCode) { const QKeySequence sequence = QKeySequence::fromString(item); if (!sequence.isEmpty()) { -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) keyCode = sequence[0].toCombined(); -#else - keyCode = sequence[0]; -#endif - if (sequence.count() > 1) { qCDebug(KonsoleKeyTrDebug) << "Unhandled key codes in sequence: " << item; } diff --git a/src/main.cpp b/src/main.cpp index 044bffcfa..db5676c13 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -28,10 +28,6 @@ #include #include #include -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) -#include -#include -#endif #include #include @@ -108,12 +104,10 @@ static void migrateRenamedConfigKeys() // With 5.93 KColorSchemeManager from KConfigWidgets, handles the loading // and saving of the widget color scheme, and uses "ColorScheme" as the // entry name, so clean-up here -#if KCONFIGWIDGETS_VERSION >= QT_VERSION_CHECK(5, 93, 0) KConfigGroup cg(konsoleConfig, "UiSettings"); const QString schemeName = cg.readEntry("WindowColorScheme"); cg.deleteEntry("WindowColorScheme"); cg.writeEntry("ColorScheme", schemeName); -#endif verGroup.writeEntry("ConfigVersion", CurrentConfigVersion); konsoleConfig->sync(); @@ -129,11 +123,6 @@ int main(int argc, char *argv[]) QElapsedTimer timer; timer.start(); #endif -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - // enable high dpi support - QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps, true); - QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling, true); -#endif /** * enable dark mode for title bar on Windows @@ -210,34 +199,7 @@ int main(int argc, char *argv[]) KDBusService dbusService(startupOption | KDBusService::NoExitOnFailure); needToDeleteQApplication = false; -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - Kdelibs4ConfigMigrator migrate(QStringLiteral("konsole")); - migrate.setConfigFiles({QStringLiteral("konsolerc"), QStringLiteral("konsole.notifyrc")}); - migrate.setUiFiles({QStringLiteral("sessionui.rc"), QStringLiteral("partui.rc"), QStringLiteral("konsoleui.rc")}); - if (migrate.migrate()) { - Kdelibs4Migration dataMigrator; - const QString sourceBasePath = dataMigrator.saveLocation("data", QStringLiteral("konsole")); - const QString targetBasePath = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QStringLiteral("/konsole/"); - QString targetFilePath; - - QDir sourceDir(sourceBasePath); - QDir targetDir(targetBasePath); - - if (sourceDir.exists()) { - if (!targetDir.exists()) { - QDir().mkpath(targetBasePath); - } - const QStringList fileNames = sourceDir.entryList(QDir::Files | QDir::NoDotAndDotDot | QDir::NoSymLinks); - for (const QString &fileName : fileNames) { - targetFilePath = targetBasePath + fileName; - if (!QFile::exists(targetFilePath)) { - QFile::copy(sourceBasePath + fileName, targetFilePath); - } - } - } - } -#endif // If we reach this location, there was no existing copy of Konsole // running, so create a new instance. Application konsoleApp(parser, customCommand); diff --git a/src/plugins/QuickCommands/quickcommandswidget.cpp b/src/plugins/QuickCommands/quickcommandswidget.cpp index 9b2c97ad7..4614bf140 100644 --- a/src/plugins/QuickCommands/quickcommandswidget.cpp +++ b/src/plugins/QuickCommands/quickcommandswidget.cpp @@ -146,7 +146,6 @@ void QuickCommandsWidget::indexSelected(const QModelIndex &idx) runShellCheck(); } - } void QuickCommandsWidget::editMode() @@ -205,21 +204,13 @@ void QuickCommandsWidget::invokeCommand(const QModelIndex &idx) void QuickCommandsWidget::runCommand() { if (!ui->warning->toPlainText().isEmpty()) { -#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0) auto choice = KMessageBox::questionTwoActions(this, -#else - auto choice = KMessageBox::questionYesNo(this, -#endif i18n("There are some errors on the script, do you really want to run it?"), i18n("Shell Errors"), KGuiItem(i18nc("@action:button", "Run"), QStringLiteral("system-run")), KStandardGuiItem::cancel(), QStringLiteral("quick-commands-question")); -#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0) if (choice == KMessageBox::SecondaryAction) { -#else - if (choice == KMessageBox::No) { -#endif return; } } @@ -245,20 +236,8 @@ void QuickCommandsWidget::triggerDelete() : i18n("You are about to delete %1, are you sure?", text); int result = -#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0) - KMessageBox::warningTwoActions(this, -#else - KMessageBox::warningYesNo(this, -#endif - dialogMessage, - i18n("Delete Quick Commands Configurations"), - KStandardGuiItem::del(), - KStandardGuiItem::cancel()); -#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0) + KMessageBox::warningTwoActions(this, dialogMessage, i18n("Delete Quick Commands Configurations"), KStandardGuiItem::del(), KStandardGuiItem::cancel()); if (result != KMessageBox::PrimaryAction) -#else - if (result != KMessageBox::Yes) -#endif return; const auto sourceIdx = priv->filterModel->mapToSource(idx); diff --git a/src/plugins/SSHManager/sshmanagerpluginwidget.cpp b/src/plugins/SSHManager/sshmanagerpluginwidget.cpp index af3705998..e7c6547c6 100644 --- a/src/plugins/SSHManager/sshmanagerpluginwidget.cpp +++ b/src/plugins/SSHManager/sshmanagerpluginwidget.cpp @@ -234,22 +234,14 @@ void SSHManagerTreeWidget::triggerDelete() const QString dontAskAgainKey = ui->treeView->model()->rowCount(selection.at(0)) ? QStringLiteral("remove_ssh_folder") : QStringLiteral("remove_ssh_config"); -#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0) int result = KMessageBox::warningTwoActions(this, -#else - int result = KMessageBox::warningYesNo(this, -#endif dialogMessage, i18nc("@title:window", "Delete SSH Configurations"), KStandardGuiItem::del(), KStandardGuiItem::cancel(), dontAskAgainKey); -#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0) if (result == KMessageBox::ButtonCode::SecondaryAction) { -#else - if (result == KMessageBox::ButtonCode::No) { -#endif return; } diff --git a/src/pluginsystem/PluginManager.cpp b/src/pluginsystem/PluginManager.cpp index fbd9fdb38..84daeb32b 100644 --- a/src/pluginsystem/PluginManager.cpp +++ b/src/pluginsystem/PluginManager.cpp @@ -11,15 +11,10 @@ #include "MainWindow.h" #include "konsoledebug.h" -#include "kcoreaddons_version.h" #include #include #include -#if KCOREADDONS_VERSION < QT_VERSION_CHECK(5, 86, 0) -#include -#endif - #include namespace Konsole @@ -40,23 +35,6 @@ PluginManager::~PluginManager() void PluginManager::loadAllPlugins() { -#if KCOREADDONS_VERSION < QT_VERSION_CHECK(5, 86, 0) - QVector pluginMetaData = KPluginLoader::findPlugins(QStringLiteral("konsoleplugins")); - for (const auto &metaData : pluginMetaData) { - KPluginLoader pluginLoader(metaData.fileName()); - KPluginFactory *factory = pluginLoader.factory(); - if (!factory) { - continue; - } - - auto *plugin = factory->create(); - if (!plugin) { - continue; - } - - d->plugins.push_back(plugin); - } -#else QVector pluginMetaData = KPluginMetaData::findPlugins(QStringLiteral("konsoleplugins"), [](const KPluginMetaData &data) { // Compare RELEASE_SERVICE_VERSION MAJOR and MINOR only: XX.YY auto plugin_version = QString(data.version()).left(5); @@ -77,7 +55,6 @@ void PluginManager::loadAllPlugins() d->plugins.push_back(result.plugin); } -#endif } void PluginManager::registerMainWindow(Konsole::MainWindow *window) diff --git a/src/profile/Profile.cpp b/src/profile/Profile.cpp index 2acfb3953..0b1e9dd73 100644 --- a/src/profile/Profile.cpp +++ b/src/profile/Profile.cpp @@ -18,7 +18,6 @@ // KDE #include #include -#include // Konsole #include "Enumeration.h" @@ -33,9 +32,7 @@ #endif // HAVE_GETPWUID #endif // Q_OS_WIN -#if KCOREADDONS_VERSION >= QT_VERSION_CHECK(5, 97, 0) #include -#endif using namespace Konsole; @@ -215,7 +212,6 @@ static QString GetWindowsShell() static QString defaultShell() { #ifndef Q_OS_WIN -#if KCOREADDONS_VERSION >= QT_VERSION_CHECK(5, 97, 0) if (!KSandbox::isFlatpak()) { return QString::fromUtf8(qgetenv("SHELL")); } @@ -235,10 +231,7 @@ static QString defaultShell() } } return {}; -#endif -#else - return QString::fromUtf8(qgetenv("SHELL")); -#endif +#endif // HAVE_GETPWUID #else // Q_OS_WIN auto shell = GetWindowPowerShell(); diff --git a/src/profile/Profile.h b/src/profile/Profile.h index 0f835227a..6f7568148 100644 --- a/src/profile/Profile.h +++ b/src/profile/Profile.h @@ -961,8 +961,4 @@ inline T Profile::property(Property p) const } } -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) -Q_DECLARE_METATYPE(Konsole::Profile::Ptr) -#endif - #endif // PROFILE_H diff --git a/src/session/Session.cpp b/src/session/Session.cpp index 6152da1cc..cd0b13e91 100644 --- a/src/session/Session.cpp +++ b/src/session/Session.cpp @@ -68,9 +68,7 @@ #include #endif -#if KCOREADDONS_VERSION >= QT_VERSION_CHECK(5, 97, 0) #include -#endif #endif // Q_OS_WIN using namespace Konsole; @@ -381,7 +379,6 @@ QString Session::checkProgram(const QString &program) } #ifndef Q_OS_WIN -#if KCOREADDONS_VERSION >= QT_VERSION_CHECK(5, 97, 0) if (KSandbox::isFlatpak()) { QProcess proc; // run "test -x exec" on the host to see if the shell is executable @@ -393,7 +390,6 @@ QString Session::checkProgram(const QString &program) } return {}; } -#endif #endif // Q_OS_WIN QFileInfo info(exec); @@ -439,11 +435,9 @@ QString Session::shellSessionId() const static QStringList postProcessArgs(const QStringList &args) { #ifndef Q_OS_WIN -#if KCOREADDONS_VERSION >= QT_VERSION_CHECK(5, 97, 0) if (!KSandbox::isFlatpak()) { return args; } -#endif QStringList arguments; // last arg is the program arguments = args; @@ -486,7 +480,6 @@ void Session::run() auto pw = getpwuid(getuid()); // pw: Do not pass the returned pointer to free. if (pw != nullptr) { -#if KCOREADDONS_VERSION >= QT_VERSION_CHECK(5, 97, 0) if (KSandbox::isFlatpak()) { QProcess proc; proc.setProgram(QStringLiteral("getent")); @@ -498,9 +491,6 @@ void Session::run() } else { programs.insert(1, QString::fromLocal8Bit(pw->pw_shell)); } -#else - programs.insert(1, QString::fromLocal8Bit(pw->pw_shell)); -#endif } #endif @@ -546,11 +536,9 @@ void Session::run() #endif #ifndef Q_OS_WIN -#if KCOREADDONS_VERSION >= QT_VERSION_CHECK(5, 97, 0) if (KSandbox::isFlatpak()) { _shellProcess->pty()->setCTtyEnabled(false); // not possibly inside sandbox } -#endif #endif // this is not strictly accurate use of the COLORFGBG variable. This does not @@ -571,7 +559,6 @@ void Session::run() addEnvironmentEntry(QStringLiteral("KONSOLE_DBUS_SESSION=%1").arg(dbusObject)); #ifndef Q_OS_WIN -#if KCOREADDONS_VERSION >= QT_VERSION_CHECK(5, 97, 0) const auto originalEnvironment = _shellProcess->environment(); _shellProcess->setProgram(exec); _shellProcess->setArguments(arguments); @@ -580,10 +567,6 @@ void Session::run() arguments = postProcessArgs(context.arguments); _shellProcess->setEnvironment(originalEnvironment); const auto result = _shellProcess->start(context.program, arguments, _environment); -#else - int result = _shellProcess->start(exec, arguments, _environment); -#endif - #else // Q_OS_WIN const auto size = _emulation->imageSize(); const int lines = size.height(); diff --git a/src/session/SessionController.cpp b/src/session/SessionController.cpp index 0cb76dafa..0faa0854b 100644 --- a/src/session/SessionController.cpp +++ b/src/session/SessionController.cpp @@ -44,21 +44,12 @@ #include -#include -#if KIO_VERSION >= QT_VERSION_CHECK(5, 98, 0) #include -#else -#include -#endif #include #include #include -#include -#include -#include - // Konsole #include "CopyInputDialog.h" #include "Emulation.h" @@ -565,22 +556,14 @@ void SessionController::handleWebShortcutAction(QAction *action) const QUrl url = filterData.uri(); auto *job = new KIO::OpenUrlJob(url); -#if KIO_VERSION >= QT_VERSION_CHECK(5, 98, 0) job->setUiDelegate(KIO::createDefaultJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, QApplication::activeWindow())); -#else - job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, QApplication::activeWindow())); -#endif job->start(); } } void SessionController::configureWebShortcuts() { -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - auto job = new KIO::CommandLauncherJob(QStringLiteral("kcmshell5"), {QStringLiteral("webshortcuts")}); -#else auto job = new KIO::CommandLauncherJob(QStringLiteral("kcmshell6"), {QStringLiteral("webshortcuts")}); -#endif job->start(); } @@ -776,11 +759,7 @@ void SessionController::setupCommonActions() _switchProfileMenu = new KActionMenu(QIcon::fromTheme(QStringLiteral("exchange-positions")), i18n("Switch Profile"), this); collection->addAction(QStringLiteral("switch-profile"), _switchProfileMenu); connect(_switchProfileMenu->menu(), &QMenu::aboutToShow, this, &Konsole::SessionController::prepareSwitchProfileMenu); -#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 77, 0) _switchProfileMenu->setPopupMode(QToolButton::MenuButtonPopup); -#else - _switchProfileMenu->setDelayed(false); -#endif // History _findAction = KStandardAction::find(this, &SessionController::searchBarEvent, collection); @@ -807,26 +786,10 @@ void SessionController::setupCommonActions() collection->addAction(QStringLiteral("set-encoding"), _codecAction); _codecAction->setCurrentCodec(QString::fromUtf8(session()->codec())); connect(session(), &Konsole::Session::sessionCodecChanged, this, &Konsole::SessionController::updateCodecAction); -#if KCONFIGWIDGETS_VERSION < QT_VERSION_CHECK(5, 103, 0) - connect(_codecAction, -#if KCONFIGWIDGETS_VERSION >= QT_VERSION_CHECK(5, 78, 0) - QOverload::of(&KCodecAction::codecTriggered), - this, -#else - QOverload::of(&KCodecAction::triggered), - this, -#endif - &Konsole::SessionController::changeCodec); -#else -#if QT_VERSION > QT_VERSION_CHECK(6, 0, 0) + connect(_codecAction, &KCodecAction::codecNameTriggered, this, [this](const QByteArray &codecName) { changeCodec(QTextCodec::codecForName(codecName)); -#else - connect(_codecAction, &KCodecAction::codecNameTriggered, this, [this](const QString &codecName) { - changeCodec(QTextCodec::codecForName(codecName.toUtf8())); -#endif }); -#endif connect(_codecAction, &KCodecAction::defaultItemTriggered, this, [this] { Profile::Ptr profile = SessionManager::instance()->sessionProfile(session()); @@ -890,11 +853,7 @@ void SessionController::setupExtraActions() copyInputActions->addAction(copyInputToAllTabsAction); copyInputActions->addAction(copyInputToSelectedTabsAction); copyInputActions->addAction(copyInputToNoneAction); -#if QT_VERSION > QT_VERSION_CHECK(6, 0, 0) connect(copyInputActions, &KSelectAction::actionTriggered, this, &Konsole::SessionController::copyInputActionsTriggered); -#else - connect(copyInputActions, QOverload::of(&KSelectAction::triggered), this, &Konsole::SessionController::copyInputActionsTriggered); -#endif action = collection->addAction(QStringLiteral("zmodem-upload"), this, &SessionController::zmodemUpload); action->setText(i18n("&ZModem Upload...")); @@ -953,11 +912,7 @@ void SessionController::setupExtraActions() // Send signal auto *sendSignalActions = collection->add(QStringLiteral("send-signal")); sendSignalActions->setText(i18n("Send Signal")); -#if QT_VERSION > QT_VERSION_CHECK(6, 0, 0) connect(sendSignalActions, &KSelectAction::actionTriggered, this, &Konsole::SessionController::sendSignal); -#else - connect(sendSignalActions, QOverload::of(&KSelectAction::triggered), this, &Konsole::SessionController::sendSignal); -#endif action = collection->addAction(QStringLiteral("sigstop-signal")); action->setText(i18n("&Suspend Task") + QStringLiteral(" (STOP)")); @@ -1141,21 +1096,13 @@ bool SessionController::confirmClose() const title); } -#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0) int result = KMessageBox::warningTwoActions(view()->window(), -#else - int result = KMessageBox::warningYesNo(view()->window(), -#endif question, i18n("Confirm Close"), KGuiItem(i18nc("@action:button", "Close Program"), QStringLiteral("application-exit")), KStandardGuiItem::cancel(), QStringLiteral("CloseSingleTab")); -#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0) return result == KMessageBox::PrimaryAction; -#else - return result == KMessageBox::Yes; -#endif } return true; } @@ -1184,20 +1131,12 @@ bool SessionController::confirmForceClose() const title); } -#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0) int result = KMessageBox::warningTwoActions(view()->window(), -#else - int result = KMessageBox::warningYesNo(view()->window(), -#endif question, i18n("Confirm Close"), KGuiItem(i18nc("@action:button", "Kill Program"), QStringLiteral("application-exit")), KStandardGuiItem::cancel()); -#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0) return result == KMessageBox::PrimaryAction; -#else - return result == KMessageBox::Yes; -#endif } return true; } @@ -1249,11 +1188,7 @@ void SessionController::openBrowser() } else { const QUrl currentUrl = url().isLocalFile() ? url() : QUrl::fromLocalFile(QDir::homePath()); auto *job = new KIO::OpenUrlJob(currentUrl); -#if KIO_VERSION >= QT_VERSION_CHECK(5, 98, 0) job->setUiDelegate(KIO::createDefaultJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, QApplication::activeWindow())); -#else - job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, QApplication::activeWindow())); -#endif job->start(); } } @@ -2044,13 +1979,7 @@ void SessionController::showDisplayContextMenu(const QPoint &position) QScopedPointer ac(new KFileItemActions()); ac->setItemListProperties(props); -#if KIO_VERSION >= QT_VERSION_CHECK(5, 82, 0) ac->insertOpenWithActionsTo(popup->actions().value(4, nullptr), popup, QStringList{qApp->desktopFileName()}); -#elif KIO_VERSION >= QT_VERSION_CHECK(5, 78, 0) - ac->insertOpenWithActionsTo(popup->actions().value(4, nullptr), popup, QString()); -#else - ac->addOpenWithActionsTo(popup); -#endif auto newActions = popup->actions(); for (auto *elm : old) { diff --git a/src/terminalDisplay/TerminalDisplay.cpp b/src/terminalDisplay/TerminalDisplay.cpp index 78acc1758..afdd9175f 100644 --- a/src/terminalDisplay/TerminalDisplay.cpp +++ b/src/terminalDisplay/TerminalDisplay.cpp @@ -679,12 +679,6 @@ void TerminalDisplay::showNotification(QString text) _resizeTimer->setInterval(SIZE_HINT_DURATION); _resizeTimer->setSingleShot(true); connect(_resizeTimer, &QTimer::timeout, _resizeWidget, &QLabel::hide); - - // When using fractional scaling in Qt5, portions of the terminal display are not invalidated - // properly. This ensures the widget is entirely redrawn to avoid leaving horitzontal lines. -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - connect(_resizeTimer, &QTimer::timeout, this, qOverload<>(&TerminalDisplay::update)); -#endif } _resizeWidget->setText(text); _resizeWidget->setMinimumWidth(_resizeWidget->fontMetrics().boundingRect(text).width() + 16); @@ -2319,11 +2313,7 @@ void TerminalDisplay::doPaste(QString text, bool appendReturn) if (!unsafeCharacters.isEmpty()) { int result = -#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0) KMessageBox::warningTwoActionsCancelList(window(), -#else - KMessageBox::warningYesNoCancelList(window(), -#endif i18n("The text you're trying to paste contains hidden control characters, " "do you want to filter them out?"), unsafeCharacters, @@ -2335,11 +2325,7 @@ void TerminalDisplay::doPaste(QString text, bool appendReturn) switch (result) { case KMessageBox::Cancel: return; -#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0) case KMessageBox::PrimaryAction: { -#else - case KMessageBox::Yes: { -#endif QString sanitized; for (const QChar &c : text) { if (!isUnsafe(c)) { @@ -2348,11 +2334,7 @@ void TerminalDisplay::doPaste(QString text, bool appendReturn) } text = sanitized; } -#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0) case KMessageBox::SecondaryAction: -#else - case KMessageBox::No: -#endif break; default: break; diff --git a/src/terminalDisplay/TerminalDisplay.h b/src/terminalDisplay/TerminalDisplay.h index 80ba974ba..cf5f84cbd 100644 --- a/src/terminalDisplay/TerminalDisplay.h +++ b/src/terminalDisplay/TerminalDisplay.h @@ -68,17 +68,10 @@ class Profile; * As Qt6 may not be affected by this issue, the adjustment is not added in that * case. Hopefully the compiler ignores this function in that case. */ -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) -inline QRect highdpi_adjust_rect(const QRect &rect) -{ - return rect.adjusted(-1, -1, 1, 1); -} -#else inline QRect highdpi_adjust_rect(const QRect &rect) { return rect; } -#endif /** * A widget which displays output from a terminal emulation and sends input keypresses and mouse activity diff --git a/src/terminalDisplay/TerminalFonts.cpp b/src/terminalDisplay/TerminalFonts.cpp index 189f7ddd5..fd4a5b73b 100644 --- a/src/terminalDisplay/TerminalFonts.cpp +++ b/src/terminalDisplay/TerminalFonts.cpp @@ -55,13 +55,6 @@ void TerminalFont::setVTFont(const QFont &f) // depending on the user's font configuration, this may not be respected strategy |= m_antialiasText ? QFont::PreferAntialias : QFont::NoAntialias; - // Konsole cannot handle non-integer font metrics - // TODO: Qt6 will remove ForceIntegerMetrics - // "Use QFontMetrics to retrieve rounded font metrics." -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - strategy |= QFont::ForceIntegerMetrics; -#endif - // In case the provided font doesn't have some specific characters it should // fall back to a Monospace fonts. newFont.setStyleHint(QFont::TypeWriter, QFont::StyleStrategy(strategy)); @@ -75,12 +68,7 @@ void TerminalFont::setVTFont(const QFont &f) // Ask for a generic font so at least it is usable. // Font listed in profile's dialog will not be updated. newFont = QFont(QStringLiteral("Monospace")); - // Set style strategy without ForceIntegerMetrics for the font - // TODO: Qt6 will remove ForceIntegerMetrics - // "Use QFontMetrics to retrieve rounded font metrics." -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - strategy &= ~QFont::ForceIntegerMetrics; -#endif + newFont.setStyleHint(QFont::TypeWriter, QFont::StyleStrategy(strategy)); qCDebug(KonsoleDebug) << "Font changed to " << newFont.toString(); } @@ -112,15 +100,8 @@ void TerminalFont::setVTFont(const QFont &f) || fontInfo.style() != newFont.style() || fontInfo.underline() != newFont.underline() || fontInfo.strikeOut() != newFont.strikeOut() - #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - || fontInfo.rawMode() != newFont.rawMode() - #endif ) { // clang-format on -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) static const char format[] = "%s,%g,%d,%d,%d,%d,%d,%d,%d"; -#else - static const char format[] = "%s,%g,%d,%d,%d,%d,%d,%d,%d,%d"; -#endif const QString nonMatching = QString::asprintf(format, qPrintable(fontInfo.family()), fontInfo.pointSizeF(), @@ -131,12 +112,7 @@ void TerminalFont::setVTFont(const QFont &f) static_cast(fontInfo.underline()), static_cast(fontInfo.strikeOut()), // Intentional newFont use - fixedPitch is bugged, see comment above - static_cast(newFont.fixedPitch()) -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - , - static_cast(fontInfo.rawMode()) -#endif - ); + static_cast(newFont.fixedPitch())); qCDebug(KonsoleDebug) << "The font to use in the terminal can not be matched exactly on your system."; qCDebug(KonsoleDebug) << " Selected: " << newFont.toString(); qCDebug(KonsoleDebug) << " System : " << nonMatching; diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index 1f616bef2..16c4024ae 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -8,6 +8,6 @@ set(KONSOLE_TEST_LIBS Qt::Test konsoleprivate) add_executable(PartManualTest PartManualTest.cpp) ecm_mark_as_test(PartManualTest) -target_link_libraries(PartManualTest KF${QT_MAJOR_VERSION}::XmlGui KF${QT_MAJOR_VERSION}::Parts KF${QT_MAJOR_VERSION}::Pty +target_link_libraries(PartManualTest KF6::XmlGui KF6::Parts KF6::Pty ${KONSOLE_TEST_LIBS}) diff --git a/src/tests/PartManualTest.cpp b/src/tests/PartManualTest.cpp index f46b4c835..7d146ce69 100644 --- a/src/tests/PartManualTest.cpp +++ b/src/tests/PartManualTest.cpp @@ -23,11 +23,6 @@ #include #include -#if KSERVICE_VERSION < QT_VERSION_CHECK(5, 86, 0) -#include -#include -#endif - // Konsole #include "../Pty.h" #include "../session/Session.h" @@ -67,7 +62,7 @@ void PartManualTest::testShortcutOverride() _shortcutTriggered = false; _override = false; _overrideCalled = false; - QVERIFY(connect(terminalPart, SIGNAL(overrideShortcut(QKeyEvent*,bool&)), this, SLOT(overrideShortcut(QKeyEvent*,bool&)))); + QVERIFY(connect(terminalPart, SIGNAL(overrideShortcut(QKeyEvent *, bool &)), this, SLOT(overrideShortcut(QKeyEvent *, bool &)))); // QTest::keyClick(terminalPart->widget(),Qt::Key_S,Qt::ControlModifier); _shortcutEventLoop = new QEventLoop(); @@ -109,21 +104,10 @@ void PartManualTest::shortcutTriggered() KParts::Part *PartManualTest::createPart() { -#if KSERVICE_VERSION < QT_VERSION_CHECK(5, 86, 0) - KService::Ptr service = KService::serviceByDesktopName(QStringLiteral("konsolepart")); - Q_ASSERT(service); - KPluginFactory *factory = KPluginLoader(service->library()).factory(); - Q_ASSERT(factory); - - auto *terminalPart = factory->create(this); - - return terminalPart; -#else const KPluginFactory::Result result = KPluginFactory::instantiatePlugin(KPluginMetaData(QStringLiteral("konsolepart")), this); Q_ASSERT(result); return result.plugin; -#endif } QTEST_MAIN(PartManualTest) diff --git a/src/tests/demo_konsolepart/CMakeLists.txt b/src/tests/demo_konsolepart/CMakeLists.txt index b3cd4cbcf..ce1791a6d 100644 --- a/src/tests/demo_konsolepart/CMakeLists.txt +++ b/src/tests/demo_konsolepart/CMakeLists.txt @@ -13,10 +13,10 @@ include(ECMInstallIcons) include(FeatureSummary) set(QT_MIN_VERSION "5.4.0") -find_package(Qt${QT_MAJOR_VERSION} ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS Core Gui Widgets) +find_package(Qt6 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS Core Gui Widgets) set(REQUIRED_KF_VERSION "5.18.0") -find_package(KF${QT_MAJOR_VERSION} ${REQUIRED_KF_VERSION} REQUIRED COMPONENTS +find_package(KF6 ${REQUIRED_KF_VERSION} REQUIRED COMPONENTS CoreAddons I18n ) diff --git a/src/tests/demo_konsolepart/src/CMakeLists.txt b/src/tests/demo_konsolepart/src/CMakeLists.txt index 92f53ee88..132447aca 100644 --- a/src/tests/demo_konsolepart/src/CMakeLists.txt +++ b/src/tests/demo_konsolepart/src/CMakeLists.txt @@ -6,12 +6,12 @@ set(demo_konsolepart_SRCS add_executable(demo_konsolepart ${demo_konsolepart_SRCS}) target_link_libraries(demo_konsolepart - KF${QT_MAJOR_VERSION}::CoreAddons - KF${QT_MAJOR_VERSION}::I18n - KF${QT_MAJOR_VERSION}::Parts - KF${QT_MAJOR_VERSION}::Pty - KF${QT_MAJOR_VERSION}::Service + KF6::CoreAddons + KF6::I18n + KF6::Parts + KF6::Pty + KF6::Service Qt::Widgets - KF${QT_MAJOR_VERSION}::XmlGui - KF${QT_MAJOR_VERSION}::WindowSystem + KF6::XmlGui + KF6::WindowSystem ) diff --git a/src/tests/demo_konsolepart/src/demo_konsolepart.cpp b/src/tests/demo_konsolepart/src/demo_konsolepart.cpp index dff353a35..88d3ae8c2 100644 --- a/src/tests/demo_konsolepart/src/demo_konsolepart.cpp +++ b/src/tests/demo_konsolepart/src/demo_konsolepart.cpp @@ -17,11 +17,6 @@ #include #include -#if KSERVICE_VERSION < QT_VERSION_CHECK(5, 86, 0) -#include -#include -#endif - demo_konsolepart::demo_konsolepart() : KMainWindow() , _mainWindow(nullptr) @@ -57,11 +52,7 @@ demo_konsolepart::demo_konsolepart() bool blurEnabled; QMetaObject::invokeMethod(_terminalPart, "isBlurEnabled", Qt::DirectConnection, Q_RETURN_ARG(bool, blurEnabled)); qWarning() << "blur enabled: " << blurEnabled; -#if KWINDOWSYSTEM_VERSION < QT_VERSION_CHECK(5, 82, 0) - KWindowEffects::enableBlurBehind(winId(), blurEnabled); -#else KWindowEffects::enableBlurBehind(windowHandle(), blurEnabled); -#endif } demo_konsolepart::~demo_konsolepart() @@ -73,27 +64,17 @@ demo_konsolepart::~demo_konsolepart() KParts::ReadOnlyPart *demo_konsolepart::createPart() { -#if KSERVICE_VERSION < QT_VERSION_CHECK(5, 86, 0) - KService::Ptr service = KService::serviceByDesktopName(QStringLiteral("konsolepart")); - Q_ASSERT(service); - KPluginFactory *factory = KPluginLoader(service->library()).factory(); - Q_ASSERT(factory); - - auto *terminalPart = factory->create(this); - return terminalPart; -#else const KPluginFactory::Result result = KPluginFactory::instantiatePlugin(KPluginMetaData(QStringLiteral("konsolepart")), this); Q_ASSERT(result); return result.plugin; -#endif } void demo_konsolepart::manageProfiles() { - QMetaObject::invokeMethod(_terminalPart, "showManageProfilesDialog", Qt::QueuedConnection, Q_ARG(QWidget*, QApplication::activeWindow())); + QMetaObject::invokeMethod(_terminalPart, "showManageProfilesDialog", Qt::QueuedConnection, Q_ARG(QWidget *, QApplication::activeWindow())); } void demo_konsolepart::quit() diff --git a/src/widgets/EditProfileDialog.cpp b/src/widgets/EditProfileDialog.cpp index 378510752..3454e5bec 100644 --- a/src/widgets/EditProfileDialog.cpp +++ b/src/widgets/EditProfileDialog.cpp @@ -56,16 +56,7 @@ #include #endif -// Include moc file here before the #define KNSCore KNS3 -// as moc generates the code without knowing about that define -// TODO KF6-only: move to usual place at end of file -#include "moc_EditProfileDialog.cpp" - -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) -#define KNSCore KNS3 -#endif - - using namespace Konsole; +using namespace Konsole; EditProfileDialog::EditProfileDialog(QWidget *parent) : KPageDialog(parent) @@ -939,13 +930,9 @@ void EditProfileDialog::setupAppearancePage(const Profile::Ptr &profile) _appearanceUi->displayVerticalLineAtColumn->setValue(profile->verticalLineAtChar()); connect(_appearanceUi->displayVerticalLineAtColumn, QOverload::of(&QSpinBox::valueChanged), this, &EditProfileDialog::setVerticalLineColumn); -#if KNEWSTUFF_VERSION >= QT_VERSION_CHECK(5, 91, 0) auto *getNewButton = new KNSWidgets::Button(this); connect(getNewButton, &KNSWidgets::Button::dialogFinished, this, &Konsole::EditProfileDialog::gotNewColorSchemes); -#else - auto *getNewButton = new KNSCore::Button(this); - connect(getNewButton, &KNSCore::Button::dialogFinished, this, &Konsole::EditProfileDialog::gotNewColorSchemes); -#endif + getNewButton->setText(QStringLiteral("Get New...")); getNewButton->setConfigFile(QStringLiteral("konsole.knsrc")); _appearanceUi->colorSchemesBtnLayout->addWidget(getNewButton); @@ -1321,17 +1308,7 @@ void EditProfileDialog::removeColorScheme() } } -#if KNEWSTUFF_VERSION >= QT_VERSION_CHECK(5, 91, 0) -#if QT_VERSION > QT_VERSION_CHECK(6, 0, 0) void EditProfileDialog::gotNewColorSchemes(const QList &changedEntries) -#else -#undef KNSCore -void EditProfileDialog::gotNewColorSchemes(const QList &changedEntries) -#define KNSCore KNS3 -#endif -#else -void EditProfileDialog::gotNewColorSchemes(const KNSCore::Entry::List &changedEntries) -#endif { int failures = 0; for (auto &entry : qAsConst(changedEntries)) { @@ -1976,26 +1953,10 @@ void EditProfileDialog::setupAdvancedPage(const Profile::Ptr &profile) auto codecAction = new KCodecAction(this); codecAction->setCurrentCodec(profile->defaultEncoding()); _advancedUi->selectEncodingButton->setMenu(codecAction->menu()); -#if KCONFIGWIDGETS_VERSION < QT_VERSION_CHECK(5, 103, 0) - connect(codecAction, -#if KCONFIGWIDGETS_VERSION >= QT_VERSION_CHECK(5, 78, 0) - QOverload::of(&KCodecAction::codecTriggered), - this, -#else - QOverload::of(&KCodecAction::triggered), - this, -#endif - &Konsole::EditProfileDialog::setDefaultCodec); -#else -#if QT_VERSION > QT_VERSION_CHECK(6, 0, 0) + connect(codecAction, &KCodecAction::codecNameTriggered, this, [this](const QByteArray &codecName) { setDefaultCodec(QTextCodec::codecForName(codecName)); -#else - connect(codecAction, &KCodecAction::codecNameTriggered, this, [this](const QString &codecName) { - setDefaultCodec(QTextCodec::codecForName(codecName.toUtf8())); -#endif }); -#endif connect(codecAction, &KCodecAction::defaultItemTriggered, this, [this] { setDefaultCodec(QTextCodec::codecForLocale()); @@ -2032,12 +1993,7 @@ int EditProfileDialog::maxSpinBoxWidth(const KPluralHandlingSpinBox *spinBox, co opt.frame = spinBox->hasFrame(); const QSize hint(width, spinBox->sizeHint().height()); -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) const QSize spinBoxSize = style()->sizeFromContents(QStyle::CT_SpinBox, &opt, hint, spinBox); -#else - const QSize spinBoxSize = style()->sizeFromContents(QStyle::CT_SpinBox, &opt, hint, spinBox).expandedTo(QApplication::globalStrut()); -#endif - return spinBoxSize.width(); } @@ -2207,3 +2163,5 @@ void EditProfileDialog::toggleIgnoreWcWidth(bool ignore) { updateTempProfileProperty(Profile::IgnoreWcWidth, ignore); } + +#include "moc_EditProfileDialog.cpp" diff --git a/src/widgets/EditProfileDialog.h b/src/widgets/EditProfileDialog.h index 0d929d7e0..c8c78de29 100644 --- a/src/widgets/EditProfileDialog.h +++ b/src/widgets/EditProfileDialog.h @@ -10,12 +10,7 @@ #include // KDE -#if QT_VERSION > QT_VERSION_CHECK(6, 0, 0) #include -#else -#include -#include -#endif #include #include @@ -150,7 +145,7 @@ private Q_SLOTS: void removeColorScheme(); void setVerticalLine(bool); void setVerticalLineColumn(int); - //void focusBorderColor(); + // void focusBorderColor(); void focusBorderColorChanged(const QColor &color); void toggleBlinkingCursor(bool); void setCursorShape(int); @@ -165,15 +160,7 @@ private Q_SLOTS: void togglebidiTableDirOverride(bool); void togglebidiLineLTR(bool); -#if KNEWSTUFF_VERSION >= QT_VERSION_CHECK(5, 91, 0) -#if QT_VERSION > QT_VERSION_CHECK(6, 0, 0) void gotNewColorSchemes(const QList &changedEntries); -#else - void gotNewColorSchemes(const QList &changedEntries); -#endif -#else - void gotNewColorSchemes(const KNS3::Entry::List &changedEntries); -#endif /** * Deletes the selected colorscheme from the user's home dir location diff --git a/src/widgets/IncrementalSearchBar.cpp b/src/widgets/IncrementalSearchBar.cpp index 92ffbb748..283f80a58 100644 --- a/src/widgets/IncrementalSearchBar.cpp +++ b/src/widgets/IncrementalSearchBar.cpp @@ -18,15 +18,10 @@ // KDE #include "KonsoleSettings.h" -#include -#if KCONFIGWIDGETS_VERSION >= QT_VERSION_CHECK(5, 93, 0) -#include -#else -#include -#endif - #include +#include #include +#include using namespace Konsole; diff --git a/src/widgets/TabTitleFormatButton.cpp b/src/widgets/TabTitleFormatButton.cpp index 541f75a9b..d620bd775 100644 --- a/src/widgets/TabTitleFormatButton.cpp +++ b/src/widgets/TabTitleFormatButton.cpp @@ -18,7 +18,6 @@ using namespace Konsole; const TabTitleFormatButton::Element TabTitleFormatButton::_localElements[] = { -#if KI18N_VERSION >= QT_VERSION_CHECK(5, 89, 0) {QStringLiteral("%n"), kli18n("Program Name: %n")}, {QStringLiteral("%d"), kli18n("Current Directory (Short): %d")}, {QStringLiteral("%D"), kli18n("Current Directory (Long): %D")}, @@ -27,22 +26,11 @@ const TabTitleFormatButton::Element TabTitleFormatButton::_localElements[] = { {QStringLiteral("%u"), kli18n("User Name: %u")}, {QStringLiteral("%h"), kli18n("Local Host: %h")}, {QStringLiteral("%B"), kli18n("User's Bourne prompt sigil: %B")}, // ($, or # for superuser) -#else - {QStringLiteral("%n"), I18N_NOOP("Program Name: %n")}, - {QStringLiteral("%d"), I18N_NOOP("Current Directory (Short): %d")}, - {QStringLiteral("%D"), I18N_NOOP("Current Directory (Long): %D")}, - {QStringLiteral("%w"), I18N_NOOP("Window Title Set by Shell: %w")}, - {QStringLiteral("%#"), I18N_NOOP("Session Number: %#")}, - {QStringLiteral("%u"), I18N_NOOP("User Name: %u")}, - {QStringLiteral("%h"), I18N_NOOP("Local Host: %h")}, - {QStringLiteral("%B"), I18N_NOOP("User's Bourne prompt sigil: %B")}, // ($, or # for superuser) -#endif }; const int TabTitleFormatButton::_localElementCount = sizeof(_localElements) / sizeof(TabTitleFormatButton::Element); const TabTitleFormatButton::Element TabTitleFormatButton::_remoteElements[] = { -#if KI18N_VERSION >= QT_VERSION_CHECK(5, 89, 0) {QStringLiteral("%u"), kli18n("User Name: %u")}, {QStringLiteral("%U"), kli18n("User Name@ (if given): %U")}, {QStringLiteral("%h"), kli18n("Remote Host (Short): %h")}, @@ -50,15 +38,6 @@ const TabTitleFormatButton::Element TabTitleFormatButton::_remoteElements[] = { {QStringLiteral("%c"), kli18n("Command and arguments: %c")}, {QStringLiteral("%w"), kli18n("Window Title Set by Shell: %w")}, {QStringLiteral("%#"), kli18n("Session Number: %#")}, -#else - {QStringLiteral("%u"), I18N_NOOP("User Name: %u")}, - {QStringLiteral("%U"), I18N_NOOP("User Name@ (if given): %U")}, - {QStringLiteral("%h"), I18N_NOOP("Remote Host (Short): %h")}, - {QStringLiteral("%H"), I18N_NOOP("Remote Host (Long): %H")}, - {QStringLiteral("%c"), I18N_NOOP("Command and arguments: %c")}, - {QStringLiteral("%w"), I18N_NOOP("Window Title Set by Shell: %w")}, - {QStringLiteral("%#"), I18N_NOOP("Session Number: %#")}, -#endif }; const int TabTitleFormatButton::_remoteElementCount = sizeof(_remoteElements) / sizeof(TabTitleFormatButton::Element); @@ -104,11 +83,7 @@ void TabTitleFormatButton::setContext(Session::TabTitleContext titleContext) menuActions.reserve(count); for (int i = 0; i < count; i++) { -#if KI18N_VERSION >= QT_VERSION_CHECK(5, 89, 0) auto *action = new QAction(array[i].description.toString(), this); -#else - auto *action = new QAction(i18n(array[i].description), this); -#endif action->setData(array[i].element); menuActions << action; } diff --git a/src/widgets/TabTitleFormatButton.h b/src/widgets/TabTitleFormatButton.h index 0619fe1a4..d2371cd00 100644 --- a/src/widgets/TabTitleFormatButton.h +++ b/src/widgets/TabTitleFormatButton.h @@ -12,10 +12,8 @@ #include // KDE -#include -#if KI18N_VERSION >= QT_VERSION_CHECK(5, 89, 0) #include -#endif +#include // Konsole #include "session/Session.h" @@ -44,11 +42,7 @@ private: struct Element { QString element; -#if KI18N_VERSION >= QT_VERSION_CHECK(5, 89, 0) KLazyLocalizedString description; -#else - const char *description; -#endif }; static const Element _localElements[]; static const int _localElementCount; diff --git a/tools/uni2characterwidth/CMakeLists.txt b/tools/uni2characterwidth/CMakeLists.txt index 8020e3d8d..21dab4ed3 100644 --- a/tools/uni2characterwidth/CMakeLists.txt +++ b/tools/uni2characterwidth/CMakeLists.txt @@ -7,10 +7,10 @@ ### See `uni2characterwidth --help` for usage information if(KONSOLE_BUILD_UNI2CHARACTERWIDTH) - find_package(Qt${QT_MAJOR_VERSION} ${QT_MIN_VERSION} CONFIG REQUIRED + find_package(Qt6 ${QT_MIN_VERSION} CONFIG REQUIRED Core ) - find_package(KF${QT_MAJOR_VERSION} ${KF_MIN_VERSION} REQUIRED + find_package(KF6 ${KF_MIN_VERSION} REQUIRED KIO ) @@ -24,7 +24,7 @@ if(KONSOLE_BUILD_UNI2CHARACTERWIDTH) add_executable(uni2characterwidth ${uni2characterwidth_SRC}) target_link_libraries(uni2characterwidth Qt::Core - KF${QT_MAJOR_VERSION}::KIOCore + KF6::KIOCore ) endif()