Merge branch 'up-dbus' into 'dbus-interface'

change kylin-network-manager to kylin-nm

See merge request kylin-desktop/kylin-nm!350
This commit is contained in:
ren peijia 2021-10-25 07:55:11 +00:00
commit b447f6a122
7 changed files with 50 additions and 7 deletions

View File

@ -2,7 +2,7 @@
set -e
PROGRAM=$(dpkg-divert --truename /usr/bin/kylin-network-manager)
PROGRAM=$(dpkg-divert --truename /usr/bin/kylin-nm)
if setcap cap_net_raw+ep $PROGRAM; then
chmod u-s $PROGRAM

View File

@ -172,7 +172,8 @@ void WlanListItem::initWlanUI()
{
m_hasPwd = (m_wirelessNetItem.m_secuType.isEmpty() || m_wirelessNetItem.m_secuType == "") ? false : true;
//设置显示的Wlan名称
this->setName((m_wirelessNetItem.m_connName != "") ? m_wirelessNetItem.m_connName : m_wirelessNetItem.m_NetSsid);
// this->setName((m_wirelessNetItem.m_connName != "") ? m_wirelessNetItem.m_connName : m_wirelessNetItem.m_NetSsid);
this->setName(m_wirelessNetItem.m_NetSsid);
//刷新左侧按钮图标
refreshIcon();

View File

@ -1,4 +1,5 @@
#include "creatnetpage.h"
#include "math.h"
#define MAX_NAME_LENGTH 32
@ -89,7 +90,7 @@ bool CreatNetPage::checkConnectBtnIsEnabled()
return false;
}
if (netMaskEdit->text().isEmpty() || !getTextEditState(netMaskEdit->text())) {
if (netMaskEdit->text().isEmpty() || !netMaskIsValide(netMaskEdit->text())) {
qDebug() << "create ipv4 netMask empty or invalid";
return false;
}
@ -164,7 +165,7 @@ void CreatNetPage::constructIpv4Info(KyConnectSetting &setting)
{
setting.m_connectName = connNameEdit->text();
QString ipv4address =ipv4addressEdit->text();
QString netMask = netMaskEdit->text();
QString netMask = getNetMaskText(netMaskEdit->text());
QString gateWay = gateWayEdit->text();
qDebug() << "constructIpv4Info: " << "ipv4address " << ipv4address
<< " netMask " << netMask
@ -186,3 +187,41 @@ void CreatNetPage::constructIpv4Info(KyConnectSetting &setting)
}
}
bool CreatNetPage::netMaskIsValide(QString text)
{
if (getTextEditState(text)) {
return true;
} else {
if (text.length() > 0 && text.length() < 3) {
int num = text.toInt();
if (num > 0 && num < 33) {
return true;
}
}
}
return false;
}
QString CreatNetPage::getNetMaskText(QString text)
{
if (text.length() > 2) {
return text;
}
int num = text.toInt();
QStringList list;
list << "0" << "0" << "0" << "0";
int count = 0;
while (num - 8 >= 0) {
list[count] = "255";
num = num - 8;
count ++;
}
if (num > 0) {
int size = pow(2, 8) - pow(2,(8-num));
list[count] = QString::number(size);
}
return QString("%1.%2.%3.%4").arg(list[0],list[1],list[2],list[3]);
}

View File

@ -48,6 +48,9 @@ private:
bool getTextEditState(QString text);
bool checkConnectBtnIsEnabled();
bool netMaskIsValide(QString text);
QString getNetMaskText(QString text);
private slots:
void setEnableOfSaveBtn();
void configChanged(int index);

View File

@ -1237,7 +1237,7 @@ void WlanPage::showDetailPage(QString devName, QString ssid)
bool isActive = m_connectResource->isActivatedConnection(wirelessNetItem.m_connectUuid);
NetDetail *netDetail = new NetDetail(devName, ssid, wirelessNetItem.m_connectUuid, isActive, true, false, this);
NetDetail *netDetail = new NetDetail(devName, ssid, wirelessNetItem.m_connectUuid, isActive, true, !wirelessNetItem.m_isConfigured, this);
netDetail->show();
return;

View File

@ -8,7 +8,7 @@ Icon=gnome-dev-ethernet
Comment=Beautiful Network Config Applet
Comment[zh_CN]=麒麟网络设置工具,提供查看和简单设置功能,拥有美观的界面和舒适的操作.
Keywords=applet;nm;network;network-manager;
Exec=/usr/bin/kylin-network-manager
Exec=/usr/bin/kylin-nm
StartupNotify=false
Terminal=false
Type=Application

View File

@ -8,7 +8,7 @@ QT += core gui x11extras dbus KWindowSystem svg concurrent network
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = kylin-network-manager
TARGET = kylin-nm
TEMPLATE = app
CONFIG += c++14 qt warn_on link_pkgconfig