mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-23 13:35:58 +03:00
AccountSettings: Do not allow to expand the folder list when disconnected.
This is supposed to fix #3860
This commit is contained in:
parent
57f10c0c8e
commit
a1421ff74f
2 changed files with 21 additions and 1 deletions
|
@ -125,7 +125,7 @@ AccountSettings::AccountSettings(AccountState *accountState, QWidget *parent) :
|
||||||
// Expand already on single click
|
// Expand already on single click
|
||||||
ui->_folderList->setExpandsOnDoubleClick(false);
|
ui->_folderList->setExpandsOnDoubleClick(false);
|
||||||
QObject::connect(ui->_folderList, SIGNAL(clicked(const QModelIndex &)),
|
QObject::connect(ui->_folderList, SIGNAL(clicked(const QModelIndex &)),
|
||||||
ui->_folderList, SLOT(expand(const QModelIndex &)));
|
this, SLOT(slotFolderListClicked(const QModelIndex&)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AccountSettings::doExpand()
|
void AccountSettings::doExpand()
|
||||||
|
@ -133,6 +133,13 @@ void AccountSettings::doExpand()
|
||||||
ui->_folderList->expandToDepth(0);
|
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)
|
void AccountSettings::slotCustomContextMenuRequested(const QPoint &pos)
|
||||||
{
|
{
|
||||||
QTreeView *tv = ui->_folderList;
|
QTreeView *tv = ui->_folderList;
|
||||||
|
@ -471,6 +478,18 @@ void AccountSettings::slotAccountStateChanged(int state)
|
||||||
// ownCloud is not yet configured.
|
// ownCloud is not yet configured.
|
||||||
showConnectionLabel( tr("No %1 connection configured.").arg(Theme::instance()->appNameGUI()) );
|
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()
|
AccountSettings::~AccountSettings()
|
||||||
|
|
|
@ -80,6 +80,7 @@ protected slots:
|
||||||
void slotDeleteAccount();
|
void slotDeleteAccount();
|
||||||
void refreshSelectiveSyncStatus();
|
void refreshSelectiveSyncStatus();
|
||||||
void slotCustomContextMenuRequested(const QPoint&);
|
void slotCustomContextMenuRequested(const QPoint&);
|
||||||
|
void slotFolderListClicked( const QModelIndex& indx );
|
||||||
void doExpand();
|
void doExpand();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Reference in a new issue