Merge branch 'networkmode' into 'dbus-interface'

Fix bug 140550  140401

See merge request kylin-desktop/kylin-nm!709
This commit is contained in:
陈学超 2022-09-22 01:35:55 +00:00
commit 7d9820e838
2 changed files with 17 additions and 2 deletions

View File

@ -27,6 +27,7 @@ FirewallDialog::FirewallDialog(KDialog *parent)
this->setWindowIcon(QIcon::fromTheme("kylin-network"));
this->setFixedSize(480, 204);
setAttribute(Qt::WA_DeleteOnClose);
centerToScreen();
}
FirewallDialog::~FirewallDialog()
@ -84,6 +85,17 @@ void FirewallDialog::initUI()
this->closeButton();
this->mainWidget()->setLayout(m_dialogLayout);
connect(m_YesBtn, &QPushButton::clicked, this, &FirewallDialog::setPrivateNetMode);
connect(m_NoBtn, &QPushButton::clicked, this, &FirewallDialog::setPublicNetMode);
connect(m_YesBtn, &QPushButton::clicked, this, &FirewallDialog::setPublicNetMode);
connect(m_NoBtn, &QPushButton::clicked, this, &FirewallDialog::setPrivateNetMode);
}
void FirewallDialog::centerToScreen()
{
QDesktopWidget* m = QApplication::desktop();
QRect desk_rect = m->screenGeometry(m->screenNumber(QCursor::pos()));
int desk_x = desk_rect.width();
int desk_y = desk_rect.height();
int x = this->width();
int y = this->height();
this->move(desk_x / 2 - x / 2 + desk_rect.left(), desk_y / 2 - y / 2 + desk_rect.top());
}

View File

@ -24,6 +24,8 @@
#include <QHBoxLayout>
#include <QFormLayout>
#include <QLabel>
#include <QDesktopWidget>
#include <QApplication>
#include "kwidget.h"
#include "kdialog.h"
@ -41,6 +43,7 @@ public:
private:
void initUI();
void centerToScreen();
QString m_uuid;
QLabel * m_iconLabel = nullptr;
QLabel * m_contentLabel = nullptr;