[PATCH 3 of 3] (issue166) Only acticate removal if all selected certificates can be remvoed
Wald Commits
scm-commit at wald.intevation.org
Mon Oct 13 17:42:01 CEST 2014
# HG changeset patch
# User Andre Heinecke <andre.heinecke at intevation.de>
# Date 1413214915 -7200
# Node ID 45082ec23e764a7d53383af0ab8c36a267e1e443
# Parent d009da9cfa10d2f35bdedfa76fa4657a51609f4d
(issue166) Only acticate removal if all selected certificates can be remvoed
diff -r d009da9cfa10 -r 45082ec23e76 ui/administratorwindow.cpp
--- a/ui/administratorwindow.cpp Mon Oct 13 17:41:12 2014 +0200
+++ b/ui/administratorwindow.cpp Mon Oct 13 17:41:55 2014 +0200
@@ -198,8 +198,7 @@
QModelIndexList list = certificateView->selectionModel()->selectedRows();
foreach (QModelIndex idx, list) {
QModelIndex realidx = mFilterModel->mapToSource(idx);
- qDebug() << "About to remove row: " << realidx.row();
- if (certificateModel->data(idx, Qt::UserRole).toBool()) {
+ if (!idx.data(Qt::UserRole).toBool()) {
certificateModel->removeRow(realidx.row(), realidx.parent());
} else {
qDebug() << "Tried to remove old certificate at idx: " << realidx.row();;
@@ -237,12 +236,15 @@
void AdministratorWindow::clickedCertificate(const QModelIndex &index)
{
- if (index.data(Qt::UserRole).toBool()) {
- removeButton->setEnabled(false);
+ QModelIndexList list = certificateView->selectionModel()->selectedRows();
+ bool all_are_removable = true;
+ foreach (QModelIndex idx, list) {
+ if (idx.data(Qt::UserRole).toBool()) {
+ all_are_removable = false;
+ break;
+ }
}
- else {
- removeButton->setEnabled(true);
- }
+ removeButton->setEnabled(all_are_removable);
}
void AdministratorWindow::logChanges(const QString ¤tCerts, const QString& keyFingerprint)
More information about the Trustbridge-commits
mailing list