diff --git a/applets/notifications/package/contents/ui/NotificationDelegate.qml b/applets/notifications/package/contents/ui/NotificationDelegate.qml --- a/applets/notifications/package/contents/ui/NotificationDelegate.qml +++ b/applets/notifications/package/contents/ui/NotificationDelegate.qml @@ -107,63 +107,12 @@ icon: appIcon image: model.image summary: model.summary + body: model.body configurable: model.configurable && !Settings.isMobile // model.actions JS array is implicitly turned into a ListModel which we can assign directly actions: model.actions created: model.created - textItem: MouseArea { - id: contextMouseArea - height: bodyText.paintedHeight - - acceptedButtons: Qt.RightButton - preventStealing: true - - onPressed: contextMenu.open(mouse.x, mouse.y) - - PlasmaComponents.ContextMenu { - id: contextMenu - visualParent: contextMouseArea - - PlasmaComponents.MenuItem { - text: i18n("Copy") - onClicked: bodyText.copy() - } - - PlasmaComponents.MenuItem { - text: i18n("Select All") - onClicked: bodyText.selectAll() - } - } - - TextEdit { - id: bodyText - anchors.fill: parent - - text: body - color: PlasmaCore.ColorScope.textColor - selectedTextColor: theme.viewBackgroundColor - selectionColor: theme.viewFocusColor - font.capitalization: theme.defaultFont.capitalization - font.family: theme.defaultFont.family - font.italic: theme.defaultFont.italic - font.letterSpacing: theme.defaultFont.letterSpacing - font.pointSize: theme.defaultFont.pointSize - font.strikeout: theme.defaultFont.strikeout - font.underline: theme.defaultFont.underline - font.weight: theme.defaultFont.weight - font.wordSpacing: theme.defaultFont.wordSpacing - renderType: Text.NativeRendering - enabled: !Settings.isMobile - selectByMouse: true - readOnly: true - wrapMode: Text.Wrap - textFormat: TextEdit.RichText - - onLinkActivated: Qt.openUrlExternally(link) - } - } - onClose: { if (notificationsModel.count > 1) { removeAnimation.running = true diff --git a/applets/notifications/package/contents/ui/NotificationItem.qml b/applets/notifications/package/contents/ui/NotificationItem.qml --- a/applets/notifications/package/contents/ui/NotificationItem.qml +++ b/applets/notifications/package/contents/ui/NotificationItem.qml @@ -39,12 +39,12 @@ signal configure signal action(string actionId) - property alias textItem: textItemLoader.sourceComponent property bool compact: false property alias icon: appIconItem.source property alias image: imageItem.image property alias summary: summaryLabel.text + property alias body: bodyText.text property alias configurable: settingsButton.visible property var created @@ -189,19 +189,67 @@ // If there is a big notification followed by a small one, the height // of the popup does not always shrink back, so this forces it to // height=0 when those are invisible. -1 means "default to implicitHeight" - Layout.maximumHeight: textItemLoader.visible || actionsColumn.visible ? -1 : 0 + Layout.maximumHeight: bodyText.visible || actionsColumn.visible ? -1 : 0 + + MouseArea { + id: contextMouseArea - Loader { - id: textItemLoader Layout.fillWidth: true - Layout.fillHeight: true - visible: textItemLoader.item && textItemLoader.item.text !== "" + anchors { leftMargin: units.smallSpacing * 2 rightMargin: units.smallSpacing * 2 } - } + implicitHeight: bodyText.paintedHeight + + acceptedButtons: Qt.RightButton + preventStealing: true + + onPressed: contextMenu.open(mouse.x, mouse.y) + + PlasmaComponents.ContextMenu { + id: contextMenu + visualParent: contextMouseArea + + PlasmaComponents.MenuItem { + text: i18n("Copy") + onClicked: bodyText.copy() + } + + PlasmaComponents.MenuItem { + text: i18n("Select All") + onClicked: bodyText.selectAll() + } + } + + TextEdit { + id: bodyText + enabled: !Settings.isMobile + anchors.fill: parent + visible: bodyText.length !== 0 + + color: PlasmaCore.ColorScope.textColor + selectedTextColor: theme.viewBackgroundColor + selectionColor: theme.viewFocusColor + font.capitalization: theme.defaultFont.capitalization + font.family: theme.defaultFont.family + font.italic: theme.defaultFont.italic + font.letterSpacing: theme.defaultFont.letterSpacing + font.pointSize: theme.defaultFont.pointSize + font.strikeout: theme.defaultFont.strikeout + font.underline: theme.defaultFont.underline + font.weight: theme.defaultFont.weight + font.wordSpacing: theme.defaultFont.wordSpacing + renderType: Text.NativeRendering + selectByMouse: true + readOnly: true + wrapMode: Text.Wrap + textFormat: TextEdit.RichText + + onLinkActivated: Qt.openUrlExternally(link) + } + } ColumnLayout { id: actionsColumn diff --git a/applets/notifications/package/contents/ui/NotificationPopup.qml b/applets/notifications/package/contents/ui/NotificationPopup.qml --- a/applets/notifications/package/contents/ui/NotificationPopup.qml +++ b/applets/notifications/package/contents/ui/NotificationPopup.qml @@ -99,10 +99,9 @@ NotificationItem { id: notificationItem - property string text summary: notificationProperties ? notificationProperties.summary: "" - text: notificationProperties ? notificationProperties.body : "" + body: notificationProperties ? notificationProperties.body : "" icon: notificationProperties ? notificationProperties.appIcon : "" image: notificationProperties ? notificationProperties.image : undefined configurable: (notificationProperties ? notificationProperties.configurable : false) && !Settings.isMobile @@ -112,16 +111,6 @@ width: Math.round(23 * units.gridUnit) - textItem: PlasmaComponents.Label { - wrapMode: Text.WrapAtWordBoundaryOrAnywhere - elide: Text.ElideRight - verticalAlignment: Text.AlignTop - onLinkActivated: Qt.openUrlExternally(link) - text: notificationItem.text - textFormat: Text.StyledText - maximumLineCount: 4 - } - onClose: { closeNotification(notificationProperties.source) notificationPopup.hide()