merge:合并最新代码

This commit is contained in:
jzxc95 2023-11-13 14:05:05 +08:00
commit 569963c2ac
43 changed files with 2846 additions and 504 deletions

6
debian/changelog vendored
View File

@ -1,3 +1,9 @@
kylin-nm (4.0.0.0-ok8.2) yangtze; urgency=medium
* issue #I7GT8M #I7GST6 #I7YPFI #I73HNK #I72PU4
-- zhaoshixu <zhaoshixu@kylinos.cn> Tue, 26 Sep 2023 14:58:15 +0800
kylin-nm (4.0.0.0-ok8.1) yangtze; urgency=medium
* rebuild with no changes.

View File

@ -21,7 +21,7 @@
#include <QDebug>
#include <QVariant>
MobileHotspot::MobileHotspot() : mFirstLoad(true) {
@ -113,23 +113,31 @@ bool MobileHotspot::isExitWirelessDevice()
return false;
}
QDBusMessage result = interface->call(QStringLiteral("getDeviceListAndEnabled"),1);
if(result.type() == QDBusMessage::ErrorMessage) {
qWarning() << "getWirelessDeviceList error:" << result.errorMessage();
QDBusReply<QVariantMap> reply = interface->call(QStringLiteral("getDeviceListAndEnabled"),1);
if(!reply.isValid()) {
qWarning() << "getWirelessDeviceList error:" << reply.error().message();
return false;
}
auto dbusArg = result.arguments().at(0).value<QDBusArgument>();
QMap<QString, bool> deviceListMap;
dbusArg >> deviceListMap;
QVariantMap::const_iterator itemIter = reply.value().cbegin();
while (itemIter != reply.value().cend()) {
deviceListMap.insert(itemIter.key(), itemIter.value().toBool());
itemIter ++;
}
QDBusReply<QMap<QString, int> > capReply = interface->call("getWirelessDeviceCap");
QDBusReply<QVariantMap> capReply = interface->call("getWirelessDeviceCap");
if (!capReply.isValid()) {
qDebug()<<"execute dbus method 'getWirelessDeviceCap' is invalid in func initInterfaceInfo()" <<capReply.error().type() ;
return false;
}
QMap<QString, int> devCapMap = capReply.value();
QMap<QString, int> devCapMap;
QVariantMap::const_iterator item = reply.value().cbegin();
while (item != reply.value().cend()) {
devCapMap.insert(item.key(), item.value().toInt());
item ++;
}
if (deviceListMap.isEmpty()) {
qDebug() << "no wireless device";

View File

@ -316,28 +316,23 @@ void MobileHotspotWidget::onInterfaceChanged()
{
m_interfaceName = m_interfaceComboBox->currentText();
if(m_interface->isValid()) {
QDBusMessage result = m_interface->call(QStringLiteral("getWirelessList"));
if(result.type() == QDBusMessage::ErrorMessage)
QDBusReply<QVariantList> reply = m_interface->call(QStringLiteral("getWirelessList"), m_interfaceName);
if(!reply.isValid())
{
qWarning() << "getWirelessList error:" << result.errorMessage();
qWarning() << "getWirelessList error:" << reply.error().message();
return;
}
bool flag = false;
auto dbusArg = result.arguments().at(0).value<QDBusArgument>();
QMap<QString, QVector<QStringList>> variantList;
dbusArg >> variantList;
if (variantList.size() != 0) {
QMap<QString, QVector<QStringList>>::iterator iter;
for (iter = variantList.begin(); iter != variantList.end(); iter++) {
if (m_interfaceName == iter.key()) {
QVector<QStringList> wlanListInfo = iter.value();
if (!wlanListInfo.isEmpty() && wlanListInfo.at(0).size() > 1) {
QList<QStringList> variantList;
for (int j = 0; j < reply.value().size(); ++j) {
variantList << reply.value().at(j).toStringList();
}
if (!variantList.isEmpty() && variantList.at(0).size() > 1) {
flag = true;
}
break;
}
}
}
if (flag) {
m_interfaceWarnLabel->setText(tr("use ") + m_interfaceName +
tr(" share network, will interrupt local wireless connection"));
@ -392,22 +387,32 @@ void MobileHotspotWidget::initInterfaceInfo()
m_interfaceComboBox->hidePopup();
}
m_interfaceComboBox->clear();
QDBusReply<QMap<QString, bool> > reply = m_interface->call("getDeviceListAndEnabled",WIRELESS);
QDBusReply<QVariantMap> reply = m_interface->call(QStringLiteral("getDeviceListAndEnabled"),WIRELESS);
if(!reply.isValid()) {
qDebug() << LOG_HEAD <<"execute dbus method 'getDeviceListAndEnabled' is invalid in func initInterfaceInfo()";
setWidgetHidden(true);
qWarning() << "[WlanConnect]getWirelessDeviceList error:" << reply.error().message();
return;
}
QMap<QString, bool> devMap = reply.value();
QDBusReply<QMap<QString, int> > capReply = m_interface->call("getWirelessDeviceCap");
QMap<QString, bool> devMap;
QVariantMap::const_iterator item = reply.value().cbegin();
while (item != reply.value().cend()) {
devMap.insert(item.key(), item.value().toBool());
item ++;
}
QDBusReply<QVariantMap> capReply = m_interface->call("getWirelessDeviceCap");
if (!capReply.isValid()) {
qDebug() << LOG_HEAD <<"execute dbus method 'getWirelessDeviceCap' is invalid in func initInterfaceInfo()" <<capReply.error().type() ;
setWidgetHidden(true);
return;
}
QMap<QString, int> devCapMap = capReply.value();
QMap<QString, int> devCapMap;
QVariantMap::const_iterator itemIter = capReply.value().cbegin();
while (itemIter != capReply.value().cend()) {
devCapMap.insert(itemIter.key(), itemIter.value().toInt());
itemIter ++;
}
if (devMap.isEmpty()) {
qDebug() << LOG_HEAD << "no wireless device";
@ -827,7 +832,7 @@ void MobileHotspotWidget::updateBandCombox()
{
QString tmp = m_freqBandComboBox->currentText();
m_freqBandComboBox->clear();
QDBusReply<QMap<QString, int> > capReply = m_interface->call("getWirelessDeviceCap");
QDBusReply<QVariantMap> capReply = m_interface->call("getWirelessDeviceCap");
if (!capReply.isValid()) {
qDebug()<<"execute dbus method 'getWirelessDeviceCap' is invalid in func initInterfaceInfo()" << capReply.error().message();
setWidgetHidden(true);
@ -835,7 +840,14 @@ void MobileHotspotWidget::updateBandCombox()
}
m_isUserSelect = false;
QMap<QString, int> devCapMap = capReply.value();
QMap<QString, int> devCapMap;
QVariantMap::const_iterator itemIter = capReply.value().cbegin();
while (itemIter != capReply.value().cend()) {
devCapMap.insert(itemIter.key(), itemIter.value().toInt());
itemIter ++;
}
if (devCapMap[m_interfaceName] & 0x02) {
m_freqBandComboBox->addItem("2.4GHz");
}

View File

@ -76,6 +76,9 @@ void NetConnect::showDesktopNotify(const QString &message)
NetConnect::NetConnect() : mFirstLoad(true) {
qDBusRegisterMetaType<QStringList>();
qDBusRegisterMetaType<QList<QStringList>>();
QTranslator* translator = new QTranslator(this);
translator->load("/usr/share/kylin-nm/netconnect/" + QLocale::system().name());
QApplication::installTranslator(translator);
@ -83,7 +86,15 @@ NetConnect::NetConnect() : mFirstLoad(true) {
pluginName = tr("LAN");
pluginType = NETWORK;
needLoad = isExitWiredDevice();
m_interface = new QDBusInterface("com.kylin.network",
"/com/kylin/network",
"com.kylin.network",
QDBusConnection::sessionBus());
if(!m_interface->isValid()) {
qWarning() << qPrintable(QDBusConnection::sessionBus().lastError().message());
}
updatePluginShowSettings();
connect(m_interface, SIGNAL(deviceStatusChanged()), this, SLOT(updatePluginShowSettings()),Qt::QueuedConnection);
}
NetConnect::~NetConnect() {
@ -111,7 +122,7 @@ QWidget *NetConnect::pluginUi() {
pluginWidget = new QWidget;
pluginWidget->setAttribute(Qt::WA_DeleteOnClose);
ui->setupUi(pluginWidget);
qDBusRegisterMetaType<QVector<QStringList>>();
m_interface = new QDBusInterface("com.kylin.network",
"/com/kylin/network",
"com.kylin.network",
@ -119,6 +130,9 @@ QWidget *NetConnect::pluginUi() {
if(!m_interface->isValid()) {
qWarning() << qPrintable(QDBusConnection::sessionBus().lastError().message());
}
qDBusRegisterMetaType<QVector<QStringList>>();
initSearchText();
initComponent();
}
@ -132,7 +146,54 @@ const QString NetConnect::name() const {
bool NetConnect::isEnable() const
{
return needLoad;
//get isEnable
QDBusInterface dbus("com.kylin.network", "/com/kylin/network",
"com.kylin.network",
QDBusConnection::sessionBus());
if (!dbus.isValid()) {
return false;
}
QMap<QString,bool> map;
QDBusReply<QVariantMap> reply = dbus.call(QStringLiteral("getDeviceListAndEnabled"),0);
if(!reply.isValid())
{
qWarning() << "[NetConnect]getWiredDeviceList error:" << reply.error().message();
return false;
}
QVariantMap::const_iterator item = reply.value().cbegin();
while (item != reply.value().cend()) {
map.insert(item.key(), item.value().toBool());
item ++;
}
bool isEnabled = !map.isEmpty();
const QByteArray schema("org.ukui.control-center.plugins");
if (QGSettings::isSchemaInstalled(schema)) {
return isEnabled;
}
//get gsettings
QGSettings *showSettings;
QString path("/org/ukui/control-center/plugins/netconnect/");
showSettings = new QGSettings(schema, path.toUtf8());
QVariant enabledState = showSettings->get("show");
//set gsettings
if (!enabledState.isValid() || enabledState.isNull()) {
qWarning() << "QGSettins get plugin show status error";
} else {
if (enabledState.toBool() != isEnabled) {
showSettings->set("show", isEnabled);
}
}
delete showSettings;
showSettings = nullptr;
return isEnabled;
}
@ -156,7 +217,8 @@ void NetConnect::initSearchText() {
ui->detailBtn->setText(tr("Advanced settings"));
ui->titleLabel->setText(tr("LAN"));
//~ contents_path /netconnect/open
ui->openLabel->setText(tr("open"));
tr("open");
ui->openLabel->setText(tr("LAN"));
}
bool NetConnect::eventFilter(QObject *w, QEvent *e) {
@ -255,16 +317,21 @@ void NetConnect::getDeviceStatusMap(QMap<QString, bool> &map)
if (m_interface == nullptr || !m_interface->isValid()) {
return;
}
map.clear();
qDebug() << "[NetConnect]call getDeviceListAndEnabled" << __LINE__;
QDBusMessage result = m_interface->call(QStringLiteral("getDeviceListAndEnabled"),0);
QDBusReply<QVariantMap> reply = m_interface->call(QStringLiteral("getDeviceListAndEnabled"),0);
qDebug() << "[NetConnect]call getDeviceListAndEnabled Respond" << __LINE__;
if(result.type() == QDBusMessage::ErrorMessage)
if(!reply.isValid())
{
qWarning() << "[NetConnect]getWiredDeviceList error:" << result.errorMessage();
qWarning() << "[NetConnect]getWiredDeviceList error:" << reply.error().message();
return;
}
auto dbusArg = result.arguments().at(0).value<QDBusArgument>();
dbusArg >> map;
QVariantMap::const_iterator item = reply.value().cbegin();
while (item != reply.value().cend()) {
map.insert(item.key(), item.value().toBool());
item ++;
}
}
//lanUpdate
@ -406,26 +473,17 @@ void NetConnect::initNetListFromDevice(QString deviceName)
if (m_interface == nullptr || !m_interface->isValid()) {
return;
}
qDebug() << "[NetConnect]call getWiredList" << __LINE__;
QDBusMessage result = m_interface->call(QStringLiteral("getWiredList"));
qDebug() << "[NetConnect]call getWiredList respond" << __LINE__;
if(result.type() == QDBusMessage::ErrorMessage)
{
qWarning() << "getWiredList error:" << result.errorMessage();
return;
}
auto dbusArg = result.arguments().at(0).value<QDBusArgument>();
QMap<QString, QVector<QStringList>> variantList;
dbusArg >> variantList;
QMap<QString, QList<QStringList>> variantList = getWiredList();
if (variantList.size() == 0) {
qDebug() << "[NetConnect]initNetListFromDevice " << deviceName << " list empty";
return;
}
QMap<QString, QVector<QStringList>>::iterator iter;
QMap<QString, QList<QStringList>>::iterator iter;
for (iter = variantList.begin(); iter != variantList.end(); iter++) {
if (deviceName == iter.key()) {
QVector<QStringList> wlanListInfo = iter.value();
QList<QStringList> wlanListInfo = iter.value();
//处理列表 已连接
qDebug() << "[NetConnect]initNetListFromDevice " << deviceName << " acitved lan " << wlanListInfo.at(0);
addLanItem(deviceFrameMap[deviceName], deviceName, wlanListInfo.at(0), true);
@ -513,22 +571,25 @@ void NetConnect::addDeviceFrame(QString devName)
qDebug() << "[NetConnect]addDeviceFrame " << devName;
qDebug() << "[NetConnect]call getDeviceListAndEnabled" << __LINE__;
QDBusMessage result = m_interface->call(QStringLiteral("getDeviceListAndEnabled"),0);
QDBusReply<QVariantMap> reply = m_interface->call(QStringLiteral("getDeviceListAndEnabled"),0);
qDebug() << "[NetConnect]call getDeviceListAndEnabled Respond" << __LINE__;
if(result.type() == QDBusMessage::ErrorMessage)
{
qWarning() << "[NetConnect]getWiredDeviceList error:" << result.errorMessage();
if(!reply.isValid()) {
qWarning() << "[NetConnect]getWiredDeviceList error:" << reply.error().message();
return;
}
auto dbusArg = result.arguments().at(0).value<QDBusArgument>();
QMap<QString,bool> map;
dbusArg >> map;
QVariantMap::const_iterator item = reply.value().cbegin();
while (item != reply.value().cend()) {
map.insert(item.key(), item.value().toBool());
item ++;
}
bool enable = true;
if (map.contains(devName)) {
enable = map[devName];
}
ItemFrame *itemFrame = new ItemFrame(devName, pluginWidget);
ui->availableLayout->addWidget(itemFrame);
itemFrame->deviceFrame->deviceLabel->setText(tr("card")+/*QString("%1").arg(count)+*/""+devName);
@ -926,17 +987,9 @@ int NetConnect::getInsertPos(QString connName, QString deviceName)
if(m_interface == nullptr || !m_interface->isValid()) {
index = 0;
} else {
qDebug() << "[NetConnect]call getWiredList" << __LINE__;
QDBusMessage result = m_interface->call(QStringLiteral("getWiredList"));
qDebug() << "[NetConnect]call getWiredList respond" << __LINE__;
if(result.type() == QDBusMessage::ErrorMessage)
{
qWarning() << "getWiredList error:" << result.errorMessage();
return 0;
}
auto dbusArg = result.arguments().at(0).value<QDBusArgument>();
QMap<QString, QVector<QStringList>> variantList;
dbusArg >> variantList;
QMap<QString, QList<QStringList>> variantList = getWiredList();
if (!variantList.contains(deviceName)) {
qDebug() << "[NetConnect] getInsertPos but " << deviceName << "not exist";
return 0;
@ -971,30 +1024,33 @@ bool NetConnect::LaunchApp(QString desktopFile)
}
}
bool NetConnect::isExitWiredDevice()
QMap<QString, QList<QStringList>> NetConnect::getWiredList()
{
QDBusInterface *interface = new QDBusInterface("com.kylin.network", "/com/kylin/network",
"com.kylin.network",
QDBusConnection::sessionBus());
if (!interface->isValid()) {
qDebug() << "/com/kylin/network is invalid";
return false;
QMap<QString, QList<QStringList>> map;
QMap<QString, bool> statusMap;
getDeviceStatusMap(statusMap);
for (int i = 0; i < statusMap.keys().size(); ++i) {
qDebug() << "[NetConnect]call getWiredList" << __LINE__;
QDBusReply<QVariantList> reply = m_interface->call(QStringLiteral("getWiredList"), statusMap.keys().at(i));
qDebug() << "[NetConnect]call getWiredList respond" << __LINE__;
if(!reply.isValid())
{
qWarning() << "getWiredList error:" << reply.error().message();
break;
}
QDBusMessage result = interface->call(QStringLiteral("getDeviceListAndEnabled"),0);
if(result.type() == QDBusMessage::ErrorMessage) {
qWarning() << "getWiredDeviceList error:" << result.errorMessage();
return false;
QList<QStringList> list;
for (int j = 0; j < reply.value().size(); ++j) {
list << reply.value().at(j).toStringList();
}
map.insert(statusMap.keys().at(i), list);
}
return map;
}
auto dbusArg = result.arguments().at(0).value<QDBusArgument>();
QMap<QString, bool> deviceListMap;
dbusArg >> deviceListMap;
if (deviceListMap.isEmpty()) {
qDebug() << "no wired device";
return false;
}
return true;
void NetConnect::updatePluginShowSettings()
{
isEnable();
}

View File

@ -147,7 +147,7 @@ private:
QMap<QString, bool> deviceStatusMap;
QMap<QString, ItemFrame *> deviceFrameMap;
bool needLoad;
QMap<QString, QList<QStringList>> getWiredList();
private slots:
void updateLanInfo(QString deviceName, QStringList lanInfo);
@ -159,6 +159,9 @@ private slots:
void onDeviceStatusChanged();
void onDeviceNameChanged(QString, QString, int);
//更新控制面板插件Gsetting show
void updatePluginShowSettings();
};
Q_DECLARE_METATYPE(QList<QDBusObjectPath>);

View File

@ -348,7 +348,7 @@ void Proxy::initUi(QWidget *widget)
mIgnoreLayout->setSpacing(10);
mIgnoreLayout->setContentsMargins(16, 0, 16, 24);
mIgnoreLabel = new QLabel(mIgnoreFrame);
mIgnoreLabel->setFixedHeight(36);
mIgnoreLabel->setWordWrap(true);
mIgnoreLineEdit = new QTextEdit(mIgnoreFrame);
mIgnoreLineEdit->setFixedHeight(120);
mIgnoreLineEdit->setStyleSheet("border-radius:6px;background-color: palette(button)");

View File

@ -143,6 +143,15 @@ WlanConnect::WlanConnect() : m_firstLoad(true) {
pluginName = tr("WLAN");
pluginType = NETWORK;
m_interface = new QDBusInterface("com.kylin.network", "/com/kylin/network",
"com.kylin.network",
QDBusConnection::sessionBus());
if(!m_interface->isValid()) {
qWarning() << qPrintable(QDBusConnection::sessionBus().lastError().message());
}
updatePluginShowSettings();
connect(m_interface, SIGNAL(wirelessDeviceStatusChanged()), this, SLOT(updatePluginShowSettings()), Qt::QueuedConnection);
}
WlanConnect::~WlanConnect()
@ -171,12 +180,14 @@ QWidget *WlanConnect::pluginUi() {
pluginWidget->setAttribute(Qt::WA_DeleteOnClose);
ui->setupUi(pluginWidget);
qDBusRegisterMetaType<QVector<QStringList>>();
qDBusRegisterMetaType<QStringList>();
m_interface = new QDBusInterface("com.kylin.network", "/com/kylin/network",
"com.kylin.network",
QDBusConnection::sessionBus());
if(!m_interface->isValid()) {
qWarning() << qPrintable(QDBusConnection::sessionBus().lastError().message());
}
initSearchText();
initComponent();
}
@ -190,7 +201,61 @@ const QString WlanConnect::name() const {
bool WlanConnect::isEnable() const
{
return true;
//get isEnable
QDBusInterface dbus("com.kylin.network", "/com/kylin/network",
"com.kylin.network",
QDBusConnection::sessionBus());
if (!dbus.isValid()) {
return false;
}
QMap<QString,bool> map;
QDBusReply<QVariantMap> reply = dbus.call(QStringLiteral("getDeviceListAndEnabled"), 1);
if(!reply.isValid())
{
qWarning() << "[NetConnect]getWiredDeviceList error:" << reply.error().message();
return false;
}
QVariantMap::const_iterator item = reply.value().cbegin();
while (item != reply.value().cend()) {
map.insert(item.key(), item.value().toBool());
item ++;
}
//筛选已托管(managed)网卡
QStringList list;
QMap<QString, bool>::iterator iters;
for (iters = map.begin(); iters != map.end(); ++iters) {
if (iters.value() == true) {
list << iters.key();
}
}
bool isEnabled = !list.isEmpty();
const QByteArray schema("org.ukui.control-center.plugins");
if (QGSettings::isSchemaInstalled(schema)) {
return isEnabled;
}
//get gsettings
QGSettings *showSettings;
QString path("/org/ukui/control-center/plugins/wlanconnect/");
showSettings = new QGSettings(schema, path.toUtf8());
QVariant enabledState = showSettings->get("show");
//set gsettings
if (!enabledState.isValid() || enabledState.isNull()) {
qWarning() << "QGSettins get plugin show status error";
} else {
if (enabledState.toBool() != isEnabled) {
showSettings->set("show", isEnabled);
}
}
delete showSettings;
showSettings = nullptr;
return isEnabled;
}
@ -214,7 +279,8 @@ void WlanConnect::initSearchText() {
ui->detailBtn->setText(tr("Advanced settings"));
ui->titleLabel->setText(tr("WLAN"));
//~ contents_path /wlanconnect/open
ui->openLabel->setText(tr("open"));
tr("open");
ui->openLabel->setText(tr("WLAN"));
}
bool WlanConnect::eventFilter(QObject *w, QEvent *e) {
@ -320,28 +386,18 @@ void WlanConnect::updateList()
}
qDebug() << "update list";
if(m_interface != nullptr && m_interface->isValid()) {
qDebug() << "[WlanConnect]call getWirelessList" << __LINE__;
QDBusMessage result = m_interface->call(QStringLiteral("getWirelessList"));
qDebug() << "[WlanConnect]call getWirelessList respond" << __LINE__;
if(result.type() == QDBusMessage::ErrorMessage)
{
qWarning() << "getWirelessList error:" << result.errorMessage();
return;
}
auto dbusArg = result.arguments().at(0).value<QDBusArgument>();
QMap<QString, QVector<QStringList>> variantList;
dbusArg >> variantList;
QMap<QString, QList<QStringList>> variantList = getWirelessList();
if (variantList.size() == 0) {
qDebug() << "[WlanConnect]updateList " << " list empty";
return;
}
QMap<QString, QVector<QStringList>>::iterator iter;
QMap<QString, QList<QStringList>>::iterator iter;
for (iter = variantList.begin(); iter != variantList.end(); iter++) {
if (deviceFrameMap.contains(iter.key())) {
QVector<QStringList> wifiList = iter.value();
QList<QStringList> wifiList = iter.value();
resortWifiList(deviceFrameMap[iter.key()], wifiList);
deviceFrameMap[iter.key()]->filletStyleChange();
}
@ -349,7 +405,7 @@ void WlanConnect::updateList()
}
}
void WlanConnect::resortWifiList(ItemFrame *frame, QVector<QStringList> list)
void WlanConnect::resortWifiList(ItemFrame *frame, QList<QStringList> list)
{
if(nullptr == frame || frame->lanItemLayout->count() <= 0 || list.isEmpty()) {
return;
@ -705,16 +761,20 @@ void WlanConnect::getDeviceList(QStringList &list)
return;
}
qDebug() << "[WlanConnect]call getDeviceListAndEnabled" << __LINE__;
QDBusMessage result = m_interface->call(QStringLiteral("getDeviceListAndEnabled"),1);
QDBusReply<QVariantMap> reply = m_interface->call(QStringLiteral("getDeviceListAndEnabled"),1);
qDebug() << "[WlanConnect]call getDeviceListAndEnabled respond" << __LINE__;
if(result.type() == QDBusMessage::ErrorMessage)
if(!reply.isValid())
{
qWarning() << "[WlanConnect]getWirelessDeviceList error:" << result.errorMessage();
qWarning() << "[WlanConnect]getWirelessDeviceList error:" << reply.error().message();
return;
}
auto dbusArg = result.arguments().at(0).value<QDBusArgument>();
QMap<QString,bool> map;
dbusArg >> map;
QVariantMap::const_iterator item = reply.value().cbegin();
while (item != reply.value().cend()) {
map.insert(item.key(), item.value().toBool());
item ++;
}
//筛选已托管(managed)网卡
QMap<QString, bool>::iterator iters;
@ -772,26 +832,20 @@ void WlanConnect::initNetListFromDevice(QString deviceName)
if (m_interface == nullptr || !m_interface->isValid()) {
return;
}
qDebug() << "[WlanConnect]call getWirelessList" << __LINE__;
QDBusMessage result = m_interface->call(QStringLiteral("getWirelessList"));
qDebug() << "[WlanConnect]call getWirelessList respond" << __LINE__;
if(result.type() == QDBusMessage::ErrorMessage)
{
qWarning() << "getWirelessList error:" << result.errorMessage();
return;
}
auto dbusArg = result.arguments().at(0).value<QDBusArgument>();
QMap<QString, QVector<QStringList>> variantList;
dbusArg >> variantList;
QMap<QString, QList<QStringList>> variantList = getWirelessList();
if (variantList.size() == 0) {
qDebug() << "[WlanConnect]initNetListFromDevice " << deviceName << " list empty";
return;
}
QMap<QString, QVector<QStringList>>::iterator iter;
QMap<QString, QList<QStringList>>::iterator iter;
for (iter = variantList.begin(); iter != variantList.end(); iter++) {
if (deviceName == iter.key()) {
QVector<QStringList> wlanListInfo = iter.value();
QList<QStringList> wlanListInfo = iter.value();
if (wlanListInfo.size() <= 0) {
break;
}
//处理列表 已连接
qDebug() << "[WlanConnect]initNetListFromDevice " << deviceName << " acitved wifi " << wlanListInfo.at(0);
addActiveItem(deviceFrameMap[deviceName], deviceName, wlanListInfo.at(0));
@ -907,21 +961,13 @@ int WlanConnect::sortWlanNet(QString deviceName, QString name, QString signal)
if (m_interface == nullptr || !m_interface->isValid()) {
return 0;
}
qDebug() << "[WlanConnect]call getWirelessList" << __LINE__;
QDBusMessage result = m_interface->call(QStringLiteral("getWirelessList"));
qDebug() << "[WlanConnect]call getWirelessList respond" << __LINE__;
if(result.type() == QDBusMessage::ErrorMessage)
{
qWarning() << "getWirelessList error:" << result.errorMessage();
return 0;
}
auto dbusArg = result.arguments().at(0).value<QDBusArgument>();
QMap<QString, QVector<QStringList>> variantList;
dbusArg >> variantList;
QMap<QString, QVector<QStringList>>::iterator iter;
QMap<QString, QList<QStringList>> variantList = getWirelessList();
QMap<QString, QList<QStringList>>::iterator iter;
for (iter = variantList.begin(); iter != variantList.end(); iter++) {
if (deviceName == iter.key()) {
QVector<QStringList> wlanListInfo = iter.value();
QList<QStringList> wlanListInfo = iter.value();
for (int i = 0; i < wlanListInfo.size(); i++) {
if (name == wlanListInfo.at(i).at(0)) {
return i;
@ -1146,3 +1192,33 @@ bool WlanConnect::LaunchApp(QString desktopFile)
return reply;
}
}
QMap<QString, QList<QStringList>> WlanConnect::getWirelessList()
{
QMap<QString, QList<QStringList>> map;
QStringList list;
getDeviceList(list);
for (int i = 0; i < list.size(); ++i) {
qDebug() << "[NetConnect]call getWirelessList" << __LINE__;
QDBusReply<QVariantList> reply = m_interface->call(QStringLiteral("getWirelessList"), list.at(i));
qDebug() << "[NetConnect]call getWirelessList respond" << __LINE__;
if(!reply.isValid())
{
qWarning() << "getWirelessList error:" << reply.error().message();
break;
}
QList<QStringList> llist;
for (int j = 0; j < reply.value().size(); ++j) {
llist << reply.value().at(j).toStringList();
}
map.insert(list.at(i), llist);
}
return map;
}
void WlanConnect::updatePluginShowSettings()
{
isEnable();
}

View File

@ -91,7 +91,7 @@ private:
int sortWlanNet(QString deviceName, QString name, QString signal);
void updateIcon(WlanItem *item, QString signalStrength, QString security, QString isApConnection, int category);
void resortWifiList(ItemFrame *frame, QVector<QStringList> list);
void resortWifiList(ItemFrame *frame, QList<QStringList> list);
//单wifi图标
@ -174,6 +174,8 @@ private:
QTimer * m_scanTimer = nullptr;
// QTimer * m_updateTimer = nullptr;
QMap<QString, QList<QStringList>> getWirelessList();
private:
KSwitchButton *m_wifiSwitch;
bool m_firstLoad;
@ -192,6 +194,7 @@ private slots:
void reScan();
//更新控制面板插件Gsetting show
void updatePluginShowSettings();
};
#endif // WLANCONNECT_H

View File

@ -3,13 +3,17 @@ include(hotspot/hotspot.pri)
include(dbus-interface/dbus-interface.pri)
HEADERS += \
$$PWD/dbusadaptor.h \
$$PWD/dbus.h \
$$PWD/dbus_adaptor.h \
$$PWD/dbus_interface.h \
$$PWD/sysdbusregister.h \
$$PWD/utils.h \
$$PWD/wifi-auth-thread.h
SOURCES += \
$$PWD/dbusadaptor.cpp \
$$PWD/dbus.cpp \
$$PWD/dbus_adaptor.cpp \
$$PWD/dbus_interface.cpp \
$$PWD/sysdbusregister.cpp \
$$PWD/utils.cpp \
$$PWD/wifi-auth-thread.cpp

View File

@ -80,6 +80,8 @@ KyConnectResourse::KyConnectResourse(QObject *parent) : QObject(parent)
connect(m_networkResourceInstance, &KyNetworkResourceManager::connectionRemove, this, &KyConnectResourse::connectionRemove);
connect(m_networkResourceInstance, &KyNetworkResourceManager::connectionUpdate, this, &KyConnectResourse::connectionUpdate);
connect(m_networkResourceInstance, &KyNetworkResourceManager::connectivityChanged, this, &KyConnectResourse::connectivityChanged);
connect(m_networkResourceInstance, &KyNetworkResourceManager::connectivityCheckSpareUriChanged, this, &KyConnectResourse::connectivityCheckSpareUriChanged);
connect(m_networkResourceInstance, &KyNetworkResourceManager::needShowDesktop, this, &KyConnectResourse::needShowDesktop);
}

View File

@ -86,6 +86,7 @@ Q_SIGNALS:
void connectionUpdate(QString uuid);
void connectionRemove(QString path);
void connectivityChanged(NetworkManager::Connectivity connectivity);
void connectivityCheckSpareUriChanged();
void needShowDesktop(QString);

View File

@ -597,6 +597,12 @@ void KyNetworkResourceManager::onPropertiesChanged(QVariantMap qvm)
Q_EMIT wiredEnabledChanged(wiredEnable);
}
}
for(QString keyStr : qvm.keys()) {
//内网检测地址变化
if (keyStr == "ConnectivityCheckSpareUri") {
Q_EMIT connectivityCheckSpareUriChanged();
}
}
}
void KyNetworkResourceManager::onConnectionUpdated()

View File

@ -129,6 +129,7 @@ Q_SIGNALS:
void wifiNetworkDeviceDisappear();
void wifiEnabledChanged(bool);
void wiredEnabledChanged(bool);
void connectivityCheckSpareUriChanged();
void activeConnectionsReset();
void activeConnectionAdd(QString uuid);

View File

@ -218,3 +218,89 @@ out:
g_object_unref (props_proxy);
}
QString getConnectivityCheckSpareUriByGDbus()
{
GDBusProxy *props_proxy;
GVariant *ret = NULL, *path_value = NULL;
GError *error = NULL;
QString str;
/* Create a D-Bus object proxy for the active connection object's properties */
props_proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
G_DBUS_PROXY_FLAGS_NONE,
NULL,
"org.freedesktop.NetworkManager",
"/org/freedesktop/NetworkManager",
"org.freedesktop.DBus.Properties",
NULL, NULL);
g_assert (props_proxy);
/* Get the object path of the Connection details */
ret = g_dbus_proxy_call_sync (props_proxy,
"Get",
g_variant_new ("(ss)",
"org.freedesktop.NetworkManager",
"ConnectivityCheckSpareUri"),
G_DBUS_CALL_FLAGS_NONE, -1,
NULL, &error);
if (!ret) {
g_dbus_error_strip_remote_error (error);
qDebug() << "failed to getConnectivityCheckSpareUri";
g_error_free (error);
}
g_variant_get (ret, "(v)", &path_value);
// if (!g_variant_is_of_type (path_value, G_VARIANT_TYPE_VARIANT)) {
// g_warning ("Unexpected type returned getting Connection property: %s",
// g_variant_get_type_string (path_value));
// goto out;
// }
str = QString(g_variant_get_string(path_value, NULL));
out:
if (path_value)
g_variant_unref (path_value);
if (ret)
g_variant_unref (ret);
g_object_unref (props_proxy);
return str;
}
void setConnectivityCheckSpareUriByGDbus(QString uri)
{
GDBusProxy *props_proxy;
GVariant *ret = NULL;
GError *error = NULL;
/* Create a D-Bus object proxy for the active connection object's properties */
props_proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
G_DBUS_PROXY_FLAGS_NONE,
NULL,
"org.freedesktop.NetworkManager",
"/org/freedesktop/NetworkManager",
"org.freedesktop.DBus.Properties",
NULL, NULL);
g_assert (props_proxy);
/* Get the object path of the Connection details */
ret = g_dbus_proxy_call_sync (props_proxy,
"Set",
g_variant_new ("(ssv)",
"org.freedesktop.NetworkManager",
"ConnectivityCheckSpareUri",
g_variant_new_string(uri.toStdString().c_str())),
G_DBUS_CALL_FLAGS_NONE, -1,
NULL, &error);
if (!ret) {
g_dbus_error_strip_remote_error (error);
qDebug() << "failed to setConnectivityCheckSpareUri";
g_error_free (error);
}
out:
if (ret)
g_variant_unref (ret);
g_object_unref (props_proxy);
}

View File

@ -37,6 +37,8 @@ QString getConnectTypeByDbus(QString &connectPath);
QString getSsidFromByteArray(QByteArray &rawSsid);
void setWiredEnabledByGDbus(bool enabled);
void setDeviceManagedByGDbus(QString dbusPath, bool managed);
QString getConnectivityCheckSpareUriByGDbus();
void setConnectivityCheckSpareUriByGDbus(QString str);
bool getWiredEnabledByGDbus();
#endif // KYLINUTIL_H

View File

@ -295,6 +295,10 @@ QString KyWirelessNetResource::getDeviceIFace(NetworkManager::ActiveConnection::
NetworkManager::Device:: Ptr devicePtr =
m_networkResourceInstance->findDeviceUni(ifaceUni);
if (devicePtr.isNull()) {
return QString();
}
return devicePtr->interfaceName();
}

431
src/backend/dbus.cpp Normal file
View File

@ -0,0 +1,431 @@
/*
* This file was generated by qdbusxml2cpp version 0.8
* Command line was: qdbusxml2cpp com.kylin.weather.xml -a dbusadaptor -c DbusAdaptor -l MainWindow
*
* qdbusxml2cpp is Copyright (C) 2015 The Qt Company Ltd.
*
* This is an auto-generated file.
* Do not edit! All changes made to it will be lost.
*/
#include "dbus.h"
#include <QtCore/QMetaObject>
#include <QtCore/QByteArray>
#include <QtCore/QList>
#include <QtCore/QMap>
#include <QtCore/QString>
#include <QtCore/QStringList>
#include <QtCore/QVariant>
const QByteArray GSETTINGS_SCHEMA_KYLIN_NM = "org.ukui.kylin-nm.switch";
const QString KEY_WIRELESS_SWITCH = "wirelessswitch";
const QString KEY_WIRED_SWITCH = "wiredswitch";
/*
* Implementation of adaptor class DbusAdaptor
*/
DbusAdaptor::DbusAdaptor(QString display, MainWindow *m, QObject *parent)
: QObject(parent),
m_display(display),
m_mainWindow(m)
{
// constructor
qDBusRegisterMetaType<QMap<QString, bool> >();
qDBusRegisterMetaType<QMap<QString, int> >();
qDBusRegisterMetaType<QList<QStringList> >();
qDBusRegisterMetaType<QMap<QString, QList<QStringList> >>();
bool isServiceRegistered = QDBusConnection::sessionBus().interface()->isServiceRegistered(QStringLiteral("com.kylin.network"));
if(!isServiceRegistered) {
registerService();
}
m_watcher = new QDBusServiceWatcher(QStringLiteral("com.kylin.network"),QDBusConnection::sessionBus(), QDBusServiceWatcher::WatchForOwnerChange, this);
connect(m_watcher, &QDBusServiceWatcher::serviceOwnerChanged, this, &DbusAdaptor::onServiceOwnerChanged);
connectToMainwindow();
}
void DbusAdaptor::onServiceOwnerChanged(const QString &service, const QString &oldOwner, const QString &newOwner)
{
if (newOwner.isEmpty()) {
bool success = registerService();
if (success) {
m_watcher->deleteLater();
}
qDebug() << "try to register service:" << success;
return;
}
uint newOwnerPid = QDBusConnection::sessionBus().interface()->servicePid(newOwner);
qDebug() << "newOwnerPid:" << newOwnerPid << ", myPid:" << QCoreApplication::applicationPid() << ", display:" << m_display;
}
bool DbusAdaptor::registerService()
{
new NetworkAdaptor(this);
QDBusConnection conn = QDBusConnection::sessionBus();
auto reply = conn.interface()->registerService(QStringLiteral("com.kylin.network"),
QDBusConnectionInterface::ReplaceExistingService,
QDBusConnectionInterface::DontAllowReplacement);
if (reply.value() == QDBusConnectionInterface::ServiceNotRegistered) {
return false;
}
bool res = QDBusConnection::sessionBus().registerObject("/com/kylin/network", this);
if (!res) {
QDBusConnection::sessionBus().interface()->unregisterService(QStringLiteral("com.kylin.network"));
}
return res;
}
//无线列表
QVariantList DbusAdaptor::getWirelessList(QString devName)
{
QList<QStringList> list;
m_mainWindow->getWirelessList(devName, list);
QVariantList vList;
for (int i = 0; i < list.size(); ++i) {
vList.append(QVariant::fromValue(list.at(i)));
}
return vList;
}
bool DbusAdaptor::getWirelessSwitchBtnState()
{
return m_mainWindow->getWirelessSwitchBtnState();
}
//有线列表
QVariantList DbusAdaptor::getWiredList(QString devName)
{
QList<QStringList> list;
m_mainWindow->getWiredList(devName, list);
QVariantList vList;
for (int i = 0; i < list.size(); ++i) {
vList.append(QVariant::fromValue(list.at(i)));
}
return vList;
}
//有线开关
void DbusAdaptor::setWiredSwitchEnable(bool enable)
{
//todo mainwindow调用backend 对开关 打开/关闭
if (QGSettings::isSchemaInstalled(GSETTINGS_SCHEMA_KYLIN_NM)) {
QGSettings *gsetting = new QGSettings(GSETTINGS_SCHEMA_KYLIN_NM);
if (gsetting->get(KEY_WIRED_SWITCH).toBool() != enable) {
gsetting->set(KEY_WIRED_SWITCH, enable);
}
delete gsetting;
gsetting = nullptr;
} else {
qDebug()<<"isSchemaInstalled false";
}
}
//无线开关
void DbusAdaptor::setWirelessSwitchEnable(bool enable)
{
//todo mainwindow调用backend 对开关 打开/关闭
// if (QGSettings::isSchemaInstalled(GSETTINGS_SCHEMA_KYLIN_NM)) {
// QGSettings *gsetting = new QGSettings(GSETTINGS_SCHEMA_KYLIN_NM);
// if (gsetting->get(KEY_WIRELESS_SWITCH).toBool() != enable) {
// gsetting->set(KEY_WIRELESS_SWITCH, enable);
// }
// delete gsetting;
// gsetting = nullptr;
// } else {
// qDebug()<<"isSchemaInstalled false";
// }
m_mainWindow->setWirelessSwitchEnable(enable);
}
//启用/禁用网卡
void DbusAdaptor::setDeviceEnable(QString devName, bool enable)
{
m_mainWindow->setWiredDeviceEnable(devName, enable);
}
//设置默认网卡
//void DbusAdaptor::setDefaultWiredDevice(QString deviceName)
//{
// if (!checkDeviceExist(WIRED, deviceName)) {
// return;
// }
// setDefaultDevice(WIRED, deviceName);
// parent()->setWiredDefaultDevice(deviceName);
// return;
//}
//QString DbusAdaptor::getDefaultWiredDevice()
//{
// QSettings * m_settings = new QSettings(CONFIG_FILE_PATH, QSettings::IniFormat);
// m_settings->beginGroup("DEFAULTCARD");
// QString key("wired");
// QString deviceName = m_settings->value(key, "").toString();
// m_settings->endGroup();
// delete m_settings;
// m_settings = nullptr;
// return deviceName;
//}
//void DbusAdaptor::setDefaultWirelessDevice(QString deviceName)
//{
// if (!checkDeviceExist(WIRED, deviceName)) {
// return;
// }
// setDefaultDevice(WIRELESS, deviceName);
// parent()->setWirelessDefaultDevice(deviceName);
// return;
//}
//QString DbusAdaptor::getDefaultWirelessDevice()
//{
// QSettings * m_settings = new QSettings(CONFIG_FILE_PATH, QSettings::IniFormat);
// m_settings->beginGroup("DEFAULTCARD");
// QString key("wireless");
// QString deviceName = m_settings->value(key, "").toString();
// m_settings->endGroup();
// delete m_settings;
// m_settings = nullptr;
// return deviceName;
//}
//删除
void DbusAdaptor::deleteConnect(int type, QString ssid)
{
if (type == WIRED) {
m_mainWindow->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)
{
if (type == WIRED) {
m_mainWindow->activateWired(devName,ssid);
} else if (type == WIRELESS) {
m_mainWindow->activateWireless(devName,ssid);
} else {
qDebug() << "[DbusAdaptor] activateConnect type is invalid";
}
}
//断开连接 根据网卡类型 参数1 0:lan 1:wlan 参数3 为ssid/uuid
void DbusAdaptor::deActivateConnect(int type, QString devName, QString ssid)
{
if (type == WIRED) {
qDebug() << "deactivateWired";
m_mainWindow->deactivateWired(devName,ssid);
} else if (type == WIRELESS) {
m_mainWindow->deactivateWireless(devName,ssid);
} else {
qDebug() << "[DbusAdaptor] deactivateConnect type is invalid";
}
}
//获取设备列表和启用/禁用状态
QVariantMap DbusAdaptor::getDeviceListAndEnabled(int devType)
{
QMap<QString, bool> map;
map.clear();
getDeviceEnableState(devType, map);
QVariantMap vMap;
QMap<QString, bool>::const_iterator item = map.cbegin();
while (item != map.cend()) {
vMap.insert(item.key(), QVariant::fromValue(item.value()));
item ++;
}
return vMap;
}
//获取无线设备能力
QVariantMap DbusAdaptor::getWirelessDeviceCap()
{
QMap<QString, int> map;
m_mainWindow->getWirelessDeviceCap(map);
QVariantMap vMap;
QMap<QString, int>::const_iterator item = map.cbegin();
while (item != map.cend()) {
vMap.insert(item.key(), QVariant::fromValue(item.value()));
item ++;
}
return vMap;
}
//唤起属性页 根据网卡类型 参数2 为ssid/uuid
void DbusAdaptor::showPropertyWidget(QString devName, QString ssid)
{
QString display = checkDisplay();
if (m_display == display) {
m_mainWindow->showPropertyWidget(devName,ssid);
} else {
Q_EMIT showPropertyWidgetSignal(display, devName, ssid);
}
}
//唤起新建有线连接界面
void DbusAdaptor::showCreateWiredConnectWidget(QString devName)
{
QString display = checkDisplay();
if (m_display == display) {
m_mainWindow->showCreateWiredConnectWidget(devName);
} else {
Q_EMIT showCreateWiredConnectWidgetSignal(display, devName);
}
}
//唤起加入其他无线网络界面
void DbusAdaptor::showAddOtherWlanWidget(QString devName)
{
QString display = checkDisplay();
if (m_display == display) {
qDebug() << "showAddOtherWlanWidget";
m_mainWindow->showAddOtherWlanWidget(devName);
} else {
qDebug() << display;
Q_EMIT showAddOtherWlanWidgetSignal(display, devName);
}
}
//开启热点
void DbusAdaptor::activeWirelessAp(const QString apName, const QString apPassword, const QString band, const QString apDevice)
{
m_mainWindow->activeWirelessAp(apName, apPassword, band, apDevice);
}
//断开热点
void DbusAdaptor::deactiveWirelessAp(const QString apName, const QString uuid)
{
m_mainWindow->deactiveWirelessAp(apName, uuid);
}
//获取热点
QStringList DbusAdaptor::getStoredApInfo()
{
QStringList list;
list.clear();
m_mainWindow->getStoredApInfo(list);
return list;
}
//获取热点path
QString DbusAdaptor::getApConnectionPath(QString uuid)
{
QString path;
path.clear();
m_mainWindow->getApConnectionPath(path, uuid);
return path;
}
//获取热点path
QString DbusAdaptor::getActiveConnectionPath(QString uuid)
{
QString path;
path.clear();
m_mainWindow->getActiveConnectionPath(path, uuid);
return path;
}
QStringList DbusAdaptor::getApInfoBySsid(QString devName, QString ssid)
{
QStringList list;
list.clear();
m_mainWindow->getApInfoBySsid(devName, ssid, list);
return list;
}
void DbusAdaptor::showKylinNM(int type)
{
qDebug() << "display" << checkDisplay();
QString display = checkDisplay();
if (m_display == display) {
m_mainWindow->onShowMainWindow(type);
} else {
Q_EMIT showKylinNMSignal(display, type);
}
}
//扫描
void DbusAdaptor::reScan()
{
m_mainWindow->rescan();
}
void DbusAdaptor::keyRingInit()
{
m_mainWindow->keyRingInit();
}
void DbusAdaptor::keyRingClear()
{
m_mainWindow->keyRingClear();
}
void DbusAdaptor::connectToMainwindow()
{
connect(m_mainWindow, &MainWindow::lanAdd, this, &DbusAdaptor::lanAdd);
connect(m_mainWindow, &MainWindow::lanRemove, this, &DbusAdaptor::lanRemove);
connect(m_mainWindow, &MainWindow::lanUpdate, this, &DbusAdaptor::lanUpdate);
connect(m_mainWindow, &MainWindow::wlanAdd, this, &DbusAdaptor::wlanAdd);
connect(m_mainWindow, &MainWindow::wlanRemove, this, &DbusAdaptor::wlanRemove);
connect(m_mainWindow, &MainWindow::wlanactiveConnectionStateChanged, this, &DbusAdaptor::wlanactiveConnectionStateChanged);
connect(m_mainWindow, &MainWindow::lanActiveConnectionStateChanged, this, &DbusAdaptor::lanActiveConnectionStateChanged);
connect(m_mainWindow, &MainWindow::activateFailed, this, &DbusAdaptor::activateFailed);
connect(m_mainWindow, &MainWindow::deactivateFailed, this, &DbusAdaptor::deactivateFailed);
connect(m_mainWindow, &MainWindow::deviceStatusChanged, this, &DbusAdaptor::deviceStatusChanged);
connect(m_mainWindow, &MainWindow::wirelessDeviceStatusChanged, this, &DbusAdaptor::wirelessDeviceStatusChanged);
connect(m_mainWindow, &MainWindow::deviceNameChanged, this, &DbusAdaptor::deviceNameChanged);
connect(m_mainWindow, &MainWindow::wirelessSwitchBtnChanged, this, &DbusAdaptor::wirelessSwitchBtnChanged);
connect(m_mainWindow, &MainWindow::hotspotDeactivated, this, &DbusAdaptor::hotspotDeactivated);
connect(m_mainWindow, &MainWindow::hotspotActivated, this, &DbusAdaptor::hotspotActivated);
connect(m_mainWindow, &MainWindow::signalStrengthChange, this, &DbusAdaptor::signalStrengthChange);
connect(m_mainWindow, &MainWindow::secuTypeChange, this, &DbusAdaptor::secuTypeChange);
connect(m_mainWindow, &MainWindow::timeToUpdate, this, &DbusAdaptor::timeToUpdate);
}
QString DbusAdaptor::checkDisplay()
{
uint pid = 0;
QDBusReply<uint> pidReply = connection().interface()->servicePid(message().service());
qDebug() << "caller pid: " << pidReply.value();
if(pidReply.isValid()) {
pid = pidReply.value();
} else {
return {};
}
return displayFromPid(pid);;
}
QString DbusAdaptor::displayFromPid(uint pid)
{
QFile environFile(QStringLiteral("/proc/%1/environ").arg(QString::number(pid)));
if (environFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
const QByteArray DISPLAY = qApp->property("sessionType").toString() == "wayland" ? QByteArrayLiteral("WAYLAND_DISPLAY")
: QByteArrayLiteral("DISPLAY");
const auto lines = environFile.readAll().split('\0');
for (const QByteArray &line : lines) {
const int equalsIdx = line.indexOf('=');
if (equalsIdx <= 0) {
continue;
}
const QByteArray key = line.left(equalsIdx);
if (key == DISPLAY) {
const QByteArray value = line.mid(equalsIdx + 1);
return value;
}
}
}
return {};
}

View File

@ -15,6 +15,8 @@
#include <QtCore/QObject>
#include <QtDBus/QtDBus>
#include <QtDBus/QDBusMetaType>
#include "dbus_adaptor.h"
#include "dbus_interface.h"
#include "tabpage.h"
#include "../dbus-interface/kylinnetworkdeviceresource.h"
@ -34,23 +36,19 @@ QT_END_NAMESPACE
#include "mainwindow.h"
class DbusAdaptor: public QDBusAbstractAdaptor
class DbusAdaptor: public QObject, protected QDBusContext
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "com.kylin.network")
public:
DbusAdaptor(MainWindow *parent);
virtual ~DbusAdaptor();
inline MainWindow *parent() const
{ return static_cast<MainWindow *>(QObject::parent()); }
explicit DbusAdaptor(QString display, MainWindow *m, QObject *parent = nullptr);
public: // PROPERTIES
public Q_SLOTS: // METHODS
//无线列表
QMap<QString, QVector<QStringList> > getWirelessList();
QVariantList getWirelessList(QString devName);
//有线列表
QMap<QString, QVector<QStringList>> getWiredList();
QVariantList getWiredList(QString devName);
//有线总开关
Q_NOREPLY void setWiredSwitchEnable(bool enable);
//无线总开关
@ -69,9 +67,9 @@ public Q_SLOTS: // METHODS
//断开连接 根据网卡类型 参数1 0:lan 1:wlan 参数3 为ssid/uuid
Q_NOREPLY void deActivateConnect(int type, QString devName, QString ssid);
//获取设备列表和启用/禁用状态
QMap<QString, bool> getDeviceListAndEnabled(int devType);
QVariantMap getDeviceListAndEnabled(int devType);
//获取无线设备能力
QMap<QString, int> getWirelessDeviceCap();
QVariantMap getWirelessDeviceCap();
//唤起属性页 根据网卡类型 参数2 为ssid/uuid
Q_NOREPLY void showPropertyWidget(QString devName, QString ssid);
//唤起新建有线连接界面
@ -125,6 +123,29 @@ Q_SIGNALS: // SIGNALS
void secuTypeChange(QString devName, QString ssid, QString secuType);
//列表排序
void timeToUpdate();
void showKylinNMSignal(QString display, int type);
//唤起属性页 根据网卡类型 参数2 为ssid/uuid
void showPropertyWidgetSignal(QString display, QString devName, QString ssid);
//唤起新建有线连接界面
void showCreateWiredConnectWidgetSignal(QString display, QString devName);
//唤起加入其他无线网络界面
void showAddOtherWlanWidgetSignal(QString display, QString devName);
private:
MainWindow *m_mainWindow;
QString m_display;
QDBusServiceWatcher *m_watcher = nullptr;
QString checkDisplay();
QString displayFromPid(uint pid);
void connectToMainwindow();
bool registerService();
private Q_SLOT:
void onServiceOwnerChanged(const QString &service, const QString &oldOwner, const QString &newOwner);
};
#endif

186
src/backend/dbus.xml Normal file
View File

@ -0,0 +1,186 @@
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
<interface name="com.kylin.network">
<signal name="lanAdd">
<arg name="devName" type="s" direction="out"/>
<arg name="info" type="as" direction="out"/>
</signal>
<signal name="lanRemove">
<arg name="dbusPath" type="s" direction="out"/>
</signal>
<signal name="lanUpdate">
<arg name="devName" type="s" direction="out"/>
<arg name="info" type="as" direction="out"/>
</signal>
<signal name="wlanAdd">
<arg name="devName" type="s" direction="out"/>
<arg name="info" type="as" direction="out"/>
</signal>
<signal name="wlanRemove">
<arg name="devName" type="s" direction="out"/>
<arg name="ssid" type="s" direction="out"/>
</signal>
<signal name="wlanactiveConnectionStateChanged">
<arg name="devName" type="s" direction="out"/>
<arg name="ssid" type="s" direction="out"/>
<arg name="uuid" type="s" direction="out"/>
<arg name="status" type="i" direction="out"/>
</signal>
<signal name="lanActiveConnectionStateChanged">
<arg name="devName" type="s" direction="out"/>
<arg name="uuid" type="s" direction="out"/>
<arg name="status" type="i" direction="out"/>
</signal>
<signal name="activateFailed">
<arg name="errorMessage" type="s" direction="out"/>
</signal>
<signal name="deactivateFailed">
<arg name="errorMessage" type="s" direction="out"/>
</signal>
<signal name="deviceStatusChanged">
</signal>
<signal name="wirelessDeviceStatusChanged">
</signal>
<signal name="deviceNameChanged">
<arg name="oldName" type="s" direction="out"/>
<arg name="newName" type="s" direction="out"/>
<arg name="type" type="i" direction="out"/>
</signal>
<signal name="wirelessSwitchBtnChanged">
<arg name="state" type="b" direction="out"/>
</signal>
<signal name="hotspotDeactivated">
<arg name="devName" type="s" direction="out"/>
<arg name="ssid" type="s" direction="out"/>
</signal>
<signal name="hotspotActivated">
<arg name="devName" type="s" direction="out"/>
<arg name="ssid" type="s" direction="out"/>
<arg name="uuid" type="s" direction="out"/>
<arg name="activePath" type="s" direction="out"/>
<arg name="settingPath" type="s" direction="out"/>
</signal>
<signal name="signalStrengthChange">
<arg name="devName" type="s" direction="out"/>
<arg name="ssid" type="s" direction="out"/>
<arg name="strength" type="i" direction="out"/>
</signal>
<signal name="secuTypeChange">
<arg name="devName" type="s" direction="out"/>
<arg name="ssid" type="s" direction="out"/>
<arg name="secuType" type="s" direction="out"/>
</signal>
<signal name="timeToUpdate">
</signal>
<signal name="showKylinNMSignal">
<arg name="display" type="s" direction="out"/>
<arg name="type" type="i" direction="out"/>
</signal>
<signal name="showPropertyWidgetSignal">
<arg name="display" type="s" direction="out"/>
<arg name="devName" type="s" direction="out"/>
<arg name="ssid" type="s" direction="out"/>
</signal>
<signal name="showCreateWiredConnectWidgetSignal">
<arg name="display" type="s" direction="out"/>
<arg name="devName" type="s" direction="out"/>
</signal>
<signal name="showAddOtherWlanWidgetSignal">
<arg name="display" type="s" direction="out"/>
<arg name="devName" type="s" direction="out"/>
</signal>
<method name="getWirelessList">
<arg type="av" direction="out"/>
<arg name="devName" type="s" direction="in"/>
</method>
<method name="getWiredList">
<arg type="av" direction="out"/>
<arg name="devName" type="s" direction="in"/>
</method>
<method name="setWiredSwitchEnable">
<arg name="enable" type="b" direction="in"/>
<annotation name="org.freedesktop.DBus.Method.NoReply" value="true"/>
</method>
<method name="setWirelessSwitchEnable">
<arg name="enable" type="b" direction="in"/>
<annotation name="org.freedesktop.DBus.Method.NoReply" value="true"/>
</method>
<method name="setDeviceEnable">
<arg name="devName" type="s" direction="in"/>
<arg name="enable" type="b" direction="in"/>
<annotation name="org.freedesktop.DBus.Method.NoReply" value="true"/>
</method>
<method name="activateConnect">
<arg name="type" type="i" direction="in"/>
<arg name="devName" type="s" direction="in"/>
<arg name="ssid" type="s" direction="in"/>
<annotation name="org.freedesktop.DBus.Method.NoReply" value="true"/>
</method>
<method name="deActivateConnect">
<arg name="type" type="i" direction="in"/>
<arg name="devName" type="s" direction="in"/>
<arg name="ssid" type="s" direction="in"/>
<annotation name="org.freedesktop.DBus.Method.NoReply" value="true"/>
</method>
<method name="getDeviceListAndEnabled">
<arg type="a{sv}" direction="out"/>
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QVariantMap"/>
<arg name="devType" type="i" direction="in"/>
</method>
<method name="getWirelessDeviceCap">
<arg type="a{sv}" direction="out"/>
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QVariantMap"/>
</method>
<method name="showPropertyWidget">
<arg name="devName" type="s" direction="in"/>
<arg name="ssid" type="s" direction="in"/>
<annotation name="org.freedesktop.DBus.Method.NoReply" value="true"/>
</method>
<method name="showCreateWiredConnectWidget">
<arg name="devName" type="s" direction="in"/>
<annotation name="org.freedesktop.DBus.Method.NoReply" value="true"/>
</method>
<method name="showAddOtherWlanWidget">
<arg name="devName" type="s" direction="in"/>
<annotation name="org.freedesktop.DBus.Method.NoReply" value="true"/>
</method>
<method name="activeWirelessAp">
<arg name="apName" type="s" direction="in"/>
<arg name="apPassword" type="s" direction="in"/>
<arg name="band" type="s" direction="in"/>
<arg name="apDevice" type="s" direction="in"/>
</method>
<method name="deactiveWirelessAp">
<arg name="apName" type="s" direction="in"/>
<arg name="uuid" type="s" direction="in"/>
</method>
<method name="getStoredApInfo">
<arg type="as" direction="out"/>
</method>
<method name="getApInfoBySsid">
<arg type="as" direction="out"/>
<arg name="devName" type="s" direction="in"/>
<arg name="ssid" type="s" direction="in"/>
</method>
<method name="getApConnectionPath">
<arg type="s" direction="out"/>
<arg name="uuid" type="s" direction="in"/>
</method>
<method name="getActiveConnectionPath">
<arg type="s" direction="out"/>
<arg name="uuid" type="s" direction="in"/>
</method>
<method name="reScan">
</method>
<method name="keyRingInit">
</method>
<method name="keyRingClear">
</method>
<method name="showKylinNM">
<arg name="type" type="i" direction="in"/>
</method>
<method name="getWirelessSwitchBtnState">
<arg type="b" direction="out"/>
</method>
</interface>
</node>

View File

@ -0,0 +1,191 @@
/*
* This file was generated by qdbusxml2cpp version 0.8
* Command line was: qdbusxml2cpp dbus.xml -a dbus_adaptor
*
* qdbusxml2cpp is Copyright (C) 2020 The Qt Company Ltd.
*
* This is an auto-generated file.
* Do not edit! All changes made to it will be lost.
*/
#include "dbus_adaptor.h"
#include <QtCore/QMetaObject>
#include <QtCore/QByteArray>
#include <QtCore/QList>
#include <QtCore/QMap>
#include <QtCore/QString>
#include <QtCore/QStringList>
#include <QtCore/QVariant>
/*
* Implementation of adaptor class NetworkAdaptor
*/
NetworkAdaptor::NetworkAdaptor(QObject *parent)
: QDBusAbstractAdaptor(parent)
{
// constructor
setAutoRelaySignals(true);
}
NetworkAdaptor::~NetworkAdaptor()
{
// destructor
}
void NetworkAdaptor::activateConnect(int type, const QString &devName, const QString &ssid)
{
// handle method call com.kylin.network.activateConnect
QMetaObject::invokeMethod(parent(), "activateConnect", Q_ARG(int, type), Q_ARG(QString, devName), Q_ARG(QString, ssid));
}
void NetworkAdaptor::activeWirelessAp(const QString &apName, const QString &apPassword, const QString &band, const QString &apDevice)
{
// handle method call com.kylin.network.activeWirelessAp
QMetaObject::invokeMethod(parent(), "activeWirelessAp", Q_ARG(QString, apName), Q_ARG(QString, apPassword), Q_ARG(QString, band), Q_ARG(QString, apDevice));
}
void NetworkAdaptor::deActivateConnect(int type, const QString &devName, const QString &ssid)
{
// handle method call com.kylin.network.deActivateConnect
QMetaObject::invokeMethod(parent(), "deActivateConnect", Q_ARG(int, type), Q_ARG(QString, devName), Q_ARG(QString, ssid));
}
void NetworkAdaptor::deactiveWirelessAp(const QString &apName, const QString &uuid)
{
// handle method call com.kylin.network.deactiveWirelessAp
QMetaObject::invokeMethod(parent(), "deactiveWirelessAp", Q_ARG(QString, apName), Q_ARG(QString, uuid));
}
QString NetworkAdaptor::getActiveConnectionPath(const QString &uuid)
{
// handle method call com.kylin.network.getActiveConnectionPath
QString out0;
QMetaObject::invokeMethod(parent(), "getActiveConnectionPath", Q_RETURN_ARG(QString, out0), Q_ARG(QString, uuid));
return out0;
}
QString NetworkAdaptor::getApConnectionPath(const QString &uuid)
{
// handle method call com.kylin.network.getApConnectionPath
QString out0;
QMetaObject::invokeMethod(parent(), "getApConnectionPath", Q_RETURN_ARG(QString, out0), Q_ARG(QString, uuid));
return out0;
}
QStringList NetworkAdaptor::getApInfoBySsid(const QString &devName, const QString &ssid)
{
// handle method call com.kylin.network.getApInfoBySsid
QStringList out0;
QMetaObject::invokeMethod(parent(), "getApInfoBySsid", Q_RETURN_ARG(QStringList, out0), Q_ARG(QString, devName), Q_ARG(QString, ssid));
return out0;
}
QVariantMap NetworkAdaptor::getDeviceListAndEnabled(int devType)
{
// handle method call com.kylin.network.getDeviceListAndEnabled
QVariantMap out0;
QMetaObject::invokeMethod(parent(), "getDeviceListAndEnabled", Q_RETURN_ARG(QVariantMap, out0), Q_ARG(int, devType));
return out0;
}
QStringList NetworkAdaptor::getStoredApInfo()
{
// handle method call com.kylin.network.getStoredApInfo
QStringList out0;
QMetaObject::invokeMethod(parent(), "getStoredApInfo", Q_RETURN_ARG(QStringList, out0));
return out0;
}
QVariantList NetworkAdaptor::getWiredList(const QString &devName)
{
// handle method call com.kylin.network.getWiredList
QVariantList out0;
QMetaObject::invokeMethod(parent(), "getWiredList", Q_RETURN_ARG(QVariantList, out0), Q_ARG(QString, devName));
return out0;
}
QVariantMap NetworkAdaptor::getWirelessDeviceCap()
{
// handle method call com.kylin.network.getWirelessDeviceCap
QVariantMap out0;
QMetaObject::invokeMethod(parent(), "getWirelessDeviceCap", Q_RETURN_ARG(QVariantMap, out0));
return out0;
}
QVariantList NetworkAdaptor::getWirelessList(const QString &devName)
{
// handle method call com.kylin.network.getWirelessList
QVariantList out0;
QMetaObject::invokeMethod(parent(), "getWirelessList", Q_RETURN_ARG(QVariantList, out0), Q_ARG(QString, devName));
return out0;
}
bool NetworkAdaptor::getWirelessSwitchBtnState()
{
// handle method call com.kylin.network.getWirelessSwitchBtnState
bool out0;
QMetaObject::invokeMethod(parent(), "getWirelessSwitchBtnState", Q_RETURN_ARG(bool, out0));
return out0;
}
void NetworkAdaptor::keyRingClear()
{
// handle method call com.kylin.network.keyRingClear
QMetaObject::invokeMethod(parent(), "keyRingClear");
}
void NetworkAdaptor::keyRingInit()
{
// handle method call com.kylin.network.keyRingInit
QMetaObject::invokeMethod(parent(), "keyRingInit");
}
void NetworkAdaptor::reScan()
{
// handle method call com.kylin.network.reScan
QMetaObject::invokeMethod(parent(), "reScan");
}
void NetworkAdaptor::setDeviceEnable(const QString &devName, bool enable)
{
// handle method call com.kylin.network.setDeviceEnable
QMetaObject::invokeMethod(parent(), "setDeviceEnable", Q_ARG(QString, devName), Q_ARG(bool, enable));
}
void NetworkAdaptor::setWiredSwitchEnable(bool enable)
{
// handle method call com.kylin.network.setWiredSwitchEnable
QMetaObject::invokeMethod(parent(), "setWiredSwitchEnable", Q_ARG(bool, enable));
}
void NetworkAdaptor::setWirelessSwitchEnable(bool enable)
{
// handle method call com.kylin.network.setWirelessSwitchEnable
QMetaObject::invokeMethod(parent(), "setWirelessSwitchEnable", Q_ARG(bool, enable));
}
void NetworkAdaptor::showAddOtherWlanWidget(const QString &devName)
{
// handle method call com.kylin.network.showAddOtherWlanWidget
QMetaObject::invokeMethod(parent(), "showAddOtherWlanWidget", Q_ARG(QString, devName));
}
void NetworkAdaptor::showCreateWiredConnectWidget(const QString &devName)
{
// handle method call com.kylin.network.showCreateWiredConnectWidget
QMetaObject::invokeMethod(parent(), "showCreateWiredConnectWidget", Q_ARG(QString, devName));
}
void NetworkAdaptor::showKylinNM(int type)
{
// handle method call com.kylin.network.showKylinNM
QMetaObject::invokeMethod(parent(), "showKylinNM", Q_ARG(int, type));
}
void NetworkAdaptor::showPropertyWidget(const QString &devName, const QString &ssid)
{
// handle method call com.kylin.network.showPropertyWidget
QMetaObject::invokeMethod(parent(), "showPropertyWidget", Q_ARG(QString, devName), Q_ARG(QString, ssid));
}

266
src/backend/dbus_adaptor.h Normal file
View File

@ -0,0 +1,266 @@
/*
* This file was generated by qdbusxml2cpp version 0.8
* Command line was: qdbusxml2cpp dbus.xml -a dbus_adaptor
*
* qdbusxml2cpp is Copyright (C) 2020 The Qt Company Ltd.
*
* This is an auto-generated file.
* This file may have been hand-edited. Look for HAND-EDIT comments
* before re-generating it.
*/
#ifndef DBUS_ADAPTOR_H
#define DBUS_ADAPTOR_H
#include <QtCore/QObject>
#include <QtDBus/QtDBus>
QT_BEGIN_NAMESPACE
class QByteArray;
template<class T> class QList;
template<class Key, class Value> class QMap;
class QString;
class QStringList;
class QVariant;
QT_END_NAMESPACE
/*
* Adaptor class for interface com.kylin.network
*/
class NetworkAdaptor: public QDBusAbstractAdaptor
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "com.kylin.network")
Q_CLASSINFO("D-Bus Introspection", ""
" <interface name=\"com.kylin.network\">\n"
" <signal name=\"lanAdd\">\n"
" <arg direction=\"out\" type=\"s\" name=\"devName\"/>\n"
" <arg direction=\"out\" type=\"as\" name=\"info\"/>\n"
" </signal>\n"
" <signal name=\"lanRemove\">\n"
" <arg direction=\"out\" type=\"s\" name=\"dbusPath\"/>\n"
" </signal>\n"
" <signal name=\"lanUpdate\">\n"
" <arg direction=\"out\" type=\"s\" name=\"devName\"/>\n"
" <arg direction=\"out\" type=\"as\" name=\"info\"/>\n"
" </signal>\n"
" <signal name=\"wlanAdd\">\n"
" <arg direction=\"out\" type=\"s\" name=\"devName\"/>\n"
" <arg direction=\"out\" type=\"as\" name=\"info\"/>\n"
" </signal>\n"
" <signal name=\"wlanRemove\">\n"
" <arg direction=\"out\" type=\"s\" name=\"devName\"/>\n"
" <arg direction=\"out\" type=\"s\" name=\"ssid\"/>\n"
" </signal>\n"
" <signal name=\"wlanactiveConnectionStateChanged\">\n"
" <arg direction=\"out\" type=\"s\" name=\"devName\"/>\n"
" <arg direction=\"out\" type=\"s\" name=\"ssid\"/>\n"
" <arg direction=\"out\" type=\"s\" name=\"uuid\"/>\n"
" <arg direction=\"out\" type=\"i\" name=\"status\"/>\n"
" </signal>\n"
" <signal name=\"lanActiveConnectionStateChanged\">\n"
" <arg direction=\"out\" type=\"s\" name=\"devName\"/>\n"
" <arg direction=\"out\" type=\"s\" name=\"uuid\"/>\n"
" <arg direction=\"out\" type=\"i\" name=\"status\"/>\n"
" </signal>\n"
" <signal name=\"activateFailed\">\n"
" <arg direction=\"out\" type=\"s\" name=\"errorMessage\"/>\n"
" </signal>\n"
" <signal name=\"deactivateFailed\">\n"
" <arg direction=\"out\" type=\"s\" name=\"errorMessage\"/>\n"
" </signal>\n"
" <signal name=\"deviceStatusChanged\"/>\n"
" <signal name=\"wirelessDeviceStatusChanged\"/>\n"
" <signal name=\"deviceNameChanged\">\n"
" <arg direction=\"out\" type=\"s\" name=\"oldName\"/>\n"
" <arg direction=\"out\" type=\"s\" name=\"newName\"/>\n"
" <arg direction=\"out\" type=\"i\" name=\"type\"/>\n"
" </signal>\n"
" <signal name=\"wirelessSwitchBtnChanged\">\n"
" <arg direction=\"out\" type=\"b\" name=\"state\"/>\n"
" </signal>\n"
" <signal name=\"hotspotDeactivated\">\n"
" <arg direction=\"out\" type=\"s\" name=\"devName\"/>\n"
" <arg direction=\"out\" type=\"s\" name=\"ssid\"/>\n"
" </signal>\n"
" <signal name=\"hotspotActivated\">\n"
" <arg direction=\"out\" type=\"s\" name=\"devName\"/>\n"
" <arg direction=\"out\" type=\"s\" name=\"ssid\"/>\n"
" <arg direction=\"out\" type=\"s\" name=\"uuid\"/>\n"
" <arg direction=\"out\" type=\"s\" name=\"activePath\"/>\n"
" <arg direction=\"out\" type=\"s\" name=\"settingPath\"/>\n"
" </signal>\n"
" <signal name=\"signalStrengthChange\">\n"
" <arg direction=\"out\" type=\"s\" name=\"devName\"/>\n"
" <arg direction=\"out\" type=\"s\" name=\"ssid\"/>\n"
" <arg direction=\"out\" type=\"i\" name=\"strength\"/>\n"
" </signal>\n"
" <signal name=\"secuTypeChange\">\n"
" <arg direction=\"out\" type=\"s\" name=\"devName\"/>\n"
" <arg direction=\"out\" type=\"s\" name=\"ssid\"/>\n"
" <arg direction=\"out\" type=\"s\" name=\"secuType\"/>\n"
" </signal>\n"
" <signal name=\"timeToUpdate\"/>\n"
" <signal name=\"showKylinNMSignal\">\n"
" <arg direction=\"out\" type=\"s\" name=\"display\"/>\n"
" <arg direction=\"out\" type=\"i\" name=\"type\"/>\n"
" </signal>\n"
" <signal name=\"showPropertyWidgetSignal\">\n"
" <arg direction=\"out\" type=\"s\" name=\"display\"/>\n"
" <arg direction=\"out\" type=\"s\" name=\"devName\"/>\n"
" <arg direction=\"out\" type=\"s\" name=\"ssid\"/>\n"
" </signal>\n"
" <signal name=\"showCreateWiredConnectWidgetSignal\">\n"
" <arg direction=\"out\" type=\"s\" name=\"display\"/>\n"
" <arg direction=\"out\" type=\"s\" name=\"devName\"/>\n"
" </signal>\n"
" <signal name=\"showAddOtherWlanWidgetSignal\">\n"
" <arg direction=\"out\" type=\"s\" name=\"display\"/>\n"
" <arg direction=\"out\" type=\"s\" name=\"devName\"/>\n"
" </signal>\n"
" <method name=\"getWirelessList\">\n"
" <arg direction=\"out\" type=\"av\"/>\n"
" <arg direction=\"in\" type=\"s\" name=\"devName\"/>\n"
" </method>\n"
" <method name=\"getWiredList\">\n"
" <arg direction=\"out\" type=\"av\"/>\n"
" <arg direction=\"in\" type=\"s\" name=\"devName\"/>\n"
" </method>\n"
" <method name=\"setWiredSwitchEnable\">\n"
" <arg direction=\"in\" type=\"b\" name=\"enable\"/>\n"
" <annotation value=\"true\" name=\"org.freedesktop.DBus.Method.NoReply\"/>\n"
" </method>\n"
" <method name=\"setWirelessSwitchEnable\">\n"
" <arg direction=\"in\" type=\"b\" name=\"enable\"/>\n"
" <annotation value=\"true\" name=\"org.freedesktop.DBus.Method.NoReply\"/>\n"
" </method>\n"
" <method name=\"setDeviceEnable\">\n"
" <arg direction=\"in\" type=\"s\" name=\"devName\"/>\n"
" <arg direction=\"in\" type=\"b\" name=\"enable\"/>\n"
" <annotation value=\"true\" name=\"org.freedesktop.DBus.Method.NoReply\"/>\n"
" </method>\n"
" <method name=\"activateConnect\">\n"
" <arg direction=\"in\" type=\"i\" name=\"type\"/>\n"
" <arg direction=\"in\" type=\"s\" name=\"devName\"/>\n"
" <arg direction=\"in\" type=\"s\" name=\"ssid\"/>\n"
" <annotation value=\"true\" name=\"org.freedesktop.DBus.Method.NoReply\"/>\n"
" </method>\n"
" <method name=\"deActivateConnect\">\n"
" <arg direction=\"in\" type=\"i\" name=\"type\"/>\n"
" <arg direction=\"in\" type=\"s\" name=\"devName\"/>\n"
" <arg direction=\"in\" type=\"s\" name=\"ssid\"/>\n"
" <annotation value=\"true\" name=\"org.freedesktop.DBus.Method.NoReply\"/>\n"
" </method>\n"
" <method name=\"getDeviceListAndEnabled\">\n"
" <arg direction=\"out\" type=\"a{sv}\"/>\n"
" <annotation value=\"QVariantMap\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n"
" <arg direction=\"in\" type=\"i\" name=\"devType\"/>\n"
" </method>\n"
" <method name=\"getWirelessDeviceCap\">\n"
" <arg direction=\"out\" type=\"a{sv}\"/>\n"
" <annotation value=\"QVariantMap\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n"
" </method>\n"
" <method name=\"showPropertyWidget\">\n"
" <arg direction=\"in\" type=\"s\" name=\"devName\"/>\n"
" <arg direction=\"in\" type=\"s\" name=\"ssid\"/>\n"
" <annotation value=\"true\" name=\"org.freedesktop.DBus.Method.NoReply\"/>\n"
" </method>\n"
" <method name=\"showCreateWiredConnectWidget\">\n"
" <arg direction=\"in\" type=\"s\" name=\"devName\"/>\n"
" <annotation value=\"true\" name=\"org.freedesktop.DBus.Method.NoReply\"/>\n"
" </method>\n"
" <method name=\"showAddOtherWlanWidget\">\n"
" <arg direction=\"in\" type=\"s\" name=\"devName\"/>\n"
" <annotation value=\"true\" name=\"org.freedesktop.DBus.Method.NoReply\"/>\n"
" </method>\n"
" <method name=\"activeWirelessAp\">\n"
" <arg direction=\"in\" type=\"s\" name=\"apName\"/>\n"
" <arg direction=\"in\" type=\"s\" name=\"apPassword\"/>\n"
" <arg direction=\"in\" type=\"s\" name=\"band\"/>\n"
" <arg direction=\"in\" type=\"s\" name=\"apDevice\"/>\n"
" </method>\n"
" <method name=\"deactiveWirelessAp\">\n"
" <arg direction=\"in\" type=\"s\" name=\"apName\"/>\n"
" <arg direction=\"in\" type=\"s\" name=\"uuid\"/>\n"
" </method>\n"
" <method name=\"getStoredApInfo\">\n"
" <arg direction=\"out\" type=\"as\"/>\n"
" </method>\n"
" <method name=\"getApInfoBySsid\">\n"
" <arg direction=\"out\" type=\"as\"/>\n"
" <arg direction=\"in\" type=\"s\" name=\"devName\"/>\n"
" <arg direction=\"in\" type=\"s\" name=\"ssid\"/>\n"
" </method>\n"
" <method name=\"getApConnectionPath\">\n"
" <arg direction=\"out\" type=\"s\"/>\n"
" <arg direction=\"in\" type=\"s\" name=\"uuid\"/>\n"
" </method>\n"
" <method name=\"getActiveConnectionPath\">\n"
" <arg direction=\"out\" type=\"s\"/>\n"
" <arg direction=\"in\" type=\"s\" name=\"uuid\"/>\n"
" </method>\n"
" <method name=\"reScan\"/>\n"
" <method name=\"keyRingInit\"/>\n"
" <method name=\"keyRingClear\"/>\n"
" <method name=\"showKylinNM\">\n"
" <arg direction=\"in\" type=\"i\" name=\"type\"/>\n"
" </method>\n"
" <method name=\"getWirelessSwitchBtnState\">\n"
" <arg direction=\"out\" type=\"b\"/>\n"
" </method>\n"
" </interface>\n"
"")
public:
NetworkAdaptor(QObject *parent);
virtual ~NetworkAdaptor();
public: // PROPERTIES
public Q_SLOTS: // METHODS
Q_NOREPLY void activateConnect(int type, const QString &devName, const QString &ssid);
void activeWirelessAp(const QString &apName, const QString &apPassword, const QString &band, const QString &apDevice);
Q_NOREPLY void deActivateConnect(int type, const QString &devName, const QString &ssid);
void deactiveWirelessAp(const QString &apName, const QString &uuid);
QString getActiveConnectionPath(const QString &uuid);
QString getApConnectionPath(const QString &uuid);
QStringList getApInfoBySsid(const QString &devName, const QString &ssid);
QVariantMap getDeviceListAndEnabled(int devType);
QStringList getStoredApInfo();
QVariantList getWiredList(const QString &devName);
QVariantMap getWirelessDeviceCap();
QVariantList getWirelessList(const QString &devName);
bool getWirelessSwitchBtnState();
void keyRingClear();
void keyRingInit();
void reScan();
Q_NOREPLY void setDeviceEnable(const QString &devName, bool enable);
Q_NOREPLY void setWiredSwitchEnable(bool enable);
Q_NOREPLY void setWirelessSwitchEnable(bool enable);
Q_NOREPLY void showAddOtherWlanWidget(const QString &devName);
Q_NOREPLY void showCreateWiredConnectWidget(const QString &devName);
void showKylinNM(int type);
Q_NOREPLY void showPropertyWidget(const QString &devName, const QString &ssid);
Q_SIGNALS: // SIGNALS
void activateFailed(const QString &errorMessage);
void deactivateFailed(const QString &errorMessage);
void deviceNameChanged(const QString &oldName, const QString &newName, int type);
void deviceStatusChanged();
void hotspotActivated(const QString &devName, const QString &ssid, const QString &uuid, const QString &activePath, const QString &settingPath);
void hotspotDeactivated(const QString &devName, const QString &ssid);
void lanActiveConnectionStateChanged(const QString &devName, const QString &uuid, int status);
void lanAdd(const QString &devName, const QStringList &info);
void lanRemove(const QString &dbusPath);
void lanUpdate(const QString &devName, const QStringList &info);
void secuTypeChange(const QString &devName, const QString &ssid, const QString &secuType);
void showAddOtherWlanWidgetSignal(const QString &display, const QString &devName);
void showCreateWiredConnectWidgetSignal(const QString &display, const QString &devName);
void showKylinNMSignal(const QString &display, int type);
void showPropertyWidgetSignal(const QString &display, const QString &devName, const QString &ssid);
void signalStrengthChange(const QString &devName, const QString &ssid, int strength);
void timeToUpdate();
void wirelessDeviceStatusChanged();
void wirelessSwitchBtnChanged(bool state);
void wlanAdd(const QString &devName, const QStringList &info);
void wlanRemove(const QString &devName, const QString &ssid);
void wlanactiveConnectionStateChanged(const QString &devName, const QString &ssid, const QString &uuid, int status);
};
#endif

View File

@ -0,0 +1,26 @@
/*
* This file was generated by qdbusxml2cpp version 0.8
* Command line was: qdbusxml2cpp dbus.xml -p dbus_interface
*
* qdbusxml2cpp is Copyright (C) 2020 The Qt Company Ltd.
*
* This is an auto-generated file.
* This file may have been hand-edited. Look for HAND-EDIT comments
* before re-generating it.
*/
#include "dbus_interface.h"
/*
* Implementation of interface class ComKylinNetworkInterface
*/
ComKylinNetworkInterface::ComKylinNetworkInterface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent)
: QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent)
{
}
ComKylinNetworkInterface::~ComKylinNetworkInterface()
{
}

View File

@ -0,0 +1,224 @@
/*
* This file was generated by qdbusxml2cpp version 0.8
* Command line was: qdbusxml2cpp dbus.xml -p dbus_interface
*
* qdbusxml2cpp is Copyright (C) 2020 The Qt Company Ltd.
*
* This is an auto-generated file.
* Do not edit! All changes made to it will be lost.
*/
#ifndef DBUS_INTERFACE_H
#define DBUS_INTERFACE_H
#include <QtCore/QObject>
#include <QtCore/QByteArray>
#include <QtCore/QList>
#include <QtCore/QMap>
#include <QtCore/QString>
#include <QtCore/QStringList>
#include <QtCore/QVariant>
#include <QtDBus/QtDBus>
/*
* Proxy class for interface com.kylin.network
*/
class ComKylinNetworkInterface: public QDBusAbstractInterface
{
Q_OBJECT
public:
static inline const char *staticInterfaceName()
{ return "com.kylin.network"; }
public:
ComKylinNetworkInterface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = nullptr);
~ComKylinNetworkInterface();
public Q_SLOTS: // METHODS
inline Q_NOREPLY void activateConnect(int type, const QString &devName, const QString &ssid)
{
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(type) << QVariant::fromValue(devName) << QVariant::fromValue(ssid);
callWithArgumentList(QDBus::NoBlock, QStringLiteral("activateConnect"), argumentList);
}
inline QDBusPendingReply<> activeWirelessAp(const QString &apName, const QString &apPassword, const QString &band, const QString &apDevice)
{
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(apName) << QVariant::fromValue(apPassword) << QVariant::fromValue(band) << QVariant::fromValue(apDevice);
return asyncCallWithArgumentList(QStringLiteral("activeWirelessAp"), argumentList);
}
inline Q_NOREPLY void deActivateConnect(int type, const QString &devName, const QString &ssid)
{
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(type) << QVariant::fromValue(devName) << QVariant::fromValue(ssid);
callWithArgumentList(QDBus::NoBlock, QStringLiteral("deActivateConnect"), argumentList);
}
inline QDBusPendingReply<> deactiveWirelessAp(const QString &apName, const QString &uuid)
{
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(apName) << QVariant::fromValue(uuid);
return asyncCallWithArgumentList(QStringLiteral("deactiveWirelessAp"), argumentList);
}
inline QDBusPendingReply<QString> getActiveConnectionPath(const QString &uuid)
{
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(uuid);
return asyncCallWithArgumentList(QStringLiteral("getActiveConnectionPath"), argumentList);
}
inline QDBusPendingReply<QString> getApConnectionPath(const QString &uuid)
{
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(uuid);
return asyncCallWithArgumentList(QStringLiteral("getApConnectionPath"), argumentList);
}
inline QDBusPendingReply<QStringList> getApInfoBySsid(const QString &devName, const QString &ssid)
{
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(devName) << QVariant::fromValue(ssid);
return asyncCallWithArgumentList(QStringLiteral("getApInfoBySsid"), argumentList);
}
inline QDBusPendingReply<QVariantMap> getDeviceListAndEnabled(int devType)
{
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(devType);
return asyncCallWithArgumentList(QStringLiteral("getDeviceListAndEnabled"), argumentList);
}
inline QDBusPendingReply<QStringList> getStoredApInfo()
{
QList<QVariant> argumentList;
return asyncCallWithArgumentList(QStringLiteral("getStoredApInfo"), argumentList);
}
inline QDBusPendingReply<QVariantList> getWiredList(const QString &devName)
{
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(devName);
return asyncCallWithArgumentList(QStringLiteral("getWiredList"), argumentList);
}
inline QDBusPendingReply<QVariantMap> getWirelessDeviceCap()
{
QList<QVariant> argumentList;
return asyncCallWithArgumentList(QStringLiteral("getWirelessDeviceCap"), argumentList);
}
inline QDBusPendingReply<QVariantList> getWirelessList(const QString &devName)
{
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(devName);
return asyncCallWithArgumentList(QStringLiteral("getWirelessList"), argumentList);
}
inline QDBusPendingReply<bool> getWirelessSwitchBtnState()
{
QList<QVariant> argumentList;
return asyncCallWithArgumentList(QStringLiteral("getWirelessSwitchBtnState"), argumentList);
}
inline QDBusPendingReply<> keyRingClear()
{
QList<QVariant> argumentList;
return asyncCallWithArgumentList(QStringLiteral("keyRingClear"), argumentList);
}
inline QDBusPendingReply<> keyRingInit()
{
QList<QVariant> argumentList;
return asyncCallWithArgumentList(QStringLiteral("keyRingInit"), argumentList);
}
inline QDBusPendingReply<> reScan()
{
QList<QVariant> argumentList;
return asyncCallWithArgumentList(QStringLiteral("reScan"), argumentList);
}
inline Q_NOREPLY void setDeviceEnable(const QString &devName, bool enable)
{
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(devName) << QVariant::fromValue(enable);
callWithArgumentList(QDBus::NoBlock, QStringLiteral("setDeviceEnable"), argumentList);
}
inline Q_NOREPLY void setWiredSwitchEnable(bool enable)
{
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(enable);
callWithArgumentList(QDBus::NoBlock, QStringLiteral("setWiredSwitchEnable"), argumentList);
}
inline Q_NOREPLY void setWirelessSwitchEnable(bool enable)
{
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(enable);
callWithArgumentList(QDBus::NoBlock, QStringLiteral("setWirelessSwitchEnable"), argumentList);
}
inline Q_NOREPLY void showAddOtherWlanWidget(const QString &devName)
{
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(devName);
callWithArgumentList(QDBus::NoBlock, QStringLiteral("showAddOtherWlanWidget"), argumentList);
}
inline Q_NOREPLY void showCreateWiredConnectWidget(const QString &devName)
{
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(devName);
callWithArgumentList(QDBus::NoBlock, QStringLiteral("showCreateWiredConnectWidget"), argumentList);
}
inline QDBusPendingReply<> showKylinNM(int type)
{
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(type);
return asyncCallWithArgumentList(QStringLiteral("showKylinNM"), argumentList);
}
inline Q_NOREPLY void showPropertyWidget(const QString &devName, const QString &ssid)
{
QList<QVariant> argumentList;
argumentList << QVariant::fromValue(devName) << QVariant::fromValue(ssid);
callWithArgumentList(QDBus::NoBlock, QStringLiteral("showPropertyWidget"), argumentList);
}
Q_SIGNALS: // SIGNALS
void activateFailed(const QString &errorMessage);
void deactivateFailed(const QString &errorMessage);
void deviceNameChanged(const QString &oldName, const QString &newName, int type);
void deviceStatusChanged();
void hotspotActivated(const QString &devName, const QString &ssid, const QString &uuid, const QString &activePath, const QString &settingPath);
void hotspotDeactivated(const QString &devName, const QString &ssid);
void lanActiveConnectionStateChanged(const QString &devName, const QString &uuid, int status);
void lanAdd(const QString &devName, const QStringList &info);
void lanRemove(const QString &dbusPath);
void lanUpdate(const QString &devName, const QStringList &info);
void secuTypeChange(const QString &devName, const QString &ssid, const QString &secuType);
void showAddOtherWlanWidgetSignal(const QString &display, const QString &devName);
void showCreateWiredConnectWidgetSignal(const QString &display, const QString &devName);
void showKylinNMSignal(const QString &display, int type);
void showPropertyWidgetSignal(const QString &display, const QString &devName, const QString &ssid);
void signalStrengthChange(const QString &devName, const QString &ssid, int strength);
void timeToUpdate();
void wirelessDeviceStatusChanged();
void wirelessSwitchBtnChanged(bool state);
void wlanAdd(const QString &devName, const QStringList &info);
void wlanRemove(const QString &devName, const QString &ssid);
void wlanactiveConnectionStateChanged(const QString &devName, const QString &ssid, const QString &uuid, int status);
};
namespace com {
namespace kylin {
typedef ::ComKylinNetworkInterface network;
}
}
#endif

View File

@ -0,0 +1,9 @@
INCLUDEPATH += $$PWD
FORMS += \
HEADERS += \
$$PWD/connectivitypage.h \
SOURCES += \
$$PWD/connectivitypage.cpp \

View File

@ -0,0 +1,205 @@
#include "connectivitypage.h"
#include <QLayout>
#include <QFormLayout>
#include <QApplication>
#include <QGSettings>
#include <QDebug>
#include <QRegExpValidator>
#include "windowmanager/windowmanager.h"
#include "kwindowsystem.h"
#include "kwindowsystem_export.h"
#include "kylinutil.h"
#define THEME_SCHAME "org.ukui.style"
#define COLOR_THEME "styleName"
#define BOTTOM_LAYOUT_MARGINS 24, 16, 24, 24
#define LAYOUT_SPACING 16
ConnectivityPage::ConnectivityPage(QString uri, QWidget *parent)
:m_uri(uri), QDialog(parent)
{
this->setAttribute(Qt::WA_DeleteOnClose, true);
this->setFixedSize(380, 369);
this->setWindowTitle(tr("Network connectivity detection"));
setAttribute(Qt::WA_DeleteOnClose, false);
KWindowSystem::setState(this->winId(), NET::SkipTaskbar | NET::SkipPager);
m_connectResource = new KyConnectResourse(this);
initUi();
initConnect();
NetworkManager::Connectivity connectivity;
m_connectResource->getConnectivity(connectivity);
setWarning(connectivity);
m_publicNetworkButton->setChecked(m_uri.isEmpty());
m_intranetButton->setChecked(!m_uri.isEmpty());
if (!m_uri.isEmpty()) {
checkUri();
}
}
void ConnectivityPage::initUi()
{
m_scrollArea = new QScrollArea(this);
m_scrollArea->setFixedWidth(380);
m_scrollArea->setFrameShape(QFrame::NoFrame);
m_scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
m_scrollArea->setContentsMargins(0,0,0,0);
m_icon = new QLabel(this);
m_statusText = new QLabel(this);
m_statusText->setWordWrap(true);
//如访问 Internet 受限,请切换网络 IP 连通性检测方式后再试。
m_text = new QLabel(this);
m_text->setText(tr("If access to the Internet is restricted, please switch the network IP connectivity detection method and try again."));
m_text->setWordWrap(true);
m_text->adjustSize();
// m_text->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
m_publicNetworkButton = new QRadioButton(this);
m_publicNetworkButton->setText(tr("Public network (default)"));
m_intranetButton = new QRadioButton(this);
m_intranetButton->setText(tr("Local area network (intranet)"));
m_uriEdit = new QLineEdit(this);
m_uriEdit->setText(m_uri);
m_warningLabel = new QLabel(this);
QPalette hintTextColor;
hintTextColor.setColor(QPalette::WindowText, Qt::red);
m_warningLabel->setPalette(hintTextColor);
m_warningLabel->setWordWrap(true);
m_confirmBtn = new QPushButton(this);
m_confirmBtn->setText(tr("Confirm"));
m_warningWidget = new QWidget(this);
m_warningWidget->adjustSize();
m_editWidget = new QWidget(this);
m_centerWidget = new QWidget(this);
m_centerWidget->setFixedWidth(380);
m_bottomWidget = new QWidget(this);
QHBoxLayout* warningLayout = new QHBoxLayout(m_warningWidget);
warningLayout->setContentsMargins(0, 0, 0, 24);
warningLayout->setSpacing(8);
warningLayout->addWidget(m_icon);
warningLayout->addWidget(m_statusText);
warningLayout->addStretch();
QVBoxLayout* editLayout = new QVBoxLayout(m_editWidget);
editLayout->setContentsMargins(22,0,0,0);
editLayout->setSpacing(0);
editLayout->addWidget(m_uriEdit);
editLayout->addWidget(m_warningLabel);
QVBoxLayout* mainLayout = new QVBoxLayout(this);
mainLayout->setContentsMargins(0,0,0,0);
mainLayout->setSpacing(0);
mainLayout->addWidget(m_scrollArea);
mainLayout->addWidget(m_bottomWidget);
this->setLayout(mainLayout);
//中间页面
QVBoxLayout *vLayout = new QVBoxLayout(m_centerWidget);
vLayout->setContentsMargins(25, 17, 23, 0);
vLayout->setSpacing(0);
vLayout->addWidget(m_warningWidget);
vLayout->addWidget(m_text);
vLayout->addSpacing(10);
vLayout->addWidget(m_publicNetworkButton);
vLayout->addSpacing(12);
vLayout->addWidget(m_intranetButton);
vLayout->addWidget(m_editWidget);
//底部按钮
QHBoxLayout* bottomLayout = new QHBoxLayout(m_bottomWidget);
bottomLayout->setContentsMargins(BOTTOM_LAYOUT_MARGINS);
bottomLayout->setSpacing(LAYOUT_SPACING);
bottomLayout->addStretch();
bottomLayout->addWidget(m_confirmBtn);
m_scrollArea->setWidget(m_centerWidget);
m_scrollArea->setWidgetResizable(true);
this->setWindowFlags(Qt::Dialog);
}
void ConnectivityPage::initConnect()
{
connect(m_confirmBtn, &QPushButton::released, this, [=](){
if (m_publicNetworkButton->isChecked()) {
setConnectivityCheckSpareUriByGDbus("");
} else {
setConnectivityCheckSpareUriByGDbus(m_uriEdit->text());
}
close();
});
connect(m_publicNetworkButton, &QRadioButton::toggled, [&](bool checked){
if (checked) {
m_uriEdit->clear();
m_uriEdit->setDisabled(true);
m_confirmBtn->setEnabled(true);
}
});
connect(m_intranetButton, &QRadioButton::toggled, [&](bool checked){
if (checked) {
checkUri();
m_uriEdit->setDisabled(false);
m_uriEdit->setFocus();
}
});
connect(m_uriEdit, &QLineEdit::textChanged, this ,&ConnectivityPage::checkUri);
connect(m_connectResource, &KyConnectResourse::connectivityChanged, this, &ConnectivityPage::setWarning);
}
void ConnectivityPage::setWarning(NetworkManager::Connectivity connectivity)
{
if (NetworkManager::Connectivity::Full == connectivity) {
//网络已连接,可正常访问 Internet 。
m_icon->setPixmap(QIcon::fromTheme("ukui-dialog-success").pixmap(16,16));
m_statusText->setText(tr("The network is connected and can access the Internet normally."));
} else if (NetworkManager::Connectivity::Limited == connectivity
|| NetworkManager::Connectivity::Portal == connectivity) {
//网络已连接,访问 Internet 受限。
m_icon->setPixmap(QIcon::fromTheme("dialog-warning").pixmap(16,16));
m_statusText->setText(tr("The network is connected and access to the Internet is restricted."));
} else {
qWarning() << "network status is " << connectivity << "should not show this page";
}
}
void ConnectivityPage::checkUri()
{
QString text = m_uriEdit->text(); //locationbar input data
if (text.isEmpty()) {
m_confirmBtn->setEnabled(false);
m_warningLabel->setText(tr("Please enter the local area network (intranet) detection address"));
m_warningLabel->show();
return;
}
int pos = 0;
QRegExp rx;
//url regular expression
rx.setPattern("(https?|ftp|file)://[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]");
QRegExpValidator rv;
rv.setRegExp(rx);
//Test for a match between the url and the regular expression
QValidator::State rvState = rv.validate(text, pos);
if (rvState == QValidator::Acceptable) {
m_confirmBtn->setEnabled(true);
m_warningLabel->clear();
m_warningLabel->hide();
} else {
m_confirmBtn->setEnabled(false);
m_warningLabel->setText(tr("Format error"));
m_warningLabel->show();
}
}
void ConnectivityPage::closeEvent(QCloseEvent *event)
{
Q_EMIT pageClose();
return QWidget::closeEvent(event);
}

View File

@ -0,0 +1,55 @@
#ifndef CONNECTIVITYPAGE_H
#define CONNECTIVITYPAGE_H
#include <QObject>
#include <QDialog>
#include <QLabel>
#include <QRadioButton>
#include <QDBusInterface>
#include <QLineEdit>
#include <QPushButton>
#include <QScrollArea>
#include "divider.h"
#include "kylinconnectresource.h"
class ConnectivityPage : public QDialog
{
Q_OBJECT
public:
explicit ConnectivityPage(QString uri = "", QWidget *parent = nullptr);
protected:
void closeEvent(QCloseEvent *event);
private:
QScrollArea *m_scrollArea;
QWidget* m_warningWidget;
QWidget* m_centerWidget;
QWidget* m_editWidget;
QWidget* m_bottomWidget;
QString m_uri;
QPushButton *m_confirmBtn;
QLabel *m_icon;
QLabel *m_statusText;
QLabel *m_text;
QRadioButton *m_publicNetworkButton;
QRadioButton *m_intranetButton;
QLineEdit *m_uriEdit;
QLabel* m_warningLabel;
KyConnectResourse* m_connectResource;
void initUi();
void initConnect();
private Q_SLOTS:
void setWarning(NetworkManager::Connectivity connectivity);
void checkUri();
Q_SIGNALS:
void pageClose();
};
#endif // CONNECTIVITYPAGE_H

View File

@ -5,6 +5,7 @@ include(tab-pages/tab-pages.pri)
include(list-items/list-items.pri)
include(netdetails/netdetails.pri)
include(enterprise-wlan/enterprise-wlan.pri)
include(connectivity/connectivity.pri)
include(networkmode/networkmode.pri)
FORMS +=

View File

@ -253,6 +253,18 @@ void WlanListItem::keyPressEvent(QKeyEvent *event)
return QFrame::keyPressEvent(event);
}
void WlanListItem::paintEvent(QPaintEvent *event)
{
QPalette pal = this->palette();
if (m_pwdLineEdit != nullptr) {
pal.setColor(QPalette::Base, pal.color(QPalette::Base));
pal.setColor(QPalette::Text, pal.color(QPalette::Text));
m_pwdLineEdit->setPalette(pal);
}
return QWidget::paintEvent(event);
}
void WlanListItem::initWlanUI()
{
m_hasPwd = (m_wirelessNetItem.m_secuType.isEmpty() || m_wirelessNetItem.m_secuType == "") ? false : true;

View File

@ -91,6 +91,7 @@ protected:
void leaveEvent(QEvent *event);
bool eventFilter(QObject *watched, QEvent *event);
void keyPressEvent(QKeyEvent *event);
void paintEvent(QPaintEvent *event);
Q_SIGNALS:
void itemHeightChanged(const bool isExpanded, const QString &ssid);

View File

@ -33,11 +33,13 @@
#include "ukuistylehelper/ukuistylehelper.h"
#include "windowmanager/windowmanager.h"
#include "kysdk/kysdk-system/libkysysinfo.h"
#include "kylinutil.h"
#define MAINWINDOW_WIDTH 420
#define MAINWINDOW_HEIGHT 476
#define LAYOUT_MARGINS 0,0,0,0
#define LOADING_TRAYICON_TIMER_MS 60
#define TABBAR_HEIGHT 30
#define THEME_SCHAME "org.ukui.style"
#define COLOR_THEME "styleName"
@ -68,10 +70,16 @@ const QString intel = "V10SP1-edu";
#define LOW_SIGNAL_LIMIT_ICON "ukui-network-wireless-signal-weak-error-symbolic"
#define NONE_SIGNAL_LIMIT_ICON "ukui-network-wireless-signal-none-error-symbolic"
#define EXCELLENT_SIGNAL_INTRANET_ICON "ukui-network-wireless-signal-excellent-intranet-symbolic"
#define GOOD_SIGNAL_INTRANET_ICON "ukui-network-wireless-signal-good-intranet-symbolic"
#define OK_SIGNAL_INTRANET_ICON "ukui-network-wireless-signal-ok-intranet-symbolic"
#define LOW_SIGNAL_INTRANET_ICON "ukui-network-wireless-signal-weak-intranet-symbolic"
#define NONE_SIGNAL_INTRANET_ICON "ukui-network-wireless-signal-none-intranet-symbolic"
#include <kwindowsystem.h>
#include <kwindowsystem_export.h>
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
MainWindow::MainWindow(QString display, QWidget *parent) : QMainWindow(parent), m_display(display)
{
firstlyStart();
}
@ -176,6 +184,11 @@ void MainWindow::firstlyStart()
//加载key ring
agent_init();
//单网卡显示
setCentralWidgetPages();
connect(m_lanWidget, &LanPage::deviceStatusChanged, this, &MainWindow::setCentralWidgetPages);
connect(m_wlanWidget, &LanPage::wirelessDeviceStatusChanged, this, &MainWindow::setCentralWidgetPages);
}
/**
@ -367,10 +380,12 @@ void MainWindow::initTrayIcon()
connect(iconTimer, &QTimer::timeout, this, &MainWindow::onSetTrayIconLoading);
m_trayIconMenu = new QMenu();
m_showMainwindowAction = new QAction(tr("Show MainWindow"),this);
// m_showMainwindowAction = new QAction(tr("Show MainWindow"),this);
m_showSettingsAction = new QAction(tr("Settings"),this);
m_showConnectivityPageAction = new QAction(tr("Network Connectivity Detection"), this);
m_showSettingsAction->setIcon(QIcon::fromTheme("document-page-setup-symbolic", QIcon(":/res/x/setup.png")) );
m_showConnectivityPageAction->setIcon(QIcon::fromTheme("gnome-netstatus-txrx"));
// m_trayIconMenu->addAction(m_showMainwindowAction);
m_trayIconMenu->addAction(m_showSettingsAction);
m_trayIcon->setContextMenu(m_trayIconMenu);
@ -380,6 +395,20 @@ void MainWindow::initTrayIcon()
connect(m_trayIcon, &QSystemTrayIcon::activated, this, &MainWindow::onTrayIconActivated);
// connect(m_showMainwindowAction, &QAction::triggered, this, &MainWindow::onShowMainwindowActionTriggled);
connect(m_showSettingsAction, &QAction::triggered, this, &MainWindow::onShowSettingsActionTriggled);
connect(m_showConnectivityPageAction, &QAction::triggered, [=]() {
if (m_connectivityPage != nullptr) {
KWindowSystem::activateWindow(m_connectivityPage->winId());
KWindowSystem::raiseWindow(m_connectivityPage->winId());
return;
}
QString uri = getConnectivityCheckSpareUriByGDbus();
m_connectivityPage = new ConnectivityPage(uri, this);
connect(m_connectivityPage, &ConnectivityPage::pageClose, [&](){
m_connectivityPage = nullptr;
});
m_connectivityPage->show();
});
m_trayIcon->show();
}
@ -417,6 +446,7 @@ void MainWindow::initDbusConnnect()
connect(m_wlanWidget, &WlanPage::timeToUpdate , this, &MainWindow::onTimeUpdateTrayIcon);
connect(m_wlanWidget, &WlanPage::showMainWindow, this, &MainWindow::onShowMainWindow);
connect(m_wlanWidget, &WlanPage::connectivityChanged, this, &MainWindow::onConnectivityChanged);
connect(m_wlanWidget, &WlanPage::connectivityCheckSpareUriChanged, this, &MainWindow::onConnectivityCheckSpareUriChanged);
connect(m_lanWidget, &LanPage::lanConnectChanged, this, &MainWindow::onRefreshTrayIconTooltip);
connect(m_lanWidget, &LanPage::deviceStatusChanged, this, &MainWindow::onRefreshTrayIconTooltip);
@ -435,6 +465,27 @@ void MainWindow::initDbusConnnect()
hideMainwindow();
}
});
QDBusConnection::sessionBus().connect(QString("com.kylin.network"),
QString("/com/kylin/network"),
QString("com.kylin.network"),
QString("showKylinNMSignal"), this, SLOT(onShowKylinNMSlot(QString,int)));
QDBusConnection::sessionBus().connect(QString("com.kylin.network"),
QString("/com/kylin/network"),
QString("com.kylin.network"),
QString("showPropertyWidgetSignal"), this, SLOT(onShowPropertyWidgetSlot(QString,QString,QString)));
QDBusConnection::sessionBus().connect(QString("com.kylin.network"),
QString("/com/kylin/network"),
QString("com.kylin.network"),
QString("showCreateWiredConnectWidgetSignal"), this, SLOT(onShowCreateWiredConnectWidgetSlot(QString,QString)));
QDBusConnection::sessionBus().connect(QString("com.kylin.network"),
QString("/com/kylin/network"),
QString("com.kylin.network"),
QString("showAddOtherWlanWidgetSignal"), this, SLOT(onShowAddOtherWlanWidgetSlot(QString,QString)));
}
/**
@ -751,10 +802,34 @@ void MainWindow::onRefreshTrayIcon()
}
}
if(!getConnectivityCheckSpareUriByGDbus().isEmpty()) {
if (iconStatus == IconActiveType::LAN_CONNECTED) {
m_trayIcon->setIcon(QIcon::fromTheme("network-intranet-symbolic"));
} else if (iconStatus == IconActiveType::WLAN_CONNECTED) {
if (signalStrength > MW_EXCELLENT_SIGNAL){
m_trayIcon->setIcon(QIcon::fromTheme(EXCELLENT_SIGNAL_INTRANET_ICON));
} else if (signalStrength > MW_GOOD_SIGNAL) {
m_trayIcon->setIcon(QIcon::fromTheme(GOOD_SIGNAL_INTRANET_ICON));
} else if (signalStrength > MW_OK_SIGNAL) {
m_trayIcon->setIcon(QIcon::fromTheme(OK_SIGNAL_INTRANET_ICON));
} else if (signalStrength > MW_LOW_SIGNAL) {
m_trayIcon->setIcon(QIcon::fromTheme(LOW_SIGNAL_INTRANET_ICON));
} else {
m_trayIcon->setIcon(QIcon::fromTheme(NONE_SIGNAL_INTRANET_ICON));
}
}
}
if (signalStrength == -1) {
m_trayIcon->setIcon(QIcon::fromTheme("network-wired-disconnected-symbolic"));
}
onRefreshTrayIconTooltip();
// if (iconStatus > IconActiveType::NOT_CONNECTED) {
// m_trayIconMenu->addAction(m_showConnectivityPageAction);
// } else {
// m_trayIconMenu->removeAction(m_showConnectivityPageAction);
// }
}
void MainWindow::onSetTrayIconLoading()
@ -844,8 +919,56 @@ void MainWindow::onRefreshTrayIconTooltip()
m_trayIcon->setToolTip(trayIconToolTip);
}
void MainWindow::setCentralWidgetPages()
{
bool isChanged = false;
if (m_isWiredUsable != m_lanWidget->isWiredDeviceUsable()) {
if (m_lanWidget->isWiredDeviceUsable()) {
m_centralWidget->insertTab(LANPAGE, m_lanWidget, "");
m_isWiredUsable = true;
} else {
m_centralWidget->removeTab(LANPAGE);
m_isWiredUsable = false;
}
isChanged = true;
}
if (m_isWirelessUsable != m_wlanWidget->isWirelessDeviceUsable()) {
if (m_wlanWidget->isWirelessDeviceUsable()) {
m_centralWidget->insertTab(WLANPAGE, m_wlanWidget, "");
m_isWirelessUsable = true;
} else {
m_centralWidget->removeTab(WLANPAGE);
m_isWirelessUsable = false;
}
isChanged = true;
}
if (!isChanged) {
return;
}
if (m_isWiredUsable && m_isWirelessUsable) {
m_centralWidget->tabBar()->show();
this->setFixedHeight(MAINWINDOW_HEIGHT);
resetWindowPosition();
} else {
m_centralWidget->tabBar()->hide();
this->setFixedHeight(MAINWINDOW_HEIGHT - TABBAR_HEIGHT);
resetWindowPosition();
}
if (m_trayIcon) {
m_trayIcon->setVisible(m_isWiredUsable || m_isWirelessUsable);
}
}
void MainWindow::onShowMainWindow(int type)
{
if (!m_trayIcon->isVisible()) {
qWarning() << "no valid network card, do not show kylin-nm mainwindow";
return;
}
if (type == LANPAGE || type == WLANPAGE) {
m_centralWidget->setCurrentIndex(type);
@ -872,6 +995,19 @@ void MainWindow::onConnectivityChanged(NetworkManager::Connectivity connectivity
onRefreshTrayIcon();
}
void MainWindow::onConnectivityCheckSpareUriChanged()
{
if (!m_trayIcon) {
return;
}
if (iconStatus == ACTIVATING) {
return;
}
onRefreshTrayIcon();
}
void MainWindow::onTimeUpdateTrayIcon()
{
if (!m_trayIcon) {
@ -899,13 +1035,14 @@ void MainWindow::keyPressEvent(QKeyEvent *event)
/**
* @brief MainWindow::getWirelessList wifi列表dbus调用
* @param map
* @param devName
* @param list
*/
void MainWindow::getWirelessList(QMap<QString, QVector<QStringList> > &map)
void MainWindow::getWirelessList(QString devName, QList<QStringList> &list)
{
map.clear();
list.clear();
if (nullptr != m_wlanWidget) {
m_wlanWidget->getWirelessList(map);
m_wlanWidget->getWirelessList(devName, list);
}
}
@ -920,11 +1057,11 @@ bool MainWindow::getWirelessSwitchBtnState()
* @brief MainWindow::getWiredList lan列表dbus调用
* @param map
*/
void MainWindow::getWiredList(QMap<QString, QVector<QStringList>> &map)
void MainWindow::getWiredList(QString devName, QList<QStringList> &list)
{
map.clear();
list.clear();
if (nullptr != m_lanWidget) {
m_lanWidget->getWiredList(map);
m_lanWidget->getWiredList(devName, list);
}
}
@ -1088,3 +1225,32 @@ void MainWindow::keyRingClear()
{
agent_clear();
}
void MainWindow::onShowKylinNMSlot(QString display, int type)
{
if (display == m_display) {
onShowMainWindow(type);
}
}
//唤起属性页 根据网卡类型 参数2 为ssid/uuid
void MainWindow::onShowPropertyWidgetSlot(QString display, QString devName, QString ssid)
{
if (display == m_display) {
showPropertyWidget(devName, ssid);
}
}
//唤起新建有线连接界面
void MainWindow::onShowCreateWiredConnectWidgetSlot(QString display, QString devName)
{
if (display == m_display) {
showCreateWiredConnectWidget(devName);
}
}
//唤起加入其他无线网络界面
void MainWindow::onShowAddOtherWlanWidgetSlot(QString display, QString devName)
{
if (display == m_display) {
showAddOtherWlanWidget(devName);
}
}

View File

@ -34,6 +34,7 @@
#include "wlanpage.h"
#include "netdetails/netdetail.h"
#include "netdetails/joinhiddenwifipage.h"
#include "connectivity/connectivitypage.h"
//安全中心-网络防火墙模式配置
#include "networkmodeconfig.h"
//删除此头文件,别在添加
@ -47,7 +48,9 @@
enum IconActiveType {
NOT_CONNECTED = 0,
LAN_CONNECTED,
LAN_CONNECTED_INTRANET,
WLAN_CONNECTED,
WLAN_CONNECTED_INTRANET,
LAN_CONNECTED_LIMITED,
WLAN_CONNECTED_LIMITED,
ACTIVATING,
@ -61,7 +64,7 @@ class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = nullptr);
explicit MainWindow(QString display, QWidget *parent = nullptr);
void showMainwindow();
void hideMainwindow();
@ -69,8 +72,8 @@ public:
void setWirelessDefaultDevice(QString deviceName);
//for dbus
void getWirelessList(QMap<QString, QVector<QStringList> > &map);
void getWiredList(QMap<QString, QVector<QStringList>> &map);
void getWirelessList(QString devName, QList<QStringList> &list);
void getWiredList(QString devName, QList<QStringList> &list);
//开启热点
void activeWirelessAp(const QString apName, const QString apPassword, const QString wirelessBand, const QString apDevice);
//断开热点
@ -186,6 +189,8 @@ private:
LanPage * m_lanWidget = nullptr;
WlanPage * m_wlanWidget = nullptr;
ConnectivityPage* m_connectivityPage = nullptr;
//监听主题的Gsettings
QGSettings * m_styleGsettings = nullptr;
@ -198,6 +203,7 @@ private:
QMenu * m_trayIconMenu = nullptr;
QAction * m_showMainwindowAction = nullptr;
QAction * m_showSettingsAction = nullptr;
QAction * m_showConnectivityPageAction = nullptr;
bool m_lanIsLoading = false;
bool m_wlanIsLoading = false;
@ -213,6 +219,11 @@ private:
uint m_intervalTime = 100;
uint m_registerCount = 0;
QString m_display;
bool m_isWiredUsable = true;
bool m_isWirelessUsable = true;
public Q_SLOTS:
void onShowMainWindow(int type);
@ -227,9 +238,20 @@ private Q_SLOTS:
void onLanConnectStatusToChangeTrayIcon(int state);
void onWlanConnectStatusToChangeTrayIcon(int state);
void onConnectivityChanged(NetworkManager::Connectivity connectivity);
void onConnectivityCheckSpareUriChanged();
void onTimeUpdateTrayIcon();
void onTabletModeChanged(bool mode);
void onRefreshTrayIconTooltip();
void onShowKylinNMSlot(QString display, int type);
//唤起属性页 根据网卡类型 参数2 为ssid/uuid
void onShowPropertyWidgetSlot(QString display, QString devName, QString ssid);
//唤起新建有线连接界面
void onShowCreateWiredConnectWidgetSlot(QString display, QString devName);
//唤起加入其他无线网络界面
void onShowAddOtherWlanWidgetSlot(QString display, QString devName);
//设置界面显示 单网卡/多网卡
void setCentralWidgetPages();
};
#endif // MAINWINDOW_H

View File

@ -20,6 +20,9 @@
#include "firewalldialog.h"
#include <QApplication>
#include "windowmanager/windowmanager.h"
#include "kwindowsystem.h"
#include "kwindowsystem_export.h"
#define THEME_SCHAME "org.ukui.style"
#define COLOR_THEME "styleName"
@ -30,6 +33,7 @@ FirewallDialog::FirewallDialog(QWidget *parent): KDialog(parent)
initUI();
this->setWindowIcon(QIcon::fromTheme("kylin-network"));
this->setFixedSize(480, 204);
KWindowSystem::setState(this->winId(), NET::SkipTaskbar | NET::SkipPager);
setAttribute(Qt::WA_DeleteOnClose);
// centerToScreen();
connect(qApp, &QApplication::paletteChanged, this, &FirewallDialog::onPaletteChanged);

View File

@ -996,34 +996,29 @@ void LanPage::onConnectionStateChange(QString uuid,
}
void LanPage::getWiredList(QMap<QString, QVector<QStringList> > &map)
void LanPage::getWiredList(QString devName, QList<QStringList> &list)
{
QStringList devlist;
m_deviceResource->getNetworkDeviceList(NetworkManager::Device::Type::Ethernet, devlist);
if (devlist.isEmpty()) {
if (!devlist.contains(devName)) {
return;
}
Q_FOREACH (auto deviceName, devlist) {
QList<KyConnectItem *> activedList;
QList<KyConnectItem *> deactivedList;
QVector<QStringList> vector;
m_activeResourse->getActiveConnectionList(deviceName,NetworkManager::ConnectionSettings::Wired,activedList);
m_activeResourse->getActiveConnectionList(devName,NetworkManager::ConnectionSettings::Wired,activedList);
if (!activedList.isEmpty()) {
vector.append(QStringList() << activedList.at(0)->m_connectName << activedList.at(0)->m_connectUuid << activedList.at(0)->m_connectPath);
list.append(QStringList() << activedList.at(0)->m_connectName << activedList.at(0)->m_connectUuid << activedList.at(0)->m_connectPath);
} else {
vector.append(QStringList()<<("--"));
list.append(QStringList()<<("--"));
}
m_connectResourse->getConnectionList(deviceName, NetworkManager::ConnectionSettings::Wired, deactivedList); //未激活列表的显示
m_connectResourse->getConnectionList(devName, NetworkManager::ConnectionSettings::Wired, deactivedList); //未激活列表的显示
if (!deactivedList.isEmpty()) {
for (int i = 0; i < deactivedList.size(); i++) {
vector.append(QStringList()<<deactivedList.at(i)->m_connectName<<deactivedList.at(i)->m_connectUuid << deactivedList.at(i)->m_connectPath);
list.append(QStringList()<<deactivedList.at(i)->m_connectName<<deactivedList.at(i)->m_connectUuid << deactivedList.at(i)->m_connectPath);
}
}
map.insert(deviceName, vector);
}
return;
}
void LanPage::sendLanUpdateSignal(KyConnectItem *p_connectItem)

View File

@ -43,7 +43,7 @@ public:
~LanPage();
//for dbus
void getWiredList(QMap<QString, QVector<QStringList> > &map);
void getWiredList(QString devName, QList<QStringList> &list);
void activateWired(const QString& devName, const QString& connUuid);
void deactivateWired(const QString& devName, const QString& connUuid);
void showDetailPage(QString devName, QString uuid);
@ -53,6 +53,10 @@ public:
bool lanIsConnected();
void getWiredDeviceConnectState(QMap<QString, QString> &map);
bool isWiredDeviceUsable() {
return !m_devList.isEmpty();
}
protected:
bool eventFilter(QObject *watched, QEvent *event);

View File

@ -82,6 +82,7 @@ WlanPage::WlanPage(QWidget *parent) : TabPage(parent)
connect(m_wirelessConnectOpreation, &KyWirelessConnectOperation::wifiEnabledChanged, this, &WlanPage::onWifiEnabledChanged);
connect(m_connectResource, &KyConnectResourse::connectivityChanged, this, &WlanPage::connectivityChanged);
connect(m_connectResource, &KyConnectResourse::connectivityCheckSpareUriChanged, this, &WlanPage::connectivityCheckSpareUriChanged);
connect(m_netSwitch, &KSwitchButton::clicked, this, [=](bool checked) {
//解决 switchBtn不支持点击的情况下点击按钮有无线网卡后不自动开启的问题
if (getSwitchBtnEnable()) {
@ -295,9 +296,8 @@ void WlanPage::initDeviceCombox()
}
} else {
m_deviceFrame->hide();
//解决因m_currentDevice被置空安全中心网络显示BUG
// m_currentDevice = "";
// setDefaultDevice(WIRELESS, m_currentDevice);
m_currentDevice = "";
setDefaultDevice(WIRELESS, m_currentDevice);
}
connect(m_deviceComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged),
@ -781,7 +781,6 @@ void WlanPage::deleteDeviceFromCombox(QString deviceName)
disconnect(m_deviceComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged),
this, &WlanPage::onDeviceComboxIndexChanged);
if (getSwitchBtnState()) {
if (0 == m_devList.count()) {
m_deviceFrame->hide();
//m_tipsLabel->show();
@ -801,7 +800,6 @@ void WlanPage::deleteDeviceFromCombox(QString deviceName)
setDefaultDevice(WIRELESS, m_currentDevice);
}
}
}
connect(m_deviceComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged),
this, &WlanPage::onDeviceComboxIndexChanged);
@ -1359,38 +1357,33 @@ void WlanPage::onRefreshIconTimer()
}
//for dbus
void WlanPage::getWirelessList(QMap<QString, QVector<QStringList> > &map)
void WlanPage::getWirelessList(QString devName, QList<QStringList> &list)
{
QMap<QString,QStringList> actMap;
m_wirelessNetResource->getWirelessActiveConnection(NetworkManager::ActiveConnection::State::Activated, actMap);
KyWirelessNetItem data;
QMap<QString, QList<KyWirelessNetItem> > wlanMap;
if (!m_wirelessNetResource->getAllDeviceWifiNetwork(wlanMap)) {
QList<KyWirelessNetItem> wlanList;
if (!m_wirelessNetResource->getDeviceWifiNetwork(devName, wlanList)) {
return;
}
QMap<QString, QList<KyWirelessNetItem> >::iterator iter = wlanMap.begin();
while (iter != wlanMap.end()) {
QVector<QStringList> vector;
QString activeSsid ;
//先是已连接
if (actMap.contains(iter.key())) {
qDebug() << "find " <<iter.key();
KyWirelessNetItem data;
if (m_wirelessNetResource->getActiveWirelessNetItem(devName, data)) {
qDebug() << "find " << devName;
QString ssid ="";
m_wirelessNetResource->getSsidByUuid(actMap[iter.key()].at(0), ssid);
if (m_wirelessNetResource->getWifiNetwork(iter.key(), ssid, data)) {
m_wirelessNetResource->getSsidByUuid(data.m_connectUuid, ssid);
if (m_wirelessNetResource->getWifiNetwork(devName, ssid, data)) {
int category = 0;
int signalStrength;
QString uni,secuType;
if (m_netDeviceResource->getActiveConnectionInfo(iter.key(), signalStrength, uni, secuType)) {
if (m_netDeviceResource->getActiveConnectionInfo(devName, signalStrength, uni, secuType)) {
category = data.getCategory(uni);
}
if (!m_showWifi6Plus && category == 2) {
category = 1;
}
vector.append(QStringList() << data.m_NetSsid
list.append(QStringList() << data.m_NetSsid
<< QString::number(signalStrength)
<< secuType
<< data.m_connectUuid
@ -1398,13 +1391,13 @@ void WlanPage::getWirelessList(QMap<QString, QVector<QStringList> > &map)
<< QString::number(category));
activeSsid = data.m_NetSsid;
} else {
vector.append(QStringList("--"));
list.append(QStringList("--"));
}
} else {
vector.append(QStringList("--"));
list.append(QStringList("--"));
}
//未连接
Q_FOREACH (auto itemData, iter.value()) {
Q_FOREACH (auto itemData, wlanList) {
if (itemData.m_NetSsid == activeSsid) {
continue;
}
@ -1413,18 +1406,12 @@ void WlanPage::getWirelessList(QMap<QString, QVector<QStringList> > &map)
if (!m_showWifi6Plus && category == 2) {
category = 1;
}
vector.append(QStringList()<<itemData.m_NetSsid
list.append(QStringList()<<itemData.m_NetSsid
<< QString::number(itemData.m_signalStrength)
<< itemData.m_secuType
<< (m_connectResource->isApConnection(itemData.m_connectUuid) ? IsApConnection : NotApConnection)
<< QString::number(category));
}
map.insert(iter.key(), vector);
iter++;
}
return;
}
//for dbus
@ -1526,7 +1513,7 @@ void WlanPage::activateWirelessConnection(const QString& devName, const QString&
m_inactivatedNetListWidget->scrollToItem(p_listWidgetItem, QAbstractItemView::EnsureVisible);
QMouseEvent *event = new QMouseEvent(QEvent::MouseButtonPress, QPoint(0,0), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
QMouseEvent *event = new QMouseEvent(QEvent::MouseButtonRelease, QPoint(0,0), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
QApplication::postEvent(p_wlanItem, event);
} else {
qDebug() << "[WlanPage]activateWirelessConnection no such " << ssid << "in" << devName;

View File

@ -52,7 +52,7 @@ public:
~WlanPage() = default;
//for dbus
void getWirelessList(QMap<QString, QVector<QStringList> > &map);
void getWirelessList(QString devName, QList<QStringList> &list);
//开启热点
void activeWirelessAp(const QString apName, const QString apPassword, const QString wirelessBand, const QString apDevice);
//断开热点
@ -88,6 +88,10 @@ public:
return m_currentDevice;
}
bool isWirelessDeviceUsable() {
return !m_devList.isEmpty();
}
Q_SIGNALS:
void oneItemExpanded(const QString &ssid);
void wlanAdd(QString devName, QStringList info);
@ -104,6 +108,7 @@ Q_SIGNALS:
void showMainWindow(int type);
void connectivityChanged(NetworkManager::Connectivity connectivity);
void connectivityCheckSpareUriChanged();
void wirelessSwitchBtnChanged(bool state);

View File

@ -18,7 +18,7 @@
//#include "mainwindow.h"
#include "mainwindow.h"
#include "dbusadaptor.h"
#include "dbus.h"
#include <QTranslator>
#include <QLocale>
#include "qt-single-application.h"
@ -130,23 +130,30 @@ int main(int argc, char *argv[])
parser.addOptions({swOption,snOption});
parser.process(a);
QString display;
QString sessionType;
if(QString(getenv("XDG_SESSION_TYPE")) == "wayland") {
sessionType = "wayland";
display = getenv("WAYLAND_DISPLAY");
} else {
sessionType = "x11";
display = getenv("DISPLAY");
}
qDebug() << sessionType << display;
qApp->setProperty("sessionType", sessionType);
QDBusInterface interface("com.kylin.network",
"/com/kylin/network",
"com.kylin.network",
QDBusConnection::sessionBus());
if (a.isRunning()) {
if(interface.isValid()) {
if (parser.isSet(swOption))
{
if (parser.isSet(swOption)) {
interface.call(QStringLiteral("showKylinNM"), 1);
} else if (parser.isSet(snOption)) {
interface.call(QStringLiteral("showKylinNM"), 0);
} else {
const QString serviceName = "com.kylin.network";
QDBusConnectionInterface *interface1 = QDBusConnection::sessionBus().interface();
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())) {
interface.call(QStringLiteral("showKylinNM"), 2);
}
}
@ -195,7 +202,7 @@ int main(int argc, char *argv[])
::usleep(1000);
}
MainWindow w;
MainWindow w(display, nullptr);
a.setActivationWindow(&w);
w.setProperty("useStyleWindowManager", false); //禁用拖动
a.setWindowIcon(QIcon::fromTheme("kylin-network"));
@ -207,13 +214,11 @@ int main(int argc, char *argv[])
// window_hints.decorations = MWM_DECOR_BORDER;
// XAtomHelper::getInstance()->setWindowMotifHint(w.winId(), window_hints);
DbusAdaptor adaptor(&w);
Q_UNUSED(adaptor);
// w.setWindowFlags(Qt::CustomizeWindowHint | Qt::FramelessWindowHint /*| Qt::X11BypassWindowManagerHint*/);
auto connection = QDBusConnection::sessionBus();
if (!connection.registerService("com.kylin.network") || !connection.registerObject("/com/kylin/network", &w)) {
qCritical() << "QDbus register service failed reason:" << connection.lastError();
}
DbusAdaptor adaptor(display, &w);
Q_UNUSED(adaptor);
return a.exec();
}

View File

@ -24,6 +24,54 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ConnectivityPage</name>
<message>
<location filename="../frontend/connectivity/connectivitypage.cpp" line="25"/>
<source>Network connectivity detection</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/connectivity/connectivitypage.cpp" line="55"/>
<source>If access to the Internet is restricted, please switch the network IP connectivity detection method and try again.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/connectivity/connectivitypage.cpp" line="61"/>
<source>Public network (default)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/connectivity/connectivitypage.cpp" line="63"/>
<source>Local area network (intranet)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/connectivity/connectivitypage.cpp" line="74"/>
<source>Confirm</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/connectivity/connectivitypage.cpp" line="161"/>
<source>The network is connected and can access the Internet normally.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/connectivity/connectivitypage.cpp" line="166"/>
<source>The network is connected and access to the Internet is restricted.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/connectivity/connectivitypage.cpp" line="177"/>
<source>Please enter the local area network (intranet) detection address</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/connectivity/connectivitypage.cpp" line="196"/>
<source>Format error</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CreatNetPage</name>
<message>
@ -260,22 +308,22 @@
<context>
<name>FirewallDialog</name>
<message>
<location filename="../frontend/networkmode/firewalldialog.cpp" line="85"/>
<location filename="../frontend/networkmode/firewalldialog.cpp" line="89"/>
<source>Allow other devices on this network to discover this computer?</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/networkmode/firewalldialog.cpp" line="87"/>
<location filename="../frontend/networkmode/firewalldialog.cpp" line="91"/>
<source>It is not recommended to enable this feature on public networks</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/networkmode/firewalldialog.cpp" line="89"/>
<location filename="../frontend/networkmode/firewalldialog.cpp" line="93"/>
<source>Not allowed (recommended)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/networkmode/firewalldialog.cpp" line="90"/>
<location filename="../frontend/networkmode/firewalldialog.cpp" line="94"/>
<source>Allowed</source>
<translation type="unfinished"></translation>
</message>
@ -313,23 +361,23 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/netdetails/ipv4page.cpp" line="265"/>
<location filename="../frontend/netdetails/ipv4page.cpp" line="264"/>
<source>Invalid address</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/netdetails/ipv4page.cpp" line="274"/>
<location filename="../frontend/netdetails/ipv4page.cpp" line="273"/>
<source>Invalid subnet mask</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/netdetails/ipv4page.cpp" line="298"/>
<location filename="../frontend/netdetails/ipv4page.cpp" line="299"/>
<location filename="../frontend/netdetails/ipv4page.cpp" line="300"/>
<source>Required</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/netdetails/ipv4page.cpp" line="368"/>
<location filename="../frontend/netdetails/ipv4page.cpp" line="367"/>
<source>Address conflict</source>
<translation type="unfinished"></translation>
</message>
@ -488,23 +536,23 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1240"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1244"/>
<source>Wired Device not carried</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1336"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1344"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1340"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1348"/>
<source>Connected: </source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1336"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1340"/>
<source>(Limited)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1338"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1342"/>
<source>Not Connected</source>
<translation type="unfinished"></translation>
</message>
@ -525,47 +573,47 @@
<context>
<name>MainWindow</name>
<message>
<location filename="../frontend/mainwindow.cpp" line="216"/>
<location filename="../frontend/mainwindow.cpp" line="247"/>
<location filename="../frontend/mainwindow.cpp" line="229"/>
<location filename="../frontend/mainwindow.cpp" line="260"/>
<source>kylin-nm</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/mainwindow.cpp" line="340"/>
<location filename="../frontend/mainwindow.cpp" line="353"/>
<source>LAN</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/mainwindow.cpp" line="342"/>
<location filename="../frontend/mainwindow.cpp" line="355"/>
<source>WLAN</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/mainwindow.cpp" line="371"/>
<location filename="../frontend/mainwindow.cpp" line="384"/>
<source>Settings</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/mainwindow.cpp" line="612"/>
<location filename="../frontend/mainwindow.cpp" line="841"/>
<location filename="../frontend/mainwindow.cpp" line="385"/>
<source>Network Connectivity Detection</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/mainwindow.cpp" line="662"/>
<location filename="../frontend/mainwindow.cpp" line="915"/>
<source>Network tool</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/mainwindow.cpp" line="626"/>
<location filename="../frontend/mainwindow.cpp" line="676"/>
<source>Network Card</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/mainwindow.cpp" line="824"/>
<location filename="../frontend/mainwindow.cpp" line="898"/>
<source>Not connected to the network</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/mainwindow.cpp" line="370"/>
<source>Show MainWindow</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MultipleDnsWidget</name>
@ -967,35 +1015,35 @@
<message>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="176"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="202"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="636"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="655"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="665"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="648"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="667"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="677"/>
<source>Disconnect</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="178"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="206"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="303"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="646"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="663"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="315"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="658"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="675"/>
<source>Connect</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="185"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="675"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="687"/>
<source>Property</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="186"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="670"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="682"/>
<source>Forget</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="324"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="336"/>
<source>Auto Connect</source>
<translation type="unfinished"></translation>
</message>
@ -1011,42 +1059,42 @@
<context>
<name>WlanPage</name>
<message>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="131"/>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="132"/>
<source>WLAN</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="133"/>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="134"/>
<source>Activated WLAN</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="144"/>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="145"/>
<source>Other WLAN</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="1754"/>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="1741"/>
<source>Connected: </source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="1756"/>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="1743"/>
<source>Not Connected</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="107"/>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="108"/>
<source>No wireless network card detected</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="974"/>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="972"/>
<source>WLAN Connected Successfully</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="970"/>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="968"/>
<source>WLAN Disconnected Successfully</source>
<translation type="unfinished"></translation>
</message>

View File

@ -55,6 +55,54 @@
<translation></translation>
</message>
</context>
<context>
<name>ConnectivityPage</name>
<message>
<location filename="../frontend/connectivity/connectivitypage.cpp" line="25"/>
<source>Network connectivity detection</source>
<translation></translation>
</message>
<message>
<location filename="../frontend/connectivity/connectivitypage.cpp" line="55"/>
<source>If access to the Internet is restricted, please switch the network IP connectivity detection method and try again.</source>
<translation> IPལ.</translation>
</message>
<message>
<location filename="../frontend/connectivity/connectivitypage.cpp" line="61"/>
<source>Public network (default)</source>
<translation> ( )</translation>
</message>
<message>
<location filename="../frontend/connectivity/connectivitypage.cpp" line="63"/>
<source>Local area network (intranet)</source>
<translation> ( )</translation>
</message>
<message>
<location filename="../frontend/connectivity/connectivitypage.cpp" line="74"/>
<source>Confirm</source>
<translation></translation>
</message>
<message>
<location filename="../frontend/connectivity/connectivitypage.cpp" line="161"/>
<source>The network is connected and can access the Internet normally.</source>
<translation>.</translation>
</message>
<message>
<location filename="../frontend/connectivity/connectivitypage.cpp" line="166"/>
<source>The network is connected and access to the Internet is restricted.</source>
<translation>.</translation>
</message>
<message>
<location filename="../frontend/connectivity/connectivitypage.cpp" line="177"/>
<source>Please enter the local area network (intranet) detection address</source>
<translation>()</translation>
</message>
<message>
<location filename="../frontend/connectivity/connectivitypage.cpp" line="196"/>
<source>Format error</source>
<translation></translation>
</message>
</context>
<context>
<name>CopyButton</name>
<message>
@ -500,7 +548,7 @@
<message>
<location filename="../frontend/netdetails/dnssettingwidget.cpp" line="70"/>
<source>Close</source>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../frontend/netdetails/dnssettingwidget.cpp" line="73"/>
@ -568,22 +616,22 @@
<translation type="vanished"></translation>
</message>
<message>
<location filename="../frontend/networkmode/firewalldialog.cpp" line="85"/>
<location filename="../frontend/networkmode/firewalldialog.cpp" line="89"/>
<source>Allow other devices on this network to discover this computer?</source>
<translation>?</translation>
</message>
<message>
<location filename="../frontend/networkmode/firewalldialog.cpp" line="87"/>
<location filename="../frontend/networkmode/firewalldialog.cpp" line="91"/>
<source>It is not recommended to enable this feature on public networks</source>
<translation></translation>
</message>
<message>
<location filename="../frontend/networkmode/firewalldialog.cpp" line="89"/>
<location filename="../frontend/networkmode/firewalldialog.cpp" line="93"/>
<source>Not allowed (recommended)</source>
<translation>()</translation>
</message>
<message>
<location filename="../frontend/networkmode/firewalldialog.cpp" line="90"/>
<location filename="../frontend/networkmode/firewalldialog.cpp" line="94"/>
<source>Allowed</source>
<translation></translation>
</message>
@ -629,23 +677,23 @@
<translation></translation>
</message>
<message>
<location filename="../frontend/netdetails/ipv4page.cpp" line="265"/>
<location filename="../frontend/netdetails/ipv4page.cpp" line="264"/>
<source>Invalid address</source>
<translation></translation>
</message>
<message>
<location filename="../frontend/netdetails/ipv4page.cpp" line="274"/>
<location filename="../frontend/netdetails/ipv4page.cpp" line="273"/>
<source>Invalid subnet mask</source>
<translation></translation>
</message>
<message>
<location filename="../frontend/netdetails/ipv4page.cpp" line="298"/>
<location filename="../frontend/netdetails/ipv4page.cpp" line="299"/>
<location filename="../frontend/netdetails/ipv4page.cpp" line="300"/>
<source>Required</source>
<translation></translation>
</message>
<message>
<location filename="../frontend/netdetails/ipv4page.cpp" line="368"/>
<location filename="../frontend/netdetails/ipv4page.cpp" line="367"/>
<source>Address conflict</source>
<translation></translation>
</message>
@ -824,7 +872,7 @@
<translation type="vanished"></translation>
</message>
<message>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1240"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1244"/>
<source>Wired Device not carried</source>
<translation></translation>
</message>
@ -833,18 +881,18 @@
<translation type="vanished"></translation>
</message>
<message>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1336"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1344"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1340"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1348"/>
<source>Connected: </source>
<translation>: </translation>
</message>
<message>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1338"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1342"/>
<source>Not Connected</source>
<translation></translation>
</message>
<message>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1336"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1340"/>
<source>(Limited)</source>
<translation>()</translation>
</message>
@ -865,47 +913,51 @@
<context>
<name>MainWindow</name>
<message>
<location filename="../frontend/mainwindow.cpp" line="216"/>
<location filename="../frontend/mainwindow.cpp" line="247"/>
<location filename="../frontend/mainwindow.cpp" line="229"/>
<location filename="../frontend/mainwindow.cpp" line="260"/>
<source>kylin-nm</source>
<translation></translation>
</message>
<message>
<location filename="../frontend/mainwindow.cpp" line="340"/>
<location filename="../frontend/mainwindow.cpp" line="353"/>
<source>LAN</source>
<translatorcomment>线</translatorcomment>
<translation></translation>
</message>
<message>
<location filename="../frontend/mainwindow.cpp" line="342"/>
<location filename="../frontend/mainwindow.cpp" line="355"/>
<source>WLAN</source>
<translatorcomment>线</translatorcomment>
<translation></translation>
</message>
<message>
<location filename="../frontend/mainwindow.cpp" line="370"/>
<source>Show MainWindow</source>
<translation></translation>
<translation type="vanished"></translation>
</message>
<message>
<location filename="../frontend/mainwindow.cpp" line="371"/>
<location filename="../frontend/mainwindow.cpp" line="384"/>
<source>Settings</source>
<translatorcomment></translatorcomment>
<translation></translation>
</message>
<message>
<location filename="../frontend/mainwindow.cpp" line="612"/>
<location filename="../frontend/mainwindow.cpp" line="841"/>
<location filename="../frontend/mainwindow.cpp" line="385"/>
<source>Network Connectivity Detection</source>
<translation></translation>
</message>
<message>
<location filename="../frontend/mainwindow.cpp" line="662"/>
<location filename="../frontend/mainwindow.cpp" line="915"/>
<source>Network tool</source>
<translation></translation>
</message>
<message>
<location filename="../frontend/mainwindow.cpp" line="626"/>
<location filename="../frontend/mainwindow.cpp" line="676"/>
<source>Network Card</source>
<translation></translation>
</message>
<message>
<location filename="../frontend/mainwindow.cpp" line="824"/>
<location filename="../frontend/mainwindow.cpp" line="898"/>
<source>Not connected to the network</source>
<translation></translation>
</message>
@ -1459,35 +1511,35 @@
<message>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="176"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="202"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="636"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="655"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="665"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="648"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="667"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="677"/>
<source>Disconnect</source>
<translation></translation>
</message>
<message>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="178"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="206"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="303"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="646"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="663"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="315"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="658"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="675"/>
<source>Connect</source>
<translation></translation>
</message>
<message>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="186"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="670"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="682"/>
<source>Forget</source>
<translation></translation>
</message>
<message>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="185"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="675"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="687"/>
<source>Property</source>
<translation></translation>
</message>
<message>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="324"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="336"/>
<source>Auto Connect</source>
<translation></translation>
</message>
@ -1507,22 +1559,22 @@
<context>
<name>WlanPage</name>
<message>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="131"/>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="132"/>
<source>WLAN</source>
<translation></translation>
</message>
<message>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="107"/>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="108"/>
<source>No wireless network card detected</source>
<translation></translation>
</message>
<message>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="133"/>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="134"/>
<source>Activated WLAN</source>
<translation></translation>
</message>
<message>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="144"/>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="145"/>
<source>Other WLAN</source>
<translation></translation>
</message>
@ -1531,22 +1583,22 @@
<translation type="vanished">...</translation>
</message>
<message>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="974"/>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="972"/>
<source>WLAN Connected Successfully</source>
<translation></translation>
</message>
<message>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="970"/>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="968"/>
<source>WLAN Disconnected Successfully</source>
<translation></translation>
</message>
<message>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="1754"/>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="1741"/>
<source>Connected: </source>
<translation>: </translation>
</message>
<message>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="1756"/>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="1743"/>
<source>Not Connected</source>
<translation></translation>
</message>

View File

@ -55,6 +55,54 @@
<translation> </translation>
</message>
</context>
<context>
<name>ConnectivityPage</name>
<message>
<location filename="../frontend/connectivity/connectivitypage.cpp" line="25"/>
<source>Network connectivity detection</source>
<translation> </translation>
</message>
<message>
<location filename="../frontend/connectivity/connectivitypage.cpp" line="55"/>
<source>If access to the Internet is restricted, please switch the network IP connectivity detection method and try again.</source>
<translation> IP .</translation>
</message>
<message>
<location filename="../frontend/connectivity/connectivitypage.cpp" line="61"/>
<source>Public network (default)</source>
<translation> ( )</translation>
</message>
<message>
<location filename="../frontend/connectivity/connectivitypage.cpp" line="63"/>
<source>Local area network (intranet)</source>
<translation> ( )</translation>
</message>
<message>
<location filename="../frontend/connectivity/connectivitypage.cpp" line="74"/>
<source>Confirm</source>
<translation></translation>
</message>
<message>
<location filename="../frontend/connectivity/connectivitypage.cpp" line="161"/>
<source>The network is connected and can access the Internet normally.</source>
<translation> .</translation>
</message>
<message>
<location filename="../frontend/connectivity/connectivitypage.cpp" line="166"/>
<source>The network is connected and access to the Internet is restricted.</source>
<translation> .</translation>
</message>
<message>
<location filename="../frontend/connectivity/connectivitypage.cpp" line="177"/>
<source>Please enter the local area network (intranet) detection address</source>
<translation> ( ) </translation>
</message>
<message>
<location filename="../frontend/connectivity/connectivitypage.cpp" line="196"/>
<source>Format error</source>
<translation> </translation>
</message>
</context>
<context>
<name>CopyButton</name>
<message>
@ -552,22 +600,22 @@
<context>
<name>FirewallDialog</name>
<message>
<location filename="../frontend/networkmode/firewalldialog.cpp" line="85"/>
<location filename="../frontend/networkmode/firewalldialog.cpp" line="89"/>
<source>Allow other devices on this network to discover this computer?</source>
<translation> ?</translation>
</message>
<message>
<location filename="../frontend/networkmode/firewalldialog.cpp" line="87"/>
<location filename="../frontend/networkmode/firewalldialog.cpp" line="91"/>
<source>It is not recommended to enable this feature on public networks</source>
<translation> </translation>
</message>
<message>
<location filename="../frontend/networkmode/firewalldialog.cpp" line="89"/>
<location filename="../frontend/networkmode/firewalldialog.cpp" line="93"/>
<source>Not allowed (recommended)</source>
<translation> ( )</translation>
</message>
<message>
<location filename="../frontend/networkmode/firewalldialog.cpp" line="90"/>
<location filename="../frontend/networkmode/firewalldialog.cpp" line="94"/>
<source>Allowed</source>
<translation></translation>
</message>
@ -613,23 +661,23 @@
<translation> </translation>
</message>
<message>
<location filename="../frontend/netdetails/ipv4page.cpp" line="265"/>
<location filename="../frontend/netdetails/ipv4page.cpp" line="264"/>
<source>Invalid address</source>
<translation> </translation>
</message>
<message>
<location filename="../frontend/netdetails/ipv4page.cpp" line="274"/>
<location filename="../frontend/netdetails/ipv4page.cpp" line="273"/>
<source>Invalid subnet mask</source>
<translation> </translation>
</message>
<message>
<location filename="../frontend/netdetails/ipv4page.cpp" line="298"/>
<location filename="../frontend/netdetails/ipv4page.cpp" line="299"/>
<location filename="../frontend/netdetails/ipv4page.cpp" line="300"/>
<source>Required</source>
<translation> </translation>
</message>
<message>
<location filename="../frontend/netdetails/ipv4page.cpp" line="368"/>
<location filename="../frontend/netdetails/ipv4page.cpp" line="367"/>
<source>Address conflict</source>
<translation> </translation>
</message>
@ -804,7 +852,7 @@
<translation type="vanished"> </translation>
</message>
<message>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1240"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1244"/>
<source>Wired Device not carried</source>
<translation> </translation>
</message>
@ -813,18 +861,18 @@
<translation type="vanished"> </translation>
</message>
<message>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1336"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1344"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1340"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1348"/>
<source>Connected: </source>
<translation>: </translation>
</message>
<message>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1338"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1342"/>
<source>Not Connected</source>
<translation> </translation>
</message>
<message>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1336"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1340"/>
<source>(Limited)</source>
<translation>( )</translation>
</message>
@ -845,47 +893,51 @@
<context>
<name>MainWindow</name>
<message>
<location filename="../frontend/mainwindow.cpp" line="216"/>
<location filename="../frontend/mainwindow.cpp" line="247"/>
<location filename="../frontend/mainwindow.cpp" line="229"/>
<location filename="../frontend/mainwindow.cpp" line="260"/>
<source>kylin-nm</source>
<translation> </translation>
</message>
<message>
<location filename="../frontend/mainwindow.cpp" line="340"/>
<location filename="../frontend/mainwindow.cpp" line="353"/>
<source>LAN</source>
<translatorcomment>线</translatorcomment>
<translation> </translation>
</message>
<message>
<location filename="../frontend/mainwindow.cpp" line="342"/>
<location filename="../frontend/mainwindow.cpp" line="355"/>
<source>WLAN</source>
<translatorcomment>线</translatorcomment>
<translation> </translation>
</message>
<message>
<location filename="../frontend/mainwindow.cpp" line="370"/>
<source>Show MainWindow</source>
<translation> </translation>
<translation type="vanished"> </translation>
</message>
<message>
<location filename="../frontend/mainwindow.cpp" line="371"/>
<location filename="../frontend/mainwindow.cpp" line="384"/>
<source>Settings</source>
<translatorcomment> </translatorcomment>
<translation> </translation>
</message>
<message>
<location filename="../frontend/mainwindow.cpp" line="612"/>
<location filename="../frontend/mainwindow.cpp" line="841"/>
<location filename="../frontend/mainwindow.cpp" line="385"/>
<source>Network Connectivity Detection</source>
<translation> </translation>
</message>
<message>
<location filename="../frontend/mainwindow.cpp" line="662"/>
<location filename="../frontend/mainwindow.cpp" line="915"/>
<source>Network tool</source>
<translation> </translation>
</message>
<message>
<location filename="../frontend/mainwindow.cpp" line="626"/>
<location filename="../frontend/mainwindow.cpp" line="676"/>
<source>Network Card</source>
<translation> </translation>
</message>
<message>
<location filename="../frontend/mainwindow.cpp" line="824"/>
<location filename="../frontend/mainwindow.cpp" line="898"/>
<source>Not connected to the network</source>
<translation> </translation>
</message>
@ -1420,35 +1472,35 @@
<message>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="176"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="202"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="636"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="655"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="665"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="648"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="667"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="677"/>
<source>Disconnect</source>
<translation></translation>
</message>
<message>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="178"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="206"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="303"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="646"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="663"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="315"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="658"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="675"/>
<source>Connect</source>
<translation></translation>
</message>
<message>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="186"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="670"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="682"/>
<source>Forget</source>
<translation> </translation>
</message>
<message>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="185"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="675"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="687"/>
<source>Property</source>
<translation></translation>
</message>
<message>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="324"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="336"/>
<source>Auto Connect</source>
<translation> </translation>
</message>
@ -1468,22 +1520,22 @@
<context>
<name>WlanPage</name>
<message>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="131"/>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="132"/>
<source>WLAN</source>
<translation> </translation>
</message>
<message>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="107"/>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="108"/>
<source>No wireless network card detected</source>
<translation> </translation>
</message>
<message>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="133"/>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="134"/>
<source>Activated WLAN</source>
<translation> </translation>
</message>
<message>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="144"/>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="145"/>
<source>Other WLAN</source>
<translation> </translation>
</message>
@ -1492,22 +1544,22 @@
<translation type="vanished">...</translation>
</message>
<message>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="974"/>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="972"/>
<source>WLAN Connected Successfully</source>
<translation> </translation>
</message>
<message>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="970"/>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="968"/>
<source>WLAN Disconnected Successfully</source>
<translation> </translation>
</message>
<message>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="1754"/>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="1741"/>
<source>Connected: </source>
<translation>: </translation>
</message>
<message>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="1756"/>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="1743"/>
<source>Not Connected</source>
<translation> </translation>
</message>

View File

@ -122,6 +122,54 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ConnectivityPage</name>
<message>
<location filename="../frontend/connectivity/connectivitypage.cpp" line="25"/>
<source>Network connectivity detection</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/connectivity/connectivitypage.cpp" line="55"/>
<source>If access to the Internet is restricted, please switch the network IP connectivity detection method and try again.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/connectivity/connectivitypage.cpp" line="61"/>
<source>Public network (default)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/connectivity/connectivitypage.cpp" line="63"/>
<source>Local area network (intranet)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/connectivity/connectivitypage.cpp" line="74"/>
<source>Confirm</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/connectivity/connectivitypage.cpp" line="161"/>
<source>The network is connected and can access the Internet normally.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/connectivity/connectivitypage.cpp" line="166"/>
<source>The network is connected and access to the Internet is restricted.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/connectivity/connectivitypage.cpp" line="177"/>
<source>Please enter the local area network (intranet) detection address</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/connectivity/connectivitypage.cpp" line="196"/>
<source>Format error</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CreatNetPage</name>
<message>
@ -1279,22 +1327,22 @@
<context>
<name>FirewallDialog</name>
<message>
<location filename="../frontend/networkmode/firewalldialog.cpp" line="85"/>
<location filename="../frontend/networkmode/firewalldialog.cpp" line="89"/>
<source>Allow other devices on this network to discover this computer?</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/networkmode/firewalldialog.cpp" line="87"/>
<location filename="../frontend/networkmode/firewalldialog.cpp" line="91"/>
<source>It is not recommended to enable this feature on public networks</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/networkmode/firewalldialog.cpp" line="89"/>
<location filename="../frontend/networkmode/firewalldialog.cpp" line="93"/>
<source>Not allowed (recommended)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/networkmode/firewalldialog.cpp" line="90"/>
<location filename="../frontend/networkmode/firewalldialog.cpp" line="94"/>
<source>Allowed</source>
<translation type="unfinished"></translation>
</message>
@ -1332,23 +1380,23 @@
<translation type="unfinished">Elle</translation>
</message>
<message>
<location filename="../frontend/netdetails/ipv4page.cpp" line="265"/>
<location filename="../frontend/netdetails/ipv4page.cpp" line="264"/>
<source>Invalid address</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/netdetails/ipv4page.cpp" line="274"/>
<location filename="../frontend/netdetails/ipv4page.cpp" line="273"/>
<source>Invalid subnet mask</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/netdetails/ipv4page.cpp" line="298"/>
<location filename="../frontend/netdetails/ipv4page.cpp" line="299"/>
<location filename="../frontend/netdetails/ipv4page.cpp" line="300"/>
<source>Required</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/netdetails/ipv4page.cpp" line="368"/>
<location filename="../frontend/netdetails/ipv4page.cpp" line="367"/>
<source>Address conflict</source>
<translation type="unfinished"></translation>
</message>
@ -1514,23 +1562,23 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1240"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1244"/>
<source>Wired Device not carried</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1336"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1344"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1340"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1348"/>
<source>Connected: </source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1336"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1340"/>
<source>(Limited)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1338"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1342"/>
<source>Not Connected</source>
<translation type="unfinished"></translation>
</message>
@ -1551,8 +1599,8 @@
<context>
<name>MainWindow</name>
<message>
<location filename="../frontend/mainwindow.cpp" line="216"/>
<location filename="../frontend/mainwindow.cpp" line="247"/>
<location filename="../frontend/mainwindow.cpp" line="229"/>
<location filename="../frontend/mainwindow.cpp" line="260"/>
<source>kylin-nm</source>
<translation></translation>
</message>
@ -1573,33 +1621,38 @@
<translation type="vanished">Gizli ı Bağlan</translation>
</message>
<message>
<location filename="../frontend/mainwindow.cpp" line="340"/>
<location filename="../frontend/mainwindow.cpp" line="353"/>
<source>LAN</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/mainwindow.cpp" line="342"/>
<location filename="../frontend/mainwindow.cpp" line="355"/>
<source>WLAN</source>
<translation>WLAN</translation>
</message>
<message>
<location filename="../frontend/mainwindow.cpp" line="371"/>
<location filename="../frontend/mainwindow.cpp" line="384"/>
<source>Settings</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/mainwindow.cpp" line="612"/>
<location filename="../frontend/mainwindow.cpp" line="841"/>
<location filename="../frontend/mainwindow.cpp" line="385"/>
<source>Network Connectivity Detection</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/mainwindow.cpp" line="662"/>
<location filename="../frontend/mainwindow.cpp" line="915"/>
<source>Network tool</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/mainwindow.cpp" line="626"/>
<location filename="../frontend/mainwindow.cpp" line="676"/>
<source>Network Card</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/mainwindow.cpp" line="824"/>
<location filename="../frontend/mainwindow.cpp" line="898"/>
<source>Not connected to the network</source>
<translation type="unfinished"></translation>
</message>
@ -1616,9 +1669,8 @@
<translation type="vanished">HotSpot</translation>
</message>
<message>
<location filename="../frontend/mainwindow.cpp" line="370"/>
<source>Show MainWindow</source>
<translation>Ana Pencereyi Göster</translation>
<translation type="vanished">Ana Pencereyi Göster</translation>
</message>
<message>
<source>Not connected</source>
@ -2321,35 +2373,35 @@
<message>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="176"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="202"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="636"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="655"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="665"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="648"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="667"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="677"/>
<source>Disconnect</source>
<translation type="unfinished">Bağlantıyı Kes</translation>
</message>
<message>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="178"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="206"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="303"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="646"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="663"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="315"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="658"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="675"/>
<source>Connect</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="185"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="675"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="687"/>
<source>Property</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="186"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="670"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="682"/>
<source>Forget</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="324"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="336"/>
<source>Auto Connect</source>
<translation type="unfinished"></translation>
</message>
@ -2365,42 +2417,42 @@
<context>
<name>WlanPage</name>
<message>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="131"/>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="132"/>
<source>WLAN</source>
<translation type="unfinished">WLAN</translation>
</message>
<message>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="133"/>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="134"/>
<source>Activated WLAN</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="144"/>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="145"/>
<source>Other WLAN</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="1754"/>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="1741"/>
<source>Connected: </source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="1756"/>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="1743"/>
<source>Not Connected</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="107"/>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="108"/>
<source>No wireless network card detected</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="974"/>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="972"/>
<source>WLAN Connected Successfully</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="970"/>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="968"/>
<source>WLAN Disconnected Successfully</source>
<translation type="unfinished"></translation>
</message>

View File

@ -55,6 +55,54 @@
<translation></translation>
</message>
</context>
<context>
<name>ConnectivityPage</name>
<message>
<location filename="../frontend/connectivity/connectivitypage.cpp" line="25"/>
<source>Network connectivity detection</source>
<translation></translation>
</message>
<message>
<location filename="../frontend/connectivity/connectivitypage.cpp" line="55"/>
<source>If access to the Internet is restricted, please switch the network IP connectivity detection method and try again.</source>
<translation>访 Internet IP </translation>
</message>
<message>
<location filename="../frontend/connectivity/connectivitypage.cpp" line="61"/>
<source>Public network (default)</source>
<translation></translation>
</message>
<message>
<location filename="../frontend/connectivity/connectivitypage.cpp" line="63"/>
<source>Local area network (intranet)</source>
<translation></translation>
</message>
<message>
<location filename="../frontend/connectivity/connectivitypage.cpp" line="74"/>
<source>Confirm</source>
<translation></translation>
</message>
<message>
<location filename="../frontend/connectivity/connectivitypage.cpp" line="161"/>
<source>The network is connected and can access the Internet normally.</source>
<translation>访 Internet </translation>
</message>
<message>
<location filename="../frontend/connectivity/connectivitypage.cpp" line="166"/>
<source>The network is connected and access to the Internet is restricted.</source>
<translation>访 Internet </translation>
</message>
<message>
<location filename="../frontend/connectivity/connectivitypage.cpp" line="177"/>
<source>Please enter the local area network (intranet) detection address</source>
<translation></translation>
</message>
<message>
<location filename="../frontend/connectivity/connectivitypage.cpp" line="196"/>
<source>Format error</source>
<translation></translation>
</message>
</context>
<context>
<name>CopyButton</name>
<message>
@ -568,22 +616,22 @@
<translation type="vanished"></translation>
</message>
<message>
<location filename="../frontend/networkmode/firewalldialog.cpp" line="85"/>
<location filename="../frontend/networkmode/firewalldialog.cpp" line="89"/>
<source>Allow other devices on this network to discover this computer?</source>
<translation></translation>
</message>
<message>
<location filename="../frontend/networkmode/firewalldialog.cpp" line="87"/>
<location filename="../frontend/networkmode/firewalldialog.cpp" line="91"/>
<source>It is not recommended to enable this feature on public networks</source>
<translation></translation>
</message>
<message>
<location filename="../frontend/networkmode/firewalldialog.cpp" line="89"/>
<location filename="../frontend/networkmode/firewalldialog.cpp" line="93"/>
<source>Not allowed (recommended)</source>
<translation></translation>
</message>
<message>
<location filename="../frontend/networkmode/firewalldialog.cpp" line="90"/>
<location filename="../frontend/networkmode/firewalldialog.cpp" line="94"/>
<source>Allowed</source>
<translation></translation>
</message>
@ -629,23 +677,23 @@
<translation></translation>
</message>
<message>
<location filename="../frontend/netdetails/ipv4page.cpp" line="265"/>
<location filename="../frontend/netdetails/ipv4page.cpp" line="264"/>
<source>Invalid address</source>
<translation>IP地址</translation>
</message>
<message>
<location filename="../frontend/netdetails/ipv4page.cpp" line="274"/>
<location filename="../frontend/netdetails/ipv4page.cpp" line="273"/>
<source>Invalid subnet mask</source>
<translation></translation>
</message>
<message>
<location filename="../frontend/netdetails/ipv4page.cpp" line="298"/>
<location filename="../frontend/netdetails/ipv4page.cpp" line="299"/>
<location filename="../frontend/netdetails/ipv4page.cpp" line="300"/>
<source>Required</source>
<translation></translation>
</message>
<message>
<location filename="../frontend/netdetails/ipv4page.cpp" line="368"/>
<location filename="../frontend/netdetails/ipv4page.cpp" line="367"/>
<source>Address conflict</source>
<translation></translation>
</message>
@ -824,7 +872,7 @@
<translation type="vanished">线</translation>
</message>
<message>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1240"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1244"/>
<source>Wired Device not carried</source>
<translation>线</translation>
</message>
@ -833,18 +881,18 @@
<translation type="vanished">线</translation>
</message>
<message>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1336"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1344"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1340"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1348"/>
<source>Connected: </source>
<translation>: </translation>
</message>
<message>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1338"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1342"/>
<source>Not Connected</source>
<translation></translation>
</message>
<message>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1336"/>
<location filename="../frontend/tab-pages/lanpage.cpp" line="1340"/>
<source>(Limited)</source>
<translation>()</translation>
</message>
@ -865,47 +913,51 @@
<context>
<name>MainWindow</name>
<message>
<location filename="../frontend/mainwindow.cpp" line="216"/>
<location filename="../frontend/mainwindow.cpp" line="247"/>
<location filename="../frontend/mainwindow.cpp" line="229"/>
<location filename="../frontend/mainwindow.cpp" line="260"/>
<source>kylin-nm</source>
<translation></translation>
</message>
<message>
<location filename="../frontend/mainwindow.cpp" line="340"/>
<location filename="../frontend/mainwindow.cpp" line="353"/>
<source>LAN</source>
<translatorcomment>线</translatorcomment>
<translation>线</translation>
</message>
<message>
<location filename="../frontend/mainwindow.cpp" line="342"/>
<location filename="../frontend/mainwindow.cpp" line="355"/>
<source>WLAN</source>
<translatorcomment>线</translatorcomment>
<translation>线</translation>
</message>
<message>
<location filename="../frontend/mainwindow.cpp" line="370"/>
<source>Show MainWindow</source>
<translation></translation>
<translation type="vanished"></translation>
</message>
<message>
<location filename="../frontend/mainwindow.cpp" line="371"/>
<location filename="../frontend/mainwindow.cpp" line="384"/>
<source>Settings</source>
<translatorcomment></translatorcomment>
<translation></translation>
</message>
<message>
<location filename="../frontend/mainwindow.cpp" line="612"/>
<location filename="../frontend/mainwindow.cpp" line="841"/>
<location filename="../frontend/mainwindow.cpp" line="385"/>
<source>Network Connectivity Detection</source>
<translation></translation>
</message>
<message>
<location filename="../frontend/mainwindow.cpp" line="662"/>
<location filename="../frontend/mainwindow.cpp" line="915"/>
<source>Network tool</source>
<translation></translation>
</message>
<message>
<location filename="../frontend/mainwindow.cpp" line="626"/>
<location filename="../frontend/mainwindow.cpp" line="676"/>
<source>Network Card</source>
<translation></translation>
</message>
<message>
<location filename="../frontend/mainwindow.cpp" line="824"/>
<location filename="../frontend/mainwindow.cpp" line="898"/>
<source>Not connected to the network</source>
<translation></translation>
</message>
@ -1416,35 +1468,35 @@
<message>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="176"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="202"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="636"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="655"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="665"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="648"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="667"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="677"/>
<source>Disconnect</source>
<translation></translation>
</message>
<message>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="178"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="206"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="303"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="646"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="663"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="315"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="658"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="675"/>
<source>Connect</source>
<translation></translation>
</message>
<message>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="186"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="670"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="682"/>
<source>Forget</source>
<translation></translation>
</message>
<message>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="185"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="675"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="687"/>
<source>Property</source>
<translation></translation>
</message>
<message>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="324"/>
<location filename="../frontend/list-items/wlanlistitem.cpp" line="336"/>
<source>Auto Connect</source>
<translation></translation>
</message>
@ -1464,22 +1516,22 @@
<context>
<name>WlanPage</name>
<message>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="131"/>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="132"/>
<source>WLAN</source>
<translation>线</translation>
</message>
<message>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="107"/>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="108"/>
<source>No wireless network card detected</source>
<translation>线</translation>
</message>
<message>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="133"/>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="134"/>
<source>Activated WLAN</source>
<translation></translation>
</message>
<message>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="144"/>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="145"/>
<source>Other WLAN</source>
<translation></translation>
</message>
@ -1488,22 +1540,22 @@
<translation type="vanished">...</translation>
</message>
<message>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="974"/>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="972"/>
<source>WLAN Connected Successfully</source>
<translation>线</translation>
</message>
<message>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="970"/>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="968"/>
<source>WLAN Disconnected Successfully</source>
<translation>线</translation>
</message>
<message>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="1754"/>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="1741"/>
<source>Connected: </source>
<translation>: </translation>
</message>
<message>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="1756"/>
<location filename="../frontend/tab-pages/wlanpage.cpp" line="1743"/>
<source>Not Connected</source>
<translation></translation>
</message>