fix bug131075
This commit is contained in:
parent
41f3fb0d7f
commit
21cad20648
|
@ -46,6 +46,8 @@ public:
|
|||
void setMulDns(const QList<QHostAddress> &dns);
|
||||
void setGateWay(const QString &gateWay);
|
||||
|
||||
QString getNetMaskText(QString text);
|
||||
|
||||
bool checkIsChanged(const ConInfo info, KyConnectSetting &setting);
|
||||
|
||||
void startLoading();
|
||||
|
@ -87,7 +89,7 @@ private:
|
|||
void configSave();
|
||||
bool getTextEditState(QString text);
|
||||
bool netMaskIsValide(QString text);
|
||||
QString getNetMaskText(QString text);
|
||||
|
||||
bool checkConnectBtnIsEnabled();
|
||||
void initConflictHintLable();
|
||||
void initLoadingIcon();
|
||||
|
|
|
@ -19,6 +19,10 @@
|
|||
*/
|
||||
#include "joinhiddenwifipage.h"
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
#define THEME_SCHAME "org.ukui.style"
|
||||
#define COLOR_THEME "styleName"
|
||||
#define WINDOW_WIDTH 480
|
||||
#define MIN_WINDOW_HEIGHT 368
|
||||
#define PEAP_WINDOW_HEIGHT 524
|
||||
|
@ -253,3 +257,25 @@ void JoinHiddenWiFiPage::onEapTypeChanged(const KyEapMethodType &type)
|
|||
}
|
||||
}
|
||||
|
||||
void JoinHiddenWiFiPage::onPaletteChanged()
|
||||
{
|
||||
QPalette pal = qApp->palette();
|
||||
|
||||
QGSettings * styleGsettings = nullptr;
|
||||
// const QByteArray style_id(THEME_SCHAME);
|
||||
// if (QGSettings::isSchemaInstalled(style_id)) {
|
||||
// styleGsettings = new QGSettings(style_id);
|
||||
// QString currentTheme = styleGsettings->get(COLOR_THEME).toString();
|
||||
// if(currentTheme == "ukui-default"){
|
||||
// pal = lightPalette(this);
|
||||
// }
|
||||
// }
|
||||
this->setPalette(pal);
|
||||
setFramePalette(m_secuWidget, pal);
|
||||
setFramePalette(m_hiddenWifiScrollArea, pal);
|
||||
|
||||
if (styleGsettings != nullptr) {
|
||||
delete styleGsettings;
|
||||
styleGsettings = nullptr;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -88,6 +88,7 @@ private Q_SLOTS:
|
|||
void onBtnShowListClicked();
|
||||
void onSecuTypeChanged(const KySecuType &type);
|
||||
void onEapTypeChanged(const KyEapMethodType &type);
|
||||
void onPaletteChanged();
|
||||
|
||||
Q_SIGNALS:
|
||||
void hiddenWiFiPageClose(QString);
|
||||
|
|
|
@ -689,26 +689,16 @@ void NetDetail::getStaticIpInfo(ConInfo &conInfo, bool bActived)
|
|||
kyConnectResourse->getConnectionSetting(m_uuid,connetSetting);
|
||||
connetSetting.dumpInfo();
|
||||
|
||||
conInfo.ipv4ConfigType = connetSetting.m_ipv4ConfigIpType;
|
||||
// conInfo.ipv4ConfigType = connetSetting.m_ipv4ConfigIpType;
|
||||
conInfo.ipv6ConfigType = connetSetting.m_ipv6ConfigIpType;
|
||||
conInfo.isAutoConnect = connetSetting.m_isAutoConnect;
|
||||
|
||||
if (connetSetting.m_ipv4ConfigIpType == CONFIG_IP_MANUAL) {
|
||||
if (connetSetting.m_ipv4Address.size() > 0) {
|
||||
conInfo.strIPV4Address = connetSetting.m_ipv4Address.at(0).ip().toString();
|
||||
conInfo.strIPV4NetMask = connetSetting.m_ipv4Address.at(0).netmask().toString();
|
||||
conInfo.strIPV4GateWay = connetSetting.m_ipv4Address.at(0).gateway().toString();
|
||||
}
|
||||
#if 0
|
||||
if (connetSetting.m_ipv4Dns.size() == 1) {
|
||||
conInfo.strIPV4FirDns = connetSetting.m_ipv4Dns.at(0).toString();
|
||||
} else if (connetSetting.m_ipv4Dns.size() > 1) {
|
||||
conInfo.strIPV4FirDns = connetSetting.m_ipv4Dns.at(0).toString();
|
||||
conInfo.strIPV4SecDns = connetSetting.m_ipv4Dns.at(1).toString();
|
||||
}
|
||||
#endif
|
||||
|
||||
conInfo.ipv4DnsList = connetSetting.m_ipv4Dns;
|
||||
//openkylin从第三方库读取有问题 改为ipv4信息直接通过dbus获取
|
||||
KyConnectItem* item = kyConnectResourse->getConnectionItemByUuidWithoutActivateChecking(m_uuid);
|
||||
if (item == nullptr) {
|
||||
conInfo.ipv4ConfigType = CONFIG_IP_DHCP;
|
||||
} else {
|
||||
getIpv4Info(item->m_connectPath, conInfo);
|
||||
}
|
||||
|
||||
if (connetSetting.m_ipv6ConfigIpType == CONFIG_IP_MANUAL) {
|
||||
|
@ -732,7 +722,14 @@ void NetDetail::getStaticIpInfo(ConInfo &conInfo, bool bActived)
|
|||
if (!bActived) {
|
||||
conInfo.strDynamicIpv4 = conInfo.strIPV4Address.isEmpty() ? tr("Auto") : conInfo.strIPV4Address;
|
||||
conInfo.strDynamicIpv6 = conInfo.strIPV6Address.isEmpty() ? tr("Auto") : conInfo.strIPV6Address;
|
||||
conInfo.strDynamicIpv4Dns = conInfo.strIPV4FirDns.isEmpty() ? tr("Auto") : conInfo.strIPV4FirDns;
|
||||
QString dns(" ");
|
||||
for (int i = 0; i < conInfo.ipv4DnsList.size(); ++i) {
|
||||
dns.append(conInfo.ipv4DnsList.at(i).toString());
|
||||
if (i != conInfo.ipv4DnsList.size()-1) {
|
||||
dns.append(" ");
|
||||
}
|
||||
}
|
||||
conInfo.strDynamicIpv4Dns = dns.isEmpty() ? tr("Auto") : dns;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1272,3 +1269,88 @@ void ThreadObject::checkIpv6ConflictThread(const QString &ipv6Address)
|
|||
ipv6rping = nullptr;
|
||||
Q_EMIT ipv6IsConflict(isConflict);
|
||||
}
|
||||
|
||||
void NetDetail::getIpv4Info(QString objPath, ConInfo &conInfo)
|
||||
{
|
||||
QDBusInterface m_interface("org.freedesktop.NetworkManager",
|
||||
objPath,
|
||||
"org.freedesktop.NetworkManager.Settings.Connection",
|
||||
QDBusConnection::systemBus());
|
||||
QDBusMessage result = m_interface.call("GetSettings");
|
||||
|
||||
if (result.arguments().isEmpty()) { return; }
|
||||
const QDBusArgument &dbusArg1st = result.arguments().at( 0 ).value<QDBusArgument>();
|
||||
QMap<QString,QMap<QString,QVariant>> map;
|
||||
dbusArg1st >> map;
|
||||
|
||||
for (QString key : map.keys() ) {
|
||||
QMap<QString,QVariant> innerMap = map.value(key);
|
||||
if (key == "ipv4") {
|
||||
for (QString inner_key : innerMap.keys()) {
|
||||
if (inner_key == "address-data") {
|
||||
//ipv4地址 ipv4子网掩码
|
||||
const QDBusArgument &dbusArg2nd = innerMap.value(inner_key).value<QDBusArgument>();
|
||||
QVector<QMap<QString,QVariant>> addressVector;
|
||||
|
||||
dbusArg2nd.beginArray();
|
||||
|
||||
while (!dbusArg2nd.atEnd()) {
|
||||
QMap<QString,QVariant> tempMap;
|
||||
dbusArg2nd >> tempMap;
|
||||
addressVector.append(tempMap);
|
||||
}
|
||||
dbusArg2nd.endArray();
|
||||
if (addressVector.size() >= 1) {
|
||||
conInfo.strIPV4Address = addressVector.at(0).value("address").toString();
|
||||
conInfo.strIPV4NetMask = ipv4Page->getNetMaskText(addressVector.at(0).value("prefix").toString());
|
||||
}
|
||||
} else if (inner_key == "method") {
|
||||
//ipv4 method
|
||||
if (innerMap.value(inner_key).toString() == "auto")
|
||||
conInfo.ipv4ConfigType = CONFIG_IP_DHCP;
|
||||
else {
|
||||
conInfo.ipv4ConfigType = CONFIG_IP_MANUAL;
|
||||
}
|
||||
} else if (inner_key == "dns") {
|
||||
//dns
|
||||
const QDBusArgument &dbusArg2nd = innerMap.value(inner_key).value<QDBusArgument>();
|
||||
QList<uint> addressVector;
|
||||
|
||||
dbusArg2nd.beginArray();
|
||||
while (!dbusArg2nd.atEnd()) {
|
||||
uint tempMap;
|
||||
dbusArg2nd >> tempMap;
|
||||
addressVector.append(tempMap);
|
||||
}
|
||||
dbusArg2nd.endArray();
|
||||
for (int i = 0; i < addressVector.size(); ++i) {
|
||||
QString dns(inet_ntoa(*(struct in_addr *)&addressVector.at(i)));
|
||||
conInfo.ipv4DnsList << QHostAddress(dns);
|
||||
}
|
||||
|
||||
} else if (inner_key == "gateway") {
|
||||
//gateway
|
||||
conInfo.strIPV4GateWay = innerMap.value(inner_key).toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
// if (key == "ipv6") {
|
||||
// for (QString inner_key : innerMap.keys()) {
|
||||
// if (inner_key == "address-data"){
|
||||
// const QDBusArgument &dbusArg2nd = innerMap.value(inner_key).value<QDBusArgument>();
|
||||
// QMap<QString,QVariant> m_map;
|
||||
|
||||
// dbusArg2nd.beginArray();
|
||||
// while (!dbusArg2nd.atEnd()) {
|
||||
// dbusArg2nd >> m_map;// append map to a vector here if you want to keep it
|
||||
// }
|
||||
// dbusArg2nd.endArray();
|
||||
|
||||
// dbusWifiIpv6 = m_map.value("address").toString();
|
||||
// } else if (inner_key == "method") {
|
||||
// dbusWifiIpv6Method = innerMap.value(inner_key).toString();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
#include "kwidget.h"
|
||||
#include "ktabbar.h"
|
||||
|
||||
#include <arpa/inet.h>
|
||||
using namespace kdk;
|
||||
|
||||
#define TAB_WIDTH 60
|
||||
|
@ -146,6 +147,7 @@ private:
|
|||
void startObjectThread();
|
||||
void setNetTabToolTip();
|
||||
|
||||
void getIpv4Info(QString objPath, ConInfo &conInfo);
|
||||
private:
|
||||
KyNetworkDeviceResourse *m_netDeviceResource = nullptr;
|
||||
KyConnectOperation* m_connectOperation = nullptr;
|
||||
|
|
|
@ -108,8 +108,10 @@ void VpnPage::constructActiveConnectionArea()
|
|||
{
|
||||
QList<KyConnectItem *> activedList;
|
||||
QList<KyConnectItem *> netList;
|
||||
QGSettings vpnGsettings(GSETTINGS_VPNICON_VISIBLE);
|
||||
|
||||
QGSettings* vpnGsettings = nullptr;
|
||||
if (QGSettings::isSchemaInstalled(GSETTINGS_VPNICON_VISIBLE)) {
|
||||
vpnGsettings = new QGSettings(GSETTINGS_VPNICON_VISIBLE);
|
||||
}
|
||||
activedList.clear();
|
||||
netList.clear();
|
||||
clearConnectionMap(m_activeConnectionMap, m_vpnListWidget);
|
||||
|
@ -137,12 +139,14 @@ void VpnPage::constructActiveConnectionArea()
|
|||
delete p_netConnectionItem;
|
||||
p_netConnectionItem = nullptr;
|
||||
}
|
||||
if (vpnGsettings.keys().contains(QString(VISIBLE))) {
|
||||
vpnGsettings.set(VISIBLE, true);
|
||||
if (vpnGsettings != nullptr
|
||||
&& vpnGsettings->keys().contains(QString(VISIBLE))) {
|
||||
vpnGsettings->set(VISIBLE, true);
|
||||
}
|
||||
} else {
|
||||
if (vpnGsettings.keys().contains(QString(VISIBLE))) {
|
||||
vpnGsettings.set(VISIBLE, false);
|
||||
if (vpnGsettings != nullptr
|
||||
&& vpnGsettings->keys().contains(QString(VISIBLE))) {
|
||||
vpnGsettings->set(VISIBLE, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -154,6 +158,9 @@ void VpnPage::constructActiveConnectionArea()
|
|||
m_netListArea->setFixedHeight(MAX_ITEMS * ITEM_HEIGHT);
|
||||
}
|
||||
m_netFrame->setFixedHeight(37 + m_netListArea->height());
|
||||
|
||||
delete vpnGsettings;
|
||||
vpnGsettings = nullptr;
|
||||
}
|
||||
|
||||
void VpnPage::initVpnArea()
|
||||
|
|
|
@ -151,7 +151,8 @@ void LanPage::initNetSwitch()
|
|||
qDebug()<<"[LanPage] org.ukui.kylin-nm.switch is not installed!";
|
||||
}
|
||||
|
||||
if (wiredSwitch != wiredEnable) {
|
||||
if (m_switchGsettings != nullptr
|
||||
&&wiredSwitch != wiredEnable) {
|
||||
m_switchGsettings->set(WIRED_SWITCH, wiredEnable);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue