Commit 2b1bb433 authored by Claudio Cambra's avatar Claudio Cambra
Browse files

Fixed week view drag and drop timezone issues

parent afd4fff5
Pipeline #99407 failed with stage
in 2 minutes and 21 seconds
......@@ -181,6 +181,7 @@ Kirigami.Page {
*/
Layout.bottomMargin: Kirigami.Units.largeSpacing * 5
highlightRangeMode: ListView.ApplyRange
interactive: Kirigami.Settings.tabletMode || Kirigami.Settings.isMobile
onCountChanged: if(root.initialMonth) root.moveToSelected()
......
......@@ -683,6 +683,7 @@ Kirigami.Page {
model: weekViewModel // From root.model
boundsBehavior: Flickable.StopAtBounds
interactive: Kirigami.Settings.tabletMode || Kirigami.Settings.isMobile
delegate: Item {
id: dayColumn
......@@ -736,8 +737,10 @@ Kirigami.Page {
let incidenceWrapper = Qt.createQmlObject('import org.kde.kalendar 1.0; IncidenceWrapper {id: incidence}', incidenceDropArea, "incidence");
incidenceWrapper.incidencePtr = drop.source.incidencePtr;
incidenceWrapper.collectionId = drop.source.collectionId;
incidenceWrapper.setIncidenceStartDate(backgroundDayMouseArea.addDate.getDate(), backgroundDayMouseArea.addDate.getMonth() + 1, backgroundDayMouseArea.addDate.getFullYear());
incidenceWrapper.setIncidenceStartTime(backgroundRectangle.index, dropAreaRepeater.minutes * index)
// This is a case where we want to set datetime according to the view timezone
let incidenceStart = new Date(backgroundDayMouseArea.addDate.getFullYear(), backgroundDayMouseArea.addDate.getMonth(), backgroundDayMouseArea.addDate.getDate(), backgroundRectangle.index, dropAreaRepeater.minutes * index)
incidenceWrapper.setIncidenceStart(incidenceStart, true);
Kalendar.CalendarManager.editIncidence(incidenceWrapper);
}
......
......@@ -228,6 +228,9 @@ void IncidenceWrapper::setIncidenceStart(const QDateTime &incidenceStart, bool r
if (respectTimeZone) {
m_incidence->setDtStart(incidenceStart);
auto newTzEnd = incidenceEnd();
newTzEnd.setTimeZone(incidenceStart.timeZone());
setIncidenceEnd(newTzEnd, true);
} else {
const auto date = incidenceStart.date();
const auto time = incidenceStart.time();
......
......@@ -120,13 +120,13 @@ public:
float geoLongitude() const;
QDateTime incidenceStart() const;
void setIncidenceStart(const QDateTime &incidenceStart, bool respectTimeZone = false);
Q_INVOKABLE void setIncidenceStart(const QDateTime &incidenceStart, bool respectTimeZone = false);
Q_INVOKABLE void setIncidenceStartDate(int day, int month, int year);
Q_INVOKABLE void setIncidenceStartTime(int hours, int minutes);
QString incidenceStartDateDisplay() const;
QString incidenceStartTimeDisplay() const;
QDateTime incidenceEnd() const;
void setIncidenceEnd(const QDateTime &incidenceEnd, bool respectTimeZone = false);
Q_INVOKABLE void setIncidenceEnd(const QDateTime &incidenceEnd, bool respectTimeZone = false);
Q_INVOKABLE void setIncidenceEndDate(int day, int month, int year);
Q_INVOKABLE void setIncidenceEndTime(int hours, int minutes);
QString incidenceEndDateDisplay() const;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment