Commit 7a4ea26a authored by Eugene Popov's avatar Eugene Popov Committed by Nate Graham
Browse files

Automatically close Clipboard applet after clearing history or deleting the last element

It would be correct to close the Clipboard applet after clearing the history or deleting the last element, since there is nothing more to do with the empty Clipboard applet (similar to how the Notification applet closes after the last notification is removed).

BUG: 421345
FIXED-IN: 5.20

Reviewers: ngraham, #plasma, broulik

Reviewed By: ngraham

Subscribers: plasma-devel

Tags: #plasma

Differential Revision:
parent ead848c6
...@@ -28,11 +28,13 @@ import org.kde.plasma.extras 2.0 as PlasmaExtras ...@@ -28,11 +28,13 @@ import org.kde.plasma.extras 2.0 as PlasmaExtras
Item { Item {
id: main id: main
property bool isClipboardEmpty:["clipboard"]["empty"]
Plasmoid.switchWidth: units.gridUnit * 5 Plasmoid.switchWidth: units.gridUnit * 5
Plasmoid.switchHeight: units.gridUnit * 5 Plasmoid.switchHeight: units.gridUnit * 5
Plasmoid.status:["clipboard"]["empty"] ? PlasmaCore.Types.PassiveStatus : PlasmaCore.Types.ActiveStatus Plasmoid.status: PlasmaCore.Types.PassiveStatus
Plasmoid.toolTipMainText: i18n("Clipboard Contents") Plasmoid.toolTipMainText: i18n("Clipboard Contents")
Plasmoid.toolTipSubText:["clipboard"]["empty"] ? i18n("Clipboard is empty") :["clipboard"]["current"] Plasmoid.toolTipSubText: isClipboardEmpty ? i18n("Clipboard is empty") :["clipboard"]["current"]
Plasmoid.toolTipTextFormat: Text.PlainText Plasmoid.toolTipTextFormat: Text.PlainText
Plasmoid.icon: "klipper" Plasmoid.icon: "klipper"
...@@ -40,6 +42,18 @@ Item { ...@@ -40,6 +42,18 @@ Item {
clipboardSource.service("", "configureKlipper"); clipboardSource.service("", "configureKlipper");
} }
onIsClipboardEmptyChanged: {
if (isClipboardEmpty) {
// We need to hide the applet before changing its status to passive
// because only the active applet can hide itself
if (plasmoid.hideOnWindowDeactivate)
plasmoid.expanded = false;
Plasmoid.status = PlasmaCore.Types.PassiveStatus;
} else {
Plasmoid.status = PlasmaCore.Types.ActiveStatus
Component.onCompleted: { Component.onCompleted: {
plasmoid.removeAction("configure"); plasmoid.removeAction("configure");
plasmoid.setAction("configure", i18n("Configure Clipboard..."), "configure", "alt+d, s"); plasmoid.setAction("configure", i18n("Configure Clipboard..."), "configure", "alt+d, s");
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment