Skip to content

Commit

Permalink
Fix weird Plasma freeze when selecting command action from settings
Browse files Browse the repository at this point in the history
It's good to have larger input field anyway
  • Loading branch information
luisbocanegra committed May 29, 2024
1 parent 8ad585a commit 6efdfe6
Showing 1 changed file with 91 additions and 97 deletions.
188 changes: 91 additions & 97 deletions package/contents/ui/components/GroupedActions.qml
Original file line number Diff line number Diff line change
Expand Up @@ -43,23 +43,18 @@ ColumnLayout {
}

// Command area
RowLayout {
ColumnLayout {
visible: actionCombo.componentValue == "custom_command"

TextArea {
wrapMode: TextArea.Wrap
topPadding: activeFocus?6:10
bottomPadding: activeFocus?22:10
leftPadding: 10
rightPadding: 10
topPadding: activeFocus ? 6 : undefined
bottomPadding: activeFocus ? 22 : undefined
id: commandTextArea
Layout.fillWidth: true
selectByMouse: true
placeholderText: qsTr("Enter shell command or pick a executable")

onTextChanged: internalValue.value = text
persistentSelection: false

// cursor position
property int cursorLine: 1 + text.substring(0, cursorPosition).split("\n").length - 1
property int cursorColumn: cursorPosition - text.lastIndexOf("\n", cursorPosition - 1)
Expand All @@ -75,43 +70,45 @@ ColumnLayout {
opacity: parent.activeFocus?.6:0
}
}

Button {
id:btnCmdCopy
icon.name: "edit-copy"
onClicked: {
if (commandTextArea.text.length > 0){
commandTextArea.selectAll()
commandTextArea.copy()
RowLayout {
Item { Layout.fillWidth: true }
Button {
id:btnCmdCopy
icon.name: "edit-copy"
onClicked: {
if (commandTextArea.text.length > 0){
commandTextArea.selectAll()
commandTextArea.copy()
}
}
}
}

Button {
id:btnCmdPaste
icon.name: "edit-paste"
onClicked: {
commandTextArea.text=""
commandTextArea.paste()
internalValue.value = commandTextArea.text
Button {
id:btnCmdPaste
icon.name: "edit-paste"
onClicked: {
commandTextArea.text=""
commandTextArea.paste()
internalValue.value = commandTextArea.text
}
}
}

Button {
id: btnExecutable
icon.name: "document-open"
ToolTip.delay: 1000
ToolTip.visible: hovered
ToolTip.text: "Pick a executable file"
onClicked: {
fileDialogExec.open()
Button {
id: btnExecutable
icon.name: "document-open"
ToolTip.delay: 1000
ToolTip.visible: hovered
ToolTip.text: "Pick a executable file"
onClicked: {
fileDialogExec.open()
}
}
}

Button {
id:btnCmdClean
icon.name: "document-cleanup"
onClicked: commandTextArea.text = ""
Button {
id:btnCmdClean
icon.name: "document-cleanup"
onClicked: commandTextArea.text = ""
}
}
}

Expand All @@ -124,7 +121,6 @@ ColumnLayout {
btnAddLauncher.text = launcher.applicationName + " - Tap to change"
btnAddLauncher.applicationUrl = url
btnAddLauncher.icon.name = launcher.iconName || "fork"

hiddenAppText.text = url
}
}
Expand All @@ -143,76 +139,76 @@ ColumnLayout {
}


RowLayout {
ColumnLayout {
visible: actionCombo.componentValue == "launch_application"
RowLayout {
Button {
id: btnAddLauncher
property string applicationUrl: ""

Button {
id: btnAddLauncher
property string applicationUrl: ""

onClicked: {
logic.addLauncher()
}
onClicked: {
logic.addLauncher()
}

Component.onCompleted: {
updateAppButton(applicationUrlValue)
hiddenAppText.text = applicationUrlValue
Component.onCompleted: {
updateAppButton(applicationUrlValue)
hiddenAppText.text = applicationUrlValue
}
}
}

TextArea {
id: hiddenAppText
topPadding: 10
bottomPadding: 10
leftPadding: 10
rightPadding: 10
placeholderText: qsTr("Enter URL or pick a file")
Layout.fillWidth: true
onTextChanged: {
updateAppButton(text)
btnAddLauncher.applicationUrl = hiddenAppText.text
TextArea {
id: hiddenAppText
placeholderText: qsTr("Enter URL or pick a file")
Layout.fillWidth: true
onTextChanged: {
updateAppButton(text)
btnAddLauncher.applicationUrl = hiddenAppText.text
}
}
}

Button {
id:btnAppCopy
icon.name: "edit-copy"
onClicked: {
if (hiddenAppText.text.length > 0) {
hiddenAppText.selectAll()
hiddenAppText.copy()
RowLayout {
Item { Layout.fillWidth: true }
Button {
id:btnAppCopy
icon.name: "edit-copy"
onClicked: {
if (hiddenAppText.text.length > 0) {
hiddenAppText.selectAll()
hiddenAppText.copy()
}
}
}
}

Button {
id:btnAppPaste
icon.name: "edit-paste"
onClicked: {
hiddenAppText.text=""
hiddenAppText.paste()
btnAddLauncher.applicationUrl = hiddenAppText.text
Button {
id:btnAppPaste
icon.name: "edit-paste"
onClicked: {
hiddenAppText.text=""
hiddenAppText.paste()
btnAddLauncher.applicationUrl = hiddenAppText.text
}
}
}

Button {
id: btnUrl
icon.name: "document-open"
ToolTip.delay: 1000
ToolTip.visible: hovered
ToolTip.text: "Pick a file"
onClicked: {
fileDialogUrl.open()
Button {
id: btnUrl
icon.name: "document-open"
ToolTip.delay: 1000
ToolTip.visible: hovered
ToolTip.text: "Pick a file"
onClicked: {
fileDialogUrl.open()
}
}
}

Button {
id:btnUrlClean
icon.name: "document-cleanup"
onClicked: {
btnAddLauncher.applicationUrl = ""
btnAddLauncher.text = "Choose an Application"
hiddenAppText.text=""
Button {
id:btnUrlClean
icon.name: "document-cleanup"
onClicked: {
btnAddLauncher.applicationUrl = ""
btnAddLauncher.text = "Choose an Application"
hiddenAppText.text=""
}
}
}
}
Expand All @@ -225,8 +221,6 @@ ColumnLayout {
FileDialog {
id: fileDialogUrl
onAccepted: {
// btnAddLauncher.applicationUrl = fileDialogExec.fileUrl.toString()
// updateAppButton(applicationUrlValue)
hiddenAppText.text = fileDialogUrl.fileUrl.toString()
}
}
Expand Down

0 comments on commit 6efdfe6

Please sign in to comment.