[Pkg-owncloud-commits] [owncloud-client] 163/218: AccountSettings: Do not allow to expand the folder list when disconnected.
Sandro Knauß
hefee-guest at moszumanska.debian.org
Sat Oct 17 14:31:04 UTC 2015
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 a1421ff74f535ba520c9372075bb88cb0ac69513
Author: Klaas Freitag <freitag at owncloud.com>
Date: Fri Sep 25 12:22:51 2015 +0200
AccountSettings: Do not allow to expand the folder list when disconnected.
This is supposed to fix #3860
---
src/gui/accountsettings.cpp | 21 ++++++++++++++++++++-
src/gui/accountsettings.h | 1 +
2 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/src/gui/accountsettings.cpp b/src/gui/accountsettings.cpp
index e9956f7..5210dca 100644
--- a/src/gui/accountsettings.cpp
+++ b/src/gui/accountsettings.cpp
@@ -125,7 +125,7 @@ AccountSettings::AccountSettings(AccountState *accountState, QWidget *parent) :
// Expand already on single click
ui->_folderList->setExpandsOnDoubleClick(false);
QObject::connect(ui->_folderList, SIGNAL(clicked(const QModelIndex &)),
- ui->_folderList, SLOT(expand(const QModelIndex &)));
+ this, SLOT(slotFolderListClicked(const QModelIndex&)));
}
void AccountSettings::doExpand()
@@ -133,6 +133,13 @@ void AccountSettings::doExpand()
ui->_folderList->expandToDepth(0);
}
+void AccountSettings::slotFolderListClicked( const QModelIndex& indx )
+{
+ if( _accountState && _accountState->state() == AccountState::Connected ) {
+ ui->_folderList->expand(indx);
+ }
+}
+
void AccountSettings::slotCustomContextMenuRequested(const QPoint &pos)
{
QTreeView *tv = ui->_folderList;
@@ -471,6 +478,18 @@ void AccountSettings::slotAccountStateChanged(int state)
// ownCloud is not yet configured.
showConnectionLabel( tr("No %1 connection configured.").arg(Theme::instance()->appNameGUI()) );
}
+
+ /* Allow to expand the item if the account is connected. */
+ ui->_folderList->setItemsExpandable( state == AccountState::Connected );
+
+ /* check if there are expanded root items, if so, close them, if the state is different from being Connected. */
+ if( state != AccountState::Connected ) {
+ int i;
+ for (i = 0; i < _model->rowCount(); ++i) {
+ if (ui->_folderList->isExpanded(_model->index(i)))
+ ui->_folderList->setExpanded(_model->index(i), false);
+ }
+ }
}
AccountSettings::~AccountSettings()
diff --git a/src/gui/accountsettings.h b/src/gui/accountsettings.h
index b63a75a..4dac973 100644
--- a/src/gui/accountsettings.h
+++ b/src/gui/accountsettings.h
@@ -80,6 +80,7 @@ protected slots:
void slotDeleteAccount();
void refreshSelectiveSyncStatus();
void slotCustomContextMenuRequested(const QPoint&);
+ void slotFolderListClicked( const QModelIndex& indx );
void doExpand();
private:
--
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