diff options
| author | Felix (xq) Queißner <git@mq32.de> | 2020-06-29 20:17:42 +0200 |
|---|---|---|
| committer | Felix (xq) Queißner <git@mq32.de> | 2020-06-29 20:17:42 +0200 |
| commit | 8e910f26a28b1b1beae363e6c19f39224f74e2e8 (patch) | |
| tree | 282b768b54c0966578944a5b2cd717ba0fe58cfa /src/browsertab.cpp | |
| parent | dcba6f90718d3f009380ad2b2994790866b881e2 (diff) | |
| download | kristall-8e910f26a28b1b1beae363e6c19f39224f74e2e8.tar.gz | |
Paves road for new favourite system: Refactors the favourites into tree structure instead of flat list.
Diffstat (limited to 'src/browsertab.cpp')
| -rw-r--r-- | src/browsertab.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/browsertab.cpp b/src/browsertab.cpp index 47163d3..fcd809e 100644 --- a/src/browsertab.cpp +++ b/src/browsertab.cpp @@ -176,15 +176,24 @@ void BrowserTab::toggleIsFavourite() toggleIsFavourite(not this->ui->fav_button->isChecked()); } -void BrowserTab::toggleIsFavourite(bool isFavourite) +void BrowserTab::toggleIsFavourite(bool shouldBeFavourite) { - if (isFavourite) + // isFavourite is the "new" state of the checkbox, so when it's true + // we yet need to add it. + if (shouldBeFavourite) { - kristall::favourites.add(this->current_location); + kristall::favourites.addUnsorted(this->current_location); } else { - kristall::favourites.remove(this->current_location); + auto answer = QMessageBox::question( + this, + "Kristall", + tr("Do you really want to remove this page from your favourites?") + ); + if(answer != QMessageBox::Yes) + return; + kristall::favourites.removeUrl(this->current_location); } this->updateUI(); @@ -934,7 +943,7 @@ void BrowserTab::updateUI() this->ui->stop_button->setVisible(in_progress); this->ui->fav_button->setEnabled(this->successfully_loaded); - this->ui->fav_button->setChecked(kristall::favourites.contains(this->current_location)); + this->ui->fav_button->setChecked(kristall::favourites.containsUrl(this->current_location)); } bool BrowserTab::trySetClientCertificate(const QString &query) |
