diff --git a/src/contents/ui/EventEditor.qml b/src/contents/ui/EventEditor.qml index e2659bf5a4fd04810eca077e11cef8dc322705af..870bec9f49a8934d74c974815a5be37981f062d3 100644 --- a/src/contents/ui/EventEditor.qml +++ b/src/contents/ui/EventEditor.qml @@ -93,6 +93,7 @@ Kirigami.OverlaySheet { displayText: i18n("Please select a calendar...") // Should default to default collection + // Should also only show *calendars* model: CalendarManager.collections delegate: Kirigami.BasicListItem { leftPadding: Kirigami.Units.largeSpacing * kDescendantLevel @@ -309,45 +310,55 @@ Kirigami.OverlaySheet { import QtQuick.Layouts 1.15 import org.kde.kirigami 2.15 as Kirigami - QQC2.ComboBox { - id: remindersComboBox${buttonIndex} + + RowLayout { Layout.fillWidth: true - function secondsToReminderLabel(seconds) { - if (seconds) { - var numAndUnit = ( - seconds >= 2 * 24 * 60 * 60 ? Math.round(seconds / (24*60*60)) + " days" : // 2 days + - seconds >= 1 * 24 * 60 * 60 ? "1 day" : - seconds >= 2 * 60 * 60 ? Math.round(seconds / (60*60)) + " hours" : // 2 hours + - seconds >= 1 * 60 * 60 ? "1 hour" : - Math.round(seconds / 60) + " minutes") - return numAndUnit + " before"; - } else { - return "On event start"; + QQC2.ComboBox { + id: remindersComboBox${buttonIndex} + Layout.fillWidth: true + + function secondsToReminderLabel(seconds) { + if (seconds) { + var numAndUnit = ( + seconds >= 2 * 24 * 60 * 60 ? Math.round(seconds / (24*60*60)) + " days" : // 2 days + + seconds >= 1 * 24 * 60 * 60 ? "1 day" : + seconds >= 2 * 60 * 60 ? Math.round(seconds / (60*60)) + " hours" : // 2 hours + + seconds >= 1 * 60 * 60 ? "1 hour" : + Math.round(seconds / 60) + " minutes") + return numAndUnit + " before"; + } else { + return "On event start"; + } } + + property var beforeEventSeconds: 0 + + displayText: secondsToReminderLabel(Number(currentText)) + + model: [0, + 5 * 60, // 5 minutes + 10 * 60, + 15 * 60, + 30 * 60, + 45 * 60, + 1 * 60 * 60, // 1 hour + 2 * 60 * 60, + 1 * 24 * 60 * 60, // 1 day + 2 * 24 * 60 * 60, + 5 * 24 * 60 * 60] + // All these times are in seconds. + delegate: Kirigami.BasicListItem { + label: remindersComboBox${buttonIndex}.secondsToReminderLabel(modelData) + onClicked: remindersComboBox${buttonIndex}.beforeEventSeconds = modelData + } + popup.z: 1000 } - property var beforeEventSeconds: 0 - - displayText: secondsToReminderLabel(Number(currentText)) - - model: [0, - 5 * 60, // 5 minutes - 10 * 60, - 15 * 60, - 30 * 60, - 45 * 60, - 1 * 60 * 60, // 1 hour - 2 * 60 * 60, - 1 * 24 * 60 * 60, // 1 day - 2 * 24 * 60 * 60, - 5 * 24 * 60 * 60] - // All these times are in seconds. - delegate: Kirigami.BasicListItem { - label: remindersComboBox${buttonIndex}.secondsToReminderLabel(modelData) - onClicked: remindersComboBox${buttonIndex}.beforeEventSeconds = modelData + QQC2.Button { + icon.name: "edit-delete-remove" + onClicked: parent.destroy() } - popup.z: 1000 } `, this.parent, `remindersComboBox${buttonIndex}`) remindersColumn.reminderCombos.push(newReminder) diff --git a/src/contents/ui/TimePicker.qml b/src/contents/ui/TimePicker.qml index 3e96c6a806c02435c2e4195fdd0eba58139e96e4..971632d13842630e376f967b52751abae70e1e50 100644 --- a/src/contents/ui/TimePicker.qml +++ b/src/contents/ui/TimePicker.qml @@ -29,7 +29,6 @@ Item { function setToTimeFromString(timeString) { // Accepts in format HH:MM:SS var splitTimeString = timeString.split(":"); - console.log(splitTimeString); switch (splitTimeString.length) { case 3: secondsView.currentIndex = Number(splitTimeString[2]); @@ -64,15 +63,15 @@ Item { Layout.fillWidth: true Layout.fillHeight: true - model: 24 - delegate: Kirigami.Heading { - property int thisIndex: index + model: 24 + delegate: Kirigami.Heading { + property int thisIndex: index - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - opacity: hourView.currentIndex == thisIndex ? 1 : 0.7 - text: modelData < 10 ? String(modelData).padStart(2, "0") : modelData - } + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + opacity: hourView.currentIndex == thisIndex ? 1 : 0.7 + text: modelData < 10 ? String(modelData).padStart(2, "0") : modelData + } } QQC2.ToolButton { Layout.fillWidth: true @@ -104,16 +103,16 @@ Item { Layout.fillWidth: true Layout.fillHeight: true - model: (60 / timePicker.minuteMultiples) // So we can adjust the minute intervals selectable by the user (model goes up to 59) - delegate: Kirigami.Heading { - property int thisIndex: index - property int minuteToDisplay: modelData * timePicker.minuteMultiples + model: (60 / timePicker.minuteMultiples) // So we can adjust the minute intervals selectable by the user (model goes up to 59) + delegate: Kirigami.Heading { + property int thisIndex: index + property int minuteToDisplay: modelData * timePicker.minuteMultiples - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - opacity: minuteView.currentIndex == thisIndex ? 1 : 0.7 - text: minuteToDisplay < 10 ? String(minuteToDisplay).padStart(2, "0") : minuteToDisplay - } + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + opacity: minuteView.currentIndex == thisIndex ? 1 : 0.7 + text: minuteToDisplay < 10 ? String(minuteToDisplay).padStart(2, "0") : minuteToDisplay + } } QQC2.ToolButton { Layout.fillWidth: true diff --git a/src/eventwrapper.cpp b/src/eventwrapper.cpp index a5f2365d79f7f737dd48052d5f7851908a847a6b..d368423e1f640c1a228d65639dbd09679c5f3190 100644 --- a/src/eventwrapper.cpp +++ b/src/eventwrapper.cpp @@ -42,7 +42,11 @@ QString EventWrapper::description() const void EventWrapper::setDescription(QString description) { + if (m_event->description() == description) { + return; + } m_event->setDescription(description); + Q_EMIT descriptionChanged(); } QString EventWrapper::location() const diff --git a/src/eventwrapper.h b/src/eventwrapper.h index 7d97bca6cc51182217b4fd395baba6d2a02dc492..6cf6ee8fbc8615b512666bc4949ba44349efd25a 100644 --- a/src/eventwrapper.h +++ b/src/eventwrapper.h @@ -8,7 +8,7 @@ #include #include -/* +/** * This class is a wrapper for a KCalendarCore::Event::Ptr object. * We can use it to create new events, or create event pointers from * pre-existing events, to more cleanly pass around to our QML code diff --git a/src/main.cpp b/src/main.cpp index ba0e29fdab4016a1dafd052ccab8da107853e50a..0dc2829421723fc042c7ac9e5ca5b36c99512e92 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -22,9 +22,6 @@ Q_DECL_EXPORT int main(int argc, char *argv[]) QCoreApplication::setOrganizationName(QStringLiteral("KDE")); QCoreApplication::setApplicationName(QStringLiteral("Kalendar")); - EventWrapper eventwrapper; - qDebug() << eventwrapper.description(); - QQmlApplicationEngine engine; auto manager = new CalendarManager(&engine);