Merge branch '2209bug-cc' into 'yhkylin/v101'

fix bug #156615 #156764

See merge request kylinos-src/kylin-nm!87
This commit is contained in:
赵世旭 2023-02-03 06:02:22 +00:00
commit b2ea02fc6a
8 changed files with 63 additions and 64 deletions

View File

@ -177,15 +177,15 @@ void LanListItem::onInfoButtonClicked()
return;
}
if(netDetail != nullptr){
netDetail->activateWindow();
return;
}
// if(netDetail != nullptr){
// netDetail->activateWindow();
// return;
// }
qDebug()<< LOG_FLAG << "the info button of lan is clicked! uuid = "
<< m_lanConnectItem.m_connectUuid << "; name = " << m_lanConnectItem.m_connectName
<< "." <<Q_FUNC_INFO << __LINE__;
#if 0
bool isActivated = false;
if (Activated == m_lanConnectItem.m_connectState) {
isActivated = true;
@ -201,7 +201,8 @@ void LanListItem::onInfoButtonClicked()
});
netDetail->show();
Q_EMIT this->detailShow(true);
#endif
Q_EMIT this->detailShow(m_deviceName, m_lanConnectItem.m_connectUuid);
return;
}

View File

@ -137,7 +137,7 @@ public Q_SLOTS:
virtual void onMenuTriggered(QAction *action)=0;
Q_SIGNALS:
void detailShow(bool isShow);
void detailShow(QString, QString);
};
#endif // LISTITEM_H

View File

@ -465,17 +465,17 @@ void WlanListItem::refreshIcon(bool isActivated)
void WlanListItem::onInfoButtonClicked()
{
//ZJP_TODO 呼出无线详情页
if(netDetail != nullptr){
netDetail->activateWindow();
return;
}
// if(netDetail != nullptr){
// netDetail->activateWindow();
// return;
// }
qDebug() << LOG_FLAG << "Net active or not:"<< m_connectState;
qDebug() << LOG_FLAG << "On wlan info button clicked! ssid = "
<< m_wirelessNetItem.m_NetSsid << "; name = "
<< m_wirelessNetItem.m_connName << "." <<Q_FUNC_INFO << __LINE__;
#if 0
bool isActive = false;
if (Activated == m_connectState) {
isActive = true;
@ -490,7 +490,8 @@ void WlanListItem::onInfoButtonClicked()
}
});
netDetail->show();
Q_EMIT this->detailShow(true);
#endif
Q_EMIT this->detailShow(m_wlanDevice, m_wirelessNetItem.m_NetSsid);
}
void WlanListItem::onNetButtonClicked()

View File

@ -829,35 +829,7 @@ void MainWindow::showCreateWiredConnectWidget(const QString devName)
void MainWindow::showAddOtherWlanWidget(QString devName)
{
qDebug() << "showAddOtherWlanWidget! devName = " << devName;
if (m_addOtherPagePtrMap.contains(devName)) {
if (m_addOtherPagePtrMap[devName] != nullptr) {
qDebug() << "showAddOtherWlanWidget" << devName << "already create,just raise";
KWindowSystem::raiseWindow(m_addOtherPagePtrMap[devName]->winId());
return;
}
}
#if 0
NetDetail *netDetail = new NetDetail(devName, "", "", false, true, true, this);
connect(netDetail, &NetDetail::createPageClose, [&](QString interfaceName){
if (m_addOtherPagePtrMap.contains(interfaceName)) {
m_addOtherPagePtrMap[interfaceName] = nullptr;
}
});
m_addOtherPagePtrMap.insert(devName, netDetail);
netDetail->show();
#endif
JoinHiddenWiFiPage *hiddenWiFi =new JoinHiddenWiFiPage(devName);
connect(hiddenWiFi, &JoinHiddenWiFiPage::hiddenWiFiPageClose, [&](QString interfaceName){
if (m_addOtherPagePtrMap.contains(interfaceName)) {
m_addOtherPagePtrMap[interfaceName] = nullptr;
}
});
m_addOtherPagePtrMap.insert(devName, hiddenWiFi);
connect(hiddenWiFi, &JoinHiddenWiFiPage::showWlanList, this, &MainWindow::onShowMainWindow);
hiddenWiFi->show();
m_wlanWidget->showAddOtherPage(devName);
}
void MainWindow::getWirelessDeviceCap(QMap<QString, int> &map)

View File

@ -152,6 +152,7 @@ private:
void initUI();
void initDbusConnnect();
void initTrayIcon();
void resetTrayIconTool();
void initWindowTheme();
void resetWindowTheme();
@ -194,8 +195,6 @@ private:
IconActiveType iconStatus = IconActiveType::NOT_CONNECTED;
QMap<QString, NetDetail*> m_createPagePtrMap;
// QMap<QString, NetDetail*> m_addOtherPagePtrMap;
QMap<QString, JoinHiddenWiFiPage*> m_addOtherPagePtrMap;
public Q_SLOTS:
void onShowMainWindow(int type);

View File

@ -811,7 +811,7 @@ QListWidgetItem *LanPage::insertNewItem(KyConnectItem *itemData, QListWidget *li
LanListItem *p_sortLanItem = nullptr;
p_sortLanItem = new LanListItem(itemData, m_currentDeviceName);
listWidget->setItemWidget(p_sortListWidgetItem, p_sortLanItem);
connect(p_sortLanItem, &LanListItem::detailShow, this, &LanPage::showDetailPage);
return p_sortListWidgetItem;
}
@ -832,6 +832,7 @@ QListWidgetItem *LanPage::addNewItem(KyConnectItem *itemData, QListWidget *listW
}
listWidget->setItemWidget(p_listWidgetItem, p_lanItem);
connect(p_lanItem, &LanListItem::detailShow, this, &LanPage::showDetailPage);
return p_listWidgetItem;
}

View File

@ -87,6 +87,7 @@ WlanPage::WlanPage(QWidget *parent) : TabPage(parent)
}
});
m_wlanPagePtrMap.clear();
m_joinHiddenWiFiPagePtrMap.clear();
}
bool WlanPage::eventFilter(QObject *w, QEvent *e)
@ -294,6 +295,7 @@ QListWidgetItem *WlanPage::addNewItem(KyWirelessNetItem &wirelessNetItem,
m_currentDevice,
m_connectResource->isApConnection(wirelessNetItem.m_connectUuid));
connect(p_wlanItem, &WlanListItem::itemHeightChanged, this, &WlanPage::onItemHeightChanged);
connect(p_wlanItem, &WlanListItem::detailShow, this, &WlanPage::showDetailPage);
QListWidgetItem *p_listWidgetItem = new QListWidgetItem();
// p_listWidgetItem->setFlags(p_listWidgetItem->flags() & (~Qt::ItemIsSelectable));
@ -310,6 +312,7 @@ QListWidgetItem *WlanPage::insertNewItem(KyWirelessNetItem &wirelessNetItem,
{
WlanListItem *p_wlanItem = new WlanListItem(wirelessNetItem, m_currentDevice);
connect(p_wlanItem, &WlanListItem::itemHeightChanged, this, &WlanPage::onItemHeightChanged);
connect(p_wlanItem, &WlanListItem::detailShow, this, &WlanPage::showDetailPage);
QListWidgetItem *p_listWidgetItem = new QListWidgetItem();
// p_listWidgetItem->setFlags(p_listWidgetItem->flags() & (~Qt::ItemIsSelectable));
@ -330,6 +333,7 @@ QListWidgetItem *WlanPage::insertNewItemWithSort(KyWirelessNetItem &wirelessNetI
// << "signal strength" << wirelessNetItem.m_signalStrength;
WlanListItem *p_sortWlanItem = new WlanListItem(wirelessNetItem, m_currentDevice);
connect(p_sortWlanItem, &WlanListItem::itemHeightChanged, this, &WlanPage::onItemHeightChanged);
connect(p_sortWlanItem, &WlanListItem::detailShow, this, &WlanPage::showDetailPage);
QListWidgetItem *p_sortListWidgetItem = new QListWidgetItem();
// p_sortListWidgetItem->setFlags(p_sortListWidgetItem->flags() & (~Qt::ItemIsSelectable));
@ -777,6 +781,12 @@ void WlanPage::onDeviceRemove(QString deviceName)
QString originalDeviceName = m_currentDevice;
if (m_joinHiddenWiFiPagePtrMap.contains(deviceName)) {
if (m_joinHiddenWiFiPagePtrMap[deviceName] != nullptr) {
m_joinHiddenWiFiPagePtrMap[deviceName]->close();
}
}
m_devList.removeOne(deviceName);
deleteDeviceFromCombox(deviceName);
@ -1144,24 +1154,8 @@ void WlanPage::requestScan()
void WlanPage::onHiddenWlanClicked()
{
// qDebug() << "[wlanPage] AddHideWifi Clicked! " << Q_FUNC_INFO << __LINE__ ;
// NetDetail *netDetail = new NetDetail(m_currentDevice, "", "", false, true, true);
// netDetail->show();
if(m_hiddenWiFi != nullptr){
m_hiddenWiFi->activateWindow();
return;
}
m_hiddenWiFi = new JoinHiddenWiFiPage(m_currentDevice);
connect(m_hiddenWiFi, &JoinHiddenWiFiPage::showWlanList, this, &WlanPage::showMainWindow);
connect(m_hiddenWiFi, &JoinHiddenWiFiPage::destroyed, [&](){
if (m_hiddenWiFi != nullptr) {
m_hiddenWiFi = nullptr;
}
});
m_hiddenWiFi->show();
qDebug() << "[wlanPage] AddHideWifi Clicked! " << Q_FUNC_INFO << __LINE__ ;
showHiddenWlanPage(m_currentDevice);
}
void WlanPage::showControlCenter()
@ -1270,6 +1264,7 @@ void WlanPage::onRefreshIconTimer()
WlanListItem *p_sortWlanItem = new WlanListItem(sortItem, m_currentDevice);
connect(p_sortWlanItem, &WlanListItem::itemHeightChanged, this, &WlanPage::onItemHeightChanged);
connect(p_sortWlanItem, &WlanListItem::detailShow, this, &WlanPage::showDetailPage);
m_inactivatedNetListWidget->insertItem(sortRow, p_sortListWidgetItem);
m_inactivatedNetListWidget->setItemWidget(p_sortListWidgetItem, p_sortWlanItem);
updateWlanItemState(m_inactivatedNetListWidget, p_sortListWidgetItem, Deactivated);
@ -1534,6 +1529,28 @@ void WlanPage::showRate()
});
}
void WlanPage::showHiddenWlanPage(QString devName)
{
if (m_joinHiddenWiFiPagePtrMap.contains(devName)) {
if (m_joinHiddenWiFiPagePtrMap[devName] != nullptr) {
qDebug() << "[WlanPage] showAddOtherWlanWidget" << devName << "already create,just raise";
KWindowSystem::raiseWindow(m_joinHiddenWiFiPagePtrMap[devName]->winId());
return;
}
}
JoinHiddenWiFiPage *hiddenWiFi =new JoinHiddenWiFiPage(devName);
connect(hiddenWiFi, &JoinHiddenWiFiPage::hiddenWiFiPageClose, [&](QString interfaceName){
if (m_joinHiddenWiFiPagePtrMap.contains(interfaceName)) {
m_joinHiddenWiFiPagePtrMap[interfaceName] = nullptr;
}
});
connect(hiddenWiFi, &JoinHiddenWiFiPage::showWlanList, this, &WlanPage::showMainWindow);
m_joinHiddenWiFiPagePtrMap.insert(devName, hiddenWiFi);
hiddenWiFi->show();
}
void WlanPage::showDetailPage(QString devName, QString ssid)
{
KyWirelessNetItem wirelessNetItem;
@ -1564,6 +1581,11 @@ void WlanPage::showDetailPage(QString devName, QString ssid)
return;
}
void WlanPage::showAddOtherPage(QString devName)
{
showHiddenWlanPage(devName);
}
bool WlanPage::checkWlanStatus(NetworkManager::ActiveConnection::State state)
{
if (m_activatedConnectResource->checkWirelessStatus(state)) {

View File

@ -66,6 +66,7 @@ public:
void deactivateWirelessConnection(const QString& devName, const QString& ssid);
void showDetailPage(QString devName, QString uuid);
void showAddOtherPage(QString devName);
bool checkWlanStatus(NetworkManager::ActiveConnection::State state);
@ -145,6 +146,8 @@ private:
void showRate();
void showHiddenWlanPage(QString devName);
QListWidgetItem *addEmptyItem(QListWidget *wirelessListWidget);
QListWidgetItem *addNewItem(KyWirelessNetItem &wirelessNetItem,
QListWidget *wirelessListWidget);
@ -231,8 +234,8 @@ private:
QTimer *m_scanTimer = nullptr;
QTimer *m_refreshIconTimer = nullptr;
JoinHiddenWiFiPage *m_hiddenWiFi = nullptr;
QMap<QString, QMap<QString, NetDetail*>> m_wlanPagePtrMap;
QMap<QString, JoinHiddenWiFiPage*> m_joinHiddenWiFiPagePtrMap;
};
#endif // WLANPAGE_H