Commit 6ab837e8 authored by Nate Graham's avatar Nate Graham
Browse files

[applets/clipboard] Make "Clear History" action a real action

This yields several benefits:
- The action automatically goes into the header in the system tray
  representation, which improves the presentation
- We get a context menu action for it for free, which is a nice
  accelerator for experts
parent 02f21007
......@@ -86,8 +86,17 @@ ColumnLayout {
placeholderText: i18n("Search...")
clearButtonShown: true
Layout.fillWidth: true
Connections {
target: main
function onClearSearchField() {
filter.clear()
}
}
}
PlasmaComponents3.ToolButton {
visible: plasmoid.containmentType !== PlasmaCore.Types.CustomEmbeddedContainment
icon.name: "edit-clear-history"
onClicked: {
clipboardSource.service("", "clearHistory")
......
......@@ -30,6 +30,8 @@ Item {
property bool isClipboardEmpty: clipboardSource.data["clipboard"]["empty"]
signal clearSearchField
Plasmoid.switchWidth: units.gridUnit * 5
Plasmoid.switchHeight: units.gridUnit * 5
Plasmoid.status: isClipboardEmpty ? PlasmaCore.Types.PassiveStatus : PlasmaCore.Types.ActiveStatus
......@@ -42,6 +44,11 @@ Item {
clipboardSource.service("", "configureKlipper");
}
function action_clearHistory() {
clipboardSource.service("", "clearHistory")
clearSearchField()
}
onIsClipboardEmptyChanged: {
if (isClipboardEmpty) {
// We need to hide the applet before changing its status to passive
......@@ -54,9 +61,12 @@ Item {
}
}
Component.onCompleted: {
plasmoid.removeAction("configure");
plasmoid.setAction("configure", i18n("Configure Clipboard..."), "configure", "alt+d, s");
plasmoid.setAction("clearHistory", i18n("Clear History"), "edit-clear-history");
}
PlasmaCore.DataSource {
......
Supports Markdown
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