diff options
| author | Felix (xq) Queißner <git@mq32.de> | 2020-06-08 12:20:31 +0200 |
|---|---|---|
| committer | Felix (xq) Queißner <git@mq32.de> | 2020-06-08 12:20:31 +0200 |
| commit | 25fcf4a129545cdcdceb87ca8deaeabaf2239e03 (patch) | |
| tree | f8e9363779cb7b0c8510fd1c09df3db61a8abdeb /src/mainwindow.cpp | |
| parent | 67af296c10de639c6d2391ae4608ec5c307549d2 (diff) | |
| download | kristall-25fcf4a129545cdcdceb87ca8deaeabaf2239e03.tar.gz | |
Adds changelog, utility menus, and support for file://
Diffstat (limited to 'src/mainwindow.cpp')
| -rw-r--r-- | src/mainwindow.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index e8dbd23..f2c4390 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -9,6 +9,7 @@ #include <QKeySequence> #include <QFile> #include <QTextStream> +#include <QFileDialog> MainWindow::MainWindow(QApplication * app, QWidget *parent) : QMainWindow(parent), @@ -45,6 +46,13 @@ MainWindow::MainWindow(QApplication * app, QWidget *parent) : connect(act, QOverload<bool>::of(&QAction::triggered), dock, &QDockWidget::setVisible); } + connect(this->ui->menuNavigation, &QMenu::aboutToShow, [this]() { + BrowserTab * tab = qobject_cast<BrowserTab*>(this->ui->browser_tabs->currentWidget()); + if(tab != nullptr) { + ui->actionAdd_to_favourites->setChecked(this->favourites.contains(tab->current_location)); + } + }); + connect(this->ui->menuView, &QMenu::aboutToShow, [this]() { for(QAction * act : this->ui->menuView->actions()) { @@ -309,3 +317,30 @@ void MainWindow::reloadTheme() application->setStyleSheet(stream.readAll()); } } + +void MainWindow::on_actionSave_as_triggered() +{ + BrowserTab * tab = qobject_cast<BrowserTab*>(this->ui->browser_tabs->currentWidget()); + if(tab != nullptr) { + QFileDialog::saveFileContent( + tab->current_buffer, + tab->current_location.fileName() + ); + } +} + +void MainWindow::on_actionGo_to_home_triggered() +{ + BrowserTab * tab = qobject_cast<BrowserTab*>(this->ui->browser_tabs->currentWidget()); + if(tab != nullptr) { + tab->navigateTo(QUrl(this->settings.value("start_page").toString()), BrowserTab::PushAfterSuccess); + } +} + +void MainWindow::on_actionAdd_to_favourites_triggered() +{ + BrowserTab * tab = qobject_cast<BrowserTab*>(this->ui->browser_tabs->currentWidget()); + if(tab != nullptr) { + tab->toggleIsFavourite(); + } +} |
