[Pkg-owncloud-commits] [owncloud-client] 227/333: Fix crash on first run when no account are configured
Sandro Knauß
hefee-guest at moszumanska.debian.org
Thu Apr 17 23:16:57 UTC 2014
This is an automated email from the git hooks/post-receive script.
hefee-guest pushed a commit to branch master
in repository owncloud-client.
commit 2ad7b0aae0ef59fa92619830cbfe8bc1374b6be0
Author: Olivier Goffart <ogoffart at woboq.com>
Date: Wed Mar 26 17:41:04 2014 +0100
Fix crash on first run when no account are configured
---
src/mirall/accountsettings.cpp | 28 +++++++++++++++++++++-------
src/mirall/accountsettings.h | 1 +
2 files changed, 22 insertions(+), 7 deletions(-)
diff --git a/src/mirall/accountsettings.cpp b/src/mirall/accountsettings.cpp
index 9bd90ec..267d2e6 100644
--- a/src/mirall/accountsettings.cpp
+++ b/src/mirall/accountsettings.cpp
@@ -106,17 +106,31 @@ AccountSettings::AccountSettings(QWidget *parent) :
ui->connectLabel->setText(tr("No account configured."));
ui->_buttonAdd->setEnabled(false);
+
+ connect(AccountManager::instance(), SIGNAL(accountChanged(Account*,Account*)), this, SLOT(slotAccountChanged(Account*,SAccount*)));
+ slotAccountChanged(AccountManager::instance()->account(), 0);
+
+ setFolderList(FolderMan::instance()->map());
+}
+
+void AccountSettings::slotAccountChanged(Account *newAccount, Account *oldAccount)
+{
+ if (oldAccount) {
+ disconnect(oldAccount, SIGNAL(stateChanged(int)), this, SLOT(slotAccountStateChanged(int)));
+ disconnect(oldAccount->quotaInfo(), SIGNAL(quotaUpdated(qint64,qint64)),
+ this, SLOT(slotUpdateQuota(qint64,qint64)));
+ }
+
+ _account = newAccount;
if (_account) {
connect(_account, SIGNAL(stateChanged(int)), SLOT(slotAccountStateChanged(int)));
slotAccountStateChanged(_account->state());
- }
- QuotaInfo *quotaInfo = _account->quotaInfo();
- connect( quotaInfo, SIGNAL(quotaUpdated(qint64,qint64)),
- this, SLOT(slotUpdateQuota(qint64,qint64)));
- slotUpdateQuota(quotaInfo->lastQuotaTotalBytes(), quotaInfo->lastQuotaUsedBytes());
-
- setFolderList(FolderMan::instance()->map());
+ QuotaInfo *quotaInfo = _account->quotaInfo();
+ connect( quotaInfo, SIGNAL(quotaUpdated(qint64,qint64)),
+ this, SLOT(slotUpdateQuota(qint64,qint64)));
+ slotUpdateQuota(quotaInfo->lastQuotaTotalBytes(), quotaInfo->lastQuotaUsedBytes());
+ }
}
void AccountSettings::slotFolderActivated( const QModelIndex& indx )
diff --git a/src/mirall/accountsettings.h b/src/mirall/accountsettings.h
index 2950d3b..97751e9 100644
--- a/src/mirall/accountsettings.h
+++ b/src/mirall/accountsettings.h
@@ -99,6 +99,7 @@ private:
Account *_account;
private slots:
void slotFolderSyncStateChange();
+ void slotAccountChanged(Account*,Account*);
};
} // namespace Mirall
--
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