diff --git a/CMakeLists.txt b/CMakeLists.txt index 7c1c3349..52e63bad 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,94 +1,94 @@ project(discover) set(PROJECT_VERSION "5.19.80") set(PROJECT_VERSION_MAJOR 5) cmake_minimum_required(VERSION 2.8.12) set(QT_MIN_VERSION "5.14.0") -set(KF5_MIN_VERSION "5.70.0") +set(KF5_MIN_VERSION "5.71.0") find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR} "${CMAKE_SOURCE_DIR}/cmake") find_package(Qt5 ${QT_MIN_VERSION} REQUIRED CONFIG COMPONENTS Widgets Test Network Xml Concurrent DBus Quick) include(KDEInstallDirs) include(KDECMakeSettings) include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE) include(ECMInstallIcons) include(ECMMarkAsTest) include(ECMAddTests) include(GenerateExportHeader) include(ECMQtDeclareLoggingCategory) include(KDEClangFormat) find_package(PkgConfig REQUIRED) find_package(KF5 ${KF5_MIN_VERSION} REQUIRED CoreAddons Config Crash DBusAddons I18n Archive XmlGui ItemModels KIO Declarative) find_package(KF5Kirigami2 2.7.0) find_package(packagekitqt5 1.0.1 CONFIG) find_package(AppStreamQt 0.11.1 CONFIG) find_package(KF5Attica 5.23 CONFIG) find_package(KF5NewStuff 5.53 CONFIG) pkg_check_modules(Flatpak IMPORTED_TARGET flatpak>=0.11.8) pkg_check_modules(Fwupd IMPORTED_TARGET fwupd>=1.0.6) pkg_check_modules(Markdown IMPORTED_TARGET libmarkdown) find_package(KUserFeedback) if(NOT CMAKE_VERSION VERSION_LESS "3.10.0") # CMake 3.9+ warns about automoc on files without Q_OBJECT, and doesn't know about other macros. # 3.10+ lets us provide more macro names that require automoc. list(APPEND CMAKE_AUTOMOC_MACRO_NAMES "DISCOVER_BACKEND_PLUGIN") endif() configure_file(DiscoverVersion.h.in DiscoverVersion.h) add_subdirectory(libdiscover) add_subdirectory(discover) add_subdirectory(exporter) add_subdirectory(update) option(WITH_NOTIFIER "Build and install the notifier plasmoid" ON) if(WITH_NOTIFIER) find_package(KF5 REQUIRED Notifications KIO) add_subdirectory(notifier) endif() set_package_properties(KF5Attica PROPERTIES DESCRIPTION "KDE Framework that implements the Open Collaboration Services API" PURPOSE "Required to build the KNewStuff3 backend" TYPE OPTIONAL) set_package_properties(KF5Kirigami2 PROPERTIES DESCRIPTION "KDE's lightweight user interface framework for mobile and convergent applications" URL "https://techbase.kde.org/Kirigami" PURPOSE "Required by discover qml components" TYPE RUNTIME) set_package_properties(KF5NewStuff PROPERTIES DESCRIPTION "Qt library that allows to interact with KNewStuff implementations" PURPOSE "Required to build the KNS backend" TYPE OPTIONAL) set_package_properties(packagekitqt5 PROPERTIES DESCRIPTION "Library that exposes PackageKit resources" URL "https://www.freedesktop.org/software/PackageKit/" PURPOSE "Required to build the PackageKit backend" TYPE OPTIONAL) set_package_properties(AppStreamQt PROPERTIES DESCRIPTION "Library that lists Appstream resources" URL "https://www.freedesktop.org" PURPOSE "Required to build the PackageKit and Flatpak backends" TYPE OPTIONAL) add_feature_info(Flatpak Flatpak_FOUND "Library that exposes flatpak repositories. Required to build the Flatpak backend" ) add_feature_info(Fwupd Fwupd_FOUND "Exposes fwupd") feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) # add clang-format target for all our real source files file(GLOB_RECURSE ALL_CLANG_FORMAT_SOURCE_FILES *.cpp *.h) kde_clang_format(${ALL_CLANG_FORMAT_SOURCE_FILES}) install(FILES discover.categories DESTINATION ${KDE_INSTALL_LOGGINGCATEGORIESDIR}) diff --git a/discover/qml/DiscoverDrawer.qml b/discover/qml/DiscoverDrawer.qml index 8bfe3df3..3a62a646 100644 --- a/discover/qml/DiscoverDrawer.qml +++ b/discover/qml/DiscoverDrawer.qml @@ -1,217 +1,214 @@ /*************************************************************************** * Copyright © 2015 Aleix Pol Gonzalez * * * * This program is free software; you can redistribute it and/or * * modify it under the terms of the GNU General Public License as * * published by the Free Software Foundation; either version 2 of * * the License or (at your option) version 3 or any later version * * accepted by the membership of KDE e.V. (or its successor approved * * by the membership of KDE e.V.), which shall act as a proxy * * defined in Section 14 of version 3 of the license. * * * * This program 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 General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program. If not, see . * ***************************************************************************/ import QtQuick 2.5 import QtQuick.Layouts 1.1 import QtQuick.Controls 2.1 import org.kde.discover 2.0 import org.kde.discover.app 1.0 import org.kde.kirigami 2.11 as Kirigami import "navigation.js" as Navigation Kirigami.GlobalDrawer { id: drawer leftPadding: 0 rightPadding: 0 topPadding: 0 bottomPadding: 0 // FIXME: Dirty workaround for 385992 width: Kirigami.Units.gridUnit * 14 property bool wideScreen: false bannerImageSource: "qrc:/banners/banner.svg" - // In desktop view, it's a sidebar, and sidebars get the view BG color - Kirigami.Theme.colorSet: modal ? Kirigami.Theme.Window : Kirigami.Theme.View - resetMenuOnTriggered: false onBannerClicked: { Navigation.openHome(); drawerOpen = false } property string currentSearchText onCurrentSubMenuChanged: { if (currentSubMenu) currentSubMenu.trigger() else if (currentSearchText.length > 0) window.leftPage.category = null else Navigation.openHome() } function suggestSearchText(text) { searchField.text = text searchField.forceActiveFocus() } // Give the search field keyboard focus by default Component.onCompleted: { searchField.forceActiveFocus(); } header: Kirigami.AbstractApplicationHeader { id: toolbar visible: drawer.wideScreen RowLayout { anchors.fill: parent anchors.leftMargin: Kirigami.Units.smallSpacing anchors.rightMargin: Kirigami.Units.smallSpacing SearchField { id: searchField Layout.topMargin: Kirigami.Units.smallSpacing Layout.bottomMargin: Kirigami.Units.smallSpacing Layout.fillHeight: true Layout.fillWidth: true visible: window.leftPage && (window.leftPage.searchFor !== null || window.leftPage.hasOwnProperty("search")) page: window.leftPage onCurrentSearchTextChanged: { var curr = window.leftPage; if (pageStack.depth>1) pageStack.pop() if (currentSearchText === "" && window.currentTopLevel === "" && !window.leftPage.category) { Navigation.openHome() } else if (!curr.hasOwnProperty("search")) { if (currentSearchText) { Navigation.clearStack() Navigation.openApplicationList( { search: currentSearchText }) } } else { curr.search = currentSearchText; curr.forceActiveFocus() } } } ToolButton { icon.name: "go-home" onClicked: Navigation.openHome() ToolTip { text: i18n("Return to the Featured page") } } } } ColumnLayout { spacing: 0 Layout.fillWidth: true Layout.leftMargin: -drawer.leftPadding Layout.rightMargin: -drawer.rightPadding Kirigami.Separator { Layout.fillWidth: true } ProgressView { separatorVisible: false } ActionListItem { action: searchAction } ActionListItem { action: installedAction } ActionListItem { action: sourcesAction } ActionListItem { action: aboutAction } ActionListItem { objectName: "updateButton" action: updateAction backgroundColor: ResourcesModel.updatesCount>0 ? "orange" : Kirigami.Theme.backgroundColor } states: [ State { name: "full" when: drawer.wideScreen PropertyChanges { target: drawer; drawerOpen: true } }, State { name: "compact" when: !drawer.wideScreen PropertyChanges { target: drawer; drawerOpen: false } } ] } Component { id: categoryActionComponent Kirigami.Action { property QtObject category readonly property bool itsMe: window.leftPage && window.leftPage.hasOwnProperty("category") && (window.leftPage.category === category) text: category ? category.name : "" iconName: category ? category.icon : "" checked: itsMe visible: (!window.leftPage || !window.leftPage.subcategories || window.leftPage.subcategories === undefined || currentSearchText.length === 0 || (category && category.contains(window.leftPage.subcategories)) ) onTriggered: { if (!window.leftPage.canNavigate) Navigation.openCategory(category, currentSearchText) else { if (pageStack.depth>1) pageStack.pop() pageStack.currentIndex = 0 window.leftPage.category = category } } } } function createCategoryActions(categories) { var actions = [] for(var i in categories) { var cat = categories[i]; var catAction = categoryActionComponent.createObject(drawer, {category: cat, children: createCategoryActions(cat.subcategories)}); actions.push(catAction) } return actions; } actions: createCategoryActions(CategoryModel.rootCategories) modal: !drawer.wideScreen handleVisible: !drawer.wideScreen }