merge:合并代码

This commit is contained in:
jzxc95 2023-09-26 14:55:26 +08:00
parent 3a9a41c08f
commit ba5b609fcf
11 changed files with 49 additions and 9 deletions

View File

@ -452,7 +452,7 @@ int KyNetworkDeviceResourse::getWirelessDeviceCapability(const QString deviceNam
qobject_cast<NetworkManager::WirelessDevice *>(connectDevice.data());
int cap = 0x00;
if (wirelessDevicePtr->wirelessCapabilities() & NetworkManager::WirelessDevice::AdhocCap) {
if (wirelessDevicePtr->wirelessCapabilities() & NetworkManager::WirelessDevice::ApCap) {
cap = cap | 0x02;
} else {
return 0x01;

View File

@ -147,6 +147,18 @@ void DbusAdaptor::setDeviceEnable(QString devName, bool enable)
// return deviceName;
//}
//删除
void DbusAdaptor::deleteConnect(int type, QString ssid)
{
if (type == WIRED) {
parent()->deleteWired(ssid);
} else if (type == WIRELESS) {
//待实现
} else {
qDebug() << "[DbusAdaptor] deleteConnect type is invalid";
}
}
//连接 根据网卡类型 参数1 0:lan 1:wlan 参数3 为ssid/uuid
void DbusAdaptor::activateConnect(int type, QString devName, QString ssid)
{

View File

@ -62,6 +62,8 @@ public Q_SLOTS: // METHODS
// QString getDefaultWiredDevice();
// Q_NOREPLY void setDefaultWirelessDevice(QString deviceName);
// QString getDefaultWirelessDevice();
//刪除 根据网络名称 参数1 0:lan 1:wlan 参数2 为ssid/uuid
void deleteConnect(int type, QString ssid);
//连接 根据网卡类型 参数1 0:lan 1:wlan 参数3 为ssid/uuid
Q_NOREPLY void activateConnect(int type, QString devName, QString ssid);
//断开连接 根据网卡类型 参数1 0:lan 1:wlan 参数3 为ssid/uuid

View File

@ -189,14 +189,21 @@ void ListItem::showDesktopNotify(const QString &message, QString soundName)
void ListItem::mousePressEvent(QMouseEvent *event)
{
qDebug()<<"[ListItem]"<<"mousePressEvent";
if (event->button() == Qt::LeftButton) {
onNetButtonClicked();
} else if (event->button() == Qt::RightButton) {
if (event->button() == Qt::RightButton) {
onRightButtonClicked();
}
return QFrame::mousePressEvent(event);
}
void ListItem::mouseReleaseEvent(QMouseEvent *event)
{
qDebug()<<"[ListItem]"<<"mouseReleaseEvent";
if (event->button() == Qt::LeftButton) {
onNetButtonClicked();
}
return QFrame::mouseReleaseEvent(event);
}
void ListItem::enterEvent(QEvent *event)
{
// QPalette pal = qApp->palette();

View File

@ -98,6 +98,7 @@ public:
protected:
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
void enterEvent(QEvent *event);
void leaveEvent(QEvent *event);
void paintEvent(QPaintEvent *event);

View File

@ -159,7 +159,7 @@ void MainWindow::firstlyStart()
initDbusConnnect();
initWindowTheme();
initTrayIcon();
initPlatform();
// initPlatform();
installEventFilter(this);
m_secondaryStartTimer = new QTimer(this);
connect(m_secondaryStartTimer, &QTimer::timeout, this, [ = ]() {
@ -442,7 +442,6 @@ void MainWindow::initDbusConnnect()
*/
void MainWindow::resetWindowPosition()
{
if (m_isShowInCenter) {
QRect availableGeometry = qApp->primaryScreen()->availableGeometry();
QRect rect((availableGeometry.width() - this->width())/2, (availableGeometry.height() - this->height())/2,
@ -1048,6 +1047,12 @@ void MainWindow::getWirelessDeviceCap(QMap<QString, int> &map)
m_wlanWidget->getWirelessDeviceCap(map);
}
//有线连接删除
void MainWindow::deleteWired(const QString &connUuid)
{
m_lanWidget->deleteWired(connUuid);
}
//有线连接断开
void MainWindow::activateWired(const QString& devName, const QString& connUuid)
{

View File

@ -84,6 +84,8 @@ public:
//获取热点ActivePath
void getActiveConnectionPath(QString &path, QString uuid);
//有线连接删除
void deleteWired(const QString &connUuid);
//有线连接断开
void activateWired(const QString& devName, const QString& connUuid);
void deactivateWired(const QString& devName, const QString& connUuid);

View File

@ -1150,7 +1150,7 @@ bool NetDetail::updateConnect()
}
}
if (ipv4Change || ipv6Change || securityChange || ipv4Page->checkDnsSettingsIsChanged()) {
if (ipv4Change || ipv6Change || securityChange/* || ipv4Page->checkDnsSettingsIsChanged()*/) {
if (isActive) {
//信息变化 断开-重连 更新需要時間 不可以立即重連
// sleep(1);

View File

@ -1181,6 +1181,15 @@ void LanPage::setWiredDeviceEnable(const QString& devName, bool enable)
m_deviceResource->setDeviceManaged(devName, enable);
}
void LanPage::deleteWired(const QString &connUuid)
{
qDebug() << "[LanPage] deleteWired" << connUuid;
if (connUuid == nullptr) {
return;
}
m_wiredConnectOperation->deleteWiredConnect(connUuid);
}
bool LanPage::eventFilter(QObject *watched, QEvent *event)
{
if (watched == m_settingsLabel) {

View File

@ -48,6 +48,7 @@ public:
void deactivateWired(const QString& devName, const QString& connUuid);
void showDetailPage(QString devName, QString uuid);
void setWiredDeviceEnable(const QString& devName, bool enable);
void deleteWired(const QString &connUuid);
bool lanIsConnected();
void getWiredDeviceConnectState(QMap<QString, QString> &map);

View File

@ -146,10 +146,11 @@ int main(int argc, char *argv[])
QDBusReply<uint> pid = interface1->servicePid(serviceName);
qDebug() << "current display " << getenv("DISPLAY") << QApplication::applicationPid()
<< "exist kylin-nm display" << displayFromPid(pid.value());
if (getenv("DISPLAY") != displayFromPid(pid.value())) {
return 0;
if (getenv("DISPLAY") == displayFromPid(pid.value())) {
interface.call(QStringLiteral("showKylinNM"), 2);
}
}
return 0;
}
QThread *thread = new QThread();