Changeset View
Changeset View
Standalone View
Standalone View
libs/declarative/connectionicon.cpp
Show First 20 Lines • Show All 75 Lines • ▼ Show 20 Line(s) | 64 | for (const NetworkManager::Device::Ptr &device : NetworkManager::networkInterfaces()) { | |||
---|---|---|---|---|---|
76 | } | 76 | } | ||
77 | } | 77 | } | ||
78 | 78 | | |||
79 | for (const NetworkManager::ActiveConnection::Ptr &activeConnection : NetworkManager::activeConnections()) { | 79 | for (const NetworkManager::ActiveConnection::Ptr &activeConnection : NetworkManager::activeConnections()) { | ||
80 | addActiveConnection(activeConnection->path()); | 80 | addActiveConnection(activeConnection->path()); | ||
81 | } | 81 | } | ||
82 | setStates(); | 82 | setStates(); | ||
83 | 83 | | |||
84 | connectivityChanged(); | | |||
85 | setIcons(); | 84 | setIcons(); | ||
85 | | ||||
86 | QDBusPendingReply<uint> pendingReply = NetworkManager::checkConnectivity(); | ||||
87 | QDBusPendingCallWatcher *callWatcher = new QDBusPendingCallWatcher(pendingReply); | ||||
88 | connect(callWatcher, &QDBusPendingCallWatcher::finished, this, [this] (QDBusPendingCallWatcher *watcher) { | ||||
89 | QDBusPendingReply<uint> reply = *watcher; | ||||
90 | if (reply.isValid()) { | ||||
91 | connectivityChanged((NetworkManager::Connectivity)reply.value()); | ||||
92 | } | ||||
93 | watcher->deleteLater(); | ||||
94 | }); | ||||
86 | } | 95 | } | ||
87 | 96 | | |||
88 | ConnectionIcon::~ConnectionIcon() | 97 | ConnectionIcon::~ConnectionIcon() | ||
89 | { | 98 | { | ||
90 | } | 99 | } | ||
91 | 100 | | |||
92 | bool ConnectionIcon::connecting() const | 101 | bool ConnectionIcon::connecting() const | ||
93 | { | 102 | { | ||
▲ Show 20 Lines • Show All 73 Lines • ▼ Show 20 Line(s) | |||||
167 | } | 176 | } | ||
168 | 177 | | |||
169 | void ConnectionIcon::carrierChanged(bool carrier) | 178 | void ConnectionIcon::carrierChanged(bool carrier) | ||
170 | { | 179 | { | ||
171 | Q_UNUSED(carrier); | 180 | Q_UNUSED(carrier); | ||
172 | setIcons(); | 181 | setIcons(); | ||
173 | } | 182 | } | ||
174 | 183 | | |||
175 | void ConnectionIcon::connectivityChanged() | 184 | void ConnectionIcon::connectivityChanged(NetworkManager::Connectivity conn) | ||
176 | { | 185 | { | ||
177 | NetworkManager::Connectivity conn = NetworkManager::connectivity(); | 186 | const bool needsPortal = conn == NetworkManager::Portal; | ||
187 | if (needsPortal != m_needsPortal) { | ||||
188 | m_needsPortal = needsPortal; | ||||
189 | Q_EMIT needsPortalChanged(needsPortal); | ||||
190 | } | ||||
178 | setLimited(conn == NetworkManager::Portal || conn == NetworkManager::Limited); | 191 | setLimited(conn == NetworkManager::Portal || conn == NetworkManager::Limited); | ||
179 | } | 192 | } | ||
180 | 193 | | |||
181 | void ConnectionIcon::deviceAdded(const QString& device) | 194 | void ConnectionIcon::deviceAdded(const QString& device) | ||
182 | { | 195 | { | ||
183 | NetworkManager::Device::Ptr dev = NetworkManager::findNetworkInterface(device); | 196 | NetworkManager::Device::Ptr dev = NetworkManager::findNetworkInterface(device); | ||
184 | 197 | | |||
185 | if (!dev) { | 198 | if (!dev) { | ||
▲ Show 20 Lines • Show All 466 Lines • Show Last 20 Lines |