配合后端修改添加、删除黑名单接口
This commit is contained in:
parent
add1e54166
commit
41f3fb0d7f
File diff suppressed because it is too large
Load Diff
|
@ -1 +0,0 @@
|
||||||
9
|
|
|
@ -1,48 +0,0 @@
|
||||||
Source: kylin-nm
|
|
||||||
Section: utils
|
|
||||||
Priority: optional
|
|
||||||
Maintainer: Kylin Team <team+kylin@tracker.debian.org>
|
|
||||||
Uploaders: handsome_feng <jianfengli@ubuntukylin.com>
|
|
||||||
Build-Depends: debhelper (>=9),
|
|
||||||
qtbase5-dev,
|
|
||||||
qt5-qmake,
|
|
||||||
qtchooser,
|
|
||||||
qtscript5-dev,
|
|
||||||
qttools5-dev-tools,
|
|
||||||
qtbase5-dev-tools,
|
|
||||||
libqt5x11extras5-dev,
|
|
||||||
libgsettings-qt-dev,
|
|
||||||
libkf5windowsystem-dev,
|
|
||||||
libx11-dev,
|
|
||||||
libqt5svg5-dev,
|
|
||||||
libkf5networkmanagerqt-dev (>= 5.36.0),
|
|
||||||
libnm-dev,
|
|
||||||
libcap-dev,
|
|
||||||
libnma-dev,
|
|
||||||
libsecret-1-dev,
|
|
||||||
libgtk-3-dev,
|
|
||||||
libukcc-dev (>= 3.1.1+1217),
|
|
||||||
libukui-log4qt-dev,
|
|
||||||
libkysdk-qtwidgets-dev(>= 1.2.0),
|
|
||||||
libkysdk-sysinfo-dev,
|
|
||||||
libkysdk-waylandhelper-dev(>= 1.2.0kylin2),
|
|
||||||
libkysec-dev,
|
|
||||||
Standards-Version: 4.5.0
|
|
||||||
Rules-Requires-Root: no
|
|
||||||
Homepage: https://github.com/ukui/kylin-nm
|
|
||||||
Vcs-Git: https://github.com/ukui/kylin-nm.git
|
|
||||||
Vcs-Browser: https://github.com/ukui/kylin-nm
|
|
||||||
|
|
||||||
Package: kylin-nm
|
|
||||||
Architecture: any
|
|
||||||
Depends: network-manager (>= 1.22.10-1kylin29k3.6),
|
|
||||||
ukui-control-center (>= 3.1.1+1217),
|
|
||||||
libkysdk-qtwidgets(>= 1.2.0),
|
|
||||||
libkysdk-waylandhelper(>= 1.2.0kylin2),
|
|
||||||
libkysdk-sysinfo,
|
|
||||||
${shlibs:Depends},
|
|
||||||
${misc:Depends}
|
|
||||||
Description: Gui Applet tool for display and edit network simply
|
|
||||||
Kylin NM is a Applet tool for managing network settings simply.
|
|
||||||
It has beautiful UI and very comfortable to use.
|
|
||||||
It's better work together with UKUI.
|
|
|
@ -1,25 +0,0 @@
|
||||||
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
|
||||||
Upstream-Name: kylin-nm
|
|
||||||
Upstream-Contact: Kylin Team <ukui@kylinos.cn>
|
|
||||||
Source: https://github.com/ukui/kylin-nm
|
|
||||||
|
|
||||||
Files: *
|
|
||||||
Copyright: 2019, Tianjin KYLIN Information Technology Co., Ltd.
|
|
||||||
License: GPL-3+
|
|
||||||
|
|
||||||
License: GPL-3+
|
|
||||||
This package 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 package 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 Genaral Public License for more details.
|
|
||||||
.
|
|
||||||
You should have received a copy og the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
||||||
.
|
|
||||||
On Debian systems, the complete text of the GNU General
|
|
||||||
Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".
|
|
|
@ -1 +0,0 @@
|
||||||
man/kylin-nm.1
|
|
|
@ -1,14 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
PROGRAM=$(dpkg-divert --truename /usr/bin/kylin-nm)
|
|
||||||
|
|
||||||
if setcap cap_net_raw+ep $PROGRAM; then
|
|
||||||
chmod u-s $PROGRAM
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "kylin nm set cap success"
|
|
||||||
|
|
||||||
exit 0
|
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
path="/usr/lib/`/usr/bin/dpkg-architecture -qDEB_TARGET_MULTIARCH`/ukui-control-center/libnetconnect.so"
|
|
||||||
dpkg-divert --package kylin-nm --rename --divert "$path"".old" --add $path
|
|
||||||
|
|
||||||
path2="/usr/lib/`/usr/bin/dpkg-architecture -qDEB_TARGET_MULTIARCH`/ukui-control-center/libproxy.so"
|
|
||||||
dpkg-divert --package kylin-nm --rename --divert "$path2"".old" --add $path2
|
|
||||||
|
|
||||||
path3="/usr/lib/`/usr/bin/dpkg-architecture -qDEB_TARGET_MULTIARCH`/ukui-control-center/libvpn.so"
|
|
||||||
dpkg-divert --package kylin-nm --rename --divert "$path3"".old" --add $path3
|
|
|
@ -1,34 +0,0 @@
|
||||||
#!/usr/bin/make -f
|
|
||||||
|
|
||||||
export QT_SELECT=5
|
|
||||||
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
|
|
||||||
|
|
||||||
QMAKE_OPTS = DEFINES+=NO_DEBUG_ON_CONSOLE
|
|
||||||
MAKE_OPTS = PREFIX=/usr QMAKE=qmake LRELEASE=lrelease QMAKE_OPTS="$(QMAKE_OPTS)"
|
|
||||||
|
|
||||||
override_dh_auto_configure:
|
|
||||||
QT_SELECT=qt5 dh_auto_configure \
|
|
||||||
-- "QMAKE_CXXFLAGS=$(CFLAGS)" \
|
|
||||||
kylin-nm.pro
|
|
||||||
|
|
||||||
%:
|
|
||||||
dh $@
|
|
||||||
|
|
||||||
override_dh_install:
|
|
||||||
dh_install
|
|
||||||
|
|
||||||
override_dh_missing:
|
|
||||||
dh_missing --fail-missing
|
|
||||||
|
|
||||||
override_dh_auto_clean:
|
|
||||||
[ ! -d .moc ] || $(RM) -r .moc
|
|
||||||
[ ! -d .obj ] || $(RM) -r .obj
|
|
||||||
[ ! -d .ui ] || $(RM) -r .ui
|
|
||||||
[ ! -f Makefile ] || dh_auto_clean
|
|
||||||
|
|
||||||
override_dh_auto_build:
|
|
||||||
dh_auto_build -- $(MAKE_OPTS)
|
|
||||||
|
|
||||||
override_dh_shlibdeps:
|
|
||||||
dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
3.0 (native)
|
|
|
@ -1,2 +0,0 @@
|
||||||
version=4
|
|
||||||
https://github.com/ukui/kylin-nm/releases .*/kylin-nm_(\d\S+)\.orig\.tar\.gz
|
|
|
@ -37,7 +37,8 @@
|
||||||
|
|
||||||
BlacklistItem::BlacklistItem(QString staMac, QString staName, QWidget *parent) :
|
BlacklistItem::BlacklistItem(QString staMac, QString staName, QWidget *parent) :
|
||||||
QFrame(parent),
|
QFrame(parent),
|
||||||
m_mac(staMac)
|
m_mac(staMac),
|
||||||
|
m_hostName(staName)
|
||||||
{
|
{
|
||||||
this->setMinimumHeight(60);
|
this->setMinimumHeight(60);
|
||||||
this->setFixedHeight(60);
|
this->setFixedHeight(60);
|
||||||
|
@ -60,7 +61,7 @@ bool BlacklistItem::eventFilter(QObject *w, QEvent *e)
|
||||||
{
|
{
|
||||||
if (e->type() == QEvent::MouseButtonRelease) {
|
if (e->type() == QEvent::MouseButtonRelease) {
|
||||||
if (w == m_removeFromBlacklistBtn) {
|
if (w == m_removeFromBlacklistBtn) {
|
||||||
emit onBtnClicked(m_mac);
|
emit onBtnClicked(m_mac, m_hostName);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,10 +40,11 @@ protected:
|
||||||
KBorderlessButton *m_removeFromBlacklistBtn = nullptr;
|
KBorderlessButton *m_removeFromBlacklistBtn = nullptr;
|
||||||
|
|
||||||
QString m_mac;
|
QString m_mac;
|
||||||
|
QString m_hostName;
|
||||||
bool eventFilter(QObject *w, QEvent *e);
|
bool eventFilter(QObject *w, QEvent *e);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void onBtnClicked(QString blacklistMac);
|
void onBtnClicked(QString staMac, QString staName);
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -26,6 +26,8 @@
|
||||||
#define LINE_MAX_SIZE 16777215, 1
|
#define LINE_MAX_SIZE 16777215, 1
|
||||||
#define LINE_MIN_SIZE 0, 1
|
#define LINE_MIN_SIZE 0, 1
|
||||||
|
|
||||||
|
#define LOG_HEAD "[BlacklistPage]"
|
||||||
|
|
||||||
BlacklistPage::BlacklistPage(QWidget *parent) : QWidget(parent)
|
BlacklistPage::BlacklistPage(QWidget *parent) : QWidget(parent)
|
||||||
{
|
{
|
||||||
QVBoxLayout *Vlayout = new QVBoxLayout(this);
|
QVBoxLayout *Vlayout = new QVBoxLayout(this);
|
||||||
|
@ -64,23 +66,22 @@ QFrame* BlacklistPage::myLine()
|
||||||
void BlacklistPage::getBlacklistDevice(QMap<QString, QString> &blacklistMap)
|
void BlacklistPage::getBlacklistDevice(QMap<QString, QString> &blacklistMap)
|
||||||
{
|
{
|
||||||
if (m_settingPathInterface == nullptr || !m_settingPathInterface->isValid()) {
|
if (m_settingPathInterface == nullptr || !m_settingPathInterface->isValid()) {
|
||||||
qDebug() << "dbus interface m_settingPathInterface is invaild";
|
qDebug() << LOG_HEAD << "dbus interface m_settingPathInterface is invaild";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QDBusMessage reply = m_settingPathInterface->call("Getblacklist");
|
QDBusMessage reply = m_settingPathInterface->call("Getblacklist");
|
||||||
if(reply.type() == QDBusMessage::ErrorMessage)
|
if(reply.type() == QDBusMessage::ErrorMessage)
|
||||||
{
|
{
|
||||||
qWarning() << "[mobilehotspot]Getstainfo error:" << reply.errorMessage();
|
qWarning() << LOG_HEAD << "Getblacklist error:" << reply.errorMessage();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (reply.arguments().isEmpty()
|
if (reply.arguments().isEmpty()
|
||||||
|| reply.arguments().at(0).toString() == ""
|
|| reply.arguments().at(0).toString() == ""
|
||||||
|| reply.arguments().at(1).toString() == "") {
|
|| reply.arguments().at(1).toString() == "") {
|
||||||
qDebug() << "Dbus interface call Getblacklist return is empty!";
|
qDebug() << LOG_HEAD << "Dbus interface call Getblacklist return is empty!";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList macList = reply.arguments().at(0).toString().split(";");
|
QStringList macList = reply.arguments().at(0).toString().split(";");
|
||||||
QStringList hostNameList = reply.arguments().at(1).toString().split(";");
|
QStringList hostNameList = reply.arguments().at(1).toString().split(";");
|
||||||
for (int index = 0; index < macList.count() && macList.at(index) != nullptr; index ++) {
|
for (int index = 0; index < macList.count() && macList.at(index) != nullptr; index ++) {
|
||||||
|
@ -104,17 +105,17 @@ void BlacklistPage::initBlacklistDev()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BlacklistPage::onsetStaIntoBlacklist(QString staMac)
|
void BlacklistPage::onsetStaIntoBlacklist(QString staMac, QString staName)
|
||||||
{
|
{
|
||||||
if (m_settingPathInterface == nullptr || !m_settingPathInterface->isValid()) {
|
if (m_settingPathInterface == nullptr || !m_settingPathInterface->isValid()) {
|
||||||
qDebug() << "dbus interface m_settingPathInterface is invaild";
|
qDebug() << LOG_HEAD << LOG_HEAD << "dbus interface m_settingPathInterface is invaild";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QDBusMessage reply = m_settingPathInterface->call("Addblacklist", staMac);
|
QDBusMessage reply = m_settingPathInterface->call("Addblacklist", staMac, staName);
|
||||||
if(reply.type() == QDBusMessage::ErrorMessage)
|
if(reply.type() == QDBusMessage::ErrorMessage)
|
||||||
{
|
{
|
||||||
qWarning() << "[mobilehotspot]Getstainfo error:" << reply.errorMessage();
|
qWarning() << LOG_HEAD << "Addblacklist error:" << reply.errorMessage();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,17 +140,17 @@ void BlacklistPage::clearBlacklistLayout()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BlacklistPage::removeStaFromBlacklist(QString staMac)
|
bool BlacklistPage::removeStaFromBlacklist(QString staMac, QString staName)
|
||||||
{
|
{
|
||||||
if (m_settingPathInterface == nullptr || !m_settingPathInterface->isValid()) {
|
if (m_settingPathInterface == nullptr || !m_settingPathInterface->isValid()) {
|
||||||
qDebug() << "dbus interface m_settingPathInterface is invaild";
|
qDebug() << LOG_HEAD << "dbus interface m_settingPathInterface is invaild";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QDBusMessage reply = m_settingPathInterface->call("Delblacklist", staMac);
|
QDBusMessage reply = m_settingPathInterface->call("Delblacklist", staMac, staName);
|
||||||
if(reply.type() == QDBusMessage::ErrorMessage)
|
if(reply.type() == QDBusMessage::ErrorMessage)
|
||||||
{
|
{
|
||||||
qWarning() << "[mobilehotspot]Getstainfo error:" << reply.errorMessage();
|
qWarning() << LOG_HEAD << "Delblacklist error:" << reply.errorMessage();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,12 +185,16 @@ void BlacklistPage::refreshBlacklist()
|
||||||
resetLayoutHight();
|
resetLayoutHight();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BlacklistPage::onRemoveFromBlacklistBtnClicked(QString staMac)
|
void BlacklistPage::onRemoveFromBlacklistBtnClicked(QString staMac, QString staName)
|
||||||
{
|
{
|
||||||
if (staMac.isNull() || staMac.isEmpty()) {
|
if (staMac.isNull()
|
||||||
|
|| staMac.isEmpty()
|
||||||
|
|| staName.isNull()
|
||||||
|
|| staName.isEmpty()) {
|
||||||
|
qDebug() << LOG_HEAD <<"On remove from blacklist button clicked error! sta mac or name is empty!";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
removeStaFromBlacklist(staMac);
|
removeStaFromBlacklist(staMac, staName);
|
||||||
refreshBlacklist();
|
refreshBlacklist();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,15 +59,15 @@ private:
|
||||||
QDBusInterface *m_settingPathInterface = nullptr;
|
QDBusInterface *m_settingPathInterface = nullptr;
|
||||||
|
|
||||||
void getBlacklistDevice(QMap<QString, QString> &blacklistMap);
|
void getBlacklistDevice(QMap<QString, QString> &blacklistMap);
|
||||||
bool removeStaFromBlacklist(QString staMac);
|
bool removeStaFromBlacklist(QString staMac, QString staName);
|
||||||
void initBlacklistDev();
|
void initBlacklistDev();
|
||||||
void addBlacklistDevFrame(QString staMac, QString staName);
|
void addBlacklistDevFrame(QString staMac, QString staName);
|
||||||
void clearBlacklistLayout();
|
void clearBlacklistLayout();
|
||||||
void resetLayoutHight();
|
void resetLayoutHight();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onsetStaIntoBlacklist(QString staMac);
|
void onsetStaIntoBlacklist(QString staMac, QString staName);
|
||||||
void onRemoveFromBlacklistBtnClicked(QString staMac);
|
void onRemoveFromBlacklistBtnClicked(QString staMac, QString staName);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MOBILEHOTSPOTWIDGET_H
|
#endif // MOBILEHOTSPOTWIDGET_H
|
||||||
|
|
|
@ -37,7 +37,8 @@
|
||||||
|
|
||||||
ConnectDevListItem::ConnectDevListItem(QString staMac, QString staName, QWidget *parent) :
|
ConnectDevListItem::ConnectDevListItem(QString staMac, QString staName, QWidget *parent) :
|
||||||
QFrame(parent),
|
QFrame(parent),
|
||||||
m_mac(staMac)
|
m_mac(staMac),
|
||||||
|
m_hostName(staName)
|
||||||
{
|
{
|
||||||
this->setMinimumSize(FRAME_MIN_SIZE);
|
this->setMinimumSize(FRAME_MIN_SIZE);
|
||||||
this->setFixedHeight(60);
|
this->setFixedHeight(60);
|
||||||
|
@ -60,7 +61,7 @@ bool ConnectDevListItem::eventFilter(QObject *w, QEvent *e)
|
||||||
{
|
{
|
||||||
if (e->type() == QEvent::MouseButtonRelease) {
|
if (e->type() == QEvent::MouseButtonRelease) {
|
||||||
if (w == m_dragIntoBlackListBtn) {
|
if (w == m_dragIntoBlackListBtn) {
|
||||||
emit onBtnClicked(m_mac);
|
emit onBtnClicked(m_mac, m_hostName);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,10 +40,11 @@ protected:
|
||||||
KBorderlessButton *m_dragIntoBlackListBtn = nullptr;
|
KBorderlessButton *m_dragIntoBlackListBtn = nullptr;
|
||||||
|
|
||||||
QString m_mac;
|
QString m_mac;
|
||||||
|
QString m_hostName;
|
||||||
bool eventFilter(QObject *w, QEvent *e);
|
bool eventFilter(QObject *w, QEvent *e);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void onBtnClicked(QString staMac);
|
void onBtnClicked(QString staMac, QString staName);
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -26,6 +26,8 @@
|
||||||
#define LINE_MAX_SIZE 16777215, 1
|
#define LINE_MAX_SIZE 16777215, 1
|
||||||
#define LINE_MIN_SIZE 0, 1
|
#define LINE_MIN_SIZE 0, 1
|
||||||
|
|
||||||
|
#define LOG_HEAD "[ConnectdevPage]"
|
||||||
|
|
||||||
ConnectdevPage::ConnectdevPage(QWidget *parent) :
|
ConnectdevPage::ConnectdevPage(QWidget *parent) :
|
||||||
QWidget(parent)
|
QWidget(parent)
|
||||||
{
|
{
|
||||||
|
@ -66,14 +68,14 @@ void ConnectdevPage::getConnectStaDevice(QMap<QString, QString> &staMap)
|
||||||
{
|
{
|
||||||
staMap.clear();
|
staMap.clear();
|
||||||
if (m_activePathInterface == nullptr || !m_activePathInterface->isValid()) {
|
if (m_activePathInterface == nullptr || !m_activePathInterface->isValid()) {
|
||||||
qDebug() << "dbus interface m_activePathInterface is invaild";
|
qDebug() << LOG_HEAD << "dbus interface m_activePathInterface is invaild";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QDBusMessage reply = m_activePathInterface->call("Getstainfo");
|
QDBusMessage reply = m_activePathInterface->call("Getstainfo");
|
||||||
if(reply.type() == QDBusMessage::ErrorMessage)
|
if(reply.type() == QDBusMessage::ErrorMessage)
|
||||||
{
|
{
|
||||||
qWarning() << "[mobilehotspot]Getstainfo error:" << reply.errorMessage();
|
qWarning() << LOG_HEAD << "Getstainfo error:" << reply.errorMessage();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,7 +83,7 @@ void ConnectdevPage::getConnectStaDevice(QMap<QString, QString> &staMap)
|
||||||
|| reply.arguments().at(0).toString() == ""
|
|| reply.arguments().at(0).toString() == ""
|
||||||
|| reply.arguments().at(0).toString() == "[Invalid UTF-8]"
|
|| reply.arguments().at(0).toString() == "[Invalid UTF-8]"
|
||||||
|| reply.arguments().at(1).toString() == "") {
|
|| reply.arguments().at(1).toString() == "") {
|
||||||
qDebug() << "Dbus interface call Getstainfo return is empty!";
|
qDebug() << LOG_HEAD << "Dbus interface call Getstainfo return is empty!";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,11 +177,15 @@ void ConnectdevPage::refreshStalist()
|
||||||
resetLayoutHight();
|
resetLayoutHight();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConnectdevPage::onDropIntoBlacklistBtnClicked(QString staMac)
|
void ConnectdevPage::onDropIntoBlacklistBtnClicked(QString staMac, QString staName)
|
||||||
{
|
{
|
||||||
if (staMac.isNull() || staMac.isEmpty()) {
|
if (staMac.isNull()
|
||||||
|
|| staMac.isEmpty()
|
||||||
|
|| staName.isNull()
|
||||||
|
|| staName.isEmpty()) {
|
||||||
|
qDebug() << LOG_HEAD <<"On drop into blacklist button clicked error! sta mac or name is empty!";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
emit setStaIntoBlacklist(staMac);
|
emit setStaIntoBlacklist(staMac, staName);
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,14 +68,14 @@ private:
|
||||||
void resetLayoutHight();
|
void resetLayoutHight();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void setStaIntoBlacklist(QString staMac);
|
void setStaIntoBlacklist(QString staMac, QString staName);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void onStaDevAdded(bool istrue, QString staMac, QString staName);
|
void onStaDevAdded(bool istrue, QString staMac, QString staName);
|
||||||
void onStaDevRemoved(bool istrue, QString staMac, QString staName);
|
void onStaDevRemoved(bool istrue, QString staMac, QString staName);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onDropIntoBlacklistBtnClicked(QString staMac);
|
void onDropIntoBlacklistBtnClicked(QString staMac, QString staName);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MOBILEHOTSPOTWIDGET_H
|
#endif // MOBILEHOTSPOTWIDGET_H
|
||||||
|
|
|
@ -46,6 +46,8 @@
|
||||||
|
|
||||||
#define REFRESH_MSEC 20*1000
|
#define REFRESH_MSEC 20*1000
|
||||||
|
|
||||||
|
#define LOG_HEAD "[MobileHotspotWidget]"
|
||||||
|
|
||||||
const QByteArray GSETTINGS_SCHEMA = "org.ukui.kylin-nm.switch";
|
const QByteArray GSETTINGS_SCHEMA = "org.ukui.kylin-nm.switch";
|
||||||
const QString WIRELESS_SWITCH = "wirelessswitch";
|
const QString WIRELESS_SWITCH = "wirelessswitch";
|
||||||
|
|
||||||
|
@ -92,7 +94,7 @@ MobileHotspotWidget::MobileHotspotWidget(QWidget *parent) : QWidget(parent)
|
||||||
"com.kylin.network",
|
"com.kylin.network",
|
||||||
QDBusConnection::sessionBus());
|
QDBusConnection::sessionBus());
|
||||||
if(!m_interface->isValid()) {
|
if(!m_interface->isValid()) {
|
||||||
qDebug() << "dbus interface com.kylin.network is invaild";
|
qDebug() << LOG_HEAD << "dbus interface com.kylin.network is invaild";
|
||||||
m_switchBtn->setChecked(false);
|
m_switchBtn->setChecked(false);
|
||||||
setUiEnabled(false);
|
setUiEnabled(false);
|
||||||
}
|
}
|
||||||
|
@ -151,7 +153,7 @@ bool MobileHotspotWidget::eventFilter(QObject *watched, QEvent *event)
|
||||||
// showDesktopNotify(tr("start to close hotspot"));
|
// showDesktopNotify(tr("start to close hotspot"));
|
||||||
QDBusReply<void> reply = m_interface->call("deactiveWirelessAp", m_apNameLine->text(), m_uuid);
|
QDBusReply<void> reply = m_interface->call("deactiveWirelessAp", m_apNameLine->text(), m_uuid);
|
||||||
if (!reply.isValid()) {
|
if (!reply.isValid()) {
|
||||||
qDebug() << "[MobileHotspotWidget] call deactiveWirelessAp failed ";
|
qDebug() << LOG_HEAD << "call deactiveWirelessAp failed ";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#ifdef HOTSPOT_CONTROL
|
#ifdef HOTSPOT_CONTROL
|
||||||
|
@ -178,7 +180,7 @@ bool MobileHotspotWidget::eventFilter(QObject *watched, QEvent *event)
|
||||||
m_freqBandComboBox->currentText(),
|
m_freqBandComboBox->currentText(),
|
||||||
m_interfaceComboBox->currentText());
|
m_interfaceComboBox->currentText());
|
||||||
if (!reply.isValid()) {
|
if (!reply.isValid()) {
|
||||||
qDebug() << "[MobileHotspotWidget] call activeWirelessAp failed ";
|
qDebug() << LOG_HEAD << "call activeWirelessAp failed ";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -272,7 +274,7 @@ void MobileHotspotWidget::initDbusConnect()
|
||||||
|
|
||||||
connect(m_apNameLine, &QLineEdit::textEdited, this, &MobileHotspotWidget::onApLineEditTextEdit);
|
connect(m_apNameLine, &QLineEdit::textEdited, this, &MobileHotspotWidget::onApLineEditTextEdit);
|
||||||
#ifdef HOTSPOT_CONTROL
|
#ifdef HOTSPOT_CONTROL
|
||||||
connect(m_connectDevPage, SIGNAL(setStaIntoBlacklist(QString)), m_blacklistPage, SLOT(onsetStaIntoBlacklist(QString)));
|
connect(m_connectDevPage, SIGNAL(setStaIntoBlacklist(QString, QString)), m_blacklistPage, SLOT(onsetStaIntoBlacklist(QString, QString)));
|
||||||
#endif
|
#endif
|
||||||
connect(m_pwdNameLine, SIGNAL(textChanged(QString)), this, SLOT(onPwdTextChanged()));
|
connect(m_pwdNameLine, SIGNAL(textChanged(QString)), this, SLOT(onPwdTextChanged()));
|
||||||
}
|
}
|
||||||
|
@ -320,18 +322,6 @@ void MobileHotspotWidget::onGsettingChanged(const QString &key)
|
||||||
if (key == WIRELESS_SWITCH) {
|
if (key == WIRELESS_SWITCH) {
|
||||||
bool status = m_switchGsettings->get(WIRELESS_SWITCH).toBool();
|
bool status = m_switchGsettings->get(WIRELESS_SWITCH).toBool();
|
||||||
if (!status) {
|
if (!status) {
|
||||||
// if (m_switchBtn->isChecked()) {
|
|
||||||
// if(m_interface->isValid()) {
|
|
||||||
// QDBusReply<void> reply = m_interface->call("deactiveWirelessAp",
|
|
||||||
// m_apNameLine->text(),
|
|
||||||
// m_pwdNameLine->text(),
|
|
||||||
// m_interfaceComboBox->currentText());
|
|
||||||
// if (!reply.isValid()) {
|
|
||||||
// qDebug() << "[MobileHotspotWidget] call deactiveWirelessAp failed ";
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
m_switchBtn->setChecked(status);
|
m_switchBtn->setChecked(status);
|
||||||
m_uuid.clear();
|
m_uuid.clear();
|
||||||
m_switchBtn->setCheckable(false);
|
m_switchBtn->setCheckable(false);
|
||||||
|
@ -350,7 +340,7 @@ void MobileHotspotWidget::initInterfaceInfo()
|
||||||
QDBusReply<QMap<QString, bool> > reply = m_interface->call("getDeviceListAndEnabled",WIRELESS);
|
QDBusReply<QMap<QString, bool> > reply = m_interface->call("getDeviceListAndEnabled",WIRELESS);
|
||||||
|
|
||||||
if (!reply.isValid()) {
|
if (!reply.isValid()) {
|
||||||
qDebug()<<"execute dbus method 'getDeviceListAndEnabled' is invalid in func initInterfaceInfo()";
|
qDebug() << LOG_HEAD <<"execute dbus method 'getDeviceListAndEnabled' is invalid in func initInterfaceInfo()";
|
||||||
setWidgetHidden(true);
|
setWidgetHidden(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -358,7 +348,7 @@ void MobileHotspotWidget::initInterfaceInfo()
|
||||||
|
|
||||||
QDBusReply<QMap<QString, int> > capReply = m_interface->call("getWirelessDeviceCap");
|
QDBusReply<QMap<QString, int> > capReply = m_interface->call("getWirelessDeviceCap");
|
||||||
if (!capReply.isValid()) {
|
if (!capReply.isValid()) {
|
||||||
qDebug()<<"execute dbus method 'getWirelessDeviceCap' is invalid in func initInterfaceInfo()" <<capReply.error().type() ;
|
qDebug() << LOG_HEAD <<"execute dbus method 'getWirelessDeviceCap' is invalid in func initInterfaceInfo()" <<capReply.error().type() ;
|
||||||
setWidgetHidden(true);
|
setWidgetHidden(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -366,7 +356,7 @@ void MobileHotspotWidget::initInterfaceInfo()
|
||||||
|
|
||||||
|
|
||||||
if (devMap.isEmpty()) {
|
if (devMap.isEmpty()) {
|
||||||
qDebug() << "no wireless device";
|
qDebug() << LOG_HEAD << "no wireless device";
|
||||||
setWidgetHidden(true);
|
setWidgetHidden(true);
|
||||||
m_switchBtn->setCheckable(false);
|
m_switchBtn->setCheckable(false);
|
||||||
} else {
|
} else {
|
||||||
|
@ -385,7 +375,7 @@ void MobileHotspotWidget::initInterfaceInfo()
|
||||||
updateBandCombox();
|
updateBandCombox();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
qDebug() << "no useable wireless device";
|
qDebug() << LOG_HEAD << "no useable wireless device";
|
||||||
setWidgetHidden(true);
|
setWidgetHidden(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -400,20 +390,20 @@ void MobileHotspotWidget::getApInfo()
|
||||||
if (m_interfaceComboBox->count() <= 0) {
|
if (m_interfaceComboBox->count() <= 0) {
|
||||||
m_switchBtn->setChecked(false);
|
m_switchBtn->setChecked(false);
|
||||||
setWidgetHidden(true);
|
setWidgetHidden(true);
|
||||||
qWarning() << "getApInfo but interface is empty";
|
qWarning() << LOG_HEAD << "getApInfo but interface is empty";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QDBusReply<QStringList> reply = m_interface->call("getStoredApInfo");
|
QDBusReply<QStringList> reply = m_interface->call("getStoredApInfo");
|
||||||
if (!reply.isValid()) {
|
if (!reply.isValid()) {
|
||||||
qDebug()<<"execute dbus method 'getStoredApInfo' is invalid in func getObjectPath()";
|
qDebug() << LOG_HEAD <<"execute dbus method 'getStoredApInfo' is invalid in func getObjectPath()";
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList apInfo = reply.value();
|
QStringList apInfo = reply.value();
|
||||||
|
|
||||||
if (apInfo.isEmpty()) {
|
if (apInfo.isEmpty()) {
|
||||||
qDebug() << "no stored hotspot info";
|
qDebug() << LOG_HEAD << "no stored hotspot info";
|
||||||
m_apNameLine->setText(m_hostName);
|
m_apNameLine->setText(m_hostName);
|
||||||
m_pwdNameLine->setText("12345678");
|
m_pwdNameLine->setText("12345678");
|
||||||
return;
|
return;
|
||||||
|
@ -434,7 +424,7 @@ void MobileHotspotWidget::getApInfo()
|
||||||
m_uuid = apInfo.at(4);
|
m_uuid = apInfo.at(4);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
qDebug() << "no such interface " << apInfo.at(2);
|
qDebug() << LOG_HEAD << "no such interface " << apInfo.at(2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -625,7 +615,7 @@ void MobileHotspotWidget::onHotspotDeactivated(QString devName, QString ssid)
|
||||||
//热点连接
|
//热点连接
|
||||||
void MobileHotspotWidget::onHotspotActivated(QString devName, QString ssid, QString uuid, QString activePath, QString settingPath)
|
void MobileHotspotWidget::onHotspotActivated(QString devName, QString ssid, QString uuid, QString activePath, QString settingPath)
|
||||||
{
|
{
|
||||||
qDebug() << "onHotspotActivated" <<devName << ssid << uuid;
|
qDebug() << LOG_HEAD << "onHotspotActivated" <<devName << ssid << uuid;
|
||||||
if (m_switchBtn->isChecked()) {
|
if (m_switchBtn->isChecked()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue