kde-plasma/plasma-pa: Fix wrong availability of profiles and ports
authorAndreas Sturmlechner <asturm@gentoo.org>
Tue, 10 Jul 2018 12:02:30 +0000 (14:02 +0200)
committerAndreas Sturmlechner <asturm@gentoo.org>
Tue, 10 Jul 2018 12:04:28 +0000 (14:04 +0200)
Upstream commit b97846017df57698f9e77c8aab077d5a3f17e7ea

Package-Manager: Portage-2.3.41, Repoman-2.3.9

kde-plasma/plasma-pa/files/plasma-pa-5.13.3-wrong-port-avail.patch [new file with mode: 0644]
kde-plasma/plasma-pa/plasma-pa-5.13.3.ebuild

diff --git a/kde-plasma/plasma-pa/files/plasma-pa-5.13.3-wrong-port-avail.patch b/kde-plasma/plasma-pa/files/plasma-pa-5.13.3-wrong-port-avail.patch
new file mode 100644 (file)
index 0000000..7670ec7
--- /dev/null
@@ -0,0 +1,100 @@
+From b97846017df57698f9e77c8aab077d5a3f17e7ea Mon Sep 17 00:00:00 2001
+From: Andreas Krutzler <andi.krutzler@gmail.com>
+Date: Fri, 29 Jun 2018 09:39:28 +0200
+Subject: Fix wrong availability of profiles and ports.
+
+Summary: Fixed bug where available ports are displayed as unavailable/unplugged and vice versa. It seems that this bug was introduced with D9671.
+
+Reviewers: nicolasfella, broulik, drosca
+
+Subscribers: plasma-devel
+
+Tags: #plasma
+
+Differential Revision: https://phabricator.kde.org/D13694
+---
+ src/port.h    | 13 ++++++++++++-
+ src/profile.h | 30 ++++++++++++++++++------------
+ 2 files changed, 30 insertions(+), 13 deletions(-)
+
+diff --git a/src/port.h b/src/port.h
+index 8a8126e..bbf32db 100644
+--- a/src/port.h
++++ b/src/port.h
+@@ -40,7 +40,18 @@ public:
+     template<typename PAInfo>
+     void setInfo(const PAInfo *info)
+     {
+-        Profile::setInfo(info);
++        Availability newAvailability;
++        switch (info->available) {
++        case PA_PORT_AVAILABLE_NO:
++            newAvailability = Unavailable;
++            break;
++        case PA_PORT_AVAILABLE_YES:
++            newAvailability = Available;
++            break;
++        default:
++            newAvailability = Unknown;
++        }
++        setCommonInfo(info, newAvailability);
+     }
+ };
+diff --git a/src/profile.h b/src/profile.h
+index d8188a2..cd29c62 100644
+--- a/src/profile.h
++++ b/src/profile.h
+@@ -49,6 +49,24 @@ public:
+     template<typename PAInfo>
+     void setInfo(const PAInfo *info)
+     {
++        setCommonInfo(info, info->available ? Available : Unavailable);
++    }
++
++    QString name() const;
++    QString description() const;
++    quint32 priority() const;
++    Availability availability() const;
++
++signals:
++    void nameChanged();
++    void descriptionChanged();
++    void priorityChanged();
++    void availabilityChanged();
++
++protected:
++    template<typename PAInfo>
++    void setCommonInfo(const PAInfo *info, Availability newAvailability)
++    {
+         // Description is optional. Name not so much as we need some ID.
+         Q_ASSERT(info->name);
+         QString infoName = QString::fromUtf8(info->name);
+@@ -68,24 +86,12 @@ public:
+             emit priorityChanged();
+         }
+-        Availability newAvailability = info->available ? Available : Unavailable;
+         if (m_availability != newAvailability) {
+             m_availability = newAvailability;
+             emit availabilityChanged();
+         }
+     }
+-    QString name() const;
+-    QString description() const;
+-    quint32 priority() const;
+-    Availability availability() const;
+-
+-signals:
+-    void nameChanged();
+-    void descriptionChanged();
+-    void priorityChanged();
+-    void availabilityChanged();
+-
+ private:
+     QString m_name;
+     QString m_description;
+-- 
+cgit v0.11.2
+
index aae43ea14cd3ea30f46af76ded89ef8f89fb5e1f..5b563ea9d02197d978b02ca1d087b2413e7c6a40 100644 (file)
@@ -27,3 +27,5 @@ DEPEND="
 "
 
 RDEPEND="${DEPEND}"
+
+PATCHES=( "${FILESDIR}/${P}-wrong-port-avail.patch" )