@@ -501,8 +501,7 @@ FilesDock::FilesDock(QWidget *parent)
501501 toggleViewAction ()->setIcon (windowIcon ());
502502
503503 const auto ls = QStandardPaths::standardLocations (QStandardPaths::HomeLocation);
504- const auto home = ls.first ();
505- ui->locationsCombo ->addItem (tr (" Home" , " The user's home folder in the file system" ), home);
504+ ui->locationsCombo ->addItem (tr (" Home" , " The user's home folder in the file system" ), ls.first ());
506505 ui->locationsCombo ->addItem (tr (" Current Project" ), " " );
507506 ui->locationsCombo ->addItem (tr (" Documents" ),
508507 QStandardPaths::standardLocations (QStandardPaths::DocumentsLocation).first ());
@@ -540,7 +539,7 @@ FilesDock::FilesDock(QWidget *parent)
540539 m_filesModel->setOption (QFileSystemModel::DontUseCustomDirectoryIcons);
541540 m_filesModel->setFilter (QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot);
542541 m_filesModel->setReadOnly (true );
543- m_filesModel->setRootPath (home );
542+ m_filesModel->setRootPath (Settings. filesCurrentDir () );
544543 m_filesProxyModel = new FilesProxyModel (this );
545544 m_filesProxyModel->setFilterCaseSensitivity (Qt::CaseInsensitive);
546545 m_filesProxyModel->setSourceModel (m_filesModel);
@@ -567,10 +566,13 @@ FilesDock::FilesDock(QWidget *parent)
567566 for (int i = 1 ; i < m_dirsModel->columnCount (); ++i)
568567 ui->treeView ->hideColumn (i);
569568 ui->treeView ->setContextMenuPolicy (Qt::CustomContextMenu);
570- const auto homeIndex = m_dirsModel->index (home );
569+ const auto homeIndex = m_dirsModel->index (Settings. filesCurrentDir () );
571570 ui->treeView ->setExpanded (homeIndex, true );
572571 ui->treeView ->scrollTo (homeIndex);
573572 ui->treeView ->setCurrentIndex (homeIndex);
573+ QTimer::singleShot (0 , this , [=](){
574+ ui->treeView ->setVisible (Settings.filesFoldersOpen ());
575+ });
574576 connect (ui->treeView , &QWidget::customContextMenuRequested, this , [ = ](const QPoint & pos) {
575577 QMenu menu (this );
576578 menu.exec (mapToGlobal (pos));
@@ -579,6 +581,7 @@ FilesDock::FilesDock(QWidget *parent)
579581 auto filePath = m_dirsModel->filePath (index);
580582 LOG_DEBUG () << " clicked" << filePath;
581583 auto sourceIndex = m_filesModel->setRootPath (filePath);
584+ Settings.setFilesCurrentDir (m_filesModel->rootPath ());
582585 m_view->setRootIndex (m_filesProxyModel->mapFromSource (sourceIndex));
583586 m_view->scrollToTop ();
584587 });
@@ -674,6 +677,7 @@ FilesDock::FilesDock(QWidget *parent)
674677 LOG_DEBUG () << " activated" << filePath;
675678 if (m_filesModel->isDir (sourceIndex)) {
676679 m_filesModel->setRootPath (filePath);
680+ Settings.setFilesCurrentDir (filePath);
677681 m_view->setRootIndex (index);
678682 m_view->setCurrentIndex (QModelIndex ());
679683 m_view->scrollToTop ();
@@ -705,11 +709,11 @@ FilesDock::FilesDock(QWidget *parent)
705709 SLOT (viewCustomContextMenuRequested (QPoint)));
706710 }
707711
708- if (Settings.viewMode () == kDetailedMode ) {
712+ if (Settings.filesViewMode () == kDetailedMode ) {
709713 Actions[" filesViewDetailsAction" ]->trigger ();
710- } else if (Settings.viewMode () == kTiledMode ) {
714+ } else if (Settings.filesViewMode () == kTiledMode ) {
711715 Actions[" filesViewTilesAction" ]->trigger ();
712- } else { /* if (Settings.viewMode () == kIconsMode) */
716+ } else { /* if (Settings.filesViewMode () == kIconsMode) */
713717 Actions[" filesViewIconsAction" ]->trigger ();
714718 }
715719 addOpenWithMenu (m_mainMenu);
@@ -925,9 +929,10 @@ void FilesDock::setupActions()
925929 QIcon (" :/icons/oxygen/32x32/actions/view-choose.png" ));
926930 action->setIcon (icon);
927931 action->setCheckable (true );
928- action->setChecked (true );
932+ action->setChecked (Settings. filesFoldersOpen () );
929933 connect (action, &QAction::triggered, this , [ = ](bool checked) {
930934 ui->treeView ->setVisible (checked);
935+ Settings.setFilesFoldersOpen (checked);
931936 });
932937 Actions.add (" filesFoldersView" , action, windowTitle ());
933938
@@ -942,6 +947,7 @@ void FilesDock::setupActions()
942947 dir.cdUp ();
943948 const auto filePath = dir.absolutePath ();
944949 const auto index = m_filesModel->setRootPath (filePath);
950+ Settings.setFilesCurrentDir (filePath);
945951 m_view->setRootIndex (m_filesProxyModel->mapFromSource (index));
946952 m_view->scrollToTop ();
947953 const auto dirsIndex = m_dirsModel->index (filePath);
@@ -1066,6 +1072,7 @@ void FilesDock::changeDirectory(const QString &filePath)
10661072 ui->treeView ->scrollTo (index);
10671073 ui->treeView ->setCurrentIndex (index);
10681074 index = m_filesModel->setRootPath (path);
1075+ Settings.setFilesCurrentDir (path);
10691076 m_view->setRootIndex (m_filesProxyModel->mapFromSource (index));
10701077 if (info.isDir ()) {
10711078 m_view->scrollToTop ();
@@ -1129,6 +1136,7 @@ void FilesDock::keyPressEvent(QKeyEvent *event)
11291136 const auto filePath = m_filesModel->filePath (sourceIndex);
11301137 if (m_filesModel->isDir (sourceIndex)) {
11311138 m_filesModel->setRootPath (filePath);
1139+ Settings.setFilesCurrentDir (filePath);
11321140 m_view->setRootIndex (index);
11331141 m_view->scrollToTop ();
11341142 const auto dirsIndex = m_dirsModel->index (filePath);
0 commit comments