mirror of
https://github.com/nextcloud/desktop.git
synced 2024-10-24 05:15:40 +03:00
Make SyncDisabler local to slotAddFolder
This also allows us to update the folder state as soon as the wizard is being closed.
This commit is contained in:
parent
d323ec5dd9
commit
89438f7ace
2 changed files with 18 additions and 16 deletions
|
@ -681,13 +681,30 @@ void Application::slotTrayClicked( QSystemTrayIcon::ActivationReason reason )
|
|||
|
||||
void Application::slotAddFolder()
|
||||
{
|
||||
/** Helper class to ensure sync is always switched back on */
|
||||
class SyncDisabler
|
||||
{
|
||||
public:
|
||||
SyncDisabler(Application *app) : _app(app)
|
||||
{
|
||||
_app->_folderMan->setSyncEnabled(false);
|
||||
}
|
||||
~SyncDisabler() {
|
||||
_app->_folderMan->setSyncEnabled(true);
|
||||
_app->computeOverallSyncStatus();
|
||||
_app->_folderMan->slotScheduleAllFolders();
|
||||
}
|
||||
private:
|
||||
Application *_app;
|
||||
};
|
||||
|
||||
if (_folderWizard) {
|
||||
raiseDialog(_folderWizard);
|
||||
return;
|
||||
}
|
||||
|
||||
// disables sync queuing while in scope
|
||||
FolderMan::SyncDisabler disableSync(_folderMan);
|
||||
SyncDisabler disableSync(this);
|
||||
|
||||
Folder::Map folderMap = _folderMan->map();
|
||||
_folderWizard = new FolderWizard;
|
||||
|
@ -716,8 +733,6 @@ void Application::slotAddFolder()
|
|||
}
|
||||
_folderWizard->deleteLater();
|
||||
_folderWizard = 0;
|
||||
|
||||
_folderMan->slotScheduleAllFolders();
|
||||
}
|
||||
|
||||
void Application::slotOpenStatus()
|
||||
|
|
|
@ -33,19 +33,6 @@ class FolderMan : public QObject
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
/** Helper class to ensure sync is always switched back on */
|
||||
class SyncDisabler
|
||||
{
|
||||
public:
|
||||
SyncDisabler(Mirall::FolderMan *man) : _man(man)
|
||||
{
|
||||
_man->setSyncEnabled(false);
|
||||
}
|
||||
~SyncDisabler() { _man->setSyncEnabled(true); }
|
||||
private:
|
||||
FolderMan *_man;
|
||||
};
|
||||
|
||||
explicit FolderMan(QObject *parent = 0);
|
||||
~FolderMan();
|
||||
|
||||
|
|
Loading…
Reference in a new issue