mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-23 13:35:58 +03:00
[Wizard] Make vfs dialog blocking
Calling the callback after the receiver was deleted caused a crash Fixes: #7709 Fixes: #7711
This commit is contained in:
parent
a6a0e361c1
commit
fdc3b7c8da
5 changed files with 15 additions and 12 deletions
|
@ -667,7 +667,7 @@ void AccountSettings::slotEnableVfsCurrentFolder()
|
|||
if (!selected.isValid() || !folder)
|
||||
return;
|
||||
|
||||
OwncloudWizard::askExperimentalVirtualFilesFeature([folder, this](bool enable) {
|
||||
OwncloudWizard::askExperimentalVirtualFilesFeature(this, [folder, this](bool enable) {
|
||||
if (!enable || !folder)
|
||||
return;
|
||||
|
||||
|
|
|
@ -545,7 +545,7 @@ void FolderWizardSelectiveSync::virtualFilesCheckboxClicked()
|
|||
// The click has already had an effect on the box, so if it's
|
||||
// checked it was newly activated.
|
||||
if (_virtualFilesCheckBox->isChecked()) {
|
||||
OwncloudWizard::askExperimentalVirtualFilesFeature([this](bool enable) {
|
||||
OwncloudWizard::askExperimentalVirtualFilesFeature(this, [this](bool enable) {
|
||||
if (!enable)
|
||||
_virtualFilesCheckBox->setChecked(false);
|
||||
});
|
||||
|
|
|
@ -368,7 +368,8 @@ void OwncloudAdvancedSetupPage::slotSelectiveSyncClicked()
|
|||
|
||||
void OwncloudAdvancedSetupPage::slotVirtualFileSyncClicked()
|
||||
{
|
||||
OwncloudWizard::askExperimentalVirtualFilesFeature([this](bool enable) {
|
||||
if (!_ui.rVirtualFileSync->isChecked()) {
|
||||
OwncloudWizard::askExperimentalVirtualFilesFeature(this, [this](bool enable) {
|
||||
if (!enable)
|
||||
return;
|
||||
|
||||
|
@ -377,6 +378,7 @@ void OwncloudAdvancedSetupPage::slotVirtualFileSyncClicked()
|
|||
setRadioChecked(_ui.rVirtualFileSync);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void OwncloudAdvancedSetupPage::slotSyncEverythingClicked()
|
||||
{
|
||||
|
|
|
@ -330,7 +330,7 @@ void OwncloudWizard::bringToTop()
|
|||
ownCloudGui::raiseDialog(this);
|
||||
}
|
||||
|
||||
void OwncloudWizard::askExperimentalVirtualFilesFeature(const std::function<void(bool enable)> &callback)
|
||||
void OwncloudWizard::askExperimentalVirtualFilesFeature(QWidget *receiver, const std::function<void(bool enable)> &callback)
|
||||
{
|
||||
const auto bestVfsMode = bestAvailableVfsMode();
|
||||
QMessageBox *msgBox = nullptr;
|
||||
|
@ -369,7 +369,8 @@ void OwncloudWizard::askExperimentalVirtualFilesFeature(const std::function<void
|
|||
msgBox->addButton(tr("Enable experimental placeholder mode"), QMessageBox::AcceptRole);
|
||||
msgBox->addButton(tr("Stay safe"), QMessageBox::RejectRole);
|
||||
}
|
||||
connect(msgBox, &QMessageBox::finished, msgBox, [callback, msgBox](int result) {
|
||||
msgBox->setParent(receiver);
|
||||
connect(msgBox, &QMessageBox::finished, receiver, [callback, msgBox](int result) {
|
||||
callback(result == QMessageBox::AcceptRole);
|
||||
msgBox->deleteLater();
|
||||
});
|
||||
|
|
|
@ -82,7 +82,7 @@ public:
|
|||
* being experimental. Calles the callback with true if enabling was
|
||||
* chosen.
|
||||
*/
|
||||
static void askExperimentalVirtualFilesFeature(const std::function<void(bool enable)> &callback);
|
||||
static void askExperimentalVirtualFilesFeature(QWidget *receiver, const std::function<void(bool enable)> &callback);
|
||||
|
||||
// FIXME: Can those be local variables?
|
||||
// Set from the OwncloudSetupPage, later used from OwncloudHttpCredsPage
|
||||
|
|
Loading…
Reference in a new issue