add method and dbus signal
This commit is contained in:
parent
6d7e721972
commit
84429a703b
|
@ -511,3 +511,24 @@ void KyActiveConnectResourse::getApActivateConnect(QList<KyApConnectItem *> &apC
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool KyActiveConnectResourse::isActiveConnection(QString uuid, QStringList &devName)
|
||||||
|
{
|
||||||
|
if (!m_networkResourceInstance->isActiveConnection(uuid)) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
NetworkManager::ActiveConnection::Ptr actPtr = m_networkResourceInstance->getActiveConnect(uuid);
|
||||||
|
if (actPtr.isNull()) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
QStringList interfaces = actPtr->devices();
|
||||||
|
for (int index = 0; index < interfaces.size(); ++index) {
|
||||||
|
QString ifaceUni = interfaces.at(index);
|
||||||
|
NetworkManager::Device:: Ptr devicePtr =
|
||||||
|
m_networkResourceInstance->findDeviceUni(ifaceUni);
|
||||||
|
devName <<devicePtr->interfaceName();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -34,6 +34,8 @@ public:
|
||||||
|
|
||||||
void getApActivateConnect(QList<KyApConnectItem *> &apConnectItemList);
|
void getApActivateConnect(QList<KyApConnectItem *> &apConnectItemList);
|
||||||
|
|
||||||
|
bool isActiveConnection(QString uuid, QStringList &devName);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void getActiveConnectIp(NetworkManager::ActiveConnection::Ptr activeConnectPtr,
|
void getActiveConnectIp(NetworkManager::ActiveConnection::Ptr activeConnectPtr,
|
||||||
QString &ipv4Address,
|
QString &ipv4Address,
|
||||||
|
|
|
@ -16,6 +16,7 @@ KyConnectResourse::KyConnectResourse(QObject *parent) : QObject(parent)
|
||||||
connect(m_networkResourceInstance, &KyNetworkResourceManager::connectionAdd, this, &KyConnectResourse::connectionAdd);
|
connect(m_networkResourceInstance, &KyNetworkResourceManager::connectionAdd, this, &KyConnectResourse::connectionAdd);
|
||||||
connect(m_networkResourceInstance, &KyNetworkResourceManager::connectionRemove, this, &KyConnectResourse::connectionRemove);
|
connect(m_networkResourceInstance, &KyNetworkResourceManager::connectionRemove, this, &KyConnectResourse::connectionRemove);
|
||||||
connect(m_networkResourceInstance, &KyNetworkResourceManager::connectionUpdate, this, &KyConnectResourse::connectionUpdate);
|
connect(m_networkResourceInstance, &KyNetworkResourceManager::connectionUpdate, this, &KyConnectResourse::connectionUpdate);
|
||||||
|
connect(m_networkResourceInstance, &KyNetworkResourceManager::connectivityChanged, this, &KyConnectResourse::connectivityChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
KyConnectResourse::~KyConnectResourse()
|
KyConnectResourse::~KyConnectResourse()
|
||||||
|
@ -278,6 +279,11 @@ void KyConnectResourse::getIpv6ConnectSetting(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void KyConnectResourse::getConnectivity(NetworkManager::Connectivity &connectivity)
|
||||||
|
{
|
||||||
|
m_networkResourceInstance->getConnectivity(connectivity);
|
||||||
|
}
|
||||||
|
|
||||||
void KyConnectResourse::getConnectionSetting(QString connectUuid, KyConnectSetting &connectSetting)
|
void KyConnectResourse::getConnectionSetting(QString connectUuid, KyConnectSetting &connectSetting)
|
||||||
{
|
{
|
||||||
qDebug() <<"[KyConnectResourse]" << connectUuid <<"get connect setting info, connect uuid";
|
qDebug() <<"[KyConnectResourse]" << connectUuid <<"get connect setting info, connect uuid";
|
||||||
|
|
|
@ -28,6 +28,7 @@ public:
|
||||||
void getApConnections(QList<KyApConnectItem *> &apConnectItemList);
|
void getApConnections(QList<KyApConnectItem *> &apConnectItemList);
|
||||||
void getConnectionSetting(QString connectUuid, KyConnectSetting &connectSetting);
|
void getConnectionSetting(QString connectUuid, KyConnectSetting &connectSetting);
|
||||||
bool getInterfaceByUuid(QString &deviceName, NetworkManager::ConnectionSettings::ConnectionType &type, const QString connUuid);
|
bool getInterfaceByUuid(QString &deviceName, NetworkManager::ConnectionSettings::ConnectionType &type, const QString connUuid);
|
||||||
|
void getConnectivity(NetworkManager::Connectivity &connectivity);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
KyConnectItem *getConnectionItem(NetworkManager::Connection::Ptr connectPtr);
|
KyConnectItem *getConnectionItem(NetworkManager::Connection::Ptr connectPtr);
|
||||||
|
@ -51,6 +52,7 @@ signals:
|
||||||
void connectionAdd(QString uuid);
|
void connectionAdd(QString uuid);
|
||||||
void connectionUpdate(QString uuid);
|
void connectionUpdate(QString uuid);
|
||||||
void connectionRemove(QString path);
|
void connectionRemove(QString path);
|
||||||
|
void connectivityChanged(NetworkManager::Connectivity connectivity);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
KyNetworkResourceManager *m_networkResourceInstance = nullptr;
|
KyNetworkResourceManager *m_networkResourceInstance = nullptr;
|
||||||
|
|
|
@ -51,6 +51,7 @@ KyNetworkResourceManager::KyNetworkResourceManager(QObject *parent) : QObject(pa
|
||||||
connect(NetworkManager::settingsNotifier(), &NetworkManager::SettingsNotifier::connectionAdded, this, &KyNetworkResourceManager::onConnectionAdded);
|
connect(NetworkManager::settingsNotifier(), &NetworkManager::SettingsNotifier::connectionAdded, this, &KyNetworkResourceManager::onConnectionAdded);
|
||||||
connect(NetworkManager::settingsNotifier(), &NetworkManager::SettingsNotifier::connectionRemoved, this, static_cast<void (KyNetworkResourceManager::*)(QString const &)>(&KyNetworkResourceManager::onConnectionRemoved));
|
connect(NetworkManager::settingsNotifier(), &NetworkManager::SettingsNotifier::connectionRemoved, this, static_cast<void (KyNetworkResourceManager::*)(QString const &)>(&KyNetworkResourceManager::onConnectionRemoved));
|
||||||
|
|
||||||
|
connect(NetworkManager::notifier(), &NetworkManager::Notifier::connectivityChanged, this, &KyNetworkResourceManager::connectivityChanged);
|
||||||
//todo wifi开关信号
|
//todo wifi开关信号
|
||||||
connect(NetworkManager::notifier(), &NetworkManager::Notifier::wirelessEnabledChanged, this, &KyNetworkResourceManager::wifinEnabledChanged);
|
connect(NetworkManager::notifier(), &NetworkManager::Notifier::wirelessEnabledChanged, this, &KyNetworkResourceManager::wifinEnabledChanged);
|
||||||
connect(NetworkManager::notifier(), &NetworkManager::Notifier::wirelessHardwareEnabledChanged, [=](){
|
connect(NetworkManager::notifier(), &NetworkManager::Notifier::wirelessHardwareEnabledChanged, [=](){
|
||||||
|
@ -483,6 +484,11 @@ bool KyNetworkResourceManager::isActivatingConnection(QString uuid)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void KyNetworkResourceManager::getConnectivity(NetworkManager::Connectivity &connectivity)
|
||||||
|
{
|
||||||
|
connectivity = NetworkManager::connectivity();
|
||||||
|
}
|
||||||
|
|
||||||
void KyNetworkResourceManager::requestScan(NetworkManager::WirelessDevice * dev)
|
void KyNetworkResourceManager::requestScan(NetworkManager::WirelessDevice * dev)
|
||||||
{
|
{
|
||||||
qDebug() <<"[KyNetworkResourceManager]"<< dev->interfaceName()<<"start scan wifi ap";
|
qDebug() <<"[KyNetworkResourceManager]"<< dev->interfaceName()<<"start scan wifi ap";
|
||||||
|
|
|
@ -101,6 +101,8 @@ public:
|
||||||
bool isActiveConnection(QString uuid);
|
bool isActiveConnection(QString uuid);
|
||||||
bool isActivatingConnection(QString uuid);
|
bool isActivatingConnection(QString uuid);
|
||||||
|
|
||||||
|
void getConnectivity(NetworkManager::Connectivity &connectivity);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void connectionAdd(QString uuid);
|
void connectionAdd(QString uuid);
|
||||||
void connectionUpdate(QString uuid);
|
void connectionUpdate(QString uuid);
|
||||||
|
@ -136,6 +138,8 @@ signals:
|
||||||
NetworkManager::VpnConnection::State state,
|
NetworkManager::VpnConnection::State state,
|
||||||
NetworkManager::VpnConnection::StateChangeReason reason);
|
NetworkManager::VpnConnection::StateChangeReason reason);
|
||||||
|
|
||||||
|
void connectivityChanged(NetworkManager::Connectivity connectivity);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
//connection
|
//connection
|
||||||
void onConnectionUpdated();
|
void onConnectionUpdated();
|
||||||
|
|
|
@ -247,8 +247,8 @@ QString KyWirelessConnectOperation::getPsk(const QString &connectUuid)
|
||||||
}
|
}
|
||||||
QDBusPendingReply<NMVariantMapMap> reply = connectPtr->secrets(PSK_SETTING_NAME);
|
QDBusPendingReply<NMVariantMapMap> reply = connectPtr->secrets(PSK_SETTING_NAME);
|
||||||
QMap<QString,QVariantMap> map(reply.value());
|
QMap<QString,QVariantMap> map(reply.value());
|
||||||
if (map.contains("802-11-wireless-security") && map.value("802-11-wireless-security").contains("psk"))
|
if (map.contains("802-11-wireless-security")
|
||||||
{
|
&& map.value("802-11-wireless-security").contains("psk")) {
|
||||||
QString psk = map.value("802-11-wireless-security").value("psk").toString();
|
QString psk = map.value("802-11-wireless-security").value("psk").toString();
|
||||||
return psk;
|
return psk;
|
||||||
}
|
}
|
||||||
|
@ -267,8 +267,8 @@ QString KyWirelessConnectOperation::getPrivateKeyPassword(const QString &connect
|
||||||
}
|
}
|
||||||
QDBusPendingReply<NMVariantMapMap> reply = connectPtr->secrets(PSK_SETTING_NAME);
|
QDBusPendingReply<NMVariantMapMap> reply = connectPtr->secrets(PSK_SETTING_NAME);
|
||||||
QMap<QString,QVariantMap> map(reply.value());
|
QMap<QString,QVariantMap> map(reply.value());
|
||||||
if (map.contains("802-1x") && map.value("802-1x").contains("private-key-password"))
|
if (map.contains("802-1x")
|
||||||
{
|
&& map.value("802-1x").contains("private-key-password")) {
|
||||||
QString psk = map.value("802-1x").value("private-key-password").toString();
|
QString psk = map.value("802-1x").value("private-key-password").toString();
|
||||||
return psk;
|
return psk;
|
||||||
}
|
}
|
||||||
|
@ -825,8 +825,7 @@ KyKeyMgmt KyWirelessConnectOperation::getConnectKeyMgmt(const QString &uuid)
|
||||||
NetworkManager::WirelessSecuritySetting::Ptr security_sett
|
NetworkManager::WirelessSecuritySetting::Ptr security_sett
|
||||||
= connectPtr->settings()->setting(NetworkManager::Setting::WirelessSecurity).dynamicCast<NetworkManager::WirelessSecuritySetting>();
|
= connectPtr->settings()->setting(NetworkManager::Setting::WirelessSecurity).dynamicCast<NetworkManager::WirelessSecuritySetting>();
|
||||||
|
|
||||||
if(security_sett.isNull())
|
if(security_sett.isNull()) {
|
||||||
{
|
|
||||||
return KyKeyMgmt::Unknown;
|
return KyKeyMgmt::Unknown;
|
||||||
}
|
}
|
||||||
return (KyKeyMgmt)security_sett->keyMgmt();
|
return (KyKeyMgmt)security_sett->keyMgmt();
|
||||||
|
@ -848,7 +847,6 @@ void KyWirelessConnectOperation::updateWirelessSecu(NetworkManager::ConnectionSe
|
||||||
}
|
}
|
||||||
security_sett->setKeyMgmt((NetworkManager::WirelessSecuritySetting::KeyMgmt)type);
|
security_sett->setKeyMgmt((NetworkManager::WirelessSecuritySetting::KeyMgmt)type);
|
||||||
if (bPwdChange) {
|
if (bPwdChange) {
|
||||||
qDebug() << "set psk " << connSettingInfo.m_psk;
|
|
||||||
security_sett->setPsk(connSettingInfo.m_psk);
|
security_sett->setPsk(connSettingInfo.m_psk);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -927,13 +925,13 @@ bool KyWirelessConnectOperation::getEnterpiseEapMethod(const QString &uuid, KyEa
|
||||||
NetworkManager::Connection::Ptr connectPtr =
|
NetworkManager::Connection::Ptr connectPtr =
|
||||||
NetworkManager::findConnectionByUuid(uuid);
|
NetworkManager::findConnectionByUuid(uuid);
|
||||||
if (connectPtr.isNull()) {
|
if (connectPtr.isNull()) {
|
||||||
qDebug() << "getEnterpiseEapMethod faild.Can't find uuid = " << uuid;
|
qWarning() << "getEnterpiseEapMethod faild.Can't find uuid = " << uuid;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
KyKeyMgmt keyMgmt = getConnectKeyMgmt(uuid);
|
KyKeyMgmt keyMgmt = getConnectKeyMgmt(uuid);
|
||||||
if (keyMgmt != WpaEap) {
|
if (keyMgmt != WpaEap) {
|
||||||
qDebug() << "getEnterpiseEapMethod but not WpaEap.it's " << keyMgmt;
|
qWarning() << "getEnterpiseEapMethod but not WpaEap.it's " << keyMgmt;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -79,9 +79,15 @@ public Q_SLOTS: // METHODS
|
||||||
//获取热点
|
//获取热点
|
||||||
QStringList getStoredApInfo();
|
QStringList getStoredApInfo();
|
||||||
Q_SIGNALS: // SIGNALS
|
Q_SIGNALS: // SIGNALS
|
||||||
void wirelessActivating(QString devName, QString ssid);
|
// void wirelessActivating(QString devName, QString ssid);
|
||||||
void wiredActivating(QString devName, QString ssid);
|
// void wiredActivating(QString devName, QString ssid);
|
||||||
void listUpdate(QString devName);
|
void lanAdd(QString devName, QStringList info);
|
||||||
|
void lanRemove(QString dbusPath);
|
||||||
|
void lanUpdate(QString devName, QStringList info);
|
||||||
|
void wlanAdd(QString devName, QStringList info);
|
||||||
|
void wlanRemove(QString devName,QString ssid);
|
||||||
|
void wlanactiveConnectionStateChanged(QString devName, QString ssid, int status);
|
||||||
|
void lanActiveConnectionStateChanged(QString devName, QString uuid, int status);
|
||||||
//仅失败,若成功直接发listUpdate
|
//仅失败,若成功直接发listUpdate
|
||||||
void activateFailed(QString errorMessage);
|
void activateFailed(QString errorMessage);
|
||||||
void deactivateFailed(QString errorMessage);
|
void deactivateFailed(QString errorMessage);
|
||||||
|
|
|
@ -165,7 +165,9 @@ void CreatNetPage::constructIpv4Info(KyConnectSetting &setting)
|
||||||
QString ipv4address =ipv4addressEdit->text();
|
QString ipv4address =ipv4addressEdit->text();
|
||||||
QString netMask = netMaskEdit->text();
|
QString netMask = netMaskEdit->text();
|
||||||
QString gateWay = gateWayEdit->text();
|
QString gateWay = gateWayEdit->text();
|
||||||
qDebug() << ipv4address << netMask << gateWay;
|
qDebug() << "constructIpv4Info: " << "ipv4address " << ipv4address
|
||||||
|
<< " netMask " << netMask
|
||||||
|
<< " gateWay " << gateWay;
|
||||||
|
|
||||||
QStringList dnsList;
|
QStringList dnsList;
|
||||||
dnsList.empty();
|
dnsList.empty();
|
||||||
|
|
|
@ -524,11 +524,9 @@ void NetDetail::on_btnForget_clicked()
|
||||||
|
|
||||||
void NetDetail::setConfirmEnable()
|
void NetDetail::setConfirmEnable()
|
||||||
{
|
{
|
||||||
qDebug() << isCreateNet << isWlan;
|
|
||||||
if (isCreateNet && !isWlan) {
|
if (isCreateNet && !isWlan) {
|
||||||
isConfirmBtnEnable = isCreateOk;
|
isConfirmBtnEnable = isCreateOk;
|
||||||
} else {
|
} else {
|
||||||
qDebug() << isDetailOk << isIpv4Ok << isIpv6Ok << isSecuOk;
|
|
||||||
if (isDetailOk && isIpv4Ok && isIpv6Ok) {
|
if (isDetailOk && isIpv4Ok && isIpv6Ok) {
|
||||||
if (isWlan && !isSecuOk) {
|
if (isWlan && !isSecuOk) {
|
||||||
isConfirmBtnEnable = false;
|
isConfirmBtnEnable = false;
|
||||||
|
@ -551,7 +549,7 @@ bool NetDetail::checkIpv4Conflict(QString ipv4Address)
|
||||||
if (ipv4Arping->ipv4ConflictCheck() >= 0) {
|
if (ipv4Arping->ipv4ConflictCheck() >= 0) {
|
||||||
isConflict = ipv4Arping->ipv4IsConflict();
|
isConflict = ipv4Arping->ipv4IsConflict();
|
||||||
} else {
|
} else {
|
||||||
qDebug() << "checkIpv4Conflict internal error";
|
qWarning() << "checkIpv4Conflict internal error";
|
||||||
}
|
}
|
||||||
|
|
||||||
delete ipv4Arping;
|
delete ipv4Arping;
|
||||||
|
@ -567,7 +565,7 @@ bool NetDetail::checkIpv6Conflict(QString ipv6address)
|
||||||
if (ipv46rping->ipv6ConflictCheck() >= 0) {
|
if (ipv46rping->ipv6ConflictCheck() >= 0) {
|
||||||
isConflict = ipv46rping->ipv6IsConflict();
|
isConflict = ipv46rping->ipv6IsConflict();
|
||||||
} else {
|
} else {
|
||||||
qDebug() << "checkIpv6Conflict internal error";
|
qWarning() << "checkIpv6Conflict internal error";
|
||||||
}
|
}
|
||||||
|
|
||||||
delete ipv46rping;
|
delete ipv46rping;
|
||||||
|
@ -580,7 +578,6 @@ void NetDetail::updateWirelessPersonalConnect()
|
||||||
KyWirelessConnectSetting setting;
|
KyWirelessConnectSetting setting;
|
||||||
securityPage->updateSecurityChange(setting);
|
securityPage->updateSecurityChange(setting);
|
||||||
bool isPwdChanged = !(m_info.strPassword == setting.m_psk);
|
bool isPwdChanged = !(m_info.strPassword == setting.m_psk);
|
||||||
qDebug() << setting.m_psk << isPwdChanged;
|
|
||||||
m_wirelessConnOpration->updateWirelessPersonalConnect(m_uuid, setting, isPwdChanged);
|
m_wirelessConnOpration->updateWirelessPersonalConnect(m_uuid, setting, isPwdChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -165,112 +165,20 @@ void SecurityPage::initConnect()
|
||||||
//EAP方式变化
|
//EAP方式变化
|
||||||
connect(eapTypeCombox, &QComboBox::currentTextChanged, this, &SecurityPage::onEapTypeComboxIndexChanged);
|
connect(eapTypeCombox, &QComboBox::currentTextChanged, this, &SecurityPage::onEapTypeComboxIndexChanged);
|
||||||
|
|
||||||
connect(caNeedBox, &QCheckBox::clicked, this, [&](){
|
connect(caNeedBox, &QCheckBox::clicked, this, &SecurityPage::onCaNeedBoxClicked);
|
||||||
if (caNeedBox->isChecked()) {
|
|
||||||
caCertPathCombox->setEnabled(false);
|
|
||||||
} else {
|
|
||||||
caCertPathCombox->setEnabled(true);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
connect(pwdBox, &QCheckBox::clicked, this, [&]() {
|
connect(pwdBox, &QCheckBox::clicked, this, &SecurityPage::onPwdBoxClicked);
|
||||||
if (pwdEdit->echoMode() == QLineEdit::Password) {
|
connect(userPwdBox, &QCheckBox::clicked, this, &SecurityPage::onUserPwdBox);
|
||||||
pwdBox->setChecked(true);
|
connect(privateKeyBox, &QCheckBox::clicked, this, &SecurityPage::onPrivateKeyBoxClicked);
|
||||||
pwdEdit->setEchoMode(QLineEdit::Normal);
|
|
||||||
} else {
|
|
||||||
pwdBox->setChecked(false);
|
|
||||||
pwdEdit->setEchoMode(QLineEdit::Password);
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
connect(caCertPathCombox, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
|
||||||
|
this, &SecurityPage::onCaCertPathComboxIndexChanged);
|
||||||
|
|
||||||
connect(userPwdBox, &QCheckBox::clicked, this, [&]() {
|
connect(clientCertPathCombox, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
|
||||||
if (userPwdEdit->echoMode() == QLineEdit::Password) {
|
this, &SecurityPage::onClientCertPathComboxIndexChanged);
|
||||||
userPwdBox->setChecked(true);
|
|
||||||
userPwdEdit->setEchoMode(QLineEdit::Normal);
|
|
||||||
} else {
|
|
||||||
userPwdBox->setChecked(false);
|
|
||||||
userPwdEdit->setEchoMode(QLineEdit::Password);
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
connect(clientPrivateKeyCombox, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
|
||||||
|
this, &SecurityPage::onClientPrivateKeyComboxIndexChanged);
|
||||||
connect(privateKeyBox, &QCheckBox::clicked, this, [&]() {
|
|
||||||
if (clientPrivateKeyPwdEdit->echoMode() == QLineEdit::Password) {
|
|
||||||
privateKeyBox->setChecked(true);
|
|
||||||
clientPrivateKeyPwdEdit->setEchoMode(QLineEdit::Normal);
|
|
||||||
} else {
|
|
||||||
privateKeyBox->setChecked(false);
|
|
||||||
clientPrivateKeyPwdEdit->setEchoMode(QLineEdit::Password);
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
connect(caCertPathCombox, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged), this, [=] (const QString &str) {
|
|
||||||
if (str.contains("Choose from file...") || str.contains("从文件选择..."))
|
|
||||||
{
|
|
||||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Choose a CA certificate"), "recent:///",
|
|
||||||
tr("CA Files (*.pem *.der *.p12 *.crt *.cer *.pfx)"));
|
|
||||||
if (!fileName.isNull()) {
|
|
||||||
QStringList nameList = fileName.split("/");
|
|
||||||
caCertPathCombox->blockSignals(true);
|
|
||||||
caCertPathCombox->setItemText(0, fileName);
|
|
||||||
caCertPathCombox->setCurrentIndex(0);
|
|
||||||
caCertPathCombox->blockSignals(false);
|
|
||||||
} else {
|
|
||||||
caCertPathCombox->blockSignals(true);
|
|
||||||
caCertPathCombox->setItemText(0, tr("None"));
|
|
||||||
caCertPathCombox->setCurrentIndex(0);
|
|
||||||
caCertPathCombox->blockSignals(false);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
qWarning() << "Choose file is null or unvalible";
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
connect(clientCertPathCombox, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged), this, [=] (const QString &str) {
|
|
||||||
if (str.contains("Choose from file...") || str.contains("从文件选择..."))
|
|
||||||
{
|
|
||||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Choose a CA certificate"), "recent:///",
|
|
||||||
tr("CA Files (*.pem *.der *.p12 *.crt *.cer *.pfx)"));
|
|
||||||
if (!fileName.isNull()) {
|
|
||||||
// QStringList nameList = fileName.split("/");
|
|
||||||
clientCertPathCombox->blockSignals(true);
|
|
||||||
clientCertPathCombox->setItemText(0, fileName);
|
|
||||||
clientCertPathCombox->setCurrentIndex(0);
|
|
||||||
clientCertPathCombox->blockSignals(false);
|
|
||||||
} else {
|
|
||||||
clientCertPathCombox->blockSignals(true);
|
|
||||||
clientCertPathCombox->setItemText(0, tr("None"));
|
|
||||||
clientCertPathCombox->setCurrentIndex(0);
|
|
||||||
clientCertPathCombox->blockSignals(false);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
qWarning() << "Choose file is null or unvalible";
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
connect(clientPrivateKeyCombox, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged), this, [=] (const QString &str) {
|
|
||||||
if (str.contains("Choose from file...") || str.contains("从文件选择..."))
|
|
||||||
{
|
|
||||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Choose a CA certificate"), "recent:///",
|
|
||||||
tr("CA Files (*.pem *.der *.p12 *.crt *.cer *.pfx)"));
|
|
||||||
if (!fileName.isNull()) {
|
|
||||||
QStringList nameList = fileName.split("/");
|
|
||||||
clientPrivateKeyCombox->blockSignals(true);
|
|
||||||
clientPrivateKeyCombox->setItemText(0, fileName);
|
|
||||||
clientPrivateKeyCombox->setCurrentIndex(0);
|
|
||||||
clientPrivateKeyCombox->blockSignals(false);
|
|
||||||
} else {
|
|
||||||
clientPrivateKeyCombox->blockSignals(true);
|
|
||||||
clientPrivateKeyCombox->setItemText(0, tr("None"));
|
|
||||||
clientPrivateKeyCombox->setCurrentIndex(0);
|
|
||||||
clientPrivateKeyCombox->blockSignals(false);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
qWarning() << "Choose file is null or unvalible";
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
connect(secuTypeCombox, SIGNAL(currentIndexChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
|
connect(secuTypeCombox, SIGNAL(currentIndexChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
|
||||||
connect(pwdEdit, &QLineEdit::textChanged, this, &SecurityPage::setEnableOfSaveBtn);
|
connect(pwdEdit, &QLineEdit::textChanged, this, &SecurityPage::setEnableOfSaveBtn);
|
||||||
|
@ -740,3 +648,114 @@ void SecurityPage::onEapTypeComboxIndexChanged()
|
||||||
eapMethodCombox->addItem("gtc(eap)", GTC_EAP);
|
eapMethodCombox->addItem("gtc(eap)", GTC_EAP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SecurityPage::onCaNeedBoxClicked()
|
||||||
|
{
|
||||||
|
if (caNeedBox->isChecked()) {
|
||||||
|
caCertPathCombox->setEnabled(false);
|
||||||
|
} else {
|
||||||
|
caCertPathCombox->setEnabled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SecurityPage::onPwdBoxClicked()
|
||||||
|
{
|
||||||
|
if (pwdEdit->echoMode() == QLineEdit::Password) {
|
||||||
|
pwdBox->setChecked(true);
|
||||||
|
pwdEdit->setEchoMode(QLineEdit::Normal);
|
||||||
|
} else {
|
||||||
|
pwdBox->setChecked(false);
|
||||||
|
pwdEdit->setEchoMode(QLineEdit::Password);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SecurityPage::onUserPwdBox()
|
||||||
|
{
|
||||||
|
if (userPwdEdit->echoMode() == QLineEdit::Password) {
|
||||||
|
userPwdBox->setChecked(true);
|
||||||
|
userPwdEdit->setEchoMode(QLineEdit::Normal);
|
||||||
|
} else {
|
||||||
|
userPwdBox->setChecked(false);
|
||||||
|
userPwdEdit->setEchoMode(QLineEdit::Password);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void SecurityPage::onPrivateKeyBoxClicked()
|
||||||
|
{
|
||||||
|
if (clientPrivateKeyPwdEdit->echoMode() == QLineEdit::Password) {
|
||||||
|
privateKeyBox->setChecked(true);
|
||||||
|
clientPrivateKeyPwdEdit->setEchoMode(QLineEdit::Normal);
|
||||||
|
} else {
|
||||||
|
privateKeyBox->setChecked(false);
|
||||||
|
clientPrivateKeyPwdEdit->setEchoMode(QLineEdit::Password);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SecurityPage::onCaCertPathComboxIndexChanged(QString str)
|
||||||
|
{
|
||||||
|
if (str.contains("Choose from file...") || str.contains("从文件选择..."))
|
||||||
|
{
|
||||||
|
QString fileName = QFileDialog::getOpenFileName(this, tr("Choose a CA certificate"), "recent:///",
|
||||||
|
tr("CA Files (*.pem *.der *.p12 *.crt *.cer *.pfx)"));
|
||||||
|
if (!fileName.isNull()) {
|
||||||
|
QStringList nameList = fileName.split("/");
|
||||||
|
caCertPathCombox->blockSignals(true);
|
||||||
|
caCertPathCombox->setItemText(0, fileName);
|
||||||
|
caCertPathCombox->setCurrentIndex(0);
|
||||||
|
caCertPathCombox->blockSignals(false);
|
||||||
|
} else {
|
||||||
|
caCertPathCombox->blockSignals(true);
|
||||||
|
caCertPathCombox->setItemText(0, tr("None"));
|
||||||
|
caCertPathCombox->setCurrentIndex(0);
|
||||||
|
caCertPathCombox->blockSignals(false);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
qWarning() << "Choose file is null or unvalible";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SecurityPage::onClientCertPathComboxIndexChanged(QString str)
|
||||||
|
{
|
||||||
|
if (str.contains("Choose from file...") || str.contains("从文件选择..."))
|
||||||
|
{
|
||||||
|
QString fileName = QFileDialog::getOpenFileName(this, tr("Choose a CA certificate"), "recent:///",
|
||||||
|
tr("CA Files (*.pem *.der *.p12 *.crt *.cer *.pfx)"));
|
||||||
|
if (!fileName.isNull()) {
|
||||||
|
clientCertPathCombox->blockSignals(true);
|
||||||
|
clientCertPathCombox->setItemText(0, fileName);
|
||||||
|
clientCertPathCombox->setCurrentIndex(0);
|
||||||
|
clientCertPathCombox->blockSignals(false);
|
||||||
|
} else {
|
||||||
|
clientCertPathCombox->blockSignals(true);
|
||||||
|
clientCertPathCombox->setItemText(0, tr("None"));
|
||||||
|
clientCertPathCombox->setCurrentIndex(0);
|
||||||
|
clientCertPathCombox->blockSignals(false);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
qWarning() << "Choose file is null or unvalible";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SecurityPage::onClientPrivateKeyComboxIndexChanged(QString str)
|
||||||
|
{
|
||||||
|
if (str.contains("Choose from file...") || str.contains("从文件选择..."))
|
||||||
|
{
|
||||||
|
QString fileName = QFileDialog::getOpenFileName(this, tr("Choose a CA certificate"), "recent:///",
|
||||||
|
tr("CA Files (*.pem *.der *.p12 *.crt *.cer *.pfx)"));
|
||||||
|
if (!fileName.isNull()) {
|
||||||
|
QStringList nameList = fileName.split("/");
|
||||||
|
clientPrivateKeyCombox->blockSignals(true);
|
||||||
|
clientPrivateKeyCombox->setItemText(0, fileName);
|
||||||
|
clientPrivateKeyCombox->setCurrentIndex(0);
|
||||||
|
clientPrivateKeyCombox->blockSignals(false);
|
||||||
|
} else {
|
||||||
|
clientPrivateKeyCombox->blockSignals(true);
|
||||||
|
clientPrivateKeyCombox->setItemText(0, tr("None"));
|
||||||
|
clientPrivateKeyCombox->setCurrentIndex(0);
|
||||||
|
clientPrivateKeyCombox->blockSignals(false);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
qWarning() << "Choose file is null or unvalible";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -96,6 +96,15 @@ private slots:
|
||||||
void onEapTypeComboxIndexChanged();
|
void onEapTypeComboxIndexChanged();
|
||||||
void setEnableOfSaveBtn();
|
void setEnableOfSaveBtn();
|
||||||
|
|
||||||
|
void onCaNeedBoxClicked();
|
||||||
|
void onPwdBoxClicked();
|
||||||
|
void onUserPwdBox();
|
||||||
|
void onPrivateKeyBoxClicked();
|
||||||
|
|
||||||
|
void onCaCertPathComboxIndexChanged(QString str);
|
||||||
|
void onClientCertPathComboxIndexChanged(QString str);
|
||||||
|
void onClientPrivateKeyComboxIndexChanged(QString str);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void setSecuPageState(bool);
|
void setSecuPageState(bool);
|
||||||
};
|
};
|
||||||
|
|
|
@ -153,12 +153,15 @@ void MainWindow::initDbusConnnect()
|
||||||
connect(m_wlanWidget, &WlanPage::activateFailed, this, &MainWindow::activateFailed);
|
connect(m_wlanWidget, &WlanPage::activateFailed, this, &MainWindow::activateFailed);
|
||||||
connect(m_wlanWidget, &WlanPage::deactivateFailed, this, &MainWindow::deactivateFailed);
|
connect(m_wlanWidget, &WlanPage::deactivateFailed, this, &MainWindow::deactivateFailed);
|
||||||
|
|
||||||
connect(m_lanWidget, &LanPage::listUpdate, this, &MainWindow::listUpdate);
|
connect(m_lanWidget, &LanPage::lanAdd, this, &MainWindow::lanAdd);
|
||||||
connect(m_wlanWidget, &WlanPage::listUpdate, this, &MainWindow::listUpdate);
|
connect(m_lanWidget, &LanPage::lanRemove, this, &MainWindow::lanRemove);
|
||||||
|
connect(m_lanWidget, &LanPage::lanUpdate, this, &MainWindow::lanUpdate);
|
||||||
|
connect(m_lanWidget, &LanPage::lanActiveConnectionStateChanged, this, &MainWindow::lanActiveConnectionStateChanged);
|
||||||
|
|
||||||
connect(m_lanWidget, &LanPage::wiredActivating, this, &MainWindow::wiredActivating);
|
|
||||||
connect(m_wlanWidget, &WlanPage::wirelessActivating, this, &MainWindow::wirelessActivating);
|
|
||||||
|
|
||||||
|
connect(m_wlanWidget, &WlanPage::wlanAdd, this, &MainWindow::wlanAdd);
|
||||||
|
connect(m_wlanWidget, &WlanPage::wlanRemove, this, &MainWindow::wlanRemove);
|
||||||
|
connect(m_wlanWidget, &WlanPage::wlanActiveConnectionStateChanged, this, &MainWindow::wlanactiveConnectionStateChanged);
|
||||||
connect(m_wlanWidget, &WlanPage::hotspotDeactivated, this, &MainWindow::hotspotDeactivated);
|
connect(m_wlanWidget, &WlanPage::hotspotDeactivated, this, &MainWindow::hotspotDeactivated);
|
||||||
connect(m_wlanWidget, &WlanPage::hotspotActivated, this, &MainWindow::hotspotActivated);
|
connect(m_wlanWidget, &WlanPage::hotspotActivated, this, &MainWindow::hotspotActivated);
|
||||||
connect(m_wlanWidget, &WlanPage::secuTypeChange, this, &MainWindow::secuTypeChange);
|
connect(m_wlanWidget, &WlanPage::secuTypeChange, this, &MainWindow::secuTypeChange);
|
||||||
|
@ -431,7 +434,9 @@ void MainWindow::showPropertyWidget(QString devName, QString ssid)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug() << "showPropertyWidget no such device " << devName;
|
qWarning() << "showPropertyWidget no such device " << devName;
|
||||||
|
delete devResourse;
|
||||||
|
devResourse = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::showCreateWiredConnectWidget(const QString devName)
|
void MainWindow::showCreateWiredConnectWidget(const QString devName)
|
||||||
|
|
|
@ -52,11 +52,14 @@ signals:
|
||||||
void deviceStatusChanged();
|
void deviceStatusChanged();
|
||||||
//设备名称变化
|
//设备名称变化
|
||||||
void deviceNameChanged(QString oldName, QString newName);
|
void deviceNameChanged(QString oldName, QString newName);
|
||||||
//设备有线无线列表更新(有线增删、无线增加减少)
|
//有线无线列表更新(有线增删、无线增加减少)
|
||||||
void listUpdate(QString devName);
|
void lanAdd(QString devName, QStringList info);
|
||||||
//控制面板连接中
|
void lanRemove(QString dbusPath);
|
||||||
void wiredActivating(QString devName, QString ssid);
|
void lanUpdate(QString devName, QStringList info);
|
||||||
void wirelessActivating(QString devName, QString ssid);
|
void wlanAdd(QString devName, QStringList info);
|
||||||
|
void wlanRemove(QString devName,QString ssid);
|
||||||
|
void wlanactiveConnectionStateChanged(QString devName, QString ssid, int status);
|
||||||
|
void lanActiveConnectionStateChanged(QString devName, QString uuid, int status);
|
||||||
void activateFailed(QString errorMessage);
|
void activateFailed(QString errorMessage);
|
||||||
void deactivateFailed(QString errorMessage);
|
void deactivateFailed(QString errorMessage);
|
||||||
//热点断开
|
//热点断开
|
||||||
|
|
|
@ -38,6 +38,7 @@ LanPage::LanPage(QWidget *parent) : TabPage(parent)
|
||||||
connect(m_activeResourse, &KyActiveConnectResourse::stateChangeReason, this, &LanPage::updateLanlist);
|
connect(m_activeResourse, &KyActiveConnectResourse::stateChangeReason, this, &LanPage::updateLanlist);
|
||||||
connect(m_connectResourse, &KyConnectResourse::connectionAdd, this, &LanPage::addConnectionSlot);
|
connect(m_connectResourse, &KyConnectResourse::connectionAdd, this, &LanPage::addConnectionSlot);
|
||||||
connect(m_connectResourse, &KyConnectResourse::connectionRemove, this, &LanPage::removeConnectionSlot);
|
connect(m_connectResourse, &KyConnectResourse::connectionRemove, this, &LanPage::removeConnectionSlot);
|
||||||
|
connect(m_connectResourse, &KyConnectResourse::connectionUpdate, this, &LanPage::connectionUpdateSlot);
|
||||||
connect(m_device, &KyNetworkDeviceResourse::deviceAdd, this, &LanPage::onDeviceAdd);
|
connect(m_device, &KyNetworkDeviceResourse::deviceAdd, this, &LanPage::onDeviceAdd);
|
||||||
connect(m_device, &KyNetworkDeviceResourse::deviceRemove, this, &LanPage::onDeviceRemove);
|
connect(m_device, &KyNetworkDeviceResourse::deviceRemove, this, &LanPage::onDeviceRemove);
|
||||||
connect(m_device, &KyNetworkDeviceResourse::deviceNameUpdate, this, &LanPage::onDeviceNameUpdate);
|
connect(m_device, &KyNetworkDeviceResourse::deviceNameUpdate, this, &LanPage::onDeviceNameUpdate);
|
||||||
|
@ -121,6 +122,10 @@ void LanPage::onLanSwitchClicked()
|
||||||
|
|
||||||
void LanPage::removeConnectionSlot(QString path) //删除时后端会自动断开激活,将其从未激活列表中删除
|
void LanPage::removeConnectionSlot(QString path) //删除时后端会自动断开激活,将其从未激活列表中删除
|
||||||
{
|
{
|
||||||
|
//for dbus
|
||||||
|
qDebug() << "[LanPage] emit lanRemove because removeConnectionSlot " << path;
|
||||||
|
emit lanRemove(path);
|
||||||
|
|
||||||
qDebug()<<"[LanPage] Removing a connection, path:"<<path;
|
qDebug()<<"[LanPage] Removing a connection, path:"<<path;
|
||||||
bool isLan = false;
|
bool isLan = false;
|
||||||
QEventLoop loop;
|
QEventLoop loop;
|
||||||
|
@ -135,22 +140,10 @@ void LanPage::removeConnectionSlot(QString path) //删除时后端会
|
||||||
delete(iters.value());
|
delete(iters.value());
|
||||||
m_deactiveMap.erase(iters);
|
m_deactiveMap.erase(iters);
|
||||||
isLan = true;
|
isLan = true;
|
||||||
//for dbus
|
|
||||||
qDebug() << "[LanPage] because removeConnectionSlot " << item->m_ifaceName;
|
|
||||||
emit listUpdate(item->m_ifaceName);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!isLan) {
|
|
||||||
//removeConnection不是当前设备的,可能是其他有线设备或无线设备,保险起见发送信号更新
|
|
||||||
for (int index = 0; index < devList.size(); ++index) {
|
|
||||||
if (devList.at(index) == m_deviceName) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
emit listUpdate(devList.at(index));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LanPage::addConnectionSlot(QString uuid) //新增一个有线连接,将其加入到激活列表
|
void LanPage::addConnectionSlot(QString uuid) //新增一个有线连接,将其加入到激活列表
|
||||||
|
@ -167,8 +160,14 @@ void LanPage::addConnectionSlot(QString uuid) //新增一个有线
|
||||||
}
|
}
|
||||||
|
|
||||||
//for dbus
|
//for dbus
|
||||||
qDebug() << "[LanPage] emit listUpdate because addConnection " << devName;
|
KyConnectItem *item = nullptr;
|
||||||
emit listUpdate(devName);
|
item = m_connectResourse->getConnectionItemByUuid(uuid, devName);
|
||||||
|
if (nullptr != item) {
|
||||||
|
QStringList info;
|
||||||
|
info << item->m_connectName << uuid << item->m_connectPath;
|
||||||
|
qDebug() << "[LanPage] emit lanAdd because addConnection " << devName;
|
||||||
|
emit lanAdd(devName, info);
|
||||||
|
}
|
||||||
|
|
||||||
KyConnectItem * newItem = m_connectResourse->getConnectionItemByUuid(uuid, m_deviceName);
|
KyConnectItem * newItem = m_connectResourse->getConnectionItemByUuid(uuid, m_deviceName);
|
||||||
if (newItem != nullptr) {
|
if (newItem != nullptr) {
|
||||||
|
@ -182,6 +181,41 @@ void LanPage::addConnectionSlot(QString uuid) //新增一个有线
|
||||||
qDebug()<<"[LanPage] GetConnectionItemByUuid is empty when add a new!";
|
qDebug()<<"[LanPage] GetConnectionItemByUuid is empty when add a new!";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
void LanPage::connectionUpdateSlot(QString uuid)
|
||||||
|
{
|
||||||
|
//for dbus
|
||||||
|
QStringList devNameList;
|
||||||
|
if (m_activeResourse->isActiveConnection(uuid, devNameList)) {
|
||||||
|
for (int i = 0; i < devNameList.size(); ++i) {
|
||||||
|
KyConnectItem *item = nullptr;
|
||||||
|
item = m_activeResourse->getActiveConnectionByUuid(uuid, devNameList.at(i));
|
||||||
|
if (nullptr != item) {
|
||||||
|
if (item->m_itemType != NetworkManager::ConnectionSettings::ConnectionType::Wired) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
QStringList info;
|
||||||
|
info << item->m_connectName << uuid << item->m_connectPath;
|
||||||
|
emit lanUpdate(devNameList.at(i), info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
QString devName;
|
||||||
|
NetworkManager::ConnectionSettings::ConnectionType type;
|
||||||
|
if (!m_connectResourse->getInterfaceByUuid(devName, type, uuid)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (type != NetworkManager::ConnectionSettings::ConnectionType::Wired) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
KyConnectItem *item = nullptr;
|
||||||
|
item = m_connectResourse->getConnectionItemByUuid(uuid, devName);
|
||||||
|
if (nullptr != item) {
|
||||||
|
QStringList info;
|
||||||
|
info << item->m_connectName << uuid << item->m_connectPath;
|
||||||
|
emit lanUpdate(devName, info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void LanPage::initDevice()
|
void LanPage::initDevice()
|
||||||
{
|
{
|
||||||
|
@ -413,16 +447,23 @@ void LanPage::updateLanlist(QString uuid, NetworkManager::ActiveConnection::Stat
|
||||||
qDebug() << "[LanPage] updateLanlist but uuid is invalid";
|
qDebug() << "[LanPage] updateLanlist but uuid is invalid";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state == NetworkManager::ActiveConnection::State::Activating) {
|
QStringList devNameList;
|
||||||
qDebug() << "[LanPage] wiredActivating " << devName;
|
if (m_activeResourse->isActiveConnection(uuid, devNameList)) {
|
||||||
emit wiredActivating(devName,uuid);
|
for (int i = 0; i < devNameList.size(); ++i) {
|
||||||
|
KyConnectItem *item = nullptr;
|
||||||
|
item = m_activeResourse->getActiveConnectionByUuid(uuid, devNameList.at(i));
|
||||||
|
if (nullptr != item) {
|
||||||
|
QStringList info;
|
||||||
|
info << item->m_connectName << uuid << item->m_connectPath;
|
||||||
|
emit lanActiveConnectionStateChanged(devNameList.at(i), uuid, state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
qDebug() << "emit lanActiveConnectionStateChanged" << devName << uuid << state;
|
||||||
|
emit lanActiveConnectionStateChanged(devName, uuid, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state == NetworkManager::ActiveConnection::State::Activated || state == NetworkManager::ActiveConnection::State::Deactivated)
|
|
||||||
{
|
|
||||||
qDebug() << "[LanPage] because updateLanlist " <<devName;
|
|
||||||
emit listUpdate(devName);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (state == NetworkManager::ActiveConnection::State::Deactivated) {
|
if (state == NetworkManager::ActiveConnection::State::Deactivated) {
|
||||||
qDebug()<<"Get a deactivate, begin to remove it from activeList";
|
qDebug()<<"Get a deactivate, begin to remove it from activeList";
|
||||||
|
@ -509,7 +550,7 @@ void LanPage::getWiredList(QMap<QString, QVector<QStringList> > &map)
|
||||||
QVector<QStringList> vector;
|
QVector<QStringList> vector;
|
||||||
m_activeResourse->getActiveConnectionList(deviceName,NetworkManager::ConnectionSettings::Wired,activedList);
|
m_activeResourse->getActiveConnectionList(deviceName,NetworkManager::ConnectionSettings::Wired,activedList);
|
||||||
if (!activedList.isEmpty()) {
|
if (!activedList.isEmpty()) {
|
||||||
vector.append(QStringList()<<activedList.at(0)->m_connectName<<activedList.at(0)->m_connectUuid);
|
vector.append(QStringList() << activedList.at(0)->m_connectName << activedList.at(0)->m_connectUuid << activedList.at(0)->m_connectPath);
|
||||||
} else {
|
} else {
|
||||||
vector.append(QStringList()<<("--"));
|
vector.append(QStringList()<<("--"));
|
||||||
}
|
}
|
||||||
|
@ -560,14 +601,13 @@ void LanPage::showDetailPage(QString devName, QString uuid)
|
||||||
item = m_activeResourse->getActiveConnectionByUuid(uuid, devName);
|
item = m_activeResourse->getActiveConnectionByUuid(uuid, devName);
|
||||||
if (nullptr == item) {
|
if (nullptr == item) {
|
||||||
item = m_connectResourse->getConnectionItemByUuid(uuid, devName);
|
item = m_connectResourse->getConnectionItemByUuid(uuid, devName);
|
||||||
|
if (nullptr == item) {
|
||||||
|
qWarning()<<"[LanPage] GetConnectionItemByUuid is empty when showDetailPage";
|
||||||
|
return;
|
||||||
|
}
|
||||||
isActive= false;
|
isActive= false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nullptr == item) {
|
|
||||||
qDebug()<<"[LanPage] GetConnectionItemByUuid is empty when showDetailPage";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
NetDetail *netDetail = new NetDetail(devName, item->m_connectName, uuid, isActive, false, false, this);
|
NetDetail *netDetail = new NetDetail(devName, item->m_connectName, uuid, isActive, false, false, this);
|
||||||
netDetail->show();
|
netDetail->show();
|
||||||
delete item;
|
delete item;
|
||||||
|
|
|
@ -29,8 +29,10 @@ public:
|
||||||
void showDetailPage(QString devName, QString uuid);
|
void showDetailPage(QString devName, QString uuid);
|
||||||
void setWiredDeviceEnable(const QString& devName, bool enable);
|
void setWiredDeviceEnable(const QString& devName, bool enable);
|
||||||
signals:
|
signals:
|
||||||
void wiredActivating(QString devName, QString ssid);
|
void lanAdd(QString devName, QStringList info);
|
||||||
|
void lanRemove(QString dbusPath);
|
||||||
|
void lanUpdate(QString devName, QStringList info);
|
||||||
|
void lanActiveConnectionStateChanged(QString interface, QString uuid, int status);
|
||||||
private:
|
private:
|
||||||
void initDevice();//初始化默认设备
|
void initDevice();//初始化默认设备
|
||||||
void initDeviceCombox();
|
void initDeviceCombox();
|
||||||
|
@ -72,6 +74,7 @@ private slots:
|
||||||
void updateLanlist(QString uuid, NetworkManager::ActiveConnection::State state, NetworkManager::ActiveConnection::Reason reason);
|
void updateLanlist(QString uuid, NetworkManager::ActiveConnection::State state, NetworkManager::ActiveConnection::Reason reason);
|
||||||
void addConnectionSlot(QString uuid);
|
void addConnectionSlot(QString uuid);
|
||||||
void removeConnectionSlot(QString path);
|
void removeConnectionSlot(QString path);
|
||||||
|
void connectionUpdateSlot(QString uuid);
|
||||||
void onSwithGsettingsChanged(const QString &key);
|
void onSwithGsettingsChanged(const QString &key);
|
||||||
void onLanSwitchClicked();
|
void onLanSwitchClicked();
|
||||||
void onDeviceAdd(QString deviceName, NetworkManager::Device::Type deviceType);
|
void onDeviceAdd(QString deviceName, NetworkManager::Device::Type deviceType);
|
||||||
|
|
|
@ -56,7 +56,6 @@ signals:
|
||||||
void deviceNameChanged(QString oldName, QString newName);
|
void deviceNameChanged(QString oldName, QString newName);
|
||||||
void activateFailed(QString errorMessage);
|
void activateFailed(QString errorMessage);
|
||||||
void deactivateFailed(QString errorMessage);
|
void deactivateFailed(QString errorMessage);
|
||||||
void listUpdate(QString devName);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void initUI();
|
void initUI();
|
||||||
|
|
|
@ -106,8 +106,6 @@ void WlanPage::initConnections()
|
||||||
{
|
{
|
||||||
connect(m_resource, &KyWirelessNetResource::wifiNetworkAdd, this, &WlanPage::onWlanAdded);
|
connect(m_resource, &KyWirelessNetResource::wifiNetworkAdd, this, &WlanPage::onWlanAdded);
|
||||||
connect(m_resource, &KyWirelessNetResource::wifiNetworkRemove, this, &WlanPage::onWlanRemoved);
|
connect(m_resource, &KyWirelessNetResource::wifiNetworkRemove, this, &WlanPage::onWlanRemoved);
|
||||||
connect(m_resource, &KyWirelessNetResource::wifiNetworkAdd, this, &WlanPage::listUpdate);
|
|
||||||
connect(m_resource, &KyWirelessNetResource::wifiNetworkRemove, this, &WlanPage::listUpdate);
|
|
||||||
connect(m_resource, &KyWirelessNetResource::signalStrengthChange, this, &WlanPage::signalStrengthChange);
|
connect(m_resource, &KyWirelessNetResource::signalStrengthChange, this, &WlanPage::signalStrengthChange);
|
||||||
connect(m_resource, &KyWirelessNetResource::secuTypeChange, this, &WlanPage::secuTypeChange);
|
connect(m_resource, &KyWirelessNetResource::secuTypeChange, this, &WlanPage::secuTypeChange);
|
||||||
|
|
||||||
|
@ -290,7 +288,12 @@ void WlanPage::getAllWlan()
|
||||||
|
|
||||||
void WlanPage::onWlanAdded(QString interface, KyWirelessNetItem &item)
|
void WlanPage::onWlanAdded(QString interface, KyWirelessNetItem &item)
|
||||||
{
|
{
|
||||||
emit listUpdate(interface);
|
//for dbus
|
||||||
|
QStringList info;
|
||||||
|
info <<item.m_NetSsid<<QString::number(item.m_signalStrength)<<item.m_secuType;
|
||||||
|
emit wlanAdd(interface, info);
|
||||||
|
|
||||||
|
|
||||||
qDebug() << "A Wlan Added! interface = " << interface << "; ssid = " << item.m_NetSsid << Q_FUNC_INFO <<__LINE__;
|
qDebug() << "A Wlan Added! interface = " << interface << "; ssid = " << item.m_NetSsid << Q_FUNC_INFO <<__LINE__;
|
||||||
if (interface != defaultDevice) {
|
if (interface != defaultDevice) {
|
||||||
qDebug() << "wlan add interface not equal defaultdevice,ignore";
|
qDebug() << "wlan add interface not equal defaultdevice,ignore";
|
||||||
|
@ -311,7 +314,7 @@ void WlanPage::onWlanAdded(QString interface, KyWirelessNetItem &item)
|
||||||
|
|
||||||
void WlanPage::onWlanRemoved(QString interface, QString ssid)
|
void WlanPage::onWlanRemoved(QString interface, QString ssid)
|
||||||
{
|
{
|
||||||
emit listUpdate(interface);
|
emit wlanRemove(interface, ssid);
|
||||||
if (!m_itemsMap.contains(ssid)) { return; }
|
if (!m_itemsMap.contains(ssid)) { return; }
|
||||||
if (m_expandedItem == m_itemsMap.value(ssid)) { m_expandedItem = nullptr; }
|
if (m_expandedItem == m_itemsMap.value(ssid)) { m_expandedItem = nullptr; }
|
||||||
qDebug() << "A Wlan Removed! interface = " << interface << "; ssid = " << ssid << Q_FUNC_INFO <<__LINE__;
|
qDebug() << "A Wlan Removed! interface = " << interface << "; ssid = " << ssid << Q_FUNC_INFO <<__LINE__;
|
||||||
|
@ -428,16 +431,8 @@ void WlanPage::onActivatedWlanChanged(QString uuid, NetworkManager::ActiveConnec
|
||||||
|
|
||||||
m_resource->getSsidByUuid(uuid, ssid);
|
m_resource->getSsidByUuid(uuid, ssid);
|
||||||
|
|
||||||
if (state == NetworkManager::ActiveConnection::State::Activating) {
|
qDebug() << "emit wlanActiveConnectionStateChanged" << devName << ssid << state;
|
||||||
qDebug() << "[WlanPage] wirelessActivating" << devName << ssid;
|
emit wlanActiveConnectionStateChanged(devName, ssid, state);
|
||||||
emit wirelessActivating(devName, ssid);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (state == NetworkManager::ActiveConnection::State::Activated || state == NetworkManager::ActiveConnection::State::Deactivated)
|
|
||||||
{
|
|
||||||
qDebug() << "[WlanPage] because ActivatedWlanChanged " << devName;
|
|
||||||
emit listUpdate(devName);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (state == NetworkManager::ActiveConnection::State::Deactivated) {
|
if (state == NetworkManager::ActiveConnection::State::Deactivated) {
|
||||||
QList<KyApConnectItem *> apConnectItemList;
|
QList<KyApConnectItem *> apConnectItemList;
|
||||||
|
|
|
@ -36,7 +36,9 @@ public:
|
||||||
void showDetailPage(QString devName, QString uuid);
|
void showDetailPage(QString devName, QString uuid);
|
||||||
signals:
|
signals:
|
||||||
void oneItemExpanded(const QString &ssid);
|
void oneItemExpanded(const QString &ssid);
|
||||||
void wirelessActivating(QString devName, QString ssid);
|
void wlanAdd(QString devName, QStringList info);
|
||||||
|
void wlanRemove(QString devName,QString ssid);
|
||||||
|
void wlanActiveConnectionStateChanged(QString interface, QString ssid, int status);
|
||||||
void hotspotDeactivated(QString devName, QString ssid);
|
void hotspotDeactivated(QString devName, QString ssid);
|
||||||
void hotspotActivated(QString devName, QString ssid);
|
void hotspotActivated(QString devName, QString ssid);
|
||||||
void signalStrengthChange(QString devName, QString ssid, int strength);
|
void signalStrengthChange(QString devName, QString ssid, int strength);
|
||||||
|
|
Loading…
Reference in New Issue