@ -341,7 +341,7 @@ void WifiManager::connectionRemoved(const QDBusObjectPath &path) {
}
void WifiManager : : newConnection ( const QDBusObjectPath & path ) {
knownConnections [ path ] = getConnectionSsid ( path ) ;
knownConnections [ path ] = getConnectionSettings ( path ) . value ( " 802-11-wireless " ) . value ( " ssid " ) . toString ( ) ;
if ( knownConnections [ path ] ! = tethering_ssid ) {
activateWifiConnection ( knownConnections [ path ] ) ;
}
@ -362,11 +362,10 @@ QDBusObjectPath WifiManager::getConnectionPath(const QString &ssid) {
return QDBusObjectPath ( ) ;
}
QString WifiManager : : getConnectionSsid ( const QDBusObjectPath & path ) {
Connection WifiManager : : getConnectionSettings ( const QDBusObjectPath & path ) {
QDBusInterface nm ( NM_DBUS_SERVICE , path . path ( ) , NM_DBUS_INTERFACE_SETTINGS_CONNECTION , bus ) ;
nm . setTimeout ( DBUS_TIMEOUT ) ;
const QDBusReply < Connection > result = nm . call ( " GetSettings " ) ;
return result . value ( ) . value ( " 802-11-wireless " ) . value ( " ssid " ) . toString ( ) ;
return QDBusReply < Connection > ( nm . call ( " GetSettings " ) ) . value ( ) ;
}
void WifiManager : : initConnections ( ) {
@ -375,7 +374,12 @@ void WifiManager::initConnections() {
const QDBusReply < QList < QDBusObjectPath > > response = nm . call ( " ListConnections " ) ;
for ( const QDBusObjectPath & path : response . value ( ) ) {
knownConnections [ path ] = getConnectionSsid ( path ) ;
const Connection & settings = getConnectionSettings ( path ) ;
if ( settings . value ( " connection " ) . value ( " type " ) = = " 802-11-wireless " ) {
knownConnections [ path ] = settings . value ( " 802-11-wireless " ) . value ( " ssid " ) . toString ( ) ;
} else if ( path . path ( ) ! = " / " ) {
lteConnectionPath = path . path ( ) ;
}
}
}
@ -416,6 +420,19 @@ NetworkType WifiManager::currentNetworkType() {
return NetworkType : : NONE ;
}
void WifiManager : : setRoamingEnabled ( bool roaming ) {
if ( ! lteConnectionPath . isEmpty ( ) ) {
QDBusInterface nm ( NM_DBUS_SERVICE , lteConnectionPath , NM_DBUS_INTERFACE_SETTINGS_CONNECTION , bus ) ;
nm . setTimeout ( DBUS_TIMEOUT ) ;
Connection settings = QDBusReply < Connection > ( nm . call ( " GetSettings " ) ) . value ( ) ;
if ( settings . value ( " gsm " ) . value ( " home-only " ) . toBool ( ) = = roaming ) {
settings [ " gsm " ] [ " home-only " ] = ! roaming ;
nm . call ( " UpdateUnsaved " , QVariant : : fromValue ( settings ) ) ; // update is temporary
}
}
}
// Functions for tethering
void WifiManager : : addTetheringConnection ( ) {
Connection connection ;