removed warning for one mod selected

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
Trial97 2023-08-16 21:26:43 +03:00
parent 6c2c724bd9
commit b0e197de38
No known key found for this signature in database
GPG Key ID: 55EF5DA53DB36318

View File

@ -310,23 +310,20 @@ void ModFolderPage::visitModPages()
void ModFolderPage::deleteModMetadata() void ModFolderPage::deleteModMetadata()
{ {
auto selection = m_filterModel->mapSelectionToSource(ui->treeView->selectionModel()->selection()).indexes(); auto selection = m_filterModel->mapSelectionToSource(ui->treeView->selectionModel()->selection()).indexes();
QString text;
auto selectionCount = m_model->selectedMods(selection).length(); auto selectionCount = m_model->selectedMods(selection).length();
if (selectionCount == 0) if (selectionCount == 0)
return; return;
else if (selectionCount > 1) if (selectionCount > 1) {
text = tr("You are about to remove the metadata for %1 mods.\n" auto response = CustomMessageBox::selectable(this, tr("Confirm Removal"),
"Are you sure?") tr("You are about to remove the metadata for %1 mods.\n"
.arg(selectionCount); "Are you sure?")
else .arg(selectionCount),
text = tr("You are about to remove the metadata for %1.\n" QMessageBox::Warning, QMessageBox::Yes | QMessageBox::No, QMessageBox::No)
"Are you sure?") ->exec();
.arg(m_model->at(selection.at(0).row())->name());
auto response = CustomMessageBox::selectable(this, tr("Confirm Removal"), text, QMessageBox::Warning, if (response != QMessageBox::Yes)
QMessageBox::Yes | QMessageBox::No, QMessageBox::No) return;
->exec(); }
if (response == QMessageBox::Yes) m_model->deleteModsMetadata(selection);
m_model->deleteModsMetadata(selection);
} }