Merge lp:~aacid/unity8/networkingstatus into lp:unity8

Proposed by Albert Astals Cid
Status: Merged
Approved by: Michał Sawicz
Approved revision: 1372
Merged at revision: 1465
Proposed branch: lp:~aacid/unity8/networkingstatus
Merge into: lp:unity8
Diff against target: 105 lines (+10/-19)
5 files modified
debian/control (+1/-0)
src/CMakeLists.txt (+4/-1)
src/CachingNetworkManagerFactory.cpp (+2/-11)
src/CachingNetworkManagerFactory.h (+2/-6)
src/Dash/CMakeLists.txt (+1/-1)
To merge this branch: bzr merge lp:~aacid/unity8/networkingstatus
Reviewer Review Type Date Requested Status
Michał Sawicz Abstain
Andrea Cimitan (community) Approve
PS Jenkins bot (community) continuous-integration Needs Fixing
Review via email: mp+239694@code.launchpad.net

Commit message

Use ubuntu::connectivity::NetworkingStatus instead of QNetworkConfigurationManager

QNetworkConfigurationManager with the networkmanager plugin tracks lots of different things while we're only really interested in if we're connected or not that is exactly what ubuntu::connectivity::NetworkingStatus does

Description of the change

 * Are there any related MPs required for this MP to build/function as expected?
No

 * Did you perform an exploratory manual test run of your code change and any related functionality?
Yes

 * Did you make sure that your branch does not contain spurious tags?
Yes

 * If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
No, think it's trivial enough

 * If you changed the UI, has there been a design review?
N/A

To post a comment you must log in.
Revision history for this message
Albert Astals Cid (aacid) wrote :

Actually
 qdbus com.ubuntu.connectivity1 /com/ubuntu/connectivity1/NetworkingStatus com.ubuntu.connectivity1.NetworkingStatus.Status
always return online in the phone, have to find out who to ask to fix that.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) wrote :

The always online issue was resolved at https://bugs.launchpad.net/indicator-network/+bug/1386109

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Andrea Cimitan (cimi) wrote :

Code seems all right... need to test this...

Revision history for this message
Andrea Cimitan (cimi) wrote :

At the moment, there is no feature easily connected to this so can be tested. I had however tested for regressions and didn't see much (dash is still not working great in offline mode)

 * Did you perform an exploratory manual test run of the code change and any related functionality?
Y
 * Did CI run pass? If not, please explain why.
Autopilot
 * Did you make sure that the branch does not contain spurious tags?
Yes

review: Approve
Revision history for this message
Michał Sawicz (saviq) :
review: Needs Fixing
lp:~aacid/unity8/networkingstatus updated
1372. By Albert Astals Cid

remove unused slot

Revision history for this message
Albert Astals Cid (aacid) wrote :

That's correct, removed.

Revision history for this message
Michał Sawicz (saviq) :
review: Abstain
lp:~aacid/unity8/networkingstatus updated
1373. By Albert Astals Cid

Merge unity8

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2014-11-17 10:09:40 +0000
3+++ debian/control 2014-11-26 08:29:52 +0000
4@@ -12,6 +12,7 @@
5 # in libstdc++ causing us issues, we explicitly select a G++
6 # version.
7 g++-4.9,
8+ libconnectivity-qt1-dev,
9 libgl1-mesa-dev[!armhf] | libgl-dev[!armhf],
10 libgl1-mesa-dri,
11 libgles2-mesa-dev[armhf],
12
13=== modified file 'src/CMakeLists.txt'
14--- src/CMakeLists.txt 2014-10-06 15:45:25 +0000
15+++ src/CMakeLists.txt 2014-11-26 08:29:52 +0000
16@@ -1,6 +1,9 @@
17+pkg_check_modules(CONNECTIVITY REQUIRED connectivity-qt1)
18+
19 include_directories(
20 ${Qt5Gui_PRIVATE_INCLUDE_DIRS}
21 ${CMAKE_SOURCE_DIR}/libs/UbuntuGestures
22+ ${CONNECTIVITY_INCLUDE_DIRS}
23 )
24
25 file(GLOB_RECURSE QML_FILES
26@@ -30,7 +33,7 @@
27 target_link_libraries(${SHELL_APP} ${XCB_LDFLAGS})
28 endif()
29
30-target_link_libraries(${SHELL_APP} UbuntuGestures)
31+target_link_libraries(${SHELL_APP} UbuntuGestures connectivity-qt1)
32
33 # For it to find libUbuntuGestures.so
34 set_target_properties(${SHELL_APP} PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${SHELL_PRIVATE_LIBDIR}")
35
36=== modified file 'src/CachingNetworkManagerFactory.cpp'
37--- src/CachingNetworkManagerFactory.cpp 2014-07-02 07:56:24 +0000
38+++ src/CachingNetworkManagerFactory.cpp 2014-11-26 08:29:52 +0000
39@@ -20,25 +20,16 @@
40 #include <QNetworkDiskCache>
41 #include <QNetworkAccessManager>
42 #include <QStandardPaths>
43-#include <QNetworkConfigurationManager>
44
45 CachingNetworkAccessManager::CachingNetworkAccessManager(QObject *parent)
46 : QNetworkAccessManager(parent)
47 {
48- m_networkManager = new QNetworkConfigurationManager(this);
49-
50- QObject::connect(m_networkManager, &QNetworkConfigurationManager::onlineStateChanged, this, &CachingNetworkAccessManager::onlineStateChanged);
51- m_isOnline = m_networkManager->isOnline();
52-}
53-
54-void CachingNetworkAccessManager::onlineStateChanged(bool isOnline)
55-{
56- m_isOnline = isOnline;
57+ m_networkingStatus = new ubuntu::connectivity::NetworkingStatus(this);
58 }
59
60 QNetworkReply* CachingNetworkAccessManager::createRequest(Operation op, const QNetworkRequest &request, QIODevice *outgoingData)
61 {
62- if (!m_isOnline) {
63+ if (m_networkingStatus->status() != ubuntu::connectivity::NetworkingStatus::Status::Online) {
64 QNetworkRequest req(request);
65 req.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::AlwaysCache);
66 return QNetworkAccessManager::createRequest(op, req, outgoingData);
67
68=== modified file 'src/CachingNetworkManagerFactory.h'
69--- src/CachingNetworkManagerFactory.h 2014-06-30 16:42:58 +0000
70+++ src/CachingNetworkManagerFactory.h 2014-11-26 08:29:52 +0000
71@@ -21,7 +21,7 @@
72 #include <QQmlNetworkAccessManagerFactory>
73 #include <QNetworkAccessManager>
74
75-class QNetworkConfigurationManager;
76+#include <ubuntu/connectivity/networking-status.h>
77
78 class CachingNetworkAccessManager : public QNetworkAccessManager
79 {
80@@ -31,12 +31,8 @@
81 protected:
82 QNetworkReply* createRequest(Operation op, const QNetworkRequest &req, QIODevice *outgoingData = 0) override;
83
84-private Q_SLOTS:
85- void onlineStateChanged(bool isOnline);
86-
87 private:
88- QNetworkConfigurationManager* m_networkManager;
89- bool m_isOnline;
90+ ubuntu::connectivity::NetworkingStatus* m_networkingStatus;
91 };
92
93 class CachingNetworkManagerFactory : public QQmlNetworkAccessManagerFactory
94
95=== modified file 'src/Dash/CMakeLists.txt'
96--- src/Dash/CMakeLists.txt 2014-10-06 15:45:25 +0000
97+++ src/Dash/CMakeLists.txt 2014-11-26 08:29:52 +0000
98@@ -12,7 +12,7 @@
99 # For it to find libUbuntuGestures.so, needed by Ubuntu.Gestures QML module.
100 set_target_properties(unity8-dash PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${SHELL_PRIVATE_LIBDIR}")
101
102-target_link_libraries(unity8-dash UbuntuGestures)
103+target_link_libraries(unity8-dash UbuntuGestures connectivity-qt1)
104
105 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
106

Subscribers

People subscribed via source and target branches