yout fixes

This commit is contained in:
Marco Martin 2015-05-15 18:53:41 +02:00
parent 5179b04a68
commit 3906520241

View file

@ -17,7 +17,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
import QtQuick 2.0 import QtQuick 2.4
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
@ -27,7 +27,7 @@ MouseArea {
id: notificationItem id: notificationItem
height: Math.max(summaryText.height, icon.height) + background.margins.top + background.margins.bottom + (expanded ? actionsLayout.height : 0) height: Math.max(messageLayout.height, icon.height) + background.margins.top + background.margins.bottom + (expanded ? actionsLayout.height : 0)
width: parent.width width: parent.width
anchors.bottomMargin: 10 anchors.bottomMargin: 10
drag.axis: Drag.XAxis drag.axis: Drag.XAxis
@ -96,6 +96,7 @@ MouseArea {
} }
PlasmaComponents.Label { PlasmaComponents.Label {
id: appLabel
anchors { anchors {
left: parent.left left: parent.left
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
@ -105,18 +106,37 @@ MouseArea {
text: model.appName text: model.appName
} }
PlasmaComponents.Label { Column {
id: summaryText id: messageLayout
anchors { anchors {
left: appLabel.right
right: icon.left right: icon.left
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
rightMargin: units.smallSpacing rightMargin: units.smallSpacing
} }
horizontalAlignment: Qt.AlignRight
verticalAlignment: Qt.AlignVCenter PlasmaComponents.Label {
color: PlasmaCore.ColorScope.textColor anchors {
text: summary + (notificationItem.expanded ? (body ? "\n" + body : '') : right: parent.right
(body ? '...' : '')) left: parent.left
}
horizontalAlignment: Qt.AlignRight
verticalAlignment: Qt.AlignVCenter
text: summary + (!notificationItem.expanded && body ? "..." : "")
wrapMode: Text.WordWrap
}
PlasmaComponents.Label {
anchors {
right: parent.right
left: parent.left
}
visible: notificationItem.expanded && body != undefined && body
horizontalAlignment: Qt.AlignRight
verticalAlignment: Qt.AlignVCenter
text: body
wrapMode: Text.WordWrap
}
} }
PlasmaCore.IconItem { PlasmaCore.IconItem {
@ -127,13 +147,13 @@ MouseArea {
} }
width: units.iconSizes.medium width: units.iconSizes.medium
height: width height: width
source: appIcon && appIcon.length > 0 ? appIcon : "im-user" source: appIcon && appIcon.length > 0 ? appIcon : "preferences-desktop-notification"
} }
RowLayout { RowLayout {
id: actionsLayout id: actionsLayout
anchors { anchors {
right: summaryText.right right: messageLayout.right
top: summaryText.bottom top: messageLayout.bottom
topMargin: units.smallSpacing topMargin: units.smallSpacing
} }
opacity: notificationItem.expanded && notificationItem.actions && notificationItem.actions.count > 0 ? 1 : 0 opacity: notificationItem.expanded && notificationItem.actions && notificationItem.actions.count > 0 ? 1 : 0