From f14da1e6cdac68deaf60bd14ebcb0866c1b157bc Mon Sep 17 00:00:00 2001
From: Inso <insomniak.fr@gmail.com>
Date: Wed, 10 Jun 2015 22:45:54 +0200
Subject: [PATCH] Fix download link in about popup

---
 res/i18n/ts/fr_FR.ts           | 25 +++++++++++++++----------
 res/ui/about.ui                |  8 +++++++-
 src/cutecoin/core/app.py       |  2 +-
 src/cutecoin/gui/mainwindow.py | 14 +++++++++-----
 4 files changed, 32 insertions(+), 17 deletions(-)

diff --git a/res/i18n/ts/fr_FR.ts b/res/i18n/ts/fr_FR.ts
index ee820cc8..2b468ac6 100644
--- a/res/i18n/ts/fr_FR.ts
+++ b/res/i18n/ts/fr_FR.ts
@@ -1120,7 +1120,7 @@ Revoking your UID can only success if it is not already validated by the network
         <translation>Sauvegarder</translation>
     </message>
     <message>
-        <location filename="../../../src/cutecoin/gui/mainwindow.py" line="385"/>
+        <location filename="../../../src/cutecoin/gui/mainwindow.py" line="387"/>
         <source>Export</source>
         <translation>Exporter</translation>
     </message>
@@ -1146,7 +1146,7 @@ Revoking your UID can only success if it is not already validated by the network
             </translation>
     </message>
     <message>
-        <location filename="../../../src/cutecoin/gui/mainwindow.py" line="251"/>
+        <location filename="../../../src/cutecoin/gui/mainwindow.py" line="253"/>
         <source>
         &lt;h1&gt;Cutecoin&lt;/h1&gt;
 
@@ -1181,32 +1181,32 @@ Revoking your UID can only success if it is not already validated by the network
         </translation>
     </message>
     <message>
-        <location filename="../../../src/cutecoin/gui/mainwindow.py" line="319"/>
+        <location filename="../../../src/cutecoin/gui/mainwindow.py" line="321"/>
         <source>Edit</source>
         <translation>Editer</translation>
     </message>
     <message>
-        <location filename="../../../src/cutecoin/gui/mainwindow.py" line="322"/>
+        <location filename="../../../src/cutecoin/gui/mainwindow.py" line="324"/>
         <source>Delete</source>
         <translation>Supprimer</translation>
     </message>
     <message>
-        <location filename="../../../src/cutecoin/gui/mainwindow.py" line="338"/>
+        <location filename="../../../src/cutecoin/gui/mainwindow.py" line="340"/>
         <source>CuteCoin {0}</source>
         <translation>CuteCoin {0}</translation>
     </message>
     <message>
-        <location filename="../../../src/cutecoin/gui/mainwindow.py" line="363"/>
+        <location filename="../../../src/cutecoin/gui/mainwindow.py" line="365"/>
         <source>CuteCoin {0} - Account : {1}</source>
         <translation>CuteCoin {0} - Compte : {1}</translation>
     </message>
     <message>
-        <location filename="../../../src/cutecoin/gui/mainwindow.py" line="383"/>
+        <location filename="../../../src/cutecoin/gui/mainwindow.py" line="385"/>
         <source>Export an account</source>
         <translation>Exporter un compte</translation>
     </message>
     <message>
-        <location filename="../../../src/cutecoin/gui/mainwindow.py" line="384"/>
+        <location filename="../../../src/cutecoin/gui/mainwindow.py" line="386"/>
         <source>All account files (*.acc)</source>
         <translation>Tout fichier de compte (*.acc)</translation>
     </message>
@@ -1276,7 +1276,7 @@ Revoking your UID can only success if it is not already validated by the network
         <translation>&amp;Préférences</translation>
     </message>
     <message>
-        <location filename="../../../src/cutecoin/gui/mainwindow.py" line="276"/>
+        <location filename="../../../src/cutecoin/gui/mainwindow.py" line="278"/>
         <source>Please get the latest release {version}</source>
         <translation>Veuillez télécharger la dernière version {version}</translation>
     </message>
@@ -1301,11 +1301,16 @@ Revoking your UID can only success if it is not already validated by the network
             &lt;p&gt;&lt;b&gt;{version_info}&lt;/b&gt;&lt;/p&gt;
             &lt;p&gt;&lt;a href=&quot;{version_url}&quot;&gt;Download link&lt;/a&gt;&lt;/p&gt;
             </source>
-        <translation>
+        <translation type="obsolete">
             &lt;p&gt;&lt;b&gt;{version_info}&lt;/b&gt;&lt;/p&gt;
             &lt;p&gt;&lt;a href=&quot;{version_url}&quot;&gt;Lien de téléchargement&lt;/a&gt;&lt;/p&gt;
             </translation>
     </message>
+    <message>
+        <location filename="../../../src/cutecoin/gui/mainwindow.py" line="249"/>
+        <source>Download link</source>
+        <translation type="unfinished">Lien de téléchargement</translation>
+    </message>
 </context>
 <context>
     <name>MemberDialog</name>
diff --git a/res/ui/about.ui b/res/ui/about.ui
index 4ea3a486..dfd2c375 100644
--- a/res/ui/about.ui
+++ b/res/ui/about.ui
@@ -19,7 +19,10 @@
      <item>
       <widget class="QLabel" name="label">
        <property name="text">
-        <string>TextLabel</string>
+        <string>label</string>
+       </property>
+       <property name="textFormat">
+        <enum>Qt::RichText</enum>
        </property>
        <property name="alignment">
         <set>Qt::AlignCenter</set>
@@ -27,6 +30,9 @@
        <property name="openExternalLinks">
         <bool>true</bool>
        </property>
+       <property name="textInteractionFlags">
+        <set>Qt::TextBrowserInteraction</set>
+       </property>
       </widget>
      </item>
      <item>
diff --git a/src/cutecoin/core/app.py b/src/cutecoin/core/app.py
index 7619336a..ca266b27 100644
--- a/src/cutecoin/core/app.py
+++ b/src/cutecoin/core/app.py
@@ -409,7 +409,7 @@ class Application(QObject):
         latest = None
         releases = reply.readAll().data().decode('utf-8')
         logging.debug(releases)
-        if reply.error == QNetworkReply.NoError:
+        if reply.error() == QNetworkReply.NoError:
             for r in json.loads(releases):
                 if not latest:
                     latest = r
diff --git a/src/cutecoin/gui/mainwindow.py b/src/cutecoin/gui/mainwindow.py
index 72e05de0..b44cafb2 100644
--- a/src/cutecoin/gui/mainwindow.py
+++ b/src/cutecoin/gui/mainwindow.py
@@ -237,13 +237,17 @@ class MainWindow(QMainWindow, Ui_MainWindow):
         version_url = ""
         if not latest[0]:
             version_info = self.tr("Latest release : {version}") \
-                .format(version='.'.join(latest[1]))
+                .format(version=latest[1])
             version_url = latest[2]
 
-        new_version_text = self.tr("""
-            <p><b>{version_info}</b></p>
-            <p><a href="{version_url}">Download link</a></p>
-            """).format(version_info=version_info, version_url=version_url)
+            new_version_text = """
+                <p><b>{version_info}</b></p>
+                <p><a href="{version_url}">{link_text}</a></p>
+                """.format(version_info=version_info,
+                            version_url=version_url,
+                            link_text=self.tr("Download link"))
+        else:
+            new_version_text = ""
 
         text = self.tr("""
         <h1>Cutecoin</h1>
-- 
GitLab