reintroduce the notification message in case you access dlc page without internet connection
authorkoda
Sat, 06 Apr 2013 01:02:28 +0200
changeset 8876 bd8df772dbe6
parent 8874 8121ce2b0a88
child 8878 b03dc99f2f2e
reintroduce the notification message in case you access dlc page without internet connection
QTfrontend/ui/page/pagedata.cpp
--- a/QTfrontend/ui/page/pagedata.cpp	Fri Apr 05 22:57:31 2013 +0200
+++ b/QTfrontend/ui/page/pagedata.cpp	Sat Apr 06 01:02:28 2013 +0200
@@ -60,7 +60,10 @@
 
     web->setOpenLinks(false);
 //    fetchList();
-
+    web->setHtml(QString(
+        "<center><h2>Hedgewars Downloadable Content</h2><br><br>"
+        "<i>%1</i></center>")
+        .arg(tr("Loading, please wait.")));
     m_contentDownloaded = false;
 }
 
@@ -106,8 +109,7 @@
 {
     QNetworkReply * reply = qobject_cast<QNetworkReply *>(sender());
 
-    if(reply)
-    {
+    if (reply && (reply->error() == QNetworkReply::NoError)) {
         QString html = QString::fromUtf8(reply->readAll());
         int begin = html.indexOf("<!-- BEGIN -->");
         int end = html.indexOf("<!-- END -->");
@@ -117,7 +119,11 @@
             html.remove(0, begin);
         }
         web->setHtml(html);
-    }
+    } else
+        web->setHtml(QString(
+            "<center><h2>Hedgewars Downloadable Content</h2><br><br>"
+            "<p><i><h4>%1</i></h4></p></center>")
+            .arg(tr("This page requires an internet connection.")));
 }
 
 void PageDataDownload::fileDownloaded()