diff --git a/applets/digital-clock/package/contents/ui/CalendarView.qml b/applets/digital-clock/package/contents/ui/CalendarView.qml --- a/applets/digital-clock/package/contents/ui/CalendarView.qml +++ b/applets/digital-clock/package/contents/ui/CalendarView.qml @@ -217,90 +217,103 @@ 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 !== "" + } } } }