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
=== modified file 'debian/control'
--- debian/control 2014-11-17 10:09:40 +0000
+++ debian/control 2014-11-26 08:29:52 +0000
@@ -12,6 +12,7 @@
12# in libstdc++ causing us issues, we explicitly select a G++12# in libstdc++ causing us issues, we explicitly select a G++
13# version.13# version.
14 g++-4.9,14 g++-4.9,
15 libconnectivity-qt1-dev,
15 libgl1-mesa-dev[!armhf] | libgl-dev[!armhf],16 libgl1-mesa-dev[!armhf] | libgl-dev[!armhf],
16 libgl1-mesa-dri,17 libgl1-mesa-dri,
17 libgles2-mesa-dev[armhf],18 libgles2-mesa-dev[armhf],
1819
=== modified file 'src/CMakeLists.txt'
--- src/CMakeLists.txt 2014-10-06 15:45:25 +0000
+++ src/CMakeLists.txt 2014-11-26 08:29:52 +0000
@@ -1,6 +1,9 @@
1pkg_check_modules(CONNECTIVITY REQUIRED connectivity-qt1)
2
1include_directories(3include_directories(
2 ${Qt5Gui_PRIVATE_INCLUDE_DIRS}4 ${Qt5Gui_PRIVATE_INCLUDE_DIRS}
3 ${CMAKE_SOURCE_DIR}/libs/UbuntuGestures5 ${CMAKE_SOURCE_DIR}/libs/UbuntuGestures
6 ${CONNECTIVITY_INCLUDE_DIRS}
4)7)
58
6file(GLOB_RECURSE QML_FILES9file(GLOB_RECURSE QML_FILES
@@ -30,7 +33,7 @@
30 target_link_libraries(${SHELL_APP} ${XCB_LDFLAGS})33 target_link_libraries(${SHELL_APP} ${XCB_LDFLAGS})
31endif()34endif()
3235
33target_link_libraries(${SHELL_APP} UbuntuGestures)36target_link_libraries(${SHELL_APP} UbuntuGestures connectivity-qt1)
3437
35# For it to find libUbuntuGestures.so38# For it to find libUbuntuGestures.so
36set_target_properties(${SHELL_APP} PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${SHELL_PRIVATE_LIBDIR}")39set_target_properties(${SHELL_APP} PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${SHELL_PRIVATE_LIBDIR}")
3740
=== modified file 'src/CachingNetworkManagerFactory.cpp'
--- src/CachingNetworkManagerFactory.cpp 2014-07-02 07:56:24 +0000
+++ src/CachingNetworkManagerFactory.cpp 2014-11-26 08:29:52 +0000
@@ -20,25 +20,16 @@
20#include <QNetworkDiskCache>20#include <QNetworkDiskCache>
21#include <QNetworkAccessManager>21#include <QNetworkAccessManager>
22#include <QStandardPaths>22#include <QStandardPaths>
23#include <QNetworkConfigurationManager>
2423
25CachingNetworkAccessManager::CachingNetworkAccessManager(QObject *parent)24CachingNetworkAccessManager::CachingNetworkAccessManager(QObject *parent)
26 : QNetworkAccessManager(parent)25 : QNetworkAccessManager(parent)
27{26{
28 m_networkManager = new QNetworkConfigurationManager(this);27 m_networkingStatus = new ubuntu::connectivity::NetworkingStatus(this);
29
30 QObject::connect(m_networkManager, &QNetworkConfigurationManager::onlineStateChanged, this, &CachingNetworkAccessManager::onlineStateChanged);
31 m_isOnline = m_networkManager->isOnline();
32}
33
34void CachingNetworkAccessManager::onlineStateChanged(bool isOnline)
35{
36 m_isOnline = isOnline;
37}28}
3829
39QNetworkReply* CachingNetworkAccessManager::createRequest(Operation op, const QNetworkRequest &request, QIODevice *outgoingData)30QNetworkReply* CachingNetworkAccessManager::createRequest(Operation op, const QNetworkRequest &request, QIODevice *outgoingData)
40{31{
41 if (!m_isOnline) {32 if (m_networkingStatus->status() != ubuntu::connectivity::NetworkingStatus::Status::Online) {
42 QNetworkRequest req(request);33 QNetworkRequest req(request);
43 req.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::AlwaysCache);34 req.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::AlwaysCache);
44 return QNetworkAccessManager::createRequest(op, req, outgoingData);35 return QNetworkAccessManager::createRequest(op, req, outgoingData);
4536
=== modified file 'src/CachingNetworkManagerFactory.h'
--- src/CachingNetworkManagerFactory.h 2014-06-30 16:42:58 +0000
+++ src/CachingNetworkManagerFactory.h 2014-11-26 08:29:52 +0000
@@ -21,7 +21,7 @@
21#include <QQmlNetworkAccessManagerFactory>21#include <QQmlNetworkAccessManagerFactory>
22#include <QNetworkAccessManager>22#include <QNetworkAccessManager>
2323
24class QNetworkConfigurationManager;24#include <ubuntu/connectivity/networking-status.h>
2525
26class CachingNetworkAccessManager : public QNetworkAccessManager26class CachingNetworkAccessManager : public QNetworkAccessManager
27{27{
@@ -31,12 +31,8 @@
31protected:31protected:
32 QNetworkReply* createRequest(Operation op, const QNetworkRequest &req, QIODevice *outgoingData = 0) override;32 QNetworkReply* createRequest(Operation op, const QNetworkRequest &req, QIODevice *outgoingData = 0) override;
3333
34private Q_SLOTS:
35 void onlineStateChanged(bool isOnline);
36
37private:34private:
38 QNetworkConfigurationManager* m_networkManager;35 ubuntu::connectivity::NetworkingStatus* m_networkingStatus;
39 bool m_isOnline;
40};36};
4137
42class CachingNetworkManagerFactory : public QQmlNetworkAccessManagerFactory38class CachingNetworkManagerFactory : public QQmlNetworkAccessManagerFactory
4339
=== modified file 'src/Dash/CMakeLists.txt'
--- src/Dash/CMakeLists.txt 2014-10-06 15:45:25 +0000
+++ src/Dash/CMakeLists.txt 2014-11-26 08:29:52 +0000
@@ -12,7 +12,7 @@
12# For it to find libUbuntuGestures.so, needed by Ubuntu.Gestures QML module.12# For it to find libUbuntuGestures.so, needed by Ubuntu.Gestures QML module.
13set_target_properties(unity8-dash PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${SHELL_PRIVATE_LIBDIR}")13set_target_properties(unity8-dash PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${SHELL_PRIVATE_LIBDIR}")
1414
15target_link_libraries(unity8-dash UbuntuGestures)15target_link_libraries(unity8-dash UbuntuGestures connectivity-qt1)
1616
17set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")17set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
1818

Subscribers

People subscribed via source and target branches