Index: src/incidencedialog.cpp =================================================================== --- src/incidencedialog.cpp +++ src/incidencedialog.cpp @@ -88,6 +88,7 @@ IncidenceRecurrence *mIeRecurrence = nullptr; IncidenceResource *mIeResource = nullptr; bool mInitiallyDirty = false; + bool mRejected = false; // if the user rejected the dialog Akonadi::Item mItem; QString typeToString(const int type) const; @@ -755,14 +756,18 @@ KConfigGroup group(KSharedConfig::openConfig(), "IncidenceDialog"); group.writeEntry("Size", size()); + Q_D(IncidenceDialog); + if (!d->mRejected) { const Akonadi::Collection col = d_ptr->mCalSelector->currentCollection(); - // col might not be valid if the collection wasn't found yet (the combo is async), skip saving in that case + // col might not be valid if the collection wasn't found yet (the combo is async), + // skip saving in that case if (col.isValid() && col.id() != IncidenceEditorNG::IncidenceEditorSettings::self()->lastSelectedFolder()) { IncidenceEditorNG::IncidenceEditorSettings::self()->setLastSelectedFolder(col.id()); IncidenceEditorNG::IncidenceEditorSettings::self()->save(); } } +} void IncidenceDialog::readConfig() { @@ -835,8 +840,10 @@ this, i18nc("@info", "Do you really want to cancel?"), i18nc("@title:window", "KOrganizer Confirmation")) == KMessageBox::Yes) { + d->mRejected = true; QDialog::reject(); // Discard current changes } else if (!d->isDirty()) { + d->mRejected = true; QDialog::reject(); // No pending changes, just close the dialog. } // else { // the user wasn't finished editing after all } } else if (d->mUi->buttonBox->button(QDialogButtonBox::RestoreDefaults)) { @@ -854,8 +861,10 @@ this, i18nc("@info", "Do you really want to cancel?"), i18nc("@title:window", "KOrganizer Confirmation")) == KMessageBox::Yes) { + d->mRejected = true; QDialog::reject(); // Discard current changes } else if (!d->isDirty()) { + d->mRejected = true; QDialog::reject(); // No pending changes, just close the dialog. } } @@ -868,9 +877,11 @@ this, i18nc("@info", "Do you really want to cancel?"), i18nc("@title:window", "KOrganizer Confirmation")) == KMessageBox::Yes) { + d->mRejected = true; QDialog::reject(); // Discard current changes QDialog::closeEvent(event); } else if (!d->isDirty()) { + d->mRejected = true; QDialog::reject(); // No pending changes, just close the dialog. QDialog::closeEvent(event); } else {