@@ -597,7 +597,8 @@ void restoreExpansionState(QTreeView *view) {
597597
598598} // namespace
599599
600- SideBar::SideBar (TabWidget *tabs, QWidget *parent) : QWidget(parent) {
600+ SideBar::SideBar (TabWidget *tabs, MainWindow *mainWindow, QWidget *parent)
601+ : QWidget(parent) {
601602 setStyleSheet (kStyleSheet );
602603
603604 QTreeView *view = new QTreeView (this );
@@ -638,16 +639,19 @@ SideBar::SideBar(TabWidget *tabs, QWidget *parent) : QWidget(parent) {
638639 });
639640
640641 connect (
641- view, &QTreeView::doubleClicked, [tabs, this ](const QModelIndex &index) {
642+ view, &QTreeView::doubleClicked,
643+ [tabs, this , mainWindow](const QModelIndex &index) {
642644 if (isRepoIndex (index)) {
643645 tabs->setCurrentIndex (index.row ());
646+ mainWindow->setSideBarVisible (false );
644647 return ;
645648 }
646649
647650 // Open existing path.
648651 QString path = index.data (PathRole).toString ();
649652 if (!path.isEmpty ()) {
650653 MainWindow::open (path);
654+ mainWindow->setSideBarVisible (false );
651655 return ;
652656 }
653657
@@ -666,12 +670,13 @@ SideBar::SideBar(TabWidget *tabs, QWidget *parent) : QWidget(parent) {
666670 if (repoVariant.isValid ()) {
667671 Repository *repo = repoVariant.value <Repository *>();
668672 CloneDialog *dialog = new CloneDialog (CloneDialog::Clone, this , repo);
669- connect (dialog, &CloneDialog::accepted, [repo, dialog] {
673+ connect (dialog, &CloneDialog::accepted, [repo, dialog, mainWindow ] {
670674 // Set local path.
671675 Account *account = repo->account ();
672676 account->setRepositoryPath (account->indexOf (repo), dialog->path ());
673677
674678 // Open the repo.
679+ mainWindow->setSideBarVisible (false );
675680 MainWindow::open (dialog->path ());
676681 });
677682
0 commit comments