mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
Move from a C++ library + QML plugin to a QML plugin only for simplicity, since the homescreen switching architecture will be done from Plasma, and so use of the shell library only needs to be from QML.
59 lines
1.6 KiB
QML
59 lines
1.6 KiB
QML
|
|
/*
|
|
SPDX-FileCopyrightText: 2019 Kai Uwe Broulik <kde@broulik.de>
|
|
|
|
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
|
*/
|
|
|
|
import QtQuick 2.8
|
|
import QtQuick.Layouts 1.1
|
|
|
|
import org.kde.plasma.core 2.0 as PlasmaCore
|
|
import org.kde.plasma.components 3.0 as PlasmaComponents3
|
|
|
|
RowLayout {
|
|
id: replyRow
|
|
|
|
signal beginReplyRequested
|
|
signal replied(string text)
|
|
|
|
property bool replying: false
|
|
|
|
property alias text: replyTextField.text
|
|
property string placeholderText
|
|
property string buttonIconName
|
|
property string buttonText
|
|
|
|
spacing: PlasmaCore.Units.smallSpacing
|
|
|
|
function activate() {
|
|
replyTextField.forceActiveFocus();
|
|
}
|
|
|
|
PlasmaComponents3.TextField {
|
|
id: replyTextField
|
|
Layout.fillWidth: true
|
|
placeholderText: replyRow.placeholderText || i18nc("Text field placeholder", "Type a reply…")
|
|
onAccepted: {
|
|
if (replyButton.enabled) {
|
|
replyRow.replied(text);
|
|
}
|
|
}
|
|
|
|
// Catches mouse click when reply field is already shown to start a reply
|
|
MouseArea {
|
|
anchors.fill: parent
|
|
cursorShape: Qt.IBeamCursor
|
|
visible: !replyRow.replying
|
|
onPressed: replyRow.beginReplyRequested()
|
|
}
|
|
}
|
|
|
|
PlasmaComponents3.Button {
|
|
id: replyButton
|
|
icon.name: replyRow.buttonIconName || "document-send"
|
|
text: replyRow.buttonText || i18nc("@action:button", "Send")
|
|
enabled: replyTextField.length > 0
|
|
onClicked: replyRow.replied(replyTextField.text)
|
|
}
|
|
}
|