aboutsummaryrefslogtreecommitdiff
path: root/src/mainwindow.cpp
diff options
context:
space:
mode:
authorMike Skec <skec@protonmail.ch>2021-02-18 20:24:11 +1100
committerFelix Queißner <felix@ib-queissner.de>2021-02-18 11:23:23 +0100
commit42813aa9ef1b6ada776cf0938ba02dad48a17422 (patch)
tree71b65bc669b693cde7ba2b1be5ab1b7f14bcc283 /src/mainwindow.cpp
parent415a5bd7b8288316b52338f359f5cd1280eff0bd (diff)
downloadkristall-42813aa9ef1b6ada776cf0938ba02dad48a17422.tar.gz
Add optional root/parent toolbar buttons
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r--src/mainwindow.cpp25
1 files changed, 7 insertions, 18 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 3008c0b..2851c84 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -436,7 +436,9 @@ void MainWindow::on_actionSettings_triggered()
// changes are instantly applied.
for (int i = 0; i < this->ui->browser_tabs->count(); ++i)
{
- this->tabAt(i)->needs_rerender = true;
+ BrowserTab *t = this->tabAt(i);
+ t->refreshOptionalToolbarItems();
+ t->needs_rerender = true;
}
// Re-render the currently-open tab if we have one.
BrowserTab * tab = this->curTab();
@@ -496,29 +498,16 @@ 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);
+ if(tab != nullptr) {
+ tab->navigateToRoot();
}
}
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);
+ if(tab != nullptr) {
+ tab->navigateToParent();
}
}