From 2d3aa901727da641eca5daae7d5cee3eedca6e7f Mon Sep 17 00:00:00 2001 From: Mike Skec Date: Mon, 4 Jan 2021 13:28:56 +1100 Subject: Remove toggleIsFavourite - no longer needed also rename addToFavouritesPopup to showFavouritesPopup --- src/browsertab.cpp | 35 ++--------------------------------- src/browsertab.hpp | 6 +----- src/mainwindow.cpp | 2 +- 3 files changed, 4 insertions(+), 39 deletions(-) (limited to 'src') diff --git a/src/browsertab.cpp b/src/browsertab.cpp index c8fc307..820952a 100644 --- a/src/browsertab.cpp +++ b/src/browsertab.cpp @@ -188,37 +188,6 @@ void BrowserTab::reloadPage() this->navigateTo(this->current_location, DontPush); } -void BrowserTab::toggleIsFavourite() -{ - toggleIsFavourite(not this->ui->fav_button->isChecked()); -} - -void BrowserTab::toggleIsFavourite(bool shouldBeFavourite) -{ - // isFavourite is the "new" state of the checkbox, so when it's true - // we yet need to add it. - if (shouldBeFavourite) - { - kristall::favourites.addUnsorted(this->current_location, this->page_title); - } - else - { - auto answer = QMessageBox::question( - this, - "Kristall", - tr("Do you really want to remove this page from your favourites?") - ); - if(answer != QMessageBox::Yes) - { - this->updateUI(); - return; - } - kristall::favourites.removeUrl(this->current_location); - } - - this->updateUI(); -} - void BrowserTab::focusUrlBar() { this->ui->url_bar->setFocus(Qt::ShortcutFocusReason); @@ -873,7 +842,7 @@ void BrowserTab::pushToHistory(const QUrl &url) this->updateUI(); } -void BrowserTab::addToFavouritesPopup() +void BrowserTab::showFavouritesPopup() { // We add it to favourites immediately. kristall::favourites.addUnsorted(this->current_location, this->page_title); @@ -895,7 +864,7 @@ void BrowserTab::addToFavouritesPopup() void BrowserTab::on_fav_button_clicked() { - this->addToFavouritesPopup(); + this->showFavouritesPopup(); } void BrowserTab::on_text_browser_anchorClicked(const QUrl &url, bool open_in_new_tab) diff --git a/src/browsertab.hpp b/src/browsertab.hpp index 7b0b749..42b86eb 100644 --- a/src/browsertab.hpp +++ b/src/browsertab.hpp @@ -65,10 +65,6 @@ public: void reloadPage(); - void toggleIsFavourite(); - - void toggleIsFavourite(bool isFavourite); - void focusUrlBar(); void focusSearchBar(); @@ -83,7 +79,7 @@ public: void refreshFavButton(); - void addToFavouritesPopup(); + void showFavouritesPopup(); void setUrlBarText(const QString & text); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 38077ee..f21047f 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -449,7 +449,7 @@ void MainWindow::on_actionAdd_to_favourites_triggered() { BrowserTab * tab = this->curTab(); if(tab != nullptr) { - tab->addToFavouritesPopup(); + tab->showFavouritesPopup(); } } -- cgit v1.2.3