diff --git a/src/gui/owncloudsetupwizard.cpp b/src/gui/owncloudsetupwizard.cpp index 40b88289a340d..09102f62429fc 100644 --- a/src/gui/owncloudsetupwizard.cpp +++ b/src/gui/owncloudsetupwizard.cpp @@ -85,6 +85,7 @@ void OwncloudSetupWizard::runWizard(QObject *obj, const char *amember, QWidget * wiz = new OwncloudSetupWizard(parent); connect(wiz, SIGNAL(ownCloudWizardDone(int)), obj, amember); + connect(wiz->_ocWizard, &OwncloudWizard::wizardClosed, obj, [] { wiz.clear(); }); FolderMan::instance()->setSyncEnabled(false); wiz->startWizard(); } diff --git a/src/gui/wizard/owncloudwizard.cpp b/src/gui/wizard/owncloudwizard.cpp index f09c52fcaf155..9368b3d162800 100644 --- a/src/gui/wizard/owncloudwizard.cpp +++ b/src/gui/wizard/owncloudwizard.cpp @@ -408,6 +408,21 @@ void OwncloudWizard::changeEvent(QEvent *e) QWizard::changeEvent(e); } +void OwncloudWizard::hideEvent(QHideEvent *event) +{ + QWizard::hideEvent(event); +#ifdef Q_OS_MACOS + // Closing the window on macOS hides it rather than closes it, so emit a wizardClosed here + emit wizardClosed(); +#endif +} + +void OwncloudWizard::closeEvent(QCloseEvent *event) +{ + emit wizardClosed(); + QWizard::closeEvent(event); +} + void OwncloudWizard::customizeStyle() { // HINT: Customize wizard's own style here, if necessary in the future (Dark-/Light-Mode switching) diff --git a/src/gui/wizard/owncloudwizard.h b/src/gui/wizard/owncloudwizard.h index 7f69587a45da7..da614b92d7e5c 100644 --- a/src/gui/wizard/owncloudwizard.h +++ b/src/gui/wizard/owncloudwizard.h @@ -110,9 +110,12 @@ public slots: void needCertificate(); void styleChanged(); void onActivate(); + void wizardClosed(); protected: void changeEvent(QEvent *) override; + void hideEvent(QHideEvent *) override; + void closeEvent(QCloseEvent *) override; private: void customizeStyle();