ui/networking: show "connecting" immediately after clicking on a network (#29378)
* fix connecting not show
* clear connect state
* pass network by value
* add comment
* move pass by value to anoter pr
* should always use function to set connecting_to_network
* remove connecting when forgetting
* out here
* can't do this :(
* Revert "can't do this :("
This reverts commit e06145202de34142e74667c876dc22442eb30796.
Revert "out here"
This reverts commit 8ca7b47a28854a92d95fcb5c5fc435e140f9af2c.
Revert "remove connecting when forgetting"
This reverts commit 671db0b5e76b6266a48f20bf4a1fd40cad4f90a4.
Revert "should always use function to set connecting_to_network"
This reverts commit a220b518fa2a4103046f9522afada80db76ae90d.
* makes sense to keep this the same
* not in between slots
---------
Co-authored-by: Shane Smiskol <shane@smiskol.com>
old-commit-hash: 9fe3df5d75bcaca3ea5be9e1d22bc00515c6e018
This commit is contained in:
@@ -80,7 +80,6 @@ void Networking::refresh() {
|
||||
void Networking::connectToNetwork(const Network n) {
|
||||
if (wifi->isKnownConnection(n.ssid)) {
|
||||
wifi->activateWifiConnection(n.ssid);
|
||||
wifiWidget->refresh();
|
||||
} else if (n.security_type == SecurityType::OPEN) {
|
||||
wifi->connect(n);
|
||||
} else if (n.security_type == SecurityType::WPA) {
|
||||
|
||||
@@ -166,8 +166,7 @@ SecurityType WifiManager::getSecurityType(const QVariantMap &properties) {
|
||||
}
|
||||
|
||||
void WifiManager::connect(const Network &n, const QString &password, const QString &username) {
|
||||
connecting_to_network = n.ssid;
|
||||
seenNetworks[n.ssid].connected = ConnectedType::CONNECTING;
|
||||
setCurrentConnecting(n.ssid);
|
||||
forgetConnection(n.ssid); // Clear all connections that may already exist to the network we are connecting
|
||||
Connection connection;
|
||||
connection["connection"]["type"] = "802-11-wireless";
|
||||
@@ -232,6 +231,14 @@ void WifiManager::forgetConnection(const QString &ssid) {
|
||||
}
|
||||
}
|
||||
|
||||
void WifiManager::setCurrentConnecting(const QString &ssid) {
|
||||
connecting_to_network = ssid;
|
||||
for (auto &network : seenNetworks) {
|
||||
network.connected = (network.ssid == ssid) ? ConnectedType::CONNECTING : ConnectedType::DISCONNECTED;
|
||||
}
|
||||
emit refreshSignal();
|
||||
}
|
||||
|
||||
uint WifiManager::getAdapterType(const QDBusObjectPath &path) {
|
||||
return call<uint>(path.path(), NM_DBUS_INTERFACE_PROPERTIES, "Get", NM_DBUS_INTERFACE_DEVICE, "DeviceType");
|
||||
}
|
||||
@@ -320,7 +327,7 @@ void WifiManager::initConnections() {
|
||||
std::optional<QDBusPendingCall> WifiManager::activateWifiConnection(const QString &ssid) {
|
||||
const QDBusObjectPath &path = getConnectionPath(ssid);
|
||||
if (!path.path().isEmpty()) {
|
||||
connecting_to_network = ssid;
|
||||
setCurrentConnecting(ssid);
|
||||
return asyncCall(NM_DBUS_PATH, NM_DBUS_INTERFACE, "ActivateConnection", QVariant::fromValue(path), QVariant::fromValue(QDBusObjectPath(adapter)), QVariant::fromValue(QDBusObjectPath("/")));
|
||||
}
|
||||
return std::nullopt;
|
||||
|
||||
@@ -85,6 +85,7 @@ private:
|
||||
void refreshNetworks();
|
||||
void activateModemConnection(const QDBusObjectPath &path);
|
||||
void addTetheringConnection();
|
||||
void setCurrentConnecting(const QString &ssid);
|
||||
|
||||
signals:
|
||||
void wrongPassword(const QString &ssid);
|
||||
|
||||
Reference in New Issue
Block a user