File 2000-applets.patch of Package plasma6-workspace
diff --git a/applets/clipboard/contents/ui/main.qml b/applets/clipboard/contents/ui/main.qml
index d64a1341b88d4c04921ef24bc670f6016bf8f0f6..5680af4a98c1188389a3eb3a4658f604aa3db63a 100644
--- a/applets/clipboard/contents/ui/main.qml
+++ b/applets/clipboard/contents/ui/main.qml
@@ -46,7 +46,7 @@ PlasmoidItem {
// because only the active applet can hide itself
if (main.hideOnWindowDeactivate)
main.expanded = false;
- Plasmoid.status = PlasmaCore.Types.HiddenStatus;
+ Plasmoid.status = PlasmaCore.Types.PassiveStatus;
} else {
Plasmoid.status = PlasmaCore.Types.ActiveStatus
}
@@ -60,6 +60,7 @@ PlasmoidItem {
PlasmaCore.Action {
id: clearAction
text: i18n("Clear History")
+ priority: PlasmaCore.Action.HighPriority
icon.name: "edit-clear-history"
visible: !main.isClipboardEmpty && !(main.fullRepresentationItem?.clipboardMenu as Private.ClipboardMenu)?.editing
onTriggered: {
diff --git a/applets/digital-clock/package/contents/ui/CalendarView.qml b/applets/digital-clock/package/contents/ui/CalendarView.qml
index 7afdc360d7ee5ae6a4c43ea13306ddefe8e71a00..1f4f054b22e4e52c35e5c13da08ffa3e198c7de3 100644
--- a/applets/digital-clock/package/contents/ui/CalendarView.qml
+++ b/applets/digital-clock/package/contents/ui/CalendarView.qml
@@ -38,10 +38,10 @@ PlasmaExtras.Representation {
Kirigami.Theme.colorSet: Kirigami.Theme.Window
Kirigami.Theme.inherit: false
- Layout.minimumWidth: (calendar.showAgenda || calendar.showClocks) ? Kirigami.Units.gridUnit * 45 : Kirigami.Units.gridUnit * 22
+ Layout.minimumWidth: (calendar.showAgenda || calendar.showClocks) ? Kirigami.Units.gridUnit * 41 : Kirigami.Units.gridUnit * 20
Layout.maximumWidth: Kirigami.Units.gridUnit * 80
- Layout.minimumHeight: Kirigami.Units.gridUnit * 25
+ Layout.minimumHeight: Kirigami.Units.gridUnit * 23
Layout.maximumHeight: Kirigami.Units.gridUnit * 40
collapseMarginsHint: true
diff --git a/applets/notifications/package/contents/ui/FullRepresentation.qml b/applets/notifications/package/contents/ui/FullRepresentation.qml
index f949dad46aadae3f78f2bf222608a8a90a48cd7b..1ead5f5234a6e4a53aab1cf9081eb14c50c8efa3 100644
--- a/applets/notifications/package/contents/ui/FullRepresentation.qml
+++ b/applets/notifications/package/contents/ui/FullRepresentation.qml
@@ -14,18 +14,19 @@ import org.kde.plasma.components 3.0 as PlasmaComponents3
import org.kde.plasma.extras 2.0 as PlasmaExtras
import org.kde.kirigami 2.20 as Kirigami
-import org.kde.coreaddons 1.0 as KCoreAddons
-
import org.kde.notificationmanager as NotificationManager
import org.kde.plasma.private.notifications as Notifications
import "global"
PlasmaExtras.Representation {
+ id: fullRepresentation
+
// TODO these should be configurable in the future
readonly property int dndMorningHour: 6
readonly property int dndEveningHour: 20
readonly property var appletInterface: root
+ readonly property bool hasHeader: Plasmoid.containmentDisplayHints & PlasmaCore.Types.ContainmentDrawsPlasmoidHeading
Layout.minimumWidth: Kirigami.Units.gridUnit * 12
Layout.minimumHeight: Kirigami.Units.gridUnit * 12
@@ -38,7 +39,11 @@ PlasmaExtras.Representation {
collapseMarginsHint: true
- Keys.onDownPressed: dndCheck.forceActiveFocus(Qt.TabFocusReason);
+ Keys.onDownPressed: {
+ if (dndCheck.visible) {
+ dndCheck.forceActiveFocus(Qt.TabFocusReason);
+ }
+ }
Connections {
target: root
@@ -51,6 +56,8 @@ PlasmaExtras.Representation {
}
header: PlasmaExtras.PlasmoidHeading {
+ visible: !fullRepresentation.hasHeader
+
ColumnLayout {
anchors {
fill: parent
@@ -255,7 +262,7 @@ PlasmaExtras.Representation {
readonly property alias wheelForwarder: wheelForwarder
- KeyNavigation.up: dndCheck
+ KeyNavigation.up: dndCheck.visible ? dndCheck : dndCheck.KeyNavigation.up
Keys.onDeletePressed: {
var idx = historyModel.index(currentIndex, 0);
diff --git a/applets/notifications/package/contents/ui/main.qml b/applets/notifications/package/contents/ui/main.qml
index 5b2cfa43ac8e1f5e67b5f2b2be94fd0635ffeaa7..6678874153c484a983f1e635202be3fdb8c3cc2a 100644
--- a/applets/notifications/package/contents/ui/main.qml
+++ b/applets/notifications/package/contents/ui/main.qml
@@ -228,17 +228,29 @@ PlasmoidItem {
id: clearHistory
text: i18n("Clear All Notifications")
icon.name: "edit-clear-history"
+ priority: PlasmaCore.Action.HighPriority
visible: historyModel.expiredNotificationsCount > 0
onTriggered: {
historyModel.clear(NotificationManager.Notifications.ClearExpired);
- // clear is async,
- historyModel.countChanged.connect(closeWhenCleared)
}
- function closeWhenCleared() {
- if (historyModel.count === 0) {
- closePlasmoid();
+ },
+ PlasmaCore.Action {
+ isSeparator: true
+ },
+ PlasmaCore.Action {
+ id: doNotDisturb
+ text: i18n("Do Not Disturb")
+ icon.name: "notifications-disabled"
+ priority: PlasmaCore.Action.HighPriority
+ checkable: true
+ checked: Globals.inhibited
+ onTriggered: (checked) => {
+ if (checked) {
+ notificationSettings.notificationsInhibitedUntil = new Date(8640000000000000);
+ notificationSettings.save();
+ } else {
+ Globals.revokeInhibitions();
}
- historyModel.countChanged.disconnect(closeWhenCleared)
}
}
]
diff --git a/applets/systemtray/package/contents/ui/ExpandedRepresentation.qml b/applets/systemtray/package/contents/ui/ExpandedRepresentation.qml
index 7a7df9b008ddaf2b6d0e823750c306efa9d5851b..5247ac76dc99c4d39432777bd6ad0d1c3f3bbaac 100644
--- a/applets/systemtray/package/contents/ui/ExpandedRepresentation.qml
+++ b/applets/systemtray/package/contents/ui/ExpandedRepresentation.qml
@@ -125,47 +125,26 @@ Item {
PlasmaComponents.ToolButton {
id: actionsButton
- visible: visibleActions > 0
- enabled: visibleActions > 1 || (singleAction && singleAction.enabled)
- checked: visibleActions > 1 ? configMenu.status !== PlasmaExtras.Menu.Closed : singleAction && singleAction.checked
+
property QtObject applet: systemTrayState.activeApplet || root
property int visibleActions: menuItemFactory.count
- property QtObject singleAction: visibleActions === 1 && menuItemFactory.object ? menuItemFactory.object.action : null
-
- icon.name: "application-menu"
- checkable: visibleActions > 1 || (singleAction && singleAction.checkable)
- contentItem.opacity: visibleActions > 1
-
- display: PlasmaComponents.AbstractButton.IconOnly
- text: actionsButton.singleAction ? actionsButton.singleAction.text : i18n("More actions")
-
- Accessible.role: actionsButton.singleAction ? Accessible.Button : Accessible.ButtonMenu
+ Accessible.role: Accessible.ButtonMenu
KeyNavigation.down: backButton.KeyNavigation.down
KeyNavigation.right: configureButton.visible ? configureButton : configureButton.KeyNavigation.right
- // NOTE: it needs a Kirigami.Icon because QtQuickControls2 buttons cannot load QIcons as their icon
- Kirigami.Icon {
- parent: actionsButton
- anchors.centerIn: parent
- active: actionsButton.hovered
- implicitWidth: Kirigami.Units.iconSizes.smallMedium
- implicitHeight: implicitWidth
- source: actionsButton.singleAction !== null ? actionsButton.singleAction.icon.name : ""
- visible: actionsButton.singleAction
- }
+ visible: visibleActions > 0
+ checkable: true
+ checked: configMenu.status !== PlasmaExtras.Menu.Closed
+ icon.name: "application-menu"
+ display: PlasmaComponents.AbstractButton.IconOnly
+ text: i18n("More actions")
+
onToggled: {
- if (visibleActions > 1) {
- if (checked) {
- configMenu.openRelative();
- } else {
- configMenu.close();
- }
- }
- }
- onClicked: {
- if (singleAction) {
- singleAction.trigger();
+ if (checked) {
+ configMenu.openRelative();
+ } else {
+ configMenu.close();
}
}
PlasmaComponents.ToolTip {
diff --git a/components/calendar/qml/DayDelegate.qml b/components/calendar/qml/DayDelegate.qml
index a22d3064d41b897f4c26bc466dcfa2dceee2b883..bc664a68b8e9eae82c51ebc7ab83371607c6fe0d 100644
--- a/components/calendar/qml/DayDelegate.qml
+++ b/components/calendar/qml/DayDelegate.qml
@@ -45,27 +45,6 @@ PlasmaComponents.AbstractButton {
required property int yearNumber
required property /*PlasmaCalendar.Calendar.DateMatchingPrecision*/int dateMatchingPrecision
- /*
- * The layout of this button is
- * [label]
- * [eventIndicatorsRow]
- * [subDayLabel]
- */
- property double mainLabelFontPixelSize: Math.max(
- Kirigami.Theme.defaultFont.pixelSize * 1.35 /* Level 1 Heading */,
- height / (dateMatchingPrecision === PlasmaCalendar.Calendar.MatchYearMonthAndDay ? 3 /* weeksColumn */ : 6))
- property double eventIndicatorsRowSize: Math.min(
- Kirigami.Units.smallSpacing,
- height / 6
- )
- // This is set to such that `subDayLabel` does not overlap with `label`
- // and `eventIndicatorsRow`.
- property double subDayLabelFontPixelSize: Math.min(
- Math.max(
- Kirigami.Theme.smallFont.pixelSize,
- height / (dateMatchingPrecision === PlasmaCalendar.Calendar.MatchYearMonthAndDay ? 6 : 12)),
- (height - mainLabelFontPixelSize) / 2 - eventIndicatorsRowSize
- )
objectName: {
switch (dateMatchingPrecision) {
@@ -174,7 +153,7 @@ PlasmaComponents.AbstractButton {
// and thus dateMatchingPrecision is PlasmaCalendar.Calendar.MatchYearMonthAndDay
active: dayStyle.model.eventCount !== undefined && dayStyle.model.eventCount > 0
anchors.bottom: parent.bottom
- anchors.bottomMargin: subDayLabel.item?.implicitHeight ?? Kirigami.Units.smallSpacing
+ anchors.bottomMargin: Kirigami.Units.mediumSpacing
anchors.horizontalCenter: parent.horizontalCenter
sourceComponent: Row {
id: eventIndicatorsRow
@@ -187,7 +166,7 @@ PlasmaComponents.AbstractButton {
delegate: Rectangle {
required property string eventColor
- width: dayStyle.eventIndicatorsRowSize
+ width: Kirigami.Units.mediumSpacing
height: width
radius: width / 2
color: eventColor
@@ -212,13 +191,10 @@ PlasmaComponents.AbstractButton {
PlasmaComponents.Label {
id: label
- anchors {
- left: parent.left
- right: parent.right
- top: parent.top
- bottom: parent.bottom
- }
- font.pixelSize: dayStyle.mainLabelFontPixelSize
+ anchors.fill: parent
+ font.pixelSize: Math.max(
+ Kirigami.Theme.defaultFont.pixelSize * 1.35 /* Level 1 Heading */,
+ dayStyle.height / (dayStyle.dateMatchingPrecision === PlasmaCalendar.Calendar.MatchYearMonthAndDay ? 3 /* weeksColumn */ : 6))
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: dayStyle.model.label || dayStyle.model.dayLabel
@@ -228,57 +204,6 @@ PlasmaComponents.AbstractButton {
elide: Text.ElideRight
}
- // This is always displayed to align the position of eventIndicatorsRow
- // even when it is empty.
- Loader {
- id: subDayLabel
- anchors {
- left: parent.left
- right: parent.right
- top: parent.bottom
- }
- asynchronous: true
- opacity: 0
-
- sourceComponent: PlasmaComponents.Label {
- elide: Text.ElideRight
- font.pixelSize: dayStyle.subDayLabelFontPixelSize
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- maximumLineCount: 1
- opacity: label.opacity
- // Prefer sublabel over day number
- text: dayStyle.model.subDayLabel || dayStyle.model.alternateDayNumber?.toString() || ''
- textFormat: Text.PlainText
- wrapMode: Text.NoWrap
- }
-
- states: State {
- when: subDayLabel.status === Loader.Ready && subDayLabel.implicitHeight > 1
- AnchorChanges {
- target: subDayLabel
- anchors.top: undefined
- anchors.bottom: subDayLabel.parent.bottom
- }
- PropertyChanges {
- target: subDayLabel
- opacity: 1
- }
- }
-
- transitions: Transition {
- NumberAnimation {
- property: "opacity"
- easing.type: Easing.OutCubic
- duration: Kirigami.Units.longDuration
- }
- AnchorAnimation {
- easing.type: Easing.OutCubic
- duration: Kirigami.Units.longDuration
- }
- }
- }
-
Component.onCompleted: {
if (dayStyle.today) {
root.todayAuxilliaryText = Qt.binding(() => dayStyle.model.subLabel || "");
diff --git a/klipper/declarative/qml/ClipboardMenu.qml b/klipper/declarative/qml/ClipboardMenu.qml
index 64f4440ecc7f207bec5bbbcd7d2be4780448e487..7d6c6105312435fa94e1eb8363066b1dbf37ae55 100644
--- a/klipper/declarative/qml/ClipboardMenu.qml
+++ b/klipper/declarative/qml/ClipboardMenu.qml
@@ -66,6 +66,13 @@ PlasmaComponents3.ScrollView {
}
onTriggerAction: uuid => model.invokeAction(uuid)
+ onExpandedChanged: {
+ if (expanded) {
+ view.currentIndex = 0;
+ filter.forceActiveFocus();
+ }
+ }
+
Keys.forwardTo: [clipboardMenu.T.StackView.view.currentItem]
Keys.onPressed: event => {
if (menuListView.count === 0 || clipboardMenu.T.StackView.view.currentItem !== clipboardMenu) {
diff --git a/klipper/declarative/qml/KlipperPopup.qml b/klipper/declarative/qml/KlipperPopup.qml
index 73783e8592ab8c857f3cb4a2432e55fb5d9e4fee..e7e23325dcb4df16922e69186d5b172fc3876870 100644
--- a/klipper/declarative/qml/KlipperPopup.qml
+++ b/klipper/declarative/qml/KlipperPopup.qml
@@ -16,8 +16,8 @@ import org.kde.kirigami as Kirigami
PlasmaExtras.Representation {
id: dialogItem
- implicitWidth: 100 // A friendly initial size
- implicitHeight: 100
+ implicitWidth: Kirigami.Units.gridUnit * 24
+ implicitHeight: implicitWidth
signal requestHidePopup()
@@ -28,21 +28,14 @@ PlasmaExtras.Representation {
Keys.onEscapePressed: requestHidePopup()
Keys.forwardTo: [stack.currentItem]
- Connections {
- target: dialogItem.Window.window
- function onVisibleChanged() {
- if (dialogItem.Window.window.visible) {
- // Break the bindings to avoid resizing loops due to screen changes
- dialogItem.implicitWidth = Math.max(Kirigami.Units.gridUnit * 15, Math.min(dialogItem.Screen.width / 4, Kirigami.Units.gridUnit * 40));
- dialogItem.implicitHeight = Math.min(dialogItem.Screen.height / 2, Kirigami.Units.gridUnit * 40);
- ((stack.initialItem as Private.ClipboardMenu).view as ListView).currentIndex = 0;
- ((stack.initialItem as Private.ClipboardMenu).view as ListView).positionViewAtBeginning();
- }
- }
- }
-
Private.HistoryModel {
id: historyModel
+
+ onCountChanged: {
+ if (count === 0) {
+ dialogItem.requestHidePopup();
+ }
+ }
}
QQC.StackView {
diff --git a/klipper/declarative/qml/TextItemDelegate.qml b/klipper/declarative/qml/TextItemDelegate.qml
index ccb2d756322baa6ab1329dfd19b4e5ca9442d6b0..baa39931ac93faa7906006f9cbc6fcaa9efb6c37 100644
--- a/klipper/declarative/qml/TextItemDelegate.qml
+++ b/klipper/declarative/qml/TextItemDelegate.qml
@@ -19,29 +19,24 @@ ClipboardItemDelegate {
verticalAlignment: Text.AlignVCenter
text: {
- if (!menuItem.model?.display) {
- return "";
+ let text = menuItem.model?.display?.slice(0, 1000) ?? "";
+ if (text.length > 0) {
+ for (const [regex, str] of [[/&/g, `&`], [/</g, `<`], [/>/g, `>`]]) {
+ text = text.replace(regex, str);
+ }
+ const color = Kirigami.Theme.highlightColor;
+ text = text.replace(/^\s+|\s+$/gm, (match1) => {
+ for (const [regex, str] of [[/ +/g, `␣`], [/\t+/g, `⇥`], [/\n+/g, `↵`]]) {
+ match1 = match1.replace(regex, (match2) => {
+ return `<font color='${color}'>${str.repeat(match2.length)}</font>`;
+ });
+ }
+ return match1;
+ });
+ text = text.replace(/\r\n|\r|\n/g, `<br>`);
}
- let highlightFontTag = "<font color='" + Kirigami.Theme.highlightColor + "'>%1</font>"
- let text = menuItem.model.display.slice(0, 100)
-
- // first escape any HTML characters to prevent privacy issues
- text = text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">")
-
- // color code leading or trailing whitespace
- // the first regex is basically "trim"
- text = text.replace(/^\s+|\s+$/gm, function(match) {
- // then inside the trimmed characters ("match") we replace each one individually
- match = match.replace(/ /g, "␣") // space
- .replace(/\t/g, "⇥") // tab
- .replace(/\n/g, "↵") // return
- return highlightFontTag.arg(match)
- })
-
- // finally turn line breaks into HTML br tags
- text = text.replace(/\r\n|\r|\n/g, "<br>")
-
- return text
+
+ return text;
}
elide: Text.ElideRight
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
diff --git a/klipper/klipperpopup.cpp b/klipper/klipperpopup.cpp
index 75b14d9a2ff2c2fadbc15c2ddb9d7a5b4c0863a4..41e3b575945980ff9d6f5938b506f75d7d8485a2 100644
--- a/klipper/klipperpopup.cpp
+++ b/klipper/klipperpopup.cpp
@@ -63,6 +63,8 @@ void KlipperPopup::hide()
void KlipperPopup::showEvent(QShowEvent *event)
{
+ resize(QSize(mainItem()->implicitWidth(), mainItem()->implicitHeight()).grownBy(padding()).boundedTo(screen()->availableSize()));
+
if (KWindowSystem::isPlatformX11()) {
KX11Extras::setOnAllDesktops(winId(), true);
}
@@ -91,17 +93,8 @@ void KlipperPopup::positionOnScreen()
void KlipperPopup::onObjectIncubated()
{
auto item = qobject_cast<QQuickItem *>(m_engine.rootObject());
- setMainItem(item);
-
- auto updateSize = [this]() {
- resize(QSize(mainItem()->implicitWidth(), mainItem()->implicitHeight()).grownBy(padding()).boundedTo(screen()->availableSize()));
- };
-
- connect(item, &QQuickItem::implicitHeightChanged, this, updateSize);
- connect(this, &KlipperPopup::paddingChanged, this, updateSize);
- updateSize();
-
connect(item, SIGNAL(requestHidePopup()), this, SLOT(hide()));
+ setMainItem(item);
}
void KlipperPopup::onFocusWindowChanged(QWindow *focusWindow)