[Pkg-owncloud-commits] [owncloud-client] 15/171: AccountWizard: Don't crash when sync is running #4221
Sandro Knauß
hefee-guest at moszumanska.debian.org
Wed Feb 17 09:36:43 UTC 2016
This is an automated email from the git hooks/post-receive script.
hefee-guest pushed a commit to annotated tag upstream/2.1.1+dfsg
in repository owncloud-client.
commit 179b25d28923f26a208a5fd93e1137ae6bc9342c
Author: Christian Kamm <mail at ckamm.de>
Date: Tue Dec 8 14:37:37 2015 +0100
AccountWizard: Don't crash when sync is running #4221
Running FolderMan::setupFolders() is redundant and just a leftover
from before multiaccount.
---
src/gui/accountsettings.cpp | 2 +-
src/gui/application.cpp | 38 +++++++++++++++++++++++++++-----------
src/gui/folderman.cpp | 6 ++++--
src/gui/folderman.h | 2 +-
4 files changed, 33 insertions(+), 15 deletions(-)
diff --git a/src/gui/accountsettings.cpp b/src/gui/accountsettings.cpp
index 1284940..ee1d73c 100644
--- a/src/gui/accountsettings.cpp
+++ b/src/gui/accountsettings.cpp
@@ -118,7 +118,7 @@ AccountSettings::AccountSettings(AccountState *accountState, QWidget *parent) :
connect(ui->selectiveSyncApply, SIGNAL(clicked()), _model, SLOT(slotApplySelectiveSync()));
connect(ui->selectiveSyncCancel, SIGNAL(clicked()), _model, SLOT(resetFolders()));
- connect(FolderMan::instance(), SIGNAL(folderListLoaded(Folder::Map)), _model, SLOT(resetFolders()));
+ connect(FolderMan::instance(), SIGNAL(folderListChanged(Folder::Map)), _model, SLOT(resetFolders()));
connect(this, SIGNAL(folderChanged()), _model, SLOT(resetFolders()));
diff --git a/src/gui/application.cpp b/src/gui/application.cpp
index 2d4622b..1182ecd 100644
--- a/src/gui/application.cpp
+++ b/src/gui/application.cpp
@@ -286,23 +286,39 @@ void Application::slotCrash()
void Application::slotownCloudWizardDone( int res )
{
+ AccountManager *accountMan = AccountManager::instance();
FolderMan *folderMan = FolderMan::instance();
+
+ // During the wizard, scheduling of new syncs is disabled
+ folderMan->setSyncEnabled(true);
+
if( res == QDialog::Accepted ) {
- int cnt = folderMan->setupFolders();
- qDebug() << "Set up " << cnt << " folders.";
- // We have some sort of configuration. Enable autostart
- Utility::setLaunchOnStartup(_theme->appName(), _theme->appNameGUI(), true);
- if (cnt == 0) {
- // The folder configuration was skipped
- _gui->slotShowSettings();
+ // Open the settings page for the new account if no folders
+ // were configured. Using the last account for this check is
+ // not exactly correct, but good enough.
+ if (!accountMan->accounts().isEmpty()) {
+ AccountStatePtr newAccount = accountMan->accounts().last();
+ bool hasFolder = false;
+ foreach (Folder* folder, folderMan->map()) {
+ if (folder->accountState() == newAccount.data()) {
+ hasFolder = true;
+ break;
+ }
+ }
+
+ if (!hasFolder) {
+ _gui->slotShowSettings();
+ }
}
- }
- folderMan->setSyncEnabled( true );
- if( res == QDialog::Accepted ) {
+
+ // Check connectivity of the newly created account
_checkConnectionTimer.start();
slotCheckConnection();
- }
+ // The very first time an account is configured: enabled autostart
+ // TODO: Doing this every time the account wizard finishes will annoy users.
+ Utility::setLaunchOnStartup(_theme->appName(), _theme->appNameGUI(), true);
+ }
}
void Application::setupLogging()
diff --git a/src/gui/folderman.cpp b/src/gui/folderman.cpp
index 18759a6..6ad1fa0 100644
--- a/src/gui/folderman.cpp
+++ b/src/gui/folderman.cpp
@@ -216,7 +216,7 @@ int FolderMan::setupFolders()
settings->endGroup(); // <account>
}
- emit folderListLoaded(_folderMap);
+ emit folderListChanged(_folderMap);
return _folderMap.size();
}
@@ -245,7 +245,7 @@ int FolderMan::setupFoldersMigration()
}
}
- emit folderListLoaded(_folderMap);
+ emit folderListChanged(_folderMap);
// return the number of valid folders.
return _folderMap.size();
@@ -775,6 +775,8 @@ Folder* FolderMan::addFolder(AccountState* accountState, const FolderDefinition&
if(folder && accountState) {
folder->setAccountState(accountState);
folder->saveToSettings();
+ emit folderSyncStateChange(folder);
+ emit folderListChanged(_folderMap);
}
return folder;
}
diff --git a/src/gui/folderman.h b/src/gui/folderman.h
index b63e750..b120ea5 100644
--- a/src/gui/folderman.h
+++ b/src/gui/folderman.h
@@ -139,7 +139,7 @@ signals:
*/
void scheduleQueueChanged();
- void folderListLoaded(const Folder::Map &);
+ void folderListChanged(const Folder::Map &);
public slots:
void slotRemoveFolder( Folder* );
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git
More information about the Pkg-owncloud-commits
mailing list