diff --git a/0001-fix-bug-closing-settings-window-causes-the-main-proc.patch b/0001-fix-bug-closing-settings-window-causes-the-main-proc.patch new file mode 100644 index 0000000..c0dc737 --- /dev/null +++ b/0001-fix-bug-closing-settings-window-causes-the-main-proc.patch @@ -0,0 +1,198 @@ +From bec5f07f273ec5427730c13a9c64cd5b24d2c3ac Mon Sep 17 00:00:00 2001 +From: dou33 +Date: Thu, 28 Oct 2021 14:48:57 +0800 +Subject: [PATCH] fix bug closing settings window causes the main process to + exit + +--- + src/confform.cpp | 14 +++++++++++++- + src/confform.h | 3 ++- + src/confform.ui | 3 +++ + src/mainwindow.cpp | 5 ++++- + wireless-security/dlgconnhidwifi.cpp | 6 ++++-- + wireless-security/dlgconnhidwifiwpa.cpp | 4 +++- + 6 files changed, 29 insertions(+), 6 deletions(-) + +diff --git a/src/confform.cpp b/src/confform.cpp +index a83fc34..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); + } + + //网络配置参数设置界面的显示内容 +@@ -213,6 +221,7 @@ void ConfForm::on_btnCreate_clicked() + if (mIfname == "") { + QString tip(tr("Can not create new wired network for without wired card")); + kylindbus.showDesktopNotify(tip); ++ //this->close(); + this->hide(); + return; + } +@@ -231,6 +240,7 @@ void ConfForm::on_btnCreate_clicked() + kylindbus.showDesktopNotify(txt); + } + ++ //this->close(); + this->hide(); + } + +@@ -265,6 +275,7 @@ void ConfForm::on_btnOk_clicked() + + KylinDBus kylindbus; + ++ //this->close(); + this->hide(); + + QString txt(tr("New network settings already finished")); +@@ -293,6 +304,7 @@ void ConfForm::on_btnOk_clicked() + //点击取消按钮 + void ConfForm::on_btnCancel_clicked() + { ++ //this->close(); + this->hide(); + } + +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 + #include + #include ++#include + #include + + 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 @@ + + + ++ ++ ++ + + + +diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp +index 78fa74f..7d9bfdf 100755 +--- a/src/mainwindow.cpp ++++ b/src/mainwindow.cpp +@@ -84,6 +84,7 @@ MainWindow::MainWindow(QWidget *parent) : + + objNetSpeed = new NetworkSpeed(); + ++ QApplication::setQuitOnLastWindowClosed(false); + this->confForm = new ConfForm(); + + this->ksnm = new KSimpleNM(); +@@ -1868,10 +1869,12 @@ void MainWindow::onBtnCreateNetClicked() + primaryGeometry = qApp->primaryScreen()->geometry(); + } + ++ 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/wireless-security/dlgconnhidwifi.cpp b/wireless-security/dlgconnhidwifi.cpp +index 7cb1f75..f38a88f 100755 +--- a/wireless-security/dlgconnhidwifi.cpp ++++ b/wireless-security/dlgconnhidwifi.cpp +@@ -230,7 +230,8 @@ void DlgConnHidWifi::changeWindow(){ + + void DlgConnHidWifi::on_btnCancel_clicked() + { +- this->close(); ++ //this->close(); ++ this->hide(); + } + + void DlgConnHidWifi::on_btnConnect_clicked() +@@ -276,7 +277,8 @@ void DlgConnHidWifi::on_btnConnect_clicked() + connect(this, SIGNAL(sendMessage()), this,SLOT(emitSignal() )); + QTimer::singleShot(4*1000, this, SLOT(emitSignal() )); + } +- this->close(); ++ //this->close(); ++ this->hide(); + } + + void DlgConnHidWifi::on_leNetName_textEdited(const QString &arg1) +diff --git a/wireless-security/dlgconnhidwifiwpa.cpp b/wireless-security/dlgconnhidwifiwpa.cpp +index 022df7f..6457463 100755 +--- a/wireless-security/dlgconnhidwifiwpa.cpp ++++ b/wireless-security/dlgconnhidwifiwpa.cpp +@@ -244,7 +244,8 @@ void DlgConnHidWifiWpa::changeWindow() + + void DlgConnHidWifiWpa::on_btnCancel_clicked() + { +- this->close(); ++ //this->close(); ++ this->hide(); + } + + void DlgConnHidWifiWpa::on_btnConnect_clicked() +@@ -289,6 +290,7 @@ void DlgConnHidWifiWpa::on_btnConnect_clicked() + QTimer::singleShot(4*1000, this, SLOT(emitSignal() )); + } + this->close(); ++ this->hide(); + } + + void DlgConnHidWifiWpa::on_checkBoxPwd_stateChanged(int arg1) +-- +2.24.3 (Apple Git-128) + diff --git a/kylin-nm.spec b/kylin-nm.spec index 16dd817..2c33102 100644 --- a/kylin-nm.spec +++ b/kylin-nm.spec @@ -1,12 +1,13 @@ Name: kylin-nm Version: 3.0.2 -Release: 3 +Release: 4 Summary: Gui Applet tool for display and edit network simply License: GPL-3+ URL: https://github.com/ukui/kylin-nm/ 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 BuildRequires: qt5-qtbase-devel BuildRequires: qtchooser @@ -27,6 +28,7 @@ Requires: network-manager-applet %prep %setup -q %patch0 -p1 +%patch1 -p1 %build %{qmake_qt5} %{_qt5_qmake_flags} CONFIG+=enable-by-default kylin-nm.pro @@ -53,6 +55,9 @@ rm -rf $RPM_BUILD_ROOT %{_mandir}/man1/kylin-nm.1.gz %changelog +* Thu Oct 28 2021 douyan - 3.0.2-4 +- fix bug closing settings window causes the main process to exit + * Tue Oct 26 2021 douyan - 3.0.2-3 - add Patch:fix-desktop-notification-window-show-error.patch