Commit 3ad8618e authored by Slawek Kaplonski's avatar Slawek Kaplonski Committed by Claudio Cambra
Browse files

Fix drag-drop recurring events

In the previous patch I accidentally missed to pass occurenceDate
parameter to the convertIncidence function and that caused some
issues when reccuring event was converted from/to add-day event.
Now this should be fixed.

Related-issue: #148
parent 1493630d
Pipeline #124521 passed with stage
in 5 minutes and 7 seconds
......@@ -22,11 +22,18 @@ Kirigami.Page {
property int endOffset: 0
property date occurrenceDate
property Item caughtDelegate
property bool allDay
padding: Kirigami.Units.largeSpacing
title: i18n("Change incidence date")
function setAllDay() {
if (allDay !== null) {
incidenceWrapper.allDay = allDay;
}
}
ColumnLayout {
anchors.fill: parent
......@@ -53,17 +60,26 @@ Kirigami.Page {
enabled: incidenceWrapper !== undefined
shortcut: "Return"
text: i18n("Only This Item")
onTriggered: changeThis()
onTriggered: {
deleteSheet.setAllDay();
changeThis();
}
},
QQC2.Action {
icon.name: "edit-table-delete-row"
text: i18n("Also Future Items")
onTriggered: changeThisAndFuture()
onTriggered: {
deleteSheet.setAllDay();
changeThisAndFuture();
}
},
QQC2.Action {
icon.name: "group-delete"
text: i18n("All Occurrences")
onTriggered: changeAll()
onTriggered: {
deleteSheet.setAllDay();
changeAll();
}
},
QQC2.Action {
icon.name: "dialog-cancel"
......
......@@ -952,7 +952,7 @@ Kirigami.ApplicationWindow {
}
}
function setUpIncidenceDateChange(incidenceWrapper, startOffset, endOffset, occurrenceDate, caughtDelegate) {
function setUpIncidenceDateChange(incidenceWrapper, startOffset, endOffset, occurrenceDate, caughtDelegate, allDay=null) {
pageStack.currentItem.dragDropEnabled = false;
if(pageStack.layers.currentItem && pageStack.layers.currentItem.dragDropEnabled) {
......@@ -960,6 +960,9 @@ Kirigami.ApplicationWindow {
}
if(incidenceWrapper.recurrenceData.type === 0) {
if (allDay !== null) {
incidenceWrapper.allDay = allDay;
}
CalendarManager.updateIncidenceDates(incidenceWrapper, startOffset, endOffset);
} else {
const onClosingHandler = () => { caughtDelegate.caught = false; root.reenableDragOnCurrentView(); };
......@@ -968,7 +971,8 @@ Kirigami.ApplicationWindow {
startOffset: startOffset,
endOffset: endOffset,
occurrenceDate: occurrenceDate,
caughtDelegate: caughtDelegate
caughtDelegate: caughtDelegate,
allDay: allDay
}, {
width: Kirigami.Units.gridUnit * 34,
height: Kirigami.Units.gridUnit * 6,
......@@ -979,12 +983,6 @@ Kirigami.ApplicationWindow {
}
}
function convertIncidence(incidenceWrapper, allDay, startOffset, endOffset, occurrenceDate, caughtDelegate) {
incidenceWrapper.allDay = allDay;
setUpIncidenceDateChange(incidenceWrapper, startOffset, endOffset, occurrenceDate, caughtDelegate);
}
function reenableDragOnCurrentView() {
pageStack.currentItem.dragDropEnabled = true;
......@@ -1268,7 +1266,7 @@ Kirigami.ApplicationWindow {
onAddSubTodo: root.setUpAddSubTodo(parentWrapper)
onDeselect: incidenceInfo.close()
onMoveIncidence: root.setUpIncidenceDateChange(incidenceWrapper, startOffset, startOffset, occurrenceDate, caughtDelegate) // We move the entire incidence
onConvertIncidence: root.convertIncidence(incidenceWrapper, allDay, startOffset, endOffset, caughtDelegate) // We convert incidence from or to all day event
onConvertIncidence: root.setUpIncidenceDateChange(incidenceWrapper, startOffset, endOffset, occurrenceDate, caughtDelegate, allDay) // We convert incidence from/to allDay
onResizeIncidence: root.setUpIncidenceDateChange(incidenceWrapper, 0, endOffset, occurrenceDate, caughtDelegate)
onOpenDayView: root.openDayLayer(selectedDate)
......
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