From 3821569363bdc13c59704c2f37c5de9fee5a21e2 Mon Sep 17 00:00:00 2001
From: Petr Mrázek <peterix@gmail.com>
Date: Mon, 14 Jul 2014 00:57:54 +0200
Subject: Show changelog even when there are no new updates available.

---
 logic/updater/DownloadUpdateTask.cpp |  2 +-
 logic/updater/UpdateChecker.cpp      | 11 ++++++-----
 logic/updater/UpdateChecker.h        |  4 ++--
 3 files changed, 9 insertions(+), 8 deletions(-)

(limited to 'logic/updater')

diff --git a/logic/updater/DownloadUpdateTask.cpp b/logic/updater/DownloadUpdateTask.cpp
index e4cad73f..e40df8f1 100644
--- a/logic/updater/DownloadUpdateTask.cpp
+++ b/logic/updater/DownloadUpdateTask.cpp
@@ -91,7 +91,7 @@ void DownloadUpdateTask::findCurrentVersionInfo()
 
 		QObject::connect(checker.get(), &UpdateChecker::channelListLoaded, this,
 						 &DownloadUpdateTask::processChannels);
-		checker->updateChanList();
+		checker->updateChanList(false);
 	}
 	else
 	{
diff --git a/logic/updater/UpdateChecker.cpp b/logic/updater/UpdateChecker.cpp
index c2895430..6669d333 100644
--- a/logic/updater/UpdateChecker.cpp
+++ b/logic/updater/UpdateChecker.cpp
@@ -59,7 +59,7 @@ void UpdateChecker::checkForUpdate(bool notifyNoUpdate)
 		QLOG_DEBUG() << "Channel list isn't loaded yet. Loading channel list and deferring "
 						"update check.";
 		m_checkUpdateWaiting = true;
-		updateChanList();
+		updateChanList(notifyNoUpdate);
 		return;
 	}
 
@@ -170,7 +170,7 @@ void UpdateChecker::updateCheckFailed()
 	QLOG_ERROR() << "Update check failed for reasons unknown.";
 }
 
-void UpdateChecker::updateChanList()
+void UpdateChecker::updateChanList(bool notifyNoUpdate)
 {
 	QLOG_DEBUG() << "Loading the channel list.";
 
@@ -185,13 +185,14 @@ void UpdateChecker::updateChanList()
 	m_chanListLoading = true;
 	NetJob *job = new NetJob("Update System Channel List");
 	job->addNetAction(ByteArrayDownload::make(QUrl(m_channelListUrl)));
-	QObject::connect(job, &NetJob::succeeded, this, &UpdateChecker::chanListDownloadFinished);
+	connect(job, &NetJob::succeeded, [this, notifyNoUpdate]()
+	{ chanListDownloadFinished(notifyNoUpdate); });
 	QObject::connect(job, &NetJob::failed, this, &UpdateChecker::chanListDownloadFailed);
 	chanListJob.reset(job);
 	job->start();
 }
 
-void UpdateChecker::chanListDownloadFinished()
+void UpdateChecker::chanListDownloadFinished(bool notifyNoUpdate)
 {
 	QByteArray data;
 	{
@@ -250,7 +251,7 @@ void UpdateChecker::chanListDownloadFinished()
 
 	// If we're waiting to check for updates, do that now.
 	if (m_checkUpdateWaiting)
-		checkForUpdate(false);
+		checkForUpdate(notifyNoUpdate);
 
 	emit channelListLoaded();
 }
diff --git a/logic/updater/UpdateChecker.h b/logic/updater/UpdateChecker.h
index 3b0ee28d..2ee1b4b5 100644
--- a/logic/updater/UpdateChecker.h
+++ b/logic/updater/UpdateChecker.h
@@ -33,7 +33,7 @@ public:
 	 * Causes the update checker to download the channel list from the URL specified in config.h (generated by CMake).
 	 * If this isn't called before checkForUpdate(), it will automatically be called.
 	 */
-	void updateChanList();
+	void updateChanList(bool notifyNoUpdate);
 
 	/*!
 	 * An entry in the channel list.
@@ -70,7 +70,7 @@ private slots:
 	void updateCheckFinished(bool notifyNoUpdate);
 	void updateCheckFailed();
 
-	void chanListDownloadFinished();
+	void chanListDownloadFinished(bool notifyNoUpdate);
 	void chanListDownloadFailed();
 
 private:
-- 
cgit