@@ -42,6 +42,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
4242#include < QHttp2Configuration>
4343#include < QInputDialog>
4444#include < QMessageBox>
45+ #include < QSystemTrayIcon>
4546#include < QTextDocument>
4647#include < QTimer>
4748
@@ -1365,7 +1366,11 @@ QString DownloadManager::getDisplayName(int index) const
13651366 }
13661367
13671368 DownloadInfo* info = m_ActiveDownloads.at (index);
1369+ return displayNameByInfo (info);
1370+ }
13681371
1372+ QString DownloadManager::displayNameByInfo (const DownloadInfo* info) const
1373+ {
13691374 QTextDocument doc;
13701375 if (!info->m_FileInfo ->name .isEmpty ()) {
13711376 doc.setHtml (info->m_FileInfo ->name );
@@ -1789,6 +1794,11 @@ void DownloadManager::nxmDescriptionAvailable(QString, int, QVariant userData,
17891794 info->m_FileInfo ->modName = doc.toPlainText ();
17901795 if (info->m_FileInfo ->fileID != 0 ) {
17911796 setState (info, STATE_READY);
1797+ if (m_OrganizerCore->settings ().interface ().showDownloadNotifications ()) {
1798+ m_OrganizerCore->showNotification (
1799+ tr (" Download complete" ),
1800+ tr (" %1 is ready to be installed." ).arg (displayNameByInfo (info)));
1801+ }
17921802 } else {
17931803 setState (info, STATE_FETCHINGFILEINFO);
17941804 }
@@ -2278,6 +2288,12 @@ void DownloadManager::downloadFinished(int index)
22782288 emit showMessage (tr (" Download failed: %1 (%2)" )
22792289 .arg (reply->errorString ())
22802290 .arg (reply->error ()));
2291+ if (m_OrganizerCore->settings ().interface ().showDownloadNotifications ()) {
2292+ m_OrganizerCore->showNotification (
2293+ tr (" Download failed" ),
2294+ tr (" %1 failed to download." ).arg (displayNameByInfo (info)),
2295+ QSystemTrayIcon::MessageIcon::Critical);
2296+ }
22812297 }
22822298 error = true ;
22832299 setState (info, STATE_ERROR);
0 commit comments