diff --git a/src/installationmanager.cpp b/src/installationmanager.cpp index 901c636cb..3f247b388 100644 --- a/src/installationmanager.cpp +++ b/src/installationmanager.cpp @@ -667,20 +667,21 @@ InstallationResult InstallationManager::install(const QString& fileName, if (category != 0 && categoryIndex == 0U && Settings::instance().nexus().categoryMappings()) { QMessageBox nexusQuery; + nexusQuery.setWindowTitle(tr("No category found")); nexusQuery.setText(tr( "This Nexus category has not yet been mapped. Do you wish to proceed without " "setting a category, proceed and disable automatic Nexus mappings, or stop " "and configure your category mappings?")); - nexusQuery.addButton(tr("&Proceed"), QMessageBox::YesRole); - nexusQuery.addButton(tr("&Disable"), QMessageBox::AcceptRole); - nexusQuery.addButton(tr("&Stop && Configure"), QMessageBox::DestructiveRole); - auto ret = nexusQuery.exec(); - switch (ret) { - case 1: + QPushButton* proceedButton = + nexusQuery.addButton(tr("&Proceed"), QMessageBox::YesRole); + QPushButton* disableButton = + nexusQuery.addButton(tr("&Disable"), QMessageBox::AcceptRole); + QPushButton* stopButton = + nexusQuery.addButton(tr("&Stop && Configure"), QMessageBox::DestructiveRole); + nexusQuery.exec(); + if (nexusQuery.clickedButton() == disableButton) { Settings::instance().nexus().setCategoryMappings(false); - case 0: - break; - case 2: + } else if (nexusQuery.clickedButton() == stopButton) { return MOBase::IPluginInstaller::RESULT_CATEGORYREQUESTED; } } else { diff --git a/src/modlistviewactions.cpp b/src/modlistviewactions.cpp index a86c90676..fd2f5c68d 100644 --- a/src/modlistviewactions.cpp +++ b/src/modlistviewactions.cpp @@ -262,6 +262,21 @@ void ModListViewActions::checkModsForUpdates() const void ModListViewActions::assignCategories() const { + if (!GlobalSettings::hideAssignCategoriesQuestion()) { + QMessageBox warning; + warning.setWindowTitle(tr("Are you sure?")); + warning.setText( + tr("This action will remove any existing categories on any mod with a valid " + "Nexus category mapping. Are you certain you want to proceed?")); + warning.setStandardButtons(QMessageBox::Yes | QMessageBox::Cancel); + QCheckBox dontShow(tr("&Don't show this again")); + warning.setCheckBox(&dontShow); + auto result = warning.exec(); + if (dontShow.isChecked()) + GlobalSettings::setHideAssignCategoriesQuestion(true); + if (result == QMessageBox::Cancel) + return; + } for (auto mod : m_core.modList()->allMods()) { ModInfo::Ptr modInfo = ModInfo::getByName(mod); QString file = modInfo->installationFile(); @@ -269,7 +284,7 @@ void ModListViewActions::assignCategories() const if (!nexusCategory) { auto download = m_core.downloadManager()->getDownloadIndex(file); if (download >= 0) { - int nexusCategory = m_core.downloadManager()->getCategoryID(download); + nexusCategory = m_core.downloadManager()->getCategoryID(download); } } int newCategory = CategoryFactory::instance()->resolveNexusID(nexusCategory); diff --git a/src/settings.cpp b/src/settings.cpp index 17de38eaa..04a094676 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -2450,6 +2450,16 @@ void GlobalSettings::setHideCategoryReminder(bool b) settings().setValue("HideCategoryReminder", b); } +bool GlobalSettings::hideAssignCategoriesQuestion() +{ + return settings().value("HideAssignCategoriesQuestion", false).toBool(); +} + +void GlobalSettings::setHideAssignCategoriesQuestion(bool b) +{ + settings().setValue("HideAssignCategoriesQuestion", b); +} + bool GlobalSettings::nexusApiKey(QString& apiKey) { QString tempKey = getWindowsCredential("APIKEY"); diff --git a/src/settings.h b/src/settings.h index e7ca47a97..30254c066 100644 --- a/src/settings.h +++ b/src/settings.h @@ -931,6 +931,9 @@ class GlobalSettings static bool hideCategoryReminder(); static void setHideCategoryReminder(bool b); + static bool hideAssignCategoriesQuestion(); + static void setHideAssignCategoriesQuestion(bool b); + // if the key exists from the credentials store, puts it in `apiKey` and // returns true; otherwise, returns false and leaves `apiKey` untouched //