| 126 | } |
| 127 | |
| 128 | void ModFolderPage::removeItems(const QItemSelection& selection) |
| 129 | { |
| 130 | if (m_instance != nullptr && m_instance->isRunning()) { |
| 131 | auto response = CustomMessageBox::selectable(this, tr("Confirm Delete"), |
| 132 | tr("If you remove mods while the game is running it may crash your game.\n" |
| 133 | "Are you sure you want to do this?"), |
| 134 | QMessageBox::Warning, QMessageBox::Yes | QMessageBox::No, QMessageBox::No) |
| 135 | ->exec(); |
| 136 | |
| 137 | if (response != QMessageBox::Yes) |
| 138 | return; |
| 139 | } |
| 140 | |
| 141 | auto indexes = selection.indexes(); |
| 142 | auto affected = m_model->getAffectedMods(indexes, EnableAction::DISABLE); |
| 143 | if (!affected.isEmpty()) { |
| 144 | auto response = CustomMessageBox::selectable(this, tr("Confirm Disable"), |
| 145 | tr("The mods you are trying to delete are required by %1 mods.\n" |
| 146 | "Do you want to disable them?") |
| 147 | .arg(affected.length()), |
| 148 | QMessageBox::Warning, QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel, |
| 149 | QMessageBox::Cancel) |
| 150 | ->exec(); |
| 151 | |
| 152 | if (response == QMessageBox::Cancel) { |
| 153 | return; |
| 154 | } |
| 155 | if (response == QMessageBox::Yes) { |
| 156 | m_model->setResourceEnabled(affected, EnableAction::DISABLE); |
| 157 | } |
| 158 | } |
| 159 | m_model->deleteResources(indexes); |
| 160 | } |
| 161 | |
| 162 | void ModFolderPage::downloadMods() |
| 163 | { |
nothing calls this directly
no test coverage detected