@ -365,8 +365,10 @@ void WifiManager::connectionRemoved(const QDBusObjectPath &path) {
void WifiManager : : newConnection ( const QDBusObjectPath & path ) {
void WifiManager : : newConnection ( const QDBusObjectPath & path ) {
knownConnections [ path ] = getConnectionSsid ( path ) ;
knownConnections [ path ] = getConnectionSsid ( path ) ;
if ( knownConnections [ path ] ! = tethering_ssid ) {
activateWifiConnection ( knownConnections [ path ] ) ;
activateWifiConnection ( knownConnections [ path ] ) ;
}
}
}
void WifiManager : : disconnect ( ) {
void WifiManager : : disconnect ( ) {
QString active_ap = get_active_ap ( ) ;
QString active_ap = get_active_ap ( ) ;
@ -428,7 +430,7 @@ void WifiManager::addTetheringConnection() {
connection [ " 802-11-wireless-security " ] [ " key-mgmt " ] = " wpa-psk " ;
connection [ " 802-11-wireless-security " ] [ " key-mgmt " ] = " wpa-psk " ;
connection [ " 802-11-wireless-security " ] [ " pairwise " ] = QStringList ( " ccmp " ) ;
connection [ " 802-11-wireless-security " ] [ " pairwise " ] = QStringList ( " ccmp " ) ;
connection [ " 802-11-wireless-security " ] [ " proto " ] = QStringList ( " rsn " ) ;
connection [ " 802-11-wireless-security " ] [ " proto " ] = QStringList ( " rsn " ) ;
connection [ " 802-11-wireless-security " ] [ " psk " ] = tetheringPassword ;
connection [ " 802-11-wireless-security " ] [ " psk " ] = defaul tT etheringPassword;
connection [ " ipv4 " ] [ " method " ] = " shared " ;
connection [ " ipv4 " ] [ " method " ] = " shared " ;
QMap < QString , QVariant > address ;
QMap < QString , QVariant > address ;
@ -445,7 +447,7 @@ void WifiManager::addTetheringConnection() {
}
}
void WifiManager : : enableTethering ( ) {
void WifiManager : : enableTethering ( ) {
if ( ! isKnownConnection ( tethering_ssid . toUtf8 ( ) ) ) {
if ( ! isKnownConnection ( tethering_ssid ) ) {
addTetheringConnection ( ) ;
addTetheringConnection ( ) ;
}
}
activateWifiConnection ( tethering_ssid . toUtf8 ( ) ) ;
activateWifiConnection ( tethering_ssid . toUtf8 ( ) ) ;
@ -465,8 +467,29 @@ bool WifiManager::tetheringEnabled() {
return false ;
return false ;
}
}
void WifiManager : : changeTetheringPassword ( const QString & newPassword ) {
QString WifiManager : : getTetheringPassword ( ) {
tetheringPassword = newPassword ;
if ( ! isKnownConnection ( tethering_ssid ) ) {
forgetConnection ( tethering_ssid . toUtf8 ( ) ) ;
addTetheringConnection ( ) ;
addTetheringConnection ( ) ;
}
}
const QDBusObjectPath & path = getConnectionPath ( tethering_ssid ) ;
if ( ! path . path ( ) . isEmpty ( ) ) {
QDBusInterface nm ( NM_DBUS_INTERFACE , path . path ( ) , NM_DBUS_INTERFACE_SETTINGS_CONNECTION , bus ) ;
nm . setTimeout ( DBUS_TIMEOUT ) ;
const QDBusReply < QMap < QString , QMap < QString , QVariant > > > response = nm . call ( " GetSecrets " , " 802-11-wireless-security " ) ;
return response . value ( ) . value ( " 802-11-wireless-security " ) . value ( " psk " ) . toString ( ) ;
}
return " " ;
}
void WifiManager : : changeTetheringPassword ( const QString & newPassword ) {
const QDBusObjectPath & path = getConnectionPath ( tethering_ssid ) ;
if ( ! path . path ( ) . isEmpty ( ) ) {
QDBusInterface nm ( NM_DBUS_INTERFACE , path . path ( ) , NM_DBUS_INTERFACE_SETTINGS_CONNECTION , bus ) ;
nm . setTimeout ( DBUS_TIMEOUT ) ;
Connection settings = QDBusReply < Connection > ( nm . call ( " GetSettings " ) ) . value ( ) ;
settings [ " 802-11-wireless-security " ] [ " psk " ] = newPassword ;
nm . call ( " Update " , QVariant : : fromValue ( settings ) ) ;
}
}