diff --git a/CMakeLists.txt b/CMakeLists.txt index e8656d85..f94c7721 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,75 +1,75 @@ cmake_minimum_required(VERSION 3.0) set(PROJECT_VERSION "5.16.80") project(systemsettings VERSION ${PROJECT_VERSION}) set(QT_MIN_VERSION "5.11.0") -set(KF5_MIN_VERSION "5.58.0") +set(KF5_MIN_VERSION "5.62.0") find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) include(KDEInstallDirs) include(KDECMakeSettings) include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE) include(GenerateExportHeader) include(ECMQMLModules) include(ECMQtDeclareLoggingCategory) add_definitions(-DQT_NO_URL_CAST_FROM_STRING) add_definitions(-DQT_USE_QSTRINGBUILDER) add_definitions(-DQT_NO_CAST_FROM_ASCII) add_definitions(-DQT_NO_CAST_TO_ASCII) add_definitions(-DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT) find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS Widgets Quick Qml QuickWidgets ) find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS Crash ItemViews KCMUtils I18n KIO Service IconThemes WidgetsAddons WindowSystem XmlGui DBusAddons Config DocTools Package Declarative Activities ActivitiesStats OPTIONAL_COMPONENTS KHtml QUIET ) ecm_find_qmlmodule(org.kde.kcm 1.0) find_package(KF5Kirigami2 2.1 CONFIG REQUIRED) find_package(LibKWorkspace ${PROJECT_VERSION} CONFIG REQUIRED) add_subdirectory(core) add_subdirectory(app) add_subdirectory(categories) add_subdirectory(icons) add_subdirectory(sidebar) add_subdirectory(doc) if(KF5KHtml_FOUND) add_subdirectory(classic) endif() if (${ECM_VERSION} STRGREATER "5.58.0") install(FILES systemsettings.categories DESTINATION ${KDE_INSTALL_LOGGINGCATEGORIESDIR}) else() install(FILES systemsettings.categories DESTINATION ${KDE_INSTALL_CONFDIR}) endif() feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/sidebar/package/contents/ui/CategoriesPage.qml b/sidebar/package/contents/ui/CategoriesPage.qml index 6618b956..633c0fdf 100644 --- a/sidebar/package/contents/ui/CategoriesPage.qml +++ b/sidebar/package/contents/ui/CategoriesPage.qml @@ -1,164 +1,152 @@ /* Copyright (c) 2017 Marco Martin This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License version 2 as published by the Free Software Foundation. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import QtQuick 2.5 import QtQuick.Controls 2.5 as QQC2 import QtQuick.Layouts 1.1 - -import org.kde.kirigami 2.8 as Kirigami +import org.kde.kirigami 2.10 as Kirigami Kirigami.ScrollablePage { id: mainColumn Component.onCompleted: searchField.forceActiveFocus() header: Rectangle { Kirigami.Theme.colorSet: Kirigami.Theme.Window Kirigami.Theme.inherit: false color: Kirigami.Theme.backgroundColor width: mainColumn.width height: Math.round(Kirigami.Units.gridUnit * 2.5) RowLayout { id: searchLayout spacing: Kirigami.Units.smallSpacing anchors { fill: parent margins: Kirigami.Units.smallSpacing } QQC2.ToolButton { id: menuButton icon.name: "application-menu" checkable: true checked: systemsettings.actionMenuVisible Layout.maximumWidth: Kirigami.Units.iconSizes.smallMedium + Kirigami.Units.smallSpacing * 2 Layout.maximumHeight: width Keys.onBacktabPressed: { root.focusPreviousRequest() } onClicked: systemsettings.showActionMenu(mapToGlobal(0, height)) QQC2.ToolTip { text: i18n("Show menu") } } Kirigami.SearchField { id: searchField focus: true Layout.minimumHeight: Layout.maximumHeight Layout.maximumHeight: Kirigami.Units.iconSizes.smallMedium + Kirigami.Units.smallSpacing * 2 Layout.fillWidth: true onTextChanged: { systemsettings.categoryModel.filterRegExp = text; } } } Kirigami.Separator { anchors { left: parent.left right: parent.right top: parent.bottom } } } background: Rectangle { Kirigami.Theme.colorSet: Kirigami.Theme.View color: Kirigami.Theme.backgroundColor } Kirigami.Heading { anchors.centerIn: parent width: parent.width * 0.7 wrapMode: Text.WordWrap horizontalAlignment: Text.AlignHCenter text: i18nc("A search yielded no results", "No items matching your search") opacity: categoryView.count == 0 ? 0.3 : 0 Behavior on opacity { OpacityAnimator { duration: Kirigami.Units.longDuration easing.type: Easing.InOutQuad } } } ListView { id: categoryView anchors.fill: parent model: systemsettings.categoryModel currentIndex: systemsettings.activeCategory onContentYChanged: systemsettings.hideToolTip(); activeFocusOnTab: true keyNavigationWraps: true Accessible.role: Accessible.List Keys.onTabPressed: { if (applicationWindow().wideScreen) { subCategoryColumn.focus = true; } else { root.focusNextRequest(); } } section { property: "categoryDisplayRole" - delegate: Kirigami.AbstractListItem { + delegate: Kirigami.ListSectionHeader { width: categoryView.width - - backgroundColor: Kirigami.Theme.backgroundColor - Kirigami.Theme.inherit: false - Kirigami.Theme.colorSet: Kirigami.Theme.Window - - hoverEnabled: false - supportsMouseEvents: false - - Kirigami.Heading { - level: 2 - text: section - } + label: section } } delegate: Kirigami.BasicListItem { id: delegate icon: model.decoration label: model.display separatorVisible: false Accessible.role: Accessible.ListItem Accessible.name: model.display onClicked: { if (systemsettings.activeCategory == index) { root.pageStack.currentIndex = 1; } else { systemsettings.activeCategory = index; subCategoryColumn.title = model.display; } } onHoveredChanged: { if (hovered) { systemsettings.requestToolTip(index, delegate.mapToItem(root, 0, 0, width, height)); } else { systemsettings.hideToolTip(); } } onFocusChanged: { if (focus) { onCurrentIndexChanged: categoryView.positionViewAtIndex(index, ListView.Contain); } } highlighted: systemsettings.activeCategory == index Keys.onEnterPressed: clicked(); Keys.onReturnPressed: clicked(); } } } diff --git a/sidebar/package/contents/ui/SubCategoryPage.qml b/sidebar/package/contents/ui/SubCategoryPage.qml index 36c6135f..4ef18542 100644 --- a/sidebar/package/contents/ui/SubCategoryPage.qml +++ b/sidebar/package/contents/ui/SubCategoryPage.qml @@ -1,159 +1,159 @@ /* Copyright (c) 2017 Marco Martin This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License version 2 as published by the Free Software Foundation. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import QtQuick 2.5 import QtQuick.Controls 2.5 as QQC2 import QtQuick.Layouts 1.1 import org.kde.kirigami 2.5 as Kirigami Kirigami.ScrollablePage { id: subCategoryColumn header: Rectangle { id: headerRect Kirigami.Theme.colorSet: Kirigami.Theme.Window Kirigami.Theme.inherit: false color: { if (headerControls.pressed) { return Kirigami.Theme.highlightColor; } else if (headerControls.containsMouse) { return Kirigami.Theme.hoverColor; } else { return Kirigami.Theme.backgroundColor; } } width: subCategoryColumn.width height: Math.round(Kirigami.Units.gridUnit * 2.5) MouseArea { id: headerControls Kirigami.Theme.colorSet: Kirigami.Theme.Button Kirigami.Theme.inherit: false anchors.fill: parent enabled: !applicationWindow().wideScreen hoverEnabled: true onClicked: root.pageStack.currentIndex = 0 Accessible.role: Accessible.Button Accessible.name: i18n("Back") RowLayout { anchors.fill: parent anchors.leftMargin: Kirigami.Units.largeSpacing Kirigami.Icon { id: toolButtonIcon visible: !applicationWindow().wideScreen Layout.alignment: Qt.AlignVCenter Layout.preferredHeight: Kirigami.Units.iconSizes.small Layout.preferredWidth: Layout.preferredHeight source: LayoutMirroring.enabled ? "go-next" : "go-previous" color: { if (headerControls.pressed) { return Kirigami.Theme.highlightedTextColor; } else { return Kirigami.Theme.textColor; } } } Kirigami.Heading { Layout.fillWidth: true Layout.fillHeight: true - level: 2 + level: 3 height: toolButtonIcon.height text: subCategoryColumn.title verticalAlignment: Text.AlignVCenter elide: Text.ElideRight color: { if (headerControls.pressed) { return Kirigami.Theme.highlightedTextColor; } else { return Kirigami.Theme.textColor; } } } } } Kirigami.Separator { anchors { left: parent.left right: parent.right top: parent.bottom } } } background: Rectangle { Kirigami.Theme.colorSet: Kirigami.Theme.View color: Kirigami.Theme.backgroundColor } ListView { id: subCategoryView anchors.fill: parent model: systemsettings.subCategoryModel currentIndex: systemsettings.activeSubCategory onContentYChanged: systemsettings.hideSubCategoryToolTip(); activeFocusOnTab: true keyNavigationWraps: true Accessible.role: Accessible.List Keys.onTabPressed: root.focusNextRequest(); Keys.onBacktabPressed: { mainColumn.focus = true; } onCountChanged: { if (count > 1) { if (root.pageStack.depth < 2) { root.pageStack.push(subCategoryColumn); } } else { root.pageStack.pop(mainColumn) } } Connections { target: systemsettings onActiveSubCategoryChanged: { root.pageStack.currentIndex = 1; subCategoryView.forceActiveFocus(); } } delegate: Kirigami.BasicListItem { id: delegate icon: model.decoration label: model.display separatorVisible: false onClicked: systemsettings.activeSubCategory = index onHoveredChanged: { if (hovered) { systemsettings.requestSubCategoryToolTip(index, delegate.mapToItem(root, 0, 0, width, height)); } else { systemsettings.hideSubCategoryToolTip(); } } onFocusChanged: { if (focus) { onCurrentIndexChanged: subCategoryView.positionViewAtIndex(index, ListView.Contain); } } highlighted: systemsettings.activeSubCategory == index Keys.onEnterPressed: clicked(); Keys.onReturnPressed: clicked(); } } }