From 59466c5f9e23555ea0f63764e148759efaddc8c6 Mon Sep 17 00:00:00 2001 From: tastytea Date: Tue, 15 Jan 2019 01:37:55 +0100 Subject: [PATCH] Delete all selected rows, not just half. --- CMakeLists.txt | 2 +- src/qt/mainwindow.cpp | 5 ++++- translations/whyblocked_de.ts | 22 +++++++++++----------- translations/whyblocked_en.ts | 22 +++++++++++----------- 4 files changed, 27 insertions(+), 24 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d7549ac..ab99c49 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required (VERSION 3.2) project (whyblocked - VERSION 0.14.4 + VERSION 0.14.5 LANGUAGES CXX ) diff --git a/src/qt/mainwindow.cpp b/src/qt/mainwindow.cpp index 2a2e244..9bfd6f0 100644 --- a/src/qt/mainwindow.cpp +++ b/src/qt/mainwindow.cpp @@ -196,8 +196,11 @@ void MainWindow::remove() QItemSelectionModel *selection = tableview->selectionModel(); if (selection->hasSelection()) { - for (auto &row : selection->selectedRows()) + // I use this construct here because the number of selected rows + // decrease by 1 each iteration. + for (; selection->selectedRows().count() > 0;) { + const QModelIndex row = selection->selectedRows().front(); const string user = row.data().toString().toStdString(); _database.remove(user); _model->removeRow(row.row()); diff --git a/translations/whyblocked_de.ts b/translations/whyblocked_de.ts index 3c05dc4..d0a3e06 100644 --- a/translations/whyblocked_de.ts +++ b/translations/whyblocked_de.ts @@ -198,7 +198,7 @@ - + Edit entry Eintrag bearbeiten @@ -219,18 +219,18 @@ - + User/Instance Benutzer/Instanz - + Blocked/Silenced Blockiert/Gedämpft - + Reason Begründung @@ -250,37 +250,37 @@ gedämpft - + Invalid selection Ungültige Auswahl - + Please select only 1 entry to edit. Bitte nur 1 Eintrag zum bearbeiten auswählen. - + Nothing selected Nichts ausgewählt - + Please select entries to remove. Bitte wähle Einträge aus, die gelöscht werden sollen. - + About Whyblocked Über Whyblocked - + <p><b>Whyblocked</b> %1</p><p>Reminds you why you blocked someone.</p><p>Sourcecode: <a href="https://schlomp.space/tastytea/whyblocked">https://schlomp.space/tastytea/whyblocked</a></p><p><small>Copyright © 2018 <a href="mailto:tastytea@tastytea.de">tastytea</a>.<br>Licence GPLv3: <a href="https://www.gnu.org/licenses/gpl-3.0.html">GNU GPL version 3</a>.<br>This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions.</small></p> <p><b>Whyblocked</b> %1</p><p>Erinnert dich, warum du jemanden blockiertest.</p><p>Quelltext: <a href="https://schlomp.space/tastytea/whyblocked">https://schlomp.space/tastytea/whyblocked</a></p><p><small>Copyright © 2018 <a href="mailto:tastytea@tastytea.de">tastytea</a>.<br>Lizenz GPLv3: <a href="https://www.gnu.org/licenses/gpl-3.0.html">GNU GPL version 3</a>.<br>Für dieses Programm besteht KEINERLEI GARANTIE. Dies ist freie Software, die Sie unter bestimmten Bedingungen weitergeben dürfen.</small></p> - + Receipts: Belege: diff --git a/translations/whyblocked_en.ts b/translations/whyblocked_en.ts index 44c3e96..60c0cfc 100644 --- a/translations/whyblocked_en.ts +++ b/translations/whyblocked_en.ts @@ -198,7 +198,7 @@ - + Edit entry @@ -219,18 +219,18 @@ - + User/Instance - + Blocked/Silenced - + Reason @@ -250,37 +250,37 @@ - + Invalid selection - + Please select only 1 entry to edit. - + Nothing selected - + Please select entries to remove. - + About Whyblocked - + <p><b>Whyblocked</b> %1</p><p>Reminds you why you blocked someone.</p><p>Sourcecode: <a href="https://schlomp.space/tastytea/whyblocked">https://schlomp.space/tastytea/whyblocked</a></p><p><small>Copyright © 2018 <a href="mailto:tastytea@tastytea.de">tastytea</a>.<br>Licence GPLv3: <a href="https://www.gnu.org/licenses/gpl-3.0.html">GNU GPL version 3</a>.<br>This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions.</small></p> - + Receipts: