|  |  | @ -29,7 +29,7 @@ bool compare_by_strength(const Network &a, const Network &b) { | 
			
		
	
		
		
			
				
					
					|  |  |  |   return a.strength > b.strength; |  |  |  |   return a.strength > b.strength; | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | WifiManager::WifiManager(QWidget* parent) : QWidget(parent) { |  |  |  | WifiManager::WifiManager(QObject *parent) : QObject(parent) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |   qDBusRegisterMetaType<Connection>(); |  |  |  |   qDBusRegisterMetaType<Connection>(); | 
			
		
	
		
		
			
				
					
					|  |  |  |   qDBusRegisterMetaType<IpConfig>(); |  |  |  |   qDBusRegisterMetaType<IpConfig>(); | 
			
		
	
		
		
			
				
					
					|  |  |  |   connecting_to_network = ""; |  |  |  |   connecting_to_network = ""; | 
			
		
	
	
		
		
			
				
					|  |  | @ -47,13 +47,7 @@ WifiManager::WifiManager(QWidget* parent) : QWidget(parent) { | 
			
		
	
		
		
			
				
					
					|  |  |  |     bus.connect(NM_DBUS_SERVICE, NM_DBUS_PATH, NM_DBUS_INTERFACE, "DeviceAdded", this, SLOT(deviceAdded(QDBusObjectPath))); |  |  |  |     bus.connect(NM_DBUS_SERVICE, NM_DBUS_PATH, NM_DBUS_INTERFACE, "DeviceAdded", this, SLOT(deviceAdded(QDBusObjectPath))); | 
			
		
	
		
		
			
				
					
					|  |  |  |   } |  |  |  |   } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   QTimer* timer = new QTimer(this); |  |  |  |   timer.callOnTimeout(this, &WifiManager::requestScan); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |   QObject::connect(timer, &QTimer::timeout, this, [=]() { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     if (!adapter.isEmpty() && this->isVisible()) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       requestScan(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |   }); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |   timer->start(5000); |  |  |  |  | 
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | void WifiManager::setup() { |  |  |  | void WifiManager::setup() { | 
			
		
	
	
		
		
			
				
					|  |  | @ -74,10 +68,18 @@ void WifiManager::setup() { | 
			
		
	
		
		
			
				
					
					|  |  |  |   requestScan(); |  |  |  |   requestScan(); | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | void WifiManager::start() { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   timer.start(5000); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   refreshNetworks(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | void WifiManager::stop() { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   timer.stop(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | void WifiManager::refreshNetworks() { |  |  |  | void WifiManager::refreshNetworks() { | 
			
		
	
		
		
			
				
					
					|  |  |  |   if (adapter.isEmpty()) { |  |  |  |   if (adapter.isEmpty() || !timer.isActive()) return; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |     return; |  |  |  | 
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |   } |  |  |  |  | 
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |   seenNetworks.clear(); |  |  |  |   seenNetworks.clear(); | 
			
		
	
		
		
			
				
					
					|  |  |  |   ipv4_address = get_ipv4_address(); |  |  |  |   ipv4_address = get_ipv4_address(); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  |  | @ -107,6 +109,7 @@ void WifiManager::refreshNetworks() { | 
			
		
	
		
		
			
				
					
					|  |  |  |     Network network = {ssid, strength, ctype, security}; |  |  |  |     Network network = {ssid, strength, ctype, security}; | 
			
		
	
		
		
			
				
					
					|  |  |  |     seenNetworks[ssid] = network; |  |  |  |     seenNetworks[ssid] = network; | 
			
		
	
		
		
			
				
					
					|  |  |  |   } |  |  |  |   } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |   emit refreshSignal(); | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | QString WifiManager::get_ipv4_address() { |  |  |  | QString WifiManager::get_ipv4_address() { | 
			
		
	
	
		
		
			
				
					|  |  | @ -315,21 +318,14 @@ void WifiManager::stateChange(unsigned int new_state, unsigned int previous_stat | 
			
		
	
		
		
			
				
					
					|  |  |  |     emit wrongPassword(connecting_to_network); |  |  |  |     emit wrongPassword(connecting_to_network); | 
			
		
	
		
		
			
				
					
					|  |  |  |   } else if (new_state == NM_DEVICE_STATE_ACTIVATED) { |  |  |  |   } else if (new_state == NM_DEVICE_STATE_ACTIVATED) { | 
			
		
	
		
		
			
				
					
					|  |  |  |     connecting_to_network = ""; |  |  |  |     connecting_to_network = ""; | 
			
		
	
		
		
			
				
					
					|  |  |  |     if (this->isVisible()) { |  |  |  |     refreshNetworks(); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |       refreshNetworks(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       emit refreshSignal(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |  | 
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |   } |  |  |  |   } | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | // https://developer.gnome.org/NetworkManager/stable/gdbus-org.freedesktop.NetworkManager.Device.Wireless.html
 |  |  |  | // https://developer.gnome.org/NetworkManager/stable/gdbus-org.freedesktop.NetworkManager.Device.Wireless.html
 | 
			
		
	
		
		
			
				
					
					|  |  |  | void WifiManager::propertyChange(const QString &interface, const QVariantMap &props, const QStringList &invalidated_props) { |  |  |  | void WifiManager::propertyChange(const QString &interface, const QVariantMap &props, const QStringList &invalidated_props) { | 
			
		
	
		
		
			
				
					
					|  |  |  |   if (interface == NM_DBUS_INTERFACE_DEVICE_WIRELESS && props.contains("LastScan")) { |  |  |  |   if (interface == NM_DBUS_INTERFACE_DEVICE_WIRELESS && props.contains("LastScan")) { | 
			
		
	
		
		
			
				
					
					|  |  |  |     if (this->isVisible() || firstScan) { |  |  |  |     refreshNetworks(); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |       refreshNetworks(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       emit refreshSignal(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       firstScan = false; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |  | 
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |   } else if (interface == NM_DBUS_INTERFACE_DEVICE_WIRELESS && props.contains("ActiveAccessPoint")) { |  |  |  |   } else if (interface == NM_DBUS_INTERFACE_DEVICE_WIRELESS && props.contains("ActiveAccessPoint")) { | 
			
		
	
		
		
			
				
					
					|  |  |  |     const QDBusObjectPath &path = props.value("ActiveAccessPoint").value<QDBusObjectPath>(); |  |  |  |     const QDBusObjectPath &path = props.value("ActiveAccessPoint").value<QDBusObjectPath>(); | 
			
		
	
		
		
			
				
					
					|  |  |  |     activeAp = path.path(); |  |  |  |     activeAp = path.path(); | 
			
		
	
	
		
		
			
				
					|  |  | 
 |