aboutsummaryrefslogtreecommitdiff
path: root/browsertab.cpp
diff options
context:
space:
mode:
authorFelix (xq) Queißner <git@mq32.de>2020-06-06 20:57:56 +0200
committerFelix (xq) Queißner <git@mq32.de>2020-06-06 20:57:56 +0200
commiteb283439a68dfb70a075205859d891dca831626b (patch)
treeb54923af31c8e05e804b36860ef9bb968f1aee99 /browsertab.cpp
parent304bed8a1f567e7ba247d19ecbeeecd40833db04 (diff)
downloadkristall-eb283439a68dfb70a075205859d891dca831626b.tar.gz
Improves navigation with hotkeys, adds sane default theme, adds page margin settings.
Diffstat (limited to 'browsertab.cpp')
-rw-r--r--browsertab.cpp27
1 files changed, 21 insertions, 6 deletions
diff --git a/browsertab.cpp b/browsertab.cpp
index dc374c1..dd8b3a7 100644
--- a/browsertab.cpp
+++ b/browsertab.cpp
@@ -94,6 +94,16 @@ void BrowserTab::navigateBack(QModelIndex history_index)
}
}
+void BrowserTab::navOneBackback()
+{
+ navigateBack(history.oneBackward(current_history_index));
+}
+
+void BrowserTab::navOneForward()
+{
+ navigateBack(history.oneForward(current_history_index));
+}
+
void BrowserTab::on_menu_button_clicked()
{
QMenu menu;
@@ -130,7 +140,13 @@ void BrowserTab::on_menu_button_clicked()
void BrowserTab::on_url_bar_returnPressed()
{
- this->navigateTo(this->ui->url_bar->text(), PushImmediate);
+ QUrl url { this->ui->url_bar->text() };
+
+ if(url.scheme().isEmpty()) {
+ url = QUrl { "gemini://" + this->ui->url_bar->text() };
+ }
+
+ this->navigateTo(url, PushImmediate);
}
void BrowserTab::on_refresh_button_clicked()
@@ -391,21 +407,20 @@ void BrowserTab::on_stop_button_clicked()
gemini_client.cancelRequest();
}
-
void BrowserTab::on_back_button_clicked()
{
- navigateBack(current_history_index.sibling(-1, 0));
+ navOneBackback();
}
void BrowserTab::on_forward_button_clicked()
{
- navigateBack(current_history_index.sibling(1, 0));
+ navOneForward();
}
void BrowserTab::updateUI()
{
- this->ui->back_button->setEnabled(current_history_index.sibling(-1, 0).isValid());
- this->ui->forward_button->setEnabled(current_history_index.sibling(1, 0).isValid());
+ this->ui->back_button->setEnabled(history.oneBackward(current_history_index).isValid());
+ this->ui->forward_button->setEnabled(history.oneForward(current_history_index).isValid());
this->ui->refresh_button->setVisible(this->successfully_loaded);
this->ui->stop_button->setVisible(not this->successfully_loaded);