connect(syncNowAction, SIGNAL(triggered()), SLOT(slotSyncCurrentFolderNow()));
addAction(syncNowAction);
- connect(ui->_folderList, SIGNAL(clicked(QModelIndex)), SLOT(slotFolderActivated(QModelIndex)));
+ connect(ui->_folderList, SIGNAL(clicked(const QModelIndex &)),
+ this, SLOT(slotFolderListClicked(const QModelIndex&)));
connect(ui->selectiveSyncApply, SIGNAL(clicked()), _model, SLOT(slotApplySelectiveSync()));
connect(ui->selectiveSyncCancel, SIGNAL(clicked()), _model, SLOT(resetFolders()));
connect(ui->signInButton, SIGNAL(clicked()) , this, SLOT(slotSignInAccount()));
connect(ui->deleteButton, SIGNAL(clicked()) , this, SLOT(slotDeleteAccount()));
-
- QObject::connect(ui->_folderList, SIGNAL(clicked(const QModelIndex &)),
- this, SLOT(slotFolderListClicked(const QModelIndex&)));
}
void AccountSettings::doExpand()
ui->_folderList->expandToDepth(0);
}
-void AccountSettings::slotFolderListClicked( const QModelIndex& indx )
-{
- if( _model->classify(indx) == FolderStatusModel::RootFolder &&
- _accountState && _accountState->state() == AccountState::Connected ) {
- bool expanded = ! (ui->_folderList->isExpanded(indx));
- ui->_folderList->setExpanded(indx, expanded);
- }
-}
-
void AccountSettings::slotCustomContextMenuRequested(const QPoint &pos)
{
QTreeView *tv = ui->_folderList;
menu->exec(tv->mapToGlobal(pos));
}
-void AccountSettings::slotFolderActivated( const QModelIndex& indx )
+void AccountSettings::slotFolderListClicked(const QModelIndex& indx)
{
if (indx.data(FolderStatusDelegate::AddButton).toBool()) {
if (indx.flags() & Qt::ItemIsEnabled) {
auto pos = tv->mapFromGlobal(QCursor::pos());
if (FolderStatusDelegate::optionsButtonRect(tv->visualRect(indx)).contains(pos)) {
slotCustomContextMenuRequested(pos);
+ return;
+ }
+
+ // Expand root items on single click
+ if(_accountState && _accountState->state() == AccountState::Connected ) {
+ bool expanded = ! (ui->_folderList->isExpanded(indx));
+ ui->_folderList->setExpanded(indx, expanded);
}
}
}