summaryrefslogtreecommitdiff
path: root/src/downloadmanager.cpp
diff options
context:
space:
mode:
authorTannin <devnull@localhost>2013-10-10 21:23:25 +0200
committerTannin <devnull@localhost>2013-10-10 21:23:25 +0200
commitbdf04f516ca7c5274ff50104662e372ed29aea6b (patch)
treec0b33c3ad7874298493566afef75246dd5bd01ab /src/downloadmanager.cpp
parent54c7131a5e2fa282369e25344ac190d51676c383 (diff)
- MO now warns if a nxm-link for a wrong game was attempted instead of downloading the wrong file
- bugfix: in nxmhandler adding a new line with different game but same executable didn't work (the change was silently dropped)
Diffstat (limited to 'src/downloadmanager.cpp')
-rw-r--r--src/downloadmanager.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/downloadmanager.cpp b/src/downloadmanager.cpp
index eca5600a..779b052c 100644
--- a/src/downloadmanager.cpp
+++ b/src/downloadmanager.cpp
@@ -376,6 +376,15 @@ void DownloadManager::startDownload(QNetworkReply *reply, DownloadInfo *newDownl
void DownloadManager::addNXMDownload(const QString &url)
{
NXMUrl nxmInfo(url);
+
+ QString managedGame = ToQString(MOShared::GameInfo::instance().getGameShortName());
+
+ if (nxmInfo.game().compare(managedGame, Qt::CaseInsensitive) != 0) {
+ QMessageBox::information(NULL, tr("Wrong Game"), tr("The download link is for a mod for \"%1\" but this instance of MO "
+ "has been set up for \"%2\".").arg(nxmInfo.game()).arg(managedGame), QMessageBox::Ok);
+ return;
+ }
+
m_RequestIDs.insert(m_NexusInterface->requestFileInfo(nxmInfo.getModId(), nxmInfo.getFileId(), this, QVariant()));
}
@@ -990,7 +999,7 @@ void DownloadManager::nxmFilesAvailable(int, QVariant userData, QVariant resultD
}
-void DownloadManager::nxmFileInfoAvailable(int modID, int fileID, QVariant, QVariant resultData, int requestID)
+void DownloadManager::nxmFileInfoAvailable(int modID, int fileID, QVariant userData, QVariant resultData, int requestID)
{
std::set<int>::iterator idIter = m_RequestIDs.find(requestID);
if (idIter == m_RequestIDs.end()) {
@@ -1007,7 +1016,11 @@ void DownloadManager::nxmFileInfoAvailable(int modID, int fileID, QVariant, QVar
info.m_Version = result["version"].toString();
info.m_FileName = result["uri"].toString();
- m_RequestIDs.insert(m_NexusInterface->requestDownloadURL(modID, fileID, this, qVariantFromValue(info)));
+ if (userData.isValid()) {
+ m_RequestIDs.insert(m_NexusInterface->requestDownloadURL(modID, fileID, this, qVariantFromValue(info), userData.toString()));
+ } else {
+ m_RequestIDs.insert(m_NexusInterface->requestDownloadURL(modID, fileID, this, qVariantFromValue(info)));
+ }
}