mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-23 05:25:50 +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,14 +368,16 @@ void OwncloudAdvancedSetupPage::slotSelectiveSyncClicked()
|
|||
|
||||
void OwncloudAdvancedSetupPage::slotVirtualFileSyncClicked()
|
||||
{
|
||||
OwncloudWizard::askExperimentalVirtualFilesFeature([this](bool enable) {
|
||||
if (!enable)
|
||||
return;
|
||||
if (!_ui.rVirtualFileSync->isChecked()) {
|
||||
OwncloudWizard::askExperimentalVirtualFilesFeature(this, [this](bool enable) {
|
||||
if (!enable)
|
||||
return;
|
||||
|
||||
_ui.lSelectiveSyncSizeLabel->setText(QString());
|
||||
_selectiveSyncBlacklist.clear();
|
||||
setRadioChecked(_ui.rVirtualFileSync);
|
||||
});
|
||||
_ui.lSelectiveSyncSizeLabel->setText(QString());
|
||||
_selectiveSyncBlacklist.clear();
|
||||
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