diff --git a/kylin-nm.pro b/kylin-nm.pro index d995544b..21f0d085 100644 --- a/kylin-nm.pro +++ b/kylin-nm.pro @@ -3,24 +3,12 @@ TEMPLATE = subdirs CONFIG += \ ordered \ - qt + qt \ SUBDIRS = \ plugins/plugin.pro \ src-vpn/src-vpn.pro \ - src + src \ + sys-dbus-register \ -TRANSLATIONS += \ - translations/kylin-nm_zh_CN.ts \ - translations/kylin-nm_tr.ts \ - translations/kylin-nm_bo.ts \ - translations/kylin-nm_bo_CN.ts - -CONFIG(release, debug|release) { - !system($$PWD/translate_generation.sh): error("Failed to generate translation") -} - -qm_files.path = $${PREFIX}/share/kylin-nm/kylin-nm/ -qm_files.files = translations/*.qm - -INSTALLS += qm_files \ +QT += widgets diff --git a/plugins/component/AddBtn/addnetbtn.cpp b/plugins/component/AddBtn/addnetbtn.cpp index a49c8d30..ca39e460 100644 --- a/plugins/component/AddBtn/addnetbtn.cpp +++ b/plugins/component/AddBtn/addnetbtn.cpp @@ -79,14 +79,13 @@ void AddNetBtn::leaveEvent(QEvent *event){ void AddNetBtn::paintEvent(QPaintEvent *event) { - QPalette pal = qApp->palette(); - QPainter painter(this); painter.setRenderHint(QPainter:: Antialiasing, true); //设置渲染,启动反锯齿 painter.setPen(Qt::NoPen); painter.setBrush(this->palette().base().color()); + QPalette pal = qApp->palette(); QColor color = pal.color(QPalette::Button); color.setAlphaF(0.5); pal.setColor(QPalette::Button, color); diff --git a/plugins/component/InfoButton/infobutton.cpp b/plugins/component/InfoButton/infobutton.cpp index abdb6858..bce835fb 100644 --- a/plugins/component/InfoButton/infobutton.cpp +++ b/plugins/component/InfoButton/infobutton.cpp @@ -22,7 +22,6 @@ #include #include #include -#include #define BUTTON_SIZE 36,36 #define ICON_SIZE 16,16 diff --git a/plugins/mobilehotspot/mobilehotspot.pro b/plugins/mobilehotspot/mobilehotspot.pro index 90c84dab..2b2064bd 100644 --- a/plugins/mobilehotspot/mobilehotspot.pro +++ b/plugins/mobilehotspot/mobilehotspot.pro @@ -4,6 +4,11 @@ CONFIG += plugin TARGET = $$qtLibraryTarget(mobilehotspot) DESTDIR = ../.. + +CONFIG(release, debug|release) { + !system($$PWD/translate_generation.sh): error("Failed to generate translation") +} + target.path = $$[QT_INSTALL_LIBS]/ukui-control-center trans.files = translations/* trans.path = /usr/share/kylin-nm/mobilehotspot/ @@ -50,4 +55,5 @@ TRANSLATIONS += \ translations/tr.ts \ translations/bo.ts\ translations/bo_CN.ts \ - translations/en_US.ts + translations/en_US.ts \ + translations/mn.ts diff --git a/plugins/mobilehotspot/mobilehotspotwidget.cpp b/plugins/mobilehotspot/mobilehotspotwidget.cpp index e7fd3495..8d483673 100644 --- a/plugins/mobilehotspot/mobilehotspotwidget.cpp +++ b/plugins/mobilehotspot/mobilehotspotwidget.cpp @@ -38,10 +38,10 @@ #define ICON_SIZE 24,24 #define PASSWORD_FRAME_MIN_HIGHT 60 -#define PASSWORD_FRAME_FIX_HIGHT 80 +#define PASSWORD_FRAME_FIX_HIGHT 90 #define PASSWORD_FRAME_MIN_SIZE 550, 60 #define PASSWORD_FRAME_MAX_SIZE 16777215, 86 -#define PASSWORD_ITEM_MARGINS 16, 12, 16, 14 +#define PASSWORD_ITEM_MARGINS 16, 10, 16, 10 #define WIRELESS 1 @@ -61,10 +61,10 @@ void MobileHotspotWidget::showDesktopNotify(const QString &message) "org.freedesktop.Notifications", QDBusConnection::sessionBus()); QList args; - args<<(tr("ukui control center")) + args<<(tr("Settings")) <<((unsigned int) 0) <addStretch(); connect(m_switchBtn, &KSwitchButton::stateChanged, this, &MobileHotspotWidget::setUiEnabled); + connect(m_interfaceComboBox, QOverload::of(&QComboBox::currentIndexChanged), this, &MobileHotspotWidget::onInterfaceChanged); connect(m_interfaceComboBox, QOverload::of(&QComboBox::currentIndexChanged), this, [=]() { + UkccCommon::buriedSettings("MobileHotspot", "Net card", QString("select"), m_interfaceComboBox->currentText()); m_interfaceName = m_interfaceComboBox->currentText(); updateBandCombox(); }); + connect(m_freqBandComboBox, QOverload::of(&QComboBox::currentIndexChanged), [=](){ + if (m_isUserSelect && !m_freqBandComboBox->currentText().isEmpty()) { + UkccCommon::buriedSettings("MobileHotspot", "Frequency band", QString("select"), m_freqBandComboBox->currentText()); + } + }); + onInterfaceChanged(); #ifdef HOTSPOT_CONTROL m_connectDevPage->refreshStalist(); @@ -142,7 +150,6 @@ bool MobileHotspotWidget::eventFilter(QObject *watched, QEvent *event) return true; } - if (watched == m_switchBtn) { if (event->type() == QEvent::MouseButtonRelease) { if (!m_interface->isValid()) { @@ -152,6 +159,7 @@ bool MobileHotspotWidget::eventFilter(QObject *watched, QEvent *event) showDesktopNotify(tr("wirless switch is close or no wireless device")); return true; } + UkccCommon::buriedSettings("MobileHotspot", "Open", QString("settings"), !m_switchBtn->isChecked() ? "true":"false"); if (m_switchBtn->isChecked()) { // showDesktopNotify(tr("start to close hotspot")); QDBusReply reply = m_interface->call("deactiveWirelessAp", m_apNameLine->text(), m_uuid); @@ -259,7 +267,7 @@ void MobileHotspotWidget::initDbusConnect() if(m_interface->isValid()) { connect(m_interface,SIGNAL(activateFailed(QString)), this, SLOT(onActivateFailed(QString)), Qt::QueuedConnection); connect(m_interface,SIGNAL(deactivateFailed(QString)), this, SLOT(onDeactivateFailed(QString)), Qt::QueuedConnection); - connect(m_interface,SIGNAL(deviceStatusChanged()), this, SLOT(onDeviceStatusChanged()), Qt::QueuedConnection); + connect(m_interface,SIGNAL(wirelessDeviceStatusChanged()), this, SLOT(onDeviceStatusChanged()), Qt::QueuedConnection); connect(m_interface,SIGNAL(deviceNameChanged(QString, QString, int)), this, SLOT(onDeviceNameChanged(QString, QString, int)), Qt::QueuedConnection); connect(m_interface,SIGNAL(hotspotDeactivated(QString, QString)), this, SLOT(onHotspotDeactivated(QString, QString)), Qt::QueuedConnection); @@ -270,7 +278,6 @@ void MobileHotspotWidget::initDbusConnect() connect(m_interface, SIGNAL(wirelessSwitchBtnChanged(bool)), this, SLOT(onWirelessBtnChanged(bool)), Qt::QueuedConnection); } - connect(m_apNameLine, &QLineEdit::textEdited, this, &MobileHotspotWidget::onApLineEditTextEdit); #ifdef HOTSPOT_CONTROL connect(m_connectDevPage, SIGNAL(setStaIntoBlacklist(QString, QString)), m_blacklistPage, SLOT(onsetStaIntoBlacklist(QString, QString))); @@ -286,11 +293,10 @@ void MobileHotspotWidget::onApLineEditTextEdit(QString text) for ( ; i < text.length(); ++i) { count += text.mid(i,1).toLocal8Bit().length(); if (count > AP_NAME_MAX_LENGTH) { - break; + m_apNameLine->setText(text.left(i)); + return; } } - - m_apNameLine->setText(text.left(i)); } void MobileHotspotWidget::onPwdTextChanged() @@ -306,6 +312,47 @@ void MobileHotspotWidget::onPwdTextChanged() this->update(); } +void MobileHotspotWidget::onInterfaceChanged() +{ + m_interfaceName = m_interfaceComboBox->currentText(); + if(m_interface->isValid()) { + QDBusMessage result = m_interface->call(QStringLiteral("getWirelessList")); + if(result.type() == QDBusMessage::ErrorMessage) + { + qWarning() << "getWirelessList error:" << result.errorMessage(); + return; + } + bool flag = false; + auto dbusArg = result.arguments().at(0).value(); + QMap> variantList; + dbusArg >> variantList; + if (variantList.size() != 0) { + QMap>::iterator iter; + for (iter = variantList.begin(); iter != variantList.end(); iter++) { + if (m_interfaceName == iter.key()) { + QVector wlanListInfo = iter.value(); + if (!wlanListInfo.isEmpty() && wlanListInfo.at(0).size() > 1) { + flag = true; + } + break; + } + } + } + if (flag) { + m_interfaceWarnLabel->setText(tr("use ") + m_interfaceName + + tr(" share network, will interrupt local wireless connection")); + m_interfaceFrame->setFixedHeight(PASSWORD_FRAME_FIX_HIGHT); + m_warnWidget->show(); + } else { + m_interfaceFrame->setFixedHeight(PASSWORD_FRAME_MIN_HIGHT); + m_warnWidget->hide(); + } + resetFrameSize(); + } + + updateBandCombox(); +} + void MobileHotspotWidget::onActiveConnectionChanged(QString deviceName, QString ssid, QString uuid, int status) { if(m_uuid == uuid && status == 4) { @@ -314,11 +361,19 @@ void MobileHotspotWidget::onActiveConnectionChanged(QString deviceName, QString setUiEnabled(false); m_uuid.clear(); } + + if (deviceName != m_interfaceName) { + return; + } + + if (m_interfaceComboBox && status == 2) { + onInterfaceChanged(); + } } void MobileHotspotWidget::onWirelessBtnChanged(bool state) { - if (!state) { + if (!state) { m_switchBtn->setChecked(state); m_uuid.clear(); m_switchBtn->setCheckable(false); @@ -332,6 +387,10 @@ void MobileHotspotWidget::initInterfaceInfo() if(!m_interface->isValid()) { return; } + + if (m_interfaceComboBox->isVisible()) { + m_interfaceComboBox->hidePopup(); + } m_interfaceComboBox->clear(); QDBusReply > reply = m_interface->call("getDeviceListAndEnabled",WIRELESS); @@ -350,7 +409,6 @@ void MobileHotspotWidget::initInterfaceInfo() } QMap devCapMap = capReply.value(); - if (devMap.isEmpty()) { qDebug() << LOG_HEAD << "no wireless device"; setWidgetHidden(true); @@ -359,7 +417,7 @@ void MobileHotspotWidget::initInterfaceInfo() QMap::Iterator iter = devMap.begin(); while (iter != devMap.end()) { QString interfaceName = iter.key(); - if (devCapMap[interfaceName] & 0x01) { + if (!(devCapMap[interfaceName] & 0x01)) { m_interfaceComboBox->addItem(interfaceName); } iter++; @@ -404,28 +462,32 @@ void MobileHotspotWidget::getApInfo() m_pwdNameLine->setText("12345678"); return; } else { + m_apNameLine->setText(apInfo.at(0)); + m_pwdNameLine->setText(apInfo.at(1)); + int index = m_interfaceComboBox->findText(apInfo.at(2)); if (index >= 0) { - m_apNameLine->setText(apInfo.at(0)); - m_pwdNameLine->setText(apInfo.at(1)); m_interfaceComboBox->setCurrentIndex(index); m_interfaceName = apInfo.at(2); - if (apInfo.at(3) == "true") { - m_switchBtn->setChecked(true); - setUiEnabled(true); - m_uuid = apInfo.at(4); - } else { - m_switchBtn->setChecked(false); - setUiEnabled(false); - m_uuid = apInfo.at(4); - } - int i = m_freqBandComboBox->findText(apInfo.at(5)); - if (i >= 0) { - m_freqBandComboBox->setCurrentIndex(i); - } } else { qDebug() << LOG_HEAD << "no such interface " << apInfo.at(2); } + + if (apInfo.at(3) == "true") { + m_switchBtn->setChecked(true); + setUiEnabled(true); + m_uuid = apInfo.at(4); + } else { + m_switchBtn->setChecked(false); + setUiEnabled(false); + m_uuid = apInfo.at(4); + } + int i = m_freqBandComboBox->findText(apInfo.at(5)); + if (i >= 0) { + m_isUserSelect = false; + m_freqBandComboBox->setCurrentIndex(i); + m_isUserSelect = true; + } } } @@ -502,10 +564,12 @@ void MobileHotspotWidget::setPasswordFrame() pwdInputVLayout->addWidget(m_pwdNameLine); pwdInputVLayout->addWidget(m_pwdHintLabel); - QFormLayout *pwdLayout = new QFormLayout(m_passwordFrame); + QGridLayout *pwdLayout = new QGridLayout(m_passwordFrame); pwdLayout->setContentsMargins(PASSWORD_ITEM_MARGINS); pwdLayout->setSpacing(0); - pwdLayout->addRow(m_pwdLabel, pwdInputWidget); + pwdLayout->addWidget(m_pwdLabel, 0, 0); + pwdLayout->addWidget(m_pwdNameLine, 0, 1); + pwdLayout->addWidget(m_pwdHintLabel, 1, 1); m_passwordFrame->setLayout(pwdLayout); @@ -522,8 +586,9 @@ void MobileHotspotWidget::setFreqBandFrame() QHBoxLayout *freqBandHLayout = new QHBoxLayout(m_freqBandFrame); - m_freqBandLabel = new QLabel(tr("Frequency band"), this); - m_freqBandLabel->setMinimumWidth(LABLE_MIN_WIDTH); + m_freqBandLabel = new FixLabel(this); + m_freqBandLabel->setText(tr("Frequency band")); + m_freqBandLabel->setFixedWidth(LABLE_MIN_WIDTH - 8); m_freqBandComboBox = new QComboBox(this); m_freqBandComboBox->setInsertPolicy(QComboBox::NoInsert); m_freqBandComboBox->setMinimumWidth(COMBOBOX_MIN_WIDTH); @@ -531,7 +596,7 @@ void MobileHotspotWidget::setFreqBandFrame() m_freqBandComboBox->addItem("2.4GHz"); m_freqBandComboBox->addItem("5GHz"); freqBandHLayout->setContentsMargins(ITEM_MARGINS); - freqBandHLayout->setSpacing(0); + freqBandHLayout->setSpacing(8); freqBandHLayout->addWidget(m_freqBandLabel); freqBandHLayout->addWidget(m_freqBandComboBox); @@ -543,23 +608,48 @@ void MobileHotspotWidget::setInterFaceFrame() /* key tips */ m_interfaceFrame = new QFrame(this); m_interfaceFrame->setFrameShape(QFrame::Shape::NoFrame); - m_interfaceFrame->setMinimumSize(FRAME_MIN_SIZE); - m_interfaceFrame->setMaximumSize(CONTECT_FRAME_MAX_SIZE); - - QHBoxLayout *interfaceHLayout = new QHBoxLayout(m_interfaceFrame); + m_interfaceFrame->setMinimumSize(PASSWORD_FRAME_MIN_SIZE); + m_interfaceFrame->setMaximumSize(PASSWORD_FRAME_MAX_SIZE); m_interfaceLabel = new QLabel(tr("Net card"), this); - m_interfaceLabel->setMinimumWidth(LABLE_MIN_WIDTH); + m_interfaceLabel->setFixedWidth(LABLE_MIN_WIDTH); m_interfaceComboBox = new QComboBox(this); m_interfaceComboBox->setInsertPolicy(QComboBox::NoInsert); m_interfaceComboBox->setMinimumWidth(COMBOBOX_MIN_WIDTH); - m_interfaceComboBox->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed); - interfaceHLayout->setContentsMargins(ITEM_MARGINS); - interfaceHLayout->setSpacing(0); - interfaceHLayout->addWidget(m_interfaceLabel); - interfaceHLayout->addWidget(m_interfaceComboBox); - m_interfaceFrame->setLayout(interfaceHLayout); + m_warnWidget = new QWidget(this); + m_warnWidget->setFixedHeight(20); + m_warnWidget->setContentsMargins(8,0,0,0); + + QHBoxLayout *warnTextHLayout = new QHBoxLayout(m_warnWidget); + QLabel* warnIcon = new QLabel(this); + warnIcon->setContentsMargins(0,0,0,0); + warnIcon->setPixmap(QIcon::fromTheme("dialog-warning").pixmap(16,16)); + + m_interfaceWarnLabel= new FixLabel(this); + m_interfaceWarnLabel->setFixedHeight(20); + + QPalette hintTextColor; + hintTextColor.setColor(QPalette::WindowText, Qt::red); + m_interfaceWarnLabel->setPalette(hintTextColor); + + warnTextHLayout->setSpacing(8); + warnTextHLayout->setContentsMargins(0,0,0,0); + warnTextHLayout->addWidget(warnIcon); + warnTextHLayout->addWidget(m_interfaceWarnLabel); + warnIcon->setFixedWidth(16); + m_warnWidget->setLayout(warnTextHLayout); + + QGridLayout *interfaceFLayout = new QGridLayout(m_interfaceFrame); + interfaceFLayout->setContentsMargins(PASSWORD_ITEM_MARGINS); + interfaceFLayout->setSpacing(0); + interfaceFLayout->addWidget(m_interfaceLabel, 0, 0); + interfaceFLayout->addWidget(m_interfaceComboBox, 0, 1); + interfaceFLayout->addWidget(m_warnWidget, 1, 1); + + m_interfaceFrame->setLayout(interfaceFLayout); + + m_warnWidget->hide(); } void MobileHotspotWidget::onActivateFailed(QString errorMessage) @@ -596,6 +686,12 @@ void MobileHotspotWidget::onDeviceNameChanged(QString oldName, QString newName, m_interfaceName = newName; } } + + QTimer::singleShot(100, this, [=]() { + if (m_interfaceComboBox->currentText() == newName) { + updateBandCombox(); + } + }); } //热点断开 @@ -656,7 +752,9 @@ void MobileHotspotWidget::onHotspotActivated(QString devName, QString ssid, QStr updateBandCombox(); index = m_freqBandComboBox->findText(info.at(1)); if (index >= 0) { + m_isUserSelect = false; m_freqBandComboBox->setCurrentIndex(index); + m_isUserSelect = true; } m_uuid = uuid; } else { @@ -735,6 +833,8 @@ void MobileHotspotWidget::updateBandCombox() setWidgetHidden(true); return; } + + m_isUserSelect = false; QMap devCapMap = capReply.value(); if (devCapMap[m_interfaceName] & 0x02) { m_freqBandComboBox->addItem("2.4GHz"); @@ -746,6 +846,7 @@ void MobileHotspotWidget::updateBandCombox() if (index >= 0) { m_freqBandComboBox->setCurrentIndex(index); } + m_isUserSelect = true; } QFrame* MobileHotspotWidget::myLine() diff --git a/plugins/mobilehotspot/mobilehotspotwidget.h b/plugins/mobilehotspot/mobilehotspotwidget.h index 20458e4a..0723b2fd 100644 --- a/plugins/mobilehotspot/mobilehotspotwidget.h +++ b/plugins/mobilehotspot/mobilehotspotwidget.h @@ -46,8 +46,11 @@ #include "connectdevlistitem.h" #include "blacklistpage.h" #include "connectdevpage.h" +#include "fixlabel.h" +#include "ukcccommon.h" using namespace kdk; +using namespace ukcc; class MobileHotspotWidget : public QWidget { @@ -71,7 +74,7 @@ private: QLabel *m_apNameLabel; QLabel *m_pwdLabel; QLabel *m_pwdHintLabel; - QLabel *m_freqBandLabel; + FixLabel *m_freqBandLabel; QLabel *m_interfaceLabel; QFrame *switchAndApNameLine; @@ -87,6 +90,9 @@ private: QComboBox *m_freqBandComboBox; QComboBox *m_interfaceComboBox; + FixLabel *m_interfaceWarnLabel; + QWidget* m_warnWidget; + QDBusInterface *m_interface = nullptr; QString m_interfaceName = ""; @@ -137,6 +143,8 @@ private: void deleteSettingPathInterface(); void initConnectDevPage(); void initBlackListPage(); + + bool m_isUserSelect = true; //是否用户操作 signals: private slots: @@ -157,6 +165,8 @@ private slots: void onApLineEditTextEdit(QString text); void onPwdTextChanged(); + + void onInterfaceChanged(); }; #endif // MOBILEHOTSPOTWIDGET_H diff --git a/plugins/mobilehotspot/translate_generation.sh b/plugins/mobilehotspot/translate_generation.sh new file mode 100755 index 00000000..72f748b9 --- /dev/null +++ b/plugins/mobilehotspot/translate_generation.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +ts_list=(`ls translations/*.ts`) +source /etc/os-release +version=(`echo $ID`) + +for ts in "${ts_list[@]}" +do + printf "\nprocess ${ts}\n" + if [ "$version" == "fedora" ] || [ "$version" == "opensuse-leap" ] || [ "$version" == "opensuse-tumbleweed" ];then + lrelease-qt5 "${ts}" + else + lrelease "${ts}" + fi +done diff --git a/plugins/mobilehotspot/translations/bo.qm b/plugins/mobilehotspot/translations/bo.qm deleted file mode 100644 index be651eed..00000000 --- a/plugins/mobilehotspot/translations/bo.qm +++ /dev/null @@ -1 +0,0 @@ - MobileHotspotWidget - - ukui control center - - - - - ukui control center desktop message - - - - + wirless switch is close or no wireless device - + hotpots name or device is invalid - + Contains at least 8 characters - + Hotspot - - + + Settings + + + + + Settings desktop message + + + + + use + + + + + share network, will interrupt local wireless connection + + + + + hotspot already close - + Open - + Wi-Fi Name - + Password - + Frequency band - + Net card - - + + hotspot already open diff --git a/plugins/mobilehotspot/translations/bo_CN.qm b/plugins/mobilehotspot/translations/bo_CN.qm deleted file mode 100644 index b9da303b..00000000 Binary files a/plugins/mobilehotspot/translations/bo_CN.qm and /dev/null differ diff --git a/plugins/mobilehotspot/translations/bo_CN.ts b/plugins/mobilehotspot/translations/bo_CN.ts index f2f82810..fc74385e 100644 --- a/plugins/mobilehotspot/translations/bo_CN.ts +++ b/plugins/mobilehotspot/translations/bo_CN.ts @@ -56,17 +56,15 @@ MobileHotspotWidget - ukui control center - ཝུའུ་ཁི་ལན་གྱི་ཚོད་འཛིན་ལྟེ་གནས། + ཝུའུ་ཁི་ལན་གྱི་ཚོད་འཛིན་ལྟེ་གནས། - ukui control center desktop message - ukui ཚོད་འཛིན་ལྟེ་གནས་ཀྱི་ཅོག་ངོས་ཆ་འཕྲིན། + ukui ཚོད་འཛིན་ལྟེ་གནས་ཀྱི་ཅོག་ངོས་ཆ་འཕྲིན། - + wirless switch is close or no wireless device སྐུད་མེད་གློག་སྒོ་རྒྱག་པའམ་ཡང་ན་སྐུད་མེད་སྒྲིག་ཆས་མེད་པ། @@ -75,7 +73,7 @@ སྒོ་རྒྱག་འགོ་བརྩམས། - + hotpots name or device is invalid ཚ་བ་ཆེ་བའི་མིང་ངམ་སྒྲིག་ཆས་ལ་ནུས་པ་མེད། @@ -88,49 +86,69 @@ ཀུན་གྱིས་དོ་སྣང་བྱེད་ཡུལ་གསར་སྐྲུན་བྱེད་འགོ་ - + Contains at least 8 characters མ་མཐར་ཡང་ཡིག་རྟགས་བརྒྱད་འདུས་ཡོད། - + Hotspot ཚ་བ་ཆེ་བ། - - + + Settings + བཀོད་སྒྲིག་བཅས་བྱ་དགོས། + + + + Settings desktop message + བཀོད་སྒྲིག་བཅས་བྱ་དགོས། ཅོག་ངོས་ལ་བརྡ་ཐོ་གཏོང་དགོས། + + + + use + བེད་སྤྱོད། + + + + share network, will interrupt local wireless connection + གླེང་མང་མཉམ་སྤྱོད་བྱས་ནས་འཕྲུལ་ཆས་ཀྱི་སྐུད་མེད་དྲ་བ་སྦྲེལ་མཐུད་བྱེད་ངེས་རེད། + + + + hotspot already close ཚ་བ་ཆེ་བའི་གནད་དོན་ཐག་ཉེ་རུ་སོང་ཡོད། - + Open སྒོ་ཕྱེ་བ། - + Wi-Fi Name Wi-Fiཡི་མིང་། - + Password གསང་གྲངས། - + Frequency band ཐེངས་གྲངས་ཀྱི་རོལ་ཆའི་རུ་ཁག - + Net card དྲ་རྒྱའི་བྱང་བུ། - - + + hotspot already open ཚ་བ་ཆེ་བའི་གནད་དོན་དེ་སྒོ་ཕྱེ་ཟིན། diff --git a/plugins/mobilehotspot/translations/en_US.ts b/plugins/mobilehotspot/translations/en_US.ts index bb4f55f3..c911b573 100644 --- a/plugins/mobilehotspot/translations/en_US.ts +++ b/plugins/mobilehotspot/translations/en_US.ts @@ -56,69 +56,87 @@ MobileHotspotWidget - ukui control center - ukui control center + ukui control center + + + ukui control center desktop message + ukui control center desktop message - ukui control center desktop message - ukui control center desktop message + Settings + - + + Settings desktop message + + + + wirless switch is close or no wireless device wirless switch is close or no wireless device - + hotpots name or device is invalid hotpots name or device is invalid - + Hotspot Hotspot - - + + use + + + + + share network, will interrupt local wireless connection + + + + + hotspot already close hotspot already close - + Open Open - + Wi-Fi Name Wi-Fi Name - + Password Password - + Contains at least 8 characters Contains at least 8 characters - + Frequency band Frequency band - + Net card Net card - - + + hotspot already open hotspot already open diff --git a/plugins/mobilehotspot/translations/mn.ts b/plugins/mobilehotspot/translations/mn.ts new file mode 100644 index 00000000..b6da58c0 --- /dev/null +++ b/plugins/mobilehotspot/translations/mn.ts @@ -0,0 +1,156 @@ + + + + + BlacklistItem + + + Remove + ᠰᠢᠯᠵᠢᠬᠦᠯᠦᠨ ᠬᠠᠰᠤᠬᠤ + + + + BlacklistPage + + + Blacklist + ᠬᠠᠷ᠎ᠠ ᠳᠠᠩᠰᠠ ᠳᠤᠬᠢᠷᠠᠭᠤᠯᠬᠤ + + + + ConnectDevListItem + + + drag into blacklist + ᠬᠠᠷ᠎ᠠ ᠳᠠᠩᠰᠠᠨ ᠳ᠋ᠤ᠌ ᠤᠷᠤᠭᠤᠯᠬᠤ + + + + ConnectdevPage + + + Connect device + ᠳᠦᠬᠦᠬᠡᠷᠦᠮᠵᠢ ᠵᠢ ᠴᠦᠷᠬᠡᠯᠡᠬᠦ + + + + MobileHotspot + + + MobileHotspot + ᠰᠢᠯᠵᠢᠮᠡᠯ ᠬᠠᠯᠠᠭᠤᠨ ᠴᠡᠭ + + + + mobilehotspot + ᠰᠢᠯᠵᠢᠮᠡᠯ ᠬᠠᠯᠠᠭᠤᠨ ᠴᠡᠭ + /mobilehotspot/mobilehotspot + + + + mobilehotspot open + ᠰᠢᠯᠵᠢᠮᠡᠯ ᠬᠠᠯᠠᠭᠤᠨ ᠴᠡᠭ ᠡᠬᠢᠯᠡᠬᠦ + /mobilehotspot/mobilehotspot open + + + + MobileHotspotWidget + + ukui control center + ᠡᠵᠡᠮᠰᠢᠯ ᠤ᠋ᠨ ᠬᠠᠪᠳᠠᠰᠤ + + + ukui control center desktop message + ᠡᠵᠡᠮᠰᠢᠯ ᠤ᠋ᠨ ᠬᠠᠪᠳᠠᠰᠤᠨ ᠤ᠋ ᠰᠢᠷᠡᠭᠡᠨ ᠨᠢᠭᠤᠷ ᠤ᠋ᠨ ᠮᠡᠳᠡᠭᠳᠡᠯ + + + + wirless switch is close or no wireless device + ᠤᠲᠠᠰᠤ ᠦᠭᠡᠢ ᠨᠡᠭᠡᠭᠡᠯᠭᠡ ᠨᠢᠭᠡᠨᠲᠡ ᠬᠠᠭᠠᠭᠰᠠᠨ ᠪᠤᠶᠤ ᠬᠠᠯᠠᠭᠤᠨ ᠴᠡᠭ ᠤ᠋ᠨ ᠴᠢᠳᠠᠮᠵᠢ ᠲᠠᠢ ᠤᠲᠠᠰᠤ ᠦᠭᠡᠢ ᠰᠦᠯᠵᠢᠶᠡᠨ ᠤ᠋ ᠺᠠᠷᠲ ᠪᠠᠢᠬᠤ ᠦᠭᠡᠢ + + + start to close hotspot + ᠬᠠᠯᠠᠭᠤᠨ ᠴᠡᠭ ᠢ᠋ ᠡᠬᠢᠯᠡᠵᠤ ᠬᠠᠭᠠᠬᠤ + + + + hotpots name or device is invalid + ᠬᠠᠯᠠᠭᠤᠨ ᠴᠡᠭ ᠤ᠋ᠨ ᠨᠡᠷᠡᠢᠳᠦᠯ ᠪᠤᠶᠤ ᠳᠦᠬᠦᠬᠡᠷᠦᠮᠵᠢ ᠪᠤᠷᠤᠭᠤ + + + can not create hotspot with password length less than eight! + 不能创建密码长度小于八位的热点! + + + start to open hotspot + ᠬᠠᠯᠠᠭᠤᠨ ᠴᠡᠭ ᠢ᠋ ᠡᠬᠢᠯᠡᠵᠤ ᠪᠠᠢᠭᠤᠯᠬᠤ + + + + Contains at least 8 characters + ᠠᠳᠠᠭ ᠲᠤ᠌ ᠪᠡᠨ 8 ᠦᠰᠦᠭ ᠳᠡᠮᠳᠡᠭ ᠠᠭᠤᠯᠠᠭᠳᠠᠵᠤ ᠪᠠᠢᠨ᠎ᠠ + + + + Hotspot + ᠰᠢᠯᠵᠢᠮᠡᠯ ᠬᠠᠯᠠᠭᠤᠨ ᠴᠡᠭ + + + + Settings + ᠳᠤᠬᠢᠷᠠᠭᠤᠯᠭ᠎ᠠ + + + + Settings desktop message + ᠰᠢᠷᠡᠭᠡᠨ ᠨᠢᠭᠤᠷ᠎ᠤ᠋ᠨ ᠵᠠᠩᠭᠢ᠎ᠶ᠋ᠢ ᠵᠣᠬᠢᠷᠠᠭᠤᠯᠬᠤ + + + + use + ᠬᠡᠷᠡᠭᠯᠡᠬᠦ + + + + share network, will interrupt local wireless connection + ᠬᠠᠮᠲᠤ ᠡᠳ᠋ᠯᠡᠬᠦ ᠲᠣᠣᠷ ᠰᠦᠯᠵᠢᠶ᠎ᠡ ᠂ ᠲᠤᠰ ᠭᠠᠵᠠᠷ᠎ᠤ᠋ᠨ ᠤᠲᠠᠰᠤᠭᠤᠢ ᠵᠠᠯᠭᠠᠯᠲᠠ᠎ᠶ᠋ᠢ ᠲᠠᠰᠤᠯᠠᠬᠤ + + + + + hotspot already close + ᠬᠠᠯᠠᠭᠤᠨ ᠴᠡᠭ ᠢ᠋ ᠬᠠᠭᠠᠪᠠ + + + + Open + ᠨᠡᠭᠡᠭᠡᠭᠦ + + + + Wi-Fi Name + Wi-Fi ᠨᠡᠷᠡᠢᠳᠦᠯ + + + + Password + ᠰᠦᠯᠵᠢᠶᠡᠨ ᠤ᠋ ᠨᠢᠭᠤᠴᠠ ᠺᠤᠳ᠋ + + + + Frequency band + ᠲᠤᠤᠷ ᠰᠦᠯᠵᠢᠶᠡᠨ ᠤ᠋ ᠳᠠᠪᠳᠠᠮᠵᠢ ᠵᠢᠨ ᠪᠦᠰᠡ + + + + Net card + ᠬᠠᠮᠳᠤᠪᠠᠷ ᠡᠳ᠋ᠯᠡᠬᠦ ᠨᠧᠲ ᠤ᠋ᠨ ᠦᠵᠦᠬᠦᠷ + + + + + hotspot already open + ᠬᠠᠯᠠᠭᠤᠨ ᠴᠡᠭ ᠢ᠋ ᠨᠡᠬᠡᠬᠡᠪᠡ + + + diff --git a/plugins/mobilehotspot/translations/tr.qm b/plugins/mobilehotspot/translations/tr.qm deleted file mode 100644 index be651eed..00000000 --- a/plugins/mobilehotspot/translations/tr.qm +++ /dev/null @@ -1 +0,0 @@ - MobileHotspotWidget - - ukui control center - - - - - ukui control center desktop message - - - - + wirless switch is close or no wireless device - + hotpots name or device is invalid - + Contains at least 8 characters - + Hotspot - - + + Settings + + + + + Settings desktop message + + + + + use + + + + + share network, will interrupt local wireless connection + + + + + hotspot already close - + Open - + Wi-Fi Name - + Password - + Frequency band - + Net card - - + + hotspot already open diff --git a/plugins/mobilehotspot/translations/zh_CN.qm b/plugins/mobilehotspot/translations/zh_CN.qm deleted file mode 100644 index 1b67cfd1..00000000 Binary files a/plugins/mobilehotspot/translations/zh_CN.qm and /dev/null differ diff --git a/plugins/mobilehotspot/translations/zh_CN.ts b/plugins/mobilehotspot/translations/zh_CN.ts index a9fb2288..013183b7 100644 --- a/plugins/mobilehotspot/translations/zh_CN.ts +++ b/plugins/mobilehotspot/translations/zh_CN.ts @@ -56,17 +56,15 @@ MobileHotspotWidget - ukui control center - 控制面板 + 控制面板 - ukui control center desktop message - 控制面板桌面通知 + 控制面板桌面通知 - + wirless switch is close or no wireless device 无线开关已关闭或不存在有热点功能的无线网卡 @@ -75,7 +73,7 @@ 开始关闭热点 - + hotpots name or device is invalid 热点名称或设备错误 @@ -88,49 +86,69 @@ 开始创建热点 - + Contains at least 8 characters 至少包含8个字符 - + Hotspot 移动热点 - - + + Settings + 设置 + + + + Settings desktop message + 设置 桌面通知 + + + + use + 使用 + + + + share network, will interrupt local wireless connection + 进行热点共享,会中断本机无线网络连接 + + + + hotspot already close 热点已关闭 - + Open 开启 - + Wi-Fi Name - Wi-Fi名称 + Wi-Fi 名称 - + Password 网络密码 - + Frequency band 网络频带 - + Net card 共享网卡端口 - - + + hotspot already open 热点已开启 diff --git a/plugins/netconnect/lanitem.cpp b/plugins/netconnect/lanitem.cpp index 67525e23..753e4fe5 100644 --- a/plugins/netconnect/lanitem.cpp +++ b/plugins/netconnect/lanitem.cpp @@ -143,13 +143,12 @@ void LanItem::onDeletetTriggered() void LanItem::paintEvent(QPaintEvent *event) { - QPalette pal = qApp->palette(); - QPainter painter(this); painter.setRenderHint(QPainter:: Antialiasing, true); //设置渲染,启动反锯齿 painter.setPen(Qt::NoPen); painter.setBrush(this->palette().base().color()); + QPalette pal = qApp->palette(); QColor color = pal.color(QPalette::Button); color.setAlphaF(0.5); pal.setColor(QPalette::Button, color); @@ -165,7 +164,7 @@ bool LanItem::eventFilter(QObject *watched, QEvent *event) { //菜单右边界与按钮右边界对齐 if (event->type() == QEvent::Show && watched == m_moreMenu) { - int menuXPos = m_moreMenu->pos().x(); + int menuXPos = mapToGlobal(m_moreButton->pos()).x(); int menuWidth = m_moreMenu->size().width(); int btnWidth = m_moreButton->size().width(); diff --git a/plugins/netconnect/netconnect.cpp b/plugins/netconnect/netconnect.cpp index 344a9236..fd70ad59 100644 --- a/plugins/netconnect/netconnect.cpp +++ b/plugins/netconnect/netconnect.cpp @@ -63,10 +63,10 @@ void NetConnect::showDesktopNotify(const QString &message) "org.freedesktop.Notifications", QDBusConnection::sessionBus()); QList args; - args<<(tr("ukui control center")) + args<<(tr("Settings")) <<((unsigned int) 0) <findChild()) w->findChild()->setStyleSheet("QWidget{background: palette(base);border-radius:4px;}"); } + // if (w == wiredSwitch) { // if (e->type() == QMouseEvent::MouseButtonRelease) { // if (!wiredSwitch->isCheckable()) { // showDesktopNotify(tr("No ethernet device avaliable")); // } else { +// UkccCommon::buriedSettings(QString("netconnect"), QString("Open"), QString("settings"),wiredSwitch->isChecked()?"false":"true"); // if (m_interface != nullptr && m_interface->isValid()) { // m_interface->call(QStringLiteral("setWiredSwitchEnable"), !wiredSwitch->isChecked()); // } @@ -242,6 +244,7 @@ void NetConnect::initComponent() { connect(ui->detailBtn, &QPushButton::clicked, this, [=](bool checked) { Q_UNUSED(checked) + UkccCommon::buriedSettings(QString("netconnect"), QString("Advanced settings"), QString("clicked")); runExternalApp(); }); } @@ -468,6 +471,7 @@ void NetConnect::addLanItem(ItemFrame *frame, QString devName, QStringList infoL if (m_interface == nullptr || !m_interface->isValid()) { return; } + UkccCommon::buriedSettings(QString("netconnect"), QString("info"), QString("clicked")); qDebug() << "[NetConnect]call showPropertyWidget" << __LINE__; m_interface->call(QStringLiteral("showPropertyWidget"), devName, infoList.at(1)); qDebug() << "[NetConnect]call showPropertyWidget respond" << __LINE__; @@ -541,6 +545,7 @@ void NetConnect::addDeviceFrame(QString devName) qDebug() << "[NetConnect]deviceFrameMap insert" << devName; // connect(itemFrame->deviceFrame, &DeviceFrame::deviceSwitchClicked ,this, [=] (bool checked) { +// UkccCommon::buriedSettings(QString("netconnect"), "device open", QString("settings"), checked?"true":"fasle"); // qDebug() << "[NetConnect]call setDeviceEnable" << devName << checked << __LINE__; // m_interface->call(QStringLiteral("setDeviceEnable"), devName, checked); // qDebug() << "[NetConnect]call setDeviceEnable Respond" << __LINE__; @@ -565,6 +570,7 @@ void NetConnect::addDeviceFrame(QString devName) // }); connect(itemFrame->addLanWidget, &AddNetBtn::clicked, this, [=](){ + UkccCommon::buriedSettings(pluginName, "Add net", QString("clicked")); if (m_interface != nullptr && m_interface->isValid()) { qDebug() << "[NetConnect]call showCreateWiredConnectWidget" << devName << __LINE__; m_interface->call(QStringLiteral("showCreateWiredConnectWidget"), devName); @@ -765,6 +771,7 @@ void NetConnect::addOneLanFrame(ItemFrame *frame, QString deviceName, QStringLis if (m_interface == nullptr || !m_interface->isValid()) { return; } + UkccCommon::buriedSettings(QString("netconnect"), QString("info"), QString("clicked")); qDebug() << "[NetConnect]call showPropertyWidget" << deviceName << connUuid << __LINE__; m_interface->call(QStringLiteral("showPropertyWidget"), deviceName, connUuid); qDebug() << "[NetConnect]call showPropertyWidget respond" << __LINE__; @@ -908,7 +915,6 @@ void NetConnect::itemActiveConnectionStatusChanged(LanItem *item, int status) item->statusLabel->setText(tr("not connected")); } item->setConnectActionText(item->isAcitve); - // QIcon searchIcon = QIcon::fromTheme(iconPath); // item->iconLabel->setPixmap(searchIcon.pixmap(searchIcon.actualSize(QSize(24, 24)))); } diff --git a/plugins/netconnect/netconnect.h b/plugins/netconnect/netconnect.h index 95bbfa4c..0f4a0a7e 100644 --- a/plugins/netconnect/netconnect.h +++ b/plugins/netconnect/netconnect.h @@ -54,8 +54,10 @@ #include "itemframe.h" #include "kwidget.h" #include "kswitchbutton.h" +#include "ukcccommon.h" using namespace kdk; +using namespace ukcc; enum { DISCONNECTED, @@ -100,7 +102,6 @@ private: int getInsertPos(QString connName, QString deviceName); - void deleteOneLan(QString ssid, int type); void activeConnect(QString ssid, QString deviceName, int type); void deActiveConnect(QString ssid, QString deviceName, int type); diff --git a/plugins/netconnect/netconnect.pro b/plugins/netconnect/netconnect.pro index 500a3b7e..893cf4f0 100644 --- a/plugins/netconnect/netconnect.pro +++ b/plugins/netconnect/netconnect.pro @@ -7,6 +7,11 @@ include(../component/addbtn.pri) TARGET = $$qtLibraryTarget(netconnect) DESTDIR = ../.. + +CONFIG(release, debug|release) { + !system($$PWD/translate_generation.sh): error("Failed to generate translation") +} + target.path = $$[QT_INSTALL_LIBS]/ukui-control-center trans.files = translations/* trans.path = /usr/share/kylin-nm/netconnect/ @@ -52,4 +57,5 @@ TRANSLATIONS += \ translations/tr.ts \ translations/bo.ts \ translations/bo_CN.ts \ - translations/en_US.ts + translations/en_US.ts \ + translations/mn.ts diff --git a/plugins/netconnect/translate_generation.sh b/plugins/netconnect/translate_generation.sh new file mode 100755 index 00000000..72f748b9 --- /dev/null +++ b/plugins/netconnect/translate_generation.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +ts_list=(`ls translations/*.ts`) +source /etc/os-release +version=(`echo $ID`) + +for ts in "${ts_list[@]}" +do + printf "\nprocess ${ts}\n" + if [ "$version" == "fedora" ] || [ "$version" == "opensuse-leap" ] || [ "$version" == "opensuse-tumbleweed" ];then + lrelease-qt5 "${ts}" + else + lrelease "${ts}" + fi +done diff --git a/plugins/netconnect/translations/bo.qm b/plugins/netconnect/translations/bo.qm deleted file mode 100644 index be651eed..00000000 --- a/plugins/netconnect/translations/bo.qm +++ /dev/null @@ -1 +0,0 @@ - - - + + Disconnect - - + + Connect @@ -43,54 +43,49 @@ - + open /netconnect/open - + Advanced settings /netconnect/Advanced settings" - - ukui control center + + Settings - - ukui control center desktop message + + Settings desktop message - - + + LAN - - No ethernet device avaliable - - - - - + + connected - - - + + + not connected - + card diff --git a/plugins/netconnect/translations/bo_CN.qm b/plugins/netconnect/translations/bo_CN.qm deleted file mode 100644 index f41e3534..00000000 Binary files a/plugins/netconnect/translations/bo_CN.qm and /dev/null differ diff --git a/plugins/netconnect/translations/bo_CN.ts b/plugins/netconnect/translations/bo_CN.ts index 895a44e9..b77e09a0 100644 --- a/plugins/netconnect/translations/bo_CN.ts +++ b/plugins/netconnect/translations/bo_CN.ts @@ -6,7 +6,7 @@ Add Others - + སྐུད་ཡོད་བརྙན་འཕྲིན་ཁ་སྣོན་བྱས་ཡོད། @@ -19,19 +19,19 @@ Delete - སུབ་དགོས། + བསུབ་པ། + + + + + Disconnect + འབྲེལ་ཐག་ཆད་པ། - - Disconnect - བར་མཚམས་ཆད་པ་རེད། - - - - + Connect - འབྲེལ་མཐུད་བཅས་བྱ་དགོས། + སྦྲེལ་མཐུད་བྱེད་པ། @@ -43,58 +43,65 @@ - + open སྒོ་ཕྱེ་བ། /netconnect/open - + Advanced settings སྔོན་ཐོན་གྱི་སྒྲིག་བཀོད། /netconnect/Advanced settings" - ukui control center - ཝུའུ་ཁི་ལན་གྱི་ཚོད་འཛིན་ལྟེ་གནས། + ཝུའུ་ཁི་ལན་གྱི་ཚོད་འཛིན་ལྟེ་གནས། - ukui control center desktop message - ukui ཚོད་འཛིན་ལྟེ་གནས་ཀྱི་ཅོག་ངོས་ཆ་འཕྲིན། + ukui ཚོད་འཛིན་ལྟེ་གནས་ཀྱི་ཅོག་ངོས་ཆ་འཕྲིན། WiredConnect སྐུད་ཡོད་སྦྲེལ་མཐུད། - - + + Settings + བཀོད་སྒྲིག་བཅས་བྱ་དགོས། + + + + Settings desktop message + བཀོད་སྒྲིག་བཅས་བྱ་དགོས། ཅོག་ངོས་ལ་བརྡ་ཐོ་གཏོང་དགོས། + + + + LAN སྐུད་ཡོད་དྲ་བ། - No ethernet device avaliable - ཨེ་ཙི་དྲ་རྒྱའི་སྒྲིག་ཆས་ལ་བཙན་འཛུལ་བྱས་མི་ཆོག། + ཨེ་ཙི་དྲ་རྒྱའི་སྒྲིག་ཆས་ལ་བཙན་འཛུལ་བྱས་མི་ཆོག། - - + + connected འབྲེལ་མཐུད་བྱེད་པ། - - - + + + not connected - འབྲེལ་མཐུད་མ་བྱས་པ། + འབྲེལ་མཐུད་མི་བྱེད་པ། - + card བྱང་བུ། diff --git a/plugins/netconnect/translations/en_US.ts b/plugins/netconnect/translations/en_US.ts index 67be9443..138a8002 100644 --- a/plugins/netconnect/translations/en_US.ts +++ b/plugins/netconnect/translations/en_US.ts @@ -22,14 +22,14 @@ - - + + Disconnect - - + + Connect @@ -43,54 +43,61 @@ - + open open /netconnect/open - + Advanced settings Advanced settings /netconnect/Advanced settings" - ukui control center - ukui control center + ukui control center - ukui control center desktop message - ukui control center desktop message + ukui control center desktop message - - + + Settings + + + + + Settings desktop message + + + + + LAN LAN - No ethernet device avaliable - No ethernet device avaliable + No ethernet device avaliable - - + + connected connected - - - + + + not connected - + card card diff --git a/plugins/netconnect/translations/mn.ts b/plugins/netconnect/translations/mn.ts new file mode 100644 index 00000000..1218b8c6 --- /dev/null +++ b/plugins/netconnect/translations/mn.ts @@ -0,0 +1,109 @@ + + + + + AddNetBtn + + + Add Others + ᠪᠤᠰᠤᠳ ᠲᠤᠤᠷ ᠰᠦᠯᠵᠢᠶᠡᠨ ᠳ᠋ᠤ᠌ ᠵᠠᠯᠭᠠᠬᠤ + + + + Add WiredNetork + ᠤᠲᠠᠰᠤᠲᠤ ᠨᠧᠲ ᠨᠡᠮᠡᠬᠦ + + + + LanItem + + + Delete + + + + + + Disconnect + + + + + + Connect + + + + + NetConnect + + + Wired Network + ᠤᠳᠠᠰᠤᠳᠤ ᠰᠦᠯᠵᠢᠶ᠎ᠡ + + + + + open + ᠨᠡᠭᠡᠭᠡᠬᠦ + /netconnect/open + + + + + Advanced settings + ᠦᠨᠳᠦᠷ ᠵᠡᠷᠬᠡ ᠵᠢᠨ ᠳᠤᠬᠢᠷᠠᠭᠤᠯᠤᠯᠳᠠ + /netconnect/Advanced settings" + + + ukui control center + ᠡᠵᠡᠮᠰᠢᠯ ᠤ᠋ᠨ ᠬᠠᠪᠳᠠᠰᠤ + + + ukui control center desktop message + ᠡᠵᠡᠮᠰᠢᠯ ᠤ᠋ᠨ ᠬᠠᠪᠳᠠᠰᠤᠨ ᠤ᠋ ᠰᠢᠷᠡᠭᠡᠨ ᠨᠢᠭᠤᠷ ᠤ᠋ᠨ ᠮᠡᠳᠡᠭᠳᠡᠯ + + + WiredConnect + ᠤᠳᠠᠰᠤᠳᠤ ᠰᠦᠯᠵᠢᠶ᠎ᠡ + + + + Settings + ᠳᠤᠬᠢᠷᠠᠭᠤᠯᠭ᠎ᠠ + + + + Settings desktop message + ᠰᠢᠷᠡᠭᠡᠨ ᠨᠢᠭᠤᠷ᠎ᠤ᠋ᠨ ᠵᠠᠩᠭᠢ᠎ᠶ᠋ᠢ ᠵᠣᠬᠢᠷᠠᠭᠤᠯᠬᠤ + + + + + LAN + ᠤᠲᠠᠰᠤᠲᠤ ᠲᠣᠣᠷ ᠰᠦᠯᠵᠢᠶ᠎ᠡ ᠃ + + + No ethernet device avaliable + ᠤᠳᠠᠰᠤᠳᠤ ᠳᠦᠬᠦᠬᠡᠷᠦᠮᠵᠢ ᠵᠢ ᠪᠠᠢᠴᠠᠭᠠᠵᠤ ᠤᠯᠤᠭᠰᠠᠨ ᠦᠬᠡᠢ + + + + + connected + ᠨᠢᠬᠡᠨᠳᠡ ᠴᠦᠷᠬᠡᠯᠡᠪᠡ + + + + + + not connected + + + + + card + ᠨᠧᠲ ᠤ᠋ᠨ ᠺᠠᠷᠲ + + + diff --git a/plugins/netconnect/translations/tr.qm b/plugins/netconnect/translations/tr.qm deleted file mode 100644 index be651eed..00000000 --- a/plugins/netconnect/translations/tr.qm +++ /dev/null @@ -1 +0,0 @@ - - - + + Disconnect - - + + Connect @@ -43,54 +43,49 @@ - + open /netconnect/open - + Advanced settings /netconnect/Advanced settings" - - ukui control center + + Settings - - ukui control center desktop message + + Settings desktop message - - + + LAN - - No ethernet device avaliable - - - - - + + connected - - - + + + not connected - + card diff --git a/plugins/netconnect/translations/zh_CN.qm b/plugins/netconnect/translations/zh_CN.qm deleted file mode 100644 index 6ac7d043..00000000 Binary files a/plugins/netconnect/translations/zh_CN.qm and /dev/null differ diff --git a/plugins/netconnect/translations/zh_CN.ts b/plugins/netconnect/translations/zh_CN.ts index da195eef..221b8951 100644 --- a/plugins/netconnect/translations/zh_CN.ts +++ b/plugins/netconnect/translations/zh_CN.ts @@ -6,7 +6,7 @@ Add Others - + @@ -22,14 +22,14 @@ 删除 - - + + Disconnect 断开 - - + + Connect 连接 @@ -43,58 +43,65 @@ - + open 开启 /netconnect/open - + Advanced settings 高级设置 /netconnect/Advanced settings" - ukui control center - 控制面板 + 控制面板 - ukui control center desktop message - 控制面板桌面通知 + 控制面板桌面通知 WiredConnect 有线网络 - - + + Settings + 设置 + + + + Settings desktop message + 设置 桌面通知 + + + + LAN 有线网络 - No ethernet device avaliable - 未检测到有线设备 + 未检测到有线设备 - - + + connected 已连接 - - - + + + not connected 未连接 - + card 网卡 diff --git a/plugins/proxy/applistwidget.cpp b/plugins/proxy/applistwidget.cpp index 150df26d..597532a6 100644 --- a/plugins/proxy/applistwidget.cpp +++ b/plugins/proxy/applistwidget.cpp @@ -43,12 +43,11 @@ void AppListWidget::setAppChecked(bool flag) /** * @brief AppListWidget::setAppIcon - * @param icon 应用图标的名称 + * @param icon 应用图标 */ -void AppListWidget::setAppIcon(const QPixmap &icon) +void AppListWidget::setAppIcon(const QIcon &icon) { - m_iconLabel->setAlignment(Qt::AlignCenter); - m_iconLabel->setPixmap(icon); + m_iconBtn->setIcon(icon); } /** @@ -119,13 +118,19 @@ void AppListWidget::initUI() mainLayout->setSpacing(8); m_checkBox = new QCheckBox(this); m_checkBox->setAttribute(Qt::WA_TransparentForMouseEvents, true); //m_checkBox不响应鼠标事件,将其传递给父窗口 - m_iconLabel = new QLabel(this); - m_iconLabel->setFixedSize(24, 24); + + m_iconBtn = new QToolButton(this); + m_iconBtn->setToolButtonStyle(Qt::ToolButtonStyle::ToolButtonIconOnly); + m_iconBtn->setAttribute(Qt::WA_TranslucentBackground, true); //透明 + m_iconBtn->setAttribute(Qt::WA_TransparentForMouseEvents, true); + m_iconBtn->setAutoRaise(true); + m_iconBtn->setFixedSize(24, 24); + m_iconBtn->setIconSize(QSize(24, 24)); + m_nameLabel = new QLabel(this); mainLayout->addWidget(m_checkBox); - mainLayout->addSpacing(8); - mainLayout->addWidget(m_iconLabel); + mainLayout->addWidget(m_iconBtn); mainLayout->addWidget(m_nameLabel); mainLayout->addStretch(); } diff --git a/plugins/proxy/applistwidget.h b/plugins/proxy/applistwidget.h index e44714e0..31b7e184 100644 --- a/plugins/proxy/applistwidget.h +++ b/plugins/proxy/applistwidget.h @@ -28,6 +28,7 @@ #include #include #include +#include class AppListWidget : public QWidget { @@ -37,7 +38,7 @@ public: ~AppListWidget(); void setAppChecked(bool flag); - void setAppIcon(const QPixmap &icon); + void setAppIcon(const QIcon &icon); void setAppName(const QString &text); void onAppCheckStateChanged(); void AddAppProxyConfig(); @@ -51,7 +52,7 @@ private: void initDbus(); QCheckBox *m_checkBox = nullptr; - QLabel *m_iconLabel = nullptr; + QToolButton *m_iconBtn = nullptr; QLabel *m_nameLabel = nullptr; QString m_path = nullptr; QDBusInterface *m_dbusInterface = nullptr; diff --git a/plugins/proxy/aptproxydialog.cpp b/plugins/proxy/aptproxydialog.cpp index b3c04f71..e42b738f 100644 --- a/plugins/proxy/aptproxydialog.cpp +++ b/plugins/proxy/aptproxydialog.cpp @@ -40,7 +40,7 @@ AptProxyDialog::~AptProxyDialog() void AptProxyDialog::initUi() { - setWindowTitle(tr("Set Apt Proxy")); + setWindowTitle(tr("Set APT Proxy")); this->setFixedSize(480, 200); QVBoxLayout *mAptProxyLyt = new QVBoxLayout(this); diff --git a/plugins/proxy/proxy.cpp b/plugins/proxy/proxy.cpp index 3886ad96..e217764f 100644 --- a/plugins/proxy/proxy.cpp +++ b/plugins/proxy/proxy.cpp @@ -127,6 +127,7 @@ QWidget *Proxy::pluginUi() { } else { qCritical() << "Xml needed by Proxy is not installed"; } + setUkccProxySettings(); } return pluginWidget; } @@ -428,14 +429,22 @@ void Proxy::initUi(QWidget *widget) AptLayout->addWidget(line_7); AptLayout->addWidget(mAPTFrame_2); + m_sysSpacerFrame = new QFrame(widget); + m_sysSpacerFrame->setFixedHeight(32); + m_appListSpacerFrame = new QFrame(widget); + m_appListSpacerFrame->setFixedHeight(4); + m_appSpacerFrame = new QFrame(widget);; + m_appSpacerFrame->setFixedHeight(32);; + mverticalLayout->addWidget(mTitleLabel); mverticalLayout->addWidget(mProxyFrame); - mverticalLayout->addSpacing(32); + + mverticalLayout->addWidget(m_sysSpacerFrame); // mverticalLayout->addWidget(m_appProxyLabel); // mverticalLayout->addWidget(m_appProxyFrame); - mverticalLayout->addSpacing(4); + mverticalLayout->addWidget(m_appListSpacerFrame); // mverticalLayout->addWidget(m_appListFrame); -// mverticalLayout->addSpacing(32); +// mverticalLayout->addWidget(m_appSpacerFrame); mverticalLayout->addWidget(mAptProxyLabel); mverticalLayout->addWidget(mAPTFrame); mverticalLayout->addStretch(); @@ -464,8 +473,11 @@ void Proxy::retranslateUi() mSOCKSPortLabel->setText(tr("Port")); mIgnoreLabel->setText(tr("List of ignored hosts. more than one entry, please separate with english semicolon(;)")); - //~ contents_path /Proxy/Apt Proxy - mAptProxyLabel->setText(tr("Apt Proxy")); + //~ contents_path /Proxy/App Proxy + tr("App Proxy"); + + //~ contents_path /Proxy/APT Proxy + mAptProxyLabel->setText(tr("APT Proxy")); mAptLabel->setText(tr("Open")); mAPTHostLabel_1->setText(tr("Server Address : ")); mAPTPortLabel_1->setText(tr("Port : ")); @@ -517,6 +529,7 @@ void Proxy::setupComponent(){ void Proxy::setupConnect(){ connect(mEnableBtn, &KSwitchButton::stateChanged, this ,[=](bool checked) { + UkccCommon::buriedSettings(QString("Proxy"), QString("System Proxy Open"), QString("settings"), checked?"true":"false"); mSelectFrame->setVisible(checked); line_8->setVisible(checked); mAutoBtn->setChecked(checked); @@ -530,9 +543,11 @@ void Proxy::setupConnect(){ connect(mProxyBtnGroup, QOverload::of(&QButtonGroup::buttonClicked), [=](QAbstractButton * eBtn){ if (eBtn == mAutoBtn) { + UkccCommon::buriedSettings(QString("Proxy"), QString("auto"), QString("clicked")); mManualBtn->setChecked(false); proxysettings->set(PROXY_MODE_KEY,"auto"); } else if (eBtn == mManualBtn){ + UkccCommon::buriedSettings(QString("Proxy"), QString("manual"), QString("clicked")); mAutoBtn->setChecked(false); proxysettings->set(PROXY_MODE_KEY,"manual"); } @@ -557,6 +572,7 @@ void Proxy::setupConnect(){ }); connect(mAptBtn , &KSwitchButton::stateChanged, this ,[=](bool checked){ + UkccCommon::buriedSettings(QString("Proxy"), QString("Apt Proxy Open"), QString("settings"), checked?"true":"false"); if (checked) { emit mEditBtn->click(); } else { // 关闭APT代理,删除对应的配置文件 @@ -567,7 +583,7 @@ void Proxy::setupConnect(){ } else { QMessageBox *mReboot = new QMessageBox(pluginWidget->topLevelWidget()); mReboot->setIcon(QMessageBox::Warning); - mReboot->setText(tr("The apt proxy has been turned off and needs to be restarted to take effect")); + mReboot->setText(tr("The APT proxy has been turned off and needs to be restarted to take effect")); QPushButton *laterbtn = mReboot->addButton(tr("Reboot Later"), QMessageBox::RejectRole); QPushButton *nowbtn = mReboot->addButton(tr("Reboot Now"), QMessageBox::AcceptRole); mReboot->exec(); @@ -716,13 +732,10 @@ void Proxy::initDbus() void Proxy::initAppProxyStatus() { bool state = getAppProxyState(); - m_appEnableBtn->setChecked(state); - onappProxyEnableChanged(state); - appProxyInfoPadding(); -// m_cancelBtn->setEnabled(false); -// m_saveBtn->setEnabled(false); appListPadding(); + m_appEnableBtn->setChecked(state); + setAppProxyUiEnable(state); } int Proxy::_getCurrentProxyMode(){ @@ -807,7 +820,7 @@ void Proxy::setAptInfo() { QMessageBox *mReboot = new QMessageBox(pluginWidget->topLevelWidget()); mReboot->setIcon(QMessageBox::Warning); - mReboot->setText(tr("The system needs to be restarted to set the Apt proxy, whether to reboot")); + mReboot->setText(tr("The system needs to be restarted to set the APT proxy, whether to reboot")); QPushButton *laterbtn = mReboot->addButton(tr("Reboot Later"), QMessageBox::RejectRole); QPushButton *nowbtn = mReboot->addButton(tr("Reboot Now"), QMessageBox::AcceptRole); mReboot->exec(); @@ -967,6 +980,50 @@ QMap Proxy::getAppListProxy() return appList; } +void Proxy::setUkccProxySettings() +{ + setSystemProxyFrameHidden(false); +// setAppProxyFrameHidden(false); + setAPTProxyFrameHidden(false); + + QDBusInterface ukccDbusInterface("org.ukui.ukcc.session", + "/", + "org.ukui.ukcc.session.interface", + QDBusConnection::sessionBus()); + + if(!ukccDbusInterface.isValid()) { + qWarning() << "ukccDbusInterface is invalid"; + return; + } + + QDBusReply > reply = ukccDbusInterface.call("getModuleHideStatus"); + if (!reply.isValid()) { + qWarning() << "reply of getModuleHideStatus is invalid"; + return; + } + + QStringList proxySettingList; + if (reply.value().contains("proxySettings")) { + QString proxySettings = reply.value()["proxySettings"].toString(); + qDebug() << "proxySettings" << proxySettings; + + if (proxySettings.isEmpty()) { + return; + } + proxySettingList = proxySettings.split(","); + } + + for (const QString setting : proxySettingList) { + if (setting.contains("SystemProxyFrame") && setting.contains("false")) { + setSystemProxyFrameHidden(true); + } else if (setting.contains("AppProxyFrame") && setting.contains("false")) { +// setAppProxyFrameHidden(true); + } else if (setting.contains("APTProxyFrame") && setting.contains("false")) { + setAPTProxyFrameHidden(true); + } + } +} + #if 0 bool Proxy::checkIsChanged(QStringList info) { @@ -1130,22 +1187,32 @@ void Proxy::setAppProxyFrameUi(QWidget *widget) m_appLine4 = setLine(m_appProxyFrame); m_appLine5 = setLine(m_appProxyFrame); + m_appProxyInfoWidget = new QWidget(m_appProxyFrame); + QVBoxLayout *widgetHLayout = new QVBoxLayout(m_appProxyInfoWidget); + widgetHLayout->setContentsMargins(0, 0, 0, 0); + widgetHLayout->setSpacing(0); + widgetHLayout->addWidget(m_appLine1); + widgetHLayout->addWidget(m_proxyTypeFrame); + widgetHLayout->addWidget(m_appLine2); + widgetHLayout->addWidget(m_ipAddressFrame); + widgetHLayout->addWidget(m_appLine3); + widgetHLayout->addWidget(m_portFrame); + widgetHLayout->addWidget(m_appLine4); + widgetHLayout->addWidget(m_userNameFrame); + widgetHLayout->addWidget(m_appLine5); + widgetHLayout->addWidget(m_pwdFrame); + appProxyLayout->addWidget(m_appEnableFrame); - appProxyLayout->addWidget(m_appLine1); - appProxyLayout->addWidget(m_proxyTypeFrame); - appProxyLayout->addWidget(m_appLine2); - appProxyLayout->addWidget(m_ipAddressFrame); - appProxyLayout->addWidget(m_appLine3); - appProxyLayout->addWidget(m_portFrame); - appProxyLayout->addWidget(m_appLine4); - appProxyLayout->addWidget(m_userNameFrame); - appProxyLayout->addWidget(m_appLine5); - appProxyLayout->addWidget(m_pwdFrame); + appProxyLayout->addWidget(m_appProxyInfoWidget); + // appProxyLayout->addWidget(line5); // appProxyLayout->addWidget(m_appBtnFrame); - connect(m_appEnableBtn, &KSwitchButton::stateChanged, this, &Proxy::onappProxyEnableChanged); + connect(m_appEnableBtn, &KSwitchButton::stateChanged, this, &Proxy::setAppProxyUiEnable); connect(m_appEnableBtn, &KSwitchButton::stateChanged, this, &Proxy::setAppProxyState); + connect(m_appEnableBtn, &KSwitchButton::stateChanged, [=](bool checked) { + UkccCommon::buriedSettings(QString("Proxy"), QString("App Proxy Open"), QString("settings"), checked?"true":"false"); + }); connect(m_proxyTypeComboBox, SIGNAL(currentTextChanged(QString)), this, SLOT(onAppProxyConfChanged())); connect(m_ipAddressLineEdit, SIGNAL(textChanged(QString)), this, SLOT(onipEditStateChanged())); connect(m_ipAddressLineEdit, SIGNAL(textChanged(QString)), this, SLOT(onAppProxyConfChanged())); @@ -1180,6 +1247,7 @@ void Proxy::setAppListFrameUi(QWidget *widget) m_appListWidget->setMinimumHeight(240); m_appListWidget->setFocusPolicy(Qt::FocusPolicy::NoFocus); m_appListWidget->setFrameShape(QFrame::Shape::Panel); + m_appListWidget->setVerticalScrollMode(QAbstractItemView::ScrollMode::ScrollPerPixel); appListLayout->addWidget(m_allowAppProxyLabel); appListLayout->addWidget(m_appListWidget); @@ -1224,7 +1292,7 @@ void Proxy::appListPadding() AppListWidget *appWidget = new AppListWidget(index, m_appListWidget); appWidget->setAppName(appInfo.value(0)); - appWidget->setAppIcon(QIcon::fromTheme(appInfo.value(1)).pixmap(24, 24)); + appWidget->setAppIcon(QIcon::fromTheme(appInfo.value(1))); appWidget->setAppChecked(flag); QListWidgetItem *appListWidgetItem = new QListWidgetItem(m_appListWidget); @@ -1248,6 +1316,32 @@ bool Proxy::getipEditState(QString text) return match; } +void Proxy::setSystemProxyFrameHidden(bool state) +{ + mTitleLabel->setHidden(state); + mProxyFrame->setHidden(state); + m_sysSpacerFrame->setHidden(state); +} + +void Proxy::setAppProxyFrameHidden(bool state) +{ + m_appProxyLabel->setHidden(state); + m_appProxyFrame->setHidden(state); + if (state) { + m_appListFrame->setHidden(state); + } else { + m_appListFrame->setHidden(!m_appEnableBtn->isChecked()); + } + m_appListSpacerFrame->setHidden(state); + m_appSpacerFrame->setHidden(state); +} + +void Proxy::setAPTProxyFrameHidden(bool state) +{ + mAptProxyLabel->setHidden(state); + mAPTFrame->setHidden(state); +} + void Proxy::onipEditStateChanged() { if (!getipEditState(m_ipAddressLineEdit->text())) { @@ -1299,19 +1393,15 @@ void Proxy::onPaletteChanged() m_appListWidget->setPalette(mpal); } -void Proxy::onappProxyEnableChanged(bool enable) +void Proxy::setAppProxyUiEnable(bool enable) { - m_proxyTypeFrame->setVisible(enable); - m_ipAddressFrame->setVisible(enable); - m_portFrame->setVisible(enable); - m_userNameFrame->setVisible(enable); - m_pwdFrame->setVisible(enable); - m_appListFrame->setVisible(enable); - m_appLine1->setVisible(enable); - m_appLine2->setVisible(enable); - m_appLine3->setVisible(enable); - m_appLine4->setVisible(enable); - m_appLine5->setVisible(enable); + if (enable) { + m_appProxyInfoWidget->show(); + m_appListFrame->show(); + } else { + m_appProxyInfoWidget->hide(); + m_appListFrame->hide(); + } } #if 0 diff --git a/plugins/proxy/proxy.h b/plugins/proxy/proxy.h index 6447d4e8..30d7437e 100644 --- a/plugins/proxy/proxy.h +++ b/plugins/proxy/proxy.h @@ -52,8 +52,10 @@ #include "kswitchbutton.h" #include "kpasswordedit.h" +#include "ukcccommon.h" using namespace kdk; +using namespace ukcc; /* qt会将glib里的signals成员识别为宏,所以取消该宏 * 后面如果用到signals时,使用Q_SIGNALS代替即可 @@ -136,13 +138,20 @@ public: void setAppProxyConf(QStringList list); //设置应用代理配置信息--调用Dbus static QMap getAppListProxy(); // bool checkIsChanged(QStringList info); - + void setUkccProxySettings(); // 设置控制面板代理模块显示/隐藏 private: void setAppProxyFrameUi(QWidget *widget); void setAppListFrameUi(QWidget *widget); void appProxyInfoPadding(); void appListPadding(); bool getipEditState(QString text); + void setSystemProxyFrameHidden(bool state); + void setAppProxyFrameHidden(bool state); + void setAPTProxyFrameHidden(bool state); + + QFrame *m_sysSpacerFrame; + QFrame *m_appListSpacerFrame; + QFrame *m_appSpacerFrame; QString pluginName; int pluginType; @@ -250,6 +259,7 @@ private: // QPushButton *m_cancelBtn; // QPushButton *m_saveBtn; QListWidget *m_appListWidget = nullptr; + QWidget *m_appProxyInfoWidget; QTextEdit *mIgnoreLineEdit; @@ -274,7 +284,7 @@ private: private slots: void setAptProxySlot(); //处理apt代理前端交互逻辑 - void onappProxyEnableChanged(bool enable); //IP地址无效提示 + void setAppProxyUiEnable(bool enable); void onipEditStateChanged(); //IP地址无效提示 void onAppProxyConfChanged(); //应用代理配置信息变化 void onAppProxyConfEditFinished(); diff --git a/plugins/proxy/proxy.pro b/plugins/proxy/proxy.pro index 2e5ab27e..2acec366 100644 --- a/plugins/proxy/proxy.pro +++ b/plugins/proxy/proxy.pro @@ -7,6 +7,11 @@ CONFIG += plugin TARGET = $$qtLibraryTarget(proxy) DESTDIR = ../.. + +CONFIG(release, debug|release) { + !system($$PWD/translate_generation.sh): error("Failed to generate translation") +} + target.path = $$[QT_INSTALL_LIBS]/ukui-control-center trans.files = translations/* trans.path = /usr/share/kylin-nm/proxy/ @@ -49,4 +54,9 @@ INSTALLS += target \ TRANSLATIONS += \ translations/zh_CN.ts \ translations/tr.ts \ - translations/bo_CN.ts + translations/bo_CN.ts \ + translations/en_US.ts \ + translations/mn.ts + +DISTFILES += \ + translations/en_US.ts diff --git a/plugins/proxy/translate_generation.sh b/plugins/proxy/translate_generation.sh new file mode 100755 index 00000000..72f748b9 --- /dev/null +++ b/plugins/proxy/translate_generation.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +ts_list=(`ls translations/*.ts`) +source /etc/os-release +version=(`echo $ID`) + +for ts in "${ts_list[@]}" +do + printf "\nprocess ${ts}\n" + if [ "$version" == "fedora" ] || [ "$version" == "opensuse-leap" ] || [ "$version" == "opensuse-tumbleweed" ];then + lrelease-qt5 "${ts}" + else + lrelease "${ts}" + fi +done diff --git a/plugins/proxy/translations/bo_CN.qm b/plugins/proxy/translations/bo_CN.qm deleted file mode 100644 index 67dad166..00000000 Binary files a/plugins/proxy/translations/bo_CN.qm and /dev/null differ diff --git a/plugins/proxy/translations/bo_CN.ts b/plugins/proxy/translations/bo_CN.ts index f806cf22..300c6189 100644 --- a/plugins/proxy/translations/bo_CN.ts +++ b/plugins/proxy/translations/bo_CN.ts @@ -4,27 +4,27 @@ AptProxyDialog - - Set Apt Proxy - Apt ངོ་ཚབ་ བཙུགས་པ། + + Set APT Proxy + APT ངོ་ཚབ་ བཙུགས་པ། - + Server Address ཞབས་ཞུའི་ས་གནས། - + Port གྲུ་ཁ། - + Cancel ཕྱིར་འཐེན། - + Confirm གཏན་འཁེལ་བྱ་དགོས། @@ -37,130 +37,135 @@ ཚབ་བྱེད་མི་སྣ། - + Start using བཀོལ་སྤྱོད་བྱེད་འགོ་ཚུགས། - + Proxy mode ཚབ་བྱེད་དཔེ་དབྱིབས། - + Auto རང་འགུལ་གྱིས་རླངས་ - + Manual ལག་དེབ། - Application Proxy - ཉེར་སྤྱོད་ངོ་ཚབ། + ཉེར་སྤྱོད་ངོ་ཚབ། - + System Proxy མ་ལག་གི་ཚབ་བྱེད་ - + Auto url རླངས་འཁོར་གྱི་དྲ་ཚིགས། /Proxy/Auto url - + Http Proxy HTTP ཚབ་བྱེད་མི་སྣ། /Proxy/Http Proxy - + Https Proxy HTTPS ཚབ་བྱེད་མི་སྣ། /Proxy/Https Proxy - + Ftp Proxy FTP ཚབ་བྱེད་མི་སྣ། /Proxy/Ftp Proxy - + Socks Proxy SOCKS ཚབ་བྱེད་མི་སྣ། /Proxy/Socks Proxy - - - - - + + + + + Port གྲུ་ཁ། - + List of ignored hosts. more than one entry, please separate with english semicolon(;) སྣང་མེད་དུ་བཞག་པའི་བདག་པོའི་མིང་ཐོ། འཇུག་སྒོ་གཅིག་ལས་བརྒལ་ན་དབྱིན་ཡིག་གི་ཕྱེད་ཀ་དང་ཁ་གྱེས་རོགས། (;) - - Apt Proxy - APT ཚབ་བྱེད་མི་སྣ། - /Proxy/Apt Proxy + + App Proxy + ཉེར་སྤྱོད་ངོ་ཚབ། + /Proxy/App Proxy - - + + APT Proxy + APT ཚབ་བྱེད་མི་སྣ། + /Proxy/APT Proxy + + + + Open སྒོ་ཕྱེ་བ། - + Server Address : ཞབས་ཞུའི་ཡོ་བྱད་ཀྱི་གནས་ཡུལ - + Port : གྲུ་ཁ། - + Edit རྩོམ་སྒྲིག - - The apt proxy has been turned off and needs to be restarted to take effect + + The APT proxy has been turned off and needs to be restarted to take effect ངོ་ཚབ་ཀྱི་སྒོ་བརྒྱབ་ཟིན་པས་ཡང་བསྐྱར་ནུས་པ་ཐོན་པར་བྱ་དགོས། - - + + Reboot Later རྗེས་སུ་ཡང་བསྐྱར་ཐེངས་གཅིག་ལ་བསྐྱར་ - - + + Reboot Now ད་ལྟ་བསྐྱར་དུ་ལས་ཀ་བྱེད་དགོས། - - The system needs to be restarted to set the Apt proxy, whether to reboot - མ་ལག་འདི་བསྐྱར་དུ་འགོ་ཚུགས་ནས་Aptཡི་ཚབ་བྱེད་འཕྲུལ་ཆས་གཏན་འཁེལ་བྱེད་དགོས་པ་དང་། བསྐྱར་དུ་འགོ་འཛུགས་དགོས་མིན་ + + The system needs to be restarted to set the APT proxy, whether to reboot + མ་ལག་འདི་བསྐྱར་དུ་འགོ་ཚུགས་ནས་APT ཡི་ཚབ་བྱེད་འཕྲུལ་ཆས་གཏན་འཁེལ་བྱེད་དགོས་པ་དང་། བསྐྱར་དུ་འགོ་འཛུགས་དགོས་མིན་ - + Proxy type ངོ་ཚབ་ཀྱི་རིགས་དབྱིབས། @@ -177,49 +182,49 @@ རྐང་འབོབ་5 - + IP address IPས་གནས། - - + + Required བླང་བྱ་བཏོན་པ། - + Invalid IP Address གོ་མི་ཆོད་པའི་IPས་གནས། - + Username སྤྱོད་མཁན་གྱི་མིང་། - - + + Optional བསལ་འདེམས་ཀྱི་རང་བཞིན། - + Password གསང་གྲངས། - + Cancel ཕྱིར་འཐེན། - + Save གྲོན་ཆུང་བྱེད་དགོས། - + The following applications are allowed to use this configuration: གཤམ་གྱི་ཉེར་སྤྱོད་གོ་རིམ་ཁྲོད་དུ་བཀོད་སྒྲིག་འདི་བཀོལ་ཆོག་པ་སྟེ། diff --git a/plugins/proxy/translations/en_US.ts b/plugins/proxy/translations/en_US.ts new file mode 100644 index 00000000..5b631c06 --- /dev/null +++ b/plugins/proxy/translations/en_US.ts @@ -0,0 +1,216 @@ + + + + + AptProxyDialog + + + Set APT Proxy + + + + + Server Address + + + + + Port + + + + + Cancel + + + + + Confirm + + + + + Proxy + + + Proxy + + + + + Start using + + + + + Proxy mode + + + + + Auto + + + + + Manual + + + + + System Proxy + + + + + Auto url + + /Proxy/Auto url + + + + Http Proxy + + /Proxy/Http Proxy + + + + Https Proxy + + /Proxy/Https Proxy + + + + Ftp Proxy + + /Proxy/Ftp Proxy + + + + Socks Proxy + + /Proxy/Socks Proxy + + + + + + + + Port + + + + + List of ignored hosts. more than one entry, please separate with english semicolon(;) + + + + + App Proxy + + /Proxy/App Proxy + + + + APT Proxy + + /Proxy/APT Proxy + + + + + Open + + + + + Server Address : + + + + + Port : + + + + + Edit + + + + + The APT proxy has been turned off and needs to be restarted to take effect + + + + + + Reboot Later + + + + + + Reboot Now + + + + + The system needs to be restarted to set the APT proxy, whether to reboot + + + + + Proxy type + + + + + IP address + + + + + + Required + + + + + Invalid IP Address + + + + + Username + + + + + + Optional + + + + + Password + + + + + Cancel + + + + + Save + + + + + The following applications are allowed to use this configuration: + + + + diff --git a/plugins/proxy/translations/mn.ts b/plugins/proxy/translations/mn.ts new file mode 100644 index 00000000..a339baf6 --- /dev/null +++ b/plugins/proxy/translations/mn.ts @@ -0,0 +1,220 @@ + + + + + AptProxyDialog + + + Set APT Proxy + APT ᠤᠷᠤᠯᠠᠭᠴᠢ ᠳᠤᠬᠢᠷᠠᠭᠤᠯᠬᠤ + + + + Server Address + ᠦᠢᠯᠡᠴᠢᠯᠡᠬᠦᠷ ᠤ᠋ᠨ ᠬᠠᠶᠢᠭ + + + + Port + ᠦᠵᠦᠬᠦᠷ + + + + Cancel + ᠦᠬᠡᠢᠰᠬᠡᠬᠦ + + + + Confirm + ᠪᠠᠳᠤᠯᠠᠬᠤ + + + + Proxy + + + Proxy + ᠤᠷᠤᠯᠠᠭᠴᠢ + + + + Start using + ᠡᠬᠢᠯᠡᠬᠦᠯᠬᠦ + + + + Proxy mode + ᠤᠷᠤᠯᠠᠭᠴᠢ ᠵᠢᠨ ᠳᠦᠷᠦᠯ ᠵᠦᠢᠯ + + + + Auto + ᠠᠦ᠋ᠲ᠋ᠣ᠋ + + + + Manual + ᠠᠦ᠋ᠲ᠋ᠣ᠋ ᠪᠤᠰᠤ + + + Application Proxy + ᠬᠡᠷᠡᠭᠯᠡᠭᠡᠨ ᠤ᠋ ᠤᠷᠤᠯᠠᠭᠴᠢ + + + + System Proxy + ᠰᠢᠰᠲ᠋ᠧᠮ ᠤ᠋ᠨ ᠤᠷᠤᠯᠠᠭᠴᠢ + + + + Auto url + URL ᠳᠤᠬᠢᠷᠠᠭᠤᠯᠭ᠎ᠠ + /Proxy/Auto url + + + + Http Proxy + HTTP ᠤᠷᠤᠯᠠᠭᠴᠢ + /Proxy/Http Proxy + + + + Https Proxy + HTTPS ᠤᠷᠤᠯᠠᠭᠴᠢ + /Proxy/Https Proxy + + + + Ftp Proxy + FTP ᠤᠷᠤᠯᠠᠭᠴᠢ + /Proxy/Ftp Proxy + + + + Socks Proxy + SOCKS ᠤᠷᠤᠯᠠᠭᠴᠢ + /Proxy/Socks Proxy + + + + + + + + Port + ᠦᠵᠦᠬᠦᠷ + + + + List of ignored hosts. more than one entry, please separate with english semicolon(;) + ᠤᠮᠳᠤᠭᠠᠢᠯᠠᠭᠰᠠᠨ ᠭᠤᠤᠯ ᠮᠠᠰᠢᠨ ᠤ᠋ ᠵᠢᠭᠰᠠᠭᠠᠯᠳᠠ᠂ ᠠᠩᠭ᠌ᠯᠢ ᠬᠡᠯᠡᠨ ᠤ᠋ ᠵᠠᠭᠠᠭᠯᠠᠬᠤ ᠳᠡᠮᠳᠡᠭ ᠢ᠋ ᠬᠡᠷᠡᠭᠯᠡᠬᠡᠷᠡᠢ (;) + + + + App Proxy + ᠬᠡᠷᠡᠭᠯᠡᠭᠡᠨ ᠤ᠋ ᠤᠷᠤᠯᠠᠭᠴᠢ + /Proxy/App Proxy + + + + APT Proxy + APT ᠤᠷᠤᠯᠠᠭᠴᠢ + /Proxy/APT Proxy + + + + + Open + ᠨᠡᠬᠡᠬᠡᠬᠦ + + + + Server Address : + ᠦᠢᠯᠡᠴᠢᠯᠡᠬᠦᠷ ᠤ᠋ᠨ ᠬᠠᠶᠢᠭ: + + + + Port : + ᠫᠤᠷᠲ : + + + + Edit + ᠨᠠᠢᠷᠠᠭᠤᠯᠬᠤ + + + + The APT proxy has been turned off and needs to be restarted to take effect + APT ᠤᠷᠤᠯᠠᠭᠴᠢ ᠬᠠᠭᠠᠭᠳᠠᠪᠠ᠂ ᠳᠠᠬᠢᠵᠤ ᠨᠡᠬᠡᠬᠡᠭᠰᠡᠨ ᠤ᠋ ᠳᠠᠷᠠᠭ᠎ᠠ ᠰᠠᠶᠢ ᠬᠦᠴᠦᠨ ᠲᠠᠢ ᠪᠤᠯᠤᠨ᠎ᠠ + + + + + Reboot Later + ᠤᠳᠠᠰᠬᠢᠭᠠᠳ ᠳᠠᠬᠢᠨ ᠡᠬᠢᠯᠡᠬᠦᠯᠬᠦ + + + + + Reboot Now + ᠳᠠᠷᠤᠢ ᠳᠠᠬᠢᠨ ᠡᠬᠢᠯᠡᠬᠦᠯᠬᠦ + + + + The system needs to be restarted to set the APT proxy, whether to reboot + ᠳᠤᠬᠢᠷᠠᠭᠤᠯᠤᠭᠰᠠᠨ APT ᠤᠷᠤᠯᠠᠭᠴᠢ ᠰᠢᠰᠲ᠋ᠧᠮ ᠢ᠋ ᠳᠠᠬᠢᠨ ᠡᠬᠢᠯᠡᠬᠦᠯᠦᠭᠰᠡᠨ ᠤ᠋ ᠳᠠᠷᠠᠭ᠎ᠠ ᠰᠠᠶᠢ ᠬᠦᠴᠦᠨ ᠲᠠᠢ ᠪᠤᠯᠤᠨ᠎ᠠ᠂ ᠰᠢᠰᠲ᠋ᠧᠮ ᠢ᠋ ᠳᠠᠬᠢᠨ ᠡᠬᠢᠯᠡᠬᠦᠯᠬᠦ ᠤᠤ + + + + Proxy type + ᠤᠷᠤᠯᠠᠭᠴᠢ ᠵᠢᠨ ᠳᠦᠷᠦᠯ ᠵᠦᠢᠯ + + + + IP address + IP ᠬᠠᠶᠢᠭ + + + + + Required + ᠡᠷᠬᠡᠪᠰᠢ ᠳᠠᠭᠯᠠᠬᠤ + + + + Invalid IP Address + ᠬᠦᠴᠦᠨ ᠦᠭᠡᠢ IP ᠬᠠᠶᠢᠭ + + + + Username + ᠬᠡᠷᠡᠭᠯᠡᠭᠴᠢ ᠵᠢᠨ ᠨᠡᠷ᠎ᠡ + + + + + Optional + ᠰᠤᠩᠭᠤᠵᠤ ᠳᠠᠭᠯᠠᠬᠤ + + + + Password + ᠨᠢᠭᠤᠴᠠ ᠺᠤᠳ᠋ + + + + Cancel + ᠦᠬᠡᠢᠰᠬᠡᠬᠦ + + + + Save + ᠬᠠᠳᠠᠭᠠᠯᠠᠬᠤ + + + + The following applications are allowed to use this configuration: + ᠳᠤᠤᠷᠠᠬᠢ ᠬᠡᠷᠡᠭᠯᠡᠭᠡ ᠲᠤᠰ ᠳᠤᠬᠢᠷᠠᠭᠤᠯᠭ᠎ᠠ ᠵᠢ ᠬᠡᠷᠡᠭᠯᠡᠬᠦ ᠵᠢ ᠵᠦᠪᠰᠢᠶᠡᠷᠡᠨ᠎ᠡ: + + + diff --git a/plugins/proxy/translations/tr.ts b/plugins/proxy/translations/tr.ts index 9bb74840..5b631c06 100644 --- a/plugins/proxy/translations/tr.ts +++ b/plugins/proxy/translations/tr.ts @@ -4,27 +4,27 @@ AptProxyDialog - - Set Apt Proxy + + Set APT Proxy - + Server Address - + Port - + Cancel - + Confirm @@ -37,177 +37,178 @@ - + Start using - + Proxy mode - + Auto - + Manual - - Application Proxy - - - - + System Proxy - + Auto url /Proxy/Auto url - + Http Proxy /Proxy/Http Proxy - + Https Proxy /Proxy/Https Proxy - + Ftp Proxy /Proxy/Ftp Proxy - + Socks Proxy /Proxy/Socks Proxy - - - - - + + + + + Port - + List of ignored hosts. more than one entry, please separate with english semicolon(;) - - Apt Proxy + + App Proxy - /Proxy/Apt Proxy + /Proxy/App Proxy - - + + APT Proxy + + /Proxy/APT Proxy + + + + Open - + Server Address : - + Port : - + Edit - - The apt proxy has been turned off and needs to be restarted to take effect + + The APT proxy has been turned off and needs to be restarted to take effect - - + + Reboot Later - - + + Reboot Now - - The system needs to be restarted to set the Apt proxy, whether to reboot + + The system needs to be restarted to set the APT proxy, whether to reboot - + Proxy type - + IP address - - + + Required - + Invalid IP Address - + Username - - + + Optional - + Password - + Cancel - + Save - + The following applications are allowed to use this configuration: diff --git a/plugins/proxy/translations/zh_CN.qm b/plugins/proxy/translations/zh_CN.qm deleted file mode 100644 index 61541952..00000000 Binary files a/plugins/proxy/translations/zh_CN.qm and /dev/null differ diff --git a/plugins/proxy/translations/zh_CN.ts b/plugins/proxy/translations/zh_CN.ts index 1360a035..69d215ae 100644 --- a/plugins/proxy/translations/zh_CN.ts +++ b/plugins/proxy/translations/zh_CN.ts @@ -4,27 +4,27 @@ AptProxyDialog - - Set Apt Proxy - 设置APT代理 + + Set APT Proxy + 设置 APT 代理 - + Server Address 服务器地址 - + Port 端口 - + Cancel 取消 - + Confirm 确定 @@ -37,177 +37,182 @@ 代理 - + Start using 启用 - + Proxy mode 代理类型 - + Auto 自动 - + Manual 手动 - Application Proxy - 应用代理 + 应用代理 - + System Proxy 系统代理 - + Auto url - 配置URL + 配置 URL /Proxy/Auto url - + Http Proxy - HTTP代理 + HTTP 代理 /Proxy/Http Proxy - + Https Proxy - HTTPS代理 + HTTPS 代理 /Proxy/Https Proxy - + Ftp Proxy - FTP代理 + FTP 代理 /Proxy/Ftp Proxy - + Socks Proxy - SOCKS代理 + SOCKS 代理 /Proxy/Socks Proxy - - - - - + + + + + Port 端口 - + List of ignored hosts. more than one entry, please separate with english semicolon(;) 忽略的主机列表,请使用英文分号(;) - - Apt Proxy - APT代理 - /Proxy/Apt Proxy + + App Proxy + 应用代理 + /Proxy/App Proxy - - + + APT Proxy + APT 代理 + /Proxy/APT Proxy + + + + Open 开启 - + Server Address : 服务器地址: - + Port : 端口: - + Edit 编辑 - - The apt proxy has been turned off and needs to be restarted to take effect - APT代理已关闭,需要重启才能生效 + + The APT proxy has been turned off and needs to be restarted to take effect + APT 代理已关闭,需要重启才能生效 - - + + Reboot Later 稍后重启 - - + + Reboot Now 立即重启 - - The system needs to be restarted to set the Apt proxy, whether to reboot - 设置APT代理需要重启系统后生效,是否重启系统 + + The system needs to be restarted to set the APT proxy, whether to reboot + 设置 APT 代理需要重启系统后生效,是否重启系统 - + Proxy type 代理类型 - + IP address - IP地址 + IP 地址 - - + + Required 必填 - + Invalid IP Address - 无效的IP地址 + 无效的 IP 地址 - + Username 用户名 - - + + Optional 选填 - + Password 密码 - + Cancel 取消 - + Save 保存 - + The following applications are allowed to use this configuration: 允许以下应用使用该配置: diff --git a/plugins/vpn/translate_generation.sh b/plugins/vpn/translate_generation.sh new file mode 100755 index 00000000..72f748b9 --- /dev/null +++ b/plugins/vpn/translate_generation.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +ts_list=(`ls translations/*.ts`) +source /etc/os-release +version=(`echo $ID`) + +for ts in "${ts_list[@]}" +do + printf "\nprocess ${ts}\n" + if [ "$version" == "fedora" ] || [ "$version" == "opensuse-leap" ] || [ "$version" == "opensuse-tumbleweed" ];then + lrelease-qt5 "${ts}" + else + lrelease "${ts}" + fi +done diff --git a/plugins/vpn/translations/bo_CN.ts b/plugins/vpn/translations/bo_CN.ts new file mode 100644 index 00000000..fb6446e7 --- /dev/null +++ b/plugins/vpn/translations/bo_CN.ts @@ -0,0 +1,84 @@ + + + + + AddNetBtn + + + Add Others + + + + + Add WiredNetork + + + + + ItemFrame + + + Add VPN + ཁ་སྣོན་རྒྱག་པ།VPN + + + + Vpn + + + + VPN + + + + + import + + + + + + Show on Taskbar + ལས་འགན་གྱི་ངོས་སུ་དཔེ་རིས་གསལ་པོར་མངོན་པ། + /Vpn/Show on Taskbar + + + + Add VPN + ཁ་སྣོན་རྒྱག་པ།VPN + /Vpn/Add VPN + + + + + connected + འབྲེལ་མཐུད་བྱུང་ཡོད། + + + + + not connected + འབྲེལ་མཐུད་མ་བྱས་པ། + + + + VpnItem + + + Delete + སུབ་དགོས། + + + + + Disconnect + བར་མཚམས་ཆད་པ་རེད། + + + + + Connect + འབྲེལ་མཐུད་བཅས་བྱ་དགོས། + + + diff --git a/plugins/vpn/translations/en_US.ts b/plugins/vpn/translations/en_US.ts new file mode 100644 index 00000000..f58fab41 --- /dev/null +++ b/plugins/vpn/translations/en_US.ts @@ -0,0 +1,84 @@ + + + + + AddNetBtn + + + Add Others + + + + + Add WiredNetork + + + + + ItemFrame + + + Add VPN + + + + + Vpn + + + + VPN + + + + + import + + + + + + Show on Taskbar + + /Vpn/Show on Taskbar + + + + Add VPN + + /Vpn/Add VPN + + + + + connected + + + + + + not connected + + + + + VpnItem + + + Delete + + + + + + Disconnect + + + + + + Connect + + + + diff --git a/plugins/vpn/translations/mn.ts b/plugins/vpn/translations/mn.ts new file mode 100644 index 00000000..6a8cc0be --- /dev/null +++ b/plugins/vpn/translations/mn.ts @@ -0,0 +1,84 @@ + + + + + AddNetBtn + + + Add Others + ᠪᠤᠰᠤᠳ ᠲᠤᠤᠷ ᠰᠦᠯᠵᠢᠶᠡᠨ ᠳ᠋ᠤ᠌ ᠵᠠᠯᠭᠠᠬᠤ + + + + Add WiredNetork + ᠤᠲᠠᠰᠤᠲᠤ ᠨᠧᠲ ᠨᠡᠮᠡᠬᠦ + + + + ItemFrame + + + Add VPN + VPN ᠨᠡᠮᠡᠬᠦ + + + + Vpn + + + + VPN + + + + + import + + + + + + Show on Taskbar + ᠡᠬᠦᠷᠬᠡ ᠵᠢᠨ ᠪᠠᠭᠠᠷ ᠲᠤ᠌ ᠢᠺᠦᠨ ᠵᠢᠷᠤᠭ ᠢ᠋ ᠢᠯᠡᠷᠡᠬᠦᠯᠬᠦ + /Vpn/Show on Taskbar + + + + Add VPN + VPN ᠨᠡᠮᠡᠬᠦ + /Vpn/Add VPN + + + + + connected + ᠴᠦᠷᠬᠡᠯᠡᠪᠡ + + + + + not connected + ᠴᠦᠷᠬᠡᠯᠡᠭᠡ ᠦᠬᠡᠢ + + + + VpnItem + + + Delete + ᠬᠠᠰᠤᠬᠤ + + + + + Disconnect + ᠳᠠᠰᠤᠯᠬᠤ + + + + + Connect + ᠴᠦᠷᠬᠡᠯᠡᠬᠦ + + + diff --git a/plugins/vpn/translations/zh_CN.qm b/plugins/vpn/translations/zh_CN.qm deleted file mode 100644 index e0162a9b..00000000 Binary files a/plugins/vpn/translations/zh_CN.qm and /dev/null differ diff --git a/plugins/vpn/translations/zh_CN.ts b/plugins/vpn/translations/zh_CN.ts index 34788ed0..ef0e9b29 100644 --- a/plugins/vpn/translations/zh_CN.ts +++ b/plugins/vpn/translations/zh_CN.ts @@ -4,12 +4,12 @@ AddNetBtn - + Add Others - + Add WiredNetork @@ -26,6 +26,7 @@ Vpn + VPN @@ -35,24 +36,27 @@ - - VPN - - - - + + Show on Taskbar 在任务栏显示图标 + /Vpn/Show on Taskbar - - + + Add VPN + 添加 VPN 连接 + /Vpn/Add VPN + + + + connected 已连接 - - + + not connected 未连接 @@ -60,19 +64,19 @@ VpnItem - + Delete 删除 - - + + Disconnect 断开 - - + + Connect 连接 diff --git a/plugins/vpn/vpn.cpp b/plugins/vpn/vpn.cpp index 26f24ef8..5efd3e43 100644 --- a/plugins/vpn/vpn.cpp +++ b/plugins/vpn/vpn.cpp @@ -107,6 +107,7 @@ QWidget *Vpn::pluginUi(){ initComponent(); initConnect(); initNet(); + initSearchText(); } return m_pluginWidget; } @@ -131,6 +132,11 @@ bool Vpn::isEnable() const return true; } +QString Vpn::translationPath() const +{ + return "/usr/share/kylin-nm/vpn/%1.ts"; +} + void Vpn::initComponent(){ //在任务栏上显示图标 //显示已连接时间 @@ -188,6 +194,7 @@ void Vpn::initComponent(){ ui->verticalLayout_3->addWidget(m_listFrame); connect(m_listFrame->m_addVpnWidget, &AddNetBtn::clicked, this, [=]() { + UkccCommon::buriedSettings(QString("VPN"), QString("Add VPN"), QString("clicked")); runExternalApp(); }); @@ -212,6 +219,10 @@ void Vpn::initComponent(){ } }); + connect(m_showBtn, &KSwitchButton::clicked, this, [=](bool checked){ + UkccCommon::buriedSettings(QString("VPN"), QString("Show on Taskbar"), QString("settings"), checked ? "true":"false"); + }); + // connect(m_timeBtn, &KSwitchButton::stateChanged, this, [=](bool state){ // if (m_switchGsettings != nullptr) { // m_switchGsettings->set(VISIBLE, state); @@ -267,6 +278,14 @@ void Vpn::setShowSwitchStatus() } } +void Vpn::initSearchText() +{ + //~ contents_path /Vpn/Show on Taskbar + tr("Show on Taskbar"); + //~ contents_path /Vpn/Add VPN + tr("Add VPN"); +} + void Vpn::runExternalApp(){ // QString cmd = "nm-connection-editor"; // QProcess process(this); @@ -488,6 +507,10 @@ int Vpn::getInsertPos(QString connName) auto dbusArg = result.arguments().at(0).value(); QVector variantList; dbusArg >> variantList; + if (variantList.isEmpty()) { + qDebug() << "[Vpn] virtualList is empty, getInsertPos return 0"; + return 0; + } for (int i = 0; i < variantList.size(); ++i ) { if (variantList.at(i).at(0) == connName) { qDebug() << "pos in kylin-nm is " << i; diff --git a/plugins/vpn/vpn.h b/plugins/vpn/vpn.h index 78e78258..7ce13c6e 100644 --- a/plugins/vpn/vpn.h +++ b/plugins/vpn/vpn.h @@ -32,8 +32,10 @@ #include "kwidget.h" #include "kswitchbutton.h" #include "itemframe.h" +#include "ukcccommon.h" using namespace kdk; +using namespace ukcc; namespace Ui { class Vpn; @@ -56,6 +58,7 @@ public: bool isShowOnHomePage() const Q_DECL_OVERRIDE; QIcon icon() const Q_DECL_OVERRIDE; bool isEnable() const Q_DECL_OVERRIDE; + QString translationPath() const Q_DECL_OVERRIDE; public: void initComponent(); @@ -106,8 +109,9 @@ private: //单个lan连接状态变化 void itemActiveConnectionStatusChanged(VpnItem *item, int status); - void setShowSwitchStatus(); + // 搜索词条 + void initSearchText(); private slots: void onVpnAdd(QStringList); diff --git a/plugins/vpn/vpn.pro b/plugins/vpn/vpn.pro index 957517c6..32b78008 100644 --- a/plugins/vpn/vpn.pro +++ b/plugins/vpn/vpn.pro @@ -47,4 +47,11 @@ INSTALLS += target \ trans TRANSLATIONS += \ - translations/zh_CN.ts + translations/zh_CN.ts \ + translations/bo_CN.ts \ + translations/en_US.ts \ + translations/mn.ts + +CONFIG(release, debug|release) { + !system($$PWD/translate_generation.sh): error("Failed to generate translation") +} diff --git a/plugins/vpn/vpnitem.cpp b/plugins/vpn/vpnitem.cpp index 34daf594..7b03a5cd 100644 --- a/plugins/vpn/vpnitem.cpp +++ b/plugins/vpn/vpnitem.cpp @@ -20,6 +20,7 @@ #include "vpnitem.h" #include #include +#include #define FRAME_SPEED 150 #define LIMIT_TIME 60*1000 #define TOTAL_PAGE 8 @@ -34,11 +35,6 @@ VpnItem::VpnItem(bool bAcitve, QWidget *parent) this->setMinimumSize(550, 58); this->setProperty("useButtonPalette", true); this->setFlat(true); - QPalette pal = this->palette(); - QColor color = pal.color(QPalette::Button); - color.setAlphaF(0.5); - pal.setColor(QPalette::Button, color); - this->setPalette(pal); QHBoxLayout *mLanLyt = new QHBoxLayout(this); mLanLyt->setContentsMargins(16,0,16,0); mLanLyt->setSpacing(16); @@ -136,12 +132,16 @@ void VpnItem::onDeletetTriggered() void VpnItem::paintEvent(QPaintEvent *event) { - QPalette pal = this->palette(); - QPainter painter(this); painter.setRenderHint(QPainter:: Antialiasing, true); //设置渲染,启动反锯齿 painter.setPen(Qt::NoPen); - painter.setBrush(pal.color(QPalette::Base)); + painter.setBrush(this->palette().base().color()); + + QPalette pal = qApp->palette(); + QColor color = pal.color(QPalette::Button); + color.setAlphaF(0.5); + pal.setColor(QPalette::Button, color); + this->setPalette(pal); QRect rect = this->rect(); @@ -175,11 +175,11 @@ bool VpnItem::eventFilter(QObject *watched, QEvent *event) { //菜单右边界与按钮右边界对齐 if (event->type() == QEvent::Show && watched == m_moreMenu) { - int menuXPos = m_moreMenu->pos().x(); int menuWidth = m_moreMenu->size().width(); int btnWidth = m_moreButton->size().width(); + int btnGlobalXPos = mapToGlobal(m_moreButton->pos()).x(); - QPoint pos = QPoint (menuXPos - menuWidth + btnWidth, m_moreMenu->pos().y()); + QPoint pos = QPoint (btnGlobalXPos - menuWidth + btnWidth, m_moreMenu->pos().y()); m_moreMenu->move(pos); return true; } diff --git a/plugins/wlanconnect/translate_generation.sh b/plugins/wlanconnect/translate_generation.sh new file mode 100755 index 00000000..72f748b9 --- /dev/null +++ b/plugins/wlanconnect/translate_generation.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +ts_list=(`ls translations/*.ts`) +source /etc/os-release +version=(`echo $ID`) + +for ts in "${ts_list[@]}" +do + printf "\nprocess ${ts}\n" + if [ "$version" == "fedora" ] || [ "$version" == "opensuse-leap" ] || [ "$version" == "opensuse-tumbleweed" ];then + lrelease-qt5 "${ts}" + else + lrelease "${ts}" + fi +done diff --git a/plugins/wlanconnect/translations/bo.qm b/plugins/wlanconnect/translations/bo.qm deleted file mode 100644 index be651eed..00000000 --- a/plugins/wlanconnect/translations/bo.qm +++ /dev/null @@ -1 +0,0 @@ - - ukui control center + Settings - ukui control center desktop message + Settings desktop message @@ -58,14 +58,14 @@ - - - + + + connected - + card diff --git a/plugins/wlanconnect/translations/bo_CN.qm b/plugins/wlanconnect/translations/bo_CN.qm deleted file mode 100644 index 8f72b8c9..00000000 Binary files a/plugins/wlanconnect/translations/bo_CN.qm and /dev/null differ diff --git a/plugins/wlanconnect/translations/bo_CN.ts b/plugins/wlanconnect/translations/bo_CN.ts index 7be28fd3..876b3054 100644 --- a/plugins/wlanconnect/translations/bo_CN.ts +++ b/plugins/wlanconnect/translations/bo_CN.ts @@ -43,14 +43,22 @@ /wlanconnect/Advanced settings" - ukui control center - ཝུའུ་ཁི་ལན་གྱི་ཚོད་འཛིན་ལྟེ་གནས། + ཝུའུ་ཁི་ལན་གྱི་ཚོད་འཛིན་ལྟེ་གནས། + + + ukui control center desktop message + ངོས་ལེབ་ངོས་ཀྱི་བརྡ་ཐོ་ཚོད་འཛིན་བྱ་དགོས། + + + + Settings + བཀོད་སྒྲིག་བཅས་བྱ་དགོས། - ukui control center desktop message - ངོས་ལེབ་ངོས་ཀྱི་བརྡ་ཐོ་ཚོད་འཛིན་བྱ་དགོས། + Settings desktop message + བཀོད་སྒྲིག་བཅས་བྱ་དགོས། ཅོག་ངོས་ལ་བརྡ་ཐོ་གཏོང་དགོས། @@ -58,14 +66,14 @@ སྐུད་མེད་དྲ་རྒྱའི་བྱང་བུ་མ་རྙེད་པ། - - - + + + connected འབྲེལ་མཐུད་བྱེད་པ། - + card བྱང་བུ། diff --git a/plugins/wlanconnect/translations/en_US.ts b/plugins/wlanconnect/translations/en_US.ts index 01b3915e..0433849d 100644 --- a/plugins/wlanconnect/translations/en_US.ts +++ b/plugins/wlanconnect/translations/en_US.ts @@ -43,14 +43,22 @@ /wlanconnect/Advanced settings" - ukui control center - ukui control center + ukui control center + + + ukui control center desktop message + ukui control center desktop message + + + + Settings + - ukui control center desktop message - ukui control center desktop message + Settings desktop message + @@ -58,14 +66,14 @@ No wireless network card detected - - - + + + connected connected - + card card diff --git a/plugins/wlanconnect/translations/mn.ts b/plugins/wlanconnect/translations/mn.ts new file mode 100644 index 00000000..986ac6c9 --- /dev/null +++ b/plugins/wlanconnect/translations/mn.ts @@ -0,0 +1,81 @@ + + + + + AddNetBtn + + + Add Others + ᠪᠤᠰᠤᠳ ᠲᠤᠤᠷ ᠰᠦᠯᠵᠢᠶᠡᠨ ᠳ᠋ᠤ᠌ ᠵᠠᠯᠭᠠᠬᠤ + + + + Add WiredNetork + ᠤᠲᠠᠰᠤᠲᠤ ᠨᠧᠲ ᠨᠡᠮᠡᠬᠦ + + + + WlanConnect + + + WlanConnect + ᠤᠳᠠᠰᠤ ᠦᠬᠡᠢ ᠬᠡᠰᠡᠭ ᠰᠦᠯᠵᠢᠶ᠎ᠡ + + + + + + WLAN + ᠤᠳᠠᠰᠤ ᠦᠬᠡᠢ ᠬᠡᠰᠡᠭ ᠰᠦᠯᠵᠢᠶ᠎ᠡ + + + + + open + ᠨᠡᠭᠡᠭᠡᠬᠦ + /wlanconnect/open + + + + + Advanced settings + ᠦᠨᠳᠦᠷ ᠵᠡᠷᠬᠡ ᠵᠢᠨ ᠳᠤᠬᠢᠷᠠᠭᠤᠯᠤᠯᠳᠠ + /wlanconnect/Advanced settings" + + + ukui control center + ᠡᠵᠡᠮᠰᠢᠯ ᠤ᠋ᠨ ᠬᠠᠪᠳᠠᠰᠤ + + + ukui control center desktop message + ᠡᠵᠡᠮᠰᠢᠯ ᠤ᠋ᠨ ᠬᠠᠪᠳᠠᠰᠤᠨ ᠤ᠋ ᠰᠢᠷᠡᠭᠡᠨ ᠨᠢᠭᠤᠷ ᠤ᠋ᠨ ᠮᠡᠳᠡᠭᠳᠡᠯ + + + + Settings + ᠳᠤᠬᠢᠷᠠᠭᠤᠯᠭ᠎ᠠ + + + + Settings desktop message + ᠰᠢᠷᠡᠭᠡᠨ ᠨᠢᠭᠤᠷ᠎ᠤ᠋ᠨ ᠵᠠᠩᠭᠢ᠎ᠶ᠋ᠢ ᠵᠣᠬᠢᠷᠠᠭᠤᠯᠬᠤ + + + + No wireless network card detected + ᠤᠳᠠᠰᠤ ᠦᠬᠡᠢ ᠨᠧᠲ ᠺᠠᠷᠲ᠎ᠢ ᠬᠢᠨᠠᠨ ᠬᠡᠮᠵᠢᠵᠤ ᠤᠯᠤᠭᠰᠠᠨ ᠦᠬᠡᠢ + + + + + + connected + ᠨᠢᠬᠡᠨᠳᠡ ᠴᠦᠷᠬᠡᠯᠡᠪᠡ + + + + card + ᠨᠧᠲ ᠺᠠᠷᠲ + + + diff --git a/plugins/wlanconnect/translations/tr.qm b/plugins/wlanconnect/translations/tr.qm deleted file mode 100644 index be651eed..00000000 --- a/plugins/wlanconnect/translations/tr.qm +++ /dev/null @@ -1 +0,0 @@ - - ukui control center + Settings - ukui control center desktop message + Settings desktop message @@ -58,14 +58,14 @@ - - - + + + connected - + card diff --git a/plugins/wlanconnect/translations/zh_CN.qm b/plugins/wlanconnect/translations/zh_CN.qm deleted file mode 100644 index 79c65849..00000000 Binary files a/plugins/wlanconnect/translations/zh_CN.qm and /dev/null differ diff --git a/plugins/wlanconnect/translations/zh_CN.ts b/plugins/wlanconnect/translations/zh_CN.ts index 52d7a5cc..c1f0a350 100644 --- a/plugins/wlanconnect/translations/zh_CN.ts +++ b/plugins/wlanconnect/translations/zh_CN.ts @@ -43,14 +43,22 @@ /wlanconnect/Advanced settings" - ukui control center - 控制面板 + 控制面板 + + + ukui control center desktop message + 控制面板桌面通知 + + + + Settings + 设置 - ukui control center desktop message - 控制面板桌面通知 + Settings desktop message + 设置 桌面通知 @@ -58,14 +66,14 @@ 未检测到无线网卡 - - - + + + connected 已连接 - + card 网卡 diff --git a/plugins/wlanconnect/wlanconnect.cpp b/plugins/wlanconnect/wlanconnect.cpp index 1fc9cd15..5d51bdca 100644 --- a/plugins/wlanconnect/wlanconnect.cpp +++ b/plugins/wlanconnect/wlanconnect.cpp @@ -124,10 +124,10 @@ void WlanConnect::showDesktopNotify(const QString &message) "org.freedesktop.Notifications", QDBusConnection::sessionBus()); QList args; - args<<(tr("ukui control center")) + args<<(tr("Settings")) <<((unsigned int) 0) <isValid()) { m_interface->call(QStringLiteral("setWirelessSwitchEnable"), !getSwitchBtnState()); } @@ -276,7 +277,7 @@ void WlanConnect::initComponent() { //删除无线网络 connect(m_interface, SIGNAL(wlanRemove(QString, QString)), this, SLOT(onNetworkRemove(QString, QString)), Qt::QueuedConnection); //网卡插拔处理 - connect(m_interface, SIGNAL(deviceStatusChanged()), this, SLOT(onDeviceStatusChanged()), Qt::QueuedConnection); + connect(m_interface, SIGNAL(wirelessDeviceStatusChanged()), this, SLOT(onDeviceStatusChanged()), Qt::QueuedConnection); //信号更新处理 改为每过固定时间 主动获取 // connect(m_interface, SIGNAL(signalStrengthChange(QString, QString, int)), this, SLOT(updateStrengthList(QString, QString, int))); //网卡name处理 @@ -286,6 +287,7 @@ void WlanConnect::initComponent() { //高级设置 connect(ui->detailBtn, &QPushButton::clicked, this, [=](bool checked) { Q_UNUSED(checked) + UkccCommon::buriedSettings(QString("wlanconnect"), QString("Advanced settings"), QString("clicked")); runExternalApp(); }); @@ -606,23 +608,33 @@ void WlanConnect::onActiveConnectionChanged(QString deviceName, QString ssid, QS if (!deviceFrameMap.contains(deviceName)) { return; } - for (int i = 0; i < deviceFrameMap[deviceName]->itemMap.size(); ++i) { - if (deviceFrameMap[deviceName]->itemMap.contains(ssid)) { - item = deviceFrameMap[deviceName]->itemMap[ssid]; - if (status == ACTIVATED || status == ACTIVATING) { - deviceFrameMap[deviceName]->itemMap[ssid]->uuid = uuid; - deviceFrameMap[deviceName]->uuid = uuid; - if (status == ACTIVATED) { - deviceFrameMap[deviceName]->lanItemLayout->removeWidget(item); - deviceFrameMap[deviceName]->lanItemLayout->insertWidget(0,item); - deviceFrameMap[deviceName]->filletStyleChange(); - } - } else if (status == DEACTIVATED) { - deviceFrameMap[deviceName]->itemMap[ssid]->uuid.clear(); - deviceFrameMap[deviceName]->uuid.clear(); - //todo 断开后排序 现在等下次更新列表 自动排序 + if (deviceFrameMap[deviceName]->itemMap.contains(ssid)) { + item = deviceFrameMap[deviceName]->itemMap[ssid]; + if (status == ACTIVATED || status == ACTIVATING) { + deviceFrameMap[deviceName]->itemMap[ssid]->uuid = uuid; + deviceFrameMap[deviceName]->uuid = uuid; + if (status == ACTIVATED) { + deviceFrameMap[deviceName]->lanItemLayout->removeWidget(item); + deviceFrameMap[deviceName]->lanItemLayout->insertWidget(0,item); + deviceFrameMap[deviceName]->filletStyleChange(); + } + } else if (status == DEACTIVATED) { + deviceFrameMap[deviceName]->itemMap[ssid]->uuid.clear(); + deviceFrameMap[deviceName]->uuid.clear(); + //todo 断开后排序 现在等下次更新列表 自动排序 + } + } else { + if (uuid == deviceFrameMap[deviceName]->uuid) { + QMap::iterator itemIter; + for (itemIter = deviceFrameMap[deviceName]->itemMap.begin(); itemIter != deviceFrameMap[deviceName]->itemMap.end(); itemIter++) { + if (itemIter.value()->uuid == uuid ) { + item = itemIter.value(); + if (status == DEACTIVATED) { + itemIter.value()->uuid.clear(); + } + break; + } } - break; } } } @@ -703,7 +715,14 @@ void WlanConnect::getDeviceList(QStringList &list) auto dbusArg = result.arguments().at(0).value(); QMap map; dbusArg >> map; - list = map.keys(); + + //筛选已托管(managed)网卡 + QMap::iterator iters; + for (iters = map.begin(); iters != map.end(); ++iters) { + if (iters.value() == true) { + list << iters.key(); + } + } } void WlanConnect::initSwtichState() @@ -976,6 +995,7 @@ void WlanConnect::addDeviceFrame(QString devName) deviceFrameMap.insert(devName, itemFrame); connect(itemFrame->addWlanWidget, &AddNetBtn::clicked, this, [=](){ + UkccCommon::buriedSettings(QString("wlanconnect"), QString("Add wlan"), QString("clicked")); if (m_interface != nullptr && m_interface->isValid()) { qDebug() << "[NetConnect]call showAddOtherWlanWidget" << devName << __LINE__; m_interface->call(QStringLiteral("showAddOtherWlanWidget"), devName); @@ -996,7 +1016,7 @@ void WlanConnect::removeDeviceFrame(QString devName) while ((layoutItem = item->lanItemFrame->layout()->takeAt(0)) != NULL) { delete layoutItem->widget(); delete layoutItem; - item = nullptr; + layoutItem = nullptr; } item->itemMap.clear(); } @@ -1047,6 +1067,7 @@ void WlanConnect::addOneWlanFrame(ItemFrame *frame, QString deviceName, QString if (m_interface == nullptr || !m_interface->isValid()) { return; } + UkccCommon::buriedSettings(QString("wlanconnect"), QString("info"), QString("clicked")); qDebug() << "[WlanConnect]call showPropertyWidget" << __LINE__; m_interface->call(QStringLiteral("showPropertyWidget"), deviceName, name); qDebug() << "[WlanConnect]call showPropertyWidget respond" << __LINE__; diff --git a/plugins/wlanconnect/wlanconnect.h b/plugins/wlanconnect/wlanconnect.h index 16d63f6e..10088b38 100644 --- a/plugins/wlanconnect/wlanconnect.h +++ b/plugins/wlanconnect/wlanconnect.h @@ -47,8 +47,10 @@ #include "wlanitem.h" #include "kwidget.h" #include "kswitchbutton.h" +#include "ukcccommon.h" using namespace kdk; +using namespace ukcc; namespace Ui { class WlanConnect; @@ -148,8 +150,8 @@ private: return m_wifiSwitch->isChecked(); } } - bool LaunchApp(QString desktopFile); + protected: bool eventFilter(QObject *w,QEvent *e); diff --git a/plugins/wlanconnect/wlanconnect.pro b/plugins/wlanconnect/wlanconnect.pro index d558656a..143f708a 100644 --- a/plugins/wlanconnect/wlanconnect.pro +++ b/plugins/wlanconnect/wlanconnect.pro @@ -7,6 +7,11 @@ include(../component/addbtn.pri) TARGET = $$qtLibraryTarget(wlanconnect) DESTDIR = ../.. + +CONFIG(release, debug|release) { + !system($$PWD/translate_generation.sh): error("Failed to generate translation") +} + target.path = $$[QT_INSTALL_LIBS]/ukui-control-center trans.files = translations/* trans.path = /usr/share/kylin-nm/wlanconnect/ @@ -52,4 +57,5 @@ TRANSLATIONS += \ translations/tr.ts \ translations/bo.ts \ translations/bo_CN.ts \ - translations/en_US.ts + translations/en_US.ts \ + translations/mn.ts diff --git a/plugins/wlanconnect/wlanitem.cpp b/plugins/wlanconnect/wlanitem.cpp index 7b98d725..9697f59e 100644 --- a/plugins/wlanconnect/wlanitem.cpp +++ b/plugins/wlanconnect/wlanitem.cpp @@ -92,13 +92,12 @@ void WlanItem::stopLoading(){ void WlanItem::paintEvent(QPaintEvent *event) { - QPalette pal = qApp->palette(); - QPainter painter(this); painter.setRenderHint(QPainter:: Antialiasing, true); //设置渲染,启动反锯齿 painter.setPen(Qt::NoPen); painter.setBrush(this->palette().base().color()); + QPalette pal = qApp->palette(); QColor color = pal.color(QPalette::Button); color.setAlphaF(0.5); pal.setColor(QPalette::Button, color); diff --git a/src-vpn/frontend/list-items/listitem.cpp b/src-vpn/frontend/list-items/listitem.cpp index 2f276e45..32f05963 100644 --- a/src-vpn/frontend/list-items/listitem.cpp +++ b/src-vpn/frontend/list-items/listitem.cpp @@ -19,6 +19,7 @@ */ #include "listitem.h" #include +#include "themepalette.h" #define MAIN_LAYOUT_MARGINS 0,0,0,0 #define MAIN_LAYOUT_SPACING 0 @@ -28,8 +29,9 @@ #define FRAME_WIDTH 404 #define INFO_ICON_WIDTH 16 #define INFO_ICON_HEIGHT 16 -#define LIGHT_HOVER_COLOR QColor(240,240,240,255) -#define DARK_HOVER_COLOR QColor(15,15,15,255) + +#define THEME_SCHAME "org.ukui.style" +#define COLOR_THEME "styleName" ListItem::ListItem(QWidget *parent) : QFrame(parent) { @@ -39,6 +41,7 @@ ListItem::ListItem(QWidget *parent) : QFrame(parent) initConnection(); connect(qApp, &QApplication::paletteChanged, this, &ListItem::onPaletteChanged); // m_itemFrame->installEventFilter(this); + onPaletteChanged(); } ListItem::~ListItem() @@ -144,8 +147,22 @@ void ListItem::initConnection() void ListItem::onPaletteChanged() { -// QPalette pal = qApp->palette(); -// pal.setColor(QPalette::Window, qApp->palette().base().color()); -// this->setPalette(pal); + QPalette pal = qApp->palette(); + QGSettings * styleGsettings = nullptr; + const QByteArray style_id(THEME_SCHAME); + if (QGSettings::isSchemaInstalled(style_id)) { + styleGsettings = new QGSettings(style_id, QByteArray(), this); + QString currentTheme = styleGsettings->get(COLOR_THEME).toString(); + if(currentTheme == "ukui-default"){ + pal = themePalette(true, this); + } + } + this->setPalette(pal); + + if (m_menu != nullptr) { + pal.setColor(QPalette::Base, pal.color(QPalette::Base)); + pal.setColor(QPalette::Text, pal.color(QPalette::Text)); + m_menu->setPalette(pal); + } } diff --git a/src-vpn/frontend/list-items/listitem.h b/src-vpn/frontend/list-items/listitem.h index f9e62a1c..054767c8 100644 --- a/src-vpn/frontend/list-items/listitem.h +++ b/src-vpn/frontend/list-items/listitem.h @@ -74,10 +74,10 @@ public: private: void initUI(); void initConnection(); + void onPaletteChanged(); public Q_SLOTS: virtual void onNetButtonClicked() = 0; - void onPaletteChanged(); virtual void onMenuTriggered(QAction *action)=0; Q_SIGNALS: diff --git a/src-vpn/frontend/list-items/vpnlistitem.cpp b/src-vpn/frontend/list-items/vpnlistitem.cpp index e499a25f..ce02cd1d 100644 --- a/src-vpn/frontend/list-items/vpnlistitem.cpp +++ b/src-vpn/frontend/list-items/vpnlistitem.cpp @@ -191,11 +191,16 @@ void VpnListItem::runExternalApp() { void VpnListItem::onInfoButtonClicked() { +#ifdef VPNDETAIL if (m_vpnConnectItem.m_itemType != NetworkManager::ConnectionSettings::ConnectionType::Vpn) { +#else + if (true) { +#endif runExternalApp(); return; } +#ifdef VPNDETAIL if(m_vpnDetail != nullptr){ m_vpnDetail->activateWindow(); return; @@ -209,6 +214,7 @@ void VpnListItem::onInfoButtonClicked() m_vpnDetail->show(); m_vpnDetail->centerToScreen(); +#endif } void VpnListItem::updateConnectionState(ConnectState state) diff --git a/src-vpn/frontend/single-pages/singlepage.cpp b/src-vpn/frontend/single-pages/singlepage.cpp index b17b6658..43a29603 100644 --- a/src-vpn/frontend/single-pages/singlepage.cpp +++ b/src-vpn/frontend/single-pages/singlepage.cpp @@ -26,11 +26,16 @@ #include #include +#define THEME_SCHAME "org.ukui.style" +#define COLOR_THEME "styleName" + SinglePage::SinglePage(QWidget *parent) : QWidget(parent) { + setThemePalette(); initUI(); initWindowProperties(); initTransparency(); + initWindowTheme(); } SinglePage::~SinglePage() @@ -53,7 +58,7 @@ void SinglePage::initUI() m_titleLayout->addWidget(m_titleLabel); m_titleLayout->addStretch(); - m_netDivider = new Divider(this); + m_netDivider = new Divider(true, this); m_listFrame = new QFrame(this); m_listLayout = new QVBoxLayout(m_listFrame); @@ -61,8 +66,9 @@ void SinglePage::initUI() m_listFrame->setLayout(m_listLayout); m_listWidget = new QListWidget(m_listFrame); m_listLayout->addWidget(m_listWidget); + m_listWidget->setProperty("needTranslucent", true); - m_setDivider = new Divider(this); + m_setDivider = new Divider(true, this); m_settingsFrame = new QFrame(this); m_settingsFrame->setFixedHeight(TITLE_FRAME_HEIGHT); @@ -104,6 +110,20 @@ void SinglePage::initWindowProperties() } } +/** + * @brief SinglePage::initWindowTheme 初始化窗口主题并创建信号槽 + */ +void SinglePage::initWindowTheme() +{ + const QByteArray style_id(THEME_SCHAME); + if (QGSettings::isSchemaInstalled(style_id)) { + m_styleGsettings = new QGSettings(style_id, QByteArray(), this); + connect(m_styleGsettings, &QGSettings::changed, this, &SinglePage::onThemeChanged); + } else { + qWarning() << "Gsettings interface \"org.ukui.style\" is not exist!" << Q_FUNC_INFO << __LINE__; + } +} + void SinglePage::showDesktopNotify(const QString &message, QString soundName) { QDBusInterface iface("org.freedesktop.Notifications", @@ -111,8 +131,8 @@ void SinglePage::showDesktopNotify(const QString &message, QString soundName) "org.freedesktop.Notifications", QDBusConnection::sessionBus()); QStringList actions; //跳转动作 - actions.append("kylin-vpn"); - actions.append("default"); //默认动作:点击消息体时打开麒麟录音 + actions.append("default"); + actions.append("kylin-vpn"); //默认动作:点击消息体时打开麒麟录音 QMap hints; if (!soundName.isEmpty()) { hints.insert("sound-name",soundName); //添加声音 @@ -134,7 +154,7 @@ void SinglePage::paintEvent(QPaintEvent *event) { QPainter painter(this); painter.setRenderHint(QPainter::Antialiasing); painter.setPen(Qt::transparent); - QColor col = qApp->palette().window().color(); + QColor col = this->palette().window().color(); QPainterPath rectPath; @@ -165,10 +185,37 @@ void SinglePage::onTransChanged() paintWithTrans(); } +void SinglePage::onThemeChanged(const QString &key) +{ + if (key == COLOR_THEME) { + setThemePalette(); + paintWithTrans(); + Q_EMIT qApp->paletteChanged(qApp->palette()); + } else if ("themeColor" == key) { + setThemePalette(); + } +} + +void SinglePage::setThemePalette() +{ + QPalette pal = qApp->palette(); + QGSettings * styleGsettings = nullptr; + const QByteArray style_id(THEME_SCHAME); + if (QGSettings::isSchemaInstalled(style_id)) { + styleGsettings = new QGSettings(style_id, QByteArray(), this); + QString currentTheme = styleGsettings->get(COLOR_THEME).toString(); + if(currentTheme == "ukui-default"){ + pal = themePalette(true, this); + } + } + pal.setColor(QPalette::Background, pal.base().color()); + this->setPalette(pal); +} + void SinglePage::paintWithTrans() { QPalette pal = this->palette(); - QColor color = qApp->palette().base().color(); + QColor color = this->palette().base().color(); color.setAlphaF(m_transparency); pal.setColor(QPalette::Window, color); this->setPalette(pal); @@ -181,5 +228,3 @@ void SinglePage::keyPressEvent(QKeyEvent *event) } return QWidget::keyPressEvent(event); } - - diff --git a/src-vpn/frontend/single-pages/singlepage.h b/src-vpn/frontend/single-pages/singlepage.h index 864e5930..7e722866 100644 --- a/src-vpn/frontend/single-pages/singlepage.h +++ b/src-vpn/frontend/single-pages/singlepage.h @@ -41,9 +41,9 @@ using namespace kdk; #define MAIN_LAYOUT_MARGINS 0,0,0,0 #define MAIN_LAYOUT_SPACING 0 -#define TITLE_FRAME_HEIGHT 60 //TabWidget的tab和widget有间隙,和设计稿看起来一致就不能设为设计稿里的高度 +#define TITLE_FRAME_HEIGHT 50 #define TITLE_LAYOUT_MARGINS 24,0,24,0 -#define NET_LAYOUT_MARGINS 8,8,0,8 +#define NET_LAYOUT_MARGINS 8,4,0,4 #define TEXT_HEIGHT 20 #define SETTINGS_LAYOUT_MARGINS 23,0,24,0 @@ -71,6 +71,8 @@ Q_SIGNALS: private Q_SLOTS: void onTransChanged(); + void onThemeChanged(const QString &key); + void setThemePalette(); protected: void paintEvent(QPaintEvent *event); @@ -84,6 +86,7 @@ protected: private: void initWindowProperties(); + void initWindowTheme(); protected: QVBoxLayout * m_mainLayout = nullptr; @@ -106,6 +109,8 @@ protected: QGSettings * m_transGsettings = nullptr; double m_transparency = 1.0; //透明度 + //监听主题的Gsettings + QGSettings * m_styleGsettings = nullptr; }; diff --git a/src-vpn/frontend/single-pages/vpnpage.cpp b/src-vpn/frontend/single-pages/vpnpage.cpp index 7bd2a0ec..9d2053f7 100644 --- a/src-vpn/frontend/single-pages/vpnpage.cpp +++ b/src-vpn/frontend/single-pages/vpnpage.cpp @@ -638,8 +638,7 @@ void VpnPage::showUI() void VpnPage::resetWindowPosition() { - -#define MARGIN 4 +#define MARGIN 8 #define PANEL_TOP 1 #define PANEL_LEFT 2 #define PANEL_RIGHT 3 diff --git a/src-vpn/frontend/single-pages/vpnpage.h b/src-vpn/frontend/single-pages/vpnpage.h index dd984d95..cc0f3757 100644 --- a/src-vpn/frontend/single-pages/vpnpage.h +++ b/src-vpn/frontend/single-pages/vpnpage.h @@ -38,7 +38,7 @@ #define VPNPAGE_LAYOUT_MARGINS 0,0,0,0 #define VPN_LIST_SPACING 0 #define ITEM_HEIGHT 50 -#define ITEM_SPACE 16 +#define ITEM_SPACE 8 #define PAGE_SPACE 22 #define LOG_FLAG "[VpnPage]" diff --git a/src-vpn/frontend/vpndetails/vpnaddpage.h b/src-vpn/frontend/vpndetails/vpnaddpage.h index bed46841..1ae1785f 100644 --- a/src-vpn/frontend/vpndetails/vpnaddpage.h +++ b/src-vpn/frontend/vpndetails/vpnaddpage.h @@ -36,6 +36,30 @@ #include "kyvpnconnectoperation.h" +#define VPNADDPAGE_MAINLAYOUT_MARGINS 0, 12, 0, 12 +#define VPNADDPAGE_ITEM_MARGINS 24, 0, 24, 0 +#define VPNADDPAGE_NULLMAGINS 0, 0, 0, 0 + +#define VPNADDPAGE_SIZE 520,312 +#define VPNADDPAGE_FRAME_FIXEDSIZE 520, 60 +#define VPNADDPAGE_BUTTON_FIXEDSIZE 96, 36 + +#define VPNADDPAGE_NULLSPACE 0 +#define VPNADDPAGE_BUTTON_SPACE 16 +#define VPNADDPAGE_NAME_MAX_LENGTH 32 +#define VPNADDPAGE_LABLE_FIXEDWIDTH 112 +#define VPNADDPAGE_COMBOBOX_FIXEDWIDTH 360 +#define VPNADDPAGE_INPUTBOX_FIXEDWIDTH 360 + +#define VPNDETAILPAGE_ITEM_MARGINS 24, 0, 24, 0 +#define VPNDETAILPAGE_NULLMAGINS 0, 0, 0, 0 + +#define VPNDETAILPAGE_FRAME_FIXEDSIZE 520, 60 +#define VPNDETAILPAGE_BUTTON_FIXEDSIZE 96, 36 + +#define VPNDETAILPAGE_NULLSPACE 0 +#define VPNDETAILPAGE_BUTTON_SPACE 16 + class vpnAddPage : public QWidget { Q_OBJECT diff --git a/src-vpn/frontend/vpndetails/vpndetail.cpp b/src-vpn/frontend/vpndetails/vpndetail.cpp index 9be9fb42..cda56da2 100644 --- a/src-vpn/frontend/vpndetails/vpndetail.cpp +++ b/src-vpn/frontend/vpndetails/vpndetail.cpp @@ -102,7 +102,7 @@ void VpnDetail::initUI() m_topWidget = new QWidget(this); m_centerWidget = new QWidget(this); m_bottomWidget = new QWidget(this); - m_divider = new Divider(this); + m_divider = new Divider(false, this); m_vpnTabBar = new VpnTabBar(this); m_autoConnectBox = new QCheckBox(this); m_autoConnectLabel = new QLabel(this); diff --git a/src-vpn/frontend/vpndetails/vpnipv4page.cpp b/src-vpn/frontend/vpndetails/vpnipv4page.cpp index 8206ba46..f036819d 100644 --- a/src-vpn/frontend/vpndetails/vpnipv4page.cpp +++ b/src-vpn/frontend/vpndetails/vpnipv4page.cpp @@ -109,7 +109,6 @@ void VpnIpv4Page::updateVpnIpv4Info(KyVpnConfig &vpnInfo) QString netMask(""); QString gateWay(""); vpnInfo.setIpConfigType(IPADDRESS_V4, CONFIG_IP_DHCP); - vpnInfo.ipv4AddressConstruct(ipv4address, netMask, gateWay); qDebug() << LOG_FLAG << "IPv4 method" << vpnInfo.m_ipv4ConfigIpType; qDebug() << LOG_FLAG << "Update IPv4 info finished"; } else { @@ -118,7 +117,6 @@ void VpnIpv4Page::updateVpnIpv4Info(KyVpnConfig &vpnInfo) QString gateWay = m_gateWayEdit->text(); qDebug() << ipv4address << netMask << gateWay; vpnInfo.setIpConfigType(IPADDRESS_V4, CONFIG_IP_MANUAL); - vpnInfo.ipv4AddressConstruct(ipv4address, netMask, gateWay); vpnInfo.dumpInfo(); qDebug() << LOG_FLAG << "Update IPv4 info finished"; } @@ -128,7 +126,6 @@ void VpnIpv4Page::updateVpnIpv4Info(KyVpnConfig &vpnInfo) if (!m_dnsServerEdit->text().isEmpty()) { ipv4DnsList.append(QHostAddress(m_dnsServerEdit->text())); } - vpnInfo.ipv4DnsConstruct(ipv4DnsList); vpnInfo.m_ipv4DnsSearch.clear(); vpnInfo.m_ipv4DnsSearch.append(m_searchDomainEdit->text()); diff --git a/src-vpn/frontend/vpndetails/vpnipv6page.cpp b/src-vpn/frontend/vpndetails/vpnipv6page.cpp index fa3d1438..2cdf5ce8 100644 --- a/src-vpn/frontend/vpndetails/vpnipv6page.cpp +++ b/src-vpn/frontend/vpndetails/vpnipv6page.cpp @@ -102,7 +102,6 @@ void VpnIpv6Page::updateVpnIpv6Info(KyVpnConfig &vpnInfo) QString netMask(""); QString gateWay(""); vpnInfo.setIpConfigType(IPADDRESS_V6, CONFIG_IP_DHCP); - vpnInfo.ipv6AddressConstruct(ipv6address, netMask, gateWay); qDebug() << LOG_FLAG << "IPv6 method" << vpnInfo.m_ipv6ConfigIpType; qDebug() << LOG_FLAG << "Update IPv6 info finished"; } else { @@ -111,7 +110,6 @@ void VpnIpv6Page::updateVpnIpv6Info(KyVpnConfig &vpnInfo) QString gateWay = m_gateWayEdit->text(); qDebug() << ipv6address << netMask << gateWay; vpnInfo.setIpConfigType(IPADDRESS_V6, CONFIG_IP_MANUAL); - vpnInfo.ipv6AddressConstruct(ipv6address, netMask, gateWay); vpnInfo.dumpInfo(); qDebug() << LOG_FLAG << "Update IPv6 info finished"; } @@ -121,7 +119,6 @@ void VpnIpv6Page::updateVpnIpv6Info(KyVpnConfig &vpnInfo) if (!m_dnsServerEdit->text().isEmpty()) { ipv6DnsList.append(QHostAddress(m_dnsServerEdit->text())); } - vpnInfo.ipv6DnsConstruct(ipv6DnsList); vpnInfo.m_ipv6DnsSearch.clear(); vpnInfo.m_ipv6DnsSearch.append(m_searchDomainEdit->text()); diff --git a/src-vpn/frontend/vpndetails/vpnipv6page.h b/src-vpn/frontend/vpndetails/vpnipv6page.h index 58808eae..0b1b0dde 100644 --- a/src-vpn/frontend/vpndetails/vpnipv6page.h +++ b/src-vpn/frontend/vpndetails/vpnipv6page.h @@ -17,7 +17,8 @@ * * */ - #ifndef VPNIPV6PAGE_H + +#ifndef VPNIPV6PAGE_H #define VPNIPV6PAGE_H #include diff --git a/src-vpn/frontend/vpnobject.cpp b/src-vpn/frontend/vpnobject.cpp index 1a7aa904..edcc12d3 100644 --- a/src-vpn/frontend/vpnobject.cpp +++ b/src-vpn/frontend/vpnobject.cpp @@ -146,8 +146,33 @@ void vpnObject::onTabletModeChanged(bool mode) m_vpnPage->hide(); } +bool vpnObject::launchApp(QString desktopFile) +{ + QDBusInterface appManagerDbusInterface(KYLIN_APP_MANAGER_NAME, + KYLIN_APP_MANAGER_PATH, + KYLIN_APP_MANAGER_INTERFACE, + QDBusConnection::sessionBus()); + + if (!appManagerDbusInterface.isValid()) { + qWarning()<<"appManagerDbusInterface init error"; + return false; + } else { + QDBusReply reply = appManagerDbusInterface.call("LaunchApp", desktopFile); + return reply; + } +} + +void vpnObject::runExternalApp() { + if (!launchApp("nm-connection-editor.desktop")){ + QString cmd = "nm-connection-editor"; + QProcess process(this); + process.startDetached(cmd); + } +} + void vpnObject::showVpnAddWidget() { +#ifdef VPNDETAIL if (m_vpnAddPage == nullptr) { m_vpnAddPage = new vpnAddPage(); connect(m_vpnAddPage, &vpnAddPage::closed, [&] () {m_vpnAddPage = nullptr;}); @@ -155,4 +180,8 @@ void vpnObject::showVpnAddWidget() m_vpnAddPage->centerToScreen(); } m_vpnAddPage->raise(); +#else + runExternalApp(); + return; +#endif } diff --git a/src-vpn/frontend/vpnobject.h b/src-vpn/frontend/vpnobject.h index 44a8c082..85081868 100644 --- a/src-vpn/frontend/vpnobject.h +++ b/src-vpn/frontend/vpnobject.h @@ -59,6 +59,8 @@ private: void initVpnIconVisible(); void initDbusConnnect(); + bool launchApp(QString desktopFile); + void runExternalApp(); private: VpnPage *m_vpnPage = nullptr; diff --git a/src-vpn/main.cpp b/src-vpn/main.cpp index 99fb9b59..7d7b6df2 100644 --- a/src-vpn/main.cpp +++ b/src-vpn/main.cpp @@ -93,17 +93,31 @@ int main(int argc, char *argv[]) QApplication::setQuitOnLastWindowClosed(false); - QThread thread; + QDBusInterface interface("com.kylin.kylinvpn", + "/com/kylin/kylinvpn", + "com.kylin.kylinvpn", + QDBusConnection::sessionBus()); + if(interface.isValid()) { + return 0; + } + + QThread *thread = new QThread(); KyNetworkResourceManager *p_networkResource = KyNetworkResourceManager::getInstance(); - p_networkResource->moveToThread(&thread); - QObject::connect(&thread, SIGNAL(started()), p_networkResource, SLOT(onInitNetwork())); - thread.start(); + p_networkResource->moveToThread(thread); + QObject::connect(thread, &QThread::started, p_networkResource, &KyNetworkResourceManager::onInitNetwork); + QObject::connect(&a,&QtSingleApplication::aboutToQuit, thread, &QThread::quit); + QObject::connect(thread, &QThread::finished, thread, &QThread::deleteLater); + QObject::connect(thread, &QThread::finished, [=](){ + qDebug() << "release" ; + p_networkResource->Release(); + }); + thread->start(); // Internationalization QString locale = QLocale::system().name(); QTranslator trans_global; qDebug() << "QLocale " << QLocale(); - if (trans_global.load(QLocale(), "kylin-vpn", "_", ":/translations/")) + if (trans_global.load(QLocale(), "kylin-vpn", "_", "/usr/share/kylin-nm/kylin-vpn/")) { a.installTranslator(&trans_global); qDebug()<<"Translations load success"; diff --git a/src-vpn/src-vpn.pro b/src-vpn/src-vpn.pro index d09627fd..312c4984 100644 --- a/src-vpn/src-vpn.pro +++ b/src-vpn/src-vpn.pro @@ -28,10 +28,13 @@ desktop.path = /etc/xdg/autostart/ desktop.files = kylin-vpn.desktop gschema.files = org.ukui.kylin-vpn.switch.gschema.xml gschema.path = /usr/share/glib-2.0/schemas/ +qm_files.path = $${PREFIX}/share/kylin-nm/kylin-vpn/ +qm_files.files = translations/*.qm INSTALLS += target \ desktop \ gschema \ + qm_files \ # The following define makes your compiler emit warnings if you use # any feature of Qt which has been marked as deprecated (the exact warnings @@ -54,9 +57,6 @@ include(singleapplication/qt-single-application.pri) include(backend/backend.pri) include(frontend/frontend.pri) -RESOURCES += \ - vpnqrc.qrc - SOURCES += \ main.cpp @@ -71,4 +71,9 @@ DISTFILES += \ TRANSLATIONS += \ translations/kylin-vpn_zh_CN.ts \ - translations/kylin-vpn_bo_CN.ts + translations/kylin-vpn_bo_CN.ts \ + translations/kylin-vpn_mn.ts + +CONFIG(release, debug|release) { + !system($$PWD/translate_generation.sh): error("Failed to generate translation") +} diff --git a/src-vpn/translate_generation.sh b/src-vpn/translate_generation.sh new file mode 100755 index 00000000..72f748b9 --- /dev/null +++ b/src-vpn/translate_generation.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +ts_list=(`ls translations/*.ts`) +source /etc/os-release +version=(`echo $ID`) + +for ts in "${ts_list[@]}" +do + printf "\nprocess ${ts}\n" + if [ "$version" == "fedora" ] || [ "$version" == "opensuse-leap" ] || [ "$version" == "opensuse-tumbleweed" ];then + lrelease-qt5 "${ts}" + else + lrelease "${ts}" + fi +done diff --git a/src-vpn/translations/kylin-vpn_bo_CN.qm b/src-vpn/translations/kylin-vpn_bo_CN.qm deleted file mode 100644 index be651eed..00000000 --- a/src-vpn/translations/kylin-vpn_bo_CN.qm +++ /dev/null @@ -1 +0,0 @@ - - + SinglePage - + Settings - + བཀོད་སྒྲིག་བཅས་བྱ་དགོས། - + Kylin VPN - + VPNཡོ་བྱད། - + kylin vpn applet desktop message - + vpnཅོག་ངོས་ཀྱི་གསལ་འདེབས་བཀོད་སྒྲིག་བྱེད་པ། + + + + VpnAdvancedPage + + + MPPE encryption algorithm: + MPPEགསང་སྣོན་རྩིས་ཐབས།: + + + + Use Stateful encryption + རྣམ་པ་ལྡན་པའི་སྒོ་ནས་ཚགས་དམ་དུ་གཏོང་བ། + + + + Send PPP echo packets + སྐྱེལ་སྤྲོད་བྱེད་དགོས།PPPཁུག་མ་ཕྱིར་མངོན་པ། + + + + Authentication Mode: + བདེན་དཔང་ར་སྤྲོད་བྱེད་སྟངས།: + + + + PAP authentication + PAPདཔང་དངོས་བདེན་པ་ཡིན་པའི + + + + CHAP authentication + CHAPདཔང་དངོས་བདེན་པ་ཡིན་པའི + + + + MSCHAP authentication + MSCHAPདཔང་དངོས་བདེན་པ་ཡིན་པའི + + + + MSCHAP2 authentication + MSCHAP2དཔང་དངོས་བདེན་པ་ཡིན་པའི + + + + EAP authentication + EAPདཔང་དངོས་བདེན་པ་ཡིན་པའི + + + + Compression Mode: + ཉུང་འཕྲི་བྱེད་སྟངས།: + + + + Allow BSD data compression + ཆོག་པ་བྱ་དགོས།BSDཉུང་འཕྲི་བཅས་བྱ་ + + + + Allow Default data compression + ཆོག་པ་བྱ་དགོས།Defaultཉུང་འཕྲི་བཅས་བྱ་ + + + + Allow TCP header compression + ཆོག་པ་བྱ་དགོས།TCPམགོ་བོ།ཉུང་འཕྲི་བཅས་བྱ་ + + + + Use protocol field compression negotiation + གྲོས་མཐུན་གྱི་ཁྱབ་ཁོངས་སྤྱད་དེ་གྲོས་མོལ་ཉུང་འཕྲ + + + + Use Address/Control compression + ས་གནས་སྤྱོད་པ།/ཉུང་འཕྲི་ཚོད་འཛིན་ + + + + All Available + རང་སྣང་གང་དྲན་བྱེད་པ + + + + 128-bit + 128གནས་ས། + + + + 40-bit + 40གནས་ས། + + + + Use custom gateway port + རང་ཉིད་ཀྱི་མཚན་ཉིད་འཇོག་པའི་དྲ་བའི་འགག་སྒོ་བེད་སྤྱོད་བྱ་དགོས + + + + Use compression + བཀོལ་སྤྱོད་ཉུང་འཕྲི་ + + + + Use a TCP connection + བེད་སྤྱོད།TCPའབྲེལ་མཐུད་བཅས་བྱ་དགོས། + + + + Set virtual device type + རྟོག་བཟོའི་སྒྲིག་ཆས་ཀྱི་རིགས་བཟོ་བ། + + + + Set virtual device name + རྟོག་བཟོའི་སྒྲིག་ཆས་ཀྱི་མིང་བཟོ་བ། + + + + Limit TCP Maximum Segment Size(MSS) + ཚོད་འཛིན།TCPཆེས་ཆེ་བའི་རིང་ཐུང་།(MSS) + + + + Randomize remote hosts + སྐབས་བསྟུན་ཅན་གྱི་རྒྱང་ཁྲིད་འཕྲུལ་ཆས་གཙོ་བོ། + + + + IPv6 tun link + IPv6 tunའབྲེལ་མཐུད་བཅས་བྱ་དགོས། + + + + Specify ping interval + དམིགས་འཛུགས་བྱས་པ།Pingདུས་འཁོར། + + + + Specify exit or restart ping + ཕྱིར་འཐེན་ནམ་ཡང་ན་བསྐྱར་དུ་སྒོ་འབྱེད་རྒྱུའི་དམིགས་འཛུགས་བྱས་རིགས།Ping + + + + Specify max routes + དམིགས་འཛུགས་བྱེད་པའི་ལམ་དེ་གོང་ནས་ཚད་བཀག་དགོས། + + + + Infinite retry on error + ནོར་འཁྲུལ་བྱུང་དུས་ཚོད་ལྟ་ཚད་མེད་བྱེད་དགོས། + + + + Use custom key size + རང་གི་མཚན་ཉིད་ཀྱི་གསང་བའི་ལྡེ་མིག་ཆེ་ཆུང་སྤྱོད་པ། + + + + Choose + གདམ་ག་རྒྱག་པ། + + + + Use custom renegotiation interval + རང་ཉིད་ཀྱི་མཚན་ཉིད་བཞག་ནས་གྲོས་མོལ་བྱེད་པའི་བར་མཚམས་འཇོག་དགོས + + + + Use custom tunnel Maximum Transmission Umit(MTU) + རང་ཉིད་ཀྱི་མཚན་ཉིད་བཞག་པའི་ཕུག་ལམ་གྱི་ཆེས་ཆེ་བའི་ཚན་པ་བརྒྱུད་གཏོང་བྱེད་པ།(MTU) + + + + Use custom UDP fragment size + རང་ཉིད་ཀྱི་མཚན་ཉིད་སྤྱད་པ།UDPཆ་བགོས་ཆེ་ཆུང་། + + + + Accept authenticated packets from any address (Float) + ས་གནས་གང་ནས་ཡོང་བ་དང་ལེན་བྱེད་དགོས།(Float)ཐོབ་ཐང་ཚོད་ལྟསར་སྤྲོད་བྱས་ཟིན་པའི་གྲངས་གཞིའི་ཁུག་མ། + + + + Subject Match + བརྗོད་བྱ་གཙོ་བོ་ཆ་འགྲིག་པ། + + + + Key File + གསང་ལྡེའི་ཡིག་ཆ། + + + + Key Direction + གསང་ལྡེའི་ཁ་ཕྱོགས། + + + + Server Address + ཞབས་ཞུ་ཡོ་བྱད་ཀྱི་ས་གནས། + + + + Port + ཁ་བཤད་པ། + + + + Proxy USername + བེད་སྤྱོད་བྱེད་མཁན་གྱི་ཚབ་ཏུ་མིང་། + + + + Proxy Password + གསང་གྲངས་ཚབ་སྒྲུབ་བྱེད་པ། + + + + General + རྒྱུན་སྲོལ། + + + + TLS settings + TLSབཀོད་སྒྲིག་བཅས་བྱ་དགོས། + + + + Server Certificate Check + ཞབས་ཞུ་ཡོ་བྱད་དཔང་ཡིག་ལ་ཞིབ་བཤེར་བྱ་དགོས། + + + + Use the previous authentication end (server) certificate + གོང་དུ་ཚོད་ལྟས་ར་སྤྲོད་བྱ་དགོས།(ཞབས་ཞུའི་ཡོ་བྱད།)དཔང་ཡིག + + + + Verify peer (server) certificate nsCertType specification + ཚོད་ལྟས་ར་སྤྲོད་བྱེད་པ་སོགས་ཡིན།(ཞབས་ཞུའི་ཡོ་བྱད།)དཔང་ཡིགnsCertTypeདམིགས་འཛུགས་བྱས་པ། + + + + Mode + མ་དཔེ། + + + + Proxies + ངོ་ཚབ་ + + + + Proxy Type + ངོ་ཚབ་ཀྱི་རིགས་དབྱིབས། + + + + Security + བདེ་འཇགས། + + + + HMAC Authentication + HMACདཔང་དངོས་བདེན་པ་ཡིན་པའི + + + + Input content + ནང་དོན་ནང་འཇུག་བྱེད་པ། + + + + No + དེ་ལྟར་མ་བྱས་ + + + + Self-adaption + རང་གིས་རང་ལ་འཕྲོད་པར + + + + Automatic + རང་འགུལ་ཡིན་དགོས། + + + + Exit + ཕྱིར་འཐེན་བྱ་དགོས། + + + + Restart + བསྐྱར་དུ་སྒོ་འབྱེད་དགོས། + + + + Don't verify certificate identification + དཔང་ཡིག་གི་མཚོན་རྟགས་ལ་ཚོད་ལྟས་ར་སྤྲོད་མི་བྱེད། + + + + Verify the entire subject exactly + བརྗོད་བྱ་གཙོ་བོ་ཡོངས་རྫོགས་ལ་ཚོད་ལྟས་ར་སྤྲོད་གསལ་པོ་བྱས་ + + + + Verify name exactly + ཞིབ་ཅིང་དག་པའི་སྒོ་ནས་ར་སྤྲོད་བྱས་པའི་མིང་། + + + + Verify name by prefix + སྔོན་གྱི་缀ཚོད་ལྟས་ར་སྤྲོད་ཀྱི་མིང་ལྟར། + + + + + Server + ཞབས་ཞུའི་ཡོ་བྱད། + + + + + Client + ཚོང་འགྲུལ་པ་སྣེ་ལེན་བྱེད་པ། + + + + + + None + མེད། + + + + TLS-Certification + TLS-དཔང་དངོས་བདེན་པ་ཡིན་པའི + + + + TLS-Encryption + TLS-ཚགས་དམ་དུ་གཏོང་བ། + + + + Not Required + དགོས་མཁོ་མེད། + + + + Default + ཁ་རོག་གེར་ཁས་ལེན + + + + Options: + རྣམ་གྲངས་འདེམས་པ།: + + + + Request an inner IP address + ནང་ཁུལ་ལ་རེ་ཞུ་བྱེད་པ།IPས་གནས། + + + + Enforce UDP encapsulation + བཙན་ཤེད་ཀྱིས་བཙན་ཤེད་བྱེདUDPཐུམ་རྒྱག་པ། + + + + Use IP compression + བེད་སྤྱོད།IPཉུང་འཕྲི་བཅས་བྱ་ + + + + Enable custom password suggestions + རང་ཉིད་ཀྱི་མཚན་ཉིད་གསང་བའི་གྲོས་འགོ་འདོན་དགོས། + + + + Choose a private key + སྒེར་གྱི་ལྡེ་མིག་འདེམས་པ། + + + + Key Files (*.key *.pem *.der *.p12 *.pfx) + སྒེར་གྱི་ལྡེ་མིག་ཡིག་ཆ།(*.key *.pem *.der *.p12 *.pfx) + + + + VpnConfigPage + + + Type + རིགས་དབྱིབས། + + + + Name + མིང་། + + + + Static Key + ཁ་རོག་གེར་ལྡེ་མིག་ལྟ་བ + + + + Local IP + ས་གནས་དེ་ག་རེད།IPས་གནས། + + + + Remote IP + རྒྱང་རིང་།IPས་གནས། + + + + PIN Code + PINཨང་གྲངས། + + + + + + Password + གསང་བའི་ཨང་གྲངས། + + + + NT Domain + NTས་ཁོངས། + + + + Server Address + ཞབས་ཞུ་ཡོ་བྱད་ཀྱི་ས་གནས། + + + + Authentication Mode + བདེན་དཔང་ར་སྤྲོད་བྱེད་སྟངས། + + + + CA Certificate + CAདཔང་ཡིག + + + + User Certificate + སྤྱོད་མཁན།དཔང་ཡིག + + + + Key Direction + གསང་ལྡེའི་ཁ་ཕྱོགས། + + + + Private Key + སྒེར་གྱི་ལྡེ་མིག + + + + Private Key Password + སྒེར་ལ་གསང་བའི་གསང་བ་ཡོད། + + + + + Password Options + གསང་བའི་ཐོག་ནས་རྣམ་གྲངས་བདམས་པ། + + + + Username + སྤྱོད་མཁན་གྱི་མིང་། + + + + Notice: +If key direction is used, it must be opposite to the VPN side used. If '1' is used, the connection must use '0'. If you are not sure which value to use, please contact your system administrator. + ཡིད་འཇོག་བྱ་དགོས་ +གལ་ཏེ་གསང་བའི་ཁ་ཕྱོགས་སྤྱད་ན་ངེས་པར་དུ་VPNཡི་སྣེ་དང་ལྡོག་དགོས། གལ་ཏེ་"1"བེད་སྤྱོད་བྱས་ན་ངེས་པར་དུ་"0"བེད་སྤྱོད་གཏོང་དགོས། གལ་ཏེ་རིན་ཐང་གང་ཡིན་པ་མི་ཤེས་ན། ཁྱེད་ཀྱི་མ་ལག་དོ་དམ་པ་ལ་འབྲེལ་གཏུག་བྱེད་རོགས། + + + + + + + Choose + གདམ་ག་རྒྱག་པ། + + + + None + མེད། + + + + + Save password only for this user + མིག་སྔར་སྤྱོད་མཁན་ཁོ་ནར་གསང་གྲངས་ཉར་ཚགས་བྱས་ཡོད། + + + + + Save password for all users + སྤྱོད་མཁན་ཚང་མར་གསང་གྲངས་ཉར་ཚགས་བྱས་ཡོད། + + + + + Ask password every time + ཚང་མར་འདྲི་རྩད་བྱེད་ཐེངས་རེ་ཡིན། + + + + + Don't require a password + གསང་བ་མི་དགོས། + + + + + Required + ངེས་པར་དུ་སྐོང་དགོས། + + + + Certificate(TLS) + དཔང་ཡིག(TLS) + + + + Static key + ཁ་རོག་གེར་ལྡེ་མིག་ལྟ་བ + + + + Password and certificate(TLS) + གསང་བ་དང་དཔང་ཡིག(TLS) + + + + Certificate/Private key + དཔང་ཡིག/སྒེར་གྱི་ལྡེ་མིག + + + + Certificate/ssh-agent + དཔང་ཡིག/ssh-agent + + + + Smart card + རིག་ནུས་བྱང་བུ། + + + + Choose a private key + སྒེར་གྱི་ལྡེ་མིག་འདེམས་པ། + + + + + Key Files (*.key *.pem *.der *.p12 *.pfx) + སྒེར་གྱི་ལྡེ་མིག་ཡིག་ཆ།(*.key *.pem *.der *.p12 *.pfx) + + + + Choose a CA certificate + གདམ་ག་རྒྱག་པ།CAདཔང་ཡིག + + + + + CA Files (*.pem *.der *.p12 *.crt *.cer *.pfx) + CAཡིག་ཆ། (*.pem *.der *.p12 *.crt *.cer *.pfx) + + + + Choose a User certificate + སྤྱོད་མཁན་གྱི་ལག་ཁྱེར་འདེམས་དགོས། + + + + Choose a Static key + འཇམ་ཐིང་ཐིང་གི་ལྡེ་མིག་འདེམས་ + + + + VpnDetail + + + + VPN + + + + + IPv4 + + + + + + IPv6 + + + + + Advanced + མཐོ་རིམ།མཐོ་རིམ་ + + + + Auto Connection + རང་འགུལ་གྱིས་སྦྲེལ་མཐུད་བྱ་དགོས། + + + + Cancel + མེད་པར་བཟོ་དགོས། + + + + Confirm + གཏན་འཁེལ་བྱ། + + + + VpnIpv4Page + + + IPv4 Config + IPv4བཀོད་སྒྲིག་བཅས་བྱ་དགོས། + + + + Address + ས་གནས། + + + + Netmask + དྲ་བ་འགེབས་པ། + + + + Default Gateway + དྲ་རྒྱའི་འགག་སྒོ་ཁས་ལེན་བྱེད་དགོས། + + + + DNS Server + DNSཞབས་ཞུའི་ཡོ་བྱད། + + + + Search Domain + ས་ཁོངས་འཚོལ་ཞིབ་བྱ། + + + + DHCP Client ID + DHCPཚོང་འགྲུལ་པ་སྣེ་ལེན་བྱེད་པ།ID + + + + Auto(DHCP) + རང་འགུལ་ཡིན་དགོས།(DHCP) + + + + Manual + ལག་པ་འགུལ་དགོས། + + + + VpnIpv6Page + + + IPv6 Config + IPv6བཀོད་སྒྲིག་བཅས་བྱ་དགོས། + + + + Address + ས་གནས། + + + + Netmask + དྲ་བ་འགེབས་པ། + + + + Default Gateway + དྲ་རྒྱའི་འགག་སྒོ་ཁས་ལེན་བྱེད་དགོས། + + + + DNS Server + DNSཞབས་ཞུའི་ཡོ་བྱད། + + + + Search Domain + ས་ཁོངས་འཚོལ་ཞིབ་བྱ། + + + + Auto(DHCP) + རང་འགུལ་ཡིན་དགོས།(DHCP) + + + + Manual + ལག་པ་འགུལ་དགོས། @@ -24,121 +750,91 @@ Not connected - + འབྲེལ་མཐུད་མ་བྱས་པ། - - + + Disconnect - + བར་མཚམས་ཆད་པ་རེད། - - + + Connect - + འབྲེལ་མཐུད་བཅས་བྱ་དགོས། VpnPage - + VPN - + - + VPN Settings - + VPNབཀོད་སྒྲིག་བཅས་བྱ་དགོས། vpnAddPage - + create VPN - + གསར་འཛུགས་བྱ་དགོས།VPN - + VPN Type - + VPNརིགས་དབྱིབས། - + VPN Name - + VPNམིང་། - - + + Required - + ངེས་པར་དུ་སྐོང་དགོས། - + VPN Server - - - - - VPN - + ཞབས་ཞུ་ཡོ་བྱད་ཀྱི་ས་གནས། - + Auto Connection - + རང་འགུལ་གྱིས་སྦྲེལ་མཐུད་བྱ་དགོས། - + Confirm - + གཏན་འཁེལ་བྱ། - + Cancel - + མེད་པར་བཟོ་དགོས། vpnConfigPage - VPN Type - - - - - VpnDetail - - - - VPN - - - - - IPv4 - - - - - IPv6 - - - - - Advanced - + VPN类型 vpnObject - + vpn tool - + VPNཡོ་བྱད། diff --git a/src-vpn/translations/kylin-vpn_mn.ts b/src-vpn/translations/kylin-vpn_mn.ts new file mode 100644 index 00000000..d50b8000 --- /dev/null +++ b/src-vpn/translations/kylin-vpn_mn.ts @@ -0,0 +1,844 @@ + + + + + SinglePage + + + Settings + ᠳᠤᠬᠢᠷᠠᠭᠤᠯᠬᠤ + + + + Kylin VPN + VPN ᠪᠠᠭᠠᠵᠢ + + + + kylin vpn applet desktop message + VPN ᠳᠤᠬᠢᠷᠠᠭᠤᠯᠭ᠎ᠠ ᠰᠢᠷᠡᠭᠡᠨ ᠨᠢᠭᠤᠷ ᠤ᠋ᠨ ᠠᠩᠬᠠᠷᠤᠭᠤᠯᠭ᠎ᠠ + + + + VpnAdvancedPage + + + MPPE encryption algorithm: + MPPE ᠨᠢᠭᠤᠴᠠᠯᠠᠨ ᠪᠤᠳᠤᠬᠤ ᠠᠷᠭ᠎ᠠ: + + + + Use Stateful encryption + ᠨᠢᠭᠤᠴᠠᠯᠠᠭᠰᠠᠨ ᠪᠠᠢᠳᠠᠯ ᠳᠦᠯᠦᠪ ᠢ᠋ ᠬᠡᠷᠡᠭᠯᠡᠬᠦ + + + + Send PPP echo packets + PPP ᠪᠤᠴᠠᠭᠠᠨ ᠢᠯᠡᠷᠡᠬᠦᠯᠬᠦ ᠪᠠᠭᠯᠠᠭ᠎ᠠ ᠵᠢ ᠢᠯᠡᠭᠡᠬᠦ + + + + Authentication Mode: + ᠬᠡᠷᠡᠴᠢᠯᠡᠬᠦ ᠠᠷᠭ᠎ᠠ: + + + + PAP authentication + PAP ᠬᠡᠷᠡᠴᠢᠯᠡᠯ + + + + CHAP authentication + CHAP ᠭᠡᠷᠡᠴᠢᠯᠡᠯ + + + + MSCHAP authentication + MSCHAP ᠭᠡᠷᠡᠴᠢᠯᠡᠯ + + + + MSCHAP2 authentication + MSCHAP2 ᠭᠡᠷᠡᠴᠢᠯᠡᠯ + + + + EAP authentication + EAP ᠭᠡᠷᠡᠴᠢᠯᠡᠯ + + + + Compression Mode: + ᠠᠪᠴᠢᠭᠤᠯᠬᠤ ᠠᠷᠭ᠎ᠠ: + + + + Allow BSD data compression + BSD ᠠᠪᠴᠢᠭᠤᠯᠤᠯ ᠢ᠋ ᠵᠦᠪᠰᠢᠶᠡᠷᠡᠬᠦ + + + + Allow Default data compression + Default ᠠᠪᠴᠢᠭᠤᠯᠤᠯ ᠢ᠋ ᠵᠦᠪᠰᠢᠶᠡᠷᠡᠬᠦ + + + + Allow TCP header compression + TCP ᠲᠤᠯᠤᠭᠠᠢ ᠠᠪᠴᠢᠭᠤᠯᠤᠯ ᠢ᠋ ᠵᠦᠪᠰᠢᠶᠡᠷᠡᠬᠦ + + + + Use protocol field compression negotiation + ᠭᠡᠷ᠎ᠡ ᠵᠢᠨ ᠬᠡᠰᠡᠭ ᠤ᠋ᠨ ᠠᠪᠴᠢᠭᠤᠯᠬᠤ ᠵᠦᠪᠰᠢᠯᠴᠡᠯ ᠢ᠋ ᠬᠡᠷᠡᠭᠯᠡᠬᠦ + + + + Use Address/Control compression + ᠬᠡᠷᠡᠭᠯᠡᠬᠦ ᠬᠠᠶᠢᠭ / ᠠᠪᠴᠢᠭᠤᠯᠤᠯ ᠢ᠋ ᠡᠵᠡᠮᠳᠡᠬᠦ + + + + All Available + ᠶᠠᠮᠠᠷᠪᠠ + + + + 128-bit + 128- ᠤᠷᠤᠨ + + + + 40-bit + 40- ᠤᠷᠤᠨ + + + + Use custom gateway port + ᠦᠪᠡᠷᠳᠡᠭᠡᠨ ᠳᠤᠭᠳᠠᠭᠠᠭᠰᠠᠨ ᠨᠸᠲ ᠪᠤᠭᠤᠮᠳᠠ ᠵᠢᠨ ᠦᠵᠦᠬᠦᠷ ᠢ᠋ ᠬᠡᠷᠡᠭᠯᠡᠬᠦ + + + + Use compression + ᠠᠪᠴᠢᠭᠤᠯᠤᠯ ᠢ᠋ ᠬᠡᠷᠡᠭᠯᠡᠬᠦ + + + + Use a TCP connection + TCP ᠴᠦᠷᠬᠡᠯᠡᠬᠡ ᠵᠢ ᠬᠡᠷᠡᠭᠯᠡᠬᠦ + + + + Set virtual device type + ᠳᠠᠭᠤᠷᠢᠶᠠᠮᠠᠯ ᠳᠦᠬᠦᠬᠡᠷᠦᠮᠵᠢ ᠵᠢᠨ ᠳᠦᠷᠦᠯ ᠵᠦᠢᠯ ᠢ᠋ ᠳᠤᠬᠢᠷᠠᠭᠤᠯᠬᠤ + + + + Set virtual device name + ᠳᠠᠭᠤᠷᠢᠶᠠᠮᠠᠯ ᠳᠦᠬᠦᠬᠡᠷᠦᠮᠵᠢ ᠵᠢᠨ ᠨᠡᠷᠡᠢᠳᠦᠯ ᠢ᠋ ᠳᠤᠬᠢᠷᠠᠭᠤᠯᠬᠤ + + + + Limit TCP Maximum Segment Size(MSS) + TCP ᠤ᠋ᠨ/ ᠵᠢᠨ ᠬᠠᠮᠤᠭ ᠤ᠋ᠨ ᠶᠡᠬᠡ ᠬᠡᠰᠡᠭ ᠤ᠋ᠨ ᠬᠡᠮᠵᠢᠶ᠎ᠡ ᠵᠢ ᠬᠢᠵᠠᠭᠠᠷᠯᠠᠬᠤ (MSS) + + + + Randomize remote hosts + ᠳᠠᠰᠢᠷᠠᠮᠴᠢᠯᠠᠭᠰᠠᠨ ᠠᠯᠤᠰ ᠡᠵᠡᠮᠰᠢᠯ ᠤ᠋ᠨ ᠭᠤᠤᠯ ᠮᠠᠰᠢᠨ + + + + IPv6 tun link + IPv6 tun ᠴᠦᠷᠬᠡᠯᠡᠬᠡ + + + + Specify ping interval + ping ᠤ᠋ᠨ/ ᠵᠢᠨ ᠦᠶᠡᠯᠡᠯ ᠢ᠋ ᠳᠤᠭᠳᠠᠬᠤ + + + + Specify exit or restart ping + ᠪᠤᠴᠠᠵᠤ ᠭᠠᠷᠤᠭᠰᠠᠨ ᠪᠤᠶᠤ ᠳᠠᠬᠢᠨ ᠡᠬᠢᠯᠡᠭᠰᠡᠨ ping ᠢ᠋/ ᠵᠢ ᠳᠤᠭᠳᠠᠬᠤ + + + + Specify max routes + ᠵᠠᠮᠴᠢᠯᠠᠭᠤᠷ ᠤ᠋ᠨ ᠳᠡᠭᠡᠳᠦ ᠬᠢᠵᠠᠭᠠᠷ ᠢ᠋ ᠳᠤᠭᠳᠠᠬᠤ + + + + Infinite retry on error + ᠠᠯᠳᠠᠭ᠎ᠠ ᠭᠠᠷᠬᠤ ᠦᠶ᠎ᠡ ᠳ᠋ᠤ᠌ ᠬᠢᠵᠠᠭᠠᠷ ᠦᠬᠡᠢ ᠳᠠᠬᠢᠵᠤ ᠳᠤᠷᠰᠢᠬᠤ + + + + Use custom key size + ᠦᠪᠡᠷᠳᠡᠭᠡᠨ ᠳᠤᠬᠢᠷᠠᠭᠤᠯᠤᠭᠰᠠᠨ ᠨᠢᠭᠤᠴᠠ ᠳᠦᠯᠬᠢᠬᠦᠷ ᠤ᠋ᠨ ᠬᠡᠮᠵᠢᠶ᠎ᠡ ᠵᠢ ᠬᠡᠷᠡᠭᠯᠡᠬᠦ + + + + Choose + ᠰᠤᠩᠭᠤᠬᠤ + + + + Use custom renegotiation interval + ᠦᠪᠡᠷᠳᠡᠭᠡᠨ ᠳᠤᠭᠳᠠᠭᠠᠭᠰᠠᠨ ᠳᠠᠬᠢᠨ ᠵᠦᠪᠰᠢᠯᠴᠡᠬᠦ ᠵᠠᠭᠠᠭ ᠢ᠋ ᠬᠡᠷᠡᠭᠯᠡᠬᠦ + + + + Use custom tunnel Maximum Transmission Umit(MTU) + ᠦᠪᠡᠷᠳᠡᠭᠡᠨ ᠳᠤᠭᠳᠠᠭᠠᠭᠰᠠᠨ ᠰᠤᠪᠠᠭ ᠤ᠋ᠨ ᠬᠠᠮᠤᠭ ᠤ᠋ᠨ ᠶᠡᠬᠡ ᠨᠢᠭᠡᠴᠢ ᠵᠢᠨ ᠳᠠᠮᠵᠢᠭᠤᠯᠭ᠎ᠠ ᠵᠢ ᠬᠡᠷᠡᠭᠯᠡᠬᠦ (MTU) + + + + Use custom UDP fragment size + ᠦᠪᠡᠷᠳᠡᠭᠡᠨ ᠳᠤᠭᠳᠠᠭᠠᠭᠰᠠᠨ UDP ᠬᠤᠪᠢᠶᠠᠷᠢ ᠬᠡᠰᠡᠭ ᠤ᠋ᠨ ᠬᠡᠮᠵᠢᠶ᠎ᠡ ᠵᠢ ᠬᠡᠷᠡᠭᠯᠡᠬᠦ + + + + Accept authenticated packets from any address (Float) + ᠶᠠᠮᠠᠷᠪᠠ ᠬᠠᠶᠢᠭ (Float) ᠵᠢᠡᠷ ᠢᠷᠡᠭᠰᠡᠨ ᠨᠢᠭᠡᠨᠳᠡ ᠪᠡᠶ᠎ᠡ ᠵᠢᠨ ᠭᠠᠷᠤᠯ ᠢ᠋ ᠪᠠᠳᠤᠯᠠᠭᠠᠵᠢᠭᠤᠯᠤᠭᠰᠠᠨ ᠳ᠋ᠠᠢᠲ᠋ᠠ ᠪᠠᠭᠯᠠᠭ᠎ᠠ ᠵᠢ ᠬᠦᠯᠢᠶᠡᠵᠤ ᠠᠪᠤᠨ᠎ᠠ + + + + Subject Match + ᠭᠤᠤᠯ ᠰᠡᠳᠦᠪ ᠠᠪᠴᠠᠯᠳᠤᠬᠤ + + + + Key File + ᠨᠢᠭᠤᠴᠠ ᠳᠦᠯᠬᠢᠬᠦᠷ ᠤ᠋ᠨ ᠹᠠᠢᠯ + + + + Key Direction + ᠨᠢᠭᠤᠴᠠ ᠳᠦᠯᠬᠢᠬᠦᠷ ᠤ᠋ᠨ ᠴᠢᠭᠯᠡᠯ + + + + Server Address + ᠦᠢᠯᠡᠴᠢᠯᠡᠬᠦᠷ ᠤ᠋ᠨ ᠬᠠᠶᠢᠭ + + + + Port + ᠦᠵᠦᠬᠦᠷ + + + + Proxy USername + ᠤᠷᠤᠯᠠᠭᠴᠢ ᠬᠡᠷᠡᠭᠡᠯᠡᠭᠴᠢ ᠵᠢᠨ ᠨᠡᠷ᠎ᠡ + + + + Proxy Password + ᠤᠷᠤᠯᠠᠭᠴᠢ ᠨᠢᠭᠤᠴᠠ ᠺᠤᠳ᠋ + + + + General + ᠳᠦᠷᠢᠮᠵᠢᠯ + + + + TLS settings + TLS ᠳᠤᠬᠢᠷᠠᠭᠤᠯᠭ᠎ᠠ + + + + Server Certificate Check + ᠦᠢᠯᠡᠴᠢᠯᠡᠬᠦᠷ ᠤ᠋ᠨ ᠦᠨᠡᠮᠯᠡᠯ ᠢ᠋ ᠰᠢᠯᠭᠠᠨ ᠪᠠᠢᠴᠠᠭᠠᠬᠤ + + + + Use the previous authentication end (server) certificate + ᠡᠮᠦᠨᠡᠬᠢ ᠪᠠᠳᠤᠯᠠᠭᠠᠵᠢᠭᠤᠯᠬᠤ ᠦᠵᠦᠬᠦᠷ ᠤ᠋ᠨ ᠦᠨᠡᠮᠯᠡᠯ ( ᠦᠢᠯᠡᠴᠢᠯᠡᠬᠦᠷ) ᠢ᠋ ᠬᠡᠷᠡᠭᠯᠡᠬᠦ + + + + Verify peer (server) certificate nsCertType specification + ᠳᠡᠩᠴᠡᠬᠦᠦ ᠴᠡᠭ ( ᠦᠢᠯᠡᠴᠢᠯᠡᠬᠦᠷ) ᠤ᠋ᠨ ᠦᠨᠡᠮᠯᠡᠯ nsCertType ᠢ᠋/ ᠵᠢ ᠪᠠᠳᠤᠯᠠᠭᠠᠵᠢᠭᠤᠯᠵᠤ ᠳᠤᠭᠳᠠᠬᠤ + + + + Mode + ᠮᠤᠳ᠋ + + + + Proxies + ᠤᠷᠤᠯᠠᠭᠴᠢ + + + + Proxy Type + ᠤᠷᠤᠯᠠᠭᠴᠢ ᠵᠢᠨ ᠳᠦᠷᠦᠯ ᠵᠦᠢᠯ + + + + Security + ᠠᠮᠤᠷ ᠳᠦᠪᠰᠢᠨ + + + + HMAC Authentication + HMAC ᠭᠡᠷᠡᠴᠢᠯᠡᠯ + + + + Input content + ᠤᠷᠤᠭᠤᠯᠬᠤ ᠠᠭᠤᠯᠭ᠎ᠠ + + + + No + ᠪᠢᠰᠢ/ ᠦᠬᠡᠢ + + + + Self-adaption + ᠦᠪᠡᠷᠳᠡᠭᠡᠨ ᠵᠤᠬᠢᠴᠠᠬᠤ + + + + Automatic + ᠠᠦ᠋ᠲ᠋ᠣ᠋ + + + + Exit + ᠪᠤᠴᠠᠵᠤ ᠭᠠᠷᠬᠤ + + + + Restart + ᠳᠠᠬᠢᠨ ᠡᠬᠢᠯᠡᠬᠦ + + + + Don't verify certificate identification + ᠦᠨᠡᠮᠯᠡᠯ ᠤ᠋ᠨ ᠳᠡᠮᠳᠡᠭ ᠢ᠋ ᠪᠠᠳᠤᠯᠠᠭᠠᠵᠢᠭᠤᠯᠬᠤ ᠦᠬᠡᠢ + + + + Verify the entire subject exactly + ᠪᠦᠬᠦᠢᠯᠡ ᠭᠤᠤᠯ ᠰᠡᠳᠦᠪ ᠢ᠋ ᠪᠠᠳᠤᠳᠠᠢ ᠪᠠᠳᠤᠯᠠᠭᠠᠵᠢᠭᠤᠯᠬᠤ + + + + Verify name exactly + ᠨᠡᠷᠡᠢᠳᠦᠯ ᠢ᠋ ᠤᠨᠤᠪᠴᠢᠳᠠᠢ ᠪᠠᠳᠤᠯᠠᠭᠠᠵᠢᠭᠤᠯᠬᠤ + + + + Verify name by prefix + ᠤᠭᠳᠤᠪᠤᠷᠢ ᠪᠡᠷ ᠨᠡᠷᠡᠢᠳᠦᠯ ᠢ᠋ ᠪᠠᠳᠤᠯᠠᠭᠠᠵᠢᠭᠤᠯᠬᠤ + + + + + Server + ᠦᠢᠯᠡᠴᠢᠯᠡᠬᠦᠷ + + + + + Client + ᠬᠡᠷᠡᠭᠡᠯᠡᠭᠴᠢ ᠵᠢᠨ ᠦᠵᠦᠬᠦᠷ + + + + + + None + ᠪᠠᠢᠬᠤ ᠦᠬᠡᠢ + + + + TLS-Certification + TLS- ᠭᠡᠷᠡᠴᠢᠯᠡᠯ + + + + TLS-Encryption + TLS- ᠨᠢᠭᠤᠴᠠᠯᠠᠬᠤ + + + + Not Required + ᠱᠠᠭᠠᠷᠳᠠᠬᠤ ᠦᠬᠡᠢ + + + + Default + ᠠᠶᠠᠳᠠᠯ + + + + Options: + ᠰᠤᠩᠭᠤᠭᠳᠠᠬᠤᠨ: + + + + Request an inner IP address + ᠳᠤᠳᠤᠭᠠᠳᠤ IP ᠬᠠᠶᠢᠭ ᠢ᠋ ᠭᠤᠶᠤᠴᠢᠯᠠᠬᠤ + + + + Enforce UDP encapsulation + ᠠᠯᠪᠠ ᠪᠡᠷ UDP ᠪᠢᠳᠡᠬᠦᠮᠵᠢᠯᠡᠬᠦ + + + + Use IP compression + IP ᠠᠪᠴᠢᠭᠤᠯᠤᠯ ᠢ᠋ ᠬᠡᠷᠡᠭᠯᠡᠬᠦ + + + + Enable custom password suggestions + ᠦᠪᠡᠷᠳᠡᠭᠡᠨ ᠳᠤᠭᠳᠠᠭᠠᠬᠰᠠᠨ ᠨᠢᠭᠤᠴᠠ ᠺᠤᠳ᠋ ᠤ᠋ᠨ ᠰᠠᠨᠠᠭᠤᠯᠤᠮᠵᠢ ᠵᠢ ᠡᠬᠢᠯᠡᠬᠦᠯᠬᠦ + + + + Choose a private key + ᠬᠤᠪᠢ ᠵᠢᠨ ᠨᠢᠭᠤᠴᠠ ᠳᠦᠯᠬᠢᠬᠦᠷ ᠢ᠋ ᠰᠤᠩᠭᠤᠬᠤ + + + + Key Files (*.key *.pem *.der *.p12 *.pfx) + ᠬᠤᠪᠢ ᠵᠢᠨ ᠨᠢᠭᠤᠴᠠ ᠳᠦᠯᠬᠢᠬᠦᠷ ᠤ᠋ᠨ ᠹᠠᠢᠯ (*.key *.pem *.der *.p12 *.pfx) + + + + VpnConfigPage + + + Type + ᠳᠦᠷᠦᠯ ᠵᠦᠢᠯ + + + + Name + ᠨᠡᠷᠡᠢᠳᠦᠯ + + + + Static Key + ᠳᠠᠢᠪᠤᠩ ᠨᠢᠭᠤᠴᠠ ᠳᠦᠯᠬᠢᠬᠦᠷ + + + + Local IP + ᠲᠤᠰ ᠭᠠᠵᠠᠷ ᠤ᠋ᠨ IP ᠬᠠᠶᠢᠭ + + + + Remote IP + ᠠᠯᠤᠰ ᠡᠵᠡᠮᠰᠢᠯ ᠤ᠋ᠨ IP ᠬᠠᠶᠢᠭ + + + + PIN Code + PIN ᠺᠤᠳ᠋ + + + + + + Password + ᠨᠢᠭᠤᠴᠠ ᠺᠤᠳ᠋ + + + + NT Domain + NT ᠬᠡᠰᠡᠭ + + + + Server Address + ᠦᠢᠯᠡᠴᠢᠯᠡᠬᠦᠷ ᠤ᠋ᠨ ᠬᠠᠶᠢᠭ + + + + Authentication Mode + ᠬᠡᠷᠡᠴᠢᠯᠡᠬᠦ ᠠᠷᠭ᠎ᠠ + + + + CA Certificate + CA ᠦᠨᠡᠮᠯᠡᠯ + + + + User Certificate + ᠬᠡᠷᠡᠭᠡᠯᠡᠭᠴᠢ ᠵᠢᠨ ᠦᠨᠡᠮᠯᠡᠯ + + + + Key Direction + ᠨᠢᠭᠤᠴᠠ ᠳᠦᠯᠬᠢᠬᠦᠷ ᠤ᠋ᠨ ᠴᠢᠭᠯᠡᠯ + + + + Private Key + ᠬᠤᠪᠢ ᠵᠢᠨ ᠨᠢᠭᠤᠴᠠ ᠳᠦᠯᠬᠢᠬᠦᠷ + + + + Private Key Password + ᠬᠤᠪᠢ ᠵᠢᠨ ᠨᠢᠭᠤᠴᠠ ᠳᠦᠯᠬᠢᠬᠦᠷ ᠤ᠋ᠨ ᠨᠢᠭᠤᠴᠠ ᠺᠤᠳ᠋ + + + + + Password Options + ᠨᠢᠭᠤᠴᠠ ᠺᠤᠳ᠋ ᠤ᠋ᠨ ᠰᠤᠩᠭᠤᠭᠳᠠᠬᠤᠨ + + + + Username + ᠬᠡᠷᠡᠭᠯᠡᠭᠴᠢ ᠵᠢᠨ ᠨᠡᠷ᠎ᠡ + + + + Notice: +If key direction is used, it must be opposite to the VPN side used. If '1' is used, the connection must use '0'. If you are not sure which value to use, please contact your system administrator. + ᠠᠩᠬᠠᠷᠤᠭᠠᠷᠠᠢ: +ᠬᠡᠷᠪᠡ ᠨᠢᠭᠤᠴᠠ ᠳᠦᠯᠬᠢᠬᠦᠷ ᠤ᠋ᠨ ᠴᠢᠭᠯᠡᠯ ᠢ᠋ ᠬᠡᠷᠡᠭᠯᠡᠭᠰᠡᠨ ᠪᠤᠯ᠂ ᠲᠡᠷᠡ ᠨᠢ ᠡᠷᠬᠡᠪᠰᠢ ᠬᠡᠷᠡᠭᠯᠡᠭᠰᠡᠨ VPN ᠦᠵᠦᠬᠦᠷ ᠲᠠᠢ ᠡᠰᠡᠷᠬᠦ ᠪᠠᠢᠬᠤ ᠬᠡᠷᠡᠭᠳᠡᠢ᠃ ᠬᠡᠷᠪᠡ '1' ᠢ᠋/ ᠵᠢ ᠬᠡᠷᠡᠭᠯᠡᠭᠰᠡᠨ ᠪᠤᠯ᠂ ᠴᠦᠷᠬᠡᠯᠡᠭᠡ ᠨᠢ ᠡᠷᠬᠡᠪᠰᠢ '0' ᠢ᠋/ ᠵᠢ ᠬᠡᠷᠡᠭᠯᠡᠬᠦ ᠬᠡᠷᠡᠭᠳᠡᠢ᠃ ᠬᠡᠷᠪᠡ ᠠᠯᠢ ᠵᠢ ᠨᠢ ᠬᠡᠷᠡᠭᠯᠡᠬᠦ ᠪᠡᠨ ᠳᠤᠭᠳᠠᠵᠤ ᠴᠢᠳᠠᠭ᠎ᠠ ᠦᠬᠡᠢ ᠪᠤᠯ᠂ ᠲᠠ ᠰᠢᠰᠲ᠋ᠧᠮ ᠤ᠋ᠨ ᠬᠠᠮᠢᠶᠠᠷᠤᠭᠴᠢ ᠲᠠᠢ ᠪᠡᠨ ᠬᠠᠷᠢᠯᠴᠠᠭᠠᠷᠠᠢ. + + + + + + + Choose + ᠰᠤᠩᠭᠤᠬᠤ + + + + None + ᠪᠠᠢᠬᠤ ᠦᠬᠡᠢ + + + + + Save password only for this user + ᠵᠦᠪᠬᠡᠨ ᠤᠳᠤᠬᠠᠨ ᠤ᠋ ᠬᠡᠷᠡᠭᠡᠯᠡᠭᠴᠢ ᠵᠢᠨ ᠨᠢᠭᠤᠴᠠ ᠺᠤᠳ᠋ ᠢ᠋ ᠬᠠᠳᠠᠭᠠᠯᠠᠨ᠎ᠠ + + + + + Save password for all users + ᠪᠦᠬᠦᠢᠯᠡ ᠬᠡᠷᠡᠭᠡᠯᠡᠭᠴᠢ ᠵᠢᠨ ᠨᠢᠭᠤᠴᠠ ᠺᠤᠳ᠋ ᠢ᠋ ᠬᠠᠳᠠᠭᠠᠯᠠᠨ᠎ᠠ + + + + + Ask password every time + ᠤᠳᠠᠭ᠎ᠠ ᠪᠦᠷᠢ ᠠᠰᠠᠭᠤᠨ ᠯᠠᠪᠯᠠᠬᠤ + + + + + Don't require a password + ᠨᠢᠭᠤᠴᠠ ᠺᠤᠳ᠋ ᠬᠡᠷᠡᠭ ᠦᠬᠡᠢ + + + + + Required + ᠡᠷᠬᠡᠪᠰᠢ ᠳᠠᠭᠯᠠᠬᠤ + + + + Certificate(TLS) + ᠦᠨᠡᠮᠯᠡᠯ (TLS) + + + + Static key + ᠳᠠᠢᠪᠤᠩ ᠨᠢᠭᠤᠴᠠ ᠳᠦᠯᠬᠢᠬᠦᠷ + + + + Password and certificate(TLS) + ᠨᠢᠭᠤᠴᠠ ᠺᠤᠳ᠋ ᠬᠢᠬᠡᠳ ᠦᠨᠡᠮᠯᠡᠯ (TLS) + + + + Certificate/Private key + ᠦᠨᠡᠮᠯᠡᠯ / ᠬᠤᠪᠢ ᠵᠢᠨ ᠨᠢᠭᠤᠴᠠ ᠳᠦᠯᠬᠢᠬᠦᠷ + + + + Certificate/ssh-agent + ᠦᠨᠡᠮᠯᠡᠯ /ssh-agent + + + + Smart card + ᠤᠶᠤᠯᠢᠭ ᠺᠠᠷᠲ + + + + Choose a private key + ᠬᠤᠪᠢ ᠵᠢᠨ ᠨᠢᠭᠤᠴᠠ ᠳᠦᠯᠬᠢᠬᠦᠷ ᠢ᠋ ᠰᠤᠩᠭᠤᠬᠤ + + + + + Key Files (*.key *.pem *.der *.p12 *.pfx) + ᠬᠤᠪᠢ ᠵᠢᠨ ᠨᠢᠭᠤᠴᠠ ᠳᠦᠯᠬᠢᠬᠦᠷ ᠤ᠋ᠨ ᠹᠠᠢᠯ (*.key *.pem *.der *.p12 *.pfx) + + + + Choose a CA certificate + CA ᠦᠨᠡᠮᠯᠡᠯ ᠢ᠋ ᠰᠤᠩᠭᠤᠬᠤ + + + + + CA Files (*.pem *.der *.p12 *.crt *.cer *.pfx) + CA ᠹᠠᠢᠯ (*.pem *.der *.p12 *.crt *.cer *.pfx) + + + + Choose a User certificate + ᠬᠡᠷᠡᠭᠡᠯᠡᠭᠴᠢ ᠵᠢᠨ ᠦᠨᠡᠮᠯᠡᠯ ᠢ᠋ ᠰᠤᠩᠭᠤᠬᠤ + + + + Choose a Static key + ᠳᠠᠢᠪᠤᠩ ᠨᠢᠭᠤᠴᠠ ᠳᠦᠯᠬᠢᠬᠦᠷ ᠢ᠋ ᠰᠤᠩᠭᠤᠬᠤ + + + + VpnDetail + + + + VPN + vpn + + + + IPv4 + ipv4 + + + + + IPv6 + ipv6 + + + + Advanced + ᠦᠨᠳᠦᠷ ᠳᠡᠰ + + + + Auto Connection + ᠠᠦ᠋ᠲ᠋ᠣ᠋ ᠴᠦᠷᠬᠡᠯᠡᠬᠦ + + + + Cancel + ᠦᠭᠡᠢᠰᠬᠡᠬᠦ + + + + Confirm + ᠪᠠᠳᠤᠯᠠᠬᠤ + + + + VpnIpv4Page + + + IPv4 Config + IPv4 ᠳᠤᠬᠢᠷᠠᠭᠤᠯᠭ᠎ᠠ + + + + Address + ᠬᠠᠶᠢᠭ + + + + Netmask + ᠬᠤᠪᠢᠶᠠᠷᠢ ᠰᠦᠯᠵᠢᠶᠡᠨ ᠤ᠋ ᠳᠠᠯᠳᠠᠯᠠᠯ ᠺᠤᠳ᠋ + + + + Default Gateway + ᠠᠶᠠᠳᠠᠯ ᠨᠸᠲ ᠪᠤᠭᠤᠮᠳᠠ + + + + DNS Server + DNS ᠦᠢᠯᠡᠴᠢᠯᠡᠬᠦᠷ + + + + Search Domain + ᠬᠠᠢᠬᠤ ᠬᠡᠰᠡᠭ + + + + DHCP Client ID + DHCP ᠬᠡᠷᠡᠭᠡᠯᠡᠭᠴᠢ ᠵᠢᠨ ᠦᠵᠦᠬᠦᠷ ID + + + + Auto(DHCP) + ᠠᠦ᠋ᠲ᠋ᠣ᠋ (DHCP) + + + + Manual + ᠠᠦ᠋ᠲ᠋ᠣ᠋ ᠪᠤᠰᠤ + + + + VpnIpv6Page + + + IPv6 Config + IPv6 ᠳᠤᠬᠢᠷᠠᠭᠤᠯᠭ᠎ᠠ + + + + Address + ᠬᠠᠶᠢᠭ + + + + Netmask + ᠬᠤᠪᠢᠶᠠᠷᠢ ᠰᠦᠯᠵᠢᠶᠡᠨ ᠤ᠋ ᠳᠠᠯᠳᠠᠯᠠᠯ ᠺᠤᠳ᠋ + + + + Default Gateway + ᠠᠶᠠᠳᠠᠯ ᠨᠸᠲ ᠪᠤᠭᠤᠮᠳᠠ + + + + DNS Server + DNS ᠦᠢᠯᠡᠴᠢᠯᠡᠬᠦᠷ + + + + Search Domain + ᠬᠠᠢᠬᠤ ᠬᠡᠰᠡᠭ + + + + Auto(DHCP) + ᠠᠦ᠋ᠲ᠋ᠣ᠋ (DHCP) + + + + Manual + ᠠᠦ᠋ᠲ᠋ᠣ᠋ ᠪᠤᠰᠤ + + + + VpnListItem + + + Not connected + ᠴᠦᠷᠬᠡᠯᠡᠭᠡ ᠦᠬᠡᠢ + + + + + Disconnect + ᠳᠠᠰᠤᠯᠬᠤ + + + + + Connect + ᠴᠦᠷᠬᠡᠯᠡᠬᠦ + + + + VpnPage + + + VPN + vpn + + + + VPN Settings + VPN ᠳᠤᠬᠢᠷᠠᠭᠤᠯᠭ᠎ᠠ + + + + vpnAddPage + + + create VPN + VPN ᠪᠠᠢᠭᠤᠯᠬᠤ + + + + VPN Type + VPN ᠳᠦᠷᠦᠯ ᠵᠦᠢᠯ + + + + VPN Name + VPN ᠨᠡᠷᠡᠢᠳᠦᠯ + + + + + Required + ᠡᠷᠬᠡᠪᠰᠢ ᠳᠠᠭᠯᠠᠬᠤ + + + + VPN Server + ᠦᠢᠯᠡᠴᠢᠯᠡᠬᠦᠷ ᠤ᠋ᠨ ᠬᠠᠶᠢᠭ + + + VPN + vpn + + + + Auto Connection + ᠠᠦ᠋ᠲ᠋ᠣ᠋ ᠴᠦᠷᠬᠡᠯᠡᠬᠦ + + + + Confirm + ᠪᠠᠳᠤᠯᠠᠬᠤ + + + + Cancel + ᠦᠬᠡᠢᠰᠬᠡᠬᠦ + + + + vpnConfigPage + + VPN Type + VPN类型 + + + + vpnObject + + + vpn tool + vpn ᠪᠠᠭᠠᠵᠢ + + + diff --git a/src-vpn/translations/kylin-vpn_zh_CN.qm b/src-vpn/translations/kylin-vpn_zh_CN.qm deleted file mode 100644 index 75c3ce3e..00000000 Binary files a/src-vpn/translations/kylin-vpn_zh_CN.qm and /dev/null differ diff --git a/src-vpn/translations/kylin-vpn_zh_CN.ts b/src-vpn/translations/kylin-vpn_zh_CN.ts index 29c04c79..3875ac54 100644 --- a/src-vpn/translations/kylin-vpn_zh_CN.ts +++ b/src-vpn/translations/kylin-vpn_zh_CN.ts @@ -4,650 +4,700 @@ SinglePage - + Settings 设置 - + Kylin VPN - VPN工具 + VPN 工具 - + kylin vpn applet desktop message - vpn配置桌面提示 + VPN 配置桌面提示 VpnAdvancedPage - + MPPE encryption algorithm: - MPPE加密算法: + MPPE 加密算法: - + Use Stateful encryption 使用有状态加密 - + Send PPP echo packets - 发送PPP回显包 + 发送 PPP 回显包 - + Authentication Mode: 认证方式: - + PAP authentication - PAP认证 + PAP 认证 - + CHAP authentication - CHAP认证 + CHAP 认证 - + MSCHAP authentication - MSCHAP认证 + MSCHAP 认证 - + MSCHAP2 authentication - MSCHAP2认证 + MSCHAP2 认证 - + EAP authentication - EAP认证 + EAP 认证 - + Compression Mode: 压缩方式: - + Allow BSD data compression - 允许BSD压缩 + 允许 BSD 压缩 - + Allow Default data compression - 允许Default压缩 + 允许 Default 压缩 - + Allow TCP header compression - 允许TCP头压缩 + 允许 TCP 头压缩 - + Use protocol field compression negotiation 使用协议域压缩协商 - + Use Address/Control compression 使用地址/控制压缩 - + All Available 任意 - + 128-bit 128位 - + 40-bit 40位 - + Use custom gateway port 使用自定义网关端口 - + Use compression 使用压缩 - + Use a TCP connection - 使用TCP连接 + 使用 TCP 连接 - + Set virtual device type 设置虚拟设备类型 - + Set virtual device name 设置虚拟设备名称 - + Limit TCP Maximum Segment Size(MSS) - 限制TCP最大段尺寸(MSS) + 限制 TCP 最大段尺寸(MSS) - + Randomize remote hosts 随机化远程主机 - + IPv6 tun link - IPv6 tun连接 + IPv6 tun 连接 - + Specify ping interval - 指定Ping周期 + 指定 Ping 周期 - + Specify exit or restart ping - 指定退出或重启的Ping + 指定退出或重启的 Ping - + Specify max routes 指定路由上限 - + Infinite retry on error 出错时无限重试 - + Use custom key size 使用自定义密钥大小 - + Choose 选择 - + Use custom renegotiation interval 使用自定义重协商间隔 - + Use custom tunnel Maximum Transmission Umit(MTU) 使用自定义隧道最大单元传输(MTU) - + Use custom UDP fragment size - 使用自定义UDP分片大小 + 使用自定义 UDP 分片大小 - + Accept authenticated packets from any address (Float) 接受来自任何地址(Float)已通过身份验证的数据包 - + Subject Match 主题匹配 - + Key File 密钥文件 - + Key Direction 密钥方向 - + Server Address 服务器地址 - + Port 端口 - + Proxy USername 代理用户名 - + Proxy Password 代理密码 - + General 常规 - + TLS settings - TLS设置 + TLS 设置 - + Server Certificate Check 服务器证书检验 - + Use the previous authentication end (server) certificate 使用前面验证端(服务器)证书 - + Verify peer (server) certificate nsCertType specification - 验证对等点(服务器)证书nsCertType指定 + 验证对等点(服务器)证书 nsCertType 指定 - + Mode 模式 - + Proxies 代理 - + Proxy Type 代理类型 - + Security 安全 - + HMAC Authentication - HMAC认证 + HMAC 认证 - + Input content 输入内容 - + No - + Self-adaption 自适应 - + Automatic 自动 - + Exit 退出 - + Restart 重启 - + Don't verify certificate identification 不验证证书标识 - + Verify the entire subject exactly 确切地验证整个主题 - + Verify name exactly 精确验证名称 - + Verify name by prefix 按前缀验证名称 - - + + Server 服务器 - - + + Client 客户端 - - - + + + None - + TLS-Certification TLS-认证 - + TLS-Encryption TLS-加密 - + Not Required 不需要 - + Default 默认 - + Options: 选项: - + Request an inner IP address - 请求内部IP地址 + 请求内部 IP 地址 - + Enforce UDP encapsulation - 强制UDP封装 + 强制 UDP 封装 - + Use IP compression - 使用IP压缩 + 使用 IP 压缩 - + Enable custom password suggestions 启用自定义密码建议 + + + Choose a private key + 选择私钥 + + + + Key Files (*.key *.pem *.der *.p12 *.pfx) + 私钥文件 (*.key *.pem *.der *.p12 *.pfx) + VpnConfigPage - + Type 类型 - + Name 名称 - + Static Key 静态密钥 - + Local IP - 本地IP地址 + 本地 IP 地址 - + Remote IP - 远程IP地址 + 远程 IP 地址 - + PIN Code - PIN码 + PIN 码 - - - + + + Password 密码 - + NT Domain - NT域 + NT 域 - + Server Address 服务器地址 - + Authentication Mode 认证方式 - + CA Certificate - CA证书 + CA 证书 - + User Certificate 用户证书 - + Key Direction 密钥方向 - + Private Key 私钥 - + Private Key Password 私有密钥密码 - - + + Password Options 密码选项 - + Username 用户名 - + Notice: If key direction is used, it must be opposite to the VPN side used. If '1' is used, the connection must use '0'. If you are not sure which value to use, please contact your system administrator. 注意: 如果使用了密钥方向,它必须和使用的VPN端相反。如果使用了“1”,连接必须要使用“0”。如果不确定使用哪个值,请联系您的系统管理员。 - - - - + + + + Choose 选择 - + None - - + + Save password only for this user 仅对当前用户保存密码 - - + + Save password for all users 为所有用户保存密码 - - + + Ask password every time 每次都询问 - - + + Don't require a password 不需要密码 - - + + Required 必填 - + Certificate(TLS) 证书(TLS) - + Static key 静态密钥 - + Password and certificate(TLS) 密码和证书(TLS) - + Certificate/Private key 证书/私钥 - + Certificate/ssh-agent - 证书/ssh-agent + 证书/ ssh-agent - + Smart card 智能卡 - + Choose a private key 选择私钥 - - + + Key Files (*.key *.pem *.der *.p12 *.pfx) - 私钥文件(*.key *.pem *.der *.p12 *.pfx) + 私钥文件 (*.key *.pem *.der *.p12 *.pfx) - + Choose a CA certificate - 选择CA证书 + 选择 CA 证书 - - + + CA Files (*.pem *.der *.p12 *.crt *.cer *.pfx) CA文件 (*.pem *.der *.p12 *.crt *.cer *.pfx) - + Choose a User certificate 选择用户证书 - + Choose a Static key 选择静态密钥 - VpnIpv4Page + VpnDetail - - IPv4 Config - IPv4配置 + + + VPN + - + + IPv4 + + + + + + IPv6 + + + + + Advanced + 高级 + + + + Auto Connection + 自动连接 + + + + Cancel + 取消 + + + + Confirm + 确定 + + + + VpnIpv4Page + + + IPv4 Config + IPv4 配置 + + + Address 地址 - + Netmask 子网掩码 - + Default Gateway 默认网关 - + DNS Server - DNS服务器 + DNS 服务器 - + Search Domain 搜索域 - + DHCP Client ID - DHCP客户端ID + DHCP 客户端 ID - + Auto(DHCP) - 自动(DHCP) + 自动 (DHCP) - + Manual 手动 @@ -655,42 +705,42 @@ If key direction is used, it must be opposite to the VPN side used. If '1&a VpnIpv6Page - + IPv6 Config - IPv6配置 + IPv6 配置 - + Address 地址 - + Netmask 子网掩码 - + Default Gateway 默认网关 - + DNS Server - DNS服务器 + DNS 服务器 - + Search Domain 搜索域 - + Auto(DHCP) - 自动(DHCP) + 自动 (DHCP) - + Manual 手动 @@ -703,14 +753,14 @@ If key direction is used, it must be opposite to the VPN side used. If '1&a 未连接 - - + + Disconnect 断开 - - + + Connect 连接 @@ -718,61 +768,56 @@ If key direction is used, it must be opposite to the VPN side used. If '1&a VpnPage - + VPN - + VPN Settings - VPN设置 + VPN 设置 vpnAddPage - + create VPN - 创建VPN + 创建 VPN - + VPN Type - VPN类型 + VPN 类型 - + VPN Name - VPN名称 + VPN 名称 - - + + Required 必填 - + VPN Server 服务器地址 - - VPN - - - - + Auto Connection 自动连接 - + Confirm 确定 - + Cancel 取消 @@ -784,52 +829,12 @@ If key direction is used, it must be opposite to the VPN side used. If '1&a VPN类型 - - VpnDetail - - - - VPN - - - - - IPv4 - - - - - - IPv6 - - - - - Advanced - 高级 - - - - Auto Connection - 自动连接 - - - - Cancel - 取消 - - - - Confirm - 确定 - - vpnObject - + vpn tool - VPN工具 + VPN 工具 diff --git a/src/backend/backend.pri b/src/backend/backend.pri index feb4853f..fdab03bd 100644 --- a/src/backend/backend.pri +++ b/src/backend/backend.pri @@ -4,19 +4,12 @@ include(dbus-interface/dbus-interface.pri) HEADERS += \ $$PWD/dbusadaptor.h \ - $$PWD/kylinarping.h \ - $$PWD/kylinipv4arping.h \ - $$PWD/kylinipv6arping.h \ $$PWD/sysdbusregister.h \ $$PWD/utils.h \ $$PWD/wifi-auth-thread.h SOURCES += \ $$PWD/dbusadaptor.cpp \ - $$PWD/kylinipv4arping.cpp \ - $$PWD/kylinipv6arping.cpp \ $$PWD/sysdbusregister.cpp \ $$PWD/utils.cpp \ $$PWD/wifi-auth-thread.cpp - -DISTFILES += diff --git a/src/backend/dbus-interface/kyenterpricesettinginfo.h b/src/backend/dbus-interface/kyenterpricesettinginfo.h index 79a7df4b..9a02dbb6 100644 --- a/src/backend/dbus-interface/kyenterpricesettinginfo.h +++ b/src/backend/dbus-interface/kyenterpricesettinginfo.h @@ -32,7 +32,7 @@ enum KyEapMethodType { TTLS, LEAP, PWD, - FAST, + FAST }; class KyEapMethodTlsInfo diff --git a/src/backend/dbus-interface/kylinactiveconnectresource.cpp b/src/backend/dbus-interface/kylinactiveconnectresource.cpp index ef79d1b0..efefec5b 100644 --- a/src/backend/dbus-interface/kylinactiveconnectresource.cpp +++ b/src/backend/dbus-interface/kylinactiveconnectresource.cpp @@ -660,7 +660,7 @@ bool KyActiveConnectResourse::connectionIsVirtual(QString uuid) return false; } - return !m_networkdevice->deviceIsWired(devicePtr->interfaceName()); + return !m_networkdevice->checkDeviceType(devicePtr->interfaceName(), NetworkManager::Device::Type::Ethernet); } bool KyActiveConnectResourse::wiredConnectIsActived() @@ -748,9 +748,9 @@ QString KyActiveConnectResourse::getAcitveConnectionPathByUuid(QString connectUu return activeAonnectPtr->path(); } -int KyActiveConnectResourse::getAcivateWifiSignal() +int KyActiveConnectResourse::getActivateWifiSignal(QString devName) { - int signalStrength = 0; + int signalStrength = -1; KyNetworkDeviceResourse devResource; QStringList devList; devResource.getNetworkDeviceList(NetworkManager::Device::Type::Wifi, devList); @@ -766,14 +766,17 @@ int KyActiveConnectResourse::getAcivateWifiSignal() } if (connectDevice->type() == NetworkManager::Device::Wifi) { - NetworkManager::WirelessDevice *wirelessDevicePtr = - qobject_cast(connectDevice.data()); - NetworkManager::AccessPoint::Ptr apPtr = wirelessDevicePtr->activeAccessPoint(); - if (apPtr.isNull()) { - continue; + if ((!devName.isEmpty() && connectDevice->interfaceName() == devName) + || devName.isEmpty()) { + NetworkManager::WirelessDevice *wirelessDevicePtr = + qobject_cast(connectDevice.data()); + NetworkManager::AccessPoint::Ptr apPtr = wirelessDevicePtr->activeAccessPoint(); + if (apPtr.isNull()) { + continue; + } + signalStrength = apPtr->signalStrength(); + break; } - signalStrength = apPtr->signalStrength(); - break; } } diff --git a/src/backend/dbus-interface/kylinactiveconnectresource.h b/src/backend/dbus-interface/kylinactiveconnectresource.h index 927161c7..68c8c0c1 100644 --- a/src/backend/dbus-interface/kylinactiveconnectresource.h +++ b/src/backend/dbus-interface/kylinactiveconnectresource.h @@ -60,7 +60,8 @@ public: bool wiredConnectIsActived(); bool checkWirelessStatus(NetworkManager::ActiveConnection::State state); QString getAcitveConnectionPathByUuid(QString uuid); - int getAcivateWifiSignal(); + + int getActivateWifiSignal(QString devName = ""); private: void getActiveConnectIp(NetworkManager::ActiveConnection::Ptr activeConnectPtr, diff --git a/src/backend/dbus-interface/kylinconnectresource.cpp b/src/backend/dbus-interface/kylinconnectresource.cpp index bb2b1be8..739738a1 100644 --- a/src/backend/dbus-interface/kylinconnectresource.cpp +++ b/src/backend/dbus-interface/kylinconnectresource.cpp @@ -80,6 +80,7 @@ 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::needShowDesktop, this, &KyConnectResourse::needShowDesktop); } KyConnectResourse::~KyConnectResourse() @@ -451,38 +452,28 @@ void KyConnectResourse::getIpv4ConnectSetting( NetworkManager::Ipv4Setting::Ptr &ipv4Setting, KyConnectSetting &connectSetting) { + connectSetting.m_ipv4Dns = ipv4Setting->dns(); if (NetworkManager::Ipv4Setting::Automatic == ipv4Setting->method()) { connectSetting.m_ipv4ConfigIpType = CONFIG_IP_DHCP; - connectSetting.m_ipv4Dns = ipv4Setting->dns(); return; } connectSetting.m_ipv4ConfigIpType = CONFIG_IP_MANUAL; - connectSetting.m_ipv4Address = ipv4Setting->addresses(); - connectSetting.m_ipv4Dns = ipv4Setting->dns(); - - return; } void KyConnectResourse::getIpv6ConnectSetting( NetworkManager::Ipv6Setting::Ptr &ipv6Setting, KyConnectSetting &connectSetting) { - + connectSetting.m_ipv6Dns = ipv6Setting->dns(); if (NetworkManager::Ipv6Setting::Automatic == ipv6Setting->method()) { connectSetting.m_ipv6ConfigIpType = CONFIG_IP_DHCP; - connectSetting.m_ipv6Dns = ipv6Setting->dns(); return; } connectSetting.m_ipv6ConfigIpType = CONFIG_IP_MANUAL; - connectSetting.m_ipv6Address = ipv6Setting->addresses(); - - connectSetting.m_ipv6Dns = ipv6Setting->dns(); - - return; } void KyConnectResourse::getConnectivity(NetworkManager::Connectivity &connectivity) @@ -737,10 +728,11 @@ KyApConnectItem *KyConnectResourse::getApConnectItem(NetworkManager::Connection: apConnectItem->m_connectName = connectPtr->name(); apConnectItem->m_connectSsid = getSsidFromByteArray(rawSsid); apConnectItem->m_connectUuid = connectPtr->uuid(); - if (wirelessSetting->band() == NetworkManager::WirelessSetting::FrequencyBand::Bg) { - apConnectItem->m_band = str2GBand; - } else if (wirelessSetting->band() == NetworkManager::WirelessSetting::FrequencyBand::A) { + + if (wirelessSetting->band() == NetworkManager::WirelessSetting::FrequencyBand::A) { apConnectItem->m_band = str5GBand; + } else if (wirelessSetting->band() == NetworkManager::WirelessSetting::FrequencyBand::Bg) { + apConnectItem->m_band = str2GBand; } apConnectItem->m_ifaceName = settingPtr->interfaceName(); apConnectItem->m_isActivated = m_networkResourceInstance->isActiveConnection(connectPtr->uuid()); diff --git a/src/backend/dbus-interface/kylinconnectresource.h b/src/backend/dbus-interface/kylinconnectresource.h index e8baf835..91bffcec 100644 --- a/src/backend/dbus-interface/kylinconnectresource.h +++ b/src/backend/dbus-interface/kylinconnectresource.h @@ -87,6 +87,8 @@ Q_SIGNALS: void connectionRemove(QString path); void connectivityChanged(NetworkManager::Connectivity connectivity); + void needShowDesktop(QString); + private: KyNetworkResourceManager *m_networkResourceInstance = nullptr; }; diff --git a/src/backend/dbus-interface/kylinconnectsetting.cpp b/src/backend/dbus-interface/kylinconnectsetting.cpp index 22700aad..0c38def4 100644 --- a/src/backend/dbus-interface/kylinconnectsetting.cpp +++ b/src/backend/dbus-interface/kylinconnectsetting.cpp @@ -69,6 +69,7 @@ int KyConnectSetting::setIpConfigType(KyIpAddressType ipType, KyIpConfigType ipC return 0; } + void KyConnectSetting::ipv4AddressConstruct(QString &ipv4Address, QString &ipv4NetMask, QString &ipv4GateWay) { qDebug()<<"ipv4 address"< &ipv4Dns) +{ + m_ipv4Dns = ipv4Dns; +} + void KyConnectSetting::ipv6AddressConstruct(QString &ipv6Address, QString &ipv6NetMask, QString &ipv6GateWay) { NetworkManager::IpAddress nmIpv6Address; @@ -91,14 +96,9 @@ void KyConnectSetting::ipv6AddressConstruct(QString &ipv6Address, QString &ipv6N m_ipv6Address << nmIpv6Address; } -void KyConnectSetting::ipv4DnsConstruct(QList &ipv4DnsList) +void KyConnectSetting::ipv6DnsConstruct(QList &ipv6Dns) { - m_ipv4Dns = ipv4DnsList; -} - -void KyConnectSetting::ipv6DnsConstruct(QList &ipv6DnsList) -{ - m_ipv6Dns = ipv6DnsList; + m_ipv6Dns = ipv6Dns; } void KyConnectSetting::dumpInfo() diff --git a/src/backend/dbus-interface/kylinconnectsetting.h b/src/backend/dbus-interface/kylinconnectsetting.h index c8ae8f8c..58d70c17 100644 --- a/src/backend/dbus-interface/kylinconnectsetting.h +++ b/src/backend/dbus-interface/kylinconnectsetting.h @@ -50,10 +50,10 @@ public: void setIfaceName(QString &ifaceName); void setConnectName(QString &connectName); int setIpConfigType(KyIpAddressType ipType, KyIpConfigType configType); + void ipv4DnsConstruct(QList &ipv4Dns); void ipv4AddressConstruct(QString &ipv4Address, QString &ipv4NetMask, QString &ipv4GateWay); + void ipv6DnsConstruct(QList &ipv6Dns); void ipv6AddressConstruct(QString &ipv6Address, QString &ipv6NetMask, QString &ipv6GateWay); - void ipv4DnsConstruct(QList &ipv4DnsList); - void ipv6DnsConstruct(QList &ipv6DnsList); void dumpInfo(); public: diff --git a/src/backend/dbus-interface/kylinnetworkdeviceresource.cpp b/src/backend/dbus-interface/kylinnetworkdeviceresource.cpp index 7ed7f6f2..79a092a7 100644 --- a/src/backend/dbus-interface/kylinnetworkdeviceresource.cpp +++ b/src/backend/dbus-interface/kylinnetworkdeviceresource.cpp @@ -29,6 +29,7 @@ KyNetworkDeviceResourse::KyNetworkDeviceResourse(QObject *parent) : QObject(pare { qRegisterMetaType("NetworkManager::Device::State"); qRegisterMetaType("NetworkManager::Device::StateChangeReason"); + qRegisterMetaType("NetworkManager::Connectivity"); m_networkResourceInstance = KyNetworkResourceManager::getInstance(); m_deviceMap.clear(); @@ -248,6 +249,41 @@ qulonglong KyNetworkDeviceResourse::getDeviceTxRefreshRate(QString deviceName) return 0; } +void KyNetworkDeviceResourse::getDeviceConnectivity(const QString &deviceName, NetworkManager::Connectivity &connectivity) +{ + connectivity = NetworkManager::Connectivity::UnknownConnectivity; + QString dbusPath; + NetworkManager::Device::Ptr connectDevice = + m_networkResourceInstance->findDeviceInterface(deviceName); + if (connectDevice != nullptr && connectDevice->isValid()) { + dbusPath = connectDevice->uni(); + } else { + qWarning() << "[KyNetworkDeviceResourse] can not find device " << deviceName; + return; + } + + QDBusInterface *ip4ConnectivityDbus = new QDBusInterface("org.freedesktop.NetworkManager", + dbusPath, + "org.freedesktop.DBus.Properties", + QDBusConnection::systemBus()); + + if (ip4ConnectivityDbus == nullptr || !ip4ConnectivityDbus->isValid()) { + qWarning() << "[KyNetworkDeviceResourse] get device properties failed"; + return; + } + + QDBusReply reply = ip4ConnectivityDbus->call("Get", "org.freedesktop.NetworkManager.Device", "Ip4Connectivity"); + + if (reply.isValid()) { + connectivity = (NetworkManager::Connectivity) reply.value().toUInt(); + } else { + qWarning() << "[KyNetworkDeviceResourse] get device properties failed"; + } + + delete ip4ConnectivityDbus; + ip4ConnectivityDbus = nullptr; +} + bool KyNetworkDeviceResourse::getActiveConnectionInfo(const QString devName, int &signalStrength, QString &uni, QString &secuType) { signalStrength = 0; @@ -279,6 +315,91 @@ bool KyNetworkDeviceResourse::getActiveConnectionInfo(const QString devName, int } } +const QMap g_bFreqs = { + {2412, 1}, + {2417, 2}, + {2422, 3}, + {2427, 4}, + {2432, 5}, + {2437, 6}, + {2442, 7}, + {2447, 8}, + {2452, 9}, + {2457, 10}, + {2462, 11}, + {2467, 12}, + {2472, 13}, + {2484, 14} +}; + +const QMap g_aFreqs = { + {5035, 7}, + {5040, 8}, + {5045, 9}, + {5055, 11}, + {5060, 12}, + {5080, 16}, + {5170, 34}, + {5180, 36}, + {5190, 38}, + {5200, 40}, + {5210, 42}, + {5220, 44}, + {5230, 46}, + {5240, 48}, + {5260, 52}, + {5280, 56}, + {5300, 60}, + {5320, 64}, + {5500, 100}, + {5520, 104}, + {5540, 108}, + {5560, 112}, + {5580, 116}, + {5600, 120}, + {5620, 124}, + {5640, 128}, + {5660, 132}, + {5680, 136}, + {5700, 140}, + {5745, 149}, + {5765, 153}, + {5785, 157}, + {5805, 161}, + {5825, 165}, + {4915, 183}, + {4920, 184}, + {4925, 185}, + {4935, 187}, + {4940, 188}, + {4945, 189}, + {4960, 192}, + {4980, 196} +}; + +uint KyNetworkDeviceResourse::kyFindChannel(uint freq) +{ + uint channel = 0; + QMap freqMap; + if (freq < 2500) { + freqMap = g_bFreqs; + } else { + freqMap = g_aFreqs; + } + for (auto freqKey : freqMap.keys()) { + if (freqKey <= freq) { + channel = freqMap.value(freqKey); + if (freqKey == freq) { + break; + } + } else { + break; + } + } + + return channel; +} + void KyNetworkDeviceResourse::getDeviceActiveAPInfo(const QString devName, QString &strMac, uint &iHz, uint &iChan, QString &secuType) { strMac.clear(); @@ -305,7 +426,7 @@ void KyNetworkDeviceResourse::getDeviceActiveAPInfo(const QString devName, QStri } strMac = apPtr->hardwareAddress(); iHz = apPtr->frequency(); - iChan = NetworkManager::findChannel(iHz); + iChan = kyFindChannel(iHz); NetworkManager::AccessPoint::Capabilities cap = apPtr->capabilities(); NetworkManager::AccessPoint::WpaFlags wpaFlag = apPtr->wpaFlags(); NetworkManager::AccessPoint::WpaFlags rsnFlag = apPtr->rsnFlags(); @@ -330,22 +451,28 @@ int KyNetworkDeviceResourse::getWirelessDeviceCapability(const QString deviceNam NetworkManager::WirelessDevice *wirelessDevicePtr = qobject_cast(connectDevice.data()); - int cap = 0; + int cap = 0x00; if (wirelessDevicePtr->wirelessCapabilities() & NetworkManager::WirelessDevice::ApCap) { - cap = cap | 0x01; - } - if (wirelessDevicePtr->wirelessCapabilities() & NetworkManager::WirelessDevice::Freq2Ghz) { cap = cap | 0x02; + } else { + return 0x01; } - if (wirelessDevicePtr->wirelessCapabilities() & NetworkManager::WirelessDevice::Freq5Ghz) { - cap = cap | 0x04; + QDBusInterface dbusInterface("org.freedesktop.NetworkManager", + connectDevice->uni(), + "org.freedesktop.NetworkManager.Device.Wireless", + QDBusConnection::systemBus()); + + QDBusReply reply = dbusInterface.call("GetHotspotCapabilities"); + if (reply.isValid()) { + if (reply.value() == 1) { + cap = cap | 0x04; + } } return cap; } else { qWarning()<<"[KyNetworkDeviceResourse]"<findDeviceInterface(deviceName); @@ -392,9 +519,14 @@ bool KyNetworkDeviceResourse::deviceIsWired(QString deviceName) return false; } - if (NetworkManager::Device::Type::Ethernet == devicePtr->type() - && !devicePtr->udi().startsWith(VIRTURAL_DEVICE_PATH)) { - return true; + if (deviceType == devicePtr->type()) { + if (NetworkManager::Device::Type::Ethernet == deviceType) { + if (!devicePtr->udi().startsWith(VIRTURAL_DEVICE_PATH)) { + return true; + } + } else { + return true; + } } return false; @@ -412,6 +544,25 @@ void KyNetworkDeviceResourse::setDeviceManaged(QString devName, bool managed) return; } setDeviceManagedByGDbus(dbusPath, managed); +#if 0 + QDBusInterface dbusInterface("org.freedesktop.NetworkManager", + dbusPath, + "org.freedesktop.NetworkManager.Device", + QDBusConnection::systemBus()); + + if (!dbusInterface.isValid()) { + qWarning() << dbusPath << "invalid"; + setDeviceManagedByGDbus(dbusPath, managed); + return; + } + + QDBusReply reply = dbusInterface.call("SetStateDevice", "", managed); + if (!reply.isValid()) { + qWarning() << "SetStateDevice error" << reply.error().message(); + setDeviceManagedByGDbus(dbusPath, managed); + return; + } +#endif } bool KyNetworkDeviceResourse::getDeviceManaged(QString deviceName) diff --git a/src/backend/dbus-interface/kylinnetworkdeviceresource.h b/src/backend/dbus-interface/kylinnetworkdeviceresource.h index 4e619068..ded05234 100644 --- a/src/backend/dbus-interface/kylinnetworkdeviceresource.h +++ b/src/backend/dbus-interface/kylinnetworkdeviceresource.h @@ -62,7 +62,7 @@ public: bool wiredDeviceIsCarriered(QString deviceName); bool wirelessDeviceIsExist(const QString devName); - bool deviceIsWired(QString deviceName); + bool checkDeviceType(QString deviceName, NetworkManager::Device::Type deviceType); void setDeviceRefreshRate(QString deviceName, int ms); @@ -72,12 +72,16 @@ public: qulonglong getDeviceRxRefreshRate(QString deviceName); qulonglong getDeviceTxRefreshRate(QString deviceName); + void getDeviceConnectivity(const QString &deviceName, NetworkManager::Connectivity &connectivity); + +private: + void initDeviceMap(); + uint kyFindChannel(uint freq); + private: KyWiredConnectOperation wiredOperation; KyNetworkResourceManager *m_networkResourceInstance = nullptr; QStringList m_activeConnectUuidList; QMap m_deviceMap; - - void initDeviceMap(); }; #endif // KYLINNETORKDEVICERESOURCE_H diff --git a/src/backend/dbus-interface/kylinnetworkresourcemanager.cpp b/src/backend/dbus-interface/kylinnetworkresourcemanager.cpp index bf27def8..e0a0323e 100644 --- a/src/backend/dbus-interface/kylinnetworkresourcemanager.cpp +++ b/src/backend/dbus-interface/kylinnetworkresourcemanager.cpp @@ -227,6 +227,11 @@ void KyNetworkResourceManager::removeDevice(int pos) { //connections signals NetworkManager::Device::Ptr device = m_devices.takeAt(pos); + + QDBusConnection::systemBus().disconnect(QString("org.freedesktop.NetworkManager"), + device.data()->uni(), + QString("org.freedesktop.NetworkManager.Device"), + QString("AcdIpProbed"), this, SIGNAL(needShowDesktop(QString))); device->disconnect(this); } @@ -302,6 +307,10 @@ void KyNetworkResourceManager::addDevice(NetworkManager::Device::Ptr device) //TODO: other device types! break; } + QDBusConnection::systemBus().connect(QString("org.freedesktop.NetworkManager"), + device.data()->uni(), + QString("org.freedesktop.NetworkManager.Device"), + QString("AcdIpProbed"), this, SIGNAL(needShowDesktop(QString))); } void KyNetworkResourceManager::insertDevices() @@ -448,8 +457,8 @@ NetworkManager::Connection::Ptr KyNetworkResourceManager::getConnect(const QStri int index = 0; NetworkManager::Connection::Ptr connectPtr = nullptr; - qDebug() <<"[KyNetworkResourceManager]" << "get connect with uuid" << connectUuid; if (connectUuid.isEmpty()) { + qWarning() << "[KyNetworkResourceManager]" << "get connect with uuid is empty"; return nullptr; } @@ -463,8 +472,7 @@ NetworkManager::Connection::Ptr KyNetworkResourceManager::getConnect(const QStri return connectPtr; } } - - qWarning()<<"[KyNetworkResourceManager]"<<"it can not find connect with uuid"<interfaceName(); connectSetting.m_isAutoConnect = connectionSettings->autoconnect(); - if (connectionSettings->connectionType() != NetworkManager::ConnectionSettings::Vpn) { - return ; + if (NetworkManager::ConnectionSettings::ConnectionType::Vpn != connectPtr->settings()->connectionType() + && NetworkManager::ConnectionSettings::ConnectionType::Bond != connectPtr->settings()->connectionType() + && NetworkManager::ConnectionSettings::ConnectionType::Bridge != connectPtr->settings()->connectionType() + && NetworkManager::ConnectionSettings::ConnectionType::Vlan != connectPtr->settings()->connectionType() + && NetworkManager::ConnectionSettings::ConnectionType::Team != connectPtr->settings()->connectionType() + && NetworkManager::ConnectionSettings::ConnectionType::IpTunnel != connectPtr->settings()->connectionType() + && NetworkManager::ConnectionSettings::ConnectionType::Wired != connectPtr->settings()->connectionType()) { + return; } QDBusPendingReply reply = connectPtr->secrets(KYVPN_VPN_KEY); @@ -1481,7 +1487,13 @@ void KyVpnConnectOperation::activateVpnConnection(const QString connectUuid) return; } - if (NetworkManager::ConnectionSettings::Vpn != connectPtr->settings()->connectionType()) { + if (NetworkManager::ConnectionSettings::ConnectionType::Vpn != connectPtr->settings()->connectionType() + && NetworkManager::ConnectionSettings::ConnectionType::Bond != connectPtr->settings()->connectionType() + && NetworkManager::ConnectionSettings::ConnectionType::Bridge != connectPtr->settings()->connectionType() + && NetworkManager::ConnectionSettings::ConnectionType::Vlan != connectPtr->settings()->connectionType() + && NetworkManager::ConnectionSettings::ConnectionType::Team != connectPtr->settings()->connectionType() + && NetworkManager::ConnectionSettings::ConnectionType::IpTunnel != connectPtr->settings()->connectionType() + && NetworkManager::ConnectionSettings::ConnectionType::Wired != connectPtr->settings()->connectionType()) { QString errorMessage = tr("the connect type is") + connectPtr->settings()->connectionType() + tr(", but it is not vpn"); diff --git a/src/backend/dbus-interface/kywirelessconnectoperation.cpp b/src/backend/dbus-interface/kywirelessconnectoperation.cpp index 6e44439e..c2993394 100644 --- a/src/backend/dbus-interface/kywirelessconnectoperation.cpp +++ b/src/backend/dbus-interface/kywirelessconnectoperation.cpp @@ -455,8 +455,15 @@ QString KyWirelessConnectOperation::getPrivateKeyPassword(const QString &connect qWarning()< reply = connectPtr->secrets(PRIVATE_PSK_SETTING_NAME); - QMap map(reply.value()); + QDBusInterface dbusInterface("org.freedesktop.NetworkManager", + connectPtr->path(), + "org.freedesktop.NetworkManager.Settings.Connection", + QDBusConnection::systemBus()); + dbusInterface.setTimeout(500); + QDBusMessage result = dbusInterface.call("GetSecrets", PRIVATE_PSK_SETTING_NAME); + const QDBusArgument &dbusArg1st = result.arguments().at( 0 ).value(); + QMap map; + dbusArg1st >> map; if (map.contains("802-1x") && map.value("802-1x").contains("private-key-password")) { QString psk = map.value("802-1x").value("private-key-password").toString(); @@ -475,8 +482,19 @@ QString KyWirelessConnectOperation::get8021xPassword(const QString &connectUuid) qWarning()< reply = connectPtr->secrets(PRIVATE_PSK_SETTING_NAME); - QMap map(reply.value()); + + QDBusInterface dbusInterface("org.freedesktop.NetworkManager", + connectPtr->path(), + "org.freedesktop.NetworkManager.Settings.Connection", + QDBusConnection::systemBus()); + dbusInterface.setTimeout(500); + QDBusMessage result = dbusInterface.call("GetSecrets", PRIVATE_PSK_SETTING_NAME); + const QDBusArgument &dbusArg1st = result.arguments().at( 0 ).value(); + QMap map; + dbusArg1st >> map; + +// QDBusPendingReply reply = connectPtr->secrets(PRIVATE_PSK_SETTING_NAME); +// QMap map(reply.value()); if (map.contains("802-1x") && map.value("802-1x").contains("password")) { QString psk = map.value("802-1x").value("password").toString(); @@ -1212,6 +1230,9 @@ void KyWirelessConnectOperation::updateWirelessApSetting( NMVariantMapMap newMap = apConnectSettingPtr->toMap(); if (newMap.contains(KEY_802_11_WIRELESS)) { newMap[KEY_802_11_WIRELESS].insert(KEY_BLACKLIST_HOSTNAME, blackList); + if (wirelessBand == WIFI_BAND_2_4GHZ) { + newMap[KEY_802_11_WIRELESS].remove("channel"); + } } apConnectPtr->update(newMap); usleep(100*1000); diff --git a/src/backend/dbus-interface/kywirelessnetitem.cpp b/src/backend/dbus-interface/kywirelessnetitem.cpp index 11ed55e4..1826cbf6 100644 --- a/src/backend/dbus-interface/kywirelessnetitem.cpp +++ b/src/backend/dbus-interface/kywirelessnetitem.cpp @@ -18,11 +18,14 @@ * */ #include "kywirelessnetitem.h" +#include "kylinactiveconnectresource.h" #include #include "kylinutil.h" const QString ENTERPRICE_TYPE = "802.1X"; -const QString WPA1_AND_WPA2 = "WPA"; +//const QString WPA1_AND_WPA2 = "WPA"; +const QString WPA1 = "WPA1"; +const QString WPA2 = "WPA2"; const QString WPA3 = "WPA3"; #define FREQ_5GHZ 5000 @@ -57,15 +60,31 @@ void KyWirelessNetItem::init(NetworkManager::WirelessNetwork::Ptr net) // m_NetSsid = net->ssid(); NetworkManager::AccessPoint::Ptr accessPointPtr = net->referenceAccessPoint(); + if (accessPointPtr->ssid().isEmpty()) { + qDebug() << accessPointPtr->uni() << "ssid isEmpty"; + NetworkManager::AccessPoint::List list = net->accessPoints(); + if (list.size() > 1) { + for (int i = 0; i < list.size(); ++i) { + if (!list.at(i)->ssid().isEmpty()) { + qDebug() << "use" << accessPointPtr->uni(); + accessPointPtr = list.at(i); + break; + } + } + } + } + if (accessPointPtr->ssid().isEmpty()) { + return; + } QByteArray rawSsid = accessPointPtr->rawSsid(); m_NetSsid = getSsidFromByteArray(rawSsid); - m_signalStrength = net->signalStrength(); - m_frequency = net->referenceAccessPoint()->frequency(); + m_signalStrength = accessPointPtr->signalStrength(); + m_frequency = accessPointPtr->frequency(); m_channel = NetworkManager::findChannel(m_frequency); - NetworkManager::AccessPoint::Capabilities cap = net->referenceAccessPoint()->capabilities(); - NetworkManager::AccessPoint::WpaFlags wpaFlag = net->referenceAccessPoint()->wpaFlags(); - NetworkManager::AccessPoint::WpaFlags rsnFlag = net->referenceAccessPoint()->rsnFlags(); + NetworkManager::AccessPoint::Capabilities cap = accessPointPtr->capabilities(); + NetworkManager::AccessPoint::WpaFlags wpaFlag = accessPointPtr->wpaFlags(); + NetworkManager::AccessPoint::WpaFlags rsnFlag = accessPointPtr->rsnFlags(); m_secuType = enumToQstring(cap, wpaFlag, rsnFlag); // if (m_secuType.indexOf(ENTERPRICE_TYPE) >= 0) { // m_kySecuType = WPA_AND_WPA2_ENTERPRISE; @@ -75,9 +94,9 @@ void KyWirelessNetItem::init(NetworkManager::WirelessNetwork::Ptr net) // m_kySecuType = WPA_AND_WPA2_PERSONAL; // } setKySecuType(m_secuType); - m_bssid = net->referenceAccessPoint()->hardwareAddress(); + m_bssid = accessPointPtr->hardwareAddress(); m_device = net->device(); - m_uni = net->referenceAccessPoint()->uni(); + m_uni = accessPointPtr->uni(); NetworkManager::Device::Ptr devicePtr = nullptr; devicePtr = m_networkResourceInstance->findDeviceInterface(m_device); @@ -131,38 +150,7 @@ void KyWirelessNetItem::init(NetworkManager::WirelessNetwork::Ptr net) } } } - initInfoBySsid(); -} - -void KyWirelessNetItem::initInfoBySsid() -{ - for (auto const & conn : m_networkResourceInstance->m_connections) { - NetworkManager::ConnectionSettings::Ptr settings = conn->settings(); - if (settings->connectionType() != NetworkManager::ConnectionSettings::Wireless) { - continue; - } - - NetworkManager::WirelessSetting::Ptr wifi_sett - = settings->setting(NetworkManager::Setting::Wireless).dynamicCast(); - QString devName = m_networkResourceInstance->findDeviceUni(m_device)->interfaceName(); - QByteArray rawSsid = wifi_sett->ssid(); - QString wifiSsid = getSsidFromByteArray(rawSsid); - if (wifiSsid == m_NetSsid - && (settings->interfaceName().compare(devName) == 0 || settings->interfaceName().isEmpty())) { - m_connectUuid = settings->uuid(); - m_connName = conn->name(); - m_connDbusPath = conn->path(); - m_isConfigured = true; - /* - * 如果有激活的链接,则取激活的链接,没有则取最后一个,因为一个热点可以创建多个链接 - */ - if (nullptr != m_networkResourceInstance->getActiveConnect(m_connectUuid)) { - break; - } - } - } - - return; + updatewirelessItemConnectInfo(*this); } int KyWirelessNetItem::getCategory(QString uni) @@ -189,14 +177,84 @@ void KyWirelessNetItem::setKySecuType(QString strSecuType) if (strSecuType.indexOf(ENTERPRICE_TYPE) >= 0) { m_kySecuType = WPA_AND_WPA2_ENTERPRISE; } else if (strSecuType.indexOf(WPA3) >= 0) { - if (strSecuType.indexOf(WPA1_AND_WPA2) >= 0) { + if (strSecuType.indexOf(WPA1) >= 0 || strSecuType.indexOf(WPA2) >= 0) { m_kySecuType = WPA_AND_WPA3; } else { m_kySecuType = WPA3_PERSONAL; } - } else if ( strSecuType.indexOf(WPA1_AND_WPA2) >= 0) { + } else if ( strSecuType.indexOf(WPA1) >= 0 || strSecuType.indexOf(WPA2) >= 0) { m_kySecuType = WPA_AND_WPA2_PERSONAL; } else { m_kySecuType = NONE; } } + +void updatewirelessItemConnectInfo(KyWirelessNetItem& item) +{ + KyNetworkResourceManager *networkResourceInstance = KyNetworkResourceManager::getInstance(); + + bool findHotspot = false; + bool findInfrastructure = false; + + KyWirelessNetItem hotspotItem; + KyWirelessNetItem connectItem; + + for (auto const & conn : networkResourceInstance->m_connections) { + NetworkManager::ConnectionSettings::Ptr settings = conn->settings(); + if (settings->connectionType() != NetworkManager::ConnectionSettings::Wireless) { + continue; + } + + NetworkManager::WirelessSetting::Ptr wifi_sett + = settings->setting(NetworkManager::Setting::Wireless).dynamicCast(); + QString devName = networkResourceInstance->findDeviceUni(item.getDevice())->interfaceName(); + QByteArray rawSsid = wifi_sett->ssid(); + QString wifiSsid = getSsidFromByteArray(rawSsid); + if (wifiSsid == item.m_NetSsid + && (settings->interfaceName().compare(devName) == 0 || settings->interfaceName().isEmpty())) { + /* + * 如果有激活的链接,则取激活的链接,没有则取最后一个,因为一个热点可以创建多个链接, 有WIFI的则用WIFI,否则用adhoc + */ + KyActiveConnectResourse actResource; + KyConnectItem * kyItem = actResource.getActiveConnectionByUuid(settings->uuid(), devName); + if (nullptr != kyItem) { + item.m_connectUuid = settings->uuid(); + item.m_connName = conn->name(); + item.m_connDbusPath = conn->path(); + item.m_isConfigured = true; + return; + } + + if (wifi_sett->mode() != NetworkManager::WirelessSetting::NetworkMode::Infrastructure) { + hotspotItem.m_connectUuid = settings->uuid(); + hotspotItem.m_connName = conn->name(); + hotspotItem.m_connDbusPath = conn->path(); + hotspotItem.m_isConfigured = true; + findHotspot = true; + } else { + connectItem.m_connectUuid = settings->uuid(); + connectItem.m_connName = conn->name(); + connectItem.m_connDbusPath = conn->path(); + connectItem.m_isConfigured = true; + findInfrastructure = true; + } + } + } + + if (findInfrastructure) { + item.m_connectUuid = connectItem.m_connectUuid; + item.m_connName = connectItem.m_connName; + item.m_connDbusPath = connectItem.m_connDbusPath; + item.m_isConfigured = connectItem.m_isConfigured; + } else if (findHotspot) { + item.m_connectUuid = hotspotItem.m_connectUuid; + item.m_connName = hotspotItem.m_connName; + item.m_connDbusPath = hotspotItem.m_connDbusPath; + item.m_isConfigured = hotspotItem.m_isConfigured; + } else { + item.m_connectUuid.clear(); + item.m_connName.clear(); + item.m_connDbusPath.clear(); + item.m_isConfigured = false; + } +} diff --git a/src/backend/dbus-interface/kywirelessnetitem.h b/src/backend/dbus-interface/kywirelessnetitem.h index 9b953ba0..2a5a4682 100644 --- a/src/backend/dbus-interface/kywirelessnetitem.h +++ b/src/backend/dbus-interface/kywirelessnetitem.h @@ -32,9 +32,12 @@ public: KyWirelessNetItem() {;} ~KyWirelessNetItem(); + QString getDevice() { + return m_device; + } + private: void init(NetworkManager::WirelessNetwork::Ptr net); - void initInfoBySsid(); public: QString m_NetSsid; @@ -62,4 +65,6 @@ private: }; +void updatewirelessItemConnectInfo(KyWirelessNetItem& item); + #endif // KYWIRELESSNETITEM_H diff --git a/src/backend/dbus-interface/kywirelessnetresource.cpp b/src/backend/dbus-interface/kywirelessnetresource.cpp index 95e70bd2..db880c5e 100644 --- a/src/backend/dbus-interface/kywirelessnetresource.cpp +++ b/src/backend/dbus-interface/kywirelessnetresource.cpp @@ -252,6 +252,7 @@ bool KyWirelessNetResource::getActiveWirelessNetItem(QString deviceName, KyWirel for (int index = 0; index < m_WifiNetworkList[deviceName].size(); index ++) { if (m_WifiNetworkList[deviceName].at(index).m_NetSsid == ssid) { wirelessNetItem = m_WifiNetworkList[deviceName].at(index); + updatewirelessItemConnectInfo(wirelessNetItem); qDebug()<< LOG_FLAG << "getWifiNetwork success"; return true; } @@ -358,6 +359,9 @@ void KyWirelessNetResource::kyWirelessNetItemListInit() } KyWirelessNetItem item(net); + if (item.m_NetSsid.isEmpty()) { + continue; + } if (!m_WifiNetworkList.contains(devIface)){ QList list; list.append(item); @@ -404,6 +408,12 @@ void KyWirelessNetResource::onWifiNetworkAdded(QString devIfaceName, QString ssi KyWirelessNetItem item(wifi); if (m_WifiNetworkList.contains(devIfaceName)) { + for (int index = 0; index < m_WifiNetworkList[devIfaceName].size(); ++index) { + if (m_WifiNetworkList[devIfaceName].at(index).m_NetSsid == item.m_NetSsid) { + m_WifiNetworkList[devIfaceName].removeAt(index); + index--; + } + } m_WifiNetworkList[devIfaceName].append(item); } else { QList list; @@ -416,18 +426,20 @@ void KyWirelessNetResource::onWifiNetworkAdded(QString devIfaceName, QString ssi void KyWirelessNetResource::onWifiNetworkRemoved(QString devIfaceName, QString ssid) { - if (m_WifiNetworkList.contains(devIfaceName)) { - int index = 0; - for ( ; index < m_WifiNetworkList.value(devIfaceName).size(); index++) { - if ( m_WifiNetworkList[devIfaceName].at(index).m_NetSsid == ssid) { - m_WifiNetworkList[devIfaceName].removeAt(index); + if (!m_WifiNetworkList.contains(devIfaceName)) { + return; + } + + for (int index = 0; index < m_WifiNetworkList.value(devIfaceName).size(); ++index) { + if (m_WifiNetworkList[devIfaceName].at(index).m_NetSsid == ssid) { + m_WifiNetworkList[devIfaceName].removeAt(index); + //remove后为空则删除 + if (m_WifiNetworkList.value(devIfaceName).isEmpty()) { + m_WifiNetworkList.remove(devIfaceName); } + Q_EMIT wifiNetworkRemove(devIfaceName,ssid); + break; } - //remove后为空则删除 - if (m_WifiNetworkList.value(devIfaceName).isEmpty()) { - m_WifiNetworkList.remove(devIfaceName); - } - Q_EMIT wifiNetworkRemove(devIfaceName,ssid); } } @@ -523,7 +535,7 @@ bool KyWirelessNetResource::getEnterPriseInfoTls(QString &uuid, KyEapMethodTlsIn info.identity = setting->identity(); info.domain = setting->domainSuffixMatch(); - info.caCertPath = setting->caPath(); + info.caCertPath = setting->caCertificate(); if (info.caCertPath.left(7) == "file://") { info.caCertPath = info.caCertPath.mid(7); } @@ -846,8 +858,48 @@ void KyWirelessNetResource::onConnectionUpdate(QString uuid) return; } - m_WifiNetworkList.clear(); - kyWirelessNetItemListInit(); + QString ssid, dev; + getSsidByUuid(uuid, ssid); + getDeviceByUuid(uuid, dev); + + if (!dev.isEmpty()) { + NetworkManager::Device::Ptr devicePtr = m_networkResourceInstance->findDeviceInterface(dev); + if (devicePtr.isNull() || !m_WifiNetworkList.contains(dev)) { + return; + } + } + + QMap >::iterator iter; + for (iter = m_WifiNetworkList.begin(); iter != m_WifiNetworkList.end(); ++iter) { + QList::iterator itemIter; + for (itemIter = iter.value().begin(); itemIter != iter.value().end(); ++itemIter) { + //判断是否有其他wifi配置 更新WIFI-bd 的connect相关变量 emit update + if (uuid == itemIter->m_connectUuid) { + if (itemIter->m_NetSsid != ssid || + (iter.key() != dev && !dev.isEmpty())) { + updatewirelessItemConnectInfo(*itemIter); + Q_EMIT connectionUpdate(iter.key(), itemIter->m_NetSsid); + + //判断netptr是否为空 空返回 + //否则 更新ssid 的connect相关变量 emit update ssid + NetworkManager::Device::Ptr devicePtr = m_networkResourceInstance->findDeviceInterface(dev); + NetworkManager::WirelessNetwork::Ptr netPtr = m_networkResourceInstance->findWifiNetwork(ssid, devicePtr->uni()); + if (netPtr.isNull()) { + qDebug() << LOG_FLAG << ssid << "netPtr is Null"; + return; + } + } + } + //更新WIFI 的connect相关变量 emit update to ui + if (ssid == itemIter->m_NetSsid) { + if (iter.key() == dev || dev.isEmpty()) { + updatewirelessItemConnectInfo(*itemIter); + Q_EMIT connectionUpdate(dev, itemIter->m_NetSsid); + } + } + break; + } + } Q_EMIT wifiNetworkUpdate(); } diff --git a/src/backend/dbus-interface/kywirelessnetresource.h b/src/backend/dbus-interface/kywirelessnetresource.h index 850ca14c..96d7cb4b 100644 --- a/src/backend/dbus-interface/kywirelessnetresource.h +++ b/src/backend/dbus-interface/kywirelessnetresource.h @@ -84,6 +84,7 @@ Q_SIGNALS: void secuTypeChange(QString, QString, QString); void connectionRemove(QString, QString, QString); void connectionAdd(QString, QString); + void connectionUpdate(QString, QString); void wifiNetworkUpdate(); void wifiNetworkAdd(QString, KyWirelessNetItem&); void wifiNetworkRemove(QString, QString); diff --git a/src/backend/dbusadaptor.h b/src/backend/dbusadaptor.h index 3185e3c7..7315f0d3 100644 --- a/src/backend/dbusadaptor.h +++ b/src/backend/dbusadaptor.h @@ -63,7 +63,7 @@ public Q_SLOTS: // METHODS // Q_NOREPLY void setDefaultWirelessDevice(QString deviceName); // QString getDefaultWirelessDevice(); //刪除 根据网络名称 参数1 0:lan 1:wlan 参数2 为ssid/uuid - Q_NOREPLY void deleteConnect(int type, QString ssid); + void deleteConnect(int type, QString ssid); //连接 根据网卡类型 参数1 0:lan 1:wlan 参数3 为ssid/uuid Q_NOREPLY void activateConnect(int type, QString devName, QString ssid); //断开连接 根据网卡类型 参数1 0:lan 1:wlan 参数3 为ssid/uuid @@ -112,6 +112,7 @@ Q_SIGNALS: // SIGNALS void deactivateFailed(QString errorMessage); //设备插拔 void deviceStatusChanged(); + void wirelessDeviceStatusChanged(); void deviceNameChanged(QString oldName, QString newName, int type); void wirelessSwitchBtnChanged(bool state); //热点断开 diff --git a/src/frontend/enterprise-wlan/enterprisewlandialog.cpp b/src/frontend/enterprise-wlan/enterprisewlandialog.cpp index 189c8d2a..68cf2fcc 100644 --- a/src/frontend/enterprise-wlan/enterprisewlandialog.cpp +++ b/src/frontend/enterprise-wlan/enterprisewlandialog.cpp @@ -21,6 +21,9 @@ #include #include #include "xatom-helper.h" +#include "kwindowsystem.h" +#include "kwindowsystem_export.h" + #define MAIN_SIZE_EXPAND 480,580 #define MAIN_SIZE_NARROW 480,484 #define SCROAREA_WIDTH 480 @@ -48,9 +51,11 @@ EnterpriseWlanDialog::EnterpriseWlanDialog(KyWirelessNetItem &wirelessNetItem, Q // this->setWindowFlags(Qt::Dialog | Qt::FramelessWindowHint); //#endif this->setAttribute(Qt::WA_DeleteOnClose); - this->setWindowFlag(Qt::Window); +// this->setWindowFlag(Qt::Window); + this->setWindowFlags(Qt::Dialog); // this->setWindowTitle(tr("Connect Enterprise WLAN")); this->setWindowIcon(QIcon::fromTheme("kylin-network")); + KWindowSystem::setState(this->winId(), NET::SkipTaskbar | NET::SkipPager); m_wirelessNetItem = wirelessNetItem; m_deviceName = device; @@ -81,11 +86,17 @@ void EnterpriseWlanDialog::closeEvent(QCloseEvent *event) void EnterpriseWlanDialog::paintEvent(QPaintEvent *event) { -// QPalette pal = qApp->palette(); -// QPainter painter(this); -// painter.setBrush(pal.color(QPalette::Base)); -// painter.drawRect(this->rect()); -// painter.fillRect(rect(), QBrush(pal.color(QPalette::Base))); + QPalette pal = qApp->palette(); + QPainter painter(this); + QColor color; + if (this->isActiveWindow()) { + color = pal.color(QPalette::Base); + } else { + color = pal.color(QPalette::Background); + } + painter.setBrush(color); + painter.drawRect(this->rect()); + painter.fillRect(rect(), QBrush(color)); return QWidget::paintEvent(event); } @@ -126,17 +137,14 @@ void EnterpriseWlanDialog::initUI() m_enterWlanScrollArea = new QScrollArea(this); m_enterWlanScrollArea->setFrameShape(QFrame::NoFrame); m_enterWlanScrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + m_centerWidget->setFixedWidth(SCROAREA_WIDTH); m_enterWlanScrollArea->setFixedWidth(SCROAREA_WIDTH); m_enterWlanScrollArea->setWidget(m_centerWidget); m_enterWlanScrollArea->setWidgetResizable(true); + m_enterWlanScrollArea->setBackgroundRole(QPalette::Base); - QPalette pal = m_enterWlanScrollArea->palette(); - pal.setBrush(QPalette::Base, QColor(0,0,0,0)); - m_enterWlanScrollArea->setPalette(pal); - m_enterWlanScrollArea->setWidgetResizable(true); - - m_bottomDivider = new Divider(this); + m_bottomDivider = new Divider(false, this); QWidget *bottomWidget = new QWidget(this); QHBoxLayout *btnLayout = new QHBoxLayout(bottomWidget); @@ -158,7 +166,6 @@ void EnterpriseWlanDialog::initUI() this->setFixedSize(MAIN_SIZE_EXPAND); this->setWindowTitle(m_wirelessNetItem.m_NetSsid); initConnections(); - onPaletteChanged(); } void EnterpriseWlanDialog::centerToScreen() @@ -182,6 +189,7 @@ void EnterpriseWlanDialog::initConnections() m_connectBtn->setEnabled(status); }); +#if 0 connect(qApp, &QApplication::paletteChanged, this, &EnterpriseWlanDialog::onPaletteChanged); const QByteArray id(THEME_SCHAME); @@ -193,8 +201,10 @@ void EnterpriseWlanDialog::initConnections() } }); } +#endif } +#if 0 void EnterpriseWlanDialog::onPaletteChanged() { QPalette pal = qApp->palette(); @@ -218,6 +228,7 @@ void EnterpriseWlanDialog::onPaletteChanged() styleGsettings = nullptr; } } +#endif void EnterpriseWlanDialog::initData() { @@ -259,7 +270,7 @@ void EnterpriseWlanDialog::onBtnConnectClicked() } else if (eapType == KyEapMethodType::TTLS) { m_securityPage->updateTtlsChange(m_info.ttlsInfo); m_connectOperation->addAndActiveWirelessEnterPriseTtlsConnect(m_info.ttlsInfo, connetSetting, m_deviceName, false); - } else if (eapType == KyEapMethodType::LEAP) { + } else if (eapType == KyEapMethodType::LEAP) { m_securityPage->updateLeapChange(m_info.leapInfo); m_connectOperation->addAndActiveWirelessEnterPriseLeapConnect(m_info.leapInfo, connetSetting, m_deviceName, false); } else if (eapType == KyEapMethodType::PWD) { @@ -268,7 +279,7 @@ void EnterpriseWlanDialog::onBtnConnectClicked() } else if (eapType == KyEapMethodType::FAST) { m_securityPage->updateFastChange(m_info.fastInfo); m_connectOperation->addAndActiveWirelessEnterPriseFastConnect(m_info.fastInfo, connetSetting, m_deviceName, false); - } else { + } else { qWarning() << "Connect enterprise wlan failed!(Unknown eap type)" << Q_FUNC_INFO << __LINE__; } close(); diff --git a/src/frontend/enterprise-wlan/enterprisewlandialog.h b/src/frontend/enterprise-wlan/enterprisewlandialog.h index 42ecd338..50b0ba5c 100644 --- a/src/frontend/enterprise-wlan/enterprisewlandialog.h +++ b/src/frontend/enterprise-wlan/enterprisewlandialog.h @@ -83,7 +83,6 @@ private: private Q_SLOTS: void onBtnConnectClicked(); void onEapTypeChanged(const KyEapMethodType &type); - void onPaletteChanged(); Q_SIGNALS: void enterpriseWlanDialogClose(bool); diff --git a/src/frontend/frontend.pri b/src/frontend/frontend.pri index b7703595..324799cc 100644 --- a/src/frontend/frontend.pri +++ b/src/frontend/frontend.pri @@ -7,18 +7,15 @@ include(netdetails/netdetails.pri) include(enterprise-wlan/enterprise-wlan.pri) include(networkmode/networkmode.pri) -FORMS += \ - $$PWD/wificonfigdialog.ui +FORMS += HEADERS += \ $$PWD/customstyle.h \ - $$PWD/mainwindow.h \ - $$PWD/wificonfigdialog.h + $$PWD/mainwindow.h SOURCES += \ $$PWD/customstyle.cpp \ - $$PWD/mainwindow.cpp \ - $$PWD/wificonfigdialog.cpp + $$PWD/mainwindow.cpp DISTFILES += \ $$PWD/networkmode/networkmode.pri diff --git a/src/frontend/list-items/lanlistitem.cpp b/src/frontend/list-items/lanlistitem.cpp index 0bac6fd7..4ff1896d 100644 --- a/src/frontend/list-items/lanlistitem.cpp +++ b/src/frontend/list-items/lanlistitem.cpp @@ -55,7 +55,6 @@ LanListItem::LanListItem(const KyConnectItem *lanConnectItem, m_itemFrame->installEventFilter(this); // connect(this->m_infoButton, &InfoButton::clicked, this, &LanListItem::onInfoButtonClicked); - connect(m_menu, &QMenu::triggered, this, &LanListItem::onMenuTriggered); connect(m_hoverButton, &FixPushButton::clicked, this, &LanListItem::onNetButtonClicked); } @@ -275,7 +274,7 @@ void LanListItem::enterEvent(QEvent *event) void LanListItem::leaveEvent(QEvent *event) { m_hoverButton->hide(); - if (m_lanConnectItem.m_connectState == Activated) { + if (m_lanConnectItem.m_connectState == Activated || m_connectState == Deactivating) { m_nameLabel->setLabelMaximumWidth(NAMELABLE_MAX_WIDTH_ACTIVATED); m_lbLoadUp->show(); m_lbLoadDown->show(); diff --git a/src/frontend/list-items/listitem.cpp b/src/frontend/list-items/listitem.cpp index 7050a2e0..6fec84db 100644 --- a/src/frontend/list-items/listitem.cpp +++ b/src/frontend/list-items/listitem.cpp @@ -118,6 +118,16 @@ ListItem::ListItem(QWidget *parent) : QFrame(parent) initConnection(); connect(qApp, &QApplication::paletteChanged, this, &ListItem::onPaletteChanged); // m_itemFrame->installEventFilter(this); + const QByteArray id(THEME_SCHAME); + if (QGSettings::isSchemaInstalled(id)) { + QGSettings * styleGsettings = new QGSettings(id, QByteArray(), this); + connect(styleGsettings, &QGSettings::changed, this, [=](QString key){ + if ("themeColor" == key) { + onPaletteChanged(); + } + }); + } + onPaletteChanged(); } ListItem::~ListItem() @@ -158,8 +168,8 @@ void ListItem::showDesktopNotify(const QString &message, QString soundName) "org.freedesktop.Notifications", QDBusConnection::sessionBus()); QStringList actions; //跳转动作 - actions.append("kylin-nm"); - actions.append("default"); //默认动作:点击消息体时打开麒麟录音 + actions.append("default"); + actions.append("kylin-nm"); //默认动作:点击消息体时打开麒麟录音 QMap hints; if (!soundName.isEmpty()) { hints.insert("sound-name",soundName); //添加声音 @@ -286,15 +296,15 @@ void ListItem::initUI() m_hItemLayout->addWidget(m_netButton); m_hItemLayout->addSpacing(10); m_hItemLayout->addWidget(m_nameLabel); - m_hItemLayout->addSpacing(8); + m_hItemLayout->addSpacing(6); //设计稿间距为8 nameLabel宽度另+2 m_hItemLayout->addWidget(m_freq); m_hItemLayout->addStretch(); + m_hItemLayout->addSpacing(8); m_hItemLayout->addWidget(m_lbLoadUpImg); m_hItemLayout->addWidget(m_lbLoadUp); m_hItemLayout->addSpacing(2); m_hItemLayout->addWidget(m_lbLoadDownImg); m_hItemLayout->addWidget(m_lbLoadDown); - m_hItemLayout->addSpacing(2); m_hItemLayout->addWidget(m_hoverButton); // m_hItemLayout->addWidget(m_infoButton); @@ -320,6 +330,24 @@ void ListItem::onPaletteChanged() // QPalette pal = qApp->palette(); // pal.setColor(QPalette::Window, qApp->palette().base().color()); // this->setPalette(pal); + QPalette pal = qApp->palette(); + QGSettings * styleGsettings = nullptr; + const QByteArray style_id(THEME_SCHAME); + if (QGSettings::isSchemaInstalled(style_id)) { + styleGsettings = new QGSettings(style_id, QByteArray(), this); + QString currentTheme = styleGsettings->get(COLOR_THEME).toString(); + if(currentTheme == "ukui-default"){ + pal = themePalette(true, this); + } + } + pal.setColor(QPalette::Base, pal.color(QPalette::Base)); //解决Wayland环境this->setPalette(pal)不生效问题 + + this->setPalette(pal); + + if (m_menu != nullptr) { + pal.setColor(QPalette::Text, pal.color(QPalette::Text)); + m_menu->setPalette(pal); + } } NameLabel::NameLabel(QWidget *parent) @@ -356,10 +384,11 @@ void NameLabel::changedLabelSlot() QFontMetrics fontMetrics(this->font()); int fontSize = fontMetrics.width(m_name); if (fontSize > m_maximumWidth) { + this->setFixedWidth(m_maximumWidth - 2); setText(fontMetrics.elidedText(m_name, Qt::ElideRight, m_maximumWidth)); setToolTip(m_name); } else { - this->setFixedWidth(fontMetrics.width(m_name)); + this->setFixedWidth(fontMetrics.width(m_name) + 2); setText(m_name); setToolTip(""); } diff --git a/src/frontend/list-items/wlanlistitem.cpp b/src/frontend/list-items/wlanlistitem.cpp index 81fb6c68..bcd5aca7 100644 --- a/src/frontend/list-items/wlanlistitem.cpp +++ b/src/frontend/list-items/wlanlistitem.cpp @@ -25,8 +25,6 @@ #define EMPTY_SSID "EMPTY_SSID" #define LOG_FLAG "[WlanListItem]" #define WAIT_US 10*1000 -#define ENABLE_BUTTON_COLOR qApp->palette().highlight().color() -#define UNABLE_BUTTON_COLOR qApp->palette().button().color() #define NAMELABLE_MAX_WIDTH_HOVER 176 #define NAMELABLE_MAX_WIDTH_ACTIVATED 142 #define NAMELABLE_MAX_WIDTH_DEACTIVATED 276 @@ -35,17 +33,19 @@ const QString ENTERPRICE_TYPE = "802.1X"; const QString WPA1_AND_WPA2 = "WPA"; const QString WPA3 = "WPA3"; -WlanListItem::WlanListItem(KyWirelessNetItem &wirelessNetItem, QString device, bool isApMode, QWidget *parent) +WlanListItem::WlanListItem(KyWirelessNetItem &wirelessNetItem, QString device, bool isApMode, bool isShowWifi6Plus, QWidget *parent) : WlanListItem(wirelessNetItem, device, parent) { m_isApMode = isApMode; + m_isShowWifi6Plus = isShowWifi6Plus; refreshIcon(false); // 额外刷新一次图标,因为WlanListItem执行时,m_isApMode尚未赋值 } -WlanListItem::WlanListItem(KyWirelessNetItem &wirelessNetItem, QString device, QWidget *parent) : ListItem(parent) +WlanListItem::WlanListItem(KyWirelessNetItem &wirelessNetItem, QString device, bool isShowWifi6Plus, QWidget *parent) : ListItem(parent) { m_wlanDevice = device; m_wirelessNetItem = wirelessNetItem; + m_isShowWifi6Plus = isShowWifi6Plus; qDebug()<<"[WlanPage] wlan list item is created." << m_wirelessNetItem.m_NetSsid; @@ -53,7 +53,6 @@ WlanListItem::WlanListItem(KyWirelessNetItem &wirelessNetItem, QString device, Q setExpanded(false); // connect(this->m_infoButton, &InfoButton::clicked, this, &WlanListItem::onInfoButtonClicked); - connect(m_menu, &QMenu::triggered, this, &WlanListItem::onMenuTriggered); connect(m_hoverButton, &FixPushButton::clicked, this, &WlanListItem::onNetButtonClicked); m_wirelessConnectOperation = new KyWirelessConnectOperation(this); @@ -196,7 +195,6 @@ void WlanListItem::onRightButtonClicked() void WlanListItem::enterEvent(QEvent *event) { //qDebug()<< LOG_FLAG <<"enterEvent" << m_wirelessNetItem.m_NetSsid; - m_mouseIsOut = false; if (m_pwdFrame != nullptr && !m_pwdFrame->isVisible()) { if (Deactivated != m_connectState) { m_hoverButton->setProperty("useButtonPalette", true); @@ -220,9 +218,8 @@ void WlanListItem::enterEvent(QEvent *event) void WlanListItem::leaveEvent(QEvent *event) { //qDebug()<< LOG_FLAG <<"leaveEvent"<< m_wirelessNetItem.m_NetSsid; - m_mouseIsOut = true; m_hoverButton->hide(); - if (m_connectState == Activated) { + if (m_connectState == Activated || m_connectState == Deactivating) { m_nameLabel->setLabelMaximumWidth(NAMELABLE_MAX_WIDTH_ACTIVATED); m_lbLoadUp->show(); m_lbLoadDown->show(); @@ -231,12 +228,6 @@ void WlanListItem::leaveEvent(QEvent *event) } else { m_nameLabel->setLabelMaximumWidth(NAMELABLE_MAX_WIDTH_DEACTIVATED); } - if (m_pwdFrame && m_pwdFrame->isVisible()) { - if (m_focusIsOut) { - setExpanded(false); - } - return QFrame::leaveEvent(event); - } return ListItem::leaveEvent(event); } @@ -249,19 +240,6 @@ bool WlanListItem::eventFilter(QObject *watched, QEvent *event) } } - if (watched == m_pwdLineEdit) { - if (event->type() == QEvent::FocusOut) { - m_focusIsOut = true; - //qDebug()<< LOG_FLAG <<"focusOutEvent" << m_wirelessNetItem.m_NetSsid; - if (m_mouseIsOut) { - setExpanded(false); - } - } else if (event->type() == QEvent::FocusIn) { - //qDebug()<< LOG_FLAG <<"focusInEvent" << m_wirelessNetItem.m_NetSsid; - m_focusIsOut = false; - } - } - return QFrame::eventFilter(watched, event); } @@ -275,17 +253,6 @@ void WlanListItem::keyPressEvent(QKeyEvent *event) return QFrame::keyPressEvent(event); } -void WlanListItem::paintEvent(QPaintEvent *event) -{ - QPalette pal = qApp->palette(); - if (m_pwdLineEdit != nullptr) { - pal.setColor(QPalette::Base, pal.color(QPalette::Base)); - m_pwdLineEdit->setPalette(pal); - } - - return QWidget::paintEvent(event); -} - void WlanListItem::initWlanUI() { m_hasPwd = (m_wirelessNetItem.m_secuType.isEmpty() || m_wirelessNetItem.m_secuType == "") ? false : true; @@ -295,6 +262,7 @@ void WlanListItem::initWlanUI() //刷新左侧按钮图标 refreshIcon(false); + this->onPaletteChanged(); #define PWD_AREA_HEIGHT 36 #define CONNECT_BUTTON_WIDTH 96 #define FRAME_CONTENT_MARGINS 56,0,16,4 @@ -313,7 +281,7 @@ void WlanListItem::initWlanUI() m_pwdLineEdit = new KPasswordEdit(m_pwdFrame); m_pwdLineEdit->setFixedWidth(LINEEDIT_WIDTH); m_pwdLineEdit->setProperty("needTranslucent", true); - m_pwdLineEdit->setUseCustomPalette(true); + m_pwdLineEdit->setClearButtonEnabled(false); //禁用ClearBtn按钮 m_pwdLineEdit->setAttribute(Qt::WA_InputMethodEnabled, true); //打开输入法 // m_pwdLineEdit->setAttribute(Qt::WA_InputMethodEnabled, false); @@ -463,6 +431,10 @@ void WlanListItem::refreshIcon(bool isActivated) } } + if (!m_isShowWifi6Plus && category == 2) { + category = 1; + } + QString iconPath = getIcon(m_hasPwd, signalStrength, category); m_netButton->setButtonIcon(QIcon::fromTheme(iconPath)); @@ -528,7 +500,7 @@ void WlanListItem::onNetButtonClicked() } else { qDebug() << "KeyMgmt not support now " << type; } - //qDebug() << "!!!!" << m_wirelessNetItem.m_kySecuType << kySecuType; + //有配置或者无密码的wifi直接连接 if (m_wirelessNetItem.m_isConfigured) { if (m_wirelessNetItem.m_kySecuType == kySecuType || diff --git a/src/frontend/list-items/wlanlistitem.h b/src/frontend/list-items/wlanlistitem.h index e496b557..21b65ce0 100644 --- a/src/frontend/list-items/wlanlistitem.h +++ b/src/frontend/list-items/wlanlistitem.h @@ -54,8 +54,8 @@ class WlanListItem : public ListItem { Q_OBJECT public: - WlanListItem(KyWirelessNetItem &wirelessNetItem, QString device, bool isApMode, QWidget *parent = nullptr); - WlanListItem(KyWirelessNetItem &wirelessNetItem, QString device, QWidget *parent = nullptr); + WlanListItem(KyWirelessNetItem &wirelessNetItem, QString device, bool isApMode, bool isShowWifi6Plus, QWidget *parent = nullptr); + WlanListItem(KyWirelessNetItem &wirelessNetItem, QString device, bool isShowWifi6Plus, QWidget *parent = nullptr); WlanListItem(QWidget *parent = nullptr); ~WlanListItem(); @@ -91,7 +91,6 @@ 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); @@ -123,11 +122,9 @@ private: QCheckBox *m_autoConnectCheckBox = nullptr; QLabel *m_autoConnectLabel = nullptr; - bool m_focusIsOut = true; - bool m_mouseIsOut = true; - bool m_forgetConnection = false; bool m_isApMode = false; + bool m_isShowWifi6Plus = true; protected Q_SLOTS: void onInfoButtonClicked(); diff --git a/src/frontend/mainwindow.cpp b/src/frontend/mainwindow.cpp index 8462b535..78fdd72e 100644 --- a/src/frontend/mainwindow.cpp +++ b/src/frontend/mainwindow.cpp @@ -159,7 +159,7 @@ void MainWindow::firstlyStart() initDbusConnnect(); initWindowTheme(); initTrayIcon(); - initPlatform(); +// initPlatform(); installEventFilter(this); m_secondaryStartTimer = new QTimer(this); connect(m_secondaryStartTimer, &QTimer::timeout, this, [ = ]() { @@ -193,19 +193,19 @@ void MainWindow::secondaryStart() */ void MainWindow::initPlatform() { -// char* projectName = kdk_system_get_projectName(); -// QString strProjectName(projectName); -// free(projectName); -// projectName = NULL; -// if(v10Sp1.compare(strProjectName,Qt::CaseInsensitive) == 0) { -// unsigned int feature = kdk_system_get_productFeatures(); -// if (feature == 3) { -// m_isShowInCenter = true; -// } -// } else if (intel.compare(strProjectName,Qt::CaseInsensitive) == 0) { -// m_isShowInCenter = true; -// } -// qDebug() << "projectName" << projectName << m_isShowInCenter; + char* projectName = kdk_system_get_projectName(); + QString strProjectName(projectName); + free(projectName); + projectName = NULL; + if(v10Sp1.compare(strProjectName,Qt::CaseInsensitive) == 0) { + unsigned int feature = kdk_system_get_productFeatures(); + if (feature == 3) { + m_isShowInCenter = true; + } + } else if (intel.compare(strProjectName,Qt::CaseInsensitive) == 0) { + m_isShowInCenter = true; + } + qDebug() << "projectName" << projectName << m_isShowInCenter; } /** @@ -301,7 +301,7 @@ void MainWindow::onTransChanged() void MainWindow::paintWithTrans() { QPalette pal = m_centralWidget->palette(); - QColor color = qApp->palette().base().color(); + QColor color = this->palette().base().color(); color.setAlphaF(m_transparency); pal.setColor(QPalette::Base, color); m_centralWidget->setPalette(pal); @@ -309,7 +309,7 @@ void MainWindow::paintWithTrans() QPalette tabPal = m_centralWidget->tabBar()->palette(); tabPal.setColor(QPalette::Base, color); - QColor inactiveColor = qApp->palette().window().color(); + QColor inactiveColor = this->palette().window().color(); inactiveColor.setAlphaF(0.86 *m_transparency); tabPal.setColor(QPalette::Window, inactiveColor); @@ -321,6 +321,7 @@ void MainWindow::paintWithTrans() */ void MainWindow::initUI() { + setThemePalette(); m_centralWidget = new QTabWidget(this); this->setCentralWidget(m_centralWidget); m_centralWidget->tabBar()->setFixedWidth(this->width()+1); @@ -386,7 +387,8 @@ void MainWindow::initDbusConnnect() { connect(m_lanWidget, &LanPage::deviceStatusChanged, this, &MainWindow::deviceStatusChanged); connect(m_lanWidget, &LanPage::deviceNameChanged, this, &MainWindow::deviceNameChanged); - connect(m_wlanWidget, &WlanPage::deviceStatusChanged, this, &MainWindow::deviceStatusChanged); + + connect(m_wlanWidget, &WlanPage::wirelessDeviceStatusChanged, this, &MainWindow::wirelessDeviceStatusChanged); connect(m_wlanWidget, &WlanPage::deviceNameChanged, this, &MainWindow::deviceNameChanged); connect(m_wlanWidget, &WlanPage::wirelessSwitchBtnChanged, this, &MainWindow::wirelessSwitchBtnChanged); @@ -411,14 +413,28 @@ void MainWindow::initDbusConnnect() connect(m_wlanWidget, &WlanPage::secuTypeChange, this, &MainWindow::secuTypeChange); connect(m_wlanWidget, &WlanPage::signalStrengthChange, this, &MainWindow::signalStrengthChange); connect(m_wlanWidget, &WlanPage::timeToUpdate , this, &MainWindow::timeToUpdate); + + 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_lanWidget, &LanPage::lanConnectChanged, this, &MainWindow::onRefreshTrayIconTooltip); + connect(m_lanWidget, &LanPage::deviceStatusChanged, this, &MainWindow::onRefreshTrayIconTooltip); + connect(m_wlanWidget, &WlanPage::wlanConnectChanged, this, &MainWindow::onRefreshTrayIconTooltip); + connect(m_wlanWidget, &WlanPage::wirelessDeviceStatusChanged, this, &MainWindow::onRefreshTrayIconTooltip); + //模式切换 QDBusConnection::sessionBus().connect(QString("com.kylin.statusmanager.interfacer"), QString("/"), QString("com.kylin.statusmanager.interface"), QString("mode_change_signal"), this, SLOT(onTabletModeChanged(bool))); + + connect(KWindowSystem::self(), &KWindowSystem::activeWindowChanged, this,[&](WId activeWindowId){ + if (activeWindowId != this->winId() && activeWindowId != 0) { + qDebug() << "tray recieve KWindowSystem activeWindowChanged" << activeWindowId << this->winId(); + hideMainwindow(); + } + }); } /** @@ -426,7 +442,6 @@ void MainWindow::initDbusConnnect() */ void MainWindow::resetWindowPosition() { - if (m_isShowInCenter) { QRect availableGeometry = qApp->primaryScreen()->availableGeometry(); QRect rect((availableGeometry.width() - this->width())/2, (availableGeometry.height() - this->height())/2, @@ -582,7 +597,54 @@ void MainWindow::setCentralWidgetType(IconActiveType iconStatus) } } else { m_centralWidget->setCurrentIndex(LAN_PAGE_INDEX); - } + } +} + +/** + * @brief MainWindow::assembleTrayIconTooltip 整理托盘图标tooltip内容 + * @param map <网卡名,网络状态> + * @param tip tooltip + */ +void MainWindow::assembleTrayIconTooltip(QMap &map, QString &tip) +{ + if (map.isEmpty()) { + tip = QString(tr("Network tool")); + return; + } + QMap::iterator iter = map.begin(); + if (map.size() == 1) { + tip = map.value(iter.key()); + if (tip.indexOf(":")) { + tip = tip.mid(tip.indexOf(":") + 2); //单网卡显示时去掉“已连接: ”字样 + } + } else if (map.size() > 1) { + tip = ""; + int count = 0; + while (iter != map.end()) { + count += 1; + tip += QString(tr("Network Card")) + QString("%1").arg(count) + "\n" + map.value(iter.key()); + ++iter; + + if (iter != map.end()) { + tip += "\n"; + } + } + } +} + +void MainWindow::setThemePalette() +{ + QPalette pal = qApp->palette(); + QGSettings * styleGsettings = nullptr; + const QByteArray style_id(THEME_SCHAME); + if (QGSettings::isSchemaInstalled(style_id)) { + styleGsettings = new QGSettings(style_id, QByteArray(), this); + QString currentTheme = styleGsettings->get(COLOR_THEME).toString(); + if(currentTheme == "ukui-default"){ + pal = themePalette(true, this); + } + } + this->setPalette(pal); } /** @@ -619,8 +681,11 @@ void MainWindow::onThemeChanged(const QString &key) if (key == COLOR_THEME) { qDebug() << "Received signal of theme changed, will reset theme." << Q_FUNC_INFO << __LINE__; // resetWindowTheme(); + setThemePalette(); paintWithTrans(); Q_EMIT qApp->paletteChanged(qApp->palette()); + } else if ("themeColor" == key) { + setThemePalette(); } else { qDebug() << "Received signal of theme changed, key=" << key << " will do nothing." << Q_FUNC_INFO << __LINE__; } @@ -636,7 +701,10 @@ void MainWindow::onRefreshTrayIcon() iconStatus = IconActiveType::LAN_CONNECTED; } else if (m_wlanWidget->checkWlanStatus(NetworkManager::ActiveConnection::State::Activated)){ // m_trayIcon->setIcon(QIcon::fromTheme("network-wireless-connected-symbolic")); - signalStrength = m_wlanWidget->getAcivateWifiSignal(); + signalStrength = m_wlanWidget->getActivateWifiSignal(m_wlanWidget->getCurrentDisplayDevice()); + if (signalStrength == -1) { + signalStrength = m_wlanWidget->getActivateWifiSignal(); + } iconStatus = IconActiveType::WLAN_CONNECTED; } else { m_trayIcon->setIcon(QIcon::fromTheme("network-wired-disconnected-symbolic")); @@ -682,6 +750,11 @@ void MainWindow::onRefreshTrayIcon() m_trayIcon->setIcon(QIcon::fromTheme(NONE_SIGNAL_LIMIT_ICON)); } } + + if (signalStrength == -1) { + m_trayIcon->setIcon(QIcon::fromTheme("network-wired-disconnected-symbolic")); + } + onRefreshTrayIconTooltip(); } void MainWindow::onSetTrayIconLoading() @@ -733,6 +806,44 @@ void MainWindow::onTabletModeChanged(bool mode) hideMainwindow(); } +/** + * @brief MainWindow::onRefreshTrayIconTooltip 根据托盘图标调整其tooltip + */ +void MainWindow::onRefreshTrayIconTooltip() +{ + if (!m_trayIcon) { + return; + } + + QString trayIconToolTip = ""; + QMap lanMap; + QMap wlanMap; + switch(iconStatus) { + case IconActiveType::NOT_CONNECTED: + trayIconToolTip = QString(tr("Not connected to the network")); + break; + + case LAN_CONNECTED: + case IconActiveType::LAN_CONNECTED_LIMITED: + m_lanWidget->getWiredDeviceConnectState(lanMap); + assembleTrayIconTooltip(lanMap, trayIconToolTip); + break; + + case IconActiveType::WLAN_CONNECTED: + case IconActiveType::WLAN_CONNECTED_LIMITED: + m_wlanWidget->getWirelssDeviceConnectState(wlanMap); + assembleTrayIconTooltip(wlanMap, trayIconToolTip); + break; + + case IconActiveType::ACTIVATING: + default: + trayIconToolTip = QString(tr("Network tool")); + break; + } + + m_trayIcon->setToolTip(trayIconToolTip); +} + void MainWindow::onShowMainWindow(int type) { if (type == LANPAGE || type == WLANPAGE) { @@ -761,6 +872,19 @@ void MainWindow::onConnectivityChanged(NetworkManager::Connectivity connectivity onRefreshTrayIcon(); } +void MainWindow::onTimeUpdateTrayIcon() +{ + if (!m_trayIcon) { + return; + } + + if (iconStatus == ACTIVATING || (iconStatus != WLAN_CONNECTED && iconStatus != WLAN_CONNECTED_LIMITED)) { + return; + } + + onRefreshTrayIcon(); +} + /** * @brief MainWindow::keyPressEvent 按esc键关闭主界面 * @param event diff --git a/src/frontend/mainwindow.h b/src/frontend/mainwindow.h index c231f3fb..1c28ba9c 100644 --- a/src/frontend/mainwindow.h +++ b/src/frontend/mainwindow.h @@ -83,8 +83,9 @@ public: void getApConnectionPath(QString &path, QString uuid); //获取热点ActivePath void getActiveConnectionPath(QString &path, QString uuid); - //删除有线连接 - void deleteWired(const QString& connUuid); + + //有线连接删除 + void deleteWired(const QString &connUuid); //有线连接断开 void activateWired(const QString& devName, const QString& connUuid); void deactivateWired(const QString& devName, const QString& connUuid); @@ -115,6 +116,7 @@ public: Q_SIGNALS: //设备插拔 void deviceStatusChanged(); + void wirelessDeviceStatusChanged(); //设备名称变化 void deviceNameChanged(QString oldName, QString newName, int type); void wirelessSwitchBtnChanged(bool state); @@ -166,6 +168,9 @@ private: void showByWaylandHelper(); void setCentralWidgetType(IconActiveType iconStatus); + void assembleTrayIconTooltip(QMap &map, QString &tip); + void setThemePalette(); + double m_transparency=1.0; //透明度 QGSettings * m_transGsettings; //透明度配置文件 int currentIconIndex=0; @@ -222,7 +227,9 @@ private Q_SLOTS: void onLanConnectStatusToChangeTrayIcon(int state); void onWlanConnectStatusToChangeTrayIcon(int state); void onConnectivityChanged(NetworkManager::Connectivity connectivity); + void onTimeUpdateTrayIcon(); void onTabletModeChanged(bool mode); + void onRefreshTrayIconTooltip(); }; #endif // MAINWINDOW_H diff --git a/src/frontend/netdetails/configpage.cpp b/src/frontend/netdetails/configpage.cpp index 2f1ca0e8..7c98d0a0 100644 --- a/src/frontend/netdetails/configpage.cpp +++ b/src/frontend/netdetails/configpage.cpp @@ -42,13 +42,11 @@ void ConfigPage::initUi() m_congigBtn = new KBorderlessButton(this); QWidget *centerWidget = new QWidget(this); - QGridLayout *gridLayout = new QGridLayout(centerWidget); - gridLayout->setContentsMargins(0, 0, 0, 0); - gridLayout->setVerticalSpacing(VERTICAL_SPACING); - gridLayout->addWidget(m_publicButton, 0, 0, Qt::AlignTop); - gridLayout->addWidget(m_publicLabel, 0, 1); - gridLayout->addWidget(m_privateButton, 1, 0, Qt::AlignTop); - gridLayout->addWidget(m_privateLabel, 1, 1); + QFormLayout *formLayout = new QFormLayout(centerWidget); + formLayout->setContentsMargins(0, 0, 0, 0); + formLayout->setVerticalSpacing(VERTICAL_SPACING); + formLayout->addRow(m_publicButton, m_publicLabel); + formLayout->addRow(m_privateButton, m_privateLabel); m_vBoxLayout = new QVBoxLayout(this); m_vBoxLayout->setContentsMargins(0, 0, 0, 0); diff --git a/src/frontend/netdetails/coninfo.h b/src/frontend/netdetails/coninfo.h index a43f69ac..a2968979 100644 --- a/src/frontend/netdetails/coninfo.h +++ b/src/frontend/netdetails/coninfo.h @@ -104,12 +104,16 @@ public: KyIpConfigType ipv4ConfigType = CONFIG_IP_DHCP; QString strIPV4Address; QString strIPV4NetMask; + QString strIPV4FirDns; + QString strIPV4SecDns; QString strIPV4GateWay; QList ipv4DnsList; KyIpConfigType ipv6ConfigType = CONFIG_IP_DHCP; QString strIPV6Address; int iIPV6Prefix; + QString strIPV6FirDns; + QString strIPV6SecDns; QString strIPV6GateWay; QList ipv6DnsList; diff --git a/src/frontend/netdetails/creatnetpage.cpp b/src/frontend/netdetails/creatnetpage.cpp index 20b21506..98781006 100644 --- a/src/frontend/netdetails/creatnetpage.cpp +++ b/src/frontend/netdetails/creatnetpage.cpp @@ -23,6 +23,8 @@ #define MAX_NAME_LENGTH 32 #define HINT_TEXT_MARGINS 8, 1, 0, 3 #define LABEL_HEIGHT 24 +#define FRAME_SPEED 150 +#define ICON_SIZE 16,16 CreatNetPage::CreatNetPage(QWidget *parent):QFrame(parent) { @@ -33,7 +35,6 @@ CreatNetPage::CreatNetPage(QWidget *parent):QFrame(parent) void CreatNetPage::initUI() { connNameEdit = new LineEdit(this); - connNameEdit->setMaxLength(MAX_NAME_LENGTH); ipv4ConfigCombox = new QComboBox(this); ipv4addressEdit = new LineEdit(this); netMaskEdit = new LineEdit(this); @@ -47,14 +48,17 @@ void CreatNetPage::initUI() // IP的正则格式限制 QRegExp rx("\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b"); - m_dnsWidget = new MultipleDnsWidget(rx, this); + m_dnsWidget = new MultipleDnsWidget(rx, false, this); QLabel *nameEmptyLabel = new QLabel(this); QLabel *configEmptyLabel = new QLabel(this); QLabel *gateWayEmptyLabel = new QLabel(this); + + QLabel *firstDnsEmptyLabel = new QLabel(this); nameEmptyLabel->setFixedHeight(LABEL_HEIGHT); configEmptyLabel->setFixedHeight(LABEL_HEIGHT); gateWayEmptyLabel->setFixedHeight(LABEL_HEIGHT); + firstDnsEmptyLabel->setFixedHeight(LABEL_HEIGHT); m_addressHintLabel = new QLabel(this); m_maskHintLabel = new QLabel(this); @@ -63,6 +67,12 @@ void CreatNetPage::initUI() m_addressHintLabel->setContentsMargins(HINT_TEXT_MARGINS); m_maskHintLabel->setContentsMargins(HINT_TEXT_MARGINS); + m_statusLabel = new QLabel(this); + m_statusLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter); + QHBoxLayout *pPwdLayout = new QHBoxLayout(ipv4addressEdit); + pPwdLayout->addStretch(); + pPwdLayout->addWidget(m_statusLabel); + QPalette hintTextColor; hintTextColor.setColor(QPalette::WindowText, Qt::red); m_addressHintLabel->setPalette(hintTextColor); @@ -75,6 +85,8 @@ void CreatNetPage::initUI() addressLayout->addWidget(ipv4addressEdit); addressLayout->addWidget(m_addressHintLabel); + initConflictHintLable(); + QWidget *maskWidget = new QWidget(this); QVBoxLayout *maskLayout = new QVBoxLayout(maskWidget); maskLayout->setContentsMargins(0, 0, 0, 0); @@ -99,14 +111,24 @@ void CreatNetPage::initUI() m_detailLayout->addRow(m_maskLabel, maskWidget); m_detailLayout->addRow(m_gateWayLabel,gateWayEdit); m_detailLayout->addRow(gateWayEmptyLabel); + + m_addressLabel->setContentsMargins(0, 0, 0, LABEL_HEIGHT); //解决布局错位问题 + m_maskLabel->setContentsMargins(0, 0, 0, LABEL_HEIGHT); + m_detailLayout->addRow(m_dnsWidget); ipv4ConfigCombox->addItem(tr("Auto(DHCP)"), AUTO_CONFIG); //"自动(DHCP)" ipv4ConfigCombox->addItem(tr("Manual"), MANUAL_CONFIG); //"手动" + QRegExp nameRx("^.{0,32}$"); + QValidator *validator = new QRegExpValidator(nameRx, this); + + connNameEdit->setValidator(validator); ipv4addressEdit->setValidator(new QRegExpValidator(rx, this)); gateWayEdit->setValidator(new QRegExpValidator(rx, this)); netMaskEdit->setValidator(new QRegExpValidator(rx, this)); + + initLoadingIcon(); } void CreatNetPage::initComponent() { @@ -121,8 +143,8 @@ void CreatNetPage::initComponent() { connect(ipv4ConfigCombox, SIGNAL(currentIndexChanged(int)), this, SLOT(setEnableOfSaveBtn())); connect(netMaskEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn())); connect(gateWayEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn())); - connect(ipv4addressEdit, SIGNAL(textChanged(QString)), this, SLOT(onAddressTextChanged())); + connect(ipv4addressEdit, SIGNAL(editingFinished()), this, SLOT(onAddressEditFinished())); connect(netMaskEdit, SIGNAL(textChanged(QString)), this, SLOT(onNetMaskTextChanged())); } @@ -160,6 +182,9 @@ void CreatNetPage::configChanged(int index) { void CreatNetPage::onAddressTextChanged() { + m_iconLabel->hide(); + m_textLabel->hide(); + if (!getTextEditState(ipv4addressEdit->text())) { m_addressHintLabel->setText(tr("Invalid address")); } else { @@ -167,6 +192,15 @@ void CreatNetPage::onAddressTextChanged() } } +void CreatNetPage::onAddressEditFinished() +{ + if (ipv4addressEdit->isModified()) { + if (!ipv4addressEdit->text().isEmpty() && getTextEditState(ipv4addressEdit->text())) { + Q_EMIT ipv4EditFinished(ipv4addressEdit->text()); + } + } +} + void CreatNetPage::onNetMaskTextChanged() { if (!netMaskIsValide(netMaskEdit->text())) { @@ -222,6 +256,17 @@ void CreatNetPage::constructIpv4Info(KyConnectSetting &setting) << " netMask " << netMask << " gateWay " << gateWay; + QStringList dnsList; + dnsList.clear(); +#if 0 + if (!firstDnsEdit->text().isEmpty()) { + dnsList << firstDnsEdit->text(); + if (!secondDnsEdit->text().isEmpty()) { + dnsList << secondDnsEdit->text(); + } + } +#endif + QList ipv4dnsList; ipv4dnsList.clear(); ipv4dnsList = m_dnsWidget->getDns(); @@ -231,8 +276,9 @@ void CreatNetPage::constructIpv4Info(KyConnectSetting &setting) } else { setting.setIpConfigType(IPADDRESS_V4, CONFIG_IP_MANUAL); setting.ipv4AddressConstruct(ipv4address, netMask, gateWay); - setting.ipv4DnsConstruct(ipv4dnsList); } + + setting.ipv4DnsConstruct(ipv4dnsList); } bool CreatNetPage::netMaskIsValide(QString text) @@ -272,3 +318,63 @@ QString CreatNetPage::getNetMaskText(QString text) return QString("%1.%2.%3.%4").arg(list[0],list[1],list[2],list[3]); } +void CreatNetPage::initConflictHintLable() +{ + QIcon icon = QIcon::fromTheme("dialog-warning"); + m_iconLabel = new QLabel(m_addressHintLabel); + m_iconLabel->setPixmap(icon.pixmap(ICON_SIZE)); + m_textLabel = new QLabel(m_addressHintLabel); + m_textLabel->setText(tr("Address conflict")); + QHBoxLayout *conflictHintLayout = new QHBoxLayout(m_addressHintLabel); + conflictHintLayout->setContentsMargins(0, 0, 0, 0); + conflictHintLayout->addWidget(m_iconLabel); + conflictHintLayout->addWidget(m_textLabel); + conflictHintLayout->addStretch(); + m_addressHintLabel->setLayout(conflictHintLayout); + m_iconLabel->hide(); + m_textLabel->hide(); +} + +void CreatNetPage::initLoadingIcon() +{ + m_loadIcons.append(QIcon::fromTheme("ukui-loading-1-symbolic")); + m_loadIcons.append(QIcon::fromTheme("ukui-loading-2-symbolic")); + m_loadIcons.append(QIcon::fromTheme("ukui-loading-3-symbolic")); + m_loadIcons.append(QIcon::fromTheme("ukui-loading-4-symbolic")); + m_loadIcons.append(QIcon::fromTheme("ukui-loading-5-symbolic")); + m_loadIcons.append(QIcon::fromTheme("ukui-loading-6-symbolic")); + m_loadIcons.append(QIcon::fromTheme("ukui-loading-7-symbolic")); + m_iconTimer = new QTimer(this); + connect(m_iconTimer, &QTimer::timeout, this, &CreatNetPage::updateIcon); +} + +void CreatNetPage::updateIcon() +{ + if (m_currentIconIndex > 6) { + m_currentIconIndex = 0; + } + m_statusLabel->setPixmap(m_loadIcons.at(m_currentIconIndex).pixmap(ICON_SIZE)); + m_currentIconIndex ++; +} + +void CreatNetPage::startLoading() +{ + m_iconTimer->start(FRAME_SPEED); +} + +void CreatNetPage::stopLoading() +{ + m_iconTimer->stop(); + m_statusLabel->clear(); +} + +void CreatNetPage::showIpv4AddressConflict(bool isConflict) +{ + if (isConflict) { + m_iconLabel->show(); + m_textLabel->show(); + } else { + m_iconLabel->hide(); + m_textLabel->hide(); + } +} diff --git a/src/frontend/netdetails/creatnetpage.h b/src/frontend/netdetails/creatnetpage.h index 7f6b8fe8..8edc3c88 100644 --- a/src/frontend/netdetails/creatnetpage.h +++ b/src/frontend/netdetails/creatnetpage.h @@ -41,16 +41,16 @@ public: CreatNetPage(QWidget *parent = nullptr); void constructIpv4Info(KyConnectSetting &setting); + void startLoading(); + void stopLoading(); + void showIpv4AddressConflict(bool isConflict); private: LineEdit *connNameEdit; QComboBox *ipv4ConfigCombox; LineEdit *ipv4addressEdit; LineEdit *netMaskEdit; LineEdit *gateWayEdit; - LineEdit *firstDnsEdit; - LineEdit *secondDnsEdit; -private: QFormLayout *m_detailLayout; QVBoxLayout *mvBoxLayout; QLabel *m_connNameLabel; @@ -63,6 +63,15 @@ private: QLabel *m_maskHintLabel; MultipleDnsWidget *m_dnsWidget = nullptr; + + QLabel *m_statusLabel = nullptr; + QList m_loadIcons; + QTimer *m_iconTimer = nullptr; + int m_currentIconIndex =0; + + QLabel *m_iconLabel; + QLabel *m_textLabel; + private: void initUI(); void initComponent(); @@ -71,6 +80,9 @@ private: bool getTextEditState(QString text); bool checkConnectBtnIsEnabled(); + void initConflictHintLable(); + void initLoadingIcon(); + bool netMaskIsValide(QString text); QString getNetMaskText(QString text); @@ -79,9 +91,14 @@ private Q_SLOTS: void configChanged(int index); void onAddressTextChanged(); void onNetMaskTextChanged(); + void onAddressEditFinished(); + +public Q_SLOTS: + void updateIcon(); Q_SIGNALS: void setCreatePageState(bool); + void ipv4EditFinished(QString); }; diff --git a/src/frontend/netdetails/detailpage.cpp b/src/frontend/netdetails/detailpage.cpp index 848f7fde..07b97a51 100644 --- a/src/frontend/netdetails/detailpage.cpp +++ b/src/frontend/netdetails/detailpage.cpp @@ -36,6 +36,8 @@ DetailPage::DetailPage(bool isWlan, bool isCreate, QWidget *parent) if (isCreate) { connect(m_SSIDEdit, &LineEdit::textEdited, this, &DetailPage::setEnableOfSaveBtn); } + + setInteractionFlag(); } DetailPage::~DetailPage() @@ -169,6 +171,35 @@ QPalette DetailPage::getTheme() return pal; } +void DetailPage::setInteractionFlag() +{ + if (m_SSIDLabel != nullptr) { + m_SSIDLabel->setTextInteractionFlags(Qt::TextSelectableByMouse); + m_SSIDLabel->setCursor(Qt::IBeamCursor); + } + //文字部分响应鼠标的可选择状态 + m_Protocol->setTextInteractionFlags(Qt::TextSelectableByMouse); + m_SecType->setTextInteractionFlags(Qt::TextSelectableByMouse); + m_Hz->setTextInteractionFlags(Qt::TextSelectableByMouse); + m_Chan->setTextInteractionFlags(Qt::TextSelectableByMouse); + m_BandWidth->setTextInteractionFlags(Qt::TextSelectableByMouse); + m_IPV6->setTextInteractionFlags(Qt::TextSelectableByMouse); + m_IPV4->setTextInteractionFlags(Qt::TextSelectableByMouse); + m_IPV4Dns->setTextInteractionFlags(Qt::TextSelectableByMouse); + m_Mac->setTextInteractionFlags(Qt::TextSelectableByMouse); + //鼠标移入指针变成光标 + m_Protocol->setCursor(Qt::IBeamCursor); + m_SecType->setCursor(Qt::IBeamCursor); + m_Hz->setCursor(Qt::IBeamCursor); + m_Chan->setCursor(Qt::IBeamCursor); + m_BandWidth->setCursor(Qt::IBeamCursor); + m_IPV6->setCursor(Qt::IBeamCursor); + m_IPV4->setCursor(Qt::IBeamCursor); + m_IPV4Dns->setCursor(Qt::IBeamCursor); + m_Mac->setCursor(Qt::IBeamCursor); + m_IPV4Dns->setScaledContents(true); +} + void DetailPage::initUI() { m_layout = new QVBoxLayout(this); m_layout->setContentsMargins(0,0,0,0); @@ -215,7 +246,10 @@ void DetailPage::initUI() { m_SSIDEdit->setAlignment(Qt::AlignRight); m_SSIDEdit->setStyleSheet("border-top:0px solid;border-bottom:1px solid;border-left:0px solid;border-right: 0px solid;background:transparent"); m_SSIDEdit->setPlaceholderText(tr("Please input SSID:")); - m_SSIDEdit->setMaxLength(MAX_NAME_LENGTH); + QRegExp nameRx("^.{0,32}$"); + QValidator *validator = new QRegExpValidator(nameRx, this); + + m_SSIDEdit->setValidator(validator); m_ssidWidget = new DetailWidget(qobject_cast(m_SSIDEdit), m_listWidget); } @@ -349,7 +383,7 @@ void DetailPage::on_btnCopyNetDetail_clicked() bandwithCopy += this->m_BandWidth->text(); ipv6Copy += m_formerIPV6; ipv4Copy += this->m_IPV4->text(); - ipv4dnsCopy += this->m_IPV4Dns->text(); + ipv4dnsCopy += this->m_IPV4Dns->getText(); macCopy += this->m_Mac->text(); netDetailList.append(bandwithCopy); netDetailList.append(ipv4Copy); diff --git a/src/frontend/netdetails/detailpage.h b/src/frontend/netdetails/detailpage.h index adb0c267..36eb7b02 100644 --- a/src/frontend/netdetails/detailpage.h +++ b/src/frontend/netdetails/detailpage.h @@ -68,6 +68,7 @@ private: void addDetailItem(QListWidget *listWidget, QWidget *detailWidget); void newCopiedTip(); QPalette getTheme(); + void setInteractionFlag(); public: QListWidget *m_listWidget = nullptr; @@ -82,34 +83,35 @@ public: DetailWidget *m_ipv6Widget = nullptr; DetailWidget *m_macWidget = nullptr; - QPushButton *m_netCopyButton; - LineEdit *m_SSIDEdit; - QLabel *m_SSIDLabel; - QLabel *m_Protocol; - QLabel *m_SecType; - QLabel *m_Hz; - QLabel *m_Chan; - QLabel *m_BandWidth; - QLabel *m_IPV4; - FixLabel *m_IPV4Dns; - FixLabel *m_IPV6; - QLabel *m_Mac; - QLabel *m_autoConnect; + QPushButton *m_netCopyButton = nullptr; + LineEdit *m_SSIDEdit = nullptr; + QLabel *m_SSIDLabel = nullptr; + QLabel *m_Protocol = nullptr; + QLabel *m_SecType = nullptr; + QLabel *m_Hz = nullptr; + QLabel *m_Chan = nullptr; + QLabel *m_BandWidth = nullptr; + QLabel *m_IPV4 = nullptr; + FixLabel *m_IPV4Dns = nullptr; + FixLabel *m_IPV6 = nullptr; + QLabel *m_Mac = nullptr; + QLabel *m_autoConnect = nullptr; KBallonTip *m_copiedTip = nullptr; // QWidget *autoFrame; private: - QVBoxLayout *m_layout; - QVBoxLayout *m_DetailLayout; - QHBoxLayout *m_AutoLayout; - QCheckBox *m_forgetNetBox; - bool m_IsWlan; - bool m_IsCreate; - QWidget *m_autoConWidget; + QVBoxLayout *m_layout = nullptr; + QVBoxLayout *m_DetailLayout = nullptr; + QHBoxLayout *m_AutoLayout = nullptr; + QCheckBox *m_forgetNetBox = nullptr; + bool m_IsWlan = false; + bool m_IsCreate = false; - QString m_formerSSID; - QString m_formerIPV6; + QWidget *m_autoConWidget = nullptr; + + QString m_formerSSID = nullptr; + QString m_formerIPV6 = nullptr; private Q_SLOTS: void setEnableOfSaveBtn(); diff --git a/src/frontend/netdetails/dnssettingwidget.cpp b/src/frontend/netdetails/dnssettingwidget.cpp new file mode 100644 index 00000000..92a8eb1c --- /dev/null +++ b/src/frontend/netdetails/dnssettingwidget.cpp @@ -0,0 +1,157 @@ +#include "dnssettingwidget.h" +#include +#include +#include +#include + +#include "coninfo.h" + +#define THEME_SCHAME "org.ukui.style" +#define COLOR_THEME "styleName" + +#define BOTTOM_LAYOUT_MARGINS 24, 16, 24, 24 +#define LAYOUT_SPACING 16 + +DnsSettingWidget::DnsSettingWidget(QString timeout, QString retry, QString tactic, QWidget *parent) + :m_timeout(timeout), m_retry(retry), m_tactic(tactic), QDialog(parent) +{ + this->setFixedSize(420, 420); + setAttribute(Qt::WA_DeleteOnClose, false); + setProperty("useStyleWindowManager", false); + initUi(); + initConnect(); + onPaletteChanged(); +} + +void DnsSettingWidget::initUi() +{ + m_titleWidget = new QWidget(this); + m_centerWidget = new QWidget(this); + m_bottomWidget = new QWidget(this); + + m_titleLabel = new QLabel(this); + m_titleLabel->setContentsMargins(24,14,0,0); + m_titleLabel->setText(tr("DNS Server Advanced Settings")); + + m_tacticLabel = new QLabel(this); + m_tacticLabel->setText(tr("Tactic")); + + m_timeoutLabel = new QLabel(this); + m_timeoutLabel->setText(tr("Timeout")); + + m_retryLabel = new QLabel(this); + m_retryLabel->setText(tr("Retry Count")); + + m_tacticComboBox = new QComboBox(this); + m_tacticComboBox->addItem(tr("order"), "order"); + m_tacticComboBox->addItem(tr("rotate"), "rotate"); + m_tacticComboBox->addItem(tr("concurrency"), "concurrency"); + m_tacticComboBox->setCurrentIndex(m_tacticComboBox->findData(m_tactic)); + + m_timeoutComboBox = new QComboBox(this); + for (int i = 0; i < 30; ++i) { + m_timeoutComboBox->insertItem(i, QString::number(i+1) + tr(" s"), QString::number(i+1)); + } + m_timeoutComboBox->setCurrentIndex(m_timeoutComboBox->findData(m_timeout.toInt())); + + m_retryComboBox = new QComboBox(this); + for (int i = 0; i < 4; ++i) { + m_retryComboBox->insertItem(i, QString::number(i+1) + tr(" times"), QString::number(i+1)); + } + m_retryComboBox->setCurrentIndex(m_retryComboBox->findData(m_retry.toInt())); + + m_bottomDivider = new Divider(false, this); + + m_closeBtn = new QPushButton(this); + m_closeBtn->setFixedSize(32,32); + m_closeBtn->setIcon(QIcon::fromTheme("application-exit-symbolic")); + m_closeBtn->setProperty("useButtonPalette", true); + m_closeBtn->setFlat(true); + m_closeBtn->setToolTip(tr("Close")); + + m_cancelBtn = new QPushButton(this); + m_cancelBtn->setText(tr("Cancel")); + + m_confirmBtn = new QPushButton(this); + m_confirmBtn->setText(tr("Confirm")); + + + QHBoxLayout* titleLayout = new QHBoxLayout(m_titleWidget); + titleLayout->setContentsMargins(0,4,3,0); + titleLayout->addStretch(); + titleLayout->addWidget(m_closeBtn); + + QVBoxLayout* mainLayout = new QVBoxLayout(this); + mainLayout->setContentsMargins(0,0,0,0); + mainLayout->setSpacing(0); + mainLayout->addWidget(m_titleWidget); + mainLayout->addWidget(m_titleLabel, Qt::AlignLeft); + mainLayout->addWidget(m_centerWidget); + mainLayout->addSpacing(115); + mainLayout->addWidget(m_bottomDivider); + mainLayout->addWidget(m_bottomWidget); + this->setLayout(mainLayout); + + //中间页面 + QFormLayout* centerLayout = new QFormLayout(m_centerWidget); + centerLayout->setContentsMargins(24,10,24,0); + centerLayout->setSpacing(16); + centerLayout->addRow(m_tacticLabel, m_tacticComboBox); + centerLayout->addRow(m_timeoutLabel, m_timeoutComboBox); + centerLayout->addRow(m_retryLabel, m_retryComboBox); + + //底部按钮 + QHBoxLayout* bottomLayout = new QHBoxLayout(m_bottomWidget); + bottomLayout->setContentsMargins(BOTTOM_LAYOUT_MARGINS); + bottomLayout->setSpacing(LAYOUT_SPACING); + bottomLayout->addStretch(); + bottomLayout->addWidget(m_cancelBtn); + bottomLayout->addWidget(m_confirmBtn); + + this->setWindowFlags(Qt::Dialog); +} + +void DnsSettingWidget::initConnect() +{ + connect(m_closeBtn, &QPushButton::released, this, [=](){ + reject(); + }); + connect(m_cancelBtn, &QPushButton::released, this, [=](){ + reject(); + }); + connect(m_confirmBtn, &QPushButton::released, this, [=](){ + m_timeout = m_timeoutComboBox->currentData().toString(); + m_tactic = m_tacticComboBox->currentData().toString(); + m_retry = m_retryComboBox->currentData().toString(); + accept(); + }); + connect(qApp, &QApplication::paletteChanged, this, &DnsSettingWidget::onPaletteChanged); +} + +void DnsSettingWidget::onPaletteChanged() +{ + QPalette pal = qApp->palette(); + + QGSettings * styleGsettings = nullptr; + const QByteArray style_id(THEME_SCHAME); + if (QGSettings::isSchemaInstalled(style_id)) { + styleGsettings = new QGSettings(style_id); + QString currentTheme = styleGsettings->get(COLOR_THEME).toString(); + if(currentTheme == "ukui-default"){ + pal = lightPalette(this); + } + } + this->setPalette(pal); + QList comboBoxList = this->findChildren(); + for (int i = 0; i < comboBoxList.count(); ++i) { + comboBoxList.at(i)->setPalette(pal); + if (comboBoxList.at(i)->view()) { + comboBoxList.at(i)->view()->setPalette(pal); + } + } + + if (styleGsettings != nullptr) { + delete styleGsettings; + styleGsettings = nullptr; + } +} diff --git a/src/frontend/netdetails/dnssettingwidget.h b/src/frontend/netdetails/dnssettingwidget.h new file mode 100644 index 00000000..91291b9f --- /dev/null +++ b/src/frontend/netdetails/dnssettingwidget.h @@ -0,0 +1,57 @@ +#ifndef DNSSETTINGWIDGET_H +#define DNSSETTINGWIDGET_H + +#include +#include +#include +#include +#include +#include + +#include "divider.h" + +class DnsSettingWidget : public QDialog +{ + Q_OBJECT +public: + explicit DnsSettingWidget(QString timeout = "", QString retry = "", QString tactic = "", QWidget *parent = nullptr); + + void getDnsSettings(QString& timeout, QString& retry, QString& tactic) { + timeout = QString::number(m_timeoutComboBox->currentData().toInt()); + retry = QString::number(m_retryComboBox->currentData().toInt()); + tactic = m_tacticComboBox->currentData().toString(); + } + +private: + QWidget* m_titleWidget; + QWidget* m_centerWidget; + QWidget* m_bottomWidget; + + QString m_timeout; + QString m_retry; + QString m_tactic; + + QLabel* m_titleLabel; + QLabel* m_tacticLabel; + QLabel* m_timeoutLabel; + QLabel* m_retryLabel; + + QComboBox* m_tacticComboBox; + QComboBox* m_timeoutComboBox; + QComboBox* m_retryComboBox; + + Divider *m_bottomDivider = nullptr; + + QPushButton *m_closeBtn; + QPushButton *m_cancelBtn; + QPushButton *m_confirmBtn; + + void initUi(); + void initConnect(); + +private Q_SLOTS: + void onPaletteChanged(); + +}; + +#endif // DNSSETTINGWIDGET_H diff --git a/src/frontend/netdetails/ipv4page.cpp b/src/frontend/netdetails/ipv4page.cpp index 4c9960ff..14e032e3 100644 --- a/src/frontend/netdetails/ipv4page.cpp +++ b/src/frontend/netdetails/ipv4page.cpp @@ -60,6 +60,9 @@ void Ipv4Page::initUI() { m_gateWayEmptyLabel = new QLabel(this); m_gateWayEmptyLabel->setFixedHeight(LABEL_HEIGHT); + m_dnsEmptyLabel = new QLabel(this); + m_dnsEmptyLabel->setFixedHeight(21); + m_configLabel->setText(tr("IPv4Config")); m_addressLabel->setText(tr("Address")); m_maskLabel->setText(tr("Netmask")); @@ -92,7 +95,9 @@ void Ipv4Page::initUI() { // IP的正则格式限制 QRegExp rx("\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b"); - m_dnsWidget = new MultipleDnsWidget(rx, this); + + Divider* divider = new Divider(false, this); + m_dnsWidget = new MultipleDnsWidget(rx, false, this); m_detailLayout = new QFormLayout(this); m_detailLayout->setVerticalSpacing(0); @@ -103,7 +108,11 @@ void Ipv4Page::initUI() { m_detailLayout->addRow(m_maskLabel,maskWidget); m_detailLayout->addRow(m_gateWayLabel,gateWayEdit); m_detailLayout->addRow(m_gateWayEmptyLabel); + m_detailLayout->addRow(divider); + m_detailLayout->addRow(m_dnsEmptyLabel); m_detailLayout->addRow(m_dnsWidget); + m_addressLabel->setContentsMargins(0, 0, 0, LABEL_HEIGHT); //解决布局错位问题 + m_maskLabel->setContentsMargins(0, 0, 0, LABEL_HEIGHT); ipv4ConfigCombox->addItem(tr("Auto(DHCP)")); //"自动(DHCP)" ipv4ConfigCombox->addItem(tr("Manual")); //"手动" @@ -131,12 +140,13 @@ void Ipv4Page::initComponent() { connect(ipv4ConfigCombox, SIGNAL(currentIndexChanged(int)), this, SLOT(configChanged(int))); connect(ipv4addressEdit, SIGNAL(textChanged(QString)), this, SLOT(onAddressTextChanged())); - connect(ipv4addressEdit, SIGNAL(editingFinished()), this, SLOT(onAddressEidtFinished())); + connect(ipv4addressEdit, SIGNAL(editingFinished()), this, SLOT(onAddressEditFinished())); connect(netMaskEdit, SIGNAL(textChanged(QString)), this, SLOT(onNetMaskTextChanged())); connect(ipv4ConfigCombox, SIGNAL(currentIndexChanged(int)), this, SLOT(setEnableOfSaveBtn())); connect(ipv4addressEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn())); connect(netMaskEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn())); connect(gateWayEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn())); + connect(m_dnsWidget, &MultipleDnsWidget::scrollToBottom, this, &Ipv4Page::scrollToBottom); } void Ipv4Page::setIpv4Config(KyIpConfigType ipv4Config) @@ -171,54 +181,52 @@ void Ipv4Page::setGateWay(const QString &gateWay) bool Ipv4Page::checkIsChanged(const ConInfo info, KyConnectSetting &setting) { bool isChanged = false; - - QList ipv4DnsList; - ipv4DnsList.clear(); - ipv4DnsList = m_dnsWidget->getDns(); - if (info.ipv4DnsList != ipv4DnsList) { - qDebug() << "ipv4 dns changed"; - setting.ipv4DnsConstruct(ipv4DnsList); - isChanged = true; - } - + KyIpConfigType type; if (ipv4ConfigCombox->currentIndex() == AUTO_CONFIG) { + type = CONFIG_IP_DHCP; if (info.ipv4ConfigType != CONFIG_IP_DHCP) { qDebug() << "ipv4ConfigType change to Auto"; - setting.setIpConfigType(IPADDRESS_V4, CONFIG_IP_DHCP); - QString ipv4address(""); - QString netMask(""); - QString gateWay(""); - - qDebug() << ipv4address << netMask << gateWay; - setting.ipv4AddressConstruct(ipv4address, netMask, gateWay); isChanged = true; } } else { + type = CONFIG_IP_MANUAL; if (info.ipv4ConfigType != CONFIG_IP_MANUAL) { qDebug() << "ipv4ConfigType change to Manual"; - setting.setIpConfigType(IPADDRESS_V4, CONFIG_IP_MANUAL); - isChanged = true; - } - qDebug() << "ipv4 netmask " << getNetMaskText(netMaskEdit->text()); - - if(info.strIPV4Address != ipv4addressEdit->text() - || info.strIPV4NetMask != /*netMaskEdit->text()*/getNetMaskText(netMaskEdit->text()) - || info.strIPV4GateWay != gateWayEdit->text()) { - - qDebug() << "ipv4 info changed"; - - QString ipv4address =ipv4addressEdit->text(); - QString netMask = getNetMaskText(netMaskEdit->text()); - QString gateWay = gateWayEdit->text(); - qDebug() << ipv4address << netMask << gateWay; - setting.ipv4AddressConstruct(ipv4address, netMask, gateWay); - setting.dumpInfo(); isChanged = true; + } else { + if(info.strIPV4Address != ipv4addressEdit->text() + || info.strIPV4NetMask != getNetMaskText(netMaskEdit->text()) + || info.strIPV4GateWay != gateWayEdit->text()) { + qDebug() << "ipv4 info changed"; + isChanged = true; + } } } + + QList ipv4dnsList; + ipv4dnsList.clear(); + ipv4dnsList = m_dnsWidget->getDns(); + if(info.ipv4DnsList != ipv4dnsList) { + isChanged = true; + } + + if (isChanged) { + setting.setIpConfigType(IPADDRESS_V4, type); + QString ipv4address = ipv4addressEdit->text(); + QString netMask = getNetMaskText(netMaskEdit->text()); + QString gateWay = gateWayEdit->text(); + setting.ipv4AddressConstruct(ipv4address, netMask, gateWay); + setting.ipv4DnsConstruct(ipv4dnsList); + setting.dumpInfo(); + } + return isChanged; } +bool Ipv4Page::checkDnsSettingsIsChanged() { + return m_dnsWidget->getDnsSettingsChanged(); +} + bool Ipv4Page::checkConnectBtnIsEnabled() { qDebug() << "checkConnectBtnIsEnabled currentIndex" << ipv4ConfigCombox->currentIndex(); @@ -268,7 +276,7 @@ void Ipv4Page::onNetMaskTextChanged() } } -void Ipv4Page::onAddressEidtFinished() +void Ipv4Page::onAddressEditFinished() { if (ipv4addressEdit->isModified()) { if (!ipv4addressEdit->text().isEmpty() && getTextEditState(ipv4addressEdit->text())) { diff --git a/src/frontend/netdetails/ipv4page.h b/src/frontend/netdetails/ipv4page.h index 441d9013..0a1fa101 100644 --- a/src/frontend/netdetails/ipv4page.h +++ b/src/frontend/netdetails/ipv4page.h @@ -34,6 +34,7 @@ //#include "kylinconnectsetting.h" #include "coninfo.h" #include "multiplednswidget.h" +#include "divider.h" class Ipv4Page : public QFrame { @@ -45,14 +46,18 @@ public: void setNetMask(const QString &netMask); void setMulDns(const QList &dns); void setGateWay(const QString &gateWay); + void setUuid(QString uuid) { + if (m_dnsWidget != nullptr) { + m_dnsWidget->setUuid(uuid); + } + } bool checkIsChanged(const ConInfo info, KyConnectSetting &setting); + bool checkDnsSettingsIsChanged(); void startLoading(); void stopLoading(); void showIpv4AddressConflict(bool isConflict); - - QString getNetMaskText(QString text); private: QComboBox *ipv4ConfigCombox; LineEdit *ipv4addressEdit; @@ -70,6 +75,7 @@ private: QLabel *m_addressHintLabel; QLabel *m_maskHintLabel; QLabel *m_gateWayEmptyLabel; + QLabel *m_dnsEmptyLabel; MultipleDnsWidget *m_dnsWidget = nullptr; @@ -88,6 +94,7 @@ private: void configSave(); bool getTextEditState(QString text); bool netMaskIsValide(QString text); + QString getNetMaskText(QString text); bool checkConnectBtnIsEnabled(); void initConflictHintLable(); void initLoadingIcon(); @@ -97,12 +104,13 @@ private Q_SLOTS: void configChanged(int index); void onAddressTextChanged(); void onNetMaskTextChanged(); - void onAddressEidtFinished(); + void onAddressEditFinished(); void updateIcon(); Q_SIGNALS: void setIpv4PageState(bool); void ipv4EditFinished(const QString &address); + void scrollToBottom(); }; #endif // IPV4PAGE_H diff --git a/src/frontend/netdetails/ipv6page.cpp b/src/frontend/netdetails/ipv6page.cpp index 16dbb4d4..a9cc1bb8 100644 --- a/src/frontend/netdetails/ipv6page.cpp +++ b/src/frontend/netdetails/ipv6page.cpp @@ -65,49 +65,42 @@ void Ipv6Page::setGateWay(const QString &gateWay) bool Ipv6Page::checkIsChanged(const ConInfo info, KyConnectSetting &setting) { bool isChanged = false; - - QList ipv6DnsList; - ipv6DnsList.clear(); - ipv6DnsList = m_dnsWidget->getDns(); - if (info.ipv6DnsList != ipv6DnsList) { - qDebug() << "ipv6 dns changed"; - setting.ipv6DnsConstruct(ipv6DnsList); - isChanged = true; - } - + KyIpConfigType type; if (ipv6ConfigCombox->currentIndex() == AUTO_CONFIG) { + type = CONFIG_IP_DHCP; if (info.ipv6ConfigType != CONFIG_IP_DHCP) { qDebug() << "ipv6ConfigType change to Auto"; - setting.setIpConfigType(IPADDRESS_V6, CONFIG_IP_DHCP); - QString ipv6address(""); - QString prefix(""); - QString gateWay(""); - setting.ipv6AddressConstruct(ipv6address, prefix, gateWay); isChanged = true; } } else { + type = CONFIG_IP_MANUAL; if (info.ipv6ConfigType != CONFIG_IP_MANUAL) { qDebug() << "ipv6ConfigType change to Manual"; - setting.setIpConfigType(IPADDRESS_V6, CONFIG_IP_MANUAL); isChanged = true; } - QList ipv6dnsList; - ipv6dnsList.clear(); - ipv6dnsList = m_dnsWidget->getDns(); if(info.strIPV6Address != ipv6AddressEdit->text() || info.iIPV6Prefix != lengthEdit->text().toInt() || info.strIPV6GateWay != gateWayEdit->text()) { - qDebug() << "ipv6 info changed"; - - QString ipv6address =ipv6AddressEdit->text(); - QString prefix = lengthEdit->text(); - QString gateWay = gateWayEdit->text(); - setting.ipv6AddressConstruct(ipv6address, prefix, gateWay); - setting.dumpInfo(); isChanged = true; } } + QList ipv6dnsList; + ipv6dnsList.clear(); + ipv6dnsList = m_dnsWidget->getDns(); + if (info.ipv6DnsList != ipv6dnsList) { + isChanged = true; + } + + if (isChanged) { + setting.setIpConfigType(IPADDRESS_V6, type); + QString ipv6address =ipv6AddressEdit->text(); + QString prefix = lengthEdit->text(); + QString gateWay = gateWayEdit->text(); + setting.ipv6AddressConstruct(ipv6address, prefix, gateWay); + setting.ipv6DnsConstruct(ipv6dnsList); + setting.dumpInfo(); + } return isChanged; } @@ -168,7 +161,7 @@ void Ipv6Page::initUI() { gateWayLayout->addWidget(m_gateWayHintLabel); QRegExp ipv6_rx("^\\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:)))(%.+)?\\s*$"); - m_dnsWidget = new MultipleDnsWidget(ipv6_rx, this); + m_dnsWidget = new MultipleDnsWidget(ipv6_rx, false, this); m_detailLayout = new QFormLayout(this); m_detailLayout->setContentsMargins(0, 0, 0, 0); @@ -181,6 +174,9 @@ void Ipv6Page::initUI() { m_detailLayout->addRow(m_gateWayLabel,gateWayWidget); m_detailLayout->addRow(m_dnsWidget); + m_addressLabel->setContentsMargins(0, 0, 0, LABEL_HEIGHT); //解决布局错位问题 + m_gateWayLabel->setContentsMargins(0, 0, 0, LABEL_HEIGHT); + ipv6ConfigCombox->addItem(tr("Auto(DHCP)")); //"自动(DHCP)" ipv6ConfigCombox->addItem(tr("Manual")); //"手动" @@ -208,6 +204,8 @@ void Ipv6Page::initComponent() { connect(ipv6AddressEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn())); connect(lengthEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn())); connect(gateWayEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn())); + + connect(m_dnsWidget, &MultipleDnsWidget::scrollToBottom, this, &Ipv6Page::scrollToBottom); } void Ipv6Page::configChanged(int index) { diff --git a/src/frontend/netdetails/ipv6page.h b/src/frontend/netdetails/ipv6page.h index a01c8793..ee6ae0f0 100644 --- a/src/frontend/netdetails/ipv6page.h +++ b/src/frontend/netdetails/ipv6page.h @@ -54,13 +54,12 @@ public: void stopLoading(); void showIpv6AddressConflict(bool isConflict); -public: +private: QComboBox *ipv6ConfigCombox; LineEdit *ipv6AddressEdit; LineEdit *lengthEdit; LineEdit *gateWayEdit; -private: QFormLayout *m_detailLayout; QLabel *m_configLabel; QLabel *m_addressLabel; @@ -81,6 +80,7 @@ private: QLabel *m_iconLabel; QLabel *m_textLabel; + private: void initUI(); void initComponent(); @@ -104,6 +104,7 @@ private Q_SLOTS: Q_SIGNALS: void setIpv6PageState(bool); void ipv6EditFinished(const QString &address); + void scrollToBottom(); }; #endif // IPV6PAGE_H diff --git a/src/frontend/netdetails/joinhiddenwifipage.cpp b/src/frontend/netdetails/joinhiddenwifipage.cpp index 492253a7..05db7ef4 100644 --- a/src/frontend/netdetails/joinhiddenwifipage.cpp +++ b/src/frontend/netdetails/joinhiddenwifipage.cpp @@ -20,12 +20,14 @@ #include "joinhiddenwifipage.h" #include +#include "kwindowsystem.h" +#include "kwindowsystem_export.h" #define THEME_SCHAME "org.ukui.style" #define COLOR_THEME "styleName" #define WINDOW_WIDTH 480 #define MIN_WINDOW_HEIGHT 368 -#define PEAP_WINDOW_HEIGHT 524 +#define EAPMIN_WINDOW_HEIGHT 524 #define TLS_WINDOW_HEIGHT 580 #define LAYOUT_MARGINS 0, 0, 0, 0 #define TOP_LAYOUT_MARGINS 24, 12, 24, 16 @@ -48,6 +50,7 @@ JoinHiddenWiFiPage::JoinHiddenWiFiPage(QString devName, KDialog *parent) initComponent(); setAttribute(Qt::WA_DeleteOnClose); + KWindowSystem::setState(this->winId(), NET::SkipTaskbar | NET::SkipPager); setJoinBtnEnable(); } @@ -77,7 +80,7 @@ void JoinHiddenWiFiPage::initUI() m_nameLabel->setFixedWidth(LABEL_MIN_WIDTH); m_nameEdit =new LineEdit(this); - m_bottomDivider = new Divider(this); + m_bottomDivider = new Divider(false, this); m_showListBtn = new KBorderlessButton(this); m_cancelBtn =new QPushButton(this); m_joinBtn =new QPushButton(this); @@ -133,8 +136,8 @@ void JoinHiddenWiFiPage::initUI() m_bottomLayout->addWidget(m_cancelBtn); m_bottomLayout->addWidget(m_joinBtn); - //请输入您想要加入网络的名称和安全类型 - m_descriptionLabel->setLabelText(tr("Please enter the network name and security type")); + //请输入您想要加入的网络信息 + m_descriptionLabel->setLabelText(tr("Please enter the network information")); QFont font = m_descriptionLabel->font(); font.setWeight(MEDIUM_WEIGHT_VALUE); m_descriptionLabel->setFont(font); @@ -144,15 +147,16 @@ void JoinHiddenWiFiPage::initUI() m_cancelBtn->setText(tr("Cancel")); m_joinBtn->setText(tr("Join")); - m_nameEdit->setMaxLength(MAX_NAME_LENGTH); + QRegExp nameRx("^.{0,32}$"); + QValidator *validator = new QRegExpValidator(nameRx, this); + m_nameEdit->setValidator(validator); m_nameEdit->setPlaceholderText(tr("Required")); //必填 - this->setWindowTitle(tr("Find and Join Wi-Fi")); + this->setWindowTitle(tr("Find and Join WLAN")); this->setWindowIcon(QIcon::fromTheme("kylin-network")); - - this->setFixedHeight(MIN_WINDOW_HEIGHT); this->setFixedWidth(WINDOW_WIDTH); - onPaletteChanged(); + this->setFixedHeight(MIN_WINDOW_HEIGHT); +// onPaletteChanged(); } void JoinHiddenWiFiPage::initComponent() @@ -172,6 +176,7 @@ void JoinHiddenWiFiPage::initComponent() }); connect(m_nameEdit, &LineEdit::textChanged, this, &JoinHiddenWiFiPage::setJoinBtnEnable); +#if 0 connect(qApp, &QApplication::paletteChanged, this, &JoinHiddenWiFiPage::onPaletteChanged); const QByteArray id(THEME_SCHAME); @@ -183,6 +188,7 @@ void JoinHiddenWiFiPage::initComponent() } }); } +#endif } void JoinHiddenWiFiPage::setJoinBtnEnable() @@ -254,10 +260,11 @@ void JoinHiddenWiFiPage::onEapTypeChanged(const KyEapMethodType &type) if (type == KyEapMethodType::TLS || type == KyEapMethodType::FAST) { this->setFixedHeight(TLS_WINDOW_HEIGHT); } else { - this->setFixedHeight(PEAP_WINDOW_HEIGHT); + this->setFixedHeight(EAPMIN_WINDOW_HEIGHT); } } +#if 0 void JoinHiddenWiFiPage::onPaletteChanged() { QPalette pal = qApp->palette(); @@ -280,6 +287,7 @@ void JoinHiddenWiFiPage::onPaletteChanged() styleGsettings = nullptr; } } +#endif void JoinHiddenWiFiPage::centerToScreen() { diff --git a/src/frontend/netdetails/joinhiddenwifipage.h b/src/frontend/netdetails/joinhiddenwifipage.h index b8eb1ae0..2ead94aa 100644 --- a/src/frontend/netdetails/joinhiddenwifipage.h +++ b/src/frontend/netdetails/joinhiddenwifipage.h @@ -88,7 +88,6 @@ private Q_SLOTS: void onBtnShowListClicked(); void onSecuTypeChanged(const KySecuType &type); void onEapTypeChanged(const KyEapMethodType &type); - void onPaletteChanged(); Q_SIGNALS: void hiddenWiFiPageClose(QString); diff --git a/src/frontend/netdetails/multiplednswidget.cpp b/src/frontend/netdetails/multiplednswidget.cpp index b689c0df..4469b27f 100644 --- a/src/frontend/netdetails/multiplednswidget.cpp +++ b/src/frontend/netdetails/multiplednswidget.cpp @@ -20,13 +20,28 @@ #include "multiplednswidget.h" #include +#include +#include +#include -#define DNS_LISTWIDGET_HEIGHT 76 +#include "ukuistylehelper/ukuistylehelper.h" +#include "coninfo.h" + +#define THEME_SCHAME "org.ukui.style" +#define COLOR_THEME "styleName" + +#define DNS_LISTWIDGET_EMPTY_HEIGHT 79 +#define DNS_LISTWIDGET_HEIGHT 188 #define BUTTON_SIZE 36,36 #define ITEM_HEIGHT 36 -MultipleDnsWidget::MultipleDnsWidget(const QRegExp &rx, QWidget *parent) +#define STR_ATTEMPTS "attempts" +#define STR_TIMEOUT "timeout" +#define STR_TYPE "type" + +MultipleDnsWidget::MultipleDnsWidget(const QRegExp &rx, bool settingShow, QWidget *parent) : m_regExp(rx), + m_settingShow(settingShow), QWidget(parent) { initUI(); @@ -36,44 +51,82 @@ MultipleDnsWidget::MultipleDnsWidget(const QRegExp &rx, QWidget *parent) void MultipleDnsWidget::initUI() { QVBoxLayout *mulDnsVLayout = new QVBoxLayout(this); - mulDnsVLayout->setContentsMargins(0, 0, 0, 0); + mulDnsVLayout->setContentsMargins(0, 0, 0, 30); m_mulDnsLabel = new QLabel(this); - m_mulDnsLabel->setText(tr("DNS server:")); //DNS服务器: + m_mulDnsLabel->setText(tr("DNS server(Drag to sort)")); //DNS服务器: + + m_emptyWidget = new QFrame(this); + m_emptyWidget->setFrameShape(QFrame::Shape::StyledPanel); + m_emptyWidget->setFixedHeight(DNS_LISTWIDGET_EMPTY_HEIGHT); + emptyLabel = new QLabel(m_emptyWidget); + emptyLabel->setAlignment(Qt::AlignCenter); + emptyLabel->setText(tr("Click \"+\" to configure DNS")); + QVBoxLayout* emptyLayout = new QVBoxLayout(m_emptyWidget); + emptyLayout->addWidget(emptyLabel,Qt::AlignCenter); + m_dnsListWidget = new QListWidget(this); - m_dnsListWidget->setFixedHeight(DNS_LISTWIDGET_HEIGHT); + m_dnsListWidget->setFixedHeight(DNS_LISTWIDGET_EMPTY_HEIGHT); m_dnsListWidget->setBackgroundRole(QPalette::Base); m_dnsListWidget->setFocusPolicy(Qt::FocusPolicy::NoFocus); m_dnsListWidget->setFrameShape(QFrame::Shape::StyledPanel); m_dnsListWidget->setEditTriggers(QAbstractItemView::DoubleClicked); + + //item可拖拽 + m_dnsListWidget->setSelectionMode(QAbstractItemView::SingleSelection); + m_dnsListWidget->setDragEnabled(true); + m_dnsListWidget->viewport()->setAcceptDrops(true); + m_dnsListWidget->setDropIndicatorShown(true); + m_dnsListWidget->setDragDropMode(QAbstractItemView::DragDropMode::InternalMove); + setDnsListWidgetStyle(); - m_addDnsBtn = new QPushButton(this); + m_buttonBox = new KButtonBox(this); + m_buttonBox->setExclusive(false); + + m_addDnsBtn = new KPushButton(this); + m_addDnsBtn->setIcon(QIcon::fromTheme("list-add-symbolic")); m_addDnsBtn->setFixedSize(BUTTON_SIZE); m_addDnsBtn->setProperty("useButtonPalette", true); - m_addDnsBtn->setIcon(QIcon::fromTheme("list-add-symbolic")); - m_removeDnsBtn = new QPushButton(this); + m_removeDnsBtn = new KPushButton(this); + m_removeDnsBtn->setIcon(QIcon::fromTheme("list-remove-symbolic")); m_removeDnsBtn->setFixedSize(BUTTON_SIZE); m_removeDnsBtn->setProperty("useButtonPalette", true); - m_removeDnsBtn->setIcon(QIcon::fromTheme("list-remove-symbolic")); m_removeDnsBtn->setEnabled(false); + m_buttonBox->addButton(m_addDnsBtn); + m_buttonBox->addButton(m_removeDnsBtn); + + + m_settingsLabel = new KBorderlessButton(this); + m_settingsLabel->setText(tr("Settings")); + QHBoxLayout *btnHLayout = new QHBoxLayout(); btnHLayout->setContentsMargins(0, 0, 0, 0); btnHLayout->setSpacing(1); btnHLayout->setAlignment(Qt::AlignLeft); - btnHLayout->addWidget(m_addDnsBtn); - btnHLayout->addWidget(m_removeDnsBtn); + + btnHLayout->addWidget(m_buttonBox); + btnHLayout->addSpacing(23); + btnHLayout->addWidget(m_settingsLabel); mulDnsVLayout->addWidget(m_mulDnsLabel, Qt::AlignLeft); + mulDnsVLayout->addWidget(m_emptyWidget); mulDnsVLayout->addWidget(m_dnsListWidget); mulDnsVLayout->addLayout(btnHLayout); + + m_emptyWidget->show(); + m_dnsListWidget->hide(); + + if (!m_settingShow) { + m_settingsLabel->hide(); + } } void MultipleDnsWidget::initComponent() { connect(qApp, &QApplication::paletteChanged, this, &MultipleDnsWidget::setDnsListWidgetStyle); - connect(m_addDnsBtn, &QPushButton::clicked, this, &MultipleDnsWidget::onAddBtnClicked); - connect(m_removeDnsBtn, &QPushButton::clicked, this, &MultipleDnsWidget::onRemoveBtnClicked); + connect(m_addDnsBtn, &KPushButton::clicked, this, &MultipleDnsWidget::onAddBtnClicked); + connect(m_removeDnsBtn, &KPushButton::clicked, this, &MultipleDnsWidget::onRemoveBtnClicked); connect(m_dnsListWidget, &QListWidget::itemClicked, this, [=]() { if (m_dnsListWidget->count() < 1) { m_removeDnsBtn->setEnabled(false); @@ -84,8 +137,10 @@ void MultipleDnsWidget::initComponent() connect(m_dnsListWidget, &QListWidget::itemDoubleClicked, this, [=](QListWidgetItem *item) { m_dnsListWidget->edit(m_dnsListWidget->currentIndex()); item->setFlags(item->flags() | Qt::ItemIsEditable); - ListItemEdit *dnsListItemEdit = new ListItemEdit(m_regExp); - m_dnsListWidget ->setItemDelegateForRow(m_dnsListWidget->currentIndex().row(), dnsListItemEdit); + }); + + connect(m_settingsLabel, &KBorderlessButton::clicked, this, [&](){ + showDnsSettingWidget(); }); } @@ -108,7 +163,7 @@ QList MultipleDnsWidget::getDns() const QString aDns; while (m_dnsListWidget->count() > row) { aDns = m_dnsListWidget->item(row)->text(); - if (!dnsList.contains(aDns) && !aDns.isEmpty()) { + if (!dnsList.contains(aDns)) { dnsList << aDns; ipv4dnsList << QHostAddress(aDns); } @@ -120,22 +175,37 @@ QList MultipleDnsWidget::getDns() const void MultipleDnsWidget::setDnsListText(const QList &dns) { m_dnsListWidget->clear(); - for (QHostAddress str: dns) { + if (!dns.isEmpty()) { + m_dnsListWidget->setFixedHeight(DNS_LISTWIDGET_HEIGHT); + m_emptyWidget->hide(); + m_dnsListWidget->show(); + } + for (int i = 0; i < dns.size(); ++i) { + QString str = dns.at(i).toString(); QListWidgetItem *dnsListWidgetItem = new QListWidgetItem(m_dnsListWidget); dnsListWidgetItem->setSizeHint(QSize(0,ITEM_HEIGHT)); - dnsListWidgetItem->setText(str.toString()); + + ListItemEdit *dnsListItemEdit = new ListItemEdit(m_regExp, m_dnsListWidget); + m_dnsListWidget->setItemDelegateForRow(i, dnsListItemEdit); + dnsListWidgetItem->setText(str); } } void MultipleDnsWidget::AddOneDnsItem(QListWidget *listWidget) { + if (m_dnsListWidget->count() == 0) { + m_emptyWidget->hide(); + m_dnsListWidget->show(); + m_dnsListWidget->setFixedHeight(DNS_LISTWIDGET_HEIGHT); + Q_EMIT scrollToBottom(); + } QListWidgetItem *dnsListWidgetItem = new QListWidgetItem(listWidget); dnsListWidgetItem->setSizeHint(QSize(0,ITEM_HEIGHT)); dnsListWidgetItem->setFlags(dnsListWidgetItem->flags() | Qt::ItemIsEditable); listWidget->addItem(dnsListWidgetItem); listWidget->setCurrentItem(dnsListWidgetItem); - ListItemEdit *dnsListItemEdit = new ListItemEdit(m_regExp); + ListItemEdit *dnsListItemEdit = new ListItemEdit(m_regExp, listWidget); listWidget->setItemDelegateForRow(listWidget->currentIndex().row() , dnsListItemEdit); listWidget->editItem(dnsListWidgetItem); } @@ -146,15 +216,33 @@ void MultipleDnsWidget::RemoveOneDnsItem(QListWidgetItem *aItem, QListWidget *li listWidget->removeItemWidget(aItem); delete aItem; } + + if (m_dnsListWidget->count() == 0) { + m_emptyWidget->show(); + m_dnsListWidget->hide(); + m_dnsListWidget->setFixedHeight(DNS_LISTWIDGET_EMPTY_HEIGHT); + } } void MultipleDnsWidget::setDnsListWidgetStyle() { - QPalette mpal(m_dnsListWidget->palette()); - mpal.setColor(QPalette::Base, qApp->palette().base().color()); - mpal.setColor(QPalette::AlternateBase, qApp->palette().alternateBase().color()); + QPalette pal = qApp->palette(); + const QByteArray style_id(THEME_SCHAME); + if (QGSettings::isSchemaInstalled(style_id)) { + QGSettings styleGsettings(style_id); + QString currentTheme = styleGsettings.get(COLOR_THEME).toString(); + if(currentTheme == "ukui-default"){ + pal = lightPalette(this); + } + } + + this->setPalette(pal); + m_dnsListWidget->setAlternatingRowColors(true); - m_dnsListWidget->setPalette(mpal); + + QColor color = pal.color(QPalette::PlaceholderText); + pal.setColor(QPalette::WindowText, color); + emptyLabel->setPalette(pal); } void MultipleDnsWidget::onAddBtnClicked() @@ -185,3 +273,45 @@ void MultipleDnsWidget::onRemoveBtnClicked() m_removeDnsBtn->setEnabled(false); } } + +void MultipleDnsWidget::showDnsSettingWidget() +{ + QDBusInterface iface("com.kylin.network.enhancement.optimization", + "/com/kylin/network/enhancement/optimization/DNS", + "com.kylin.network.enhancement.optimization.DNS", + QDBusConnection::systemBus()); + + if (!iface.isValid()) { + return; + } + + QDBusMessage result = iface.call("GetExtraDns", m_uuid); + const QDBusArgument &dbusArg1st = result.arguments().at( 0 ).value(); + QVariantMap map = result.arguments().at(0).toMap(); + QString timeout, retry, tactic; + dbusArg1st >> map; + + QString originTimeout,originRetry,originType; + originTimeout = map.value(STR_TIMEOUT).toString(); + originRetry = map.value(STR_ATTEMPTS).toString(); + originType = map.value(STR_TYPE).toString(); + + timeout = !originTimeout.isEmpty() ? map.value(STR_TIMEOUT).toString() : "5"; + retry = !originRetry.isEmpty() ? map.value(STR_ATTEMPTS).toString() : "2"; + tactic = !originType.isEmpty() ? map.value(STR_TYPE).toString() : "order"; + + DnsSettingWidget* dialog = new DnsSettingWidget(timeout, retry, tactic); + kdk::UkuiStyleHelper::self()->removeHeader(dialog); + if (dialog->exec() == QDialog::Accepted) { + QString timeout, retry, tactic; + dialog->getDnsSettings(timeout, retry, tactic); + if (iface.isValid()) { + iface.call("SetOptions", m_uuid, timeout, retry, tactic); + } + if (timeout != originTimeout || retry != originRetry || tactic != originType) { + m_dnsSettingChanged = true; + } + } + delete dialog; + dialog = nullptr; +} diff --git a/src/frontend/netdetails/multiplednswidget.h b/src/frontend/netdetails/multiplednswidget.h index ba065dba..44f59717 100644 --- a/src/frontend/netdetails/multiplednswidget.h +++ b/src/frontend/netdetails/multiplednswidget.h @@ -33,34 +33,56 @@ #include #include "listitemedit.h" +#include "dnssettingwidget.h" +#include "kborderlessbutton.h" +#include "kbuttonbox.h" + +using namespace kdk; class MultipleDnsWidget: public QWidget { Q_OBJECT public: - MultipleDnsWidget(const QRegExp &rx, QWidget *parent = nullptr); + MultipleDnsWidget(const QRegExp &rx, bool settingShow = true, QWidget *parent = nullptr); ~MultipleDnsWidget() = default; void setEditEnabled(bool state); QList getDns() const; void setDnsListText(const QList &dns); + void setUuid(QString uuid) { + m_uuid = uuid; + } + bool getDnsSettingsChanged() { + return m_dnsSettingChanged; + } private: void initUI(); void initComponent(); void AddOneDnsItem(QListWidget *listWidget); void RemoveOneDnsItem(QListWidgetItem *aItem, QListWidget *listWidget); + void showDnsSettingWidget(); QLabel *m_mulDnsLabel; + QLabel *emptyLabel; + QFrame *m_emptyWidget; QListWidget *m_dnsListWidget = nullptr; - QPushButton *m_addDnsBtn; - QPushButton *m_removeDnsBtn; + KPushButton *m_addDnsBtn; + KPushButton *m_removeDnsBtn; + KButtonBox *m_buttonBox; + KBorderlessButton* m_settingsLabel; QRegExp m_regExp; + QString m_uuid; + bool m_settingShow; + bool m_dnsSettingChanged = false; private Q_SLOTS: void setDnsListWidgetStyle(); void onAddBtnClicked(); void onRemoveBtnClicked(); + +Q_SIGNALS: + void scrollToBottom(); }; #endif // MULTIPLEDNSWIDGET_H diff --git a/src/frontend/netdetails/netdetail.cpp b/src/frontend/netdetails/netdetail.cpp index 85fe1821..d628e9a7 100644 --- a/src/frontend/netdetails/netdetail.cpp +++ b/src/frontend/netdetails/netdetail.cpp @@ -18,8 +18,6 @@ * */ #include "netdetail.h" -#include "backend/kylinipv4arping.h" -#include "backend/kylinipv6arping.h" //#include "xatom/xatom-helper.h" #define THEME_SCHAME "org.ukui.style" @@ -29,8 +27,11 @@ #include #include #include +#include #include "windowmanager/windowmanager.h" +#include "kwindowsystem.h" +#include "kwindowsystem_export.h" #define WINDOW_WIDTH 520 #define WINDOW_HEIGHT 602 @@ -39,7 +40,7 @@ #define CENTER_LAYOUT_MARGINS 24,0,0,0 #define BOTTOM_LAYOUT_MARGINS 24,0,24,0 #define BOTTOM_LAYOUT_SPACING 16 -#define PAGE_LAYOUT_SPACING 1 + #define DETAIL_PAGE_NUM 0 #define IPV4_PAGE_NUM 1 #define IPV6_PAGE_NUM 2 @@ -56,6 +57,10 @@ #define TLS_SCRO_HEIGHT 480 #define MAX_TAB_TEXT_LENGTH 44 +#define SYSTEM_DBUS_SERVICE "com.kylin.network.qt.systemdbus" +#define SYSTEM_DBUS_PATH "/" +#define SYSTEM_DBUS_INTERFACE "com.kylin.network.interface" + //extern void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed); void NetDetail::showDesktopNotify(const QString &message, QString soundName) @@ -65,8 +70,8 @@ void NetDetail::showDesktopNotify(const QString &message, QString soundName) "org.freedesktop.Notifications", QDBusConnection::sessionBus()); QStringList actions; //跳转动作 - actions.append("kylin-nm"); - actions.append("default"); //默认动作:点击消息体时打开麒麟录音 + actions.append("default"); + actions.append("kylin-nm"); //默认动作:点击消息体时打开麒麟录音 QMap hints; if (!soundName.isEmpty()) { hints.insert("sound-name", soundName); //添加声音 @@ -102,27 +107,37 @@ void NetDetail::startObjectThread() m_object->moveToThread(m_objectThread); connect(m_objectThread, &QThread::finished, m_objectThread, &QObject::deleteLater); connect(m_objectThread, &QThread::finished, m_object, &QObject::deleteLater); - connect(ipv4Page, &Ipv4Page::ipv4EditFinished, this, [=](){ - ipv4Page->startLoading(); - }); - connect(ipv6Page, &Ipv6Page::ipv6EditFinished, this, [=](){ - ipv6Page->startLoading(); - }); + if (m_isCreateNet && !isWlan) { + connect(createNetPage, &CreatNetPage::ipv4EditFinished, this, [=](){ + createNetPage->startLoading(); + }); + connect(createNetPage, SIGNAL(ipv4EditFinished(const QString &)), m_object, SLOT(checkIpv4ConflictThread(const QString &))); + connect(m_object, &ThreadObject::ipv4IsConflict, this, [=](bool ipv4IsConf) { + createNetPage->stopLoading(); + createNetPage->showIpv4AddressConflict(ipv4IsConf); + }); + } else { + connect(ipv4Page, &Ipv4Page::ipv4EditFinished, this, [=](){ + ipv4Page->startLoading(); + }); + connect(ipv6Page, &Ipv6Page::ipv6EditFinished, this, [=](){ + ipv6Page->startLoading(); + }); - connect(ipv4Page, SIGNAL(ipv4EditFinished(const QString &)), m_object, SLOT(checkIpv4ConflictThread(const QString &))); - connect(ipv6Page, SIGNAL(ipv6EditFinished(const QString &)), m_object, SLOT(checkIpv6ConflictThread(const QString &))); - connect(this, SIGNAL(checkCurrentIpv4Conflict(const QString &)), m_object, SLOT(checkIpv4ConflictThread(const QString &))); - connect(this, SIGNAL(checkCurrentIpv6Conflict(const QString &)), m_object, SLOT(checkIpv6ConflictThread(const QString &))); - - connect(m_object, &ThreadObject::ipv4IsConflict, this, [=](bool ipv4IsConf) { - ipv4Page->stopLoading(); - ipv4Page->showIpv4AddressConflict(ipv4IsConf); - }); - connect(m_object, &ThreadObject::ipv6IsConflict, this, [=](bool ipv6IsConf) { - ipv6Page->stopLoading(); - ipv6Page->showIpv6AddressConflict(ipv6IsConf); - }); + connect(ipv4Page, SIGNAL(ipv4EditFinished(const QString &)), m_object, SLOT(checkIpv4ConflictThread(const QString &))); + connect(ipv6Page, SIGNAL(ipv6EditFinished(const QString &)), m_object, SLOT(checkIpv6ConflictThread(const QString &))); + connect(this, SIGNAL(checkCurrentIpv4Conflict(const QString &)), m_object, SLOT(checkIpv4ConflictThread(const QString &))); + connect(this, SIGNAL(checkCurrentIpv6Conflict(const QString &)), m_object, SLOT(checkIpv6ConflictThread(const QString &))); + connect(m_object, &ThreadObject::ipv4IsConflict, this, [=](bool ipv4IsConf) { + ipv4Page->stopLoading(); + ipv4Page->showIpv4AddressConflict(ipv4IsConf); + }); + connect(m_object, &ThreadObject::ipv6IsConflict, this, [=](bool ipv6IsConf) { + ipv6Page->stopLoading(); + ipv6Page->showIpv6AddressConflict(ipv6IsConf); + }); + } m_objectThread->start(); } @@ -144,20 +159,20 @@ NetDetail::NetDetail(QString interface, QString name, QString uuid, bool isActiv // XAtomHelper::getInstance()->setWindowMotifHint(this->winId(), window_hints); //#else // this->setWindowFlags(Qt::Dialog /*| Qt::FramelessWindowHint*/); - this->setWindowFlag(Qt::Window); +// this->setWindowFlag(Qt::Window); + KWindowSystem::setState(this->winId(), NET::SkipTaskbar | NET::SkipPager); //#endif // this->setProperty("useStyleWindowManager", false); //禁用拖动 // setWindowFlags(Qt::Dialog | Qt::FramelessWindowHint ); // setAttribute(Qt::WA_TranslucentBackground); + setWindowFlags(Qt::Dialog); setAttribute(Qt::WA_DeleteOnClose); setFixedSize(WINDOW_WIDTH,WINDOW_HEIGHT); centerToScreen(); - qDebug() << m_isCreateNet << name; if (!m_isCreateNet && name.isEmpty()) { m_isCreateNet = true; } - qDebug() << m_isCreateNet; m_netDeviceResource = new KyNetworkDeviceResourse(this); m_wirelessConnOpration = new KyWirelessConnectOperation(this); m_resource = new KyWirelessNetResource(this); @@ -169,6 +184,7 @@ NetDetail::NetDetail(QString interface, QString name, QString uuid, bool isActiv getConInfo(m_info); startObjectThread(); pagePadding(name,isWlan); + connect(qApp, &QApplication::paletteChanged, this, &NetDetail::onPaletteChanged); isCreateOk = !(m_isCreateNet && !isWlan); @@ -196,7 +212,10 @@ NetDetail::~NetDetail() void NetDetail::onPaletteChanged() { QPalette pal = qApp->palette(); + pal.setColor(QPalette::Background, pal.base().color()); + this->setPalette(pal); +#if 0 QGSettings * styleGsettings = nullptr; const QByteArray style_id(THEME_SCHAME); if (QGSettings::isSchemaInstalled(style_id)) { @@ -215,17 +234,20 @@ void NetDetail::onPaletteChanged() setFramePalette(securityPage, pal); setFramePalette(createNetPage, pal); QToolTip::setPalette(pal); +#endif QPalette listwidget_pal(detailPage->m_listWidget->palette()); listwidget_pal.setColor(QPalette::Base, pal.base().color()); listwidget_pal.setColor(QPalette::AlternateBase, pal.alternateBase().color()); detailPage->m_listWidget->setAlternatingRowColors(true); detailPage->m_listWidget->setPalette(listwidget_pal); - +#if 0 if (styleGsettings != nullptr) { delete styleGsettings; styleGsettings = nullptr; } + +#endif } void NetDetail::currentRowChangeSlot(int row) @@ -270,7 +292,6 @@ void NetDetail::centerToScreen() int desk_y = desk_rect.height(); int x = this->width(); int y = this->height(); -// this->move(desk_x / 2 - x / 2 + desk_rect.left(), desk_y / 2 - y / 2 + desk_rect.top()); kdk::WindowManager::setGeometry(this->windowHandle(), QRect(desk_x / 2 - x / 2 + desk_rect.left(), desk_y / 2 - y / 2 + desk_rect.top(), this->width(), @@ -281,7 +302,7 @@ void NetDetail::initUI() { QVBoxLayout *mainLayout = new QVBoxLayout(this); mainLayout->setContentsMargins(0,9,0,24); - mainLayout->setSpacing(22); + mainLayout->setSpacing(0); this->installEventFilter(this); pageFrame = new QFrame(this); @@ -303,6 +324,7 @@ void NetDetail::initUI() createNetPage->setFixedWidth(PAGE_WIDTH); configPage->setFixedWidth(PAGE_WIDTH); + // 滚动区域 m_secuPageScrollArea = new QScrollArea(centerWidget); m_secuPageScrollArea->setFixedWidth(SCRO_WIDTH); m_secuPageScrollArea->setFrameShape(QFrame::NoFrame); @@ -318,6 +340,12 @@ void NetDetail::initUI() m_ipv4ScrollArea->setWidget(ipv4Page); m_ipv4ScrollArea->setWidgetResizable(true); + connect(ipv4Page, &Ipv4Page::scrollToBottom, this, [&](){ + QTimer::singleShot(50,this,[=]() { + m_ipv4ScrollArea->verticalScrollBar()->setValue(m_ipv4ScrollArea->verticalScrollBar()->maximum()); + }); + }); + m_ipv6ScrollArea = new QScrollArea(centerWidget); m_ipv6ScrollArea->setFixedWidth(SCRO_WIDTH); m_ipv6ScrollArea->setFrameShape(QFrame::NoFrame); @@ -325,12 +353,18 @@ void NetDetail::initUI() m_ipv6ScrollArea->setWidget(ipv6Page); m_ipv6ScrollArea->setWidgetResizable(true); - QPalette pal = m_secuPageScrollArea->palette(); - pal.setBrush(QPalette::Base, QColor(0,0,0,0)); - m_secuPageScrollArea->setPalette(pal); - m_ipv4ScrollArea->setPalette(pal); - m_ipv6ScrollArea->setPalette(pal); + connect(ipv6Page, &Ipv6Page::scrollToBottom, this, [&](){ + QTimer::singleShot(50,this,[=]() { + m_ipv6ScrollArea->verticalScrollBar()->setValue(m_ipv6ScrollArea->verticalScrollBar()->maximum()); + }); + }); + m_createNetPageScrollArea = new QScrollArea(centerWidget); + m_createNetPageScrollArea->setFixedWidth(SCRO_WIDTH); + m_createNetPageScrollArea->setFrameShape(QFrame::NoFrame); + m_createNetPageScrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + m_createNetPageScrollArea->setWidget(createNetPage); + m_createNetPageScrollArea->setWidgetResizable(true); stackWidget = new QStackedWidget(centerWidget); stackWidget->addWidget(detailPage); @@ -338,7 +372,7 @@ void NetDetail::initUI() stackWidget->addWidget(m_ipv6ScrollArea); stackWidget->addWidget(m_secuPageScrollArea); stackWidget->addWidget(configPage); - stackWidget->addWidget(createNetPage); + stackWidget->addWidget(m_createNetPageScrollArea); // TabBar onPaletteChanged(); @@ -373,7 +407,6 @@ void NetDetail::initUI() cancelBtn = new QPushButton(this); cancelBtn->setText(tr("Cancel")); - forgetBtn = new QPushButton(this); QHBoxLayout *pageLayout = new QHBoxLayout(pageFrame); @@ -384,6 +417,8 @@ void NetDetail::initUI() centerlayout->setContentsMargins(CENTER_LAYOUT_MARGINS); // 右边距为0,为安全页滚动区域留出空间 centerlayout->addWidget(stackWidget); + Divider *divider = new Divider(false, this); + QHBoxLayout *bottomLayout = new QHBoxLayout(bottomWidget); bottomLayout->setContentsMargins(BOTTOM_LAYOUT_MARGINS); bottomLayout->setSpacing(BOTTOM_LAYOUT_SPACING); @@ -394,10 +429,14 @@ void NetDetail::initUI() bottomWidget->setMinimumHeight(PAGE_MIN_HEIGHT); mainLayout->addWidget(pageFrame); + mainLayout->addSpacing(24); mainLayout->addWidget(centerWidget); + mainLayout->addWidget(divider); + mainLayout->addSpacing(16); mainLayout->addWidget(bottomWidget); this->setAutoFillBackground(true); +// this->setPalette(pal); } void NetDetail::loadPage() @@ -493,22 +532,31 @@ void NetDetail::pagePadding(QString netName, bool isWlan) detailPage->setAutoConnect(m_info.isAutoConnect); //ipv4页面填充 - ipv4Page->setIpv4Config(m_info.ipv4ConfigType); + ipv4Page->setUuid(m_uuid); ipv4Page->setMulDns(m_info.ipv4DnsList); if (m_info.ipv4ConfigType == CONFIG_IP_MANUAL) { Q_EMIT checkCurrentIpv4Conflict(m_info.strIPV4Address); + ipv4Page->setIpv4Config(m_info.ipv4ConfigType); ipv4Page->setIpv4(m_info.strIPV4Address); ipv4Page->setNetMask(m_info.strIPV4NetMask); +// ipv4Page->setIpv4FirDns(m_info.strIPV4FirDns); +// ipv4Page->setIpv4SecDns(m_info.strIPV4SecDns); ipv4Page->setGateWay(m_info.strIPV4GateWay); + } else { + ipv4Page->setIpv4Config(m_info.ipv4ConfigType); } //ipv6页面填充 - ipv6Page->setIpv6Config(m_info.ipv6ConfigType); ipv6Page->setMulDns(m_info.ipv6DnsList); if (m_info.ipv6ConfigType == CONFIG_IP_MANUAL) { Q_EMIT checkCurrentIpv6Conflict(m_info.strIPV6Address); + ipv6Page->setIpv6Config(m_info.ipv6ConfigType); ipv6Page->setIpv6(m_info.strIPV6Address); ipv6Page->setIpv6Perfix(m_info.iIPV6Prefix); +// ipv6Page->setIpv6FirDns(m_info.strIPV6FirDns); +// ipv6Page->setIpv6SecDns(m_info.strIPV6SecDns); ipv6Page->setGateWay(m_info.strIPV6GateWay); + } else { + ipv6Page->setIpv6Config(m_info.ipv6ConfigType); } //安全页面 @@ -647,7 +695,15 @@ void NetDetail::getDynamicIpInfo(ConInfo &conInfo, bool bActived) } if (!ipv4Dns.isEmpty()) { - conInfo.strDynamicIpv4Dns = ipv4Dns.at(0).toString(); + //conInfo.strDynamicIpv4Dns = ipv4Dns.at(0).toString(); + QString dnsList; + dnsList.clear(); + for (QHostAddress str: ipv4Dns) { + dnsList.append(str.toString()); + dnsList.append("; "); + } + dnsList.chop(2); + conInfo.strDynamicIpv4Dns = dnsList; } } @@ -659,31 +715,26 @@ void NetDetail::getStaticIpInfo(ConInfo &conInfo, bool bActived) kyConnectResourse->getConnectionSetting(m_uuid,connetSetting); connetSetting.dumpInfo(); -// conInfo.ipv4ConfigType = connetSetting.m_ipv4ConfigIpType; + conInfo.ipv4ConfigType = connetSetting.m_ipv4ConfigIpType; conInfo.ipv6ConfigType = connetSetting.m_ipv6ConfigIpType; -// conInfo.ipv4DnsList = connetSetting.m_ipv4Dns; - conInfo.ipv6DnsList = connetSetting.m_ipv6Dns; conInfo.isAutoConnect = connetSetting.m_isAutoConnect; + conInfo.ipv4DnsList = connetSetting.m_ipv4Dns; + conInfo.ipv6DnsList = connetSetting.m_ipv6Dns; -// if (connetSetting.m_ipv4ConfigIpType == CONFIG_IP_MANUAL) { -// if (connetSetting.m_ipv4Address.size() > 0) { -// conInfo.strIPV4Address = connetSetting.m_ipv4Address.at(0).ip().toString(); -// conInfo.strIPV4NetMask = connetSetting.m_ipv4Address.at(0).netmask().toString(); -// conInfo.strIPV4GateWay = connetSetting.m_ipv4Address.at(0).gateway().toString(); -// } -// if (connetSetting.m_ipv4Dns.size() == 1) { -// conInfo.strIPV4FirDns = connetSetting.m_ipv4Dns.at(0).toString(); -// } else if (connetSetting.m_ipv4Dns.size() > 1) { -// conInfo.strIPV4FirDns = connetSetting.m_ipv4Dns.at(0).toString(); -// conInfo.strIPV4SecDns = connetSetting.m_ipv4Dns.at(1).toString(); -// } -// } - //openkylin从第三方库读取有问题 改为ipv4信息直接通过dbus获取 - KyConnectItem* item = kyConnectResourse->getConnectionItemByUuidWithoutActivateChecking(m_uuid); - if (item == nullptr) { - conInfo.ipv4ConfigType = CONFIG_IP_DHCP; - } else { - getIpv4Info(item->m_connectPath, conInfo); + if (connetSetting.m_ipv4ConfigIpType == CONFIG_IP_MANUAL) { + if (connetSetting.m_ipv4Address.size() > 0) { + conInfo.strIPV4Address = connetSetting.m_ipv4Address.at(0).ip().toString(); + conInfo.strIPV4NetMask = connetSetting.m_ipv4Address.at(0).netmask().toString(); + conInfo.strIPV4GateWay = connetSetting.m_ipv4Address.at(0).gateway().toString(); + } + #if 0 + if (connetSetting.m_ipv4Dns.size() == 1) { + conInfo.strIPV4FirDns = connetSetting.m_ipv4Dns.at(0).toString(); + } else if (connetSetting.m_ipv4Dns.size() > 1) { + conInfo.strIPV4FirDns = connetSetting.m_ipv4Dns.at(0).toString(); + conInfo.strIPV4SecDns = connetSetting.m_ipv4Dns.at(1).toString(); + } + #endif } if (connetSetting.m_ipv6ConfigIpType == CONFIG_IP_MANUAL) { @@ -692,23 +743,20 @@ void NetDetail::getStaticIpInfo(ConInfo &conInfo, bool bActived) conInfo.iIPV6Prefix = ipv6Page->getPerfixLength(connetSetting.m_ipv6Address.at(0).netmask().toString()); conInfo.strIPV6GateWay = connetSetting.m_ipv6Address.at(0).gateway().toString(); } - } - - QString dnsList; - dnsList.clear(); - if (!conInfo.ipv4DnsList.isEmpty()) { - for (QHostAddress str: conInfo.ipv4DnsList) { - dnsList.append(str.toString()); - dnsList.append("; "); +#if 0 + if (connetSetting.m_ipv6Dns.size() == 1) { + conInfo.strIPV6FirDns = connetSetting.m_ipv6Dns.at(0).toString(); + } else if (connetSetting.m_ipv6Dns.size() > 1) { + conInfo.strIPV6FirDns = connetSetting.m_ipv6Dns.at(0).toString(); + conInfo.strIPV6SecDns = connetSetting.m_ipv6Dns.at(1).toString(); } - dnsList.chop(2); - conInfo.strDynamicIpv4Dns = dnsList; +#endif } if (!bActived) { conInfo.strDynamicIpv4 = conInfo.strIPV4Address.isEmpty() ? tr("Auto") : conInfo.strIPV4Address; conInfo.strDynamicIpv6 = conInfo.strIPV6Address.isEmpty() ? tr("Auto") : conInfo.strIPV6Address; - conInfo.strDynamicIpv4Dns = conInfo.ipv4DnsList.isEmpty() ? tr("Auto") : conInfo.strDynamicIpv4Dns; + conInfo.strDynamicIpv4Dns = conInfo.strIPV4FirDns.isEmpty() ? tr("Auto") : conInfo.strIPV4FirDns; } } @@ -736,17 +784,17 @@ void NetDetail::initSecuData() case WPA_AND_WPA2_ENTERPRISE: if (!m_wirelessConnOpration->getEnterpiseEapMethod(m_uuid, m_info.enterpriseType)) { qDebug() << m_name << "not enterprise wifi"; - } else if (m_info.enterpriseType == TLS){ + } else if (m_info.enterpriseType == TLS) { initTlsInfo(m_info); - } else if (m_info.enterpriseType == PEAP){ + } else if (m_info.enterpriseType == PEAP) { initPeapInfo(m_info); - } else if (m_info.enterpriseType == TTLS){ + } else if (m_info.enterpriseType == TTLS) { initTtlsInfo(m_info); - } else if (m_info.enterpriseType == LEAP){ + } else if (m_info.enterpriseType == LEAP) { initLeapInfo(m_info); - } else if (m_info.enterpriseType == PWD){ + } else if (m_info.enterpriseType == PWD) { initPwdInfo(m_info); - } else if (m_info.enterpriseType == FAST){ + } else if (m_info.enterpriseType == FAST) { initFastInfo(m_info); } else { qWarning() << "[NetDetail] unknown enterprise connection type" << m_info.enterpriseType; @@ -912,7 +960,7 @@ void NetDetail::updateWirelessEnterPriseConnect(KyEapMethodType enterpriseType) securityPage->updateFastChange(m_info.fastInfo); m_wirelessConnOpration->updateWirelessEnterPriseFastConnect(m_uuid, m_info.fastInfo); } else { - qWarning() << "[NetDetail] unknow enterprise connection type"; + qWarning() << "[NetDetail] unknown enterprise connection type" << enterpriseType; } } @@ -1088,23 +1136,6 @@ bool NetDetail::updateConnect() bool ipv6Change = ipv6Page->checkIsChanged(m_info, connetSetting); qDebug() << "ipv4Changed" << ipv4Change << "ipv6Change" << ipv6Change; - -// if (ipv4Change && connetSetting.m_ipv4ConfigIpType == CONFIG_IP_MANUAL) { -// if (checkIpv4Conflict(connetSetting.m_ipv4Address.at(0).ip().toString())) { -// qDebug() << "ipv4 conflict"; -// showDesktopNotify(tr("ipv4 address conflict!"), "networkwrong"); -// return false; -// } -// } - -// if (ipv6Change && connetSetting.m_ipv6ConfigIpType == CONFIG_IP_MANUAL) { -// if (checkIpv6Conflict(connetSetting.m_ipv6Address.at(0).ip().toString())) { -// qDebug() << "ipv6 conflict"; -// showDesktopNotify(tr("ipv6 address conflict!"), "networkwrong"); -// return false; -// } -// } - if (ipv4Change || ipv6Change) { connetSetting.dumpInfo(); m_wiredConnOperation->updateWiredConnect(m_uuid, connetSetting); @@ -1119,7 +1150,7 @@ bool NetDetail::updateConnect() } } - if (ipv4Change || ipv6Change || securityChange) { + if (ipv4Change || ipv6Change || securityChange/* || ipv4Page->checkDnsSettingsIsChanged()*/) { if (isActive) { //信息变化 断开-重连 更新需要時間 不可以立即重連 // sleep(1); @@ -1203,26 +1234,7 @@ void NetDetail::setNetTabToolTip() NetTabBar::NetTabBar(QWidget *parent) :KTabBar(KTabBarStyle::SegmentDark, parent) { - //模式切换 - QDBusConnection::sessionBus().connect(QString("com.kylin.statusmanager.interface"), - QString("/"), - QString("com.kylin.statusmanager.interface"), - QString("mode_change_signal"), this, SLOT(onModeChanged(bool))); - //模式获取 - QDBusInterface interface(QString("com.kylin.statusmanager.interface"), - QString("/"), - QString("com.kylin.statusmanager.interface"), - QDBusConnection::sessionBus()); - if(!interface.isValid()) { - this->setFixedHeight(TAB_HEIGHT); - return; - } - QDBusReply reply = interface.call("get_current_tabletmode"); - if (!reply.isValid()) { - this->setFixedHeight(TAB_HEIGHT); - return; - } - onModeChanged(reply.value()); + } NetTabBar::~NetTabBar() @@ -1245,16 +1257,6 @@ QSize NetTabBar::minimumTabSizeHint(int index) const return size; } -void NetTabBar::onModeChanged(bool mode) -{ - if (mode) { - this->setFixedHeight(TAB_HEIGHT_TABLET); // 平板模式 - } else { - this->setFixedHeight(TAB_HEIGHT); // PC模式 - } -} - - ThreadObject::ThreadObject(QString deviceName, QObject *parent) :m_devName(deviceName), QObject(parent) { @@ -1277,33 +1279,37 @@ void ThreadObject::checkIpv4ConflictThread(const QString &ipv4Address) return; } bool isConflict = false; - KyIpv4Arping* ipv4Arping = new KyIpv4Arping(m_devName, ipv4Address); - if (ipv4Arping->ipv4ConflictCheck() >= 0) { - isConflict = ipv4Arping->ipv4IsConflict(); - if (isConflict) { - QString mac = ipv4Arping->getMacAddress(); - qDebug() << "conflict mac" << mac; - KyNetworkDeviceResourse resource; - QStringList devList,devList1,devList2; - resource.getNetworkDeviceList(NetworkManager::Device::Type::Ethernet, devList1); - resource.getNetworkDeviceList(NetworkManager::Device::Type::Wifi, devList2); - devList << devList1 << devList2; - for(int i = 0; i < devList.size(); ++i){ - QString hardAddress; - int band; - resource.getHardwareInfo(devList.at(i), hardAddress, band); - if (hardAddress == mac) { - qDebug() << "conflict local card" << devList.at(i); - isConflict = false; - } - } - } - } else { - qWarning() << "checkIpv4Conflict internal error"; + + QDBusInterface dbusInterface(SYSTEM_DBUS_SERVICE, + SYSTEM_DBUS_PATH, + SYSTEM_DBUS_INTERFACE, + QDBusConnection::systemBus()); + + if(!dbusInterface.isValid()) { + qWarning ()<< "check IPv4 conflict failed, init kylin.network.qt.systemdbus error"; + Q_EMIT ipv4IsConflict(isConflict); + return; + } + + KyNetworkDeviceResourse resource; + QStringList devList, devList1, devList2, macList; + resource.getNetworkDeviceList(NetworkManager::Device::Type::Ethernet, devList1); + resource.getNetworkDeviceList(NetworkManager::Device::Type::Wifi, devList2); + devList << devList1 << devList2; + for (int i = 0; i < devList.size(); ++i) { + QString hardAddress; + int band; + resource.getHardwareInfo(devList.at(i), hardAddress, band); + macList << hardAddress; + } + + QDBusReply reply = dbusInterface.call("checkIpv4IsConflict", m_devName, ipv4Address, macList); + if (reply.isValid()) { + isConflict = reply.value(); + } else { + qWarning () << "check IPv4 conflict failed, dbus reply invalid"; } - delete ipv4Arping; - ipv4Arping = nullptr; Q_EMIT ipv4IsConflict(isConflict); } @@ -1313,96 +1319,21 @@ void ThreadObject::checkIpv6ConflictThread(const QString &ipv6Address) return; } bool isConflict = false; - KyIpv6Arping* ipv6rping = new KyIpv6Arping(m_devName, ipv6Address); - if (ipv6rping->ipv6ConflictCheck() >= 0) { - isConflict = ipv6rping->ipv6IsConflict(); + QDBusInterface dbusInterface(SYSTEM_DBUS_SERVICE, + SYSTEM_DBUS_PATH, + SYSTEM_DBUS_INTERFACE, + QDBusConnection::systemBus()); + + if(!dbusInterface.isValid()) { + qWarning () << "check IPv6 conflict failed, init kylin.network.qt.systemdbus error"; } else { - qWarning() << "checkIpv6Conflict internal error"; + QDBusReply reply = dbusInterface.call("checkIpv6IsConflict", m_devName, ipv6Address); + if (reply.isValid()) { + isConflict = reply.value(); + } else { + qWarning () << "check IPv6 conflict failed, dbus reply invalid"; + } } - delete ipv6rping; - ipv6rping = nullptr; Q_EMIT ipv6IsConflict(isConflict); } - -void NetDetail::getIpv4Info(QString objPath, ConInfo &conInfo) -{ - QDBusInterface m_interface("org.freedesktop.NetworkManager", - objPath, - "org.freedesktop.NetworkManager.Settings.Connection", - QDBusConnection::systemBus()); - QDBusMessage result = m_interface.call("GetSettings"); - - if (result.arguments().isEmpty()) { return; } - const QDBusArgument &dbusArg1st = result.arguments().at( 0 ).value(); - QMap> map; - dbusArg1st >> map; - - for (QString key : map.keys() ) { - QMap innerMap = map.value(key); - if (key == "ipv4") { - for (QString inner_key : innerMap.keys()) { - if (inner_key == "address-data") { - //ipv4地址 ipv4子网掩码 - const QDBusArgument &dbusArg2nd = innerMap.value(inner_key).value(); - QVector> addressVector; - - dbusArg2nd.beginArray(); - - while (!dbusArg2nd.atEnd()) { - QMap tempMap; - dbusArg2nd >> tempMap; - addressVector.append(tempMap); - } - dbusArg2nd.endArray(); - if (addressVector.size() >= 1) { - conInfo.strIPV4Address = addressVector.at(0).value("address").toString(); - conInfo.strIPV4NetMask = ipv4Page->getNetMaskText(addressVector.at(0).value("prefix").toString()); - } - } else if (inner_key == "method") { - //ipv4 method - if (innerMap.value(inner_key).toString() == "auto") - conInfo.ipv4ConfigType = CONFIG_IP_DHCP; - else { - conInfo.ipv4ConfigType = CONFIG_IP_MANUAL; - } - } else if (inner_key == "dns") { - //dns - const QDBusArgument &dbusArg2nd = innerMap.value(inner_key).value(); - QList addressVector; - - dbusArg2nd.beginArray(); - while (!dbusArg2nd.atEnd()) { - uint tempMap; - dbusArg2nd >> tempMap; - QString dns(inet_ntoa(*(struct in_addr *)&tempMap)); - conInfo.ipv4DnsList << QHostAddress(dns); - } - dbusArg2nd.endArray(); - } else if (inner_key == "gateway") { - //gateway - conInfo.strIPV4GateWay = innerMap.value(inner_key).toString(); - } - } - } - // if (key == "ipv6") { - // for (QString inner_key : innerMap.keys()) { - // if (inner_key == "address-data"){ - // const QDBusArgument &dbusArg2nd = innerMap.value(inner_key).value(); - // QMap m_map; - - // dbusArg2nd.beginArray(); - // while (!dbusArg2nd.atEnd()) { - // dbusArg2nd >> m_map;// append map to a vector here if you want to keep it - // } - // dbusArg2nd.endArray(); - - // dbusWifiIpv6 = m_map.value("address").toString(); - // } else if (inner_key == "method") { - // dbusWifiIpv6Method = innerMap.value(inner_key).toString(); - // } - // } - // } - } - -} diff --git a/src/frontend/netdetails/netdetail.h b/src/frontend/netdetails/netdetail.h index 7c10d850..62877b9b 100644 --- a/src/frontend/netdetails/netdetail.h +++ b/src/frontend/netdetails/netdetail.h @@ -51,7 +51,6 @@ #include "kwidget.h" #include "ktabbar.h" #include "networkmodeconfig.h" -#include using namespace kdk; @@ -69,9 +68,6 @@ protected: QSize sizeHint() const; QSize minimumTabSizeHint(int index) const; -private Q_SLOTS: - void onModeChanged(bool mode); - }; class ThreadObject : public QObject { @@ -148,7 +144,6 @@ private: void startObjectThread(); void setNetTabToolTip(); - void getIpv4Info(QString objPath, ConInfo &conInfo); private: KyNetworkDeviceResourse *m_netDeviceResource = nullptr; KyConnectOperation* m_connectOperation = nullptr; @@ -170,6 +165,7 @@ private: QScrollArea * m_secuPageScrollArea; QScrollArea * m_ipv4ScrollArea; QScrollArea * m_ipv6ScrollArea; + QScrollArea * m_createNetPageScrollArea; QPushButton * cancelBtn; QPushButton * forgetBtn; diff --git a/src/frontend/netdetails/netdetails.pri b/src/frontend/netdetails/netdetails.pri index f06fe245..72d05b83 100644 --- a/src/frontend/netdetails/netdetails.pri +++ b/src/frontend/netdetails/netdetails.pri @@ -12,7 +12,8 @@ HEADERS += \ $$PWD/joinhiddenwifipage.h \ $$PWD/multiplednswidget.h \ $$PWD/netdetail.h \ - $$PWD/securitypage.h + $$PWD/securitypage.h \ + $$PWD/dnssettingwidget.h SOURCES += \ $$PWD/configpage.cpp \ @@ -25,4 +26,5 @@ SOURCES += \ $$PWD/joinhiddenwifipage.cpp \ $$PWD/multiplednswidget.cpp \ $$PWD/netdetail.cpp \ - $$PWD/securitypage.cpp + $$PWD/securitypage.cpp \ + $$PWD/dnssettingwidget.cpp diff --git a/src/frontend/netdetails/securitypage.cpp b/src/frontend/netdetails/securitypage.cpp index 934f60ed..1d700c6e 100644 --- a/src/frontend/netdetails/securitypage.cpp +++ b/src/frontend/netdetails/securitypage.cpp @@ -84,13 +84,6 @@ void SecurityPage::initUI() userPwdEdit->setUseCustomPalette(true); userPwdFlagBox = new QCheckBox(this); - QWidget *queryWidget = new QWidget(this); - QHBoxLayout *queryLayout = new QHBoxLayout(queryWidget); - queryLayout->setContentsMargins(0, 0, 0, 0); - queryLayout->addWidget(userPwdFlagBox); - queryLayout->addWidget(userPwdFlagLabel); - queryLayout->addStretch(); - //FAST m_pacCheckBox = new QCheckBox(this); m_pacProvisionComboBox = new QComboBox(this); @@ -100,6 +93,13 @@ void SecurityPage::initUI() m_pacFlagLabel = new FixLabel(this); m_pacFileLabel = new QLabel(this); + QWidget *queryWidget = new QWidget(this); + QHBoxLayout *queryLayout = new QHBoxLayout(queryWidget); + queryLayout->setContentsMargins(0, 0, 0, 0); + queryLayout->addWidget(userPwdFlagBox); + queryLayout->addWidget(userPwdFlagLabel); + queryLayout->addStretch(); + //记住该网络复选框 m_emptyLabel = new QLabel(this); m_emptyLabel->setMinimumWidth(MIN_LABEL_WIDTH - 8); @@ -156,7 +156,6 @@ void SecurityPage::initUI() topLayout->addWidget(userPwdLabel, 9, 0); topLayout->addWidget(userPwdEdit, 9, 1); - // CA证书选项框及CheckBox布局 QWidget *caWidget = new QWidget(this); QGridLayout *checkLayout = new QGridLayout(caWidget); @@ -1213,14 +1212,13 @@ void SecurityPage::changeColumnWidthWithSecuType() if (!isDetailPage) { return; } - if (secuTypeCombox->currentData().toInt() == WPA_AND_WPA2_ENTERPRISE) { - if (eapMethodCombox->currentData().toInt() == TLS || eapMethodCombox->currentData().toInt() == FAST) { - topLayout->setColumnMinimumWidth(0, MIN_LABEL_WIDTH); - topLayout->setColumnMinimumWidth(1, MIN_EDIT_WIDTH); - bottomLayout->setColumnMinimumWidth(0, MIN_LABEL_WIDTH - 8); + if (secuTypeCombox->currentData().toInt() == WPA_AND_WPA2_ENTERPRISE && + eapMethodCombox->currentData().toInt() == TLS) { + topLayout->setColumnMinimumWidth(0, MIN_LABEL_WIDTH); + topLayout->setColumnMinimumWidth(1, MIN_EDIT_WIDTH); + bottomLayout->setColumnMinimumWidth(0, MIN_LABEL_WIDTH - 8); - } - }else { + } else { topLayout->setColumnMinimumWidth(0, DETAIL_MIN_LABEL_WIDTH); topLayout->setColumnMinimumWidth(1, DETAIL_MIN_EDIT_WIDTH); } diff --git a/src/frontend/netdetails/securitypage.h b/src/frontend/netdetails/securitypage.h index 5519256f..46f7e8da 100644 --- a/src/frontend/netdetails/securitypage.h +++ b/src/frontend/netdetails/securitypage.h @@ -31,7 +31,6 @@ #include "kylable.h" #include "kwidget.h" #include "kpasswordedit.h" -#include "detailwidget.h" using namespace kdk; diff --git a/src/frontend/networkmode/networkmodeconfig.cpp b/src/frontend/networkmode/networkmodeconfig.cpp index 4decade3..2c4e52b6 100644 --- a/src/frontend/networkmode/networkmodeconfig.cpp +++ b/src/frontend/networkmode/networkmodeconfig.cpp @@ -104,10 +104,7 @@ NetworkMode::NetworkMode(QObject *parent) { qRegisterMetaType("NetworkManager::Device::State"); qRegisterMetaType("NetworkManager::Device::StateChangeReason"); - m_deviceResource = new KyNetworkDeviceResourse(this); m_activatedConnectResource = new KyActiveConnectResourse(this); - m_connectResource = new KyConnectResourse(this); - m_wirelessNetResource = new KyWirelessNetResource(this); connect(m_activatedConnectResource, &KyActiveConnectResourse::stateChangeReason, this, &NetworkMode::onConnectionStateChanged); } @@ -116,7 +113,8 @@ void NetworkMode::initWiredNetworkMode() { qDebug()<< LOG_FLAG << "initWiredNetworkMode"; QStringList wiredDevList; - m_deviceResource->getNetworkDeviceList(NetworkManager::Device::Type::Ethernet, wiredDevList); + KyNetworkDeviceResourse deviceResource; + deviceResource.getNetworkDeviceList(NetworkManager::Device::Type::Ethernet, wiredDevList); if (wiredDevList.isEmpty()) { return; } @@ -148,14 +146,16 @@ void NetworkMode::initWirelessNetworkMode() { qDebug()<< LOG_FLAG << "initWirelessNetworkMode"; QStringList wirelessDevList; - m_deviceResource->getNetworkDeviceList(NetworkManager::Device::Type::Wifi, wirelessDevList); + KyNetworkDeviceResourse deviceResource; + deviceResource.getNetworkDeviceList(NetworkManager::Device::Type::Wifi, wirelessDevList); if (wirelessDevList.isEmpty()) { return; } for (auto devName : wirelessDevList) { KyWirelessNetItem wirelessNetItem; - bool ret = m_wirelessNetResource->getActiveWirelessNetItem(devName, wirelessNetItem); + KyWirelessNetResource wirelessNetResource; + bool ret = wirelessNetResource.getActiveWirelessNetItem(devName, wirelessNetItem); if (ret == true) { int configType = NetworkModeConfig::getInstance()->getNetworkModeConfig(wirelessNetItem.m_connectUuid); @@ -205,9 +205,10 @@ void NetworkMode::onConnectionStateChanged(QString uuid, QString ssid = ""; int configType = NetworkModeConfig::getInstance()->getNetworkModeConfig(uuid); + KyConnectResourse connectResource; //有线网络连接 - if (m_connectResource->isWiredConnection(uuid)) { + if (connectResource.isWiredConnection(uuid)) { KyConnectItem *p_newItem = nullptr; p_newItem = m_activatedConnectResource->getActiveConnectionByUuid(uuid); if (nullptr == p_newItem) { @@ -229,9 +230,10 @@ void NetworkMode::onConnectionStateChanged(QString uuid, } } //无线网络连接 - if (m_connectResource->isWirelessConnection(uuid)) { - m_wirelessNetResource->getSsidByUuid(uuid, ssid); - m_wirelessNetResource->getDeviceByUuid(uuid, deviceName); + if (connectResource.isWirelessConnection(uuid)) { + KyWirelessNetResource wirelessNetResource; + wirelessNetResource.getSsidByUuid(uuid, ssid); + wirelessNetResource.getDeviceByUuid(uuid, deviceName); if (ssid.isEmpty()) { //忘记此网络 qDebug()<< LOG_FLAG << "forgrt wireless connect:" << uuid <<", call break_networkConnect"; diff --git a/src/frontend/networkmode/networkmodeconfig.h b/src/frontend/networkmode/networkmodeconfig.h index 87773fcb..94c41f80 100644 --- a/src/frontend/networkmode/networkmodeconfig.h +++ b/src/frontend/networkmode/networkmodeconfig.h @@ -64,10 +64,7 @@ public: void initWirelessNetworkMode(); private: - KyNetworkDeviceResourse *m_deviceResource = nullptr; KyActiveConnectResourse *m_activatedConnectResource = nullptr; - KyConnectResourse * m_connectResource = nullptr; - KyWirelessNetResource *m_wirelessNetResource = nullptr; void setFirstConnectNetworkMode(QString uuid, QString deviceName, QString ssid); private Q_SLOTS: diff --git a/src/frontend/tab-pages/lanpage.cpp b/src/frontend/tab-pages/lanpage.cpp index 10e7b72a..c8bea0c3 100644 --- a/src/frontend/tab-pages/lanpage.cpp +++ b/src/frontend/tab-pages/lanpage.cpp @@ -63,6 +63,10 @@ LanPage::LanPage(QWidget *parent) : TabPage(parent) connect(m_connectResourse, &KyConnectResourse::connectionRemove, this, &LanPage::onRemoveConnection); connect(m_connectResourse, &KyConnectResourse::connectionUpdate, this, &LanPage::onUpdateConnection); + connect(m_connectResourse, &KyConnectResourse::needShowDesktop, this, [=](QString ip) { + this->showDesktopNotify(ip + tr("conflict, unable to connect to the network normally!"), QString()); + }); + connect(m_deviceResource, &KyNetworkDeviceResourse::deviceAdd, this, &LanPage::onDeviceAdd); connect(m_deviceResource, &KyNetworkDeviceResourse::deviceRemove, this, &LanPage::onDeviceRemove); connect(m_deviceResource, &KyNetworkDeviceResourse::deviceNameUpdate, this, &LanPage::onDeviceNameUpdate); @@ -150,8 +154,7 @@ void LanPage::initNetSwitch() // wiredGsetting = m_switchGsettings->get(WIRED_SWITCH).toBool(); // connect(m_switchGsettings, &QGSettings::changed, this, &LanPage::onSwithGsettingsChanged); // if (wiredEnable != wiredGsetting) { -// wiredEnable = wiredGsetting; -// m_wiredConnectOperation->setWiredEnabled(wiredGsetting); +// m_switchGsettings->set(WIRED_SWITCH, wiredEnable); // } // } // } else { @@ -349,9 +352,11 @@ void LanPage::constructActiveConnectionArea() p_activeConnectionItem = nullptr; } setNetSpeed->start(REFRESH_NETWORKSPEED_TIMER); + m_activatedLanListWidget->setSelectionMode(QAbstractItemView::SelectionMode::SingleSelection); } else { qDebug()<<"[LanPage] there is not active"; addEmptyConnectItem(m_activeConnectionMap, m_activatedLanListWidget); + m_activatedLanListWidget->setSelectionMode(QAbstractItemView::SelectionMode::NoSelection); } return; @@ -405,7 +410,11 @@ void LanPage::initLanArea() constructConnectionArea(); } - return; + if (!m_activeConnectionMap.isEmpty() && !m_activeConnectionMap.contains(EMPTY_CONNECT_UUID) && !setNetSpeed->isActive()) { + setNetSpeed->start(); + } else { + setNetSpeed->stop(); + } } bool LanPage::removeConnectionItem(QMap &connectMap, @@ -456,6 +465,7 @@ void LanPage::onRemoveConnection(QString path) //删除时后端会 removeConnectionItem(m_activeConnectionMap, m_activatedLanListWidget, path); if (m_activeConnectionMap.count() <= 0) { addEmptyConnectItem(m_activeConnectionMap, m_activatedLanListWidget); + m_activatedLanListWidget->setSelectionMode(QAbstractItemView::SelectionMode::NoSelection); } setNetSpeed->stop(); return; @@ -525,7 +535,8 @@ void LanPage::addDeviceForCombox(QString deviceName) void LanPage::onDeviceAdd(QString deviceName, NetworkManager::Device::Type deviceType) { - if (!m_deviceResource->deviceIsWired(deviceName)) { + Q_UNUSED(deviceType) + if (!m_deviceResource->checkDeviceType(deviceName, NetworkManager::Device::Type::Ethernet)) { return; } @@ -831,6 +842,8 @@ QListWidgetItem *LanPage::addNewItem(KyConnectItem *itemData, QListWidget *listW void LanPage::updateActivatedConnectionArea(KyConnectItem *p_newItem) { + m_activatedLanListWidget->setSelectionMode(QAbstractItemView::SelectionMode::SingleSelection); + if (m_activeConnectionMap.contains(p_newItem->m_connectUuid)) { return; } @@ -859,6 +872,7 @@ void LanPage::updateConnectionArea(KyConnectItem *p_newItem) deleteConnectionMapItem(m_activeConnectionMap, m_activatedLanListWidget, p_newItem->m_connectUuid); if (m_activeConnectionMap.count() <= 0) { addEmptyConnectItem(m_activeConnectionMap, m_activatedLanListWidget); + m_activatedLanListWidget->setSelectionMode(QAbstractItemView::SelectionMode::NoSelection); } if (p_newItem->m_ifaceName == m_currentDeviceName || p_newItem->m_ifaceName == "") { @@ -1313,6 +1327,38 @@ bool LanPage::lanIsConnected() } } +void LanPage::getWiredDeviceConnectState(QMap &map) +{ + map.clear(); + if (m_enableDeviceList.isEmpty()) { + return; + } + + for (const auto devname : m_enableDeviceList) { + NetworkManager::Connectivity state; + QList activedList; + m_deviceResource->getDeviceConnectivity(devname, state); + + if (state < NetworkManager::Connectivity::Full) { + m_activeResourse->getActiveConnectionList(devname, NetworkManager::ConnectionSettings::Wired, activedList); + if (!activedList.isEmpty()) { + map.insert(devname, QString(tr("Connected: ")) + activedList.at(0)->m_connectName + " " + QString(tr("(Limited)"))); + } else { + map.insert(devname, tr("Not Connected")); + } + + } else if (state == NetworkManager::Connectivity::Full) { + m_activeResourse->getActiveConnectionList(devname, NetworkManager::ConnectionSettings::Wired, activedList); + if (!activedList.isEmpty()) { + map.insert(devname, QString(tr("Connected: ")) + activedList.at(0)->m_connectName); + } + + } else { + qDebug() << devname << " Network connectivity is unknown."; + } + } +} + void LanPage::showRate() { //定时获取网速 diff --git a/src/frontend/tab-pages/lanpage.h b/src/frontend/tab-pages/lanpage.h index be91f14e..ab401e8f 100644 --- a/src/frontend/tab-pages/lanpage.h +++ b/src/frontend/tab-pages/lanpage.h @@ -44,13 +44,14 @@ public: //for dbus void getWiredList(QMap > &map); - void deleteWired(const QString& connUuid); void activateWired(const QString& devName, const QString& connUuid); void deactivateWired(const QString& devName, const QString& connUuid); void showDetailPage(QString devName, QString uuid); void setWiredDeviceEnable(const QString& devName, bool enable); + void deleteWired(const QString &connUuid); bool lanIsConnected(); + void getWiredDeviceConnectState(QMap &map); protected: bool eventFilter(QObject *watched, QEvent *event); diff --git a/src/frontend/tab-pages/tabpage.cpp b/src/frontend/tab-pages/tabpage.cpp index 1bacfd3c..4644d397 100644 --- a/src/frontend/tab-pages/tabpage.cpp +++ b/src/frontend/tab-pages/tabpage.cpp @@ -60,7 +60,7 @@ void TabPage::initUI() m_titleLayout->addWidget(m_titleLabel); m_titleLayout->addStretch(); m_titleLayout->addWidget(m_netSwitch); - m_titleDivider = new Divider(this); + m_titleDivider = new Divider(true, this); //临时增加的下拉框选择网卡区域 m_deviceFrame = new QFrame(this); @@ -71,7 +71,9 @@ void TabPage::initUI() m_deviceLabel = new QLabel(m_deviceFrame); m_deviceLabel->setText(tr("Current Device")); m_deviceComboBox = new QComboBox(m_deviceFrame); - m_deviceComboBox->setFixedWidth(DEVICE_COMBOBOX_WIDTH); + m_deviceComboBox->setMinimumWidth(DEVICE_COMBOBOX_WIDTH); + m_deviceComboBox->setMaximumWidth(DEVICE_COMBOBOX_WIDTH_MAX); + m_deviceComboBox->setSizeAdjustPolicy(QComboBox::SizeAdjustPolicy::AdjustToContents); m_tipsLabel = new QLabel(m_deviceFrame); m_tipsLabel->setText(tr("Devices Closed!")); @@ -90,7 +92,7 @@ void TabPage::initUI() m_activatedNetLabel->setContentsMargins(TEXT_MARGINS); m_activatedNetLabel->setFixedHeight(TEXT_HEIGHT); m_activatedNetLayout->addWidget(m_activatedNetLabel); - m_activatedNetDivider = new Divider(this); + m_activatedNetDivider = new Divider(true, this); m_inactivatedNetFrame = new QFrame(this); m_inactivatedNetFrame->setMinimumHeight(INACTIVE_AREA_MIN_HEIGHT); @@ -118,7 +120,7 @@ void TabPage::initUI() m_inactivatedNetLayout->addWidget(m_inactivatedNetLabel); m_inactivatedNetLayout->addWidget(m_inactivatedNetListArea); - m_inactivatedNetDivider = new Divider(this); + m_inactivatedNetDivider = new Divider(true, this); m_settingsFrame = new QFrame(this); m_settingsFrame->setFixedHeight(TITLE_FRAME_HEIGHT); @@ -159,15 +161,17 @@ void TabPage::initUI() void TabPage::onPaletteChanged() { QPalette labPal = m_activatedNetLabel->palette(); - QColor color = qApp->palette().color(QPalette::PlaceholderText); + QColor color = this->palette().color(QPalette::PlaceholderText); labPal.setColor(QPalette::WindowText, color); m_activatedNetLabel->setPalette(labPal); m_inactivatedNetLabel->setPalette(labPal); if (m_deviceComboBox->view()) { QPalette view_pal = m_deviceComboBox->view()->palette(); - QColor view_color = qApp->palette().color(QPalette::Active, QPalette::Button); + QColor view_color = this->palette().color(QPalette::Active, QPalette::Button); view_pal.setColor(QPalette::Base, view_color); + view_pal.setColor(QPalette::Text, this->palette().color(QPalette::Text)); + view_pal.setColor(QPalette::Foreground, this->palette().color(QPalette::Foreground)); m_deviceComboBox->setPalette(view_pal); m_deviceComboBox->view()->setPalette(view_pal); } @@ -315,8 +319,8 @@ void TabPage::showDesktopNotify(const QString &message, QString soundName) "org.freedesktop.Notifications", QDBusConnection::sessionBus()); QStringList actions; //跳转动作 - actions.append("kylin-nm"); - actions.append("default"); //默认动作:点击消息体时打开麒麟录音 + actions.append("default"); + actions.append("kylin-nm"); //默认动作:点击消息体时打开麒麟录音 QMap hints; if (!soundName.isEmpty()) { hints.insert("sound-name",soundName); //添加声音 diff --git a/src/frontend/tab-pages/tabpage.h b/src/frontend/tab-pages/tabpage.h index ded45ee2..462e38b7 100644 --- a/src/frontend/tab-pages/tabpage.h +++ b/src/frontend/tab-pages/tabpage.h @@ -50,6 +50,7 @@ using namespace kdk; #define TITLE_LAYOUT_MARGINS 24,0,24,0 #define DEVICE_LAYOUT_MARGINS 24,0,24,8 #define DEVICE_COMBOBOX_WIDTH 180 +#define DEVICE_COMBOBOX_WIDTH_MAX 230 #define ACTIVE_NET_LAYOUT_MARGINS 8,8,8,8 #define NET_LAYOUT_MARGINS 8,8,0,1 #define NET_LAYOUT_SPACING 8 @@ -109,6 +110,7 @@ public: Q_SIGNALS: void deviceStatusChanged(); + void wirelessDeviceStatusChanged(); void deviceNameChanged(QString oldName, QString newName, int type); void activateFailed(QString errorMessage); void deactivateFailed(QString errorMessage); diff --git a/src/frontend/tab-pages/wlanpage.cpp b/src/frontend/tab-pages/wlanpage.cpp index 5da79676..5d1f506c 100644 --- a/src/frontend/tab-pages/wlanpage.cpp +++ b/src/frontend/tab-pages/wlanpage.cpp @@ -46,6 +46,7 @@ WlanPage::WlanPage(QWidget *parent) : TabPage(parent) m_connectResource = new KyConnectResourse(this); m_wirelessConnectOpreation = new KyWirelessConnectOperation(this); + checkShowWifi6Plus(); initDevice(); initWlanUI(); initWlanSwitchState(); @@ -62,6 +63,7 @@ WlanPage::WlanPage(QWidget *parent) : TabPage(parent) connect(m_wirelessNetResource, &KyWirelessNetResource::connectionAdd, this, &WlanPage::onConnectionAdd); connect(m_wirelessNetResource, &KyWirelessNetResource::connectionRemove, this, &WlanPage::onConnectionRemove); + connect(m_wirelessNetResource, &KyWirelessNetResource::connectionUpdate, this, &WlanPage::onConnectionUpdate); connect(m_activatedConnectResource, &KyActiveConnectResourse::stateChangeReason, this, &WlanPage::onConnectionStateChanged); @@ -70,6 +72,7 @@ WlanPage::WlanPage(QWidget *parent) : TabPage(parent) connect(m_netDeviceResource, &KyNetworkDeviceResourse::deviceRemove, this, &WlanPage::onDeviceRemove); connect(m_netDeviceResource, &KyNetworkDeviceResourse::deviceNameUpdate, this, &WlanPage::onDeviceNameUpdate); + connect(m_netDeviceResource, &KyNetworkDeviceResourse::deviceManagedChange, this, &WlanPage::onDeviceManagedChanged); connect(m_netDeviceResource, &KyNetworkDeviceResourse::stateChanged, this, &WlanPage::onWlanStateChanged); connect(m_wirelessConnectOpreation, &KyWirelessConnectOperation::activateConnectionError, this, &WlanPage::activateFailed); @@ -153,11 +156,12 @@ void WlanPage::initWlanUI() addWlanMoreItem(); m_inactivatedAreaLayout->addWidget(m_inactivatedNetListWidget); - connect(m_inactivatedNetListWidget, &QListWidget::currentItemChanged, this, [=]() { - if (m_inactivatedNetListWidget->currentItem() != nullptr) { - m_inactivatedNetListWidget->currentItem()->setSelected(false); - } - }); + connect(m_inactivatedNetListWidget, &QListWidget::currentItemChanged, + this, &WlanPage::onInactivateListWidgetItemChanged); + + //点击【已连接】网络区域 去掉其他网络的选中效果 + connect(m_activatedNetListWidget, &QListWidget::clicked, this, &WlanPage::setInactivateListItemNoSelect); + connect(m_activatedNetListWidget, &QListWidget::currentItemChanged, this, &WlanPage::setInactivateListItemNoSelect); QPalette pal = m_activatedNetListWidget->palette(); pal.setBrush(QPalette::Base, QColor(0,0,0,0)); //背景透明 @@ -193,6 +197,21 @@ bool WlanPage::getWirelessEnable() return m_wirelessConnectOpreation->getWirelessEnabled(); } +void WlanPage::checkShowWifi6Plus() +{ + //990下不显示wifi6+图标 + QProcess * processCpuinfo = new QProcess(this); + processCpuinfo->start(QString("cat /proc/cpuinfo")); + connect(processCpuinfo, static_cast(&QProcess::finished), this, [ = ]() { + processCpuinfo->deleteLater(); + }); + processCpuinfo->waitForFinished(); + QString ctrCpuinfo = processCpuinfo->readAll(); + if (ctrCpuinfo.indexOf("Kirin", 0, Qt::CaseInsensitive) != -1 && ctrCpuinfo.indexOf("990") != -1) { + m_showWifi6Plus = false; + } +} + void WlanPage::initWlanSwitchState() { if (m_devList.isEmpty()) { @@ -225,6 +244,17 @@ void WlanPage::initDevice() m_netDeviceResource->getNetworkDeviceList(NetworkManager::Device::Type::Wifi, m_devList); m_currentDevice = getDefaultDeviceName(WIRELESS); + + if (m_devList.count() == 0) { + return; + } + for (int index = m_devList.count() - 1; index >= 0; --index) { + if (!m_netDeviceResource->getDeviceManaged(m_devList.at(index))) { + //删除未托管网卡 + qDebug() << LOG_FLAG << "delete unmanaged device" << m_devList.at(index); + m_devList.removeOne(m_devList.at(index)); + } + } return; } @@ -293,7 +323,8 @@ QListWidgetItem *WlanPage::addNewItem(KyWirelessNetItem &wirelessNetItem, WlanListItem *p_wlanItem = new WlanListItem( wirelessNetItem, m_currentDevice, - m_connectResource->isApConnection(wirelessNetItem.m_connectUuid)); + m_connectResource->isApConnection(wirelessNetItem.m_connectUuid), + m_showWifi6Plus); connect(p_wlanItem, &WlanListItem::itemHeightChanged, this, &WlanPage::onItemHeightChanged); connect(p_wlanItem, &WlanListItem::detailShow, this, &WlanPage::showDetailPage); @@ -310,7 +341,7 @@ QListWidgetItem *WlanPage::insertNewItem(KyWirelessNetItem &wirelessNetItem, QListWidget *wirelessListWidget, int row) { - WlanListItem *p_wlanItem = new WlanListItem(wirelessNetItem, m_currentDevice); + WlanListItem *p_wlanItem = new WlanListItem(wirelessNetItem, m_currentDevice, m_showWifi6Plus); connect(p_wlanItem, &WlanListItem::itemHeightChanged, this, &WlanPage::onItemHeightChanged); connect(p_wlanItem, &WlanListItem::detailShow, this, &WlanPage::showDetailPage); @@ -331,7 +362,7 @@ QListWidgetItem *WlanPage::insertNewItemWithSort(KyWirelessNetItem &wirelessNetI // qDebug()<< "insertNewItemWithSort" << wirelessNetItem.m_NetSsid // <<"sort item config" << wirelessNetItem.m_isConfigured // << "signal strength" << wirelessNetItem.m_signalStrength; - WlanListItem *p_sortWlanItem = new WlanListItem(wirelessNetItem, m_currentDevice); + WlanListItem *p_sortWlanItem = new WlanListItem(wirelessNetItem, m_currentDevice, m_showWifi6Plus); connect(p_sortWlanItem, &WlanListItem::itemHeightChanged, this, &WlanPage::onItemHeightChanged); connect(p_sortWlanItem, &WlanListItem::detailShow, this, &WlanPage::showDetailPage); @@ -453,12 +484,14 @@ void WlanPage::constructActivateConnectionArea() height += p_listWidgetItem->sizeHint().height(); setNetSpeed->start(REFRESH_NETWORKSPEED_TIMER); + m_activatedNetListWidget->setSelectionMode(QAbstractItemView::SelectionMode::SingleSelection); } } if (height == 0) { QListWidgetItem *p_listWidgetItem = addEmptyItem(m_activatedNetListWidget); m_activateConnectionItemMap.insert(EMPTY_SSID, p_listWidgetItem); + m_activatedNetListWidget->setSelectionMode(QAbstractItemView::SelectionMode::NoSelection); height += p_listWidgetItem->sizeHint().height(); } @@ -528,12 +561,20 @@ void WlanPage::initWlanArea() void WlanPage::onWlanAdded(QString interface, KyWirelessNetItem &item) { //for dbus + int category = 0; + category = item.getCategory(item.m_uni); + + //990 WiFi6+对应图标显示为WiFi6 + if (!m_showWifi6Plus && category == 2) { + category = 1; + } + QStringList info; info << item.m_NetSsid << QString::number(item.m_signalStrength) << item.m_secuType << (m_connectResource->isApConnection(item.m_connectUuid) ? IsApConnection : NotApConnection) - << QString::number(item.getCategory(item.m_uni)); + << QString::number(category); Q_EMIT wlanAdd(interface, info); if (interface != m_currentDevice) { @@ -598,6 +639,7 @@ void WlanPage::onWlanRemoved(QString interface, QString ssid) QListWidgetItem *p_listWidgetItem = addEmptyItem(m_activatedNetListWidget); m_activateConnectionItemMap.insert(EMPTY_SSID, p_listWidgetItem); + m_activatedNetListWidget->setSelectionMode(QAbstractItemView::SelectionMode::NoSelection); } return; @@ -647,6 +689,13 @@ void WlanPage::onConnectionRemove(QString deviceName, QString ssid, QString path return; } +void WlanPage::onConnectionUpdate(QString deviceName, QString ssid) +{ + if (deviceName == m_currentDevice || deviceName.isEmpty()) { + updateWlanListItem(ssid); + } +} + void WlanPage::onSecurityTypeChange(QString devName, QString ssid, QString secuType) { QListWidgetItem *p_listWidgetItem = nullptr; @@ -681,7 +730,7 @@ void WlanPage::addDeviceToCombox(QString deviceName) m_deviceFrame->hide(); m_currentDevice = deviceName; setDefaultDevice(WIRELESS, m_currentDevice); - } else if (m_deviceComboBox->count() == 0) { + } else if (m_deviceComboBox->count() == 0 && m_currentDevice != deviceName) { m_deviceComboBox->addItem(m_currentDevice); m_deviceComboBox->addItem(deviceName); m_deviceFrame->show(); @@ -708,6 +757,11 @@ void WlanPage::onDeviceAdd(QString deviceName, NetworkManager::Device::Type devi return; } + if (!m_netDeviceResource->getDeviceManaged(deviceName)) { + qWarning() << LOG_FLAG << "couldn not add device" << deviceName << ", it is unmanaged"; + return; + } + m_devList << deviceName; setSwitchBtnEnable(true); setSwitchBtnState(getWirelessDevieceUseable()); @@ -717,7 +771,7 @@ void WlanPage::onDeviceAdd(QString deviceName, NetworkManager::Device::Type devi initWlanArea(); } - Q_EMIT deviceStatusChanged(); + Q_EMIT wirelessDeviceStatusChanged(); return; } @@ -740,7 +794,7 @@ void WlanPage::deleteDeviceFromCombox(QString deviceName) m_currentDevice = m_devList.at(0); setDefaultDevice(WIRELESS, m_currentDevice); } else { - int index = m_deviceComboBox->findData(deviceName); + int index = m_deviceComboBox->findText(deviceName); if (-1 != index) { m_deviceComboBox->removeItem(index); m_currentDevice = m_deviceComboBox->currentText(); @@ -782,7 +836,7 @@ void WlanPage::onDeviceRemove(QString deviceName) initWlanArea(); } - Q_EMIT deviceStatusChanged(); + Q_EMIT wirelessDeviceStatusChanged(); } void WlanPage::updateDeviceForCombox(QString oldDeviceName, QString newDeviceName) @@ -834,6 +888,54 @@ void WlanPage::onWlanStateChanged(NetworkManager::Device::State newstate, Networ Q_EMIT wirelessSwitchBtnChanged(getSwitchBtnState()); } +void WlanPage::onDeviceManagedChanged(QString deviceName, bool managed) +{ + if (!m_netDeviceResource->checkDeviceType(deviceName, NetworkManager::Device::Type::Wifi)) { + return; + } + + if (managed && !m_devList.contains(deviceName)) { + //添加新增托管网卡 + onDeviceAdd(deviceName, NetworkManager::Device::Type::Wifi); + qDebug() << LOG_FLAG << "add managed device" << deviceName; + } + if (!managed && m_devList.contains(deviceName)) { + //删除未托管网卡 + onDeviceRemove(deviceName); + qDebug() << LOG_FLAG << "delete unmanaged device" << deviceName; + } +} + +void WlanPage::onInactivateListWidgetItemChanged(QListWidgetItem *current, QListWidgetItem *previous) +{ + if (previous != nullptr && previous->sizeHint().height() > NORMAL_HEIGHT) { + + QSize normalSize(previous->sizeHint().width(), NORMAL_HEIGHT); + previous->setSizeHint(normalSize); + WlanListItem *p_wlanItem = (WlanListItem*)m_inactivatedNetListWidget->itemWidget(previous); + if (p_wlanItem != nullptr) { + p_wlanItem->setExpanded(false); + } + } + + if (current != nullptr) { + current->setSelected(false); + } +} + +void WlanPage::setInactivateListItemNoSelect() +{ + if (m_inactivatedNetListWidget->currentItem() != nullptr + && m_inactivatedNetListWidget->currentItem()->sizeHint().height() > NORMAL_HEIGHT) { + + WlanListItem *p_wlanItem = (WlanListItem*)m_inactivatedNetListWidget->itemWidget(m_inactivatedNetListWidget->currentItem()); + if (p_wlanItem != nullptr) { + p_wlanItem->setExpanded(false); + } + m_inactivatedNetListWidget->currentItem()->setSelected(false); + } +} + void WlanPage::sendApStateChangeSignal(QString uuid, QString ssid, QString deviceName, @@ -878,6 +980,8 @@ void WlanPage::wlanShowNotify(QString ssid, NetworkManager::ActiveConnection::St void WlanPage::updateActivatedArea(QString uuid, QString ssid, QString devName) { + m_activatedNetListWidget->setSelectionMode(QAbstractItemView::SelectionMode::SingleSelection); + if (m_activateConnectionItemMap.contains(ssid)) { return; } @@ -889,7 +993,7 @@ void WlanPage::updateActivatedArea(QString uuid, QString ssid, QString devName) m_inactivatedNetListWidget, ssid); KyWirelessNetItem wirelessNetItem; - bool ret = m_wirelessNetResource->getWifiNetwork(devName, ssid, wirelessNetItem); + bool ret = m_wirelessNetResource->getActiveWirelessNetItem(devName, wirelessNetItem); if (!ret) { qWarning()<<"[WlanPage] get wireless item failed, when update activated connection area."; return; @@ -932,6 +1036,7 @@ void WlanPage::updateWirelessNetArea(QString uuid, QString ssid, QString devName deleteWirelessItemFormMap(m_activateConnectionItemMap, m_activatedNetListWidget, ssid); QListWidgetItem *p_activeListWidgetItem = addEmptyItem(m_activatedNetListWidget); m_activateConnectionItemMap.insert(EMPTY_SSID, p_activeListWidgetItem); + m_activatedNetListWidget->setSelectionMode(QAbstractItemView::SelectionMode::NoSelection); m_activatedNetListWidget->setFixedHeight(p_activeListWidgetItem->sizeHint().height()); } } else { @@ -993,6 +1098,25 @@ void WlanPage::onConnectionStateChanged(QString uuid, return; } + if (state == NetworkManager::ActiveConnection::State::Deactivating || + state == NetworkManager::ActiveConnection::State::Deactivated) { + if (!m_activateConnectionItemMap.contains(ssid)) { + //check uuid + QMap::iterator iter; + for(iter = m_activateConnectionItemMap.begin(); iter!= m_activateConnectionItemMap.end(); iter++) + { + if(iter.value() != nullptr) { + QListWidgetItem *p_listWidgetItem = iter.value(); + WlanListItem *p_wlanItem = (WlanListItem*)m_activatedNetListWidget->itemWidget(p_listWidgetItem); + if (p_wlanItem->getUuid() == uuid) { + ssid = p_wlanItem->getSsid(); + break; + } + } + } + } + } + qDebug()<< "[WlanPage] wlan state changed, ssid = " << ssid << "; state = " << state << "; reason = " << reason << Q_FUNC_INFO <<__LINE__; if (state == NetworkManager::ActiveConnection::State::Activated) { @@ -1047,6 +1171,7 @@ void WlanPage::onItemHeightChanged(const bool isExpanded, const QString &ssid) if (isExpanded) { if (m_expandedItem != p_listWidgetItem) { + onInactivateListWidgetItemChanged(p_listWidgetItem, m_expandedItem); qDebug()<getActiveConnectionInfo(m_currentDevice, signalStrength, uni, secuType); + refreshActiveConnectionIcon(activateSsid, signalStrength); continue; } @@ -1204,7 +1334,7 @@ void WlanPage::onRefreshIconTimer() int takeRow = m_inactivatedNetListWidget->row(p_sortListWidgetItem); m_inactivatedNetListWidget->takeItem(takeRow); - WlanListItem *p_sortWlanItem = new WlanListItem(sortItem, m_currentDevice); + WlanListItem *p_sortWlanItem = new WlanListItem(sortItem, m_currentDevice, m_showWifi6Plus); connect(p_sortWlanItem, &WlanListItem::itemHeightChanged, this, &WlanPage::onItemHeightChanged); connect(p_sortWlanItem, &WlanListItem::detailShow, this, &WlanPage::showDetailPage); m_inactivatedNetListWidget->insertItem(sortRow, p_sortListWidgetItem); @@ -1257,6 +1387,9 @@ void WlanPage::getWirelessList(QMap > &map) if (m_netDeviceResource->getActiveConnectionInfo(iter.key(), signalStrength, uni, secuType)) { category = data.getCategory(uni); } + if (!m_showWifi6Plus && category == 2) { + category = 1; + } vector.append(QStringList() << data.m_NetSsid << QString::number(signalStrength) << secuType @@ -1275,11 +1408,16 @@ void WlanPage::getWirelessList(QMap > &map) if (itemData.m_NetSsid == activeSsid) { continue; } + int category = 0; + category = itemData.getCategory(itemData.m_uni); + if (!m_showWifi6Plus && category == 2) { + category = 1; + } vector.append(QStringList()<isApConnection(itemData.m_connectUuid) ? IsApConnection : NotApConnection) - << QString::number(itemData.getCategory(itemData.m_uni))); + << QString::number(category)); } map.insert(iter.key(), vector); @@ -1381,6 +1519,7 @@ void WlanPage::activateWirelessConnection(const QString& devName, const QString& WlanListItem *p_wlanItem = nullptr; if (m_wirelessNetItemMap.contains(ssid)) { + Q_EMIT showMainWindow(WLAN_PAGE_INDEX); p_listWidgetItem = m_wirelessNetItemMap.value(ssid); p_wlanItem = (WlanListItem*)m_inactivatedNetListWidget->itemWidget(p_listWidgetItem); @@ -1389,7 +1528,6 @@ void WlanPage::activateWirelessConnection(const QString& devName, const QString& QMouseEvent *event = new QMouseEvent(QEvent::MouseButtonPress, QPoint(0,0), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); QApplication::postEvent(p_wlanItem, event); - Q_EMIT showMainWindow(WLAN_PAGE_INDEX); } else { qDebug() << "[WlanPage]activateWirelessConnection no such " << ssid << "in" << devName; } @@ -1443,6 +1581,8 @@ void WlanPage::onWlanPageVisibleChanged(int index) qDebug() << "wlanpage not visible"; showNonePwd(); } + + m_inactivatedNetListWidget->setCurrentIndex(QModelIndex()); // 去除item选中效果 } void WlanPage::showNonePwd() @@ -1593,7 +1733,27 @@ void WlanPage::addWlanMoreItem() return; } -int WlanPage::getAcivateWifiSignal() +int WlanPage::getActivateWifiSignal(QString devName) { - return m_activatedConnectResource->getAcivateWifiSignal(); + return m_activatedConnectResource->getActivateWifiSignal(devName); +} + +void WlanPage::getWirelssDeviceConnectState(QMap &map) +{ + map.clear(); + if (m_devList.isEmpty()) { + return; + } + + for (const auto devname : m_devList) { + KyWirelessNetItem wirelessNetItem; + if (!m_netDeviceResource->getDeviceManaged(devname)) { + continue; + } + if (m_wirelessNetResource->getActiveWirelessNetItem(devname, wirelessNetItem)) { + map.insert(devname, QString(tr("Connected: ")) + wirelessNetItem.m_NetSsid); + } else { + map.insert(devname, tr("Not Connected")); + } + } } diff --git a/src/frontend/tab-pages/wlanpage.h b/src/frontend/tab-pages/wlanpage.h index 26d0cbfc..dd26c361 100644 --- a/src/frontend/tab-pages/wlanpage.h +++ b/src/frontend/tab-pages/wlanpage.h @@ -79,7 +79,14 @@ public: bool getWirelessSwitchBtnState(); - int getAcivateWifiSignal(); + int getActivateWifiSignal(QString devName = ""); + + //无线网卡连通性 + void getWirelssDeviceConnectState(QMap &map); + + QString getCurrentDisplayDevice() { + return m_currentDevice; + } Q_SIGNALS: void oneItemExpanded(const QString &ssid); @@ -112,6 +119,7 @@ private Q_SLOTS: void onConnectionAdd(QString deviceName, QString ssid); void onConnectionRemove(QString deviceName, QString ssid, QString path); + void onConnectionUpdate(QString deviceName, QString ssid); void onDeviceAdd(QString deviceName, NetworkManager::Device::Type deviceType); void onDeviceRemove(QString deviceName); @@ -129,6 +137,10 @@ private Q_SLOTS: void onRefreshIconTimer(); void onWlanStateChanged(NetworkManager::Device::State newstate, NetworkManager::Device::State oldstate, NetworkManager::Device::StateChangeReason reason); + void onDeviceManagedChanged(QString deviceName, bool managed); + + void onInactivateListWidgetItemChanged(QListWidgetItem *current, QListWidgetItem *previous); + void setInactivateListItemNoSelect(); protected: bool eventFilter(QObject *watched, QEvent *event); @@ -210,6 +222,9 @@ private: } } + void checkShowWifi6Plus(); + bool m_showWifi6Plus = true; + private: QMap m_wirelessNetItemMap; QMap m_activateConnectionItemMap; diff --git a/src/frontend/tools/divider.cpp b/src/frontend/tools/divider.cpp index 03f088a8..164a9d0b 100644 --- a/src/frontend/tools/divider.cpp +++ b/src/frontend/tools/divider.cpp @@ -21,20 +21,43 @@ #include #include -Divider::Divider(QWidget * parent) : QFrame(parent) +#include "../netdetails/coninfo.h" +#include "themepalette.h" + +#define THEME_SCHAME "org.ukui.style" +#define COLOR_THEME "styleName" + +Divider::Divider(bool useDarkPal, QWidget * parent) + :m_useDarkPal(useDarkPal), + QFrame(parent) { this->setFixedHeight(1); + connect(qApp, &QApplication::paletteChanged, this ,&Divider::onPaletteChanged); + onPaletteChanged(); } +void Divider::onPaletteChanged() +{ + QPalette pal = qApp->palette(); + QGSettings * styleGsettings = nullptr; + const QByteArray styleId(THEME_SCHAME); + if (QGSettings::isSchemaInstalled(styleId) && m_useDarkPal) { + styleGsettings = new QGSettings(styleId, QByteArray(), this); + QString currentTheme = styleGsettings->get(COLOR_THEME).toString(); + if(currentTheme == "ukui-default"){ + pal = themePalette(true, this); + } + } + m_color = pal.color(QPalette::BrightText); + m_color.setAlphaF(0.08); +} void Divider::paintEvent(QPaintEvent * e) { QPainter p(this); - QColor color = qApp->palette().color(QPalette::BrightText); - color.setAlphaF(0.08); p.save(); - p.setBrush(color); + p.setBrush(m_color); p.setPen(Qt::transparent); p.drawRoundedRect(this->rect(), 6, 6); p.restore(); diff --git a/src/frontend/tools/divider.h b/src/frontend/tools/divider.h index 47c4e66b..2d493000 100644 --- a/src/frontend/tools/divider.h +++ b/src/frontend/tools/divider.h @@ -24,11 +24,15 @@ class Divider : public QFrame { public: - Divider(QWidget * parent = nullptr); + Divider(bool useDarkPal = false, QWidget * parent = nullptr); ~Divider() = default; - +private: + bool m_useDarkPal; + QColor m_color; +private Q_SLOTS: + void onPaletteChanged(); protected: - void paintEvent(QPaintEvent *event); + void paintEvent(QPaintEvent * e); }; #endif // DIVIDER_H diff --git a/src/frontend/tools/infobutton.cpp b/src/frontend/tools/infobutton.cpp index 1a2803cf..3c1902c1 100644 --- a/src/frontend/tools/infobutton.cpp +++ b/src/frontend/tools/infobutton.cpp @@ -22,20 +22,22 @@ #include #include #include +#include +#include "themepalette.h" #define BUTTON_SIZE 36,36 #define ICON_SIZE 16,16 #define BACKGROUND_COLOR QColor(0,0,0,0) -#define FOREGROUND_COLOR_NORMAL qApp->palette().text().color() -//#define FOREGROUND_COLOR_HOVER QColor(55,144,250,255) -//#define FOREGROUND_COLOR_PRESS QColor(36,109,212,255) -#define FOREGROUND_COLOR_BRIGHTTEXT qApp->palette().brightText().color() -#define FOREGROUND_COLOR_HIGHLIGHT qApp->palette().highlight().color() +#define FOREGROUND_COLOR_NORMAL this->palette().text().color() +#define FOREGROUND_COLOR_BRIGHTTEXT this->palette().brightText().color() +#define FOREGROUND_COLOR_HIGHLIGHT this->palette().highlight().color() #define OUTER_PATH 8,10,16,16 #define INNER_PATH 9,11,14,14 #define TEXT_POS 14,7,16,16,0 #define BUTTON_SIZE 36,36 +#define THEME_SCHAME "org.ukui.style" +#define COLOR_THEME "styleName" QColor mixColor(const QColor &c1, const QColor &c2, qreal bias); @@ -44,6 +46,17 @@ InfoButton::InfoButton(QWidget *parent) : QPushButton(parent) this->setFixedSize(BUTTON_SIZE); initUI(); connect(qApp, &QApplication::paletteChanged, this, &InfoButton::onPaletteChanged); + + const QByteArray id(THEME_SCHAME); + if (QGSettings::isSchemaInstalled(id)) { + QGSettings * styleGsettings = new QGSettings(id, QByteArray(), this); + connect(styleGsettings, &QGSettings::changed, this, [=](QString key){ + if ("themeColor" == key) { + onPaletteChanged(); + } + }); + } + onPaletteChanged(); } void InfoButton::initUI() @@ -55,6 +68,23 @@ void InfoButton::initUI() void InfoButton::onPaletteChanged() { + QPalette pal = qApp->palette(); + QGSettings * styleGsettings = nullptr; + const QByteArray styleId(THEME_SCHAME); + if (QGSettings::isSchemaInstalled(styleId)) { + styleGsettings = new QGSettings(styleId, QByteArray(), this); + QString currentTheme = styleGsettings->get(COLOR_THEME).toString(); + if(currentTheme == "ukui-default"){ + pal = themePalette(true, this); + } + } + pal.setColor(QPalette::Base, pal.color(QPalette::Base));//解决Wayland环境this->setPalette(pal)不生效问题 + pal.setColor(QPalette::Text, pal.color(QPalette::Text)); + pal.setColor(QPalette::Highlight, pal.color(QPalette::Highlight)); + pal.setColor(QPalette::BrightText, pal.color(QPalette::BrightText)); + + this->setPalette(pal); + m_foregroundColor = FOREGROUND_COLOR_NORMAL; this->repaint(); } diff --git a/src/frontend/tools/kylable.cpp b/src/frontend/tools/kylable.cpp index 53a3dc1b..46229b8e 100644 --- a/src/frontend/tools/kylable.cpp +++ b/src/frontend/tools/kylable.cpp @@ -25,7 +25,7 @@ #include #include -#define FOREGROUND_COLOR_NORMAL qApp->palette().text().color() +#define FOREGROUND_COLOR_NORMAL this->palette().text().color() static inline qreal mixQreal(qreal a, qreal b, qreal bias) { diff --git a/src/frontend/tools/kylable.h b/src/frontend/tools/kylable.h index 30cc8913..7907198b 100644 --- a/src/frontend/tools/kylable.h +++ b/src/frontend/tools/kylable.h @@ -22,6 +22,7 @@ #include #include +#include "themepalette.h" class FixLabel : public QLabel { diff --git a/src/frontend/tools/radioitembutton.cpp b/src/frontend/tools/radioitembutton.cpp index c46d8550..27cd57c5 100644 --- a/src/frontend/tools/radioitembutton.cpp +++ b/src/frontend/tools/radioitembutton.cpp @@ -24,6 +24,8 @@ #include #include #include +#include "themepalette.h" + #define FLASH_SPEED 100 #define TIMEOUT_TIMER 90*1000 #define BUTTON_SIZE 36,36 @@ -35,9 +37,11 @@ #define FOREGROUND_COLOR_PRESS_INACTIVE_DARK QColor(70,70,70,255) #define FOREGROUND_COLOR_NORMAL_ACTIVE QColor(55,144,250,255) #define FOREGROUND_COLOR_PRESS_ACTIVE QColor(36,109,212,255) -#define COLOR_BRIGHT_TEXT qApp->palette().brightText().color() -#define COLOR_HIGH_LIGHT qApp->palette().highlight().color() + +#define COLOR_BRIGHT_TEXT this->palette().brightText().color() +#define COLOR_HIGH_LIGHT this->palette().highlight().color() #define THEME_SCHAME "org.ukui.style" +#define COLOR_THEME "styleName" QColor mixColor(const QColor &c1, const QColor &c2, qreal bias); @@ -61,6 +65,9 @@ RadioItemButton::RadioItemButton(QWidget *parent) : QPushButton(parent) } }); } + + onPaletteChanged(); + //JXJ_TODO loading动画 connect(this, &RadioItemButton::requestStartLoading, this, &RadioItemButton::onLoadingStarted); connect(this , &RadioItemButton::requestStopLoading, this, &RadioItemButton::onLoadingStopped); @@ -139,6 +146,21 @@ void RadioItemButton::onLoadingStopped() void RadioItemButton::onPaletteChanged() { + QPalette pal = qApp->palette(); + QGSettings * styleGsettings = nullptr; + const QByteArray styleId(THEME_SCHAME); + if (QGSettings::isSchemaInstalled(styleId)) { + styleGsettings = new QGSettings(styleId, QByteArray(), this); + QString currentTheme = styleGsettings->get(COLOR_THEME).toString(); + if(currentTheme == "ukui-default"){ + pal = themePalette(true, this); + } + } + pal.setColor(QPalette::Base, pal.color(QPalette::Base)); //解决Wayland环境this->setPalette(pal)不生效问题 + pal.setColor(QPalette::BrightText, pal.color(QPalette::BrightText)); + pal.setColor(QPalette::Highlight, pal.color(QPalette::Highlight)); + + this->setPalette(pal); refreshButtonIcon(); } @@ -232,7 +254,7 @@ void RadioItemButton::refreshButtonIcon() } else { m_backgroundColor = COLOR_BRIGHT_TEXT; m_backgroundColor.setAlphaF(0.12); - if (qApp->palette().base().color().red() > MIDDLE_COLOR) { + if (this->palette().base().color().red() > MIDDLE_COLOR) { m_iconLabel->setPixmap(m_pixmap); } else { m_iconLabel->setPixmap(loadSvg(m_pixmap, PixmapColor::WHITE)); diff --git a/src/frontend/tools/themepalette.h b/src/frontend/tools/themepalette.h new file mode 100644 index 00000000..2c1d0402 --- /dev/null +++ b/src/frontend/tools/themepalette.h @@ -0,0 +1,219 @@ +#ifndef THEMEPALETTE_H +#define THEMEPALETTE_H + +#include +#include + +static QPalette themePalette(bool isDark, QWidget *widget) +{ + QPalette palette = qApp->palette(); + + //ukui-light palette UKUI3.1 + QColor windowText_at(38, 38, 38), + windowText_iat(0, 0, 0, 255 * 0.55), + windowText_dis(0, 0, 0, 255 * 0.3), + button_at(230, 230, 230), + button_iat(230, 230, 230), + button_dis(233, 233, 233), + light_at(255, 255, 255), + light_iat(255, 255, 255), + light_dis(242, 242, 242), + midlight_at(218, 218, 218), + midlight_iat(218, 218, 218), + midlight_dis(230, 230, 230), + dark_at(77, 77, 77), + dark_iat(77, 77, 77), + dark_dis(64, 64, 64), + mid_at(115, 115, 115), + mid_iat(115, 115, 115), + mid_dis(102, 102, 102), + text_at(38, 38, 38), + text_iat(38, 38, 38), + text_dis(0, 0, 0, 255 * 0.3), + brightText_at(0, 0, 0), + brightText_iat(0, 0, 0), + brightText_dis(0, 0, 0), + buttonText_at(38, 38, 38), + buttonText_iat(38, 38, 38), + buttonText_dis(179, 179, 179), + base_at(255, 255, 255), + base_iat(245, 245, 245), + base_dis(237, 237, 237), + window_at(245, 245, 245), + window_iat(237, 237, 237), + window_dis(230, 230, 230), + shadow_at(0, 0, 0, 255 * 0.16), + shadow_iat(0, 0, 0, 255 * 0.16), + shadow_dis(0, 0, 0, 255 * 0.21), + highLight_at(55, 144, 250), + highLight_iat(55, 144, 250), + highLight_dis(233, 233, 233), + highLightText_at(255, 255, 255), + highLightText_iat(255, 255, 255), + highLightText_dis(179, 179, 179), + link_at(55, 144, 250), + link_iat(55, 144, 250), + link_dis(55, 144, 250), + linkVisited_at(114, 46, 209), + linkVisited_iat(114, 46, 209), + linkVisited_dis(114, 46, 209), + alternateBase_at(245, 245, 245), + alternateBase_iat(245, 245, 245), + alternateBase_dis(245, 245, 245), + noRale_at(240, 240, 240), + noRole_iat(240, 240, 240), + noRole_dis(217, 217, 217), + toolTipBase_at(255, 255, 255), + toolTipBase_iat(255, 255, 255), + toolTipBase_dis(255, 255, 255), + toolTipText_at(38, 38, 38), + toolTipText_iat(38, 38, 38), + toolTipText_dis(38, 38, 38), + placeholderText_at(0, 0, 0, 255 * 0.35), + placeholderText_iat(0, 0, 0, 255 * 0.35), + placeholderText_dis(0, 0, 0, 255 * 0.3); + + //ukui-dark + if (isDark) { + windowText_at.setRgb(217, 217, 217); + windowText_iat.setRgb(255, 255, 255, 255 * 0.55); + windowText_dis.setRgb(255, 255, 255, 255 * 0.3); + button_at.setRgb(55, 55, 59); + button_iat.setRgb(55, 55, 59); + button_dis.setRgb(46, 46, 46); + light_at.setRgb(255, 255, 255); + light_iat.setRgb(255, 255, 255); + light_dis.setRgb(242, 242, 242); + midlight_at.setRgb(95, 95, 98); + midlight_iat.setRgb(95, 95, 98); + midlight_dis.setRgb(79, 79, 82); + dark_at.setRgb(38, 38, 38); + dark_iat.setRgb(38, 38, 38); + dark_dis.setRgb(26, 26, 26); + mid_at.setRgb(115, 115, 115); + mid_iat.setRgb(115, 115, 115); + mid_dis.setRgb(102, 102, 102); + text_at.setRgb(217, 217, 217); + text_iat.setRgb(217, 217, 217); + text_dis.setRgb(255, 255, 255, 255 * 0.3); + brightText_at.setRgb(255, 255, 255); + brightText_iat.setRgb(255, 255, 255); + brightText_dis.setRgb(255, 255, 255); + buttonText_at.setRgb(217, 217, 217); + buttonText_iat.setRgb(217, 217, 217); + buttonText_dis.setRgb(76, 76, 79); + base_at.setRgb(29, 29, 29); + base_iat.setRgb(28, 28, 28); + base_dis.setRgb(36, 36, 36); + window_at.setRgb(35, 36, 38); + window_iat.setRgb(26, 26, 26); + window_dis.setRgb(18, 18, 18); + shadow_at.setRgb(0, 0, 0, 255 * 0.16); + shadow_iat.setRgb(0, 0, 0, 255 * 0.16); + shadow_dis.setRgb(0, 0, 0, 255 * 0.21); + highLight_at.setRgb(55, 144, 250); + highLight_iat.setRgb(55, 144, 250); + highLight_dis.setRgb(46, 46, 46); + highLightText_at.setRgb(255, 255, 255); + highLightText_iat.setRgb(255, 255, 255); + highLightText_dis.setRgb(77, 77, 77); + link_at.setRgb(55, 144, 250); + link_iat.setRgb(55, 144, 250); + link_dis.setRgb(55, 144, 250); + linkVisited_at.setRgb(114, 46, 209); + linkVisited_iat.setRgb(114, 46, 209); + linkVisited_dis.setRgb(114, 46, 209); + alternateBase_at.setRgb(38, 38, 38); + alternateBase_iat.setRgb(38, 38, 38); + alternateBase_dis.setRgb(38, 38, 38); + noRale_at.setRgb(51, 51, 51); + noRole_iat.setRgb(51, 51, 51); + noRole_dis.setRgb(60, 60, 60); + toolTipBase_at.setRgb(38, 38, 38); + toolTipBase_iat.setRgb(38, 38, 38); + toolTipBase_dis.setRgb(38, 38, 38); + toolTipText_at.setRgb(217, 217, 217); + toolTipText_iat.setRgb(217, 217, 217); + toolTipText_dis.setRgb(217, 217, 217); + placeholderText_at.setRgb(255, 255, 255, 255 * 0.35); + placeholderText_iat.setRgb(255, 255, 255, 255 * 0.35); + placeholderText_dis.setRgb(255, 255, 255, 255 * 0.3); + } + palette.setColor(QPalette::Active, QPalette::WindowText, windowText_at); + palette.setColor(QPalette::Inactive, QPalette::WindowText, windowText_iat); + palette.setColor(QPalette::Disabled, QPalette::WindowText, windowText_dis); + + palette.setColor(QPalette::Active, QPalette::Button, button_at); + palette.setColor(QPalette::Inactive, QPalette::Button, button_iat); + palette.setColor(QPalette::Disabled, QPalette::Button, button_dis); + + palette.setColor(QPalette::Active, QPalette::Light, light_at); + palette.setColor(QPalette::Inactive, QPalette::Light, light_iat); + palette.setColor(QPalette::Disabled, QPalette::Light, light_dis); + + palette.setColor(QPalette::Active, QPalette::Midlight, midlight_at); + palette.setColor(QPalette::Inactive, QPalette::Midlight, midlight_iat); + palette.setColor(QPalette::Disabled, QPalette::Midlight, midlight_dis); + + palette.setColor(QPalette::Active, QPalette::Dark, dark_at); + palette.setColor(QPalette::Inactive, QPalette::Dark, dark_iat); + palette.setColor(QPalette::Disabled, QPalette::Dark, dark_dis); + + palette.setColor(QPalette::Active, QPalette::Mid, mid_at); + palette.setColor(QPalette::Inactive, QPalette::Mid, mid_iat); + palette.setColor(QPalette::Disabled, QPalette::Mid, mid_dis); + + palette.setColor(QPalette::Active, QPalette::Text, text_at); + palette.setColor(QPalette::Inactive, QPalette::Text, text_iat); + palette.setColor(QPalette::Disabled, QPalette::Text, text_dis); + + palette.setColor(QPalette::Active, QPalette::BrightText, brightText_at); + palette.setColor(QPalette::Inactive, QPalette::BrightText, brightText_iat); + palette.setColor(QPalette::Disabled, QPalette::BrightText, brightText_dis); + + palette.setColor(QPalette::Active, QPalette::ButtonText, buttonText_at); + palette.setColor(QPalette::Inactive, QPalette::ButtonText, buttonText_iat); + palette.setColor(QPalette::Disabled, QPalette::ButtonText, buttonText_dis); + + palette.setColor(QPalette::Active, QPalette::Base, base_at); + palette.setColor(QPalette::Inactive, QPalette::Base, base_iat); + palette.setColor(QPalette::Disabled, QPalette::Base, base_dis); + + palette.setColor(QPalette::Active, QPalette::Window, window_at); + palette.setColor(QPalette::Inactive, QPalette::Window, window_iat); + palette.setColor(QPalette::Disabled, QPalette::Window, window_dis); + + palette.setColor(QPalette::Active, QPalette::Shadow, shadow_at); + palette.setColor(QPalette::Inactive, QPalette::Shadow, shadow_iat); + palette.setColor(QPalette::Disabled, QPalette::Shadow, shadow_dis); + + palette.setColor(QPalette::Active, QPalette::HighlightedText, highLightText_at); + palette.setColor(QPalette::Inactive, QPalette::HighlightedText, highLightText_iat); + palette.setColor(QPalette::Disabled, QPalette::HighlightedText, highLightText_dis); + + palette.setColor(QPalette::Active, QPalette::AlternateBase, alternateBase_at); + palette.setColor(QPalette::Inactive, QPalette::AlternateBase, alternateBase_iat); + palette.setColor(QPalette::Disabled, QPalette::AlternateBase, alternateBase_dis); + + palette.setColor(QPalette::Active, QPalette::NoRole, noRale_at); + palette.setColor(QPalette::Inactive, QPalette::NoRole, noRole_iat); + palette.setColor(QPalette::Disabled, QPalette::NoRole, noRole_dis); + + palette.setColor(QPalette::Active, QPalette::ToolTipBase, toolTipBase_at); + palette.setColor(QPalette::Inactive, QPalette::ToolTipBase, toolTipBase_iat); + palette.setColor(QPalette::Disabled, QPalette::ToolTipBase, toolTipBase_dis); + + palette.setColor(QPalette::Active, QPalette::ToolTipText, toolTipText_at); + palette.setColor(QPalette::Inactive, QPalette::ToolTipText, toolTipText_iat); + palette.setColor(QPalette::Disabled, QPalette::ToolTipText, toolTipText_dis); + +#if (QT_VERSION >= QT_VERSION_CHECK(5,12,0)) + palette.setColor(QPalette::Active, QPalette::PlaceholderText, placeholderText_at); + palette.setColor(QPalette::Inactive, QPalette::PlaceholderText, placeholderText_iat); + palette.setColor(QPalette::Disabled, QPalette::PlaceholderText, placeholderText_dis); +#endif + + return palette; +} + +#endif // THEMEPALETTE_H diff --git a/src/frontend/tools/tools.pri b/src/frontend/tools/tools.pri index 9c261260..a1c11e63 100644 --- a/src/frontend/tools/tools.pri +++ b/src/frontend/tools/tools.pri @@ -7,7 +7,8 @@ HEADERS += \ $$PWD/loadingdiv.h \ $$PWD/radioitembutton.h \ $$PWD/switchbutton.h \ - $$PWD/kylable.h + $$PWD/kylable.h \ + $$PWD/themepalette.h SOURCES += \ diff --git a/src/frontend/wificonfigdialog.ui b/src/frontend/wificonfigdialog.ui deleted file mode 100644 index e608614c..00000000 --- a/src/frontend/wificonfigdialog.ui +++ /dev/null @@ -1,140 +0,0 @@ - - - WiFiConfigDialog - - - - 0 - 0 - 474 - 320 - - - - Dialog - - - - - 60 - 30 - 290 - 30 - - - - - - - - - - 60 - 140 - 90 - 30 - - - - - - - - - - 60 - 200 - 90 - 30 - - - - - - - - - - 190 - 140 - 240 - 30 - - - - - - - 190 - 200 - 241 - 30 - - - - - - - 220 - 260 - 96 - 36 - - - - - - - - - - 330 - 260 - 96 - 36 - - - - - - - - - - 60 - 80 - 121 - 30 - - - - - - - - - - 190 - 80 - 240 - 30 - - - - - - - 400 - 211 - 18 - 9 - - - - - - - - - - diff --git a/src/main.cpp b/src/main.cpp index 765ddeb8..05b5235f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include #if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)) #include "xatom-helper.h" @@ -78,6 +79,27 @@ void messageOutput(QtMsgType type, const QMessageLogContext &context, const QStr fclose(log_file); } +QString displayFromPid(uint pid) +{ + QFile environFile(QStringLiteral("/proc/%1/environ").arg(QString::number(pid))); + if (environFile.open(QIODevice::ReadOnly | QIODevice::Text)) { + const QByteArray DISPLAY = KWindowSystem::isPlatformWayland() ? 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 {}; +} + int main(int argc, char *argv[]) { initUkuiLog4qt("kylin-nm"); @@ -109,24 +131,35 @@ int main(int argc, char *argv[]) parser.process(a); QDBusInterface interface("com.kylin.network", - "/com/kylin/network", - "com.kylin.network", - QDBusConnection::sessionBus()); + "/com/kylin/network", + "com.kylin.network", + QDBusConnection::sessionBus()); if(interface.isValid()) { if (parser.isSet(swOption)) { - interface.call(QStringLiteral("showKylinNM"),1); + interface.call(QStringLiteral("showKylinNM"), 1); + } else if (parser.isSet(snOption)){ + interface.call(QStringLiteral("showKylinNM"), 0); } else { - interface.call(QStringLiteral("showKylinNM"),0); + const QString serviceName = "com.kylin.network"; + QDBusConnectionInterface *interface1 = QDBusConnection::sessionBus().interface(); + QDBusReply 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); + } } return 0; } - QThread thread; + QThread *thread = new QThread(); KyNetworkResourceManager *p_networkResource = KyNetworkResourceManager::getInstance(); - p_networkResource->moveToThread(&thread); - QObject::connect(&thread, SIGNAL(started()), p_networkResource, SLOT(onInitNetwork())); - thread.start(); + p_networkResource->moveToThread(thread); + QObject::connect(thread, &QThread::started, p_networkResource, &KyNetworkResourceManager::onInitNetwork); + QObject::connect(&a,&QtSingleApplication::aboutToQuit, thread, &QThread::quit); + QObject::connect(thread, &QThread::finished, thread, &QThread::deleteLater); + thread->start(); // Internationalization QString locale = QLocale::system().name(); @@ -174,9 +207,6 @@ int main(int argc, char *argv[]) // window_hints.decorations = MWM_DECOR_BORDER; // XAtomHelper::getInstance()->setWindowMotifHint(w.winId(), window_hints); - w.setWindowFlags(Qt::CustomizeWindowHint | Qt::FramelessWindowHint /*| Qt::X11BypassWindowManagerHint*/); - - DbusAdaptor adaptor(&w); Q_UNUSED(adaptor); diff --git a/src/src.pro b/src/src.pro index 8a66099c..bfeaabda 100644 --- a/src/src.pro +++ b/src/src.pro @@ -21,16 +21,24 @@ INCLUDEPATH += /usr/include/KF5/NetworkManagerQt LIBS += -L/usr/lib/ -lgsettings-qt -lX11 -lKF5NetworkManagerQt -lukui-log4qt #LIBS += -lkysec + +CONFIG(release, debug|release) { + !system($$PWD/translate_generation.sh): error("Failed to generate translation") +} + target.path = /usr/bin target.source += $$TARGET desktop.path = /etc/xdg/autostart/ desktop.files = kylin-nm.desktop gschema.files = org.ukui.kylin-nm.switch.gschema.xml gschema.path = /usr/share/glib-2.0/schemas/ +qm_files.path = $${PREFIX}/share/kylin-nm/kylin-nm/ +qm_files.files = translations/*.qm INSTALLS += target \ desktop \ gschema \ + qm_files \ # The following define makes your compiler emit warnings if you use # any feature of Qt which has been marked as deprecated (the exact warnings @@ -67,3 +75,10 @@ unix { DISTFILES += \ org.ukui.kylin-nm.switch.gschema.xml + +TRANSLATIONS += \ + translations/kylin-nm_zh_CN.ts \ + translations/kylin-nm_tr.ts \ + translations/kylin-nm_bo.ts \ + translations/kylin-nm_bo_CN.ts \ + translations/kylin-nm_mn.ts diff --git a/src/translate_generation.sh b/src/translate_generation.sh new file mode 100755 index 00000000..72f748b9 --- /dev/null +++ b/src/translate_generation.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +ts_list=(`ls translations/*.ts`) +source /etc/os-release +version=(`echo $ID`) + +for ts in "${ts_list[@]}" +do + printf "\nprocess ${ts}\n" + if [ "$version" == "fedora" ] || [ "$version" == "opensuse-leap" ] || [ "$version" == "opensuse-tumbleweed" ];then + lrelease-qt5 "${ts}" + else + lrelease "${ts}" + fi +done diff --git a/src/translations/kylin-nm_bo.qm b/src/translations/kylin-nm_bo.qm deleted file mode 100644 index be651eed..00000000 --- a/src/translations/kylin-nm_bo.qm +++ /dev/null @@ -1 +0,0 @@ - ConfigPage - + Network profile type - + Public(recommended) Devices on the network cannot discover this computer. Generally, it is suitable for networks in public places, such as airports or coffee shops, etc. - + Private Devices on the network can discover this computer. Generally applicable to a network at home or work where you know and trust the individuals and devices on the network. - + Config firewall and security settings @@ -27,53 +27,58 @@ CreatNetPage - + Connection Name - + IPv4Config - + Address - + Netmask - + Default Gateway - + Invalid address - + Invalid subnet mask - - + + Required - + + Address conflict + + + + Auto(DHCP) - + Manual @@ -81,110 +86,173 @@ DetailPage - + Auto Connection - - + + SSID: - + Copied successfully! - + Copy all - + Please input SSID: - - + + Protocol: - - + + Security Type: - - + + Hz: - - + + Chan: - - + + BandWidth: - - + + IPv4: - - - IPv6: - - - - - + + IPv4 DNS: - - + + + IPv6: + + + + + Mac: + + DnsSettingWidget + + + DNS Server Advanced Settings + + + + + Tactic + + + + + Timeout + + + + + Retry Count + + + + + order + + + + + rotate + + + + + concurrency + + + + + s + + + + + times + + + + + Close + + + + + Cancel + + + + + Confirm + + + EnterpriseWlanDialog - + Wi-Fi network requires authentication - + Access to Wi-Fi network " - + " requires a password or encryption key. - + Cancel - + Connect @@ -192,22 +260,22 @@ FirewallDialog - + Allow other devices on this network to discover this computer? - + It is not recommended to enable this feature on public networks - + Not allowed (recommended) - + Allowed @@ -215,53 +283,53 @@ Ipv4Page - + Address - + Netmask - + Default Gateway - + IPv4Config - + Auto(DHCP) - + Manual - + Invalid address - + Invalid subnet mask - - + + Required - + Address conflict @@ -269,53 +337,53 @@ Ipv6Page - + Address - + Subnet prefix Length - + Default Gateway - + IPv6Config - + Auto(DHCP) - + Manual - - + + Required - + Invalid address - + Invalid gateway - + Address conflict @@ -323,76 +391,76 @@ JoinHiddenWiFiPage - - Please enter the network name and security type + + Please enter the network information - + Network name(SSID) - + Show Network List - + Cancel - + Join - + Required - - Find and Join Wi-Fi + + Find and Join WLAN LanListItem - + Not connected - + Wired Device not carried - - - + + + Disconnect - - - + + + Connect - - + + Property - - + + Delete @@ -400,40 +468,56 @@ LanPage - - No ethernet device avaliable - - - - + LAN - + + conflict, unable to connect to the network normally! + + + + Activated LAN - + Inactivated LAN - + Wired Device not carried + + + + Connected: + + + + + (Limited) + + + + + Not Connected + + ListItem - + Kylin NM - + kylin network applet desktop message @@ -441,28 +525,44 @@ MainWindow - - + + kylin-nm - + LAN - + WLAN - + Settings - + + + Network tool + + + + + Network Card + + + + + Not connected to the network + + + + Show MainWindow @@ -470,120 +570,130 @@ MultipleDnsWidget - - DNS server: + + DNS server(Drag to sort) + + + + + Click "+" to configure DNS + + + + + Settings NetDetail - + Kylin NM - + kylin network desktop message - + Detail - + Security - - + + Config - + Confirm - + Cancel - + Forget this network - + IPv4 - + IPv6 - + Add LAN Connect - + Connect Hidden WLAN - + Delete this network - - - + + + None - - - + + + Auto - + start check ipv4 address conflict - + start check ipv6 address conflict - + this wifi no support enterprise type - + this wifi no support None type - + this wifi no support WPA2 type - + this wifi no support WPA3 type @@ -591,7 +701,7 @@ OneConnForm - + Form @@ -599,7 +709,7 @@ OneLancForm - + Form @@ -607,213 +717,214 @@ SecurityPage - + Remember the Network - + Security - - + + Password - + EAP type - + Identity - + Domain - + CA certficate - + no need for CA certificate - + User certificate - + User private key - + User key password - + Password options - - - + + + Required - + Ineer authentication - + Username - + Ask pwd each query - - - - - - - - - - - - + + + + + + + + + + + + + None - + WPA&WPA2 Personal - + WPA&WPA2 Enterprise - + WPA3 Personal - - - - + + + + Choose from file... - - PAC provisioning - - - - - Allow automatic PAC provisioning - - - - - PAC file - - - - - Anonymous - - - - - Authenticated - - - - - Both - - - - + Store passwords only for this user - + Store password only for this user - + Store passwords for all users - + Store password for all users - + Ask this password every time - + Ask password every time - - - + + PAC provisioning + + + + + Allow automatic PAC provisioning + + + + + PAC file + + + + + Anonymous + + + + + Authenticated + + + + + Both + + + + + + Choose a CA certificate - - - + + + CA Files (*.pem *.der *.p12 *.crt *.cer *.pfx) - + Choose a PAC file - + PAC Files (*.pac) - + @@ -821,113 +932,70 @@ TabPage - + Current Device - + Devices Closed! - + Settings - + Kylin NM - + kylin network applet desktop message - - WiFiConfigDialog - - - Dialog - - - - - WLAN Authentication - - - - - Input WLAN Information Please - - - - - WLAN ID: - - - - - WLAN Name: - - - - - Password: - - - - - Cancl - - - - - Ok - - - WlanListItem - + Not connected - - - - - + + + + + Disconnect - - - - - + + + + + Connect - - + + Property - - + + Forget - + Auto Connect @@ -935,7 +1003,7 @@ WlanMoreItem - + Add Others... @@ -943,32 +1011,42 @@ WlanPage - + WLAN - + Activated WLAN - + Other WLAN - + + Connected: + + + + + Not Connected + + + + No wireless network card detected - + WLAN Connected Successfully - + WLAN Disconnected Successfully @@ -976,17 +1054,17 @@ main - + kylinnm - + show kylin-nm wifi page - + show kylin-nm lan page diff --git a/translations/kylin-nm_bo_CN.ts b/src/translations/kylin-nm_bo_CN.ts similarity index 63% rename from translations/kylin-nm_bo_CN.ts rename to src/translations/kylin-nm_bo_CN.ts index 64e1f0ab..8067c616 100644 --- a/translations/kylin-nm_bo_CN.ts +++ b/src/translations/kylin-nm_bo_CN.ts @@ -35,22 +35,22 @@ ConfigPage - + Network profile type དྲ་རྒྱའི་བཀོད་སྒྲིག་ཡིག་ཆའི་རིགས། - + Public(recommended) Devices on the network cannot discover this computer. Generally, it is suitable for networks in public places, such as airports or coffee shops, etc. སྤྱི་སྤྱོད།(འོས་སྦྱོར་བྱས་པ།)དྲ་རྒྱའི་སྒྲིག་ཆས་ཀྱིས་གློག་ཀླད་འདི་མཐོང་མི་ཐུབ། སྤྱིར་བཏང་གི་གནས་ཚུལ་འོག་ཏུ་མི་མང་འདུ་སའི་ནང་གི་དྲ་བ་ལ་འཚམ་པ་སྟེ།དཔེར་ན་གནམ་གྲུ་ཐང་དང་འཚིག་ཇའི་ཁང་སོགས་ལྟ་བུ།. - + Private Devices on the network can discover this computer. Generally applicable to a network at home or work where you know and trust the individuals and devices on the network. ཆེད་སྤྱོད། དྲ་རྒྱའི་སྒྲིག་ཆས་ཀྱིས་གློག་ཀླད་འདི་མཐོང་ཐུབ། སྤྱིར་བཏང་གི་གནས་ཚུལ་འོག་ཁྱིམ་ཚང་ངམ་ལས་དོན་ཚན་པའི་དྲ་བ་དང་འཚམ་པས།ཁྱེད་ཀྱིས་དྲ་ཐོག་གི་མི་སྒེར་དང་སྒྲིག་ཆས་ལ་ངོས་འཛིན་དང་ཡིད་ཆེས་བྱེད་དགོས།. - + Config firewall and security settings མེ་འགོག་གྱང་རྩིག་དང་བདེ་འཇགས་བཀོད་སྒྲིག་བྱ་དགོས། @@ -73,30 +73,35 @@ CreatNetPage - + Connection Name འབྲེལ་མཐུད་ཀྱི་མིང་། - + IPv4Config IPv4ཁུང་ཙི། - + Address སྡོད་གནས། - + Netmask དྲ་རྒྱའི་མ་ལག - + Default Gateway ཁ་ཆད་བཞག་པའི་སྒོ་ཆེན། + + + Address conflict + ཤག་གནས་གདོང་གཏུག་ + Prefs DNS སྔོན་གྲབས་DNS @@ -106,28 +111,28 @@ ཚབ་བྱེད་རང་བཞིན་གྱི་DNS - + Auto(DHCP) རང་འགུལ་(DHCP) - + Manual ལག་དེབ། - + Invalid address རྩིས་འགྲོ་མེད་པའི་ས་གནས། - + Invalid subnet mask རྩིས་འགྲོ་མེད་པའི་དྲ་བ་འགེབས་སྲུང་བྱེད་པ། - - + + Required ངེས་པར་དུ་སྐོང་དགོས། @@ -135,82 +140,82 @@ DetailPage - + Auto Connection རང་འགུལ་གྱིས་འབྲེལ་མཐུད་བྱེད - - + + SSID: SSID: - + Copied successfully! འདྲ་བཟོ་བྱས་ནས་གྲུབ་འབྲས་ཐོབ་! - + Copy all ཚང་མ་འདྲ་བཤུས་བྱེད་ - + Please input SSID: SSID:ནང་འཇུག་གནང་རོགས།: - - + + Protocol: གྲོས་ཆོད་ནང་དུ།: - - + + Security Type: བདེ་འཇགས་ཀྱི་རིགས་དབྱིབས་ནི།: - - + + Hz: དྲ་རྒྱའི་འཕྲིན་ལམ།: - - + + Chan: དྲ་བའི་བགྲོད་ལམ།: - - + + BandWidth: ཞེང་ཆེ་བ།: - - + + IPv6: IPv6: - - + + IPv4: IPv4: - - + + IPv4 DNS: IPv4 DNS: - - + + Mac: ཨའོ་མོན་ནི།: @@ -445,6 +450,69 @@ + + DnsSettingWidget + + + DNS Server Advanced Settings + DNSགྱི་ཞབས་ཞུའི་ཡོ་བྱད་མཐོ་རིམ་སྒྲིག་བཀོད། + + + + Tactic + ཐབས་ཇུས། + + + + Timeout + དུས་ཚོད་ལས་བརྒལ་བ། + + + + Retry Count + བསྐྱར་དུ་ཚོད་ལྟ་བྱེད་ཐེངས་གྲངས། + + + + order + གོ་རིམ། + + + + rotate + སྐབས་བསྟུན་བྱེད་པ། + + + + concurrency + འགྲེམས་སྤེལ་ཡང་བྱ། + + + + s + སྐར་ཆ། + + + + times + གཉིས་པ། + + + + Close + སྒོ་རྒྱག་པ། + + + + Cancel + མེད་པར་བཟོ་དགོས། + + + + Confirm + དངོས་སུ་ཁས་ལེན་པ། + + EnterpriseWlanDialog @@ -456,27 +524,27 @@ 关闭 - + Wi-Fi network requires authentication Wi-Fiཡི་དྲ་རྒྱའི་བླང་བྱར་སྤྲོད་བྱ་རྒྱུའི་བླང་བྱ་བཏོན་ཡོད། - + Access to Wi-Fi network " Wii-Fiབར་གྱི་དྲ་རྒྱར་འཚམས་འདྲི་གནང་བ་རེད། - + " requires a password or encryption key. གསང་གྲངས་དང་གསང་བའི་ལྡེ་མིག་དགོས། - + Cancel ཕྱིར་འཐེན། - + Connect སྦྲེལ་མཐུད་བྱེད་པ @@ -500,22 +568,22 @@ དེ་ལྟར་མ་བྱས་ - + Allow other devices on this network to discover this computer? དྲ་རྒྱའི་སྟེང་གི་སྒྲིག་ཆས་གཞན་པས་གློག་ཀླད་འདི་རྙེད་དུ་འཇུག་གམ།? - + It is not recommended to enable this feature on public networks བསམ་འཆར་མེད་།སྤྱི་པའི་དྲ་རྒྱའི་སྟེང་ནས་ནུས་པ་འདི་མགོ་བརྩམས་། - + Not allowed (recommended) མི་ཆོག་པ་(འོས་སྦྱོར།) - + Allowed ཆོག་པ་ @@ -523,22 +591,22 @@ Ipv4Page - + IPv4Config IPv4ཁུང་ཙི། - + Address སྡོད་གནས། - + Netmask དྲ་རྒྱའི་མ་ལག - + Default Gateway ཁ་ཆད་བཞག་པའི་སྒོ་ཆེན། @@ -551,33 +619,33 @@ ཚབ་བྱེད་རང་བཞིན་གྱི་DNS - + Auto(DHCP) རང་འགུལ་(DHCP) - + Manual ལག་དེབ། - + Invalid address རྩིས་འགྲོ་མེད་པའི་ས་གནས། - + Invalid subnet mask རྩིས་འགྲོ་མེད་པའི་དྲ་བ་འགེབས་སྲུང་བྱེད་པ། - - + + Required ངེས་པར་དུ་སྐོང་དགོས། - + Address conflict ཤག་གནས་གདོང་གཏུག་ @@ -585,22 +653,22 @@ Ipv6Page - + IPv6Config IPv6ཁུང་ཙི། - + Address སྡོད་གནས། - + Subnet prefix Length ཡན་ལག་དྲ་རྒྱའི་སྔོན་སྒྲིག་གི་རིང་ཚད། - + Default Gateway ཁ་ཆད་བཞག་པའི་སྒོ་ཆེན། @@ -613,33 +681,33 @@ ཚབ་བྱེད་རང་བཞིན་གྱི་DNS - + Auto(DHCP) རང་འགུལ་(DHCP) - + Manual ལག་དེབ། - - + + Required ངེས་པར་དུ་སྐོང་དགོས། - + Invalid address རྩིས་འགྲོ་མེད་པའི་ས་གནས། - + Invalid gateway རྩིས་འགྲོ་མེད་པའི་དྲ་བའི་འགག་སྒོ། - + Address conflict ཤག་གནས་གདོང་གཏུག་ @@ -647,80 +715,80 @@ JoinHiddenWiFiPage - - Please enter the network name and security type - ཁྱེད་རང་དྲ་རྒྱའི་ནང་དུ་ཞུགས་འདོད་པའི་མིང་དང་བདེ་འཇགས་རིགས་ནང་འཇུག་བྱེད་རོགས། + + Please enter the network information + ཁྱེད་རང་ཞུགས་འདོད་པའི་དྲ་རྒྱའི་ཆ་འཕྲིན་ནང་འཇུག་བྱེད་རོགས། - + Network name(SSID) - དྲ་རྒྱའི་མིང་། (SID) + དྲ་རྒྱའི་མིང་། (SSID) Remember the Network དྲ་རྒྱ་དེ་སེམས་ལ་འཛིན་དགོས། - + Show Network List དྲ་རྒྱའི་རེའུ་མིག་གསལ་པོར་མངོན་པ། - + Cancel མེད་པར་བཟོ་དགོས། - + Join དེའི་ནང་དུ་ཞུགས་པ། - + Required ངེས་པར་དུ་སྐོང་དགོས། - - Find and Join Wi-Fi - འཚོལ་ཞིབ་བྱས་པ་མ་ཟད་WI-FIལ་ཞུགས་པ་རེད། + + Find and Join WLAN + འཚོལ་ཞིབ་བྱས་པ་མ་ཟད་WLANལ་ཞུགས་པ་རེད། LanListItem - + Not connected འབྲེལ་མཐུད་མི་བྱེད་པ། - + Wired Device not carried སྐུད་ཡོད་སྒྲིག་ཆས་འཁྱེར་མེད་པ། - - - + + + Disconnect འབྲེལ་ཐག་ཆད་པ། - - - + + + Connect སྦྲེལ་མཐུད་བྱེད་པ - - + + Property ངོ་བོ། - - + + Delete དྲ་རྒྱ་དེ་བསུབ་དགོས། @@ -728,22 +796,26 @@ LanPage - No ethernet device avaliable - ཨེ་ཙི་དྲ་རྒྱའི་སྒྲིག་ཆས་ལ་བཙན་འཛུལ་བྱས་མི་ཆོག། + ཨེ་ཙི་དྲ་རྒྱའི་སྒྲིག་ཆས་ལ་བཙན་འཛུལ་བྱས་མི་ཆོག། - + LAN སྐུད་ཡོད་དྲ་བ། - + + conflict, unable to connect to the network normally! + གདོང་གཏུག་རྒྱུན་ལྡན་ལྟར་དྲ་རྒྱ་དང་འབྲེལ་མཐུད་བྱེད་ཐབས་བྲལ་བ་རེད།! + + + Activated LAN ངའི་དྲ་རྒྱ། - + Inactivated LAN དྲ་བ་གཞན་དག @@ -752,7 +824,7 @@ སྐུད་ཡོད་དྲ་བ་ཆད་སོང་། - + Wired Device not carried སྐུད་ཡོད་སྒྲིག་ཆས་འཁྱེར་མེད་པ། @@ -760,16 +832,32 @@ LAN Connected Successfully སྐུད་ཡོད་དྲ་བ་སྦྲེལ་ཡོད། + + + + Connected: + འབྲེལ་མཐུད་བྱུང་ཡོད།: + + + + Not Connected + འབྲེལ་མཐུད་མ་བྱས་པ། + + + + (Limited) + (དྲ་བར་ཚོད་འཛིན་ཐེབས་པ་རེད།) + ListItem - + Kylin NM དྲ་རྒྱའི་ཡོ་བྱད། - + kylin network applet desktop message དྲ་རྒྱའི་གསལ་འདེབས་གནས་ཚུལ། @@ -777,76 +865,102 @@ MainWindow - - + + kylin-nm དྲ་རྒྱའི་ཡོ་བྱད། - + LAN 有线网络 སྐུད་ཡོད་དྲ་བ། - + WLAN 无线局域网 སྐུད་མེད་ཅུས་ཁོངས་ཀྱི་དྲ་བ། - + Show MainWindow རླུང་གཙོ་བོ་མངོན་པར་བྱས་ཡོད། - + Settings 设置网络项 སྒྲིག་བཀོད། + + Network tool - དྲ་རྒྱའི་ལག་ཆ་ + དྲ་རྒྱའི་ལག་ཆ་ + + + + Network Card + དྲ་བྱང་། + + + + Not connected to the network + དྲ་རྒྱ་དང་སྦྲེལ་མཐུད་མ་བྱས་པ། MultipleDnsWidget - DNS server: - DNSཞབས་ཞུའི་ཡོ་བྱད།: + DNSཞབས་ཞུ་བ།: + + + + DNS server(Drag to sort) + DNS ཞབས་ཞུའི་ཡོ་བྱད། (འཐེན་འགུལ་ལ་བརྟེན་ནས་རིམ་སྒྲིག་།) + + + + Click "+" to configure DNS + "+"མནན་ན་ད་གཟོད་DNSལ་བཀོད་སྒྲིག་བྱེད་ཐུབ། + + + + Settings + མཐོ་རིམ་གྱི་བཀོད་སྒྲིག་བྱ་དགོས། NetDetail - + Kylin NM ཅིན་ལིན་NM - + kylin network desktop message དྲ་རྒྱའི་གསལ་འདེབས་གནས་ཚུལ། - + Detail ཞིབ་ཕྲའི་གནས་ཚུལ། - + IPv4 IPv4 - + IPv6 IPv6 - + Security བདེ་འཇགས། @@ -855,62 +969,62 @@ 关闭 - - + + Config བཀོད་སྒྲིག་བཅས་བྱ་དགོས། - + Confirm གཏན་འཁེལ་བྱ་དགོས། - + Cancel ཕྱིར་འཐེན། - + Forget this network དྲ་རྒྱ་འདི་བརྗེད་སོང་། - + Delete this network དྲ་རྒྱ་དེ་བསུབ་དགོས། - + Add LAN Connect སྐུད་ཡོད་དྲ་བ་ཁ་སྣོན་བྱ་དགོས། - + Connect Hidden WLAN ཧའེ་ཏེན་ཝེ་ལན་དང་འབྲེལ་མཐུད་བྱེད་པ། - - - + + + None གཅིག་ཀྱང་མེད། - - - + + + Auto རང་འགུལ་གྱིས་རླངས་ - + start check ipv4 address conflict ipv4ས་གནས་ཀྱི་འགལ་བ་ལ་ཞིབ་བཤེར་བྱེད་འགོ་ཚུགས། - + start check ipv6 address conflict ipv6གནས་ཡུལ་དང་འགལ་བར་ཞིབ་བཤེར་བྱེད་འགོ་ཚུགས། @@ -923,22 +1037,22 @@ ipv6ཐག་གཅོད་གདོང་གཏུག་བྱུང་བ་རེད།! - + this wifi no support enterprise type wifiལ་རྒྱབ་སྐྱོར་མེད་པའི་ཁེ་ལས་ཀྱི་རིགས་དབྱིབས། - + this wifi no support None type wifiལ་རྒྱབ་སྐྱོར་མི་བྱེད་པར་རིགས་དབྱིབས་གཅིག་ཀྱང་མེད། - + this wifi no support WPA2 type wifiལ་རྒྱབ་སྐྱོར་མི་བྱེད་པའི་WPA2རིགས་དབྱིབས་ - + this wifi no support WPA3 type wifiལ་རྒྱབ་སྐྱོར་མི་བྱེད་པའི་WPA3རིགས་དབྱིབས་ @@ -997,7 +1111,7 @@ OneConnForm - + Form @@ -1025,7 +1139,7 @@ OneLancForm - + Form @@ -1049,213 +1163,222 @@ SecurityPage - + Remember the Network དྲ་རྒྱ་དེ་སེམས་ལ་འཛིན་དགོས། - + Security བདེ་འཇགས། - - + + Password གསང་གྲངས། - + EAP type EAP རིགས་དབྱིབས། - + Identity ཐོབ་ཐང་། - + Domain ཁྱབ་ཁོངས། - + CA certficate - CA certficate + CAལག་ཁྱེར། - + no need for CA certificate CAཡི་ལག་ཁྱེར་མི་དགོས། - + User certificate སྤྱོད་མཁན་གྱི་ལག་ཁྱེར། - + User private key སྤྱོད་མཁན་གྱི་སྒེར་གྱི་ལྡེ་མིག - + User key password སྤྱོད་མཁན་གྱི་ལྡེ་མིག་གི་གསང་ - + Password options གསང་བའི་ཐོག་ནས་རྣམ་གྲངས་བདམས་པ། - - - + + + Required ངེས་པར་དུ་སྐོང་དགོས། - + Ineer authentication དབྱིན་ཆས་ཀྱི་བདེན་དཔང་ར་སྤྲོད་ - + Username བཀོལ་སྤྱོད་ཀྱི་མིང་། - + Ask pwd each query འདྲི་རྩད་རེ་རེར་འདྲི་རྩད་བྱེད་པ། - - - - - - - - - - - - + + + + + + + + + + + + + None གཅིག་ཀྱང་མེད། - + WPA&WPA2 Personal WPA&WPA2མི་སྒེར་གྱི་ངོས་ནས་བཤད་ན། - + WPA&WPA2 Enterprise WPA&WPA2 ཁེ་ལས། - + WPA3 Personal WPA3མི་སྒེར་ - - - - + + + + Choose from file... ཡིག་ཆའི་ནང་ནས་གདམ་ག་རྒྱག་དགོས།... - - PAC provisioning - PACབཀོད་སྒྲིག་བྱས་པ། - - - - Allow automatic PAC provisioning - རང་འགུལ་PACབཀོད་སྒྲིག་བྱས་ཆོག - - - - PAC file - PACཡི་ཡིག་ཆ། - - - - Anonymous - མིང་མི་འགོད་པ། - - - - Authenticated - དཔང་དངོས་བདེན་པ་ཡིན་པའི་ར་ - - - - Both - དེ་གཉིས་ཀ་མཉམ་དུ་སྤྱོད་དགོས། - - - + Store passwords only for this user སྤྱོད་མཁན་དེ་ཁོ་ནའི་ཆེད་དུ་གསང་གྲངས་ཉར་ཚགས་བྱས་ཡོད། - + Store password only for this user སྤྱོད་མཁན་དེ་ཁོ་ནའི་ཆེད་དུ་གསང་གྲངས་ཉར་ཚགས་བྱས་ཡོད། - + Store passwords for all users སྤྱོད་མཁན་ཚང་མའི་གསང་བ་གསོག་ཉར་བྱེད་དགོས། - + Store password for all users སྤྱོད་མཁན་ཚང་མའི་གསང་བ་གསོག་ཉར་བྱེད་དགོས། - + Ask this password every time ཐེངས་རེར་གསང་བ་འདི་འདྲི་རྩད་བྱེད་ཐེངས་རེ་ཡིན། - + Ask password every time ཐེངས་རེར་གསང་བ་འདི་འདྲི་རྩད་བྱེད་ཐེངས་རེ་ཡིན། - - - + + + Choose a CA certificate CAཡི་དཔང་ཡིག་འདེམས་པ། - - - + + + CA Files (*.pem *.der *.p12 *.crt *.cer *.pfx) CA དཔང་ཡིག (*.pem *.der *.p12 *.crt *.cer *.pfx) - + + PAC provisioning + PAC 配置 + PAC གཏན་འབེབས་བྱས་པ། + + + + Allow automatic PAC provisioning + 允许自动PAC配置 + རང་འགུལ་གྱིས་PACམཚོ་འདོན་བྱས་ཆོག། + + + + PAC file + PAC 文件 + PACཡིག་ཆ། + + + + Anonymous + 匿名 + མིང་མ་བཀོད་པའི་ + + + + Authenticated + 已认证 + བདེན་དཔང་ར་སྤྲོད་བྱས། + + + + Both + 两者兼用 + དེ་གཉིས་ཀ + + + Choose a PAC file - ཡིག་ཆ་PACབདམས་པ་རེད། + 选择一个PAC文件 + PACཡིག་ཆ་ཞིག་བདམས་པ། - + PAC Files (*.pac) - PACཡི་ཡིག་ཆ། (*.pac) + PAC文件(*.pac) + PACཡིག་ཆ།(*.pac) - + @@ -1263,27 +1386,27 @@ TabPage - + Current Device མིག་སྔའི་སྒྲིག་ཆས། - + Devices Closed! སྒྲིག་ཆས་སྒོ་རྒྱག་པ།! - + Settings སྒྲིག་བཀོད། - + Kylin NM ཅིན་ལིན་NM - + kylin network applet desktop message kylinདྲ་རྒྱའི་ཀུ་ཤུའི་ཅོག་ཙེའི་ཆ་འཕྲིན། @@ -1298,85 +1421,73 @@ WiFiConfigDialog - - Dialog - - - - WLAN Authentication - སྐུད་མེད་བདེན་དཔང་ར་སྤྲོད། + སྐུད་མེད་བདེན་དཔང་ར་སྤྲོད། - Input WLAN Information Please - སྐུད་མེད་ཆ་འཕྲིན་ནང་འཇུག་གནང་རོགས། + སྐུད་མེད་ཆ་འཕྲིན་ནང་འཇུག་གནང་རོགས། - WLAN ID: - WLAN ID: + WLAN ID: - WLAN Name: - སྐུད་མེད་མིང་།: + སྐུད་མེད་མིང་།: - Password: - གསང་གྲངས་ནི།: + གསང་གྲངས་ནི།: - Cancl - ཁན་ཁེ་ལན། + ཁན་ཁེ་ལན། - Ok - འགྲིགས། + འགྲིགས། WlanListItem - + Not connected འབྲེལ་མཐུད་མི་བྱེད་པ། - - - - - + + + + + Disconnect འབྲེལ་ཐག་ཆད་པ། - - - - - + + + + + Connect སྦྲེལ་མཐུད་བྱེད་པ - - + + Forget བརྗེད་པ། - - + + Property ངོ་བོ། - + Auto Connect རང་འགུལ་གྱིས་སྦྲེལ་མཐུད་ @@ -1388,7 +1499,7 @@ 更多... - + Add Others... གཞན་པ་ཁ་སྣོན་བྱས་ནས་... @@ -1396,22 +1507,22 @@ WlanPage - + WLAN སྐུད་མེད་ཅུས་ཁོངས་ཀྱི་དྲ་བ། - + No wireless network card detected སྐུད་མེད་དྲ་རྒྱའི་བྱང་བུ་མ་རྙེད་པ། - + Activated WLAN ངའི་དྲ་རྒྱ། - + Other WLAN དྲ་བ་གཞན་དག @@ -1420,15 +1531,29 @@ 更多... - + WLAN Connected Successfully སྐུད་མེད་དྲ་བ་སྦྲེལ་ཡོད། - + WLAN Disconnected Successfully སྐུད་མེད་དྲ་རྒྱ་ཆད་སོང་། + + + Connected: + འབྲེལ་མཐུད་བྱུང་ཡོད།: + + + + Not Connected + འབྲེལ་མཐུད་མ་བྱས་པ། + + + (Limited) + (དྲ་བར་ཚོད་འཛིན་ཐེབས་པ་རེད།) + WpaWifiDialog @@ -1488,17 +1613,17 @@ main - + kylinnm - + show kylin-nm wifi page སྐུད་མེད་དྲ་རྒྱའི་ངོས་མངོན་པར་བྱས་ཡོད། - + show kylin-nm lan page སྐུད་ཡོད་དྲ་རྒྱའི་ཤོག་ངོས་མངོན་པར་བྱས་ཡོད། diff --git a/src/translations/kylin-nm_mn.ts b/src/translations/kylin-nm_mn.ts new file mode 100644 index 00000000..1a536303 --- /dev/null +++ b/src/translations/kylin-nm_mn.ts @@ -0,0 +1,1592 @@ + + + + + ConfForm + + Manual + 手动 + + + Cancel + 取消 + + + kylin-nm + 网络工具 + + + kylin network applet desktop message + 网络提示消息 + + + Will check the IP address conflict + 正在检测ip地址冲突 + + + IPv4 address conflict, Please change IP + ip地址冲突,请更改ip + + + IPv6 address conflict, Please change IP + ip地址冲突,请更改ip {6 ?} + + + + ConfigPage + + + Network profile type + ᠰᠦᠯᠵᠢᠶᠡᠨ ᠤ᠋ ᠳᠤᠬᠢᠷᠠᠭᠤᠯᠭ᠎ᠠ ᠹᠠᠢᠯ ᠤ᠋ᠨ ᠳᠦᠷᠦᠯ + + + + Public(recommended) Devices on the network cannot discover this computer. Generally, it is suitable for networks in public places, such as airports or coffee shops, etc. + ᠨᠡᠢᠳᠡ ᠵᠢᠨ ᠰᠦᠯᠵᠢᠶᠡᠨ ( ᠳᠠᠨᠢᠯᠴᠠᠭᠤᠯᠬᠤ) ᠳ᠋ᠤ᠌ ᠬᠢ ᠳᠦᠬᠦᠬᠡᠷᠦᠮᠵᠢ ᠲᠤᠰ ᠺᠣᠮᠫᠢᠦ᠋ᠲ᠋ᠧᠷ ᠢ᠋ ᠣᠯᠵᠤ ᠮᠡᠳᠡᠵᠤ ᠪᠣᠯᠬᠤ ᠥᠬᠡᠢ᠂ ᠶᠡᠷᠦᠳᠡ ᠵᠢᠨ ᠪᠠᠢᠳᠠᠯ ᠳ᠋ᠤ᠌ ᠣᠯᠠᠨ ᠨᠡᠢᠳᠡ ᠵᠢᠨ ᠳᠠᠯᠠᠪᠠᠢ ᠳ᠋ᠤ᠌ ᠬᠢ ᠰᠦᠯᠵᠢᠶ᠎ᠡ ᠵᠢ ᠬᠡᠷᠡᠭᠯᠡᠨ᠎ᠡ᠂ ᠵᠢᠰᠢᠶᠡᠯᠡᠪᠡᠯ ᠨᠢᠰᠬᠡᠯ ᠤ᠋ᠨ ᠪᠠᠭᠤᠳᠠᠯ ᠤ᠋ᠨ ᠺᠤᠹᠸ ᠵᠢᠨ ᠦᠷᠦᠬᠡ ᠵᠡᠷᠭᠡ. + + + + Private Devices on the network can discover this computer. Generally applicable to a network at home or work where you know and trust the individuals and devices on the network. + ᠳᠤᠰᠬᠠᠢ ᠬᠡᠷᠡᠭᠯᠡᠬᠦ᠂ ᠰᠦᠯᠵᠢᠶᠡᠨ ᠤ᠋ ᠳᠦᠬᠦᠬᠡᠷᠦᠮᠵᠢ ᠲᠤᠰ ᠺᠣᠮᠫᠢᠦ᠋ᠲ᠋ᠧᠷ ᠢ᠋ ᠣᠯᠵᠤ ᠮᠡᠳᠡᠪᠡ᠂ ᠶᠡᠷᠦᠳᠡ ᠵᠢᠨ ᠪᠠᠢᠳᠠᠯ ᠳ᠋ᠤ᠌ ᠬᠡᠷᠦᠢ ᠤ᠋ᠨ ᠪᠤᠶᠤ ᠠᠯᠪᠠᠨ ᠪᠠᠢᠭᠤᠯᠭ᠎ᠠ ᠵᠢᠨ ᠰᠦᠯᠵᠢᠶᠡᠨ ᠳ᠋ᠤ᠌ ᠬᠡᠷᠡᠭᠯᠡᠨ᠎ᠡ᠂ ᠲᠠ ᠳᠠᠨᠢᠬᠤ ᠮᠦᠷᠳᠡᠭᠡᠨ ᠨᠠᠢᠳᠠᠪᠤᠷᠢᠳᠠᠢ ᠰᠦᠯᠵᠢᠶᠡᠨ ᠳᠡᠬᠡᠷᠡᠬᠢ ᠬᠤᠪᠢ ᠬᠥᠮᠦᠨ ᠪᠤᠶᠤ ᠳᠦᠬᠦᠬᠡᠷᠦᠮᠵᠢ. + + + + Config firewall and security settings + ᠭᠠᠯ ᠰᠡᠷᠬᠡᠢᠯᠡᠬᠦ ᠬᠡᠷᠡᠮ ᠪᠤᠯᠤᠨ ᠠᠮᠤᠷ ᠳᠦᠪᠰᠢᠨ ᠤ᠋ ᠳᠤᠬᠢᠷᠠᠭᠤᠯᠭ᠎ᠠ + + + + CopyButton + + Copied successfully + 复制成功 + + + Copied successfully! + 复制成功! + + + Copy all + 复制全部 + + + + CreatNetPage + + + Connection Name + ᠰᠦᠯᠵᠢᠶᠡᠨ ᠤ᠋ ᠨᠡᠷᠡᠢᠳᠦᠯ + + + + IPv4Config + IPv4 ᠳᠤᠬᠢᠷᠠᠭᠤᠯᠭ᠎ᠠ + + + + Address + IPv4 ᠬᠠᠶᠢᠭ + + + + Netmask + ᠬᠤᠪᠢᠶᠠᠷᠢ ᠰᠦᠯᠵᠢᠶᠡᠨ ᠤ᠋ ᠬᠠᠯᠬᠠᠪᠴᠢ + + + + Default Gateway + ᠠᠶᠠᠳᠠᠯ ᠨᠧᠲ ᠪᠤᠭᠤᠮᠳᠠ + + + + Address conflict + ᠬᠠᠶᠢᠭ ᠤ᠋ᠨ ᠮᠦᠷᠬᠦᠯᠳᠦᠬᠡᠨ + + + Prefs DNS + ᠳᠡᠷᠢᠬᠦᠨ ᠰᠤᠩᠭᠤᠯᠳᠠ DNS + + + Alternative DNS + ᠪᠡᠯᠡᠳᠬᠡᠯ ᠰᠤᠩᠭᠤᠯᠳᠠ DNS + + + + Auto(DHCP) + ᠠᠦ᠋ᠲ᠋ᠤ᠋ (DHCP) + + + + Manual + ᠭᠠᠷ᠎ᠢᠶᠠᠷ ᠬᠦᠳᠡᠯᠭᠡᠬᠦ᠌ + + + + Invalid address + ᠬᠦᠴᠦᠨ ᠦᠬᠡᠢ ᠬᠠᠶᠢᠭ + + + + Invalid subnet mask + ᠬᠦᠴᠦᠨ ᠦᠬᠡᠢ ᠬᠤᠪᠢᠶᠠᠷᠢ ᠰᠦᠯᠵᠢᠶᠡᠨ ᠤ᠋ ᠬᠠᠯᠬᠠᠪᠴᠢ + + + + + Required + ᠡᠷᠬᠡᠪᠰᠢ ᠳᠠᠭᠯᠠᠬᠤ + + + + DetailPage + + + Auto Connection + ᠠᠦ᠋ᠲ᠋ᠤ᠋ ᠪᠡᠷ ᠴᠦᠷᠬᠡᠯᠡᠬᠦ + + + + + SSID: + SSID: + + + + Copied successfully! + ᠺᠤᠫᠢᠳᠠᠪᠠ! + + + + Copy all + ᠪᠦᠬᠦᠨ ᠢ᠋ ᠺᠤᠫᠢᠳᠠᠬᠤ + + + + Please input SSID: + SSID ᠢ᠋/ ᠵᠢ ᠤᠷᠤᠭᠤᠯᠤᠭᠠᠷᠠᠢ: + + + + + Protocol: + ᠭᠡᠷ᠎ᠡ: + + + + + Security Type: + ᠠᠮᠤᠷ ᠳᠦᠪᠰᠢᠨ ᠤ᠋ ᠳᠦᠷᠦᠯ ᠵᠦᠢᠯ: + + + + + Hz: + ᠲᠤᠤᠷ ᠰᠦᠯᠵᠢᠶᠡᠨ ᠤ᠋ ᠳᠠᠪᠳᠠᠮᠵᠢ ᠵᠢᠨ ᠪᠦᠰᠡ: + + + + + Chan: + ᠲᠤᠤᠷ ᠰᠦᠯᠵᠢᠶᠡᠨ ᠤ᠋ ᠨᠡᠪᠳᠡᠷᠡᠬᠦ ᠵᠠᠮ: + + + + + BandWidth: + ᠪᠦᠰᠡ ᠵᠢᠨ ᠦᠷᠭᠡᠨ: + + + + + IPv6: + IPv6 ᠬᠠᠶᠢᠭ: + + + + + IPv4: + IPv4 ᠬᠠᠶᠢᠭ: + + + + + IPv4 DNS: + IPv4 ᠦᠢᠯᠡᠴᠢᠯᠡᠬᠦᠷ: + + + + + Mac: + ᠹᠢᠽᠢᠺ ᠤ᠋ᠨ ᠬᠠᠶᠢᠭ: + + + + DlgHideWifi + + Cancel + 取消 + + + Connect + 连接 + + + None + + + + + DlgHideWifiEapFast + + Username + 用户名 + + + Password + 密钥 + + + Cancel + 取消 + + + Connect + 连接 + + + None + + + + + DlgHideWifiEapLeap + + Username + 用户名 + + + Password + 密钥 + + + Cancel + 取消 + + + Connect + 连接 + + + None + + + + + DlgHideWifiEapPeap + + Domain + + + + Username + 用户名 + + + Password + 密钥 + + + Cancel + 取消 + + + Connect + 连接 + + + None + + + + + DlgHideWifiEapPwd + + Username + 用户名 + + + Password + 密钥 + + + Cancel + 取消 + + + Connect + 连接 + + + None + + + + + DlgHideWifiEapTTLS + + Domain + + + + Username + 用户名 + + + Password + 密钥 + + + Cancel + 取消 + + + Connect + 连接 + + + None + + + + + DlgHideWifiEapTls + + Identity + 匿名身份 + + + Domain + + + + User certificate + 用户证书 + + + User private key + 用户私钥 + + + User key password + 用户密钥密码 + + + Cancel + 取消 + + + Connect + 连接 + + + None + + + + + DlgHideWifiLeap + + Username + 用户名 + + + Password + 密钥 + + + Cancel + 取消 + + + Connect + 连接 + + + None + + + + + DlgHideWifiWep + + Cancel + 取消 + + + Connect + 连接 + + + None + + + + + DlgHideWifiWpa + + Password + 密钥 + + + Cancel + 取消 + + + Connect + 连接 + + + None + + + + + DnsSettingWidget + + + DNS Server Advanced Settings + DNS ᠦᠢᠯᠡᠴᠢᠯᠡᠬᠦᠷ ᠤ᠋ᠨ ᠳᠡᠭᠡᠳᠦ ᠳᠡᠰ ᠤ᠋ᠨ ᠳᠤᠬᠢᠷᠠᠭᠤᠯᠭ᠎ᠠ + + + + Tactic + ᠪᠤᠳᠤᠯᠭ᠎ᠠ + + + + Timeout + ᠴᠠᠭ ᠡᠴᠡ ᠬᠡᠳᠦᠷᠡᠭᠰᠡᠨ ᠴᠠᠭ + + + + Retry Count + ᠳᠠᠬᠢᠨ ᠳᠤᠷᠰᠢᠭᠰᠠᠨ ᠤᠳᠠᠭ᠎ᠠ + + + + order + ᠳᠠᠷᠠᠭᠠᠯᠠᠯ + + + + rotate + ᠳᠠᠰᠢᠷᠠᠮ + + + + concurrency + ᠵᠡᠷᠭᠡᠳᠡ ᠢᠯᠡᠬᠡᠬᠦ + + + + s + ᠰᠸᠺᠦ᠋ᠨ᠋ᠲ + + + + times + ᠤᠳᠠᠭ᠎ᠠ + + + + Close + ᠬᠠᠭᠠᠬᠤ + + + + Cancel + ᠦᠭᠡᠢᠰᠬᠡᠬᠦ + + + + Confirm + ᠪᠠᠳᠤᠯᠠᠬᠤ + + + + EnterpriseWlanDialog + + Connect Enterprise WLAN + ᠠᠵᠤ ᠠᠬᠤᠢᠯᠠᠯ ᠤ᠋ᠨ ᠲᠤᠤᠷ ᠰᠦᠯᠵᠢᠶᠡᠨ ᠳ᠋ᠤ᠌ ᠴᠦᠷᠬᠡᠯᠡᠬᠦ + + + Close + 关闭 + + + + Wi-Fi network requires authentication + Wi-Fi ᠰᠦᠯᠵᠢᠶ᠎ᠡ ᠬᠡᠷᠡᠴᠢᠯᠡᠯ ᠢ᠋ ᠱᠠᠭᠠᠷᠳᠠᠬᠤ + + + + Access to Wi-Fi network " + Wi-Fi ᠰᠦᠯᠵᠢᠶᠡᠨ ᠳ᠋ᠤ᠌ ᠠᠢᠯᠴᠢᠯᠠᠬᠤ + + + + " requires a password or encryption key. + ᠨᠢᠭᠤᠴᠠ ᠺᠣᠳ᠋ ᠱᠠᠭᠠᠷᠳᠠᠬᠤ ᠪᠤᠶᠤ ᠨᠢᠭᠤᠴᠠ ᠳᠦᠯᠬᠢᠬᠦᠷ ᠨᠢᠭᠤᠴᠠᠯᠠᠬᠤ. + + + + Cancel + ᠦᠬᠡᠢᠰᠬᠡᠬᠦ + + + + Connect + ᠴᠦᠷᠬᠡᠯᠡᠬᠡ + + + + FirewallDialog + + + Allow other devices on this network to discover this computer? + ᠲᠤᠰ ᠳᠦᠯᠵᠢᠶᠡᠨ ᠳᠡᠭᠡᠷᠡᠬᠢ ᠪᠤᠰᠤᠳ ᠳᠦᠬᠦᠬᠡᠷᠦᠮᠵᠢ ᠡᠨᠡ ᠺᠣᠮᠫᠢᠦ᠋ᠲ᠋ᠧᠷ ᠢ᠋ ᠣᠯᠵᠤ ᠮᠡᠳᠡᠬᠦ ᠵᠢ ᠵᠥᠪᠰᠢᠶᠡᠷᠡᠬᠦ ᠤᠤ? + + + + It is not recommended to enable this feature on public networks + ᠨᠡᠢᠳᠡ ᠵᠢᠨ ᠰᠦᠯᠵᠢᠶᠡᠨ ᠳᠡᠭᠡᠷ᠎ᠡ ᠲᠤᠰ ᠴᠢᠳᠠᠪᠬᠢ ᠵᠢ ᠨᠡᠬᠡᠬᠡᠬᠦ ᠥᠬᠡᠢ ᠪᠠᠢᠬᠤ ᠵᠢ ᠰᠠᠨᠠᠭᠤᠯᠵᠤ ᠪᠠᠢᠨ᠎ᠠ + + + + Not allowed (recommended) + ᠵᠥᠪᠰᠢᠶᠡᠷᠡᠬᠦ ᠥᠬᠡᠢ ( ᠳᠠᠨᠢᠯᠴᠠᠭᠤᠯᠬᠤ) + + + + Allowed + ᠵᠥᠪᠰᠢᠶᠡᠷᠡᠬᠦ + + + + Ipv4Page + + + IPv4Config + IPv4 ᠳᠤᠬᠢᠷᠠᠭᠤᠯᠭ᠎ᠠ + + + + Address + ᠬᠠᠶᠢᠭ + + + + Netmask + ᠬᠤᠪᠢᠶᠠᠷᠢ ᠰᠦᠯᠵᠢᠶᠡᠨ ᠤ᠋ ᠬᠠᠯᠬᠠᠪᠴᠢ + + + + Default Gateway + ᠠᠶᠠᠳᠠᠯ ᠨᠧᠲ ᠪᠤᠭᠤᠮᠳᠠ + + + Prefs DNS + ᠳᠡᠷᠢᠬᠦᠨ ᠰᠤᠩᠭᠤᠯᠳᠠ DNS + + + Alternative DNS + ᠪᠡᠯᠡᠳᠬᠡᠯ ᠰᠤᠩᠭᠤᠯᠳᠠ DNS + + + + Auto(DHCP) + ᠠᠦ᠋ᠲ᠋ᠤ᠋ (DHCP) + + + + Manual + ᠭᠠᠷ᠎ᠢᠶᠠᠷ ᠬᠦᠳᠡᠯᠭᠡᠬᠦ᠌ + + + + Invalid address + ᠬᠦᠴᠦᠨ ᠦᠬᠡᠢ ᠬᠠᠶᠢᠭ + + + + Invalid subnet mask + ᠬᠦᠴᠦᠨ ᠦᠬᠡᠢ ᠬᠤᠪᠢᠶᠠᠷᠢ ᠰᠦᠯᠵᠢᠶᠡᠨ ᠤ᠋ ᠬᠠᠯᠬᠠᠪᠴᠢ + + + + + Required + ᠡᠷᠬᠡᠪᠰᠢ ᠳᠠᠭᠯᠠᠬᠤ + + + + Address conflict + ᠬᠠᠶᠢᠭ ᠤ᠋ᠨ ᠮᠦᠷᠬᠦᠯᠳᠦᠬᠡᠨ + + + + Ipv6Page + + + IPv6Config + IPv6 ᠳᠤᠬᠢᠷᠠᠭᠤᠯᠭ᠎ᠠ + + + + Address + ᠬᠠᠶᠢᠭ + + + + Subnet prefix Length + ᠬᠤᠪᠢᠶᠠᠷᠢ ᠰᠦᠯᠵᠢᠶᠡᠨ ᠤ᠋ ᠤᠭᠳᠤᠪᠤᠷᠢ ᠵᠢᠨ ᠤᠷᠳᠤ + + + + Default Gateway + ᠠᠶᠠᠳᠠᠯ ᠨᠧᠲ ᠪᠤᠭᠤᠮᠳᠠ + + + Prefs DNS + ᠳᠡᠷᠢᠬᠦᠨ ᠰᠤᠩᠭᠤᠯᠳᠠ DNS + + + Alternative DNS + ᠪᠡᠯᠡᠳᠬᠡᠯ ᠰᠤᠩᠭᠤᠯᠳᠠ DNS + + + + Auto(DHCP) + ᠠᠦ᠋ᠲ᠋ᠤ᠋ (DHCP) + + + + Manual + ᠭᠠᠷ᠎ᠢᠶᠠᠷ ᠬᠦᠳᠡᠯᠭᠡᠬᠦ᠌ + + + + + Required + ᠡᠷᠬᠡᠪᠰᠢ ᠳᠠᠭᠯᠠᠬᠤ + + + + Invalid address + ᠬᠦᠴᠦᠨ ᠦᠬᠡᠢ ᠬᠠᠶᠢᠭ + + + + Invalid gateway + ᠬᠦᠴᠦᠨ ᠦᠬᠡᠢ ᠨᠧᠲ ᠪᠤᠭᠤᠮᠳᠠ + + + + Address conflict + ᠬᠠᠶᠢᠭ ᠤ᠋ᠨ ᠮᠦᠷᠬᠦᠯᠳᠦᠬᠡᠨ + + + + JoinHiddenWiFiPage + + + Please enter the network information + ᠲᠠᠨ ᠤ᠋ ᠣᠷᠣᠬᠤ ᠬᠡᠵᠤ ᠪᠠᠢᠭ᠎ᠠ ᠰᠦᠯᠵᠢᠶᠡᠨ ᠰᠤᠷᠠᠭ ᠵᠠᠩᠬᠢ ᠵᠢ ᠣᠷᠣᠭᠤᠯᠤᠭᠠᠷᠠᠢ + + + + Network name(SSID) + ᠰᠦᠯᠵᠢᠶᠡᠨ ᠤ᠋ ᠨᠡᠷ᠎ᠡ (SSID) + + + + Show Network List + ᠰᠦᠯᠵᠢᠶᠡᠨ ᠤ᠋ ᠵᠢᠭᠰᠠᠭᠠᠯᠳᠠ ᠵᠢ ᠢᠯᠡᠷᠡᠬᠦᠯᠬᠦ + + + + Cancel + ᠦᠬᠡᠢᠰᠬᠡᠬᠦ + + + + Join + ᠣᠷᠣᠬᠤ + + + + Required + ᠡᠷᠬᠡᠪᠰᠢ ᠳᠠᠭᠯᠠᠬᠤ + + + + Find and Join WLAN + ᠤᠳᠠᠰᠤ ᠥᠬᠡᠢ ᠬᠡᠰᠡᠭ ᠤ᠋ᠨ ᠰᠦᠯᠵᠢᠶ᠎ᠡ ᠵᠢ ᠡᠷᠢᠵᠤ ᠣᠷᠣᠬᠤ + + + + LanListItem + + + Not connected + ᠴᠦᠷᠬᠡᠯᠡᠭᠡ ᠦᠬᠡᠢ + + + + Wired Device not carried + ᠰᠦᠯᠵᠢᠶᠡᠨ ᠤ᠋ ᠤᠳᠠᠰᠤ ᠵᠠᠯᠭᠠᠭ᠎ᠠ ᠦᠬᠡᠢ + + + + + + Disconnect + ᠳᠠᠰᠤᠯᠬᠤ + + + + + + Connect + ᠴᠦᠷᠬᠡᠯᠡᠬᠡ + + + + + Property + ᠬᠠᠷᠢᠶᠠᠯᠠᠯ + + + + + Delete + ᠲᠤᠰ ᠰᠦᠯᠵᠢᠶ᠎ᠡ ᠵᠢ ᠬᠠᠰᠤᠬᠤ + + + + LanPage + + No ethernet device avaliable + ᠤᠳᠠᠰᠤᠳᠤ ᠳᠦᠬᠦᠬᠡᠷᠦᠮᠵᠢ ᠵᠢ ᠪᠠᠢᠴᠠᠭᠠᠵᠤ ᠤᠯᠤᠭᠰᠠᠨ ᠦᠬᠡᠢ + + + + LAN + ᠤᠳᠠᠰᠤᠳᠤ ᠲᠤᠤᠷ ᠰᠦᠯᠵᠢᠶ᠎ᠡ + + + + conflict, unable to connect to the network normally! + ᠮᠦᠷᠬᠦᠯᠳᠦᠬᠦ᠂ ᠰᠦᠯᠵᠢᠶᠡᠨ ᠳ᠋ᠤ᠌ ᠬᠡᠪ ᠤ᠋ᠨ ᠴᠦᠷᠬᠡᠯᠡᠵᠤ ᠴᠢᠳᠠᠬᠤ ᠥᠬᠡᠢ! + + + + Activated LAN + ᠮᠢᠨᠤ ᠲᠤᠤᠷ ᠰᠦᠯᠵᠢᠶ᠎ᠡ + + + + Inactivated LAN + ᠪᠤᠰᠤᠳ ᠲᠤᠤᠷ ᠰᠦᠯᠵᠢᠶ᠎ᠡ + + + LAN Disconnected Successfully + ᠤᠳᠠᠰᠤᠳᠤ ᠲᠤᠤᠷ ᠰᠦᠯᠵᠢᠶ᠎ᠡ ᠵᠢ ᠨᠢᠭᠡᠨᠳᠡ ᠳᠠᠰᠤᠯᠪᠠ + + + + Wired Device not carried + ᠰᠦᠯᠵᠢᠶᠡᠨ ᠤ᠋ ᠤᠳᠠᠰᠤ ᠵᠠᠯᠭᠠᠭ᠎ᠠ ᠦᠬᠡᠢ + + + LAN Connected Successfully + ᠤᠳᠠᠰᠤᠳᠤ ᠲᠤᠤᠷ ᠰᠦᠯᠵᠢᠶ᠎ᠡ ᠵᠢ ᠨᠢᠭᠡᠨᠳᠡ ᠴᠦᠷᠬᠡᠯᠡᠪᠡ + + + + + Connected: + ᠴᠥᠷᠬᠡᠯᠡᠪᠡ: + + + + Not Connected + ᠴᠥᠷᠬᠡᠯᠡᠭᠡ ᠥᠬᠡᠢ + + + + (Limited) + ( ᠰᠦᠯᠵᠢᠶ᠎ᠡ ᠬᠢᠵᠠᠭᠠᠷᠯᠠᠭᠳᠠᠪᠠ) + + + + ListItem + + + Kylin NM + ᠴᠢ ᠯᠢᠨ ᠲᠤᠤᠷ ᠰᠦᠯᠵᠢᠶ᠎ᠡ ᠵᠢ ᠳᠤᠬᠢᠷᠠᠭᠤᠯᠬᠤ ᠪᠠᠭᠠᠵᠢ + + + + kylin network applet desktop message + ᠲᠤᠤᠷ ᠰᠦᠯᠵᠢᠶᠡᠨ ᠤ᠋ ᠰᠠᠨᠠᠭᠤᠯᠤᠮᠵᠢ ᠵᠢᠨ ᠮᠡᠳᠡᠭᠡ + + + + MainWindow + + + + kylin-nm + ᠲᠤᠤᠷ ᠰᠦᠯᠵᠢᠶᠡᠨ ᠤ᠋ ᠪᠠᠭᠠᠵᠢ + + + + LAN + 有线网络 + ᠤᠳᠠᠰᠤᠳᠤ ᠰᠦᠯᠵᠢᠶ᠎ᠡ + + + + WLAN + 无线局域网 + ᠤᠳᠠᠰᠤ ᠦᠬᠡᠢ ᠬᠡᠰᠡᠭ ᠰᠦᠯᠵᠢᠶ᠎ᠡ + + + + Show MainWindow + ᠲᠤᠤᠷ ᠰᠦᠯᠵᠢᠶᠡᠨ ᠤ᠋ ᠪᠠᠭᠠᠵᠢ ᠵᠢ ᠨᠡᠬᠡᠬᠡᠬᠦ + + + + Settings + ᠲᠤᠤᠷ ᠰᠦᠯᠵᠢᠶᠡᠨ ᠤ᠋ ᠲᠦᠷᠦᠯ ᠢ᠋ ᠳᠤᠬᠢᠷᠠᠭᠤᠯᠬᠤ + ᠲᠤᠤᠷ ᠰᠦᠯᠵᠢᠶᠡᠨ ᠤ᠋ ᠲᠦᠷᠦᠯ ᠢ᠋ ᠳᠤᠬᠢᠷᠠᠭᠤᠯᠬᠤ + + + + + Network tool + ᠰᠦᠯᠵᠢᠶᠡᠨ ᠤ᠋ ᠪᠠᠭᠠᠵᠢ + + + + Network Card + ᠰᠦᠯᠵᠢᠶᠡᠨ ᠤ᠋ ᠺᠠᠷᠲ + + + + Not connected to the network + ᠰᠦᠯᠵᠢᠶᠡᠨ ᠳ᠋ᠤ᠌ ᠴᠥᠷᠬᠡᠯᠡᠭᠡ ᠥᠬᠡᠢ + + + + MultipleDnsWidget + + + DNS server(Drag to sort) + DNS ᠦᠢᠯᠡᠴᠢᠯᠡᠬᠦᠷ ᠤ᠋ᠨ ᠦᠨᠳᠦᠷ ᠳᠡᠰ ᠤ᠋ᠨ ᠳᠤᠬᠢᠷᠠᠭᠤᠯᠭ᠎ᠠ + + + + Click "+" to configure DNS + "+" ᠢ᠋/ ᠵᠢ ᠳᠤᠪᠴᠢᠳᠠᠵᠤ᠂ DNS ᠢ᠋/ ᠵᠢ ᠳᠤᠬᠢᠷᠠᠭᠤᠯᠬᠤ + + + + Settings + ᠦᠨᠳᠦᠷ ᠳᠡᠰ ᠤ᠋ᠨ ᠳᠤᠬᠢᠷᠠᠭᠤᠯᠭ᠎ᠠ + + + + NetDetail + + + Kylin NM + ᠴᠢ ᠯᠢᠨ ᠲᠤᠤᠷ ᠰᠦᠯᠵᠢᠶ᠎ᠡ ᠵᠢ ᠳᠤᠬᠢᠷᠠᠭᠤᠯᠬᠤ ᠪᠠᠭᠠᠵᠢ + + + + kylin network desktop message + ᠲᠤᠤᠷ ᠰᠦᠯᠵᠢᠶᠡᠨ ᠤ᠋ ᠰᠠᠨᠠᠭᠤᠯᠤᠮᠵᠢ ᠵᠢᠨ ᠮᠡᠳᠡᠭᠡ + + + + Detail + ᠳᠡᠯᠭᠡᠷᠡᠩᠭᠦᠢ ᠠᠭᠤᠯᠭ᠎ᠠ + + + + IPv4 + IPv4 + + + + IPv6 + IPv6 + + + + Security + ᠠᠮᠤᠷ ᠳᠦᠪᠰᠢᠨ + + + Close + 关闭 + + + + + Config + ᠳᠤᠬᠢᠷᠠᠭᠤᠯᠭ᠎ᠠ + + + + Confirm + ᠪᠠᠳᠤᠯᠠᠬᠤ + + + + Cancel + ᠦᠬᠡᠢᠰᠬᠡᠬᠦ + + + + Forget this network + ᠲᠤᠰ ᠲᠤᠤᠷ ᠰᠦᠯᠵᠢᠶ᠎ᠡ ᠵᠢ ᠮᠠᠷᠳᠠᠬᠤ + + + + Delete this network + ᠲᠤᠰ ᠰᠦᠯᠵᠢᠶ᠎ᠡ ᠵᠢ ᠬᠠᠰᠤᠬᠤ + + + + Add LAN Connect + ᠤᠳᠠᠰᠤᠳᠤ ᠲᠤᠤᠷ ᠰᠦᠯᠵᠢᠶ᠎ᠡ ᠨᠡᠮᠡᠬᠦ + + + + Connect Hidden WLAN + ᠨᠢᠭᠤᠴᠠᠯᠠᠭᠰᠠᠨ WLAN ᠲᠤ᠌/ ᠳ᠋ᠤ᠌ ᠴᠦᠷᠬᠡᠯᠡᠬᠦ + + + + + + None + ᠦᠬᠡᠢ + + + + + + Auto + ᠠᠦ᠋ᠲ᠋ᠤ᠋ + + + + start check ipv4 address conflict + ipv4 ᠬᠠᠶᠢᠭ ᠤ᠋ᠨ ᠮᠦᠷᠬᠦᠯᠳᠦᠬᠡᠨ ᠢ᠋ ᠪᠠᠢᠴᠠᠭᠠᠵᠤ ᠡᠬᠢᠯᠡᠪᠡ + + + + start check ipv6 address conflict + ipv6 ᠬᠠᠶᠢᠭ ᠤ᠋ᠨ ᠮᠦᠷᠬᠦᠯᠳᠦᠬᠡᠨ ᠢ᠋ ᠪᠠᠢᠴᠠᠭᠠᠵᠤ ᠡᠬᠢᠯᠡᠪᠡ + + + ipv4 address conflict! + ipv4 ᠬᠠᠶᠢᠭ ᠮᠦᠷᠬᠦᠯᠳᠦᠬᠡᠨ ᠲᠠᠢ! + + + ipv6 address conflict! + ipv6 ᠬᠠᠶᠢᠭ ᠮᠦᠷᠬᠦᠯᠳᠦᠬᠡᠨ ᠲᠠᠢ! + + + + this wifi no support enterprise type + ᠲᠤᠰ wifi ᠠᠵᠤ ᠠᠬᠤᠢᠯᠠᠯ ᠤ᠋ᠨ ᠰᠦᠯᠵᠢᠶᠡᠨ ᠤ᠋ ᠲᠦᠷᠦᠯ ᠢ᠋ ᠳᠡᠮᠵᠢᠬᠦ ᠦᠬᠡᠢ + + + + this wifi no support None type + ᠲᠤᠰ wifi ᠬᠤᠭᠤᠰᠤᠨ ᠬᠡᠯᠪᠡᠷᠢ ᠵᠢ ᠳᠡᠮᠵᠢᠬᠦ ᠦᠬᠡᠢ + + + + this wifi no support WPA2 type + ᠲᠤᠰ wifiWPA2 ᠳᠦᠷᠦᠯ ᠢ᠋ ᠳᠡᠮᠵᠢᠬᠦ ᠦᠬᠡᠢ + + + + this wifi no support WPA3 type + ᠲᠤᠰ wifiWPA3 ᠳᠦᠷᠦᠯ ᠢ᠋ ᠳᠡᠮᠵᠢᠬᠦ ᠦᠬᠡᠢ + + + SSID: + SSID: + + + Protocol: + 协议: + + + Hz: + 网络频带: + + + Chan: + 网络通道: + + + BandWidth: + 带宽: + + + IPv4: + IPv4地址: + + + IPv4 DNS: + IPv4 DNS服务器: + + + IPv6: + 本地链接IPv6地址: + + + Mac: + 物理地址: + + + + OldMainWindow + + kylin-nm + 网络工具 + + + Show MainWindow + 打开网络工具 + + + Not connected + 未连接 + + + + OneConnForm + + + Form + + + + Connect + 连接 + + + Disconnect + 断开 + + + Cancel + 取消 + + + Forget + 忘记此网络 + + + None + + + + + OneLancForm + + + Form + + + + Connect + 连接 + + + Disconnect + 断开 + + + Cancel + 取消 + + + Not connected + 未连接 + + + + SecurityPage + + + Remember the Network + ᠲᠤᠰ ᠰᠦᠯᠵᠢᠶ᠎ᠡ ᠵᠢ ᠴᠡᠬᠡᠵᠢᠯᠡᠬᠦ + + + + Security + ᠠᠶᠤᠯᠬᠦᠢ ᠴᠢᠨᠠᠷ + + + + + Password + ᠨᠢᠭᠤᠴᠠ ᠲᠦᠯᠬᠢᠬᠦᠷ + + + + EAP type + EAP ᠠᠷᠭ᠎ᠠ + + + + Identity + ᠨᠡᠷ᠎ᠡ ᠪᠤᠷᠤᠭᠤᠯᠤᠭᠰᠠᠨ ᠪᠡᠶ᠎ᠡ ᠵᠢᠨ ᠭᠠᠷᠤᠯ + + + + Domain + ᠤᠷᠤᠨ + + + + CA certficate + CA ᠦᠨᠡᠮᠯᠡᠯ + + + + no need for CA certificate + CA ᠦᠨᠡᠮᠯᠡᠯ ᠬᠡᠷᠡᠭᠰᠡᠬᠦ ᠦᠬᠡᠢ + + + + User certificate + ᠬᠡᠷᠡᠭᠯᠡᠭᠴᠢ ᠵᠢᠨ ᠦᠨᠡᠮᠯᠡᠯ + + + + User private key + ᠬᠡᠷᠡᠭᠯᠡᠭᠴᠢ ᠵᠢᠨ ᠨᠢᠭᠤᠴᠠ ᠳᠦᠯᠬᠢᠬᠦᠷ + + + + User key password + ᠬᠡᠷᠡᠭᠯᠡᠭᠴᠢ ᠵᠢᠨ ᠨᠢᠭᠤᠴᠠ ᠳᠦᠯᠬᠢᠬᠦᠷ ᠤ᠋ᠨ ᠨᠢᠭᠤᠴᠠ ᠺᠤᠳ᠋ + + + + Password options + ᠨᠢᠭᠤᠴᠠ ᠺᠣᠳ᠋ ᠤ᠋ᠨ ᠰᠤᠩᠭᠤᠭᠳᠠᠬᠤᠨ + + + + + + Required + ᠵᠠᠪᠠᠯ ᠲᠠᠭᠯᠠᠨ᠎ᠠ ᠃ + + + + Ineer authentication + ᠳᠤᠳᠤᠭᠠᠳᠤ ᠬᠡᠷᠡᠴᠢᠯᠡᠯ + + + + Username + ᠬᠡᠷᠡᠭᠯᠡᠭᠴᠢ ᠵᠢᠨ ᠨᠡᠷ᠎ᠡ + + + + Ask pwd each query + ᠤᠳᠠᠭ᠎ᠠ ᠪᠦᠷᠢ ᠨᠢᠭᠤᠴᠠ ᠺᠤᠳ᠋ ᠢ᠋ ᠯᠠᠪᠯᠠᠬᠤ + + + + + + + + + + + + + + + + None + ᠦᠬᠡᠢ + + + + WPA&WPA2 Personal + WPA&WPA2 ᠬᠤᠪᠢ ᠬᠦᠮᠦᠨ + + + + WPA&WPA2 Enterprise + WPA&WPA2 ᠠᠵᠤ ᠠᠬᠤᠢᠯᠠᠯ + + + + WPA3 Personal + WPA3 ᠬᠤᠪᠢ ᠬᠦᠮᠦᠨ + + + + + + + Choose from file... + ᠹᠠᠢᠯ ᠡᠴᠡ ᠰᠤᠩᠭᠤᠬᠤ... + + + + Store passwords only for this user + ᠵᠥᠪᠬᠡᠨ ᠲᠤᠰ ᠬᠡᠷᠡᠭᠯᠡᠭᠴᠢ ᠵᠢᠨ ᠨᠢᠭᠤᠴᠠ ᠺᠣᠳ᠋ ᠢ᠋ ᠬᠠᠳᠠᠭᠠᠯᠠᠬᠤ + + + + Store password only for this user + ᠵᠥᠪᠬᠡᠨ ᠲᠤᠰ ᠬᠡᠷᠡᠭᠯᠡᠭᠴᠢ ᠵᠢᠨ ᠨᠢᠭᠤᠴᠠ ᠺᠣᠳ᠋ ᠢ᠋ ᠬᠠᠳᠠᠭᠠᠯᠠᠬᠤ + + + + Store passwords for all users + ᠪᠦᠬᠦᠢᠯᠡ ᠬᠡᠷᠡᠭᠡᠯᠡᠭᠴᠢ ᠵᠢᠨ ᠨᠢᠭᠤᠴᠠ ᠺᠤᠳ᠋ ᠢ᠋ ᠬᠠᠳᠠᠭᠠᠯᠠᠬᠤ + + + + Store password for all users + ᠪᠦᠬᠦᠢᠯᠡ ᠬᠡᠷᠡᠭᠡᠯᠡᠭᠴᠢ ᠵᠢᠨ ᠨᠢᠭᠤᠴᠠ ᠺᠤᠳ᠋ ᠢ᠋ ᠬᠠᠳᠠᠭᠠᠯᠠᠬᠤ + + + + Ask this password every time + ᠤᠳᠠᠭ᠎ᠠ ᠪᠦᠷᠢ ᠲᠤᠰ ᠨᠢᠭᠤᠴᠠ ᠺᠣᠳ᠋ ᠢ᠋ ᠠᠰᠠᠭᠤᠨ ᠯᠠᠪᠯᠠᠬᠤ + + + + Ask password every time + ᠤᠳᠠᠭ᠎ᠠ ᠪᠦᠷᠢ ᠲᠤᠰ ᠨᠢᠭᠤᠴᠠ ᠺᠣᠳ᠋ ᠢ᠋ ᠠᠰᠠᠭᠤᠨ ᠯᠠᠪᠯᠠᠬᠤ + + + + + + Choose a CA certificate + ᠨᠢᠭᠡ CA ᠬᠡᠷᠡᠴᠢᠯᠡᠯ ᠰᠤᠩᠭᠤᠬᠤ + + + + + + CA Files (*.pem *.der *.p12 *.crt *.cer *.pfx) + CA ᠬᠡᠷᠡᠴᠢᠯᠡᠯ (*.pem *.der *.p12 *.crt *.cer *.pfx) + + + + PAC provisioning + PAC ᠳᠤᠬᠢᠷᠠᠭᠤᠯᠭ᠎ᠠ + + + + Allow automatic PAC provisioning + ᠠᠦ᠋ᠲ᠋ᠣ᠋ PAC ᠳᠤᠬᠢᠷᠠᠭᠤᠯᠭ᠎ᠠ ᠵᠢ ᠵᠥᠪᠰᠢᠶᠡᠷᠡᠬᠦ + + + + PAC file + PAC ᠹᠠᠢᠯ + + + + Anonymous + ᠪᠤᠷᠤᠭᠤᠯᠠᠭᠰᠠᠨ ᠨᠡᠷ᠎ᠡ + + + + Authenticated + ᠬᠡᠷᠡᠴᠢᠯᠡᠪᠡ + + + + Both + ᠬᠣᠶᠠᠭᠤᠯᠠ ᠵᠢ ᠠᠭᠤᠰᠤᠯᠴᠠᠭᠤᠯᠵᠤ ᠬᠡᠷᠡᠭᠯᠡᠬᠦ + + + + Choose a PAC file + ᠨᠢᠭᠡ PAC ᠹᠠᠢᠯ ᠰᠣᠩᠭᠣᠬᠤ + + + + PAC Files (*.pac) + PAC ᠹᠠᠢᠯ (*.pac) + + + + + + + + + TabPage + + + Current Device + ᠤᠳᠤᠬᠠᠨ ᠤ᠋ ᠨᠧᠲ ᠺᠠᠷᠲ + + + + Devices Closed! + ᠳᠦᠬᠦᠬᠡᠷᠦᠮᠵᠢ ᠬᠠᠭᠠᠭᠳᠠᠪᠠ! + + + + Settings + ᠲᠤᠤᠷ ᠰᠦᠯᠵᠢᠶᠡᠨ ᠤ᠋ ᠳᠤᠬᠢᠷᠠᠭᠤᠯᠭ᠎ᠠ + + + + Kylin NM + ᠴᠢ ᠯᠢᠨ ᠲᠤᠤᠷ ᠰᠦᠯᠵᠢᠶᠡᠨ ᠤ᠋ ᠳᠤᠬᠢᠷᠠᠭᠤᠯᠬᠤ ᠪᠠᠭᠠᠵᠢ + + + + kylin network applet desktop message + ᠲᠤᠤᠷ ᠰᠦᠯᠵᠢᠶᠡᠨ ᠤ᠋ ᠰᠠᠨᠠᠭᠤᠯᠤᠮᠵᠢ ᠵᠢᠨ ᠮᠡᠳᠡᠭᠡ + + + + WiFiConfigDialog + + WLAN Authentication + WLAN ᠬᠡᠷᠡᠴᠢᠯᠡᠯ + + + Input WLAN Information Please + WLAN ᠰᠤᠷᠠᠭ ᠵᠠᠩᠬᠢ ᠵᠢ ᠤᠷᠤᠭᠤᠯᠤᠭᠠᠷᠠᠢ + + + WLAN ID: + WLAN ID: + + + WLAN Name: + WLAN ᠨᠡᠷᠡᠢᠳᠦᠯ: + + + Password: + ᠨᠢᠭᠤᠴᠠ ᠺᠤᠳ᠋: + + + Cancl + ᠦᠬᠡᠢᠰᠬᠡᠬᠦ + + + Ok + Ok + + + + WlanListItem + + + Not connected + ᠴᠦᠷᠬᠡᠯᠡᠭᠡ ᠦᠬᠡᠢ + + + + + + + + Disconnect + ᠳᠠᠰᠤᠯᠬᠤ + + + + + + + + Connect + ᠴᠦᠷᠬᠡᠯᠡᠬᠡ + + + + + Forget + ᠲᠤᠰ ᠲᠤᠤᠷ ᠰᠦᠯᠵᠢᠶ᠎ᠡ ᠵᠢ ᠮᠠᠷᠳᠠᠬᠤ + + + + + Property + ᠬᠠᠷᠢᠶᠠᠯᠠᠯ + + + + Auto Connect + ᠲᠤᠰ ᠲᠤᠤᠷ ᠰᠦᠯᠵᠢᠶᠡᠨ ᠳ᠋ᠤ᠌ ᠠᠦ᠋ᠲ᠋ᠤ᠋ ᠪᠡᠷ ᠵᠠᠯᠭᠠᠬᠤ + + + + WlanMoreItem + + More... + 更多... + + + + Add Others... + ᠪᠤᠰᠤᠳ ᠲᠤᠤᠷ ᠰᠦᠯᠵᠢᠶᠡᠨ ᠳ᠋ᠤ᠌ ᠵᠠᠯᠭᠠᠬᠤ... + + + + WlanPage + + + WLAN + ᠤᠳᠠᠰᠤ ᠦᠬᠡᠢ ᠬᠡᠰᠡᠭ ᠰᠦᠯᠵᠢᠶ᠎ᠡ + + + + No wireless network card detected + ᠤᠳᠠᠰᠤ ᠦᠬᠡᠢ ᠰᠦᠯᠵᠢᠶᠡᠨ ᠺᠠᠷᠲ᠎ᠢ ᠬᠢᠨᠠᠨ ᠬᠡᠮᠵᠢᠵᠤ ᠤᠯᠤᠭᠰᠠᠨ ᠦᠬᠡᠢ + + + + Activated WLAN + ᠮᠢᠨᠤ ᠲᠤᠤᠷ ᠰᠦᠯᠵᠢᠶ᠎ᠡ + + + + Other WLAN + ᠪᠤᠰᠤᠳ ᠰᠦᠯᠵᠢᠶ᠎ᠡ + + + More... + 更多... + + + + WLAN Connected Successfully + ᠤᠳᠠᠰᠤ ᠦᠬᠡᠢ ᠲᠤᠤᠷ ᠰᠦᠯᠵᠢᠶ᠎ᠡ ᠵᠢ ᠴᠦᠷᠬᠡᠯᠡᠪᠡ + + + + WLAN Disconnected Successfully + ᠤᠳᠠᠰᠤ ᠦᠬᠡᠢ ᠲᠤᠤᠷ ᠰᠦᠯᠵᠢᠶ᠎ᠡ ᠵᠢ ᠳᠠᠰᠤᠯᠪᠠ + + + + Connected: + ᠴᠥᠷᠬᠡᠯᠡᠪᠡ: + + + + Not Connected + ᠴᠥᠷᠬᠡᠯᠡᠭᠡ ᠥᠬᠡᠢ + + + (Limited) + ( ᠰᠦᠯᠵᠢᠶ᠎ᠡ ᠬᠢᠵᠠᠭᠠᠷᠯᠠᠭᠳᠠᠪᠠ) + + + + WpaWifiDialog + + EAP type + EAP方法 + + + Username + 用户名 + + + Password + 密钥 + + + Ask pwd each query + 每次询问密码 + + + Cancel + 取消 + + + Connect + 连接 + + + None + + + + Choose from file... + 从文件选择... + + + Choose a CA certificate + 选择一个CA证书 + + + CA Files (*.pem *.der *.p12 *.crt *.cer *.pfx) + CA 证书 (*.pem *.der *.p12 *.crt *.cer *.pfx) + + + Identity + 匿名身份 + + + Domain + + + + no need for CA certificate + 不需要CA证书 + + + + main + + + kylinnm + + + + + show kylin-nm wifi page + + + + + show kylin-nm lan page + + + + diff --git a/src/translations/kylin-nm_tr.qm b/src/translations/kylin-nm_tr.qm deleted file mode 100644 index dec3ec35..00000000 Binary files a/src/translations/kylin-nm_tr.qm and /dev/null differ diff --git a/translations/kylin-nm_tr.ts b/src/translations/kylin-nm_tr.ts similarity index 75% rename from translations/kylin-nm_tr.ts rename to src/translations/kylin-nm_tr.ts index 7a973305..e79ac137 100644 --- a/translations/kylin-nm_tr.ts +++ b/src/translations/kylin-nm_tr.ts @@ -102,22 +102,22 @@ ConfigPage - + Network profile type - + Public(recommended) Devices on the network cannot discover this computer. Generally, it is suitable for networks in public places, such as airports or coffee shops, etc. - + Private Devices on the network can discover this computer. Generally applicable to a network at home or work where you know and trust the individuals and devices on the network. - + Config firewall and security settings @@ -125,53 +125,58 @@ CreatNetPage - + Connection Name - + IPv4Config - + Address - + Netmask - + Default Gateway - + Invalid address - + Invalid subnet mask - - + + Required - + + Address conflict + + + + Auto(DHCP) Oto(DHCP) - + Manual Elle @@ -179,82 +184,82 @@ DetailPage - + Auto Connection - - + + SSID: - + Copied successfully! - + Copy all - + Please input SSID: - - + + Protocol: - - + + Security Type: - - + + Hz: - - + + Chan: - - + + BandWidth: - - + + IPv4: IPv6 adresi: {4:?} - - - IPv6: - IPv6 adresi: {6:?} - - - - + + IPv4 DNS: - - + + + IPv6: + IPv6 adresi: {6:?} + + + + Mac: @@ -1181,29 +1186,92 @@ - EnterpriseWlanDialog + DnsSettingWidget - - Wi-Fi network requires authentication + + DNS Server Advanced Settings - - Access to Wi-Fi network " + + Tactic - - " requires a password or encryption key. + + Timeout - + + Retry Count + + + + + order + + + + + rotate + + + + + concurrency + + + + + s + + + + + times + + + + + Close + + + + Cancel - + + Confirm + + + + + EnterpriseWlanDialog + + + Wi-Fi network requires authentication + + + + + Access to Wi-Fi network " + + + + + " requires a password or encryption key. + + + + + Cancel + + + + Connect @@ -1211,22 +1279,22 @@ FirewallDialog - + Allow other devices on this network to discover this computer? - + It is not recommended to enable this feature on public networks - + Not allowed (recommended) - + Allowed @@ -1234,53 +1302,53 @@ Ipv4Page - + Address - + Netmask - + Default Gateway - + IPv4Config - + Auto(DHCP) Oto(DHCP) - + Manual Elle - + Invalid address - + Invalid subnet mask - - + + Required - + Address conflict @@ -1288,53 +1356,53 @@ Ipv6Page - + Address - + Subnet prefix Length - + Default Gateway - + IPv6Config - + Auto(DHCP) Oto(DHCP) - + Manual Elle - - + + Required - + Invalid address - + Invalid gateway - + Address conflict @@ -1342,38 +1410,38 @@ JoinHiddenWiFiPage - - Please enter the network name and security type + + Please enter the network information - + Network name(SSID) - + Show Network List - + Cancel - + Join - + Required - - Find and Join Wi-Fi + + Find and Join WLAN @@ -1387,38 +1455,38 @@ LanListItem - + Not connected Bağlanamadı - + Wired Device not carried - - - + + + Disconnect Bağlantıyı Kes - - - + + + Connect - - + + Property - - + + Delete @@ -1426,40 +1494,56 @@ LanPage - - No ethernet device avaliable - - - - + LAN - + + conflict, unable to connect to the network normally! + + + + Activated LAN - + Inactivated LAN - + Wired Device not carried + + + + Connected: + + + + + (Limited) + + + + + Not Connected + + ListItem - + Kylin NM - + kylin network applet desktop message Kylin ağ uygulaması masaüstü mesajı @@ -1467,8 +1551,8 @@ MainWindow - - + + kylin-nm @@ -1489,20 +1573,36 @@ Gizli Ağı Bağlan - + LAN - + WLAN WLAN - + Settings + + + + Network tool + + + + + Network Card + + + + + Not connected to the network + + Enabled Aktif @@ -1516,7 +1616,7 @@ HotSpot - + Show MainWindow Ana Pencereyi Göster @@ -1612,120 +1712,130 @@ MultipleDnsWidget - - DNS server: + + DNS server(Drag to sort) + + + + + Click "+" to configure DNS + + + + + Settings NetDetail - + Kylin NM - + kylin network desktop message - + Detail - + Security - - + + Config Ayar - + Confirm - + Cancel - + Forget this network - + IPv4 IPv6 adresi: {4?} - + IPv6 IPv6 adresi: {6?} - + Add LAN Connect - + Connect Hidden WLAN - + Delete this network - - - + + + None Yok - - - + + + Auto Oto - + start check ipv4 address conflict - + start check ipv6 address conflict - + this wifi no support enterprise type - + this wifi no support None type - + this wifi no support WPA2 type - + this wifi no support WPA3 type @@ -1819,7 +1929,7 @@ OneConnForm - + Form -- @@ -1891,7 +2001,7 @@ OneLancForm - + Form -- @@ -1947,213 +2057,214 @@ SecurityPage - + Remember the Network - + Security - - + + Password - + EAP type - + Identity Kimlik: - + Domain Domain: - + CA certficate - + no need for CA certificate - + User certificate Kullanıcı sertifikası: - + User private key Kullanıcı özel anahtarı: - + User key password Kullanıcı anahtarı şifresi: - + Password options - - - + + + Required - + Ineer authentication - + Username - + Ask pwd each query - - - - - - - - - - - - + + + + + + + + + + + + + None Yok - + WPA&WPA2 Personal - + WPA&WPA2 Enterprise - + WPA3 Personal - - - - + + + + Choose from file... - - PAC provisioning - - - - - Allow automatic PAC provisioning - - - - - PAC file - PAC dosyası - - - - Anonymous - Anonim - - - - Authenticated - Doğrulanmış - - - - Both - Her ikisi de - - - + Store passwords only for this user - + Store password only for this user - + Store passwords for all users - + Store password for all users - + Ask this password every time - + Ask password every time - - - + + PAC provisioning + + + + + Allow automatic PAC provisioning + + + + + PAC file + PAC dosyası + + + + Anonymous + Anonim + + + + Authenticated + Doğrulanmış + + + + Both + Her ikisi de + + + + + Choose a CA certificate - - - + + + CA Files (*.pem *.der *.p12 *.crt *.cer *.pfx) - + Choose a PAC file - + PAC Files (*.pac) - + @@ -2161,27 +2272,27 @@ TabPage - + Current Device - + Devices Closed! - + Settings - + Kylin NM - + kylin network applet desktop message Kylin ağ uygulaması masaüstü mesajı @@ -2196,85 +2307,49 @@ WiFiConfigDialog - - Dialog - - - - - WLAN Authentication - - - - - Input WLAN Information Please - - - - - WLAN ID: - - - - - WLAN Name: - - - - - Password: - - - - - Cancl - - - - Ok - Tamam + Tamam WlanListItem - + Not connected Bağlanamadı - - - - - + + + + + Disconnect Bağlantıyı Kes - - - - - + + + + + Connect - - + + Property - - + + Forget - + Auto Connect @@ -2282,7 +2357,7 @@ WlanMoreItem - + Add Others... @@ -2290,32 +2365,42 @@ WlanPage - + WLAN WLAN - + Activated WLAN - + Other WLAN - + + Connected: + + + + + Not Connected + + + + No wireless network card detected - + WLAN Connected Successfully - + WLAN Disconnected Successfully @@ -2338,17 +2423,17 @@ main - + kylinnm - + show kylin-nm wifi page - + show kylin-nm lan page diff --git a/translations/kylin-nm_zh_CN.ts b/src/translations/kylin-nm_zh_CN.ts similarity index 58% rename from translations/kylin-nm_zh_CN.ts rename to src/translations/kylin-nm_zh_CN.ts index ed79480e..eb2b23a9 100644 --- a/translations/kylin-nm_zh_CN.ts +++ b/src/translations/kylin-nm_zh_CN.ts @@ -35,22 +35,22 @@ ConfigPage - + Network profile type 网络配置文件类型 - + Public(recommended) Devices on the network cannot discover this computer. Generally, it is suitable for networks in public places, such as airports or coffee shops, etc. 公用(推荐) 网络中的设备不可发现此电脑。一般情况下适用于公共场所中的网络,如机场或咖啡店等等。 - + Private Devices on the network can discover this computer. Generally applicable to a network at home or work where you know and trust the individuals and devices on the network. 专用 网络中的设备可发现此电脑。一般情况下适用于家庭或工作单位的网络,您认识并信任网络上的个人和设备。 - + Config firewall and security settings 配置防火墙和安全设置 @@ -73,61 +73,66 @@ CreatNetPage - + Connection Name 网络名称 - + IPv4Config - IPv4配置 + IPv4 配置 - + Address - IPv4地址 + IPv4 地址 - + Netmask 子网掩码 - + Default Gateway 默认网关 + + + Address conflict + 地址冲突 + Prefs DNS - 首选DNS + 首选 DNS Alternative DNS - 备选DNS + 备选 DNS - + Auto(DHCP) - 自动(DHCP) + 自动 (DHCP) - + Manual 手动 - + Invalid address - 无效地址 + 无效的IP地址 - + Invalid subnet mask - 无效子网掩码 + 无效的子网掩码 - - + + Required 必填 @@ -135,82 +140,82 @@ DetailPage - + Auto Connection 自动连接 - - + + SSID: SSID: - + Copied successfully! 复制成功! - + Copy all 复制全部 - + Please input SSID: - 请输入SSID: + 请输入 SSID: - - + + Protocol: 协议: - - + + Security Type: 安全类型: - - + + Hz: 网络频带: - - + + Chan: 网络通道: - - + + BandWidth: 带宽: - - + + IPv6: - 本地链接IPv6地址: + 本地链接 IPv6 地址: - - + + IPv4: - IPv4地址: + IPv4 地址: - - + + IPv4 DNS: - IPv4 DNS服务器: + IPv4 DNS 服务器: - - + + Mac: 物理地址: @@ -445,6 +450,69 @@ + + DnsSettingWidget + + + DNS Server Advanced Settings + DNS 服务器高级配置 + + + + Tactic + 策略 + + + + Timeout + 超时时间 + + + + Retry Count + 重试次数 + + + + order + 顺序 + + + + rotate + 随机 + + + + concurrency + 并发 + + + + s + + + + + times + + + + + Close + 关闭 + + + + Cancel + 取消 + + + + Confirm + 确定 + + EnterpriseWlanDialog @@ -456,27 +524,27 @@ 关闭 - + Wi-Fi network requires authentication - Wi-Fi网络要求认证 + Wi-Fi 网络要求认证 - + Access to Wi-Fi network " - 访问Wi-Fi网络 + 访问 Wi-Fi 网络 - + " requires a password or encryption key. 需要密码或加密密钥。 - + Cancel 取消 - + Connect 连接 @@ -500,22 +568,22 @@ - + Allow other devices on this network to discover this computer? 是否允许此网络上的其他设备发现这台电脑? - + It is not recommended to enable this feature on public networks 不建议在公共网络上开启此功能 - + Not allowed (recommended) 不允许(推荐) - + Allowed 允许 @@ -523,61 +591,61 @@ Ipv4Page - + IPv4Config - IPv4配置 + IPv4 配置 - + Address 地址 - + Netmask 子网掩码 - + Default Gateway 默认网关 Prefs DNS - 首选DNS + 首选 DNS Alternative DNS - 备选DNS + 备选 DNS - + Auto(DHCP) 自动 - + Manual 手动 - + Invalid address - 无效地址 + 无效的IP地址 - + Invalid subnet mask - 无效子网掩码 + 无效的子网掩码 - - + + Required 必填 - + Address conflict 地址冲突 @@ -585,61 +653,61 @@ Ipv6Page - + IPv6Config - IPv6配置 + IPv6 配置 - + Address 地址 - + Subnet prefix Length 子网前缀长度 - + Default Gateway 默认网关 Prefs DNS - 首选DNS + 首选 DNS Alternative DNS - 备选DNS + 备选 DNS - + Auto(DHCP) 自动 - + Manual 手动 - - + + Required 必填 - + Invalid address - 无效地址 + 无效的IP地址 - + Invalid gateway - 无效网关 + 无效的网关地址 - + Address conflict 地址冲突 @@ -647,80 +715,80 @@ JoinHiddenWiFiPage - - Please enter the network name and security type - 请输入您想要加入网络的名称和安全类型 + + Please enter the network information + 请输入您想要加入的网络信息 - + Network name(SSID) - 网络名(SSID) + 网络名 (SSID) Remember the Network 记住该网络 - + Show Network List 显示网络列表 - + Cancel 取消 - + Join 加入 - + Required 必填 - - Find and Join Wi-Fi - 查找并加入Wi-Fi + + Find and Join WLAN + 查找并加入无线局域网络 LanListItem - + Not connected 未连接 - + Wired Device not carried 未插入网线 - - - + + + Disconnect 断开 - - - + + + Connect 连接 - - + + Property 属性 - - + + Delete 删除此网络 @@ -728,22 +796,26 @@ LanPage - No ethernet device avaliable - 未检测到有线设备 + 未检测到有线设备 - + LAN 有线网络 - + + conflict, unable to connect to the network normally! + 冲突,无法正常连接到网络! + + + Activated LAN 我的网络 - + Inactivated LAN 其他网络 @@ -752,7 +824,7 @@ 有线网络已断开 - + Wired Device not carried 未插入网线 @@ -760,16 +832,32 @@ LAN Connected Successfully 有线网络已连接 + + + + Connected: + 已连接: + + + + Not Connected + 未连接 + + + + (Limited) + (网络受限) + ListItem - + Kylin NM - 麒麟网络设置工具 + 网络设置工具 - + kylin network applet desktop message 网络提示消息 @@ -777,76 +865,98 @@ MainWindow - - + + kylin-nm 网络工具 - + LAN 有线网络 有线网络 - + WLAN 无线局域网 无线局域网 - + Show MainWindow 打开网络工具 - + Settings 设置网络项 设置网络项 + + Network tool - 网络工具 + 网络工具 + + + + Network Card + 网卡 + + + + Not connected to the network + 未连接网络 MultipleDnsWidget - - DNS server: - DNS服务器: + + DNS server(Drag to sort) + DNS 服务器高级配置 + + + + Click "+" to configure DNS + 点击 “+”配置 DNS + + + + Settings + 高级设置 NetDetail - + Kylin NM - 麒麟网络设置工具 + 网络设置工具 - + kylin network desktop message 网络提示消息 - + Detail 详情 - + IPv4 IPv4 - + IPv6 IPv6 - + Security 安全 @@ -855,64 +965,64 @@ 关闭 - - + + Config 配置 - + Confirm 确定 - + Cancel 取消 - + Forget this network 忘记此网络 - + Delete this network 删除此网络 - + Add LAN Connect 添加有线网络 - + Connect Hidden WLAN - 连接到隐藏WLAN + 连接到隐藏 WLAN - - - + + + None - - - + + + Auto 自动 - + start check ipv4 address conflict - 开始检测ipv4地址冲突 + 开始检测 ipv4 地址冲突 - + start check ipv6 address conflict - 开始检测ipv6地址冲突 + 开始检测 ipv6 地址冲突 ipv4 address conflict! @@ -923,24 +1033,24 @@ ipv6地址冲突! - + this wifi no support enterprise type - 此wifi不支持企业网类型 + 此 wifi 不支持企业网类型 - + this wifi no support None type - 此wifi不支持空类型 + 此 wifi 不支持空类型 - + this wifi no support WPA2 type - 此wifi不支持WPA2类型 + 此 wifi 不支持 WPA2 类型 - + this wifi no support WPA3 type - 此wifi不支持WPA3类型 + 此 wifi 不支持 WPA3 类型 SSID: @@ -997,7 +1107,7 @@ OneConnForm - + Form @@ -1025,7 +1135,7 @@ OneLancForm - + Form @@ -1049,213 +1159,214 @@ SecurityPage - + Remember the Network 记住该网络 - + Security 安全性 - - + + Password 密钥 - + EAP type - EAP方法 + EAP 方法 - + Identity 匿名身份 - + Domain - + CA certficate CA 证书 - + no need for CA certificate - 不需要CA证书 + 不需要 CA 证书 - + User certificate 用户证书 - + User private key 用户私钥 - + User key password 用户密钥密码 - + Password options 密码选项 - - - + + + Required 必填 - + Ineer authentication 内部认证 - + Username 用户名 - + Ask pwd each query 每次询问密码 - - - - - - - - - - - - + + + + + + + + + + + + + None - + WPA&WPA2 Personal WPA&WPA2 个人 - + WPA&WPA2 Enterprise WPA&WPA2 企业 - + WPA3 Personal WPA3 个人 - - - - + + + + Choose from file... 从文件选择... - - PAC provisioning - PAC配置 - - - - Allow automatic PAC provisioning - 允许自动PAC配置 - - - - PAC file - PAC文件 - - - - Anonymous - 匿名 - - - - Authenticated - 已认证 - - - - Both - 两者兼用 - - - + Store passwords only for this user 仅为该用户存储密码 - + Store password only for this user 仅为该用户存储密码 - + Store passwords for all users 存储所有用户的密码 - + Store password for all users 存储所有用户的密码 - + Ask this password every time 每次询问这个密码 - + Ask password every time 每次询问这个密码 - - - + + + Choose a CA certificate - 选择一个CA证书 + 选择一个 CA 证书 - - - + + + CA Files (*.pem *.der *.p12 *.crt *.cer *.pfx) CA 证书 (*.pem *.der *.p12 *.crt *.cer *.pfx) - + + PAC provisioning + PAC 配置 + + + + Allow automatic PAC provisioning + 允许自动 PAC 配置 + + + + PAC file + PAC 文件 + + + + Anonymous + 匿名 + + + + Authenticated + 已认证 + + + + Both + 两者兼用 + + + Choose a PAC file - 选择一个PAC文件 + 选择一个 PAC 文件 - + PAC Files (*.pac) - PAC 文件 (*.pac) + PAC 文件(*.pac) - + @@ -1263,27 +1374,27 @@ TabPage - + Current Device 当前网卡 - + Devices Closed! 设备关闭! - + Settings 网络设置 - + Kylin NM - 麒麟网络设置工具 + 网络设置工具 - + kylin network applet desktop message 网络提示消息 @@ -1295,88 +1406,45 @@ 未插入网线 - - WiFiConfigDialog - - - Dialog - - - - - WLAN Authentication - - - - - Input WLAN Information Please - - - - - WLAN ID: - - - - - WLAN Name: - - - - - Password: - - - - - Cancl - - - - - Ok - - - WlanListItem - + Not connected 未连接 - - - - - + + + + + Disconnect 断开 - - - - - + + + + + Connect 连接 - - + + Forget 忘记此网络 - - + + Property 属性 - + Auto Connect 自动加入该网络 @@ -1388,7 +1456,7 @@ 更多... - + Add Others... 加入其他网络... @@ -1396,22 +1464,22 @@ WlanPage - + WLAN 无线局域网 - + No wireless network card detected 未检测到无线网卡 - + Activated WLAN 我的网络 - + Other WLAN 其他网络 @@ -1420,15 +1488,29 @@ 更多... - + WLAN Connected Successfully 无线网络已连接 - + WLAN Disconnected Successfully 无线网络已断开 + + + Connected: + 已连接: + + + + Not Connected + 未连接 + + + (Limited) + (网络受限) + WpaWifiDialog @@ -1488,17 +1570,17 @@ main - + kylinnm - + show kylin-nm wifi page - + show kylin-nm lan page diff --git a/sys-dbus-register/conf/com.kylin.network.qt.systemdbus.conf b/sys-dbus-register/conf/com.kylin.network.qt.systemdbus.conf new file mode 100644 index 00000000..4a3e4887 --- /dev/null +++ b/sys-dbus-register/conf/com.kylin.network.qt.systemdbus.conf @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + diff --git a/sys-dbus-register/conf/com.kylin.network.qt.systemdbus.service b/sys-dbus-register/conf/com.kylin.network.qt.systemdbus.service new file mode 100644 index 00000000..297fe77c --- /dev/null +++ b/sys-dbus-register/conf/com.kylin.network.qt.systemdbus.service @@ -0,0 +1,4 @@ +[D-BUS Service] +Name=com.kylin.network.qt.systemdbus +Exec=/usr/bin/kylin-nm-sysdbus +User=root diff --git a/sys-dbus-register/kyarping/kyarping.pri b/sys-dbus-register/kyarping/kyarping.pri new file mode 100644 index 00000000..7d4372ca --- /dev/null +++ b/sys-dbus-register/kyarping/kyarping.pri @@ -0,0 +1,12 @@ +INCLUDEPATH += $$PWD + +HEADERS += \ + $$PWD/kylinarping.h \ + $$PWD/kylinipv4arping.h \ + $$PWD/kylinipv6arping.h \ + +SOURCES += \ + $$PWD/kylinipv4arping.cpp \ + $$PWD/kylinipv6arping.cpp \ + +DISTFILES += diff --git a/sys-dbus-register/kyarping/kylinarping.h b/sys-dbus-register/kyarping/kylinarping.h new file mode 100644 index 00000000..b1aa98be --- /dev/null +++ b/sys-dbus-register/kyarping/kylinarping.h @@ -0,0 +1,120 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * Copyright (C) 2022 Tianjin KYLIN Information Technology Co., Ltd. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ +#ifndef KYLINARPING_H +#define KYLINARPING_H + +#include +#include +#include + +static cap_flag_value_t cap_raw = CAP_CLEAR; +static const cap_value_t caps[] = { CAP_NET_RAW }; + +static void limit_capabilities() +{ + cap_t cap_p; + + cap_p = cap_get_proc(); + if (!cap_p) { + qWarning()<<"cap_get_proc failed."; + } + + cap_get_flag(cap_p, CAP_NET_RAW, CAP_PERMITTED, &cap_raw); + + if (cap_raw != CAP_CLEAR) { + if (cap_clear(cap_p) < 0) { + qWarning()<<"cap clear failed"< +#include +#include + +#define FINAL_PACKS 2 + +__attribute__((const)) static inline size_t sll_len(const size_t halen) +{ + struct sockaddr_ll unused; + const size_t len = offsetof(struct sockaddr_ll, sll_addr) + halen; + + if (len < sizeof(unused)) + return sizeof(unused); + + return len; +} + + +KyIpv4Arping::KyIpv4Arping(QString ifaceName, QString ipAddress, int retryCount, int timeout, QObject *parent) : QObject(parent) +{ + m_ifaceName = ifaceName; + m_ipv4Address = ipAddress; + m_retryCount = retryCount; + m_timeout = timeout; + + memset(&m_srcAddress, 0, sizeof(m_srcAddress)); +} + +KyIpv4Arping::~KyIpv4Arping() +{ + +} + +void KyIpv4Arping::monoGetTime (struct timespec *ts) +{ +#ifdef CLOCK_MONOTONIC + if (clock_gettime (CLOCK_MONOTONIC, ts)) +#endif + { + static long freq = 0; + if (freq == 0) + freq = sysconf (_SC_CLK_TCK); + + struct tms dummy; + clock_t t = times (&dummy); + ts->tv_sec = t / freq; + ts->tv_nsec = (t % freq) * (1000000000 / freq); + } +} + +void KyIpv4Arping::saveMacAddress(const uint8_t *ptr, size_t len) +{ + int index; + char macAddress[64] = {0}; + + for (index = 0; index < len; index++) { + snprintf(&macAddress[strlen(macAddress)], sizeof(macAddress) - strlen(macAddress), "%02X", ptr[index]); + if (index != len - 1) { + snprintf(&macAddress[strlen(macAddress)], sizeof(macAddress) - strlen(macAddress), "%s", ":"); + } + } + + m_conflictMac = QString(macAddress); + return ; +} + +void KyIpv4Arping::setConflictFlag(bool isConflict) +{ + m_ipConflict = isConflict; +} + +int KyIpv4Arping::sendIpv4Packet() +{ + int err; + unsigned char buf[256]; + struct arphdr *ah = (struct arphdr *)buf; + unsigned char *p = (unsigned char *)(ah + 1); + struct sockaddr_ll *p_me = (struct sockaddr_ll *)&(m_me); + struct sockaddr_ll *p_he = (struct sockaddr_ll *)&(m_he); + + ah->ar_hrd = htons(p_me->sll_hatype); + if (ah->ar_hrd == htons(ARPHRD_FDDI)) + ah->ar_hrd = htons(ARPHRD_ETHER); + ah->ar_pro = htons(ETH_P_IP); + ah->ar_hln = p_me->sll_halen; + ah->ar_pln = 4; + ah->ar_op = htons(ARPOP_REQUEST); + + memcpy(p, &p_me->sll_addr, ah->ar_hln); + p += p_me->sll_halen; + + qWarning()<<"[KyIpv4Arping]" <<"m_src address:" << inet_ntoa(m_srcAddress); + memcpy(p, &m_srcAddress, 4); + p += 4; + + memcpy(p, &p_he->sll_addr, ah->ar_hln); + p += ah->ar_hln; + + memcpy(p, &m_destAddress, 4); + p += 4; + + err = sendto(m_ipv4Socket, buf, p - buf, 0, (struct sockaddr *)p_he, sll_len(ah->ar_hln)); + + return err; +} + +int KyIpv4Arping::ipv4PacketProcess(unsigned char *buf, ssize_t len, struct sockaddr_ll *from) +{ + struct arphdr *ah = (struct arphdr *)buf; + unsigned char *p = (unsigned char *)(ah + 1); + struct in_addr src_ip, dst_ip; + + /* Filter out wild packets */ + if (from->sll_pkttype != PACKET_HOST && + from->sll_pkttype != PACKET_BROADCAST && + from->sll_pkttype != PACKET_MULTICAST) + return 0; + + /* Only these types are recognised */ + if (ah->ar_op != htons(ARPOP_REQUEST) && + ah->ar_op != htons(ARPOP_REPLY)) + return 0; + + /* ARPHRD check and this darned FDDI hack here :-( */ + if (ah->ar_hrd != htons(from->sll_hatype) && + (from->sll_hatype != ARPHRD_FDDI || ah->ar_hrd != htons(ARPHRD_ETHER))) + return 0; + + /* Protocol must be IP. */ + if (ah->ar_pro != htons(ETH_P_IP)) + return 0; + if (ah->ar_pln != 4) + return 0; + if (ah->ar_hln != ((struct sockaddr_ll *)&m_me)->sll_halen) + return 0; + + if (len < (ssize_t) sizeof(*ah) + 2 * (4 + ah->ar_hln)) + return 0; + + memcpy(&src_ip, p + ah->ar_hln, 4); + memcpy(&dst_ip, p + ah->ar_hln + 4 + ah->ar_hln, 4); + /* + * DAD packet was: + * src_ip = 0 (or some src) + * src_hw = ME + * dst_ip = tested address + * dst_hw = + * + * We fail, if receive request/reply with: + * src_ip = tested_address + * src_hw != ME + * if src_ip in request was not zero, check + * also that it matches to dst_ip, otherwise + * dst_ip/dst_hw do not matter. + */ + if (src_ip.s_addr != m_destAddress.s_addr) + return 0; + + if (memcmp(p, ((struct sockaddr_ll *)&m_me)->sll_addr, + ((struct sockaddr_ll *)&m_me)->sll_halen) == 0) + return 0; + + saveMacAddress(p, ah->ar_hln); + setConflictFlag(true); + + return FINAL_PACKS; +} + +int KyIpv4Arping::ipv4EventLoop() +{ + int rc = -1; + int ret; + int index; + int exit_loop = 0; + ssize_t bytes; + + int tfd; + struct pollfd pfds[POLLFD_COUNT]; + + struct itimerspec timerfd_vals; + timerfd_vals.it_interval.tv_sec = m_timeout, + timerfd_vals.it_interval.tv_nsec = 0, + timerfd_vals.it_value.tv_sec = m_timeout, + timerfd_vals.it_value.tv_nsec = 0; + + uint64_t exp; + uint64_t total_expires = 1; + + unsigned char packet[4096]; + struct sockaddr_storage from = { 0 }; + socklen_t addr_len = sizeof(from); + + /* timerfd */ + tfd = timerfd_create(CLOCK_MONOTONIC, 0); + if (tfd == -1) { + qWarning()<<"[KyIpv4Arping]" << "timerfd_create failed, errno" << errno; + return -1; + } + + if (timerfd_settime(tfd, 0, &timerfd_vals, NULL)) { + close(tfd); + qWarning()<<"[KyIpv4Arping]" << "timerfd_settime failed, errno" << errno; + return -1; + } + + pfds[POLLFD_TIMER].fd = tfd; + pfds[POLLFD_TIMER].events = POLLIN | POLLERR | POLLHUP; + + /* socket */ + pfds[POLLFD_SOCKET].fd = m_ipv4Socket; + pfds[POLLFD_SOCKET].events = POLLIN | POLLERR | POLLHUP; + sendIpv4Packet(); + + while (!exit_loop) { + ret = poll(pfds, POLLFD_COUNT, -1); + if (ret <= 0) { + if (errno == EAGAIN) { + continue; + } + + if (errno) { + qWarning()<<"[KyIpv4Arping]" <<"poll failed, errno" << errno; + } + + exit_loop = 1; + continue; + } + + for (index = 0; index < POLLFD_COUNT; index++) { + if (pfds[index].revents == 0) { + continue; + } + + switch (index) { + case POLLFD_TIMER: + bytes = read(tfd, &exp, sizeof(uint64_t)); + if (bytes != sizeof(uint64_t)) { + qWarning() <<"[KyIpv4Arping]" << "could not read timerfd"; + continue; + } + + total_expires += exp; + if (0 < m_retryCount && (uint64_t)m_retryCount < total_expires) { + exit_loop = 1; + rc = 0; + continue; + } + + sendIpv4Packet(); + break; + case POLLFD_SOCKET: + bytes = recvfrom(m_ipv4Socket, packet, sizeof(packet), 0, + (struct sockaddr *)&from, &addr_len); + if (bytes < 0) { + qWarning()<<"[KyIpv4Arping]" << "recvfrom function failed, errno" << errno; + continue; + } + if (ipv4PacketProcess(packet, bytes, (struct sockaddr_ll *)&from) == FINAL_PACKS) { + exit_loop = 1; + rc = 0; + } + break; + default: + qWarning()<<"[KyIpv4Arping]" <<"the fd index is undefine" << index; + break; + } + } + } + + close(tfd); + freeifaddrs(m_ifa0); + + return rc; +} + +int KyIpv4Arping::checkIfflags(unsigned int ifflags) +{ + if (!(ifflags & IFF_UP)) { + qWarning()<<"[KyIpv4Arping]" <<"the iface" << m_ifaceName <<" is down."; + return -1; + } + + if (ifflags & (IFF_NOARP | IFF_LOOPBACK)) { + qWarning()<<"[KyIpv4Arping]" << "Interface" << m_ifaceName << "is not ARPable."; + return -1; + } + + return 0; +} + + +int KyIpv4Arping::checkDevice() +{ + int rc; + struct ifaddrs *ifa; + int n = 0; + + rc = getifaddrs(&m_ifa0); + if (rc < 0) { + qWarning()<<"[KyIpv4Arping]" <<"get iface address failed, erron"<< errno; + return -errno; + } + + for (ifa = m_ifa0; ifa; ifa = ifa->ifa_next) { + if (!ifa->ifa_addr) { + continue; + } + + if (ifa->ifa_addr->sa_family != AF_PACKET) { + continue; + } + + if (!m_ifaceName.isEmpty() + && (NULL != ifa->ifa_name) + && strcmp(ifa->ifa_name, m_ifaceName.toUtf8())) { + continue; + } + + if (checkIfflags(ifa->ifa_flags) < 0) { + continue; + } + + if (!((struct sockaddr_ll *)ifa->ifa_addr)->sll_halen) { + continue; + } + + if (!ifa->ifa_broadaddr) { + continue; + } + + m_ifa = ifa; + + if (n++) + break; + } + + if (n == 1 && m_ifa) { + m_ifindex = if_nametoindex(m_ifa->ifa_name); + if (!m_ifindex) { + qWarning()<<"[KyIpv4Arping]" <<"if_nametoindex is invalid"; + freeifaddrs(m_ifa0); + return -1; + } + m_ifaceName = m_ifa->ifa_name; + + return 0; + } + + freeifaddrs(m_ifa0); + return -1; +} + +void KyIpv4Arping::findBroadcastAddress() +{ + struct sockaddr_ll *he = (struct sockaddr_ll *)&(m_he); + + if (m_ifa) { + struct sockaddr_ll *sll = + (struct sockaddr_ll *)m_ifa->ifa_broadaddr; + + if (sll->sll_halen == he->sll_halen) { + memcpy(he->sll_addr, sll->sll_addr, he->sll_halen); + return; + } + } + + qWarning()<<"[KyIpv4Arping]" <<"using default broadcast address."; + + memset(he->sll_addr, -1, he->sll_halen); + + return; +} + +int KyIpv4Arping::ipv4ConflictCheck() +{ + limit_capabilities(); + + int ret = checkDevice(); + if (ret < 0) { + qWarning()<<"[KyIpv4Arping]"<<"the device is invalid" << m_ifaceName; + return -1; + } + + enable_capability_raw(); + m_ipv4Socket = socket(PF_PACKET, SOCK_DGRAM, 0); + disable_capability_raw(); + if (m_ipv4Socket < 0) { + qWarning()<<"[KyIpv4Arping]" << "create ipv4 socket failed, errno" << errno; + return -1; + } + + inet_aton(m_ipv4Address.toUtf8(), &m_destAddress); + m_destAddressFamily = AF_INET; + + ((struct sockaddr_ll *)&m_me)->sll_family = AF_PACKET; + ((struct sockaddr_ll *)&m_me)->sll_ifindex = m_ifindex; + ((struct sockaddr_ll *)&m_me)->sll_protocol = htons(ETH_P_ARP); + + ret = bind(m_ipv4Socket, (struct sockaddr *)&m_me, sizeof(m_me)); + if (ret < 0) { + qWarning()<<"[KyIpv4Arping]" <<"ipv4 socket bind failed, errno"<< errno; + close(m_ipv4Socket); + return -1; + } + + socklen_t alen = sizeof(m_me); + ret = getsockname(m_ipv4Socket, (struct sockaddr *)&m_me, &alen); + if (ret < 0) { + qWarning()<<"[KyIpv4Arping]" <<"ipv4 get socket name failed, errno" << errno; + close(m_ipv4Socket); + return -1; + } + + if (((struct sockaddr_ll *)&m_me)->sll_halen == 0) { + qWarning()<<"[KyIpv4Arping]" <<"the iface"<< m_ifaceName <<" is not suitable for arp"; + close(m_ipv4Socket); + return -1; + } + + m_he = m_me; + + findBroadcastAddress(); + + drop_capabilities(); + + ret = ipv4EventLoop(); + close(m_ipv4Socket); + + return ret; +} diff --git a/sys-dbus-register/kyarping/kylinipv4arping.h b/sys-dbus-register/kyarping/kylinipv4arping.h new file mode 100644 index 00000000..9aa9cb91 --- /dev/null +++ b/sys-dbus-register/kyarping/kylinipv4arping.h @@ -0,0 +1,107 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * Copyright (C) 2022 Tianjin KYLIN Information Technology Co., Ltd. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ +#ifndef KYLIN_IPV4_ARPING +#define KYLIN_IPV4_ARPING + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "kylinarping.h" + +#include +#include +#include + +enum { + POLLFD_TIMER = 0, + POLLFD_SOCKET, + POLLFD_COUNT +}; + +class KyIpv4Arping : public QObject +{ + Q_OBJECT +public: + explicit KyIpv4Arping(QString ifaceName, QString ipAddress, int retryCount=3, int timeout=1, QObject *parent = nullptr); + ~KyIpv4Arping(); + +public: + bool ipv4IsConflict() { + return m_ipConflict; + } + + QString getMacAddress() { + return m_conflictMac; + } + + int ipv4ConflictCheck(); + +private: + void monoGetTime(struct timespec *ts); + void saveMacAddress(const uint8_t *ptr, size_t len); + void findBroadcastAddress(); + int checkDevice(); + int checkIfflags(unsigned int ifflags); + + int sendIpv4Packet(); + int ipv4EventLoop(); + int ipv4PacketProcess(unsigned char *buf, ssize_t len, struct sockaddr_ll *from); + + void setConflictFlag(bool isConflict); + +private: + struct in_addr m_srcAddress; + struct in_addr m_destAddress; + int m_destAddressFamily; + + struct sockaddr_storage m_me; + struct sockaddr_storage m_he; + int m_ipv4Socket = 0; + + QString m_ifaceName; + int m_ifindex; + struct ifaddrs *m_ifa; + struct ifaddrs *m_ifa0; + + QString m_ipv4Address; + int m_retryCount; + int m_timeout; + + bool m_ipConflict = false; + QString m_conflictMac = nullptr; +}; + +#endif diff --git a/sys-dbus-register/kyarping/kylinipv6arping.cpp b/sys-dbus-register/kyarping/kylinipv6arping.cpp new file mode 100644 index 00000000..a6969a6b --- /dev/null +++ b/sys-dbus-register/kyarping/kylinipv6arping.cpp @@ -0,0 +1,439 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * Copyright (C) 2022 Tianjin KYLIN Information Technology Co., Ltd. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ +#include "kylinipv6arping.h" + +#include +#include +#include +#include "kylinarping.h" + +KyIpv6Arping::KyIpv6Arping(QString ifaceName, QString ipAddress, int retryCount, int timeout, QObject *parent) : QObject(parent) +{ + m_ifaceName = ifaceName; + m_ipv6Address = ipAddress; + m_retryCount = retryCount; + m_timeoutMs = timeout; + + m_ipv6Conflict = false; +} + +KyIpv6Arping::~KyIpv6Arping() +{ + +} + +void KyIpv6Arping::monoGetTime (struct timespec *ts) +{ +#ifdef CLOCK_MONOTONIC + if (clock_gettime (CLOCK_MONOTONIC, ts)) +#endif + { + static long freq = 0; + if (freq == 0) + freq = sysconf (_SC_CLK_TCK); + + struct tms dummy; + clock_t t = times (&dummy); + ts->tv_sec = t / freq; + ts->tv_nsec = (t % freq) * (1000000000 / freq); + } +} + +int KyIpv6Arping::getLocalMacAddress(const char *ifname, unsigned char *addr) +{ +# ifdef SIOCGIFHWADDR + struct ifreq req; + memset (&req, 0, sizeof (req)); + + if (((unsigned)strlen (ifname)) >= (unsigned)IFNAMSIZ) { + return -1; /* buffer overflow = local root */ + } + + strcpy (req.ifr_name, ifname); + + int fd = socket (AF_INET6, SOCK_DGRAM, 0); + if (fd == -1) { + return -1; + } + + if (ioctl (fd, SIOCGIFHWADDR, &req)) { + qWarning()<<"[KyIpv6Arping]"<<"get local mac address failed, errno" << errno; + close (fd); + return -1; + } + close (fd); + + memcpy (addr, req.ifr_hwaddr.sa_data, 6); + return 0; +# else + /* No SIOCGIFHWADDR, which seems Linux specific. */ + struct ifaddrs *ifa = NULL; + struct ifaddrs *ifp = NULL; + getifaddrs(&ifa); + ifp = ifa; /* preserve the address of ifa to free memory later */ + while (ifp != NULL) { + if (ifp->ifa_addr->sa_family == AF_LINK && strcmp(ifp->ifa_name, ifname) == 0) { + const struct sockaddr_dl* sdl = (const struct sockaddr_dl*) ifp->ifa_addr; + memcpy(addr, sdl->sdl_data + sdl->sdl_nlen, 6); + freeifaddrs(ifa); + return 0; + } + ifp = ifp->ifa_next; + } + freeifaddrs(ifa); + return -1; +# endif +} + +int KyIpv6Arping::getIpv6ByName(struct sockaddr_in6 *addr) +{ + struct addrinfo hints, *res; + memset (&hints, 0, sizeof (hints)); + hints.ai_family = PF_INET6; + hints.ai_socktype = SOCK_DGRAM; /* dummy */ + hints.ai_flags = 0; + + int val = getaddrinfo (m_ipv6Address.toUtf8(), NULL, &hints, &res); + if (val) { + qWarning()<<"[KyIpv6Arping]" << m_ipv6Address <<"get addrinfo failed, errno" << val; + return -1; + } + + memcpy (addr, res->ai_addr, sizeof (struct sockaddr_in6)); + freeaddrinfo (res); + + val = if_nametoindex (m_ifaceName.toUtf8()); + if (val == 0) { + qWarning()<<"[KyIpv6Arping]" <<"if_nametoindex failed, errno" << errno; + return -1; + } + addr->sin6_scope_id = val; + + return 0; +} + +int KyIpv6Arping::buildSolicitationPacket(solicit_packet *ns, struct sockaddr_in6 *tgt, const char *ifname) +{ + /* builds ICMPv6 Neighbor Solicitation packet */ + ns->hdr.nd_ns_type = ND_NEIGHBOR_SOLICIT; + ns->hdr.nd_ns_code = 0; + ns->hdr.nd_ns_cksum = 0; /* computed by the kernel */ + ns->hdr.nd_ns_reserved = 0; + memcpy (&ns->hdr.nd_ns_target, &tgt->sin6_addr, 16); + + /* determines actual multicast destination address */ + memcpy (&tgt->sin6_addr.s6_addr, "\xff\x02\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x01\xff", 13); + + /* gets our own interface's link-layer address (MAC) */ + if (getLocalMacAddress (m_ifaceName.toUtf8().constData(), ns->hw_addr)) { + return sizeof (ns->hdr); + } + + ns->opt.nd_opt_type = ND_OPT_SOURCE_LINKADDR; + ns->opt.nd_opt_len = 1; /* 8 bytes */ + return sizeof (*ns); +} + +void KyIpv6Arping::saveMacAddress (const uint8_t *ptr, size_t len) +{ + int index; + char macAddress[64] = {0}; + + for (index = 0; index < len; index++) { + snprintf(&macAddress[strlen(macAddress)], sizeof(macAddress) - strlen(macAddress), "%02X", ptr[index]); + if (index != len - 1) { + snprintf(&macAddress[strlen(macAddress)], sizeof(macAddress) - strlen(macAddress), "%s", ":"); + } + } + + m_conflictMacAddress = QString(macAddress); + return ; +} + +int KyIpv6Arping::parseIpv6Packet(const uint8_t *buf, size_t len, const struct sockaddr_in6 *tgt) +{ + const struct nd_neighbor_advert *na = + (const struct nd_neighbor_advert *)buf; + const uint8_t *ptr; + + /* checks if the packet is a Neighbor Advertisement, and + * if the target IPv6 address is the right one */ + if ((len < sizeof (struct nd_neighbor_advert)) + || (na->nd_na_type != ND_NEIGHBOR_ADVERT) + || (na->nd_na_code != 0) + || memcmp (&na->nd_na_target, &tgt->sin6_addr, 16)) { + return -1; + } + len -= sizeof (struct nd_neighbor_advert); + + /* looks for Target Link-layer address option */ + ptr = buf + sizeof (struct nd_neighbor_advert); + + int index; + char macAddress[64] = {0}; + uint8_t hw_addr[6] = {0}; + getLocalMacAddress(m_ifaceName.toUtf8().constData(), hw_addr); + for (index = 0; index < 6; index++) { + snprintf(&macAddress[strlen(macAddress)], sizeof(macAddress) - strlen(macAddress), "%02X", hw_addr[index]); + if (index != 5) { + snprintf(&macAddress[strlen(macAddress)], sizeof(macAddress) - strlen(macAddress), "%s", ":"); + } + } + QString localAddr(macAddress); + + while (len >= 8) + { + uint16_t optlen; + + optlen = ((uint16_t)(ptr[1])) << 3; + if (optlen == 0) + break; /* invalid length */ + + if (len < optlen) /* length > remaining bytes */ + break; + len -= optlen; + + + /* skips unrecognized option */ + if (ptr[0] != ND_OPT_TARGET_LINKADDR) + { + ptr += optlen; + continue; + } + + /* Found! displays link-layer address */ + ptr += 2; + optlen -= 2; + + saveMacAddress (ptr, optlen); + if (!localAddr.isEmpty() && getConflictMacAddress() == localAddr) { + break; + } + setIpv6ConflictFlag(true); + return 0; + } + + return -1; +} + +int KyIpv6Arping::readIpv6Packet(void *buf, + size_t len, + int flags, + struct sockaddr_in6 *addr) +{ + char cbuf[CMSG_SPACE (sizeof (int))]; + + struct iovec iov = { + .iov_base = buf, + .iov_len = len + }; + + struct msghdr hdr = { + .msg_name = addr, + .msg_namelen = sizeof (*addr), + .msg_iov = &iov, + .msg_iovlen = 1, + .msg_control = cbuf, + .msg_controllen = sizeof (cbuf) + }; + + ssize_t val = recvmsg (m_ipv6Socket, &hdr, flags); + if (val == -1) { + return val; + } + + /* ensures the hop limit is 255 */ + for (struct cmsghdr *cmsg = CMSG_FIRSTHDR (&hdr); + cmsg != NULL; cmsg = CMSG_NXTHDR (&hdr, cmsg)) { + if ((cmsg->cmsg_level == IPPROTO_IPV6) + && (cmsg->cmsg_type == IPV6_HOPLIMIT)) { + if (255 != *(int *)CMSG_DATA (cmsg)) { + // pretend to be a spurious wake-up + errno = EAGAIN; + return -1; + } + } + } + + return val; +} + +int KyIpv6Arping::reciveAndProcessIpv6Packet(const struct sockaddr_in6 *tgt, unsigned wait_ms) +{ + struct timespec end; + struct pollfd fds; + + /* computes deadline time */ + monoGetTime (&end); + div_t d; + d = div (wait_ms, 1000); + end.tv_sec = end.tv_sec + d.quot; + end.tv_nsec = end.tv_nsec + (d.rem * 1000000); + + /* receive loop */ + for (;;) + { + /* waits for reply until deadline */ + struct timespec now; + int val = 0; + + monoGetTime (&now); + if (end.tv_sec >= now.tv_sec) { + val = (end.tv_sec - now.tv_sec) * 1000 + + (int)((end.tv_nsec - now.tv_nsec) / 1000000); + if (val < 0) { + val = 0; + } + } + + fds.fd = m_ipv6Socket; + fds.events = POLLIN; + val = poll (&fds, 1, val); + if (val < 0) + break; + + if (val == 0) + return 0; + + /* receives an ICMPv6 packet */ + // TODO: use interface MTU as buffer size + uint8_t buf[1460]; + struct sockaddr_in6 addr; + + val = readIpv6Packet(buf, sizeof (buf), MSG_DONTWAIT, &addr); + if (val < 0) { + if (errno != EAGAIN) + qWarning()<<"[KyIpv6Arping]"<<"Receiving ICMPv6 packet failed"; + continue; + } + + /* ensures the response came through the right interface */ + if (addr.sin6_scope_id + && (addr.sin6_scope_id != tgt->sin6_scope_id)) + continue; + + if (parseIpv6Packet(buf, val, tgt) == 0) { + return 1 /* = responses */; + } + } + + return -1; /* error */ +} + + +int KyIpv6Arping::ipv6ConflictCheck() +{ + struct sockaddr_in6 tgt; + struct icmp6_filter filter; + int retry = 0; + + limit_capabilities(); + + enable_capability_raw(); + m_ipv6Socket = socket (PF_INET6, SOCK_RAW, IPPROTO_ICMPV6); + disable_capability_raw(); + if (m_ipv6Socket < 0) { + qDebug()<<"[KyIpv6Arping]" <<"create ipv6 socket failed:"; + return -1; + } + + fcntl (m_ipv6Socket, F_SETFD, FD_CLOEXEC); + + /* set ICMPv6 filter */ + ICMP6_FILTER_SETBLOCKALL (&filter); + ICMP6_FILTER_SETPASS (ND_NEIGHBOR_ADVERT, &filter); + + enable_capability_raw(); + setsockopt (m_ipv6Socket, IPPROTO_ICMPV6, ICMP6_FILTER, &filter, sizeof (filter)); + + int soDontRoute = 1; + setsockopt (m_ipv6Socket, SOL_SOCKET, SO_DONTROUTE, &soDontRoute, sizeof(soDontRoute)); + + /* sets Hop-by-hop limit to 255 */ + int multicastHopLimit = 255; + setsockopt (m_ipv6Socket, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, + &multicastHopLimit, sizeof (multicastHopLimit)); + + int unicastHops = 255; + setsockopt (m_ipv6Socket, IPPROTO_IPV6, IPV6_UNICAST_HOPS, + &unicastHops, sizeof (unicastHops)); + + int recvHopLimit = 1; + setsockopt(m_ipv6Socket, IPPROTO_IPV6, IPV6_RECVHOPLIMIT, + &recvHopLimit, sizeof (recvHopLimit)); + + disable_capability_raw(); + + drop_capabilities(); + + /* resolves target's IPv6 address */ + int ret = getIpv6ByName(&tgt); + if (ret < 0) { + qWarning()<<"[KyIpv6Arping]"<<"get ipv6 by name failed."; + close (m_ipv6Socket); + return ret; + } + + solicit_packet packet; + struct sockaddr_in6 dst; + ssize_t plen; + + memcpy (&dst, &tgt, sizeof (dst)); + plen = buildSolicitationPacket(&packet, &dst, m_ifaceName.toUtf8().constData()); + if (plen == -1) { + qWarning()<<"[KyIpv6Arping]"<<"build solicit packet failed."; + close (m_ipv6Socket); + return -1; + } + + while (retry < m_retryCount) { + /* sends a Solitication */ + if (sendto (m_ipv6Socket, &packet, plen, MSG_DONTROUTE, + (const struct sockaddr *)&dst, + sizeof (dst)) != plen) { + qWarning()<<"[KyIpv6Arping]"<<"Sending ICMPv6 packet failed."; + close (m_ipv6Socket); + return -1; + } + + retry++; + + /* receives an Advertisement */ + ssize_t val = reciveAndProcessIpv6Packet(&tgt, m_timeoutMs); + if (val > 0) { + close (m_ipv6Socket); + return 0; + } else if (val == 0) { + continue; + } else { + close (m_ipv6Socket); + return -1; + } + } + + close(m_ipv6Socket); + + if (retry == m_retryCount) { + return 0; + } else { + return -2; + } +} diff --git a/sys-dbus-register/kyarping/kylinipv6arping.h b/sys-dbus-register/kyarping/kylinipv6arping.h new file mode 100644 index 00000000..faa08c25 --- /dev/null +++ b/sys-dbus-register/kyarping/kylinipv6arping.h @@ -0,0 +1,128 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * Copyright (C) 2022 Tianjin KYLIN Information Technology Co., Ltd. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ +#ifndef KYLINIPV6ARPING_H +#define KYLINIPV6ARPING_H + +//#include + +#include +#include +#include /* div() */ +#include /* uint8_t */ +#include /* UINT_MAX */ +#include +#include + +#include /* EMFILE */ +#include +#include /* close() */ +#include /* clock_gettime() */ +#include /* poll() */ +#include +#include +#include + +//#include "gettime.h" + +#ifdef HAVE_GETOPT_H +# include +#endif + +#include /* getaddrinfo() */ +#include /* inet_ntop() */ +#include /* if_nametoindex() */ + +#include +#include + +#ifndef IPV6_RECVHOPLIMIT +/* Using obsolete RFC 2292 instead of RFC 3542 */ +# define IPV6_RECVHOPLIMIT IPV6_HOPLIMIT +#endif + +/* BSD-like systems define ND_RA_FLAG_HA instead of ND_RA_FLAG_HOME_AGENT */ +#ifndef ND_RA_FLAG_HOME_AGENT +# ifdef ND_RA_FLAG_HA +# define ND_RA_FLAG_HOME_AGENT ND_RA_FLAG_HA +# endif +#endif + +#ifndef AI_IDN +# define AI_IDN 0 +#endif + + +#include +#include +#include + +typedef struct +{ + struct nd_neighbor_solicit hdr; + struct nd_opt_hdr opt; + uint8_t hw_addr[6]; +} solicit_packet; + +class KyIpv6Arping: public QObject +{ + Q_OBJECT +public: + explicit KyIpv6Arping(QString ifaceName, QString ipAddress, int retryCount=3, int timeout=1000, QObject *parent = nullptr); + ~KyIpv6Arping(); + +public: + bool ipv6IsConflict() { + return m_ipv6Conflict; + } + + void setIpv6ConflictFlag(bool conflict) { + m_ipv6Conflict = conflict; + } + + QString getConflictMacAddress() { + return m_conflictMacAddress; + } + + int ipv6ConflictCheck(); + +private: + void monoGetTime (struct timespec *ts); + void saveMacAddress (const uint8_t *ptr, size_t len); + int getLocalMacAddress(const char *ifname, unsigned char *addr); + + int getIpv6ByName(struct sockaddr_in6 *addr); + int buildSolicitationPacket(solicit_packet *ns, struct sockaddr_in6 *tgt, const char *ifname); + int parseIpv6Packet(const uint8_t *buf, size_t len, const struct sockaddr_in6 *tgt); + int readIpv6Packet(void *buf, size_t len, int flags, struct sockaddr_in6 *addr); + int reciveAndProcessIpv6Packet(const struct sockaddr_in6 *tgt, unsigned wait_ms); + +private: + int m_ipv6Socket = 0; + + QString m_ifaceName; + QString m_ipv6Address; + int m_retryCount; + int m_timeoutMs; + + bool m_ipv6Conflict = false; + QString m_conflictMacAddress = nullptr; +}; + +#endif // KYLINIPV6ARPING_H diff --git a/sys-dbus-register/kynmsystemdbus.cpp b/sys-dbus-register/kynmsystemdbus.cpp new file mode 100644 index 00000000..1057f1e5 --- /dev/null +++ b/sys-dbus-register/kynmsystemdbus.cpp @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2023, KylinSoft Co., Ltd. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +#include "kynmsystemdbus.h" +#include "kylinipv4arping.h" +#include "kylinipv6arping.h" + +#define LOG_FLAG "[KynmSystemDbus]" + +KynmSystemDbus::KynmSystemDbus(QObject *parent) : QObject(parent) +{ + +} + +KynmSystemDbus::~KynmSystemDbus() +{ + +} + +bool KynmSystemDbus::checkIpv4IsConflict(const QString devName, const QString ipv4Address, QStringList macList) +{ + bool isConflict = false; + KyIpv4Arping* ipv4Arping = new KyIpv4Arping(devName, ipv4Address); + if (ipv4Arping->ipv4ConflictCheck() >= 0) { + isConflict = ipv4Arping->ipv4IsConflict(); + if (isConflict && !macList.isEmpty()) { + QString macAddress = ipv4Arping->getMacAddress(); + for (const auto mac : macList) { + if (macAddress == mac) { + qDebug() << LOG_FLAG << "IPv4 conflict mac" << mac; + isConflict = false; + break; + } + } + } + } else { + qWarning() << LOG_FLAG << "checkIpv4Conflict internal error"; + } + + delete ipv4Arping; + ipv4Arping = nullptr; + + return isConflict; +} + +bool KynmSystemDbus::checkIpv6IsConflict(const QString devName, const QString ipv6Address) +{ + bool isConflict = false; + KyIpv6Arping* ipv6rping = new KyIpv6Arping(devName, ipv6Address); + if (ipv6rping->ipv6ConflictCheck() >= 0) { + isConflict = ipv6rping->ipv6IsConflict(); + } else { + qWarning() << LOG_FLAG << "checkIpv6Conflict internal error"; + } + + delete ipv6rping; + ipv6rping = nullptr; + + return isConflict; +} diff --git a/sys-dbus-register/kynmsystemdbus.h b/sys-dbus-register/kynmsystemdbus.h new file mode 100644 index 00000000..d786bdde --- /dev/null +++ b/sys-dbus-register/kynmsystemdbus.h @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2023, KylinSoft Co., Ltd. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +#ifndef KYNMSYSTEMDBUS_H +#define KYNMSYSTEMDBUS_H + +#include + +class KynmSystemDbus : public QObject +{ + Q_OBJECT + Q_CLASSINFO("D-Bus Interface", "com.kylin.network.interface") + +public: + explicit KynmSystemDbus(QObject *parent = nullptr); + ~KynmSystemDbus(); + +public Q_SLOTS: + Q_SCRIPTABLE bool checkIpv4IsConflict(const QString devName, const QString ipv4Address, QStringList macList); + Q_SCRIPTABLE bool checkIpv6IsConflict(const QString devName, const QString ipv6Address); +}; + +#endif // KYNMSYSTEMDBUS_H diff --git a/sys-dbus-register/main.cpp b/sys-dbus-register/main.cpp new file mode 100644 index 00000000..a725bee3 --- /dev/null +++ b/sys-dbus-register/main.cpp @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2023, KylinSoft Co., Ltd. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +#include "kynmsystemdbus.h" +#include +#include +#include +#include + +int main(int argc, char *argv[]){ + + QCoreApplication app(argc, argv); + + QDBusConnection systemBus = QDBusConnection::systemBus(); + if (!systemBus.registerService("com.kylin.network.qt.systemdbus")){ + qCritical() << "QDbus register service failed reason:" << systemBus.lastError(); + exit(1); + } + + if (!systemBus.registerObject("/", new KynmSystemDbus(), QDBusConnection::ExportAllSlots | QDBusConnection::ExportAllSignals)){ + qCritical() << "QDbus register object failed reason:" << systemBus.lastError(); + exit(2); + } + + return app.exec(); +} diff --git a/sys-dbus-register/sys-dbus-register.pro b/sys-dbus-register/sys-dbus-register.pro new file mode 100644 index 00000000..40d22c73 --- /dev/null +++ b/sys-dbus-register/sys-dbus-register.pro @@ -0,0 +1,31 @@ +QT += dbus network +TARGET = kylin-nm-sysdbus +TEMPLATE = app +CONFIG += c++14 qt warn_on link_pkgconfig no_keywords +CONFIG -= app_bundle + +TARGET = kylin-nm-sysdbus +TEMPLATE = app + +PKGCONFIG +=gio-2.0 glib-2.0 gio-unix-2.0 libcap + +inst1.files += conf/com.kylin.network.qt.systemdbus.service +inst1.path = /usr/share/dbus-1/system-services/ +inst2.files += conf/com.kylin.network.qt.systemdbus.conf +inst2.path = /etc/dbus-1/system.d/ +target.source += $$TARGET +target.path = /usr/bin + +INSTALLS += \ + target \ + inst1 \ + inst2 \ + +include(kyarping/kyarping.pri) + +SOURCES += \ + kynmsystemdbus.cpp \ + main.cpp + +HEADERS += \ + kynmsystemdbus.h