diff options
| author | LostDragonist <lost.dragonist@gmail.com> | 2018-08-19 13:02:30 -0500 |
|---|---|---|
| committer | LostDragonist <lost.dragonist@gmail.com> | 2018-08-19 13:02:30 -0500 |
| commit | a2eb3e02665ae4dd2d6029142ac28d27f1cef361 (patch) | |
| tree | aac1b9bc332863770b2c1a81a27a8d0ccd47931c /src | |
| parent | d65031c814769079a72d79b0edb84a20266b2b3c (diff) | |
Prevent user from deleting currently active profile
Diffstat (limited to 'src')
| -rw-r--r-- | src/organizer_en.ts | 80 | ||||
| -rw-r--r-- | src/profilesdialog.cpp | 14 | ||||
| -rw-r--r-- | src/profilesdialog.h | 1 |
3 files changed, 52 insertions, 43 deletions
diff --git a/src/organizer_en.ts b/src/organizer_en.ts index 0d0cae2c..8b8bd101 100644 --- a/src/organizer_en.ts +++ b/src/organizer_en.ts @@ -2886,7 +2886,7 @@ You can also use online editors and converters instead.</source> </message> <message> <location filename="mainwindow.cpp" line="4562"/> - <location filename="mainwindow.cpp" line="5016"/> + <location filename="mainwindow.cpp" line="5019"/> <source>Error</source> <translation type="unfinished"></translation> </message> @@ -2966,79 +2966,79 @@ You can also use online editors and converters instead.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="mainwindow.cpp" line="5089"/> + <location filename="mainwindow.cpp" line="5092"/> <source>loot failed. Exit code was: %1</source> <translation type="unfinished"></translation> </message> <message> - <location filename="mainwindow.cpp" line="5111"/> + <location filename="mainwindow.cpp" line="5114"/> <source>failed to start loot</source> <translation type="unfinished"></translation> </message> <message> - <location filename="mainwindow.cpp" line="5114"/> + <location filename="mainwindow.cpp" line="5117"/> <source>failed to run loot: %1</source> <translation type="unfinished"></translation> </message> <message> - <location filename="mainwindow.cpp" line="5118"/> + <location filename="mainwindow.cpp" line="5121"/> <source>Errors occured</source> <translation type="unfinished"></translation> </message> <message> - <location filename="mainwindow.cpp" line="5165"/> + <location filename="mainwindow.cpp" line="5168"/> <source>Backup of load order created</source> <translation type="unfinished"></translation> </message> <message> - <location filename="mainwindow.cpp" line="5175"/> + <location filename="mainwindow.cpp" line="5178"/> <source>Choose backup to restore</source> <translation type="unfinished"></translation> </message> <message> - <location filename="mainwindow.cpp" line="5188"/> + <location filename="mainwindow.cpp" line="5191"/> <source>No Backups</source> <translation type="unfinished"></translation> </message> <message> - <location filename="mainwindow.cpp" line="5188"/> + <location filename="mainwindow.cpp" line="5191"/> <source>There are no backups to restore</source> <translation type="unfinished"></translation> </message> <message> - <location filename="mainwindow.cpp" line="5209"/> - <location filename="mainwindow.cpp" line="5231"/> + <location filename="mainwindow.cpp" line="5212"/> + <location filename="mainwindow.cpp" line="5234"/> <source>Restore failed</source> <translation type="unfinished"></translation> </message> <message> - <location filename="mainwindow.cpp" line="5210"/> - <location filename="mainwindow.cpp" line="5232"/> + <location filename="mainwindow.cpp" line="5213"/> + <location filename="mainwindow.cpp" line="5235"/> <source>Failed to restore the backup. Errorcode: %1</source> <translation type="unfinished"></translation> </message> <message> - <location filename="mainwindow.cpp" line="5221"/> + <location filename="mainwindow.cpp" line="5224"/> <source>Backup of modlist created</source> <translation type="unfinished"></translation> </message> <message> - <location filename="mainwindow.cpp" line="5327"/> + <location filename="mainwindow.cpp" line="5330"/> <source>A file with the same name has already been downloaded. What would you like to do?</source> <translation type="unfinished"></translation> </message> <message> - <location filename="mainwindow.cpp" line="5329"/> + <location filename="mainwindow.cpp" line="5332"/> <source>Overwrite</source> <translation type="unfinished"></translation> </message> <message> - <location filename="mainwindow.cpp" line="5330"/> + <location filename="mainwindow.cpp" line="5333"/> <source>Rename new file</source> <translation type="unfinished"></translation> </message> <message> - <location filename="mainwindow.cpp" line="5331"/> + <location filename="mainwindow.cpp" line="5334"/> <source>Ignore file</source> <translation type="unfinished"></translation> </message> @@ -4199,108 +4199,108 @@ p, li { white-space: pre-wrap; } <translation type="unfinished"></translation> </message> <message> - <location filename="organizercore.cpp" line="1315"/> + <location filename="organizercore.cpp" line="1318"/> <source>Error</source> <translation type="unfinished"></translation> </message> <message> - <location filename="organizercore.cpp" line="1323"/> + <location filename="organizercore.cpp" line="1326"/> <source>Windows Event Log Error</source> <translation type="unfinished"></translation> </message> <message> - <location filename="organizercore.cpp" line="1324"/> + <location filename="organizercore.cpp" line="1327"/> <source>The Windows Event Log service is disabled and/or not running. This prevents USVFS from running properly. Your mods may not be working in the executable that you are launching. Note that you may have to restart MO and/or your PC after the service is fixed. Continue launching %1?</source> <translation type="unfinished"></translation> </message> <message> - <location filename="organizercore.cpp" line="1412"/> + <location filename="organizercore.cpp" line="1415"/> <source>No profile set</source> <translation type="unfinished"></translation> </message> <message> - <location filename="organizercore.cpp" line="1698"/> + <location filename="organizercore.cpp" line="1701"/> <source>Failed to refresh list of esps: %1</source> <translation type="unfinished"></translation> </message> <message> - <location filename="organizercore.cpp" line="1782"/> + <location filename="organizercore.cpp" line="1785"/> <source>Multiple esps/esls activated, please check that they don't conflict.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="organizercore.cpp" line="1857"/> + <location filename="organizercore.cpp" line="1860"/> <source>Download?</source> <translation type="unfinished"></translation> </message> <message> - <location filename="organizercore.cpp" line="1858"/> + <location filename="organizercore.cpp" line="1861"/> <source>A download has been started but no installed page plugin recognizes it. If you download anyway no information (i.e. version) will be associated with the download. Continue?</source> <translation type="unfinished"></translation> </message> <message> - <location filename="organizercore.cpp" line="1992"/> + <location filename="organizercore.cpp" line="1995"/> <source>failed to update mod list: %1</source> <translation type="unfinished"></translation> </message> <message> - <location filename="organizercore.cpp" line="1999"/> - <location filename="organizercore.cpp" line="2016"/> + <location filename="organizercore.cpp" line="2002"/> + <location filename="organizercore.cpp" line="2019"/> <source>login successful</source> <translation type="unfinished"></translation> </message> <message> - <location filename="organizercore.cpp" line="2023"/> + <location filename="organizercore.cpp" line="2026"/> <source>Login failed</source> <translation type="unfinished"></translation> </message> <message> - <location filename="organizercore.cpp" line="2024"/> + <location filename="organizercore.cpp" line="2027"/> <source>Login failed, try again?</source> <translation type="unfinished"></translation> </message> <message> - <location filename="organizercore.cpp" line="2033"/> + <location filename="organizercore.cpp" line="2036"/> <source>login failed: %1. Download will not be associated with an account</source> <translation type="unfinished"></translation> </message> <message> - <location filename="organizercore.cpp" line="2041"/> + <location filename="organizercore.cpp" line="2044"/> <source>login failed: %1</source> <translation type="unfinished"></translation> </message> <message> - <location filename="organizercore.cpp" line="2051"/> + <location filename="organizercore.cpp" line="2054"/> <source>login failed: %1. You need to log-in with Nexus to update MO.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="organizercore.cpp" line="2104"/> + <location filename="organizercore.cpp" line="2107"/> <source>MO1 "Script Extender" load mechanism has left hook.dll in your game folder</source> <translation type="unfinished"></translation> </message> <message> - <location filename="organizercore.cpp" line="2107"/> - <location filename="organizercore.cpp" line="2123"/> + <location filename="organizercore.cpp" line="2110"/> + <location filename="organizercore.cpp" line="2126"/> <source>Description missing</source> <translation type="unfinished"></translation> </message> <message> - <location filename="organizercore.cpp" line="2116"/> + <location filename="organizercore.cpp" line="2119"/> <source><a href="%1">hook.dll</a> has been found in your game folder (right click to copy the full path). This is most likely a leftover of setting the ModOrganizer 1 load mechanism to "Script Extender", in which case you must remove this file either by changing the load mechanism in ModOrganizer 1 or manually removing the file, otherwise the game is likely to crash and burn.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="organizercore.cpp" line="2150"/> + <location filename="organizercore.cpp" line="2153"/> <source>failed to save load order: %1</source> <translation type="unfinished"></translation> </message> <message> - <location filename="organizercore.cpp" line="2222"/> + <location filename="organizercore.cpp" line="2225"/> <source>The designated write target "%1" is not enabled.</source> <translation type="unfinished"></translation> </message> diff --git a/src/profilesdialog.cpp b/src/profilesdialog.cpp index 04c1876d..f0bbe6ed 100644 --- a/src/profilesdialog.cpp +++ b/src/profilesdialog.cpp @@ -53,6 +53,7 @@ ProfilesDialog::ProfilesDialog(const QString &profileName, MOBase::IPluginGame c , ui(new Ui::ProfilesDialog)
, m_FailState(false)
, m_Game(game)
+ , m_ActiveProfileName("")
{
ui->setupUi(this);
@@ -66,6 +67,7 @@ ProfilesDialog::ProfilesDialog(const QString &profileName, MOBase::IPluginGame c QListWidgetItem *item = addItem(profileIter.filePath());
if (profileName == profileIter.fileName()) {
ui->profilesList->setCurrentItem(item);
+ m_ActiveProfileName = profileName;
}
}
@@ -182,13 +184,19 @@ void ProfilesDialog::on_copyProfileButton_clicked() void ProfilesDialog::on_removeProfileButton_clicked()
{
+ Profile::Ptr profileToDelete = ui->profilesList->currentItem()->data(Qt::UserRole).value<Profile::Ptr>();
+ if (profileToDelete->name() == m_ActiveProfileName) {
+ QMessageBox::warning(this, tr("Deleting active profile"),
+ tr("Unable to delete active profile. Please change to a different profile first."));
+ return;
+ }
+
QMessageBox confirmBox(QMessageBox::Question, tr("Confirm"), tr("Are you sure you want to remove this profile (including local savegames if any)?"),
QMessageBox::Yes | QMessageBox::No);
if (confirmBox.exec() == QMessageBox::Yes) {
- Profile::Ptr currentProfile = ui->profilesList->currentItem()->data(Qt::UserRole).value<Profile::Ptr>();
QString profilePath;
- if (currentProfile.get() == nullptr) {
+ if (profileToDelete.get() == nullptr) {
profilePath = Settings::instance().getProfileDirectory()
+ "/" + ui->profilesList->currentItem()->text();
if (QMessageBox::question(this, tr("Profile broken"),
@@ -199,7 +207,7 @@ void ProfilesDialog::on_removeProfileButton_clicked() } else {
// on destruction, the profile object would write the profile.ini file again, so
// we have to get rid of the it before deleting the directory
- profilePath = currentProfile->absolutePath();
+ profilePath = profileToDelete->absolutePath();
}
QListWidgetItem* item = ui->profilesList->takeItem(ui->profilesList->currentRow());
if (item != nullptr) {
diff --git a/src/profilesdialog.h b/src/profilesdialog.h index cab25f6a..a328ce40 100644 --- a/src/profilesdialog.h +++ b/src/profilesdialog.h @@ -95,6 +95,7 @@ private: QListWidget *m_ProfilesList;
bool m_FailState;
MOBase::IPluginGame const *m_Game;
+ QString m_ActiveProfileName;
};
#endif // PROFILESDIALOG_H
|
