summaryrefslogtreecommitdiff
path: root/src/modlist.cpp
diff options
context:
space:
mode:
authorTannin <devnull@localhost>2013-04-13 19:23:18 +0200
committerTannin <devnull@localhost>2013-04-13 19:23:18 +0200
commit1c9018e9fdba7878b0ef605f81529c20ef3bbffe (patch)
tree7b52a5f7b9091ea68f03d06692bba4c240d30d49 /src/modlist.cpp
parent528338d7bfb5479115511f77b70219eda1b32a62 (diff)
- bugfix: wrong multibyte to widechar conversion in hookdll breaks internationalization
- bugfix: mod names not checked for validity on rename - bugfix: mod list wasn't invalidated after rename (regression?) - problem reports moved to separate dialog - ncc plugin now does the check for dotNet - python plugin wrapper started (only supports tools currently) - new ini editor plugin in python (non-functional currently)
Diffstat (limited to 'src/modlist.cpp')
-rw-r--r--src/modlist.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/modlist.cpp b/src/modlist.cpp
index f186ce8e..2183ce09 100644
--- a/src/modlist.cpp
+++ b/src/modlist.cpp
@@ -20,12 +20,11 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include "modlist.h"
#include "report.h"
-#include "utility.h"
#include "messagedialog.h"
#include "installationtester.h"
#include "qtgroupingproxy.h"
#include <gameinfo.h>
-
+#include <utility.h>
#include <QFileInfo>
#include <QDir>
#include <QDirIterator>
@@ -301,19 +300,25 @@ QVariant ModList::data(const QModelIndex &modelIndex, int role) const
bool ModList::renameMod(int index, const QString &newName)
{
+ QString nameFixed = newName;
+ if (!fixDirectoryName(nameFixed) || nameFixed.isEmpty()) {
+ MessageDialog::showMessage(tr("Invalid name"), NULL);
+ return false;
+ }
+
// before we rename, write back the current profile so we don't lose changes and to ensure
// there is no scheduled asynchronous rewrite anytime soon
m_Profile->writeModlistNow();
ModInfo::Ptr modInfo = ModInfo::getByIndex(index);
QString oldName = modInfo->name();
- modInfo->setName(newName);
+ modInfo->setName(nameFixed);
// this just broke all profiles! The recipient of modRenamed has to do some magic
// to can't write the currently active profile back
- emit modRenamed(oldName, newName);
+ emit modRenamed(oldName, nameFixed);
// invalidate the currently displayed state of this list
-// notifyChange(-1);
+ notifyChange(-1);
return true;
}