Commit 48bbaa33 authored by Claudio Cambra's avatar Claudio Cambra
Browse files

Disable drag and drop when processing prior drops

parent cb8395d4
Pipeline #105202 passed with stage
in 5 minutes and 3 seconds
......@@ -791,6 +791,8 @@ void CalendarManager::updateIncidenceDates(IncidenceWrapper *incidenceWrapper, i
setNewDates(incidenceWrapper->incidencePtr());
m_changer->modifyIncidence(item, oldIncidence);
}
Q_EMIT updateIncidenceDatesCompleted();
}
bool CalendarManager::hasChildren(KCalendarCore::Incidence::Ptr incidence)
......
......@@ -106,6 +106,7 @@ Q_SIGNALS:
void undoRedoDataChanged();
void incidenceChanged();
void enabledTodoCollectionsChanged();
void updateIncidenceDatesCompleted();
private:
Akonadi::ETMCalendar::Ptr m_calendar = nullptr;
......
......@@ -34,6 +34,8 @@ Kirigami.Page {
readonly property bool isLarge: width > Kirigami.Units.gridUnit * 40
readonly property bool isTiny: width < Kirigami.Units.gridUnit * 18
property bool dragDropEnabled: true
function setToDate(date, isInitialMonth = false) {
monthPage.initialMonth = isInitialMonth;
let monthDiff = date.getMonth() - pathView.currentItem.firstDayOfMonth.getMonth() + (12 * (date.getFullYear() - pathView.currentItem.firstDayOfMonth.getFullYear()))
......@@ -153,6 +155,7 @@ Kirigami.Page {
height: pathView.height
model: monthViewModel // from monthPage model
isCurrentView: viewLoader.isCurrentItem
dragDropEnabled: monthPage.dragDropEnabled
startDate: viewLoader.startDate
currentDate: monthPage.currentDate
......
......@@ -46,6 +46,7 @@ Item {
property int month
property alias bgLoader: backgroundLoader.item
property bool isCurrentView: true
property bool dragDropEnabled: true
//Internal
property int numberOfLinesShown: 0
......@@ -307,6 +308,7 @@ Item {
horizontalSpacing: linesRepeater.spacing
openOccurrenceId: root.openOccurrence ? root.openOccurrence.incidenceId : ""
isDark: root.isDark
dragDropEnabled: root.dragDropEnabled
}
}
}
......
......@@ -62,6 +62,7 @@ Rectangle {
property bool caught: false
property real caughtX: 0
property real caughtY: 0
property bool dragDropEnabled: true
Drag.active: mouseArea.drag.active
Drag.hotSpot.x: mouseArea.mouseX
......@@ -158,7 +159,7 @@ Rectangle {
incidenceData: modelData
collectionId: modelData.collectionId
drag.target: !Kirigami.Settings.isMobile && !modelData.isReadOnly ? parent : undefined
drag.target: !Kirigami.Settings.isMobile && !modelData.isReadOnly && incidenceDelegate.dragDropEnabled ? parent : undefined
onReleased: parent.Drag.drop()
onViewClicked: viewIncidence(modelData)
......
......@@ -42,6 +42,7 @@ Kirigami.Page {
readonly property bool isLarge: width > Kirigami.Units.gridUnit * 30
readonly property bool isDark: LabelUtils.isDarkColor(Kirigami.Theme.backgroundColor)
property real maxTimeLabelWidth: 0
property bool dragDropEnabled: true
onSelectedDateChanged: {
pathView.currentItem.item.savedYScrollPos = 0;
......@@ -571,7 +572,7 @@ Kirigami.Page {
incidenceData: modelData
collectionId: modelData.collectionId
drag.target: !Kirigami.Settings.isMobile && !modelData.isReadOnly ? incidenceCard : undefined
drag.target: !Kirigami.Settings.isMobile && !modelData.isReadOnly && root.dragDropEnabled ? incidenceCard : undefined
onReleased: incidenceCard.Drag.drop()
onViewClicked: root.viewIncidence(modelData)
......
......@@ -40,6 +40,7 @@ Kirigami.Page {
property int daysToShow: 7
readonly property int minutesFromStartOfDay: (root.currentDate.getHours() * 60) + root.currentDate.getMinutes()
readonly property bool isDark: LabelUtils.isDarkColor(Kirigami.Theme.backgroundColor)
property bool dragDropEnabled: true
property real scrollbarWidth: 0
readonly property real dayWidth: ((root.width - hourLabelWidth - leftPadding - scrollbarWidth) / daysToShow) - gridLineWidth
......@@ -480,6 +481,7 @@ Kirigami.Page {
openOccurrenceId: root.openOccurrence ? root.openOccurrence.incidenceId : ""
isDark: root.isDark
reactToCurrentMonth: false
dragDropEnabled: root.dragDropEnabled
}
}
}
......@@ -923,7 +925,7 @@ Kirigami.Page {
incidenceData: modelData
collectionId: modelData.collectionId
drag.target: !Kirigami.Settings.isMobile && !modelData.isReadOnly ? parent : undefined
drag.target: !Kirigami.Settings.isMobile && !modelData.isReadOnly && root.dragDropEnabled ? parent : undefined
onReleased: parent.Drag.drop()
onViewClicked: viewIncidence(modelData)
......
......@@ -910,6 +910,12 @@ Kirigami.ApplicationWindow {
}
function setUpIncidenceDateChange(incidenceWrapper, startOffset, endOffset, occurrenceDate, caughtDelegate) {
pageStack.currentItem.dragDropEnabled = false;
if(pageStack.layers.currentItem && pageStack.layers.currentItem.dragDropEnabled) {
pageStack.layers.currentItem.dragDropEnabled = false;
}
if(incidenceWrapper.recurrenceData.type === 0) {
CalendarManager.updateIncidenceDates(incidenceWrapper, startOffset, endOffset);
} else {
......@@ -931,6 +937,17 @@ Kirigami.ApplicationWindow {
}
}
Connections {
target: CalendarManager
function onUpdateIncidenceDatesCompleted() {
pageStack.currentItem.dragDropEnabled = true;
if(pageStack.layers.currentItem && pageStack.layers.currentItem.dragDropEnabled) {
pageStack.layers.currentItem.dragDropEnabled = true;
}
}
}
Component {
id: deleteIncidenceSheetComponent
DeleteIncidenceSheet {
......
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