mirror of
https://github.com/zealdocs/zeal.git
synced 2024-12-02 09:44:14 +03:00
ui: Clean up docset removal code a bit
This commit is contained in:
parent
08abd7385c
commit
7c29eb313a
@ -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 <b>%1</b> 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)
|
||||
|
Loading…
Reference in New Issue
Block a user