Hello community,

here is the log from the commit of package plasma5-pk-updates for 
openSUSE:Factory checked in at 2019-03-26 15:35:47
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/plasma5-pk-updates (Old)
 and      /work/SRC/openSUSE:Factory/.plasma5-pk-updates.new.25356 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "plasma5-pk-updates"

Tue Mar 26 15:35:47 2019 rev:17 rq:687415 version:0.3.2

Changes:
--------
--- /work/SRC/openSUSE:Factory/plasma5-pk-updates/plasma5-pk-updates.changes    
2018-12-28 12:32:43.912071659 +0100
+++ 
/work/SRC/openSUSE:Factory/.plasma5-pk-updates.new.25356/plasma5-pk-updates.changes
 2019-03-26 15:35:48.516412695 +0100
@@ -1,0 +2,14 @@
+Thu Mar 21 13:31:03 UTC 2019 - alarr...@suse.com
+
+- Add patches already approved by upstream to delay any check for updates
+  until the network is online if the network is offline . The patches
+  also fix some visibility issues of widgets that don't make sense if
+  the network is offline. This is part of the fix for boo#1103678.
+  * 0001-Hide-updates-and-checkbox-when-system-is-offline.patch
+  * 0002-Add-its-own-messageChanged-NOTIFY-signal-to-message.patch
+  * 0003-Delay-PkUpdates-checkUpdates-calls-if-the-network-is-offline.patch
+
+- Rebase patch:
+  * 0001-Hide-option-to-install-updates-on-Tumbleweed.patch
+
+-------------------------------------------------------------------

New:
----
  0001-Hide-updates-and-checkbox-when-system-is-offline.patch
  0002-Add-its-own-messageChanged-NOTIFY-signal-to-message.patch
  0003-Delay-PkUpdates-checkUpdates-calls-if-the-network-is-offline.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ plasma5-pk-updates.spec ++++++
--- /var/tmp/diff_new_pack.F3aA5q/_old  2019-03-26 15:35:49.140412432 +0100
+++ /var/tmp/diff_new_pack.F3aA5q/_new  2019-03-26 15:35:49.144412431 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package plasma5-pk-updates
 #
-# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -12,7 +12,7 @@
 # license that conforms to the Open Source Definition (Version 1.9)
 # published by the Open Source Initiative.
 
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
 #
 
 
@@ -27,7 +27,12 @@
 # Updated translations
 Source1:        plasma5-pk-updates-lang.tar.xz
 # PATCH-FIX-UPSTREAM
-Patch:          desktop.patch
+Patch0:         desktop.patch
+# PATCH-FIX-UPSTREAM boo#1103678
+Patch1:         0001-Hide-updates-and-checkbox-when-system-is-offline.patch
+Patch2:         0002-Add-its-own-messageChanged-NOTIFY-signal-to-message.patch
+Patch3:         
0003-Delay-PkUpdates-checkUpdates-calls-if-the-network-is-offline.patch
+
 # PATCH-FEATURE-OPENSUSE
 Patch100:       0001-Hide-option-to-install-updates-on-Tumbleweed.patch
 BuildRequires:  PackageKit-Qt5-devel

++++++ 0001-Hide-option-to-install-updates-on-Tumbleweed.patch ++++++
--- /var/tmp/diff_new_pack.F3aA5q/_old  2019-03-26 15:35:49.156412425 +0100
+++ /var/tmp/diff_new_pack.F3aA5q/_new  2019-03-26 15:35:49.160412424 +0100
@@ -10,10 +10,10 @@
  src/plasma/contents/ui/PackageDelegate.qml |  2 ++
  4 files changed, 39 insertions(+), 2 deletions(-)
 
-diff --git a/src/declarative/pkupdates.cpp b/src/declarative/pkupdates.cpp
-index f8fd0ac..90bea08 100644
---- a/src/declarative/pkupdates.cpp
-+++ b/src/declarative/pkupdates.cpp
+Index: plasma-pk-updates-0.3.2/src/declarative/pkupdates.cpp
+===================================================================
+--- plasma-pk-updates-0.3.2.orig/src/declarative/pkupdates.cpp
++++ plasma-pk-updates-0.3.2/src/declarative/pkupdates.cpp
 @@ -20,6 +20,7 @@
  #include <limits.h>
  
@@ -44,10 +44,10 @@
  void PkUpdates::getUpdateDetails(const QString &pkgID)
  {
      qCDebug(PLASMA_PK_UPDATES) << "Requesting update details for" << pkgID;
-diff --git a/src/declarative/pkupdates.h b/src/declarative/pkupdates.h
-index 1f17da5..075da75 100644
---- a/src/declarative/pkupdates.h
-+++ b/src/declarative/pkupdates.h
+Index: plasma-pk-updates-0.3.2/src/declarative/pkupdates.h
+===================================================================
+--- plasma-pk-updates-0.3.2.orig/src/declarative/pkupdates.h
++++ plasma-pk-updates-0.3.2/src/declarative/pkupdates.h
 @@ -55,6 +55,7 @@ class PkUpdates : public QObject
      Q_PROPERTY(bool isNetworkOnline READ isNetworkOnline NOTIFY 
networkStateChanged)
      Q_PROPERTY(bool isNetworkMobile READ isNetworkMobile NOTIFY 
networkStateChanged)
@@ -68,10 +68,10 @@
  signals:
      /**
       * Emitted when the number uf updates has changed
-diff --git a/src/plasma/contents/ui/Full.qml b/src/plasma/contents/ui/Full.qml
-index eca7ec0..ca9b750 100644
---- a/src/plasma/contents/ui/Full.qml
-+++ b/src/plasma/contents/ui/Full.qml
+Index: plasma-pk-updates-0.3.2/src/plasma/contents/ui/Full.qml
+===================================================================
+--- plasma-pk-updates-0.3.2.orig/src/plasma/contents/ui/Full.qml
++++ plasma-pk-updates-0.3.2/src/plasma/contents/ui/Full.qml
 @@ -140,6 +140,7 @@ Item {
                  currentIndex: -1
                  boundsBehavior: Flickable.StopAtBounds
@@ -84,8 +84,8 @@
          }
  
          RowLayout {
--            visible: PkUpdates.count && !PkUpdates.isActive
-+            visible: PkUpdates.count && !PkUpdates.isActive && 
!PkUpdates.isTumbleweed
+-            visible: PkUpdates.count && PkUpdates.isNetworkOnline && 
!PkUpdates.isActive
++            visible: PkUpdates.count && PkUpdates.isNetworkOnline && 
!PkUpdates.isActive && !PkUpdates.isTumbleweed
              PlasmaComponents.CheckBox {
                  id: chkSelectAll
                  anchors {
@@ -117,10 +117,10 @@
          PlasmaComponents.BusyIndicator {
              running: PkUpdates.isActive
              visible: running
-diff --git a/src/plasma/contents/ui/PackageDelegate.qml 
b/src/plasma/contents/ui/PackageDelegate.qml
-index 678d21d..9f8aaf7 100644
---- a/src/plasma/contents/ui/PackageDelegate.qml
-+++ b/src/plasma/contents/ui/PackageDelegate.qml
+Index: plasma-pk-updates-0.3.2/src/plasma/contents/ui/PackageDelegate.qml
+===================================================================
+--- plasma-pk-updates-0.3.2.orig/src/plasma/contents/ui/PackageDelegate.qml
++++ plasma-pk-updates-0.3.2/src/plasma/contents/ui/PackageDelegate.qml
 @@ -32,6 +32,7 @@ PlasmaComponents.ListItem {
      property string updateText
      property variant updateUrls: []
@@ -137,6 +137,3 @@
          anchors {
              left: parent.left
              verticalCenter: packageInfoColumn.verticalCenter
--- 
-2.16.2
-

++++++ 0001-Hide-updates-and-checkbox-when-system-is-offline.patch ++++++
>From ebbc468b211201838db7675a2ef9d2611c5c6ee4 Mon Sep 17 00:00:00 2001
From: Antonio Larrosa <antonio.larr...@gmail.com>
Date: Mon, 18 Mar 2019 17:13:28 +0100
Subject: [PATCH 1/3] Hide updates and checkbox when system is offline.

Hide actions that can't be taken if the system doesn't have a network
connection.
---
 src/plasma/contents/ui/Full.qml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/plasma/contents/ui/Full.qml b/src/plasma/contents/ui/Full.qml
index eca7ec0..7cf37eb 100644
--- a/src/plasma/contents/ui/Full.qml
+++ b/src/plasma/contents/ui/Full.qml
@@ -127,7 +127,7 @@ Item {
             id: updatesScrollArea
             Layout.fillWidth: true
             Layout.fillHeight: true
-            visible: PkUpdates.count && !PkUpdates.isActive
+            visible: PkUpdates.count && PkUpdates.isNetworkOnline && 
!PkUpdates.isActive
 
             ListView {
                 id: updatesView
@@ -160,7 +160,7 @@ Item {
         }
 
         RowLayout {
-            visible: PkUpdates.count && !PkUpdates.isActive
+            visible: PkUpdates.count && PkUpdates.isNetworkOnline && 
!PkUpdates.isActive
             PlasmaComponents.CheckBox {
                 id: chkSelectAll
                 anchors {
-- 
2.21.0

++++++ 0002-Add-its-own-messageChanged-NOTIFY-signal-to-message.patch ++++++
>From fc2b970b8116fe0f85e94e5dfcba709dbec183a6 Mon Sep 17 00:00:00 2001
From: Antonio Larrosa <antonio.larr...@gmail.com>
Date: Mon, 18 Mar 2019 17:35:55 +0100
Subject: [PATCH 2/3] Add its own messageChanged NOTIFY signal to the message
 property

The message property also changes when the network state changes, not only
when isActiveChanged is emitted, so let's create its own signal that is
emitted in both cases.
---
 src/declarative/pkupdates.cpp | 3 +++
 src/declarative/pkupdates.h   | 3 ++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/declarative/pkupdates.cpp b/src/declarative/pkupdates.cpp
index f8fd0ac..08a51ae 100644
--- a/src/declarative/pkupdates.cpp
+++ b/src/declarative/pkupdates.cpp
@@ -54,6 +54,9 @@ PkUpdates::PkUpdates(QObject *parent) :
 
     connect(Solid::PowerManagement::notifier(), 
&Solid::PowerManagement::Notifier::appShouldConserveResourcesChanged,
             this, &PkUpdates::isOnBatteryChanged);
+
+    connect(this, &PkUpdates::isActiveChanged, this, 
&PkUpdates::messageChanged);
+    connect(this, &PkUpdates::networkStateChanged, this, 
&PkUpdates::messageChanged);
 }
 
 PkUpdates::~PkUpdates()
diff --git a/src/declarative/pkupdates.h b/src/declarative/pkupdates.h
index 1f17da5..c72162a 100644
--- a/src/declarative/pkupdates.h
+++ b/src/declarative/pkupdates.h
@@ -46,7 +46,7 @@ class PkUpdates : public QObject
     Q_PROPERTY(int securityCount READ securityCount NOTIFY updatesChanged)
     Q_PROPERTY(bool isSystemUpToDate READ isSystemUpToDate NOTIFY 
updatesChanged)
     Q_PROPERTY(QString iconName READ iconName NOTIFY updatesChanged)
-    Q_PROPERTY(QString message READ message NOTIFY isActiveChanged)
+    Q_PROPERTY(QString message READ message NOTIFY messageChanged)
     Q_PROPERTY(int percentage READ percentage NOTIFY percentageChanged)
     Q_PROPERTY(QString timestamp READ timestamp NOTIFY updatesChanged)
     Q_PROPERTY(QString statusMessage READ statusMessage NOTIFY 
statusMessageChanged)
@@ -161,6 +161,7 @@ signals:
     void percentageChanged();
     void networkStateChanged();
     void isOnBatteryChanged();
+    void messageChanged();
 
 public slots:
     /**
-- 
2.21.0

++++++ 0003-Delay-PkUpdates-checkUpdates-calls-if-the-network-is-offline.patch 
++++++
>From 2101d37b7b93b0cbb4414db6dd3424f52fcda95b Mon Sep 17 00:00:00 2001
From: Antonio Larrosa <antonio.larr...@gmail.com>
Date: Mon, 18 Mar 2019 18:00:26 +0100
Subject: [PATCH 3/3] Delay PkUpdates::checkUpdates calls if the network state
 is offline

If PkUpdates::checkUpdates is called and the network state is offline,
delay the check for updates until the network is online again.

This fixes the problem that when the user logs in, the applet is run
and just after the PkUpdates object is created, checkUpdates is called
(from main itself). But at that point the user might have not entered
the wifi password so the check would fail. Now, if we detect there's
no network, we just delay the check until the network state is online.
---
 src/declarative/pkupdates.cpp | 17 +++++++++++++++++
 src/declarative/pkupdates.h   |  3 +++
 2 files changed, 20 insertions(+)

diff --git a/src/declarative/pkupdates.cpp b/src/declarative/pkupdates.cpp
index 08a51ae..94b712e 100644
--- a/src/declarative/pkupdates.cpp
+++ b/src/declarative/pkupdates.cpp
@@ -55,6 +55,7 @@ PkUpdates::PkUpdates(QObject *parent) :
     connect(Solid::PowerManagement::notifier(), 
&Solid::PowerManagement::Notifier::appShouldConserveResourcesChanged,
             this, &PkUpdates::isOnBatteryChanged);
 
+    connect(PackageKit::Daemon::global(), 
&PackageKit::Daemon::networkStateChanged, this, 
&PkUpdates::doDelayedCheckUpdates);
     connect(this, &PkUpdates::isActiveChanged, this, 
&PkUpdates::messageChanged);
     connect(this, &PkUpdates::networkStateChanged, this, 
&PkUpdates::messageChanged);
 }
@@ -170,6 +171,16 @@ bool PkUpdates::isNetworkOnline() const
     return (PackageKit::Daemon::networkState() > 
PackageKit::Daemon::Network::NetworkOffline);
 }
 
+void PkUpdates::doDelayedCheckUpdates()
+{
+    if (m_checkUpdatesWhenNetworkOnline && isNetworkOnline())
+    {
+        qCDebug(PLASMA_PK_UPDATES) << "CheckUpdates was delayed. Doing it now";
+        m_checkUpdatesWhenNetworkOnline = false;
+        checkUpdates();
+    }
+}
+
 bool PkUpdates::isNetworkMobile() const
 {
     qCDebug(PLASMA_PK_UPDATES) << "Is net mobile:" << 
(PackageKit::Daemon::networkState() == 
PackageKit::Daemon::Network::NetworkMobile);
@@ -201,6 +212,12 @@ QString PkUpdates::timestamp() const
 
 void PkUpdates::checkUpdates(bool force)
 {
+    if (!isNetworkOnline())
+    {
+        qCDebug(PLASMA_PK_UPDATES) << "Checking updates delayed. Network is 
offline";
+        m_checkUpdatesWhenNetworkOnline = true;
+        return;
+    }
     qCDebug(PLASMA_PK_UPDATES) << "Checking updates, forced";
 
     // ask the Packagekit daemon to refresh the cache
diff --git a/src/declarative/pkupdates.h b/src/declarative/pkupdates.h
index c72162a..d9cb063 100644
--- a/src/declarative/pkupdates.h
+++ b/src/declarative/pkupdates.h
@@ -202,6 +202,8 @@ public slots:
      */
     Q_INVOKABLE void getUpdateDetails(const QString & pkgID);
 
+    Q_INVOKABLE void doDelayedCheckUpdates();
+
 private slots:
     void getUpdates();
     void onChanged();
@@ -234,6 +236,7 @@ private:
     int m_percentage = 0;
     Activity m_activity = Idle;
     bool m_lastCheckSuccessful = false;
+    bool m_checkUpdatesWhenNetworkOnline = false;
 };
 
 #endif // PLASMA_PK_UPDATES_H
-- 
2.21.0


Reply via email to