解决控制面板调用属性页的问题和直接删除配置控制面板不断连问题

This commit is contained in:
jzxc95 2021-10-11 15:24:42 +08:00
parent 0e19d97a88
commit 205bd5b3c5
9 changed files with 43 additions and 28 deletions

View File

@ -583,7 +583,7 @@ bool KyConnectResourse::isWiredConnection(QString uuid)
NetworkManager::Connection::Ptr connectPtr =
m_networkResourceInstance->getConnect(uuid);
if (connectPtr->isValid()) {
if (!connectPtr.isNull()) {
NetworkManager::ConnectionSettings::Ptr connectSettingPtr = connectPtr->settings();
if (connectSettingPtr.isNull()) {
@ -605,7 +605,7 @@ bool KyConnectResourse::isWirelessConnection(QString uuid)
NetworkManager::Connection::Ptr connectPtr =
m_networkResourceInstance->getConnect(uuid);
if (connectPtr->isValid()) {
if (connectPtr.isNull()) {
NetworkManager::ConnectionSettings::Ptr connectSettingPtr = connectPtr->settings();
if (connectSettingPtr.isNull()) {

View File

@ -178,12 +178,14 @@ QMap<QString, bool> DbusAdaptor::getDeviceListAndEnabled(int devType)
//唤起属性页 根据网卡类型 参数2 为ssid/uuid
void DbusAdaptor::showPropertyWidget(QString devName, QString ssid)
{
qDebug() << "showPropertyWidget";
parent()->showPropertyWidget(devName,ssid);
}
//唤起新建有线连接界面
void DbusAdaptor::showCreateWiredConnectWidget(QString devName)
{
qDebug() << "showCreateWiredConnectWidget";
parent()->showCreateWiredConnectWidget(devName);
}

View File

@ -86,7 +86,7 @@ Q_SIGNALS: // SIGNALS
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 wlanactiveConnectionStateChanged(QString devName, QString ssid, QString uuid, int status);
void lanActiveConnectionStateChanged(QString devName, QString uuid, int status);
//仅失败若成功直接发listUpdate
void activateFailed(QString errorMessage);

View File

@ -60,7 +60,7 @@ signals:
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 wlanactiveConnectionStateChanged(QString devName, QString ssid, QString uuid, int status);
void lanActiveConnectionStateChanged(QString devName, QString uuid, int status);
void activateFailed(QString errorMessage);
void deactivateFailed(QString errorMessage);

View File

@ -1,4 +1,5 @@
#include "detailpage.h"
#include <QPainter>
extern void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed);
@ -80,12 +81,16 @@ void DetailPage::initUI() {
mSSID = new QLineEdit(this);
mSSID->setAlignment(Qt::AlignRight);
qDebug() << "DetailPage" << isCreate;
if (!isCreate) {
mSSID->setStyleSheet("background:transparent;border-width:0;border-style:outset");
mSSID->setFocusPolicy(Qt::NoFocus);
} else {
mSSID->setStyleSheet("border-width:0;border-style:outset");
}
QHBoxLayout *mSsidLayout = new QHBoxLayout(this);
mSsidLayout->addStretch();
mSsidLayout->addWidget(mSSID);
mProtocol = new QLabel(this);
QHBoxLayout *mProtocolLayout = new QHBoxLayout(this);
@ -143,7 +148,7 @@ void DetailPage::initUI() {
mAutoLayout->addWidget(autoConnect);
mAutoLayout->addSpacerItem(horizontalSpacer);
mDetailLayout->addRow(tr("SSID:"), mSSID);
mDetailLayout->addRow(tr("SSID:"), mSsidLayout);
mDetailLayout->addRow(tr("Protocol:"), mProtocolLayout);
if (mIsWlan) {
mDetailLayout->addRow(tr("Security Type:"), mSecTypeLayout);

View File

@ -44,7 +44,7 @@ NetDetail::NetDetail(QString interface, QString name, QString uuid, bool isActiv
m_uuid(uuid),
isActive(isActive),
isWlan(isWlan),
isCreateNet(isCreateNet),
m_isCreateNet(isCreateNet),
QDialog(parent)
{
//设置窗口无边框,阴影
@ -64,9 +64,11 @@ NetDetail::NetDetail(QString interface, QString name, QString uuid, bool isActiv
setFixedSize(WINDOW_WIDTH,WINDOW_HEIGHT);
centerToScreen();
if (isCreateNet && !uuid.isEmpty()) {
isCreateNet = false;
qDebug() << m_isCreateNet << name;
if (m_isCreateNet && !name.isEmpty()) {
m_isCreateNet = false;
}
qDebug() << m_isCreateNet;
m_netDeviceResource = new KyNetworkDeviceResourse(this);
m_wirelessConnOpration = new KyWirelessConnectOperation(this);
m_resource = new KyWirelessNetResource(this);
@ -79,13 +81,13 @@ NetDetail::NetDetail(QString interface, QString name, QString uuid, bool isActiv
pagePadding(name,isWlan);
isCreateOk = !(isCreateNet && !isWlan);
isCreateOk = !(m_isCreateNet && !isWlan);
isDetailOk = !(m_name.isEmpty());
isIpv4Ok = true;
isIpv6Ok = true;
isSecuOk = true;
qDebug() << interface << name << uuid << "isWlan" << isWlan << "isCreateNet" <<isCreateNet;
qDebug() << interface << name << uuid << "isWlan" << isWlan << "isCreateNet" <<m_isCreateNet;
setConfirmEnable();
}
@ -116,7 +118,7 @@ void NetDetail::initUI()
QVBoxLayout *mainLayout = new QVBoxLayout(this);
mainLayout->setContentsMargins(9,9,14,24);
detailPage = new DetailPage(isWlan, isCreateNet, this);
detailPage = new DetailPage(isWlan, m_isCreateNet, this);
ipv4Page = new Ipv4Page(this);
ipv6Page = new Ipv6Page(this);
securityPage = new SecurityPage(this);
@ -230,7 +232,7 @@ void NetDetail::initUI()
void NetDetail::loadPage()
{
//判断是否创建网络页面
if (isCreateNet && !isWlan) {
if (m_isCreateNet && !isWlan) {
pageFrame->hide();
stackWidget->setCurrentIndex(CREATE_NET_PAGE_NUM);
titleLabel->setText(tr("Add Lan Connect"));
@ -305,7 +307,7 @@ void NetDetail::initComponent()
void NetDetail::pagePadding(QString netName, bool isWlan)
{
//网络详情页填充
if(isCreateNet && !isWlan) {
if(m_isCreateNet && !isWlan) {
return;
}
@ -363,7 +365,7 @@ void NetDetail::pagePadding(QString netName, bool isWlan)
//获取网路详情信息
void NetDetail::getConInfo(ConInfo &conInfo)
{
if (isCreateNet && !isWlan) {
if (m_isCreateNet && !isWlan) {
return;
}
getBaseInfo(conInfo);
@ -555,7 +557,7 @@ void NetDetail::initTtlsInfo(ConInfo &conInfo)
//点击了保存更改网络设置的按钮
void NetDetail::on_btnConfirm_clicked()
{
if (isCreateNet) {
if (m_isCreateNet) {
if (!isWlan) {
//新建有线连接
qDebug() << "Confirm create wired connect";
@ -589,7 +591,7 @@ void NetDetail::on_btnForget_clicked()
void NetDetail::setConfirmEnable()
{
if (isCreateNet && !isWlan) {
if (m_isCreateNet && !isWlan) {
isConfirmBtnEnable = isCreateOk;
} else {
if (isDetailOk && isIpv4Ok && isIpv6Ok) {

View File

@ -109,7 +109,7 @@ private:
QString m_deviceName;
bool isWlan;
bool isCreateNet;
bool m_isCreateNet;
bool isActive;
bool isHideWlan;

View File

@ -538,7 +538,7 @@ void WlanPage::onActivatedWlanChanged(QString uuid, NetworkManager::ActiveConnec
m_resource->getSsidByUuid(uuid, ssid, devName);
qDebug() << "emit wlanActiveConnectionStateChanged" << devName << ssid << state;
emit wlanActiveConnectionStateChanged(devName, ssid, state);
emit wlanActiveConnectionStateChanged(devName, ssid,uuid, state);
if (state == NetworkManager::ActiveConnection::State::Deactivated) {
QList<KyApConnectItem *> apConnectItemList;
@ -781,9 +781,14 @@ void WlanPage::getWirelessList(QMap<QString, QVector<QStringList> > &map)
QString activeSsid ;
//先是已连接
if (actMap.contains(iter.key())) {
qDebug() << "find " <<iter.key();
KyWirelessNetItem data;
if (m_resource->getWifiNetwork(iter.key(), actMap[iter.key()].at(0), data)) {
vector.append(QStringList()<<data.m_NetSsid<<QString::number(data.m_signalStrength)<<data.m_secuType);
QString ssid ="";
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;
}
@ -924,6 +929,7 @@ void WlanPage::onMainWindowVisibleChanged(const bool &visible)
void WlanPage::showDetailPage(QString devName, QString ssid)
{
KyWirelessNetItem data;
bool isActive;
if (!m_resource->getWifiNetwork(devName, ssid, data)) {
qDebug()<<"[WlanPage] " << ssid << " is missing when showDetailPage";
return;
@ -931,15 +937,15 @@ void WlanPage::showDetailPage(QString devName, QString ssid)
QMap<QString,QStringList> actMap;
m_resource->getWirelessActiveConnection(NetworkManager::ActiveConnection::State::Activated, actMap);
if (!actMap.contains(devName)) {
qDebug()<<"[WlanPage] " << devName << " is missing when showDetailPage";
return;
}
if (actMap.empty() || !actMap.contains(devName)) {
qDebug()<<"[WlanPage] " << devName << " is missing in active device when showDetailPage";
isActive = false;
} else {
QString actSsid;
m_resource->getSsidByUuid(actMap[devName].at(0), actSsid, devName);
isActive = !actSsid.compare(ssid);
}
bool isActive = !actSsid.compare(ssid);
NetDetail *netDetail = new NetDetail(devName, ssid, data.m_connectUuid, isActive, true, true, this);
netDetail->show();
}

View File

@ -44,7 +44,7 @@ signals:
void oneItemExpanded(const QString &ssid);
void wlanAdd(QString devName, QStringList info);
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 hotspotActivated(QString devName, QString ssid);
void signalStrengthChange(QString devName, QString ssid, int strength);