aboutsummaryrefslogtreecommitdiff
path: root/launcher/ui/pages/instance/ExternalResourcesPage.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'launcher/ui/pages/instance/ExternalResourcesPage.cpp')
-rw-r--r--launcher/ui/pages/instance/ExternalResourcesPage.cpp37
1 files changed, 19 insertions, 18 deletions
diff --git a/launcher/ui/pages/instance/ExternalResourcesPage.cpp b/launcher/ui/pages/instance/ExternalResourcesPage.cpp
index 41ccd1db..6f1abbff 100644
--- a/launcher/ui/pages/instance/ExternalResourcesPage.cpp
+++ b/launcher/ui/pages/instance/ExternalResourcesPage.cpp
@@ -162,7 +162,7 @@ void ExternalResourcesPage::removeItem()
int count = 0;
bool folder = false;
- for (auto i : selection.indexes()) {
+ for (auto& i : selection.indexes()) {
if (i.column() == 0) {
count++;
@@ -172,23 +172,24 @@ void ExternalResourcesPage::removeItem()
}
}
- bool enough = count > 1;
-
- if (enough || folder) {
- QString text;
- if (enough)
- text = tr("About to remove: %1 items\n"
- "This may be permanent and they will be gone from the folder.\n\n"
- "Are you sure?")
- .arg(count);
- else
- text = tr("About to remove: %1 (folder)\n"
- "This may be permanent and it will be gone from the parent folder.\n\n"
- "Are you sure?")
- .arg(m_model->at(selection.indexes().at(0).row()).fileinfo().fileName());
-
- auto response = CustomMessageBox::selectable(this, tr("CAREFUL!"), text, QMessageBox::Warning, QMessageBox::Yes | QMessageBox::No,
- QMessageBox::No)
+ QString text;
+ bool multiple = count > 1;
+
+ if (multiple) {
+ text = tr("About to remove: %1 items\n"
+ "This may be permanent and they will be gone from the folder.\n\n"
+ "Are you sure?")
+ .arg(count);
+ } else if (folder) {
+ text = tr("About to remove: %1 (folder)\n"
+ "This may be permanent and it will be gone from the parent folder.\n\n"
+ "Are you sure?")
+ .arg(m_model->at(selection.indexes().at(0).row()).fileinfo().fileName());
+ }
+
+ if (!text.isEmpty()) {
+ auto response = CustomMessageBox::selectable(this, tr("Confirm Removal"), text, QMessageBox::Warning,
+ QMessageBox::Yes | QMessageBox::No, QMessageBox::No)
->exec();
if (response != QMessageBox::Yes)