diff --git a/CMakeLists.txt b/CMakeLists.txt index 3653175d5..f883698ef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,94 +1,94 @@ cmake_minimum_required(VERSION 3.0) project(kdeplasma-addons) set(PROJECT_VERSION "5.19.80") set(PROJECT_VERSION_MAJOR 5) ################# Disallow in-source build ################# if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") message(FATAL_ERROR "plasma requires an out of source build. Please create a separate build directory and run 'cmake path_to_plasma [options]' there.") endif() set(QT_MIN_VERSION 5.12.0) -set(KF5_MIN_VERSION 5.70.0) +set(KF5_MIN_VERSION 5.71.0) include(FeatureSummary) find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH}) include(KDEInstallDirs) include(KDECMakeSettings) include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE) include(ECMQtDeclareLoggingCategory) include(ECMInstallIcons) include(KDEPackageAppTemplates) include(GenerateExportHeader) include(CMakePackageConfigHelpers) include(KDEClangFormat) find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED Core Gui DBus Quick Qml Widgets Test ) find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS Archive Config CoreAddons Declarative Holidays I18n IconThemes KIO KCMUtils Kross Notifications Plasma Runner Service Sonnet UnitConversion WindowSystem NewStuff ) find_package(KF5Purpose CONFIG QUIET) set_package_properties(KF5Purpose PROPERTIES DESCRIPTION "Framework for cross-application services and actions" PURPOSE "Needed for QuickShare applet" URL "https://commits.kde.org/purpose" TYPE RUNTIME ) add_definitions( -DQT_DEPRECATED_WARNINGS -DQT_NO_URL_CAST_FROM_STRING ) ######################################################################### ################# list the subdirectories ################# add_subdirectory(applets) add_subdirectory(dataengines) add_subdirectory(runners) add_subdirectory(wallpapers) add_subdirectory(windowswitchers) add_subdirectory(desktopswitchers) add_subdirectory(plasmacalendarplugins) add_subdirectory(templates) # 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}) feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/applets/nightcolor/package/contents/ui/main.qml b/applets/nightcolor/package/contents/ui/main.qml index 54edc0fc0..d621d07de 100644 --- a/applets/nightcolor/package/contents/ui/main.qml +++ b/applets/nightcolor/package/contents/ui/main.qml @@ -1,108 +1,108 @@ /* * Copyright 2019 Vlad Zahorodnii * * 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) any later version. * * 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 org.kde.kquickcontrolsaddons 2.0 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.plasmoid 2.0 import org.kde.plasma.private.nightcolorcontrol 1.0 Item { id: root Plasmoid.icon: monitor.running ? 'redshift-status-on' : 'redshift-status-off' Plasmoid.status: { // Display the applet in the system tray when Night Color is active. if (monitor.enabled && monitor.targetTemperature != 6500) { return PlasmaCore.Types.ActiveStatus; } if (inhibitor.state != Inhibitor.Uninhibited) { return PlasmaCore.Types.ActiveStatus; } return PlasmaCore.Types.PassiveStatus; } Plasmoid.toolTipMainText: i18n("Night Color Control") Plasmoid.toolTipSubText: { if (inhibitor.state == Inhibitor.Inhibited) { return i18n("Night Color is inhibited"); } if (!monitor.available) { return i18n("Night Color is unavailable"); } if (!monitor.enabled) { return i18n("Night Color is disabled"); } if (!monitor.running) { return i18n("Night Color is not running"); } return i18n("Night Color is active (%1K)", monitor.currentTemperature); } Plasmoid.preferredRepresentation: Plasmoid.compactRepresentation Plasmoid.compactRepresentation: PlasmaCore.IconItem { active: compactMouseArea.containsMouse source: plasmoid.icon MouseArea { id: compactMouseArea anchors.fill: parent hoverEnabled: true onClicked: toggleInhibition() } } Plasmoid.onActivated: toggleInhibition() function toggleInhibition() { if (!monitor.available) { return; } switch (inhibitor.state) { case Inhibitor.Inhibiting: case Inhibitor.Inhibited: inhibitor.uninhibit(); break; case Inhibitor.Uninhibiting: case Inhibitor.Uninhibited: inhibitor.inhibit(); break; } } function action_KCMNightColor() { - KCMShell.open("kcm_nightcolor"); + KCMShell.openSystemSettings("kcm_nightcolor"); } Inhibitor { id: inhibitor } Monitor { id: monitor } Component.onCompleted: { if (KCMShell.authorize("kcm_nightcolor.desktop").length > 0) { plasmoid.setAction("KCMNightColor", i18n("Configure Night Color..."), "configure"); } plasmoid.removeAction("configure"); } } diff --git a/applets/userswitcher/package/contents/ui/main.qml b/applets/userswitcher/package/contents/ui/main.qml index 2ee6c9a6d..3ed6830c5 100644 --- a/applets/userswitcher/package/contents/ui/main.qml +++ b/applets/userswitcher/package/contents/ui/main.qml @@ -1,252 +1,252 @@ /* * Copyright 2015 Kai Uwe Broulik * * 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) any later version. * * 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA. */ import QtQuick 2.2 import QtQuick.Controls 1.1 as QtControls import QtQuick.Layouts 1.1 import QtQuick.Window 2.1 import org.kde.plasma.plasmoid 2.0 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.plasma.extras 2.0 as PlasmaExtras import org.kde.kcoreaddons 1.0 as KCoreAddons // kuser import org.kde.kquickcontrolsaddons 2.0 // kcmshell import org.kde.plasma.private.sessions 2.0 as Sessions Item { id: root readonly property bool isVertical: plasmoid.formFactor === PlasmaCore.Types.Vertical readonly property string displayedName: showFullName ? kuser.fullName : kuser.loginName readonly property bool showFace: plasmoid.configuration.showFace readonly property bool showName: plasmoid.configuration.showName readonly property bool showFullName: plasmoid.configuration.showFullName // TTY number and X display readonly property bool showTechnicalInfo: plasmoid.configuration.showTechnicalInfo Plasmoid.switchWidth: units.gridUnit * 10 Plasmoid.switchHeight: units.gridUnit * 12 Plasmoid.toolTipTextFormat: Text.StyledText Plasmoid.toolTipSubText: i18n("You are logged in as %1", displayedName) Binding { target: plasmoid property: "icon" value: kuser.faceIconUrl // revert to the plasmoid icon if no face given when: kuser.faceIconUrl.toString() !== "" } KCoreAddons.KUser { id: kuser } Plasmoid.compactRepresentation: MouseArea { id: compactRoot // Taken from DigitalClock to ensure uniform sizing when next to each other readonly property bool tooSmall: plasmoid.formFactor === PlasmaCore.Types.Horizontal && Math.round(2 * (compactRoot.height / 5)) <= theme.smallestFont.pixelSize Layout.minimumWidth: isVertical ? 0 : compactRow.implicitWidth Layout.maximumWidth: isVertical ? Infinity : Layout.minimumWidth Layout.preferredWidth: isVertical ? undefined : Layout.minimumWidth Layout.minimumHeight: isVertical ? label.height : theme.smallestFont.pixelSize Layout.maximumHeight: isVertical ? Layout.minimumHeight : Infinity Layout.preferredHeight: isVertical ? Layout.minimumHeight : theme.mSize(theme.defaultFont).height * 2 onClicked: plasmoid.expanded = !plasmoid.expanded Row { id: compactRow anchors.centerIn: parent spacing: units.smallSpacing PlasmaCore.IconItem { id: icon width: height height: compactRoot.height Layout.preferredWidth: height source: visible ? (kuser.faceIconUrl.toString() || "user-identity") : "" visible: root.showFace usesPlasmaTheme: false } PlasmaComponents.Label { id: label text: root.displayedName height: compactRoot.height horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter wrapMode: Text.NoWrap fontSizeMode: Text.VerticalFit font.pixelSize: tooSmall ? theme.defaultFont.pixelSize : units.roundToIconSize(units.gridUnit * 2) minimumPointSize: theme.smallestFont.pointSize visible: root.showName } } } Plasmoid.fullRepresentation: Item { id: fullRoot Layout.preferredWidth: units.gridUnit * 12 Layout.preferredHeight: Math.min(Screen.height * 0.5, column.contentHeight) PlasmaCore.DataSource { id: pmEngine engine: "powermanagement" connectedSources: ["PowerDevil", "Sleep States"] function performOperation(what) { var service = serviceForSource("PowerDevil") var operation = service.operationDescription(what) service.startOperationCall(operation) } } Sessions.SessionsModel { id: sessionsModel } PlasmaComponents.Highlight { id: delegateHighlight visible: false z: -1 // otherwise it shows ontop of the icon/label and tints them slightly } ColumnLayout { id: column // there doesn't seem a more sensible way of getting this due to the expanding ListView readonly property int contentHeight: currentUserItem.height + userList.contentHeight + units.smallSpacing + (newSessionButton.visible ? newSessionButton.height : 0) + (lockScreenButton.visible ? lockScreenButton.height : 0) + leaveButton.height anchors.fill: parent spacing: 0 ListDelegate { id: currentUserItem text: root.displayedName subText: i18n("Current user") icon: kuser.faceIconUrl.toString() || "user-identity" interactive: false interactiveIcon: KCMShell.authorize("user_manager.desktop").length > 0 - onIconClicked: KCMShell.open("user_manager") + onIconClicked: KCMShell.openSystemSettings("user_manager") usesPlasmaTheme: false } PlasmaExtras.ScrollArea { Layout.fillWidth: true Layout.fillHeight: true ListView { id: userList model: sessionsModel highlight: PlasmaComponents.Highlight {} highlightMoveDuration: 0 delegate: ListDelegate { width: userList.width text: { if (!model.session) { return i18nc("Nobody logged in on that session", "Unused") } if (model.realName && root.showFullName) { return model.realName } return model.name } icon: model.icon || "user-identity" subText: { if (!root.showTechnicalInfo) { return "" } if (model.isTty) { return i18nc("User logged in on console number", "TTY %1", model.vtNumber) } else if (model.displayNumber) { return i18nc("User logged in on console (X display number)", "on %1 (%2)", model.vtNumber, model.displayNumber) } return "" } onClicked: sessionsModel.switchUser(model.vtNumber, sessionsModel.shouldLock) onContainsMouseChanged: { if (containsMouse) { userList.currentIndex = index } else { userList.currentIndex = -1 } } usesPlasmaTheme: false } } } ListDelegate { id: newSessionButton text: i18nc("@action", "New Session") icon: "system-switch-user" highlight: delegateHighlight visible: sessionsModel.canStartNewSession onClicked: sessionsModel.startNewSession(sessionsModel.shouldLock) } ListDelegate { id: lockScreenButton text: i18nc("@action", "Lock Screen") icon: "system-lock-screen" highlight: delegateHighlight enabled: pmEngine.data["Sleep States"]["LockScreen"] visible: enabled onClicked: pmEngine.performOperation("lockScreen") } ListDelegate { id: leaveButton text: i18nc("Show a dialog with options to logout/shutdown/restart", "Leave...") highlight: delegateHighlight icon: "system-shutdown" onClicked: pmEngine.performOperation("requestShutDown") } } Component.onCompleted: { plasmoid.expandedChanged.connect(function (expanded) { if (expanded) { sessionsModel.reload(); } }); } } }