diff options
| -rw-r--r-- | src/mainwindow.cpp | 29 | ||||
| -rw-r--r-- | src/mainwindow.hpp | 4 | ||||
| -rw-r--r-- | src/mainwindow.ui | 24 |
3 files changed, 57 insertions, 0 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index d656867..d2623eb 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -482,6 +482,35 @@ void MainWindow::on_actionBackward_triggered() } } +void MainWindow::on_actionRoot_triggered() +{ + BrowserTab * tab = this->curTab(); + if(tab != nullptr && !tab->is_internal_location) { + QUrl url = tab->current_location; + url.setPath("/"); + tab->navigateTo(url, BrowserTab::PushImmediate); + } +} + +void MainWindow::on_actionParent_triggered() +{ + BrowserTab * tab = this->curTab(); + if(tab != nullptr && !tab->is_internal_location) { + QUrl url = tab->current_location; + + // Make sure we have a trailing slash, or else + // QUrl::resolved will not work + if (!url.path().endsWith("/")) + { + url.setPath(url.path() + "/"); + } + + // Go up one directory + url = url.resolved(QUrl{".."}); + tab->navigateTo(url, BrowserTab::PushImmediate); + } +} + void MainWindow::on_actionRefresh_triggered() { BrowserTab * tab = this->curTab(); diff --git a/src/mainwindow.hpp b/src/mainwindow.hpp index 7602ac5..a252daa 100644 --- a/src/mainwindow.hpp +++ b/src/mainwindow.hpp @@ -70,6 +70,10 @@ private slots: void on_actionBackward_triggered(); + void on_actionRoot_triggered(); + + void on_actionParent_triggered(); + void on_actionRefresh_triggered(); void on_actionAbout_Qt_triggered(); diff --git a/src/mainwindow.ui b/src/mainwindow.ui index bc503ca..5c11e56 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -222,6 +222,8 @@ <addaction name="actionGo_to_home"/> <addaction name="actionBackward"/> <addaction name="actionForward"/> + <addaction name="actionRoot"/> + <addaction name="actionParent"/> <addaction name="separator"/> <addaction name="actionRefresh"/> <addaction name="separator"/> @@ -310,6 +312,28 @@ <string>Alt+Right</string> </property> </action> + <action name="actionRoot"> + <property name="text"> + <string>Root</string> + </property> + <property name="toolTip"> + <string>Go to the root directory (/)</string> + </property> + <property name="shortcut"> + <string>Ctrl+/</string> + </property> + </action> + <action name="actionParent"> + <property name="text"> + <string>Parent</string> + </property> + <property name="toolTip"> + <string>Go to the parent directory</string> + </property> + <property name="shortcut"> + <string>Alt+Up</string> + </property> + </action> <action name="actionRefresh"> <property name="icon"> <iconset theme="view-refresh"/> |
