From 7c29eb313a338227e3e4dc91330739ecb0d2a73e Mon Sep 17 00:00:00 2001 From: Oleg Shparber Date: Wed, 14 Sep 2016 02:20:18 -0400 Subject: [PATCH] ui: Clean up docset removal code a bit --- src/libs/ui/docsetsdialog.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/libs/ui/docsetsdialog.cpp b/src/libs/ui/docsetsdialog.cpp index 3f81f45..6c8d2ef 100644 --- a/src/libs/ui/docsetsdialog.cpp +++ b/src/libs/ui/docsetsdialog.cpp @@ -243,8 +243,10 @@ void DocsetsDialog::removeSelectedDocsets() return; int ret; - if (selectonModel->selectedIndexes().count() == 1) { - const QString docsetTitle = selectonModel->selectedIndexes().first().data().toString(); + + const QModelIndexList selectedIndexes = selectonModel->selectedIndexes(); + if (selectedIndexes.size() == 1) { + const QString docsetTitle = selectedIndexes.first().data().toString(); ret = QMessageBox::question(this, QStringLiteral("Zeal"), tr("Remove %1 docset?").arg(docsetTitle)); } else { @@ -258,7 +260,7 @@ void DocsetsDialog::removeSelectedDocsets() // Gather names first, because model indicies become invalid when docsets are removed. QStringList names; - for (const QModelIndex &index : selectonModel->selectedIndexes()) + for (const QModelIndex &index : selectedIndexes) names.append(index.data(Registry::ListModel::DocsetNameRole).toString()); for (const QString &name : names)