aboutsummaryrefslogtreecommitdiff
path: root/src/mainwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r--src/mainwindow.cpp29
1 files changed, 29 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();