Skip to content

Commit

Permalink
Switch automatically to newly opened tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
npmiller authored and PCMan committed Mar 21, 2016
1 parent 51bf53e commit 7ef9555
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions pcmanfm/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ void MainWindow::chdir(FmPath* path) {
}

// add a new tab
void MainWindow::addTab(FmPath* path) {
int MainWindow::addTab(FmPath* path) {
Settings& settings = static_cast<Application*>(qApp)->settings();

TabPage* newPage = new TabPage(path, this);
Expand All @@ -297,6 +297,8 @@ void MainWindow::addTab(FmPath* path) {
if(!settings.alwaysShowTabs()) {
ui.tabBar->setVisible(ui.tabBar->count() > 1);
}

return index;
}

void MainWindow::toggleMenuBar(bool checked) {
Expand Down Expand Up @@ -375,7 +377,8 @@ void MainWindow::on_actionGo_triggered() {

void MainWindow::on_actionNewTab_triggered() {
FmPath* path = currentPage()->path();
addTab(path);
int index = addTab(path);
ui.tabBar->setCurrentIndex(index);
}

void MainWindow::on_actionNewWin_triggered() {
Expand Down
2 changes: 1 addition & 1 deletion pcmanfm/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Q_OBJECT
virtual ~MainWindow();

void chdir(FmPath* path);
void addTab(FmPath* path);
int addTab(FmPath* path);

TabPage* currentPage() {
return reinterpret_cast<TabPage*>(ui.stackedWidget->currentWidget());
Expand Down

0 comments on commit 7ef9555

Please sign in to comment.