Commit 88281cfb authored by Claudio Cambra's avatar Claudio Cambra
Browse files

The incidence editor now edits a copy if the incidence ptr, meaning changes to...

The incidence editor now edits a copy if the incidence ptr, meaning changes to the incidence aren't apparent until applied
parent 7e805ddb
Pipeline #93342 canceled with stage
......@@ -620,6 +620,7 @@ Kirigami.ApplicationWindow {
editorToUse.incidenceWrapper = Qt.createQmlObject('import org.kde.kalendar 1.0; IncidenceWrapper {id: incidence}',
editorToUse, "incidence");
editorToUse.incidenceWrapper.incidencePtr = incidencePtr;
editorToUse.incidenceWrapper.triggerEditMode();
editorToUse.incidenceWrapper.collectionId = collectionId;
editorToUse.editMode = true;
}
......
......@@ -617,6 +617,12 @@ void IncidenceWrapper::setTodoPercentComplete(int todoPercentComplete)
Q_EMIT todoCompletedChanged();
}
void IncidenceWrapper::triggerEditMode() // You edit a clone so that the original ptr isn't messed with
{
KCalendarCore::Incidence::Ptr clonedPtr(m_incidence->clone());
setIncidencePtr(clonedPtr);
}
void IncidenceWrapper::setNewEvent()
{
auto event = KCalendarCore::Event::Ptr(new KCalendarCore::Event);
......
......@@ -158,6 +158,7 @@ public:
int todoPercentComplete();
void setTodoPercentComplete(int todoPercentComplete);
Q_INVOKABLE void triggerEditMode();
Q_INVOKABLE void setNewEvent();
Q_INVOKABLE void setNewTodo();
Q_INVOKABLE void addAlarms(KCalendarCore::Alarm::List alarms);
......
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