Commit 6b809a15 authored by Bharadwaj Raju's avatar Bharadwaj Raju
Browse files

colorpicker: Make left-clicking a color copy in the default format

Also add a small "Copied!" message

BUG: 457311


(cherry picked from commit 3f3e3e9c)
parent 21e864bb
Pipeline #244136 passed with stage
in 3 minutes and 12 seconds
......@@ -379,8 +379,15 @@ Item {
}
onClicked: {
formattingMenu.model = Logic.menuForColor(delegateMouse.currentColor)
formattingMenu.open(0, rect.height)
if (mouse.button === Qt.LeftButton) {
picker.copyToClipboard(Logic.formatColor(delegateMouse.currentColor, root.defaultFormat))
colorLabel.visible = false;
copyIndicatorLabel.visible = true;
colorLabelRestoreTimer.start()
} else {
formattingMenu.model = Logic.menuForColor(delegateMouse.currentColor)
formattingMenu.open(0, rect.height)
}
}
function remove() {
......@@ -394,6 +401,15 @@ Item {
mainText: colorLabel.text
}
Timer {
id: colorLabelRestoreTimer
interval: Kirigami.Units.humanMoment
onTriggered: {
colorLabel.visible = true;
copyIndicatorLabel.visible = false;
}
}
Rectangle {
id: rect
......@@ -430,11 +446,28 @@ Item {
minimumPointSize: PlasmaCore.Theme.smallestFont.pointSize
text: Logic.formatColor(delegateMouse.currentColor, root.defaultFormat)
}
PlasmaComponents3.Label {
id: copyIndicatorLabel
visible: false
anchors.fill: parent
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
elide: Text.ElideLeft
fontSizeMode: Text.HorizontalFit
minimumPointSize: PlasmaCore.Theme.smallestFont.pointSize
text: i18nc("@info:progress just copied a color to clipboard", "Copied!")
}
}
PlasmaComponents.ModelContextMenu {
id: formattingMenu
onClicked: picker.copyToClipboard(model.text)
onClicked: {
picker.copyToClipboard(model.text)
colorLabel.visible = false;
copyIndicatorLabel.visible = true;
colorLabelRestoreTimer.start()
}
}
}
......
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