Commit 30077146 authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇

[Notes applet] Wrap in FocusScope

Allows to leverage FocusScope's activeFocus property to determin whether we the text field or
formatting buttons have focus.

Differential Revision: https://phabricator.kde.org/D6575
parent bb474d52
......@@ -124,17 +124,22 @@ PlasmaCore.SvgItem {
selectionEnd: mainTextArea.selectionEnd
}
FocusScope {
id: focusScope
anchors {
fill: parent
leftMargin: horizontalMargins
rightMargin: horizontalMargins
topMargin: verticalMargins
bottomMargin: verticalMargins
}
PlasmaComponents.TextArea {
id: mainTextArea
anchors {
top: parent.top
left: parent.left
right: parent.right
leftMargin: horizontalMargins
rightMargin: horizontalMargins
topMargin: verticalMargins
bottom: fontButtons.top
bottomMargin: Math.round(units.largeSpacing / 2)
}
......@@ -227,9 +232,6 @@ PlasmaCore.SvgItem {
bottom: parent.bottom
left: parent.left
right: parent.right
leftMargin: horizontalMargins
rightMargin: horizontalMargins
bottomMargin: verticalMargins
}
readonly property int requiredWidth: formatButtonsRow.width + spacing + settingsButton.width
......@@ -239,24 +241,7 @@ PlasmaCore.SvgItem {
id: formatButtonsRow
spacing: units.smallSpacing
// show format buttons if TextField or any of the buttons have focus
opacity: {
if (!fontButtons.showFormatButtons) {
return 0;
}
if (mainTextArea.activeFocus || settingsButton.activeFocus) {
return 1;
}
for (var i = 0; i < children.length; ++i) {
if (children[i].activeFocus) {
return 1;
}
}
return 0;
}
opacity: fontButtons.showFormatButtons && focusScope.activeFocus ? 1 : 0
Behavior on opacity { NumberAnimation { duration: units.longDuration } }
enabled: opacity > 0
......@@ -305,6 +290,7 @@ PlasmaCore.SvgItem {
Accessible.name: tooltip
}
}
}
Component.onCompleted: {
plasmoid.setAction("change_note_color_white", i18n("White"));
......
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