[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [plasma-workspace] applets/digital-clock/package/contents/ui: [Digital Clock] Add tooltip for agenda
From:       Kai Uwe Broulik <null () kde ! org>
Date:       2018-01-04 8:24:27
Message-ID: E1eX0p9-0008J0-CX () code ! kde ! org
[Download RAW message or body]

Git commit 59ba8b8f4c5ff820d7f9b1b8bc7d9d3b2b2cfee1 by Kai Uwe Broulik.
Committed on 04/01/2018 at 08:23.
Pushed by broulik into branch 'master'.

[Digital Clock] Add tooltip for agenda items with too long description

Also, when an appointment has no description, let the title use both lines of text,
and center them vertically if it doesn't need both lines.
The tooltip is only enabled if the title is actually elided, otherwise it could be \
bothersome to have.

BUG: 378970
FIXED-IN: 5.12.0

Differential Revision: https://phabricator.kde.org/D9641

M  +96   -83   applets/digital-clock/package/contents/ui/CalendarView.qml

https://commits.kde.org/plasma-workspace/59ba8b8f4c5ff820d7f9b1b8bc7d9d3b2b2cfee1

diff --git a/applets/digital-clock/package/contents/ui/CalendarView.qml \
b/applets/digital-clock/package/contents/ui/CalendarView.qml index 533346da..e1a2a79a \
                100644
--- a/applets/digital-clock/package/contents/ui/CalendarView.qml
+++ b/applets/digital-clock/package/contents/ui/CalendarView.qml
@@ -217,90 +217,103 @@ Item {
                         return true;
                     }
 
-                    GridLayout {
-                        columns: 3
-                        rows: 2
-                        rowSpacing: 0
-                        columnSpacing: 2 * units.smallSpacing
-
+                    PlasmaCore.ToolTipArea {
                         width: parent.width
-
-                        Rectangle {
-                            id: eventColor
-
-                            Layout.row: 0
-                            Layout.column: 0
-                            Layout.rowSpan: 2
-                            Layout.fillHeight: true
-
-                            color: modelData.eventColor
-                            width: 5 * units.devicePixelRatio
-                            visible: modelData.eventColor !== ""
-                        }
-
-                        PlasmaComponents.Label {
-                            id: startTimeLabel
-
-                            readonly property bool startsToday: \
                modelData.startDateTime - monthView.currentDate >= 0
-                            readonly property bool \
startedYesterdayLessThan12HoursAgo: modelData.startDateTime - monthView.currentDate \
                >= -43200000 //12hrs in ms
-
-                            Layout.row: 0
-                            Layout.column: 1
-                            Layout.minimumWidth: dateLabelMetrics.width
-
-                            text: startsToday || startedYesterdayLessThan12HoursAgo
-                                    ? Qt.formatTime(modelData.startDateTime)
-                                    : \
                agenda.formatDateWithoutYear(modelData.startDateTime)
-                            horizontalAlignment: Qt.AlignRight
-                            visible: eventItem.hasTime
-                        }
-
-                        PlasmaComponents.Label {
-                            id: endTimeLabel
-
-                            readonly property bool endsToday: modelData.endDateTime \
                - monthView.currentDate <= 86400000 // 24hrs in ms
-                            readonly property bool endsTomorrowInLessThan12Hours: \
                modelData.endDateTime - monthView.currentDate <= 86400000 + 43200000 \
                // 36hrs in ms
-
-                            Layout.row: 1
-                            Layout.column: 1
-                            Layout.minimumWidth: dateLabelMetrics.width
-
-                            text: endsToday || endsTomorrowInLessThan12Hours
-                                    ? Qt.formatTime(modelData.endDateTime)
-                                    : \
                agenda.formatDateWithoutYear(modelData.endDateTime)
-                            horizontalAlignment: Qt.AlignRight
-                            enabled: false
-
-                            visible: eventItem.hasTime
-                        }
-
-                        PlasmaComponents.Label {
-                            id: eventTitle
-
-                            Layout.row: 0
-                            Layout.column: 2
-                            Layout.fillWidth: true
-
-                            font.weight: Font.Bold
-                            elide: Text.ElideRight
-                            text: modelData.title
-                            verticalAlignment: Text.AlignVCenter
-                        }
-
-                        PlasmaComponents.Label {
-                            id: eventDescription
-
-                            Layout.row: 1
-                            Layout.column: 2
-                            Layout.fillWidth: true
-
-                            elide: Text.ElideRight
-                            text: modelData.description
-                            verticalAlignment: Text.AlignVCenter
-                            maximumLineCount: 1
-                            enabled: false
-
-                            visible: text !== ""
+                        height: eventGrid.height
+                        active: eventTitle.truncated || eventDescription.truncated
+                        mainText: active ? eventTitle.text : ""
+                        subText: active ? eventDescription.text : ""
+
+                        GridLayout {
+                            id: eventGrid
+                            columns: 3
+                            rows: 2
+                            rowSpacing: 0
+                            columnSpacing: 2 * units.smallSpacing
+
+                            width: parent.width
+
+                            Rectangle {
+                                id: eventColor
+
+                                Layout.row: 0
+                                Layout.column: 0
+                                Layout.rowSpan: 2
+                                Layout.fillHeight: true
+
+                                color: modelData.eventColor
+                                width: 5 * units.devicePixelRatio
+                                visible: modelData.eventColor !== ""
+                            }
+
+                            PlasmaComponents.Label {
+                                id: startTimeLabel
+
+                                readonly property bool startsToday: \
modelData.startDateTime - monthView.currentDate >= 0 +                                \
readonly property bool startedYesterdayLessThan12HoursAgo: modelData.startDateTime - \
monthView.currentDate >= -43200000 //12hrs in ms +
+                                Layout.row: 0
+                                Layout.column: 1
+                                Layout.minimumWidth: dateLabelMetrics.width
+
+                                text: startsToday || \
startedYesterdayLessThan12HoursAgo +                                        ? \
Qt.formatTime(modelData.startDateTime) +                                        : \
agenda.formatDateWithoutYear(modelData.startDateTime) +                               \
horizontalAlignment: Qt.AlignRight +                                visible: \
eventItem.hasTime +                            }
+
+                            PlasmaComponents.Label {
+                                id: endTimeLabel
+
+                                readonly property bool endsToday: \
modelData.endDateTime - monthView.currentDate <= 86400000 // 24hrs in ms +            \
readonly property bool endsTomorrowInLessThan12Hours: modelData.endDateTime - \
monthView.currentDate <= 86400000 + 43200000 // 36hrs in ms +
+                                Layout.row: 1
+                                Layout.column: 1
+                                Layout.minimumWidth: dateLabelMetrics.width
+
+                                text: endsToday || endsTomorrowInLessThan12Hours
+                                        ? Qt.formatTime(modelData.endDateTime)
+                                        : \
agenda.formatDateWithoutYear(modelData.endDateTime) +                                \
horizontalAlignment: Qt.AlignRight +                                enabled: false
+
+                                visible: eventItem.hasTime
+                            }
+
+                            PlasmaComponents.Label {
+                                id: eventTitle
+
+                                readonly property bool wrap: eventDescription.text \
=== "" +
+                                Layout.row: 0
+                                Layout.rowSpan: wrap ? 2 : 1
+                                Layout.column: 2
+                                Layout.fillWidth: true
+
+                                font.weight: Font.Bold
+                                elide: Text.ElideRight
+                                text: modelData.title
+                                verticalAlignment: Text.AlignVCenter
+                                maximumLineCount: 2
+                                wrapMode: wrap ? Text.Wrap : Text.NoWrap
+                            }
+
+                            PlasmaComponents.Label {
+                                id: eventDescription
+
+                                Layout.row: 1
+                                Layout.column: 2
+                                Layout.fillWidth: true
+
+                                elide: Text.ElideRight
+                                text: modelData.description
+                                verticalAlignment: Text.AlignVCenter
+                                enabled: false
+
+                                visible: text !== ""
+                            }
                         }
                     }
                 }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic