!13 kylin nm right click menu in Chinese editing network settings

From: @hua_yadong
Reviewed-by: @dou33
Signed-off-by: @dou33
This commit is contained in:
openeuler-ci-bot 2021-12-10 06:25:17 +00:00 committed by Gitee
commit 7bdc39e6d5
2 changed files with 141 additions and 1 deletions

View File

@ -0,0 +1,135 @@
From e7bc75d3a9334f56ff0906ad98cbff148b0a5c57 Mon Sep 17 00:00:00 2001
From: huayadong <huayadong@kylinos.cn>
Date: Fri, 10 Dec 2021 10:37:51 +0800
Subject: [PATCH] right click menu in Chinese editing network settings
---
src/confform.cpp | 10 +++++++++-
src/confform.h | 3 ++-
src/confform.ui | 3 +++
src/mainwindow.cpp | 3 ++-
src/oneconnform.cpp | 2 +-
src/onelancform.cpp | 2 +-
6 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/src/confform.cpp b/src/confform.cpp
index f0c04ce..d62cbb4 100755
--- a/src/confform.cpp
+++ b/src/confform.cpp
@@ -30,7 +30,7 @@
extern QString llname, lwname;
ConfForm::ConfForm(QWidget *parent) :
- QWidget(parent),
+ QDialog(parent),
ui(new Ui::ConfForm)
{
ui->setupUi(this);
@@ -92,6 +92,12 @@ ConfForm::ConfForm(QWidget *parent) :
// ui->btnCancel->setStyleSheet(btnOffQss);
// ui->btnOk->setStyleSheet(btnOnQss);
// ui->btnCreate->setStyleSheet(btnOnQss);
+ ui->leAddr->setContextMenuPolicy(Qt::NoContextMenu);
+ ui->leName->setContextMenuPolicy(Qt::NoContextMenu);
+ ui->leDns->setContextMenuPolicy(Qt::NoContextMenu);
+ ui->leDns2->setContextMenuPolicy(Qt::NoContextMenu);
+ ui->leGateway->setContextMenuPolicy(Qt::NoContextMenu);
+
ui->lineUp->setStyleSheet(lineQss);
ui->lineDown->setStyleSheet(lineQss);
ui->lineUp->hide();
@@ -148,6 +154,7 @@ void ConfForm::mousePressEvent(QMouseEvent *event)
this->dragPos = event->globalPos();
event->accept();
}
+ return QDialog::mousePressEvent(event);
}
void ConfForm::mouseReleaseEvent(QMouseEvent *event)
{
@@ -159,6 +166,7 @@ void ConfForm::mouseMoveEvent(QMouseEvent *event)
this->move(this->winPos - (this->dragPos - event->globalPos()));
event->accept();
}
+ return QDialog::mouseMoveEvent(event);
}
//网络配置参数设置界面的显示内容
diff --git a/src/confform.h b/src/confform.h
index e29cdd2..b40d2c2 100755
--- a/src/confform.h
+++ b/src/confform.h
@@ -25,13 +25,14 @@
#include <QPoint>
#include <QPainter>
#include <QPainterPath>
+#include <QDialog>
#include <QListView>
namespace Ui {
class ConfForm;
}
-class ConfForm : public QWidget
+class ConfForm : public QDialog
{
Q_OBJECT
diff --git a/src/confform.ui b/src/confform.ui
index 3b117a5..a312a94 100755
--- a/src/confform.ui
+++ b/src/confform.ui
@@ -13,6 +13,9 @@
<property name="windowTitle">
<string/>
</property>
+ <property name="toolTip">
+ <string/>
+ </property>
<widget class="QWidget" name="centralWidget" native="true">
<property name="geometry">
<rect>
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 6461855..7d9bfdf 100755
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -1871,9 +1871,10 @@ void MainWindow::onBtnCreateNetClicked()
QApplication::setQuitOnLastWindowClosed(false);
ConfForm *m_cf = new ConfForm();
+ m_cf->setAttribute(Qt::WA_DeleteOnClose);
m_cf->cbTypeChanged(3);
m_cf->move(primaryGeometry.width() / 2 - m_cf->width() / 2, primaryGeometry.height() / 2 - m_cf->height() / 2);
- m_cf->show();
+ m_cf->exec();
}
diff --git a/src/oneconnform.cpp b/src/oneconnform.cpp
index aa6a97d..fde19c4 100755
--- a/src/oneconnform.cpp
+++ b/src/oneconnform.cpp
@@ -653,7 +653,7 @@ void OneConnForm::on_btnInfo_clicked()
cf->setProp(ui->lbName->text(), v4method, addr, mask, gateway, dns, this->isActive);
cf->move(primaryGeometry.width() / 2 - cf->width() / 2, primaryGeometry.height() / 2 - cf->height() / 2);
- cf->show();
+ cf->exec();
cf->raise();
bt->deleteLater();
diff --git a/src/onelancform.cpp b/src/onelancform.cpp
index 5dd6634..3d03baf 100755
--- a/src/onelancform.cpp
+++ b/src/onelancform.cpp
@@ -373,7 +373,7 @@ void OneLancForm::on_btnInfo_clicked()
connect(cf, SIGNAL(requestRefreshLanList(int)), mw, SLOT(onBtnNetListClicked(int)));
cf->move(primaryGeometry.width() / 2 - cf->width() / 2, primaryGeometry.height() / 2 - cf->height() / 2);
- cf->show();
+ cf->exec();
cf->raise();
cf->activateWindow();
}
--
2.30.0

View File

@ -1,6 +1,6 @@
Name: kylin-nm
Version: 3.0.2
Release: 5
Release: 6
Summary: Gui Applet tool for display and edit network simply
License: GPL-3+
URL: https://github.com/ukui/kylin-nm/
@ -9,6 +9,7 @@ Source0: %{name}-%{version}.tar.gz
Patch0: fix-desktop-notification-window-show-error.patch
Patch1: 0001-fix-bug-closing-settings-window-causes-the-main-proc.patch
Patch2: Fix-bug-closing-the-settings-window-causes-the-main-process-to-exit-2.patch
Patch3: kylin-nm-right-click-menu-in-Chinese-editing-network-settings.patch
BuildRequires: qt5-qtbase-devel
BuildRequires: qtchooser
@ -31,6 +32,7 @@ Requires: network-manager-applet
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%build
%{qmake_qt5} %{_qt5_qmake_flags} CONFIG+=enable-by-default kylin-nm.pro
@ -57,6 +59,9 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/man1/kylin-nm.1.gz
%changelog
* Fri Dec 10 2021 huayadong <huayadong@kylinos.cn> - 3.0.2-6
- add patch:kylin-nm-right-click-menu-in-Chinese-editing-network-settings.patch
* Tue Dec 07 2021 huayadong <huayadong@kylinos.cn> - 3.0.2-5
- add patch:Fix-bug-closing-the-settings-window-causes-the-main-process-to-exit-1104.patch