Use plasma TextArea for sharing text in plasmoid

Summary:
This also fixes a bug where the box could be too small.
BUG: 400862

Reviewers: #kde_connect, nicolasfella

Reviewed By: #kde_connect, nicolasfella

Subscribers: nicolasfella, sredman, apol, kdeconnect

Tags: #kde_connect

Differential Revision: https://phabricator.kde.org/D16782
This commit is contained in:
Billy Laws 2018-11-09 18:06:35 +00:00
parent e26af48062
commit 9fc55c72f0

View file

@ -22,9 +22,8 @@ import QtQuick 2.1
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.components 3.0 as PlasmaComponents3
import org.kde.kdeconnect 1.0 import org.kde.kdeconnect 1.0
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import QtQuick.Dialogs 1.0 import QtQuick.Dialogs 1.0
import QtQuick.Controls 2.4 import QtQuick.Controls 2.4
@ -250,11 +249,9 @@ PlasmaComponents.ListItem
PlasmaComponents.Label { PlasmaComponents.Label {
text: i18n("Share text") text: i18n("Share text")
} }
TextArea { PlasmaComponents3.TextArea {
id: shareText id: shareText
wrapMode: TextEdit.NoWrap width: parent.width
width: parent.width;
height: Math.max(shareText.contentHeight + shareText.textMargin * 3, shareText.textMargin * 7 + shareText.font.pixelSize)
} }
PlasmaComponents.Button PlasmaComponents.Button
{ {
@ -262,7 +259,8 @@ PlasmaComponents.ListItem
anchors.right: shareText.right anchors.right: shareText.right
iconSource: "document-send" iconSource: "document-send"
onClicked: { onClicked: {
share.plugin.shareText(shareText.getText(0, shareText.length)) share.plugin.shareText(shareText.getText(0, shareText.length))
shareText.clear()
} }
} }
//NOTE: More information could be displayed here //NOTE: More information could be displayed here