解决控制面板调用属性页的问题和直接删除配置控制面板不断连问题
This commit is contained in:
parent
0e19d97a88
commit
205bd5b3c5
|
@ -583,7 +583,7 @@ bool KyConnectResourse::isWiredConnection(QString uuid)
|
||||||
NetworkManager::Connection::Ptr connectPtr =
|
NetworkManager::Connection::Ptr connectPtr =
|
||||||
m_networkResourceInstance->getConnect(uuid);
|
m_networkResourceInstance->getConnect(uuid);
|
||||||
|
|
||||||
if (connectPtr->isValid()) {
|
if (!connectPtr.isNull()) {
|
||||||
NetworkManager::ConnectionSettings::Ptr connectSettingPtr = connectPtr->settings();
|
NetworkManager::ConnectionSettings::Ptr connectSettingPtr = connectPtr->settings();
|
||||||
|
|
||||||
if (connectSettingPtr.isNull()) {
|
if (connectSettingPtr.isNull()) {
|
||||||
|
@ -605,7 +605,7 @@ bool KyConnectResourse::isWirelessConnection(QString uuid)
|
||||||
NetworkManager::Connection::Ptr connectPtr =
|
NetworkManager::Connection::Ptr connectPtr =
|
||||||
m_networkResourceInstance->getConnect(uuid);
|
m_networkResourceInstance->getConnect(uuid);
|
||||||
|
|
||||||
if (connectPtr->isValid()) {
|
if (connectPtr.isNull()) {
|
||||||
NetworkManager::ConnectionSettings::Ptr connectSettingPtr = connectPtr->settings();
|
NetworkManager::ConnectionSettings::Ptr connectSettingPtr = connectPtr->settings();
|
||||||
|
|
||||||
if (connectSettingPtr.isNull()) {
|
if (connectSettingPtr.isNull()) {
|
||||||
|
|
|
@ -178,12 +178,14 @@ QMap<QString, bool> DbusAdaptor::getDeviceListAndEnabled(int devType)
|
||||||
//唤起属性页 根据网卡类型 参数2 为ssid/uuid
|
//唤起属性页 根据网卡类型 参数2 为ssid/uuid
|
||||||
void DbusAdaptor::showPropertyWidget(QString devName, QString ssid)
|
void DbusAdaptor::showPropertyWidget(QString devName, QString ssid)
|
||||||
{
|
{
|
||||||
|
qDebug() << "showPropertyWidget";
|
||||||
parent()->showPropertyWidget(devName,ssid);
|
parent()->showPropertyWidget(devName,ssid);
|
||||||
}
|
}
|
||||||
|
|
||||||
//唤起新建有线连接界面
|
//唤起新建有线连接界面
|
||||||
void DbusAdaptor::showCreateWiredConnectWidget(QString devName)
|
void DbusAdaptor::showCreateWiredConnectWidget(QString devName)
|
||||||
{
|
{
|
||||||
|
qDebug() << "showCreateWiredConnectWidget";
|
||||||
parent()->showCreateWiredConnectWidget(devName);
|
parent()->showCreateWiredConnectWidget(devName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ Q_SIGNALS: // SIGNALS
|
||||||
void lanUpdate(QString devName, QStringList info);
|
void lanUpdate(QString devName, QStringList info);
|
||||||
void wlanAdd(QString devName, QStringList info);
|
void wlanAdd(QString devName, QStringList info);
|
||||||
void wlanRemove(QString devName,QString ssid);
|
void wlanRemove(QString devName,QString ssid);
|
||||||
void wlanactiveConnectionStateChanged(QString devName, QString ssid, int status);
|
void wlanactiveConnectionStateChanged(QString devName, QString ssid, QString uuid, int status);
|
||||||
void lanActiveConnectionStateChanged(QString devName, QString uuid, int status);
|
void lanActiveConnectionStateChanged(QString devName, QString uuid, int status);
|
||||||
//仅失败,若成功直接发listUpdate
|
//仅失败,若成功直接发listUpdate
|
||||||
void activateFailed(QString errorMessage);
|
void activateFailed(QString errorMessage);
|
||||||
|
|
|
@ -60,7 +60,7 @@ signals:
|
||||||
void lanUpdate(QString devName, QStringList info);
|
void lanUpdate(QString devName, QStringList info);
|
||||||
void wlanAdd(QString devName, QStringList info);
|
void wlanAdd(QString devName, QStringList info);
|
||||||
void wlanRemove(QString devName,QString ssid);
|
void wlanRemove(QString devName,QString ssid);
|
||||||
void wlanactiveConnectionStateChanged(QString devName, QString ssid, int status);
|
void wlanactiveConnectionStateChanged(QString devName, QString ssid, QString uuid, int status);
|
||||||
void lanActiveConnectionStateChanged(QString devName, QString uuid, 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);
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "detailpage.h"
|
#include "detailpage.h"
|
||||||
|
#include <QPainter>
|
||||||
|
|
||||||
extern void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed);
|
extern void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed);
|
||||||
|
|
||||||
|
@ -80,12 +81,16 @@ void DetailPage::initUI() {
|
||||||
|
|
||||||
mSSID = new QLineEdit(this);
|
mSSID = new QLineEdit(this);
|
||||||
mSSID->setAlignment(Qt::AlignRight);
|
mSSID->setAlignment(Qt::AlignRight);
|
||||||
|
qDebug() << "DetailPage" << isCreate;
|
||||||
if (!isCreate) {
|
if (!isCreate) {
|
||||||
mSSID->setStyleSheet("background:transparent;border-width:0;border-style:outset");
|
mSSID->setStyleSheet("background:transparent;border-width:0;border-style:outset");
|
||||||
mSSID->setFocusPolicy(Qt::NoFocus);
|
mSSID->setFocusPolicy(Qt::NoFocus);
|
||||||
} else {
|
} else {
|
||||||
mSSID->setStyleSheet("border-width:0;border-style:outset");
|
mSSID->setStyleSheet("border-width:0;border-style:outset");
|
||||||
}
|
}
|
||||||
|
QHBoxLayout *mSsidLayout = new QHBoxLayout(this);
|
||||||
|
mSsidLayout->addStretch();
|
||||||
|
mSsidLayout->addWidget(mSSID);
|
||||||
|
|
||||||
mProtocol = new QLabel(this);
|
mProtocol = new QLabel(this);
|
||||||
QHBoxLayout *mProtocolLayout = new QHBoxLayout(this);
|
QHBoxLayout *mProtocolLayout = new QHBoxLayout(this);
|
||||||
|
@ -143,7 +148,7 @@ void DetailPage::initUI() {
|
||||||
mAutoLayout->addWidget(autoConnect);
|
mAutoLayout->addWidget(autoConnect);
|
||||||
mAutoLayout->addSpacerItem(horizontalSpacer);
|
mAutoLayout->addSpacerItem(horizontalSpacer);
|
||||||
|
|
||||||
mDetailLayout->addRow(tr("SSID:"), mSSID);
|
mDetailLayout->addRow(tr("SSID:"), mSsidLayout);
|
||||||
mDetailLayout->addRow(tr("Protocol:"), mProtocolLayout);
|
mDetailLayout->addRow(tr("Protocol:"), mProtocolLayout);
|
||||||
if (mIsWlan) {
|
if (mIsWlan) {
|
||||||
mDetailLayout->addRow(tr("Security Type:"), mSecTypeLayout);
|
mDetailLayout->addRow(tr("Security Type:"), mSecTypeLayout);
|
||||||
|
|
|
@ -44,7 +44,7 @@ NetDetail::NetDetail(QString interface, QString name, QString uuid, bool isActiv
|
||||||
m_uuid(uuid),
|
m_uuid(uuid),
|
||||||
isActive(isActive),
|
isActive(isActive),
|
||||||
isWlan(isWlan),
|
isWlan(isWlan),
|
||||||
isCreateNet(isCreateNet),
|
m_isCreateNet(isCreateNet),
|
||||||
QDialog(parent)
|
QDialog(parent)
|
||||||
{
|
{
|
||||||
//设置窗口无边框,阴影
|
//设置窗口无边框,阴影
|
||||||
|
@ -64,9 +64,11 @@ NetDetail::NetDetail(QString interface, QString name, QString uuid, bool isActiv
|
||||||
setFixedSize(WINDOW_WIDTH,WINDOW_HEIGHT);
|
setFixedSize(WINDOW_WIDTH,WINDOW_HEIGHT);
|
||||||
centerToScreen();
|
centerToScreen();
|
||||||
|
|
||||||
if (isCreateNet && !uuid.isEmpty()) {
|
qDebug() << m_isCreateNet << name;
|
||||||
isCreateNet = false;
|
if (m_isCreateNet && !name.isEmpty()) {
|
||||||
|
m_isCreateNet = false;
|
||||||
}
|
}
|
||||||
|
qDebug() << m_isCreateNet;
|
||||||
m_netDeviceResource = new KyNetworkDeviceResourse(this);
|
m_netDeviceResource = new KyNetworkDeviceResourse(this);
|
||||||
m_wirelessConnOpration = new KyWirelessConnectOperation(this);
|
m_wirelessConnOpration = new KyWirelessConnectOperation(this);
|
||||||
m_resource = new KyWirelessNetResource(this);
|
m_resource = new KyWirelessNetResource(this);
|
||||||
|
@ -79,13 +81,13 @@ NetDetail::NetDetail(QString interface, QString name, QString uuid, bool isActiv
|
||||||
pagePadding(name,isWlan);
|
pagePadding(name,isWlan);
|
||||||
|
|
||||||
|
|
||||||
isCreateOk = !(isCreateNet && !isWlan);
|
isCreateOk = !(m_isCreateNet && !isWlan);
|
||||||
isDetailOk = !(m_name.isEmpty());
|
isDetailOk = !(m_name.isEmpty());
|
||||||
isIpv4Ok = true;
|
isIpv4Ok = true;
|
||||||
isIpv6Ok = true;
|
isIpv6Ok = true;
|
||||||
isSecuOk = true;
|
isSecuOk = true;
|
||||||
|
|
||||||
qDebug() << interface << name << uuid << "isWlan" << isWlan << "isCreateNet" <<isCreateNet;
|
qDebug() << interface << name << uuid << "isWlan" << isWlan << "isCreateNet" <<m_isCreateNet;
|
||||||
|
|
||||||
setConfirmEnable();
|
setConfirmEnable();
|
||||||
}
|
}
|
||||||
|
@ -116,7 +118,7 @@ void NetDetail::initUI()
|
||||||
QVBoxLayout *mainLayout = new QVBoxLayout(this);
|
QVBoxLayout *mainLayout = new QVBoxLayout(this);
|
||||||
mainLayout->setContentsMargins(9,9,14,24);
|
mainLayout->setContentsMargins(9,9,14,24);
|
||||||
|
|
||||||
detailPage = new DetailPage(isWlan, isCreateNet, this);
|
detailPage = new DetailPage(isWlan, m_isCreateNet, this);
|
||||||
ipv4Page = new Ipv4Page(this);
|
ipv4Page = new Ipv4Page(this);
|
||||||
ipv6Page = new Ipv6Page(this);
|
ipv6Page = new Ipv6Page(this);
|
||||||
securityPage = new SecurityPage(this);
|
securityPage = new SecurityPage(this);
|
||||||
|
@ -230,7 +232,7 @@ void NetDetail::initUI()
|
||||||
void NetDetail::loadPage()
|
void NetDetail::loadPage()
|
||||||
{
|
{
|
||||||
//判断是否创建网络页面
|
//判断是否创建网络页面
|
||||||
if (isCreateNet && !isWlan) {
|
if (m_isCreateNet && !isWlan) {
|
||||||
pageFrame->hide();
|
pageFrame->hide();
|
||||||
stackWidget->setCurrentIndex(CREATE_NET_PAGE_NUM);
|
stackWidget->setCurrentIndex(CREATE_NET_PAGE_NUM);
|
||||||
titleLabel->setText(tr("Add Lan Connect"));
|
titleLabel->setText(tr("Add Lan Connect"));
|
||||||
|
@ -305,7 +307,7 @@ void NetDetail::initComponent()
|
||||||
void NetDetail::pagePadding(QString netName, bool isWlan)
|
void NetDetail::pagePadding(QString netName, bool isWlan)
|
||||||
{
|
{
|
||||||
//网络详情页填充
|
//网络详情页填充
|
||||||
if(isCreateNet && !isWlan) {
|
if(m_isCreateNet && !isWlan) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -363,7 +365,7 @@ void NetDetail::pagePadding(QString netName, bool isWlan)
|
||||||
//获取网路详情信息
|
//获取网路详情信息
|
||||||
void NetDetail::getConInfo(ConInfo &conInfo)
|
void NetDetail::getConInfo(ConInfo &conInfo)
|
||||||
{
|
{
|
||||||
if (isCreateNet && !isWlan) {
|
if (m_isCreateNet && !isWlan) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
getBaseInfo(conInfo);
|
getBaseInfo(conInfo);
|
||||||
|
@ -555,7 +557,7 @@ void NetDetail::initTtlsInfo(ConInfo &conInfo)
|
||||||
//点击了保存更改网络设置的按钮
|
//点击了保存更改网络设置的按钮
|
||||||
void NetDetail::on_btnConfirm_clicked()
|
void NetDetail::on_btnConfirm_clicked()
|
||||||
{
|
{
|
||||||
if (isCreateNet) {
|
if (m_isCreateNet) {
|
||||||
if (!isWlan) {
|
if (!isWlan) {
|
||||||
//新建有线连接
|
//新建有线连接
|
||||||
qDebug() << "Confirm create wired connect";
|
qDebug() << "Confirm create wired connect";
|
||||||
|
@ -589,7 +591,7 @@ void NetDetail::on_btnForget_clicked()
|
||||||
|
|
||||||
void NetDetail::setConfirmEnable()
|
void NetDetail::setConfirmEnable()
|
||||||
{
|
{
|
||||||
if (isCreateNet && !isWlan) {
|
if (m_isCreateNet && !isWlan) {
|
||||||
isConfirmBtnEnable = isCreateOk;
|
isConfirmBtnEnable = isCreateOk;
|
||||||
} else {
|
} else {
|
||||||
if (isDetailOk && isIpv4Ok && isIpv6Ok) {
|
if (isDetailOk && isIpv4Ok && isIpv6Ok) {
|
||||||
|
|
|
@ -109,7 +109,7 @@ private:
|
||||||
QString m_deviceName;
|
QString m_deviceName;
|
||||||
|
|
||||||
bool isWlan;
|
bool isWlan;
|
||||||
bool isCreateNet;
|
bool m_isCreateNet;
|
||||||
bool isActive;
|
bool isActive;
|
||||||
bool isHideWlan;
|
bool isHideWlan;
|
||||||
|
|
||||||
|
|
|
@ -538,7 +538,7 @@ void WlanPage::onActivatedWlanChanged(QString uuid, NetworkManager::ActiveConnec
|
||||||
m_resource->getSsidByUuid(uuid, ssid, devName);
|
m_resource->getSsidByUuid(uuid, ssid, devName);
|
||||||
|
|
||||||
qDebug() << "emit wlanActiveConnectionStateChanged" << devName << ssid << state;
|
qDebug() << "emit wlanActiveConnectionStateChanged" << devName << ssid << state;
|
||||||
emit wlanActiveConnectionStateChanged(devName, ssid, state);
|
emit wlanActiveConnectionStateChanged(devName, ssid,uuid, state);
|
||||||
|
|
||||||
if (state == NetworkManager::ActiveConnection::State::Deactivated) {
|
if (state == NetworkManager::ActiveConnection::State::Deactivated) {
|
||||||
QList<KyApConnectItem *> apConnectItemList;
|
QList<KyApConnectItem *> apConnectItemList;
|
||||||
|
@ -781,9 +781,14 @@ void WlanPage::getWirelessList(QMap<QString, QVector<QStringList> > &map)
|
||||||
QString activeSsid ;
|
QString activeSsid ;
|
||||||
//先是已连接
|
//先是已连接
|
||||||
if (actMap.contains(iter.key())) {
|
if (actMap.contains(iter.key())) {
|
||||||
|
qDebug() << "find " <<iter.key();
|
||||||
KyWirelessNetItem data;
|
KyWirelessNetItem data;
|
||||||
if (m_resource->getWifiNetwork(iter.key(), actMap[iter.key()].at(0), data)) {
|
QString ssid ="";
|
||||||
vector.append(QStringList()<<data.m_NetSsid<<QString::number(data.m_signalStrength)<<data.m_secuType);
|
QString devName = iter.key();
|
||||||
|
m_resource->getSsidByUuid(actMap[iter.key()].at(0), ssid, devName);
|
||||||
|
if (m_resource->getWifiNetwork(iter.key(), ssid, data)) {
|
||||||
|
qDebug() << data.m_NetSsid << data.m_signalStrength << data.m_secuType << data.m_connectUuid;
|
||||||
|
vector.append(QStringList()<<data.m_NetSsid<<QString::number(data.m_signalStrength)<<data.m_secuType<<data.m_connectUuid);
|
||||||
activeSsid = data.m_NetSsid;
|
activeSsid = data.m_NetSsid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -924,6 +929,7 @@ void WlanPage::onMainWindowVisibleChanged(const bool &visible)
|
||||||
void WlanPage::showDetailPage(QString devName, QString ssid)
|
void WlanPage::showDetailPage(QString devName, QString ssid)
|
||||||
{
|
{
|
||||||
KyWirelessNetItem data;
|
KyWirelessNetItem data;
|
||||||
|
bool isActive;
|
||||||
if (!m_resource->getWifiNetwork(devName, ssid, data)) {
|
if (!m_resource->getWifiNetwork(devName, ssid, data)) {
|
||||||
qDebug()<<"[WlanPage] " << ssid << " is missing when showDetailPage";
|
qDebug()<<"[WlanPage] " << ssid << " is missing when showDetailPage";
|
||||||
return;
|
return;
|
||||||
|
@ -931,15 +937,15 @@ void WlanPage::showDetailPage(QString devName, QString ssid)
|
||||||
|
|
||||||
QMap<QString,QStringList> actMap;
|
QMap<QString,QStringList> actMap;
|
||||||
m_resource->getWirelessActiveConnection(NetworkManager::ActiveConnection::State::Activated, actMap);
|
m_resource->getWirelessActiveConnection(NetworkManager::ActiveConnection::State::Activated, actMap);
|
||||||
if (!actMap.contains(devName)) {
|
if (actMap.empty() || !actMap.contains(devName)) {
|
||||||
qDebug()<<"[WlanPage] " << devName << " is missing when showDetailPage";
|
qDebug()<<"[WlanPage] " << devName << " is missing in active device when showDetailPage";
|
||||||
return;
|
isActive = false;
|
||||||
|
} else {
|
||||||
|
QString actSsid;
|
||||||
|
m_resource->getSsidByUuid(actMap[devName].at(0), actSsid, devName);
|
||||||
|
isActive = !actSsid.compare(ssid);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString actSsid;
|
|
||||||
m_resource->getSsidByUuid(actMap[devName].at(0), actSsid, devName);
|
|
||||||
|
|
||||||
bool isActive = !actSsid.compare(ssid);
|
|
||||||
NetDetail *netDetail = new NetDetail(devName, ssid, data.m_connectUuid, isActive, true, true, this);
|
NetDetail *netDetail = new NetDetail(devName, ssid, data.m_connectUuid, isActive, true, true, this);
|
||||||
netDetail->show();
|
netDetail->show();
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ signals:
|
||||||
void oneItemExpanded(const QString &ssid);
|
void oneItemExpanded(const QString &ssid);
|
||||||
void wlanAdd(QString devName, QStringList info);
|
void wlanAdd(QString devName, QStringList info);
|
||||||
void wlanRemove(QString devName,QString ssid);
|
void wlanRemove(QString devName,QString ssid);
|
||||||
void wlanActiveConnectionStateChanged(QString interface, QString ssid, int status);
|
void wlanActiveConnectionStateChanged(QString interface, QString ssid, QString uuid, 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