Merge branch 'bug-194718' into 'yhkylin/v101-2303'
fix(display):多display显示适配 (#194718) See merge request kylinos-src/kylin-nm!279
This commit is contained in:
commit
b4298949bd
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QVariant>
|
||||||
|
|
||||||
MobileHotspot::MobileHotspot() : mFirstLoad(true) {
|
MobileHotspot::MobileHotspot() : mFirstLoad(true) {
|
||||||
|
|
||||||
|
@ -113,23 +113,31 @@ bool MobileHotspot::isExitWirelessDevice()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QDBusMessage result = interface->call(QStringLiteral("getDeviceListAndEnabled"),1);
|
QDBusReply<QVariantMap> reply = interface->call(QStringLiteral("getDeviceListAndEnabled"),1);
|
||||||
if(result.type() == QDBusMessage::ErrorMessage) {
|
if(!reply.isValid()) {
|
||||||
qWarning() << "getWirelessDeviceList error:" << result.errorMessage();
|
qWarning() << "getWirelessDeviceList error:" << reply.error().message();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto dbusArg = result.arguments().at(0).value<QDBusArgument>();
|
|
||||||
QMap<QString, bool> deviceListMap;
|
QMap<QString, bool> deviceListMap;
|
||||||
dbusArg >> deviceListMap;
|
QVariantMap::const_iterator itemIter = reply.value().cbegin();
|
||||||
|
while (itemIter != reply.value().cend()) {
|
||||||
|
deviceListMap.insert(itemIter.key(), itemIter.value().toBool());
|
||||||
|
itemIter ++;
|
||||||
|
}
|
||||||
|
|
||||||
QDBusReply<QMap<QString, int> > capReply = interface->call("getWirelessDeviceCap");
|
QDBusReply<QVariantMap> capReply = interface->call("getWirelessDeviceCap");
|
||||||
if (!capReply.isValid()) {
|
if (!capReply.isValid()) {
|
||||||
qDebug()<<"execute dbus method 'getWirelessDeviceCap' is invalid in func initInterfaceInfo()" <<capReply.error().type() ;
|
qDebug()<<"execute dbus method 'getWirelessDeviceCap' is invalid in func initInterfaceInfo()" <<capReply.error().type() ;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
QMap<QString, int> devCapMap = capReply.value();
|
|
||||||
|
|
||||||
|
QMap<QString, int> devCapMap;
|
||||||
|
QVariantMap::const_iterator item = reply.value().cbegin();
|
||||||
|
while (item != reply.value().cend()) {
|
||||||
|
devCapMap.insert(item.key(), item.value().toInt());
|
||||||
|
item ++;
|
||||||
|
}
|
||||||
|
|
||||||
if (deviceListMap.isEmpty()) {
|
if (deviceListMap.isEmpty()) {
|
||||||
qDebug() << "no wireless device";
|
qDebug() << "no wireless device";
|
||||||
|
|
|
@ -314,31 +314,26 @@ void MobileHotspotWidget::onInterfaceChanged()
|
||||||
{
|
{
|
||||||
m_interfaceName = m_interfaceComboBox->currentText();
|
m_interfaceName = m_interfaceComboBox->currentText();
|
||||||
if(m_interface->isValid()) {
|
if(m_interface->isValid()) {
|
||||||
QDBusMessage result = m_interface->call(QStringLiteral("getWirelessList"));
|
QDBusReply<QVariantList> reply = m_interface->call(QStringLiteral("getWirelessList"), m_interfaceName);
|
||||||
if(result.type() == QDBusMessage::ErrorMessage)
|
if(!reply.isValid())
|
||||||
{
|
{
|
||||||
qWarning() << "getWirelessList error:" << result.errorMessage();
|
qWarning() << "getWirelessList error:" << reply.error().message();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bool flag = false;
|
bool flag = false;
|
||||||
auto dbusArg = result.arguments().at(0).value<QDBusArgument>();
|
|
||||||
QMap<QString, QVector<QStringList>> variantList;
|
QList<QStringList> variantList;
|
||||||
dbusArg >> variantList;
|
for (int j = 0; j < reply.value().size(); ++j) {
|
||||||
if (variantList.size() != 0) {
|
variantList << reply.value().at(j).toStringList();
|
||||||
QMap<QString, QVector<QStringList>>::iterator iter;
|
|
||||||
for (iter = variantList.begin(); iter != variantList.end(); iter++) {
|
|
||||||
if (m_interfaceName == iter.key()) {
|
|
||||||
QVector<QStringList> wlanListInfo = iter.value();
|
|
||||||
if (!wlanListInfo.isEmpty() && wlanListInfo.at(0).size() > 1) {
|
|
||||||
flag = true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!variantList.isEmpty() && variantList.at(0).size() > 1) {
|
||||||
|
flag = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (flag) {
|
if (flag) {
|
||||||
m_interfaceWarnLabel->setText(tr("use ") + m_interfaceName +
|
m_interfaceWarnLabel->setText(tr("use ") + m_interfaceName +
|
||||||
tr(" share network, will interrupt local wireless connection"));
|
tr(" share network, will interrupt local wireless connection"));
|
||||||
m_interfaceFrame->setFixedHeight(PASSWORD_FRAME_FIX_HIGHT);
|
m_interfaceFrame->setFixedHeight(PASSWORD_FRAME_FIX_HIGHT);
|
||||||
m_warnWidget->show();
|
m_warnWidget->show();
|
||||||
} else {
|
} else {
|
||||||
|
@ -390,22 +385,32 @@ void MobileHotspotWidget::initInterfaceInfo()
|
||||||
m_interfaceComboBox->hidePopup();
|
m_interfaceComboBox->hidePopup();
|
||||||
}
|
}
|
||||||
m_interfaceComboBox->clear();
|
m_interfaceComboBox->clear();
|
||||||
QDBusReply<QMap<QString, bool> > reply = m_interface->call("getDeviceListAndEnabled",WIRELESS);
|
QDBusReply<QVariantMap> reply = m_interface->call(QStringLiteral("getDeviceListAndEnabled"),WIRELESS);
|
||||||
|
if(!reply.isValid()) {
|
||||||
if (!reply.isValid()) {
|
qWarning() << "[WlanConnect]getWirelessDeviceList error:" << reply.error().message();
|
||||||
qDebug() << LOG_HEAD <<"execute dbus method 'getDeviceListAndEnabled' is invalid in func initInterfaceInfo()";
|
|
||||||
setWidgetHidden(true);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QMap<QString, bool> devMap = reply.value();
|
|
||||||
|
|
||||||
QDBusReply<QMap<QString, int> > capReply = m_interface->call("getWirelessDeviceCap");
|
QMap<QString, bool> devMap;
|
||||||
|
QVariantMap::const_iterator item = reply.value().cbegin();
|
||||||
|
while (item != reply.value().cend()) {
|
||||||
|
devMap.insert(item.key(), item.value().toBool());
|
||||||
|
item ++;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QDBusReply<QVariantMap> capReply = m_interface->call("getWirelessDeviceCap");
|
||||||
if (!capReply.isValid()) {
|
if (!capReply.isValid()) {
|
||||||
qDebug() << LOG_HEAD <<"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;
|
||||||
}
|
}
|
||||||
QMap<QString, int> devCapMap = capReply.value();
|
QMap<QString, int> devCapMap;
|
||||||
|
QVariantMap::const_iterator itemIter = capReply.value().cbegin();
|
||||||
|
while (itemIter != capReply.value().cend()) {
|
||||||
|
devCapMap.insert(itemIter.key(), itemIter.value().toInt());
|
||||||
|
itemIter ++;
|
||||||
|
}
|
||||||
|
|
||||||
if (devMap.isEmpty()) {
|
if (devMap.isEmpty()) {
|
||||||
qDebug() << LOG_HEAD << "no wireless device";
|
qDebug() << LOG_HEAD << "no wireless device";
|
||||||
|
@ -824,14 +829,21 @@ void MobileHotspotWidget::updateBandCombox()
|
||||||
{
|
{
|
||||||
QString tmp = m_freqBandComboBox->currentText();
|
QString tmp = m_freqBandComboBox->currentText();
|
||||||
m_freqBandComboBox->clear();
|
m_freqBandComboBox->clear();
|
||||||
QDBusReply<QMap<QString, int> > capReply = m_interface->call("getWirelessDeviceCap");
|
QDBusReply<QVariantMap> capReply = m_interface->call("getWirelessDeviceCap");
|
||||||
if (!capReply.isValid()) {
|
if (!capReply.isValid()) {
|
||||||
qDebug()<<"execute dbus method 'getWirelessDeviceCap' is invalid in func initInterfaceInfo()" << capReply.error().message();
|
qDebug()<<"execute dbus method 'getWirelessDeviceCap' is invalid in func initInterfaceInfo()" << capReply.error().message();
|
||||||
setWidgetHidden(true);
|
setWidgetHidden(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_isUserSelect = false;
|
m_isUserSelect = false;
|
||||||
QMap<QString, int> devCapMap = capReply.value();
|
|
||||||
|
QMap<QString, int> devCapMap;
|
||||||
|
QVariantMap::const_iterator itemIter = capReply.value().cbegin();
|
||||||
|
while (itemIter != capReply.value().cend()) {
|
||||||
|
devCapMap.insert(itemIter.key(), itemIter.value().toInt());
|
||||||
|
itemIter ++;
|
||||||
|
}
|
||||||
|
|
||||||
if (devCapMap[m_interfaceName] & 0x02) {
|
if (devCapMap[m_interfaceName] & 0x02) {
|
||||||
m_freqBandComboBox->addItem("2.4GHz");
|
m_freqBandComboBox->addItem("2.4GHz");
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,6 +74,9 @@ void NetConnect::showDesktopNotify(const QString &message)
|
||||||
|
|
||||||
|
|
||||||
NetConnect::NetConnect() : mFirstLoad(true) {
|
NetConnect::NetConnect() : mFirstLoad(true) {
|
||||||
|
qDBusRegisterMetaType<QStringList>();
|
||||||
|
qDBusRegisterMetaType<QList<QStringList>>();
|
||||||
|
|
||||||
QTranslator* translator = new QTranslator(this);
|
QTranslator* translator = new QTranslator(this);
|
||||||
translator->load("/usr/share/kylin-nm/netconnect/" + QLocale::system().name());
|
translator->load("/usr/share/kylin-nm/netconnect/" + QLocale::system().name());
|
||||||
QApplication::installTranslator(translator);
|
QApplication::installTranslator(translator);
|
||||||
|
@ -107,7 +110,6 @@ QWidget *NetConnect::pluginUi() {
|
||||||
pluginWidget = new QWidget;
|
pluginWidget = new QWidget;
|
||||||
pluginWidget->setAttribute(Qt::WA_DeleteOnClose);
|
pluginWidget->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
ui->setupUi(pluginWidget);
|
ui->setupUi(pluginWidget);
|
||||||
qDBusRegisterMetaType<QVector<QStringList>>();
|
|
||||||
m_interface = new QDBusInterface("com.kylin.network",
|
m_interface = new QDBusInterface("com.kylin.network",
|
||||||
"/com/kylin/network",
|
"/com/kylin/network",
|
||||||
"com.kylin.network",
|
"com.kylin.network",
|
||||||
|
@ -249,16 +251,21 @@ void NetConnect::getDeviceStatusMap(QMap<QString, bool> &map)
|
||||||
if (m_interface == nullptr || !m_interface->isValid()) {
|
if (m_interface == nullptr || !m_interface->isValid()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
map.clear();
|
||||||
qDebug() << "[NetConnect]call getDeviceListAndEnabled" << __LINE__;
|
qDebug() << "[NetConnect]call getDeviceListAndEnabled" << __LINE__;
|
||||||
QDBusMessage result = m_interface->call(QStringLiteral("getDeviceListAndEnabled"),0);
|
QDBusReply<QVariantMap> reply = m_interface->call(QStringLiteral("getDeviceListAndEnabled"),0);
|
||||||
qDebug() << "[NetConnect]call getDeviceListAndEnabled Respond" << __LINE__;
|
qDebug() << "[NetConnect]call getDeviceListAndEnabled Respond" << __LINE__;
|
||||||
if(result.type() == QDBusMessage::ErrorMessage)
|
if(!reply.isValid())
|
||||||
{
|
{
|
||||||
qWarning() << "[NetConnect]getWiredDeviceList error:" << result.errorMessage();
|
qWarning() << "[NetConnect]getWiredDeviceList error:" << reply.error().message();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto dbusArg = result.arguments().at(0).value<QDBusArgument>();
|
|
||||||
dbusArg >> map;
|
QVariantMap::const_iterator item = reply.value().cbegin();
|
||||||
|
while (item != reply.value().cend()) {
|
||||||
|
map.insert(item.key(), item.value().toBool());
|
||||||
|
item ++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//lanUpdate
|
//lanUpdate
|
||||||
|
@ -390,26 +397,17 @@ void NetConnect::initNetListFromDevice(QString deviceName)
|
||||||
if (m_interface == nullptr || !m_interface->isValid()) {
|
if (m_interface == nullptr || !m_interface->isValid()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
qDebug() << "[NetConnect]call getWiredList" << __LINE__;
|
|
||||||
QDBusMessage result = m_interface->call(QStringLiteral("getWiredList"));
|
QMap<QString, QList<QStringList>> variantList = getWiredList();
|
||||||
qDebug() << "[NetConnect]call getWiredList respond" << __LINE__;
|
|
||||||
if(result.type() == QDBusMessage::ErrorMessage)
|
|
||||||
{
|
|
||||||
qWarning() << "getWiredList error:" << result.errorMessage();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
auto dbusArg = result.arguments().at(0).value<QDBusArgument>();
|
|
||||||
QMap<QString, QVector<QStringList>> variantList;
|
|
||||||
dbusArg >> variantList;
|
|
||||||
if (variantList.size() == 0) {
|
if (variantList.size() == 0) {
|
||||||
qDebug() << "[NetConnect]initNetListFromDevice " << deviceName << " list empty";
|
qDebug() << "[NetConnect]initNetListFromDevice " << deviceName << " list empty";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QMap<QString, QVector<QStringList>>::iterator iter;
|
|
||||||
|
|
||||||
|
QMap<QString, QList<QStringList>>::iterator iter;
|
||||||
for (iter = variantList.begin(); iter != variantList.end(); iter++) {
|
for (iter = variantList.begin(); iter != variantList.end(); iter++) {
|
||||||
if (deviceName == iter.key()) {
|
if (deviceName == iter.key()) {
|
||||||
QVector<QStringList> wlanListInfo = iter.value();
|
QList<QStringList> wlanListInfo = iter.value();
|
||||||
//处理列表 已连接
|
//处理列表 已连接
|
||||||
qDebug() << "[NetConnect]initNetListFromDevice " << deviceName << " acitved lan " << wlanListInfo.at(0);
|
qDebug() << "[NetConnect]initNetListFromDevice " << deviceName << " acitved lan " << wlanListInfo.at(0);
|
||||||
addLanItem(deviceFrameMap[deviceName], deviceName, wlanListInfo.at(0), true);
|
addLanItem(deviceFrameMap[deviceName], deviceName, wlanListInfo.at(0), true);
|
||||||
|
@ -486,22 +484,25 @@ void NetConnect::addDeviceFrame(QString devName)
|
||||||
qDebug() << "[NetConnect]addDeviceFrame " << devName;
|
qDebug() << "[NetConnect]addDeviceFrame " << devName;
|
||||||
|
|
||||||
qDebug() << "[NetConnect]call getDeviceListAndEnabled" << __LINE__;
|
qDebug() << "[NetConnect]call getDeviceListAndEnabled" << __LINE__;
|
||||||
QDBusMessage result = m_interface->call(QStringLiteral("getDeviceListAndEnabled"),0);
|
QDBusReply<QVariantMap> reply = m_interface->call(QStringLiteral("getDeviceListAndEnabled"),0);
|
||||||
qDebug() << "[NetConnect]call getDeviceListAndEnabled Respond" << __LINE__;
|
qDebug() << "[NetConnect]call getDeviceListAndEnabled Respond" << __LINE__;
|
||||||
if(result.type() == QDBusMessage::ErrorMessage)
|
if(!reply.isValid()) {
|
||||||
{
|
qWarning() << "[NetConnect]getWiredDeviceList error:" << reply.error().message();
|
||||||
qWarning() << "[NetConnect]getWiredDeviceList error:" << result.errorMessage();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto dbusArg = result.arguments().at(0).value<QDBusArgument>();
|
|
||||||
QMap<QString,bool> map;
|
QMap<QString,bool> map;
|
||||||
dbusArg >> map;
|
QVariantMap::const_iterator item = reply.value().cbegin();
|
||||||
|
while (item != reply.value().cend()) {
|
||||||
|
map.insert(item.key(), item.value().toBool());
|
||||||
|
item ++;
|
||||||
|
}
|
||||||
|
|
||||||
bool enable = true;
|
bool enable = true;
|
||||||
if (map.contains(devName)) {
|
if (map.contains(devName)) {
|
||||||
enable = map[devName];
|
enable = map[devName];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ItemFrame *itemFrame = new ItemFrame(devName, pluginWidget);
|
ItemFrame *itemFrame = new ItemFrame(devName, pluginWidget);
|
||||||
ui->availableLayout->addWidget(itemFrame);
|
ui->availableLayout->addWidget(itemFrame);
|
||||||
itemFrame->deviceFrame->deviceLabel->setText(tr("card")+/*QString("%1").arg(count)+*/":"+devName);
|
itemFrame->deviceFrame->deviceLabel->setText(tr("card")+/*QString("%1").arg(count)+*/":"+devName);
|
||||||
|
@ -887,17 +888,9 @@ int NetConnect::getInsertPos(QString connName, QString deviceName)
|
||||||
if(m_interface == nullptr || !m_interface->isValid()) {
|
if(m_interface == nullptr || !m_interface->isValid()) {
|
||||||
index = 0;
|
index = 0;
|
||||||
} else {
|
} else {
|
||||||
qDebug() << "[NetConnect]call getWiredList" << __LINE__;
|
|
||||||
QDBusMessage result = m_interface->call(QStringLiteral("getWiredList"));
|
QMap<QString, QList<QStringList>> variantList = getWiredList();
|
||||||
qDebug() << "[NetConnect]call getWiredList respond" << __LINE__;
|
|
||||||
if(result.type() == QDBusMessage::ErrorMessage)
|
|
||||||
{
|
|
||||||
qWarning() << "getWiredList error:" << result.errorMessage();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
auto dbusArg = result.arguments().at(0).value<QDBusArgument>();
|
|
||||||
QMap<QString, QVector<QStringList>> variantList;
|
|
||||||
dbusArg >> variantList;
|
|
||||||
if (!variantList.contains(deviceName)) {
|
if (!variantList.contains(deviceName)) {
|
||||||
qDebug() << "[NetConnect] getInsertPos but " << deviceName << "not exist";
|
qDebug() << "[NetConnect] getInsertPos but " << deviceName << "not exist";
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -915,3 +908,29 @@ int NetConnect::getInsertPos(QString connName, QString deviceName)
|
||||||
}
|
}
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QMap<QString, QList<QStringList>> NetConnect::getWiredList()
|
||||||
|
{
|
||||||
|
QMap<QString, QList<QStringList>> map;
|
||||||
|
|
||||||
|
QMap<QString, bool> statusMap;
|
||||||
|
getDeviceStatusMap(statusMap);
|
||||||
|
|
||||||
|
for (int i = 0; i < statusMap.keys().size(); ++i) {
|
||||||
|
qDebug() << "[NetConnect]call getWiredList" << __LINE__;
|
||||||
|
QDBusReply<QVariantList> reply = m_interface->call(QStringLiteral("getWiredList"), statusMap.keys().at(i));
|
||||||
|
qDebug() << "[NetConnect]call getWiredList respond" << __LINE__;
|
||||||
|
if(!reply.isValid())
|
||||||
|
{
|
||||||
|
qWarning() << "getWiredList error:" << reply.error().message();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<QStringList> list;
|
||||||
|
for (int j = 0; j < reply.value().size(); ++j) {
|
||||||
|
list << reply.value().at(j).toStringList();
|
||||||
|
}
|
||||||
|
map.insert(statusMap.keys().at(i), list);
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
|
@ -144,6 +144,8 @@ private:
|
||||||
QMap<QString, bool> deviceStatusMap;
|
QMap<QString, bool> deviceStatusMap;
|
||||||
QMap<QString, ItemFrame *> deviceFrameMap;
|
QMap<QString, ItemFrame *> deviceFrameMap;
|
||||||
|
|
||||||
|
QMap<QString, QList<QStringList>> getWiredList();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void updateLanInfo(QString deviceName, QStringList lanInfo);
|
void updateLanInfo(QString deviceName, QStringList lanInfo);
|
||||||
|
|
||||||
|
|
|
@ -167,6 +167,7 @@ QWidget *WlanConnect::pluginUi() {
|
||||||
pluginWidget->setAttribute(Qt::WA_DeleteOnClose);
|
pluginWidget->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
ui->setupUi(pluginWidget);
|
ui->setupUi(pluginWidget);
|
||||||
qDBusRegisterMetaType<QVector<QStringList>>();
|
qDBusRegisterMetaType<QVector<QStringList>>();
|
||||||
|
qDBusRegisterMetaType<QStringList>();
|
||||||
m_interface = new QDBusInterface("com.kylin.network", "/com/kylin/network",
|
m_interface = new QDBusInterface("com.kylin.network", "/com/kylin/network",
|
||||||
"com.kylin.network",
|
"com.kylin.network",
|
||||||
QDBusConnection::sessionBus());
|
QDBusConnection::sessionBus());
|
||||||
|
@ -317,28 +318,18 @@ void WlanConnect::updateList()
|
||||||
}
|
}
|
||||||
qDebug() << "update list";
|
qDebug() << "update list";
|
||||||
if(m_interface != nullptr && m_interface->isValid()) {
|
if(m_interface != nullptr && m_interface->isValid()) {
|
||||||
qDebug() << "[WlanConnect]call getWirelessList" << __LINE__;
|
QMap<QString, QList<QStringList>> variantList = getWirelessList();
|
||||||
QDBusMessage result = m_interface->call(QStringLiteral("getWirelessList"));
|
|
||||||
qDebug() << "[WlanConnect]call getWirelessList respond" << __LINE__;
|
|
||||||
if(result.type() == QDBusMessage::ErrorMessage)
|
|
||||||
{
|
|
||||||
qWarning() << "getWirelessList error:" << result.errorMessage();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
auto dbusArg = result.arguments().at(0).value<QDBusArgument>();
|
|
||||||
QMap<QString, QVector<QStringList>> variantList;
|
|
||||||
dbusArg >> variantList;
|
|
||||||
|
|
||||||
if (variantList.size() == 0) {
|
if (variantList.size() == 0) {
|
||||||
qDebug() << "[WlanConnect]updateList " << " list empty";
|
qDebug() << "[WlanConnect]updateList " << " list empty";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QMap<QString, QVector<QStringList>>::iterator iter;
|
QMap<QString, QList<QStringList>>::iterator iter;
|
||||||
|
|
||||||
for (iter = variantList.begin(); iter != variantList.end(); iter++) {
|
for (iter = variantList.begin(); iter != variantList.end(); iter++) {
|
||||||
if (deviceFrameMap.contains(iter.key())) {
|
if (deviceFrameMap.contains(iter.key())) {
|
||||||
QVector<QStringList> wifiList = iter.value();
|
QList<QStringList> wifiList = iter.value();
|
||||||
resortWifiList(deviceFrameMap[iter.key()], wifiList);
|
resortWifiList(deviceFrameMap[iter.key()], wifiList);
|
||||||
deviceFrameMap[iter.key()]->filletStyleChange();
|
deviceFrameMap[iter.key()]->filletStyleChange();
|
||||||
}
|
}
|
||||||
|
@ -346,7 +337,7 @@ void WlanConnect::updateList()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WlanConnect::resortWifiList(ItemFrame *frame, QVector<QStringList> list)
|
void WlanConnect::resortWifiList(ItemFrame *frame, QList<QStringList> list)
|
||||||
{
|
{
|
||||||
if(nullptr == frame || frame->lanItemLayout->count() <= 0 || list.isEmpty()) {
|
if(nullptr == frame || frame->lanItemLayout->count() <= 0 || list.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
|
@ -702,16 +693,20 @@ void WlanConnect::getDeviceList(QStringList &list)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
qDebug() << "[WlanConnect]call getDeviceListAndEnabled" << __LINE__;
|
qDebug() << "[WlanConnect]call getDeviceListAndEnabled" << __LINE__;
|
||||||
QDBusMessage result = m_interface->call(QStringLiteral("getDeviceListAndEnabled"),1);
|
QDBusReply<QVariantMap> reply = m_interface->call(QStringLiteral("getDeviceListAndEnabled"),1);
|
||||||
qDebug() << "[WlanConnect]call getDeviceListAndEnabled respond" << __LINE__;
|
qDebug() << "[WlanConnect]call getDeviceListAndEnabled respond" << __LINE__;
|
||||||
if(result.type() == QDBusMessage::ErrorMessage)
|
if(!reply.isValid())
|
||||||
{
|
{
|
||||||
qWarning() << "[WlanConnect]getWirelessDeviceList error:" << result.errorMessage();
|
qWarning() << "[WlanConnect]getWirelessDeviceList error:" << reply.error().message();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto dbusArg = result.arguments().at(0).value<QDBusArgument>();
|
|
||||||
QMap<QString,bool> map;
|
QMap<QString,bool> map;
|
||||||
dbusArg >> map;
|
QVariantMap::const_iterator item = reply.value().cbegin();
|
||||||
|
while (item != reply.value().cend()) {
|
||||||
|
map.insert(item.key(), item.value().toBool());
|
||||||
|
item ++;
|
||||||
|
}
|
||||||
|
|
||||||
//筛选已托管(managed)网卡
|
//筛选已托管(managed)网卡
|
||||||
QMap<QString, bool>::iterator iters;
|
QMap<QString, bool>::iterator iters;
|
||||||
|
@ -770,26 +765,20 @@ void WlanConnect::initNetListFromDevice(QString deviceName)
|
||||||
if (m_interface == nullptr || !m_interface->isValid()) {
|
if (m_interface == nullptr || !m_interface->isValid()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
qDebug() << "[WlanConnect]call getWirelessList" << __LINE__;
|
|
||||||
QDBusMessage result = m_interface->call(QStringLiteral("getWirelessList"));
|
QMap<QString, QList<QStringList>> variantList = getWirelessList();
|
||||||
qDebug() << "[WlanConnect]call getWirelessList respond" << __LINE__;
|
|
||||||
if(result.type() == QDBusMessage::ErrorMessage)
|
|
||||||
{
|
|
||||||
qWarning() << "getWirelessList error:" << result.errorMessage();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
auto dbusArg = result.arguments().at(0).value<QDBusArgument>();
|
|
||||||
QMap<QString, QVector<QStringList>> variantList;
|
|
||||||
dbusArg >> variantList;
|
|
||||||
if (variantList.size() == 0) {
|
if (variantList.size() == 0) {
|
||||||
qDebug() << "[WlanConnect]initNetListFromDevice " << deviceName << " list empty";
|
qDebug() << "[WlanConnect]initNetListFromDevice " << deviceName << " list empty";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QMap<QString, QVector<QStringList>>::iterator iter;
|
|
||||||
|
|
||||||
|
QMap<QString, QList<QStringList>>::iterator iter;
|
||||||
for (iter = variantList.begin(); iter != variantList.end(); iter++) {
|
for (iter = variantList.begin(); iter != variantList.end(); iter++) {
|
||||||
if (deviceName == iter.key()) {
|
if (deviceName == iter.key()) {
|
||||||
QVector<QStringList> wlanListInfo = iter.value();
|
QList<QStringList> wlanListInfo = iter.value();
|
||||||
|
if (wlanListInfo.size() <= 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
//处理列表 已连接
|
//处理列表 已连接
|
||||||
qDebug() << "[WlanConnect]initNetListFromDevice " << deviceName << " acitved wifi " << wlanListInfo.at(0);
|
qDebug() << "[WlanConnect]initNetListFromDevice " << deviceName << " acitved wifi " << wlanListInfo.at(0);
|
||||||
addActiveItem(deviceFrameMap[deviceName], deviceName, wlanListInfo.at(0));
|
addActiveItem(deviceFrameMap[deviceName], deviceName, wlanListInfo.at(0));
|
||||||
|
@ -903,21 +892,13 @@ int WlanConnect::sortWlanNet(QString deviceName, QString name, QString signal)
|
||||||
if (m_interface == nullptr || !m_interface->isValid()) {
|
if (m_interface == nullptr || !m_interface->isValid()) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
qDebug() << "[WlanConnect]call getWirelessList" << __LINE__;
|
|
||||||
QDBusMessage result = m_interface->call(QStringLiteral("getWirelessList"));
|
QMap<QString, QList<QStringList>> variantList = getWirelessList();
|
||||||
qDebug() << "[WlanConnect]call getWirelessList respond" << __LINE__;
|
|
||||||
if(result.type() == QDBusMessage::ErrorMessage)
|
QMap<QString, QList<QStringList>>::iterator iter;
|
||||||
{
|
|
||||||
qWarning() << "getWirelessList error:" << result.errorMessage();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
auto dbusArg = result.arguments().at(0).value<QDBusArgument>();
|
|
||||||
QMap<QString, QVector<QStringList>> variantList;
|
|
||||||
dbusArg >> variantList;
|
|
||||||
QMap<QString, QVector<QStringList>>::iterator iter;
|
|
||||||
for (iter = variantList.begin(); iter != variantList.end(); iter++) {
|
for (iter = variantList.begin(); iter != variantList.end(); iter++) {
|
||||||
if (deviceName == iter.key()) {
|
if (deviceName == iter.key()) {
|
||||||
QVector<QStringList> wlanListInfo = iter.value();
|
QList<QStringList> wlanListInfo = iter.value();
|
||||||
for (int i = 0; i < wlanListInfo.size(); i++) {
|
for (int i = 0; i < wlanListInfo.size(); i++) {
|
||||||
if (name == wlanListInfo.at(i).at(0)) {
|
if (name == wlanListInfo.at(i).at(0)) {
|
||||||
return i;
|
return i;
|
||||||
|
@ -1127,3 +1108,28 @@ void WlanConnect::itemActiveConnectionStatusChanged(WlanItem *item, int status)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QMap<QString, QList<QStringList>> WlanConnect::getWirelessList()
|
||||||
|
{
|
||||||
|
QMap<QString, QList<QStringList>> map;
|
||||||
|
QStringList list;
|
||||||
|
getDeviceList(list);
|
||||||
|
|
||||||
|
for (int i = 0; i < list.size(); ++i) {
|
||||||
|
qDebug() << "[NetConnect]call getWirelessList" << __LINE__;
|
||||||
|
QDBusReply<QVariantList> reply = m_interface->call(QStringLiteral("getWirelessList"), list.at(i));
|
||||||
|
qDebug() << "[NetConnect]call getWirelessList respond" << __LINE__;
|
||||||
|
if(!reply.isValid())
|
||||||
|
{
|
||||||
|
qWarning() << "getWirelessList error:" << reply.error().message();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<QStringList> llist;
|
||||||
|
for (int j = 0; j < reply.value().size(); ++j) {
|
||||||
|
llist << reply.value().at(j).toStringList();
|
||||||
|
}
|
||||||
|
map.insert(list.at(i), llist);
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -91,7 +91,7 @@ private:
|
||||||
|
|
||||||
int sortWlanNet(QString deviceName, QString name, QString signal);
|
int sortWlanNet(QString deviceName, QString name, QString signal);
|
||||||
void updateIcon(WlanItem *item, QString signalStrength, QString security, QString isApConnection, int category);
|
void updateIcon(WlanItem *item, QString signalStrength, QString security, QString isApConnection, int category);
|
||||||
void resortWifiList(ItemFrame *frame, QVector<QStringList> list);
|
void resortWifiList(ItemFrame *frame, QList<QStringList> list);
|
||||||
|
|
||||||
|
|
||||||
//单wifi图标
|
//单wifi图标
|
||||||
|
@ -174,6 +174,8 @@ private:
|
||||||
|
|
||||||
QTimer * m_scanTimer = nullptr;
|
QTimer * m_scanTimer = nullptr;
|
||||||
// QTimer * m_updateTimer = nullptr;
|
// QTimer * m_updateTimer = nullptr;
|
||||||
|
|
||||||
|
QMap<QString, QList<QStringList>> getWirelessList();
|
||||||
private:
|
private:
|
||||||
KSwitchButton *m_wifiSwitch;
|
KSwitchButton *m_wifiSwitch;
|
||||||
bool m_firstLoad;
|
bool m_firstLoad;
|
||||||
|
|
|
@ -3,13 +3,17 @@ include(hotspot/hotspot.pri)
|
||||||
include(dbus-interface/dbus-interface.pri)
|
include(dbus-interface/dbus-interface.pri)
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
$$PWD/dbusadaptor.h \
|
$$PWD/dbus.h \
|
||||||
|
$$PWD/dbus_adaptor.h \
|
||||||
|
$$PWD/dbus_interface.h \
|
||||||
$$PWD/sysdbusregister.h \
|
$$PWD/sysdbusregister.h \
|
||||||
$$PWD/utils.h \
|
$$PWD/utils.h \
|
||||||
$$PWD/wifi-auth-thread.h
|
$$PWD/wifi-auth-thread.h
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
$$PWD/dbusadaptor.cpp \
|
$$PWD/dbus.cpp \
|
||||||
|
$$PWD/dbus_adaptor.cpp \
|
||||||
|
$$PWD/dbus_interface.cpp \
|
||||||
$$PWD/sysdbusregister.cpp \
|
$$PWD/sysdbusregister.cpp \
|
||||||
$$PWD/utils.cpp \
|
$$PWD/utils.cpp \
|
||||||
$$PWD/wifi-auth-thread.cpp
|
$$PWD/wifi-auth-thread.cpp
|
||||||
|
|
|
@ -0,0 +1,419 @@
|
||||||
|
/*
|
||||||
|
* This file was generated by qdbusxml2cpp version 0.8
|
||||||
|
* Command line was: qdbusxml2cpp com.kylin.weather.xml -a dbusadaptor -c DbusAdaptor -l MainWindow
|
||||||
|
*
|
||||||
|
* qdbusxml2cpp is Copyright (C) 2015 The Qt Company Ltd.
|
||||||
|
*
|
||||||
|
* This is an auto-generated file.
|
||||||
|
* Do not edit! All changes made to it will be lost.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "dbus.h"
|
||||||
|
#include <QtCore/QMetaObject>
|
||||||
|
#include <QtCore/QByteArray>
|
||||||
|
#include <QtCore/QList>
|
||||||
|
#include <QtCore/QMap>
|
||||||
|
#include <QtCore/QString>
|
||||||
|
#include <QtCore/QStringList>
|
||||||
|
#include <QtCore/QVariant>
|
||||||
|
|
||||||
|
const QByteArray GSETTINGS_SCHEMA_KYLIN_NM = "org.ukui.kylin-nm.switch";
|
||||||
|
const QString KEY_WIRELESS_SWITCH = "wirelessswitch";
|
||||||
|
const QString KEY_WIRED_SWITCH = "wiredswitch";
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Implementation of adaptor class DbusAdaptor
|
||||||
|
*/
|
||||||
|
|
||||||
|
DbusAdaptor::DbusAdaptor(QString display, MainWindow *m, QObject *parent)
|
||||||
|
: QObject(parent),
|
||||||
|
m_display(display),
|
||||||
|
m_mainWindow(m)
|
||||||
|
{
|
||||||
|
// constructor
|
||||||
|
qDBusRegisterMetaType<QMap<QString, bool> >();
|
||||||
|
qDBusRegisterMetaType<QMap<QString, int> >();
|
||||||
|
qDBusRegisterMetaType<QList<QStringList> >();
|
||||||
|
qDBusRegisterMetaType<QMap<QString, QList<QStringList> >>();
|
||||||
|
|
||||||
|
bool isServiceRegistered = QDBusConnection::sessionBus().interface()->isServiceRegistered(QStringLiteral("com.kylin.network"));
|
||||||
|
if(!isServiceRegistered) {
|
||||||
|
registerService();
|
||||||
|
}
|
||||||
|
|
||||||
|
m_watcher = new QDBusServiceWatcher(QStringLiteral("com.kylin.network"),QDBusConnection::sessionBus(), QDBusServiceWatcher::WatchForOwnerChange, this);
|
||||||
|
connect(m_watcher, &QDBusServiceWatcher::serviceOwnerChanged, this, &DbusAdaptor::onServiceOwnerChanged);
|
||||||
|
|
||||||
|
connectToMainwindow();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DbusAdaptor::onServiceOwnerChanged(const QString &service, const QString &oldOwner, const QString &newOwner)
|
||||||
|
{
|
||||||
|
if (newOwner.isEmpty()) {
|
||||||
|
bool success = registerService();
|
||||||
|
if (success) {
|
||||||
|
m_watcher->deleteLater();
|
||||||
|
}
|
||||||
|
qDebug() << "try to register service:" << success;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint newOwnerPid = QDBusConnection::sessionBus().interface()->servicePid(newOwner);
|
||||||
|
qDebug() << "newOwnerPid:" << newOwnerPid << ", myPid:" << QCoreApplication::applicationPid() << ", display:" << m_display;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DbusAdaptor::registerService()
|
||||||
|
{
|
||||||
|
new NetworkAdaptor(this);
|
||||||
|
|
||||||
|
QDBusConnection conn = QDBusConnection::sessionBus();
|
||||||
|
auto reply = conn.interface()->registerService(QStringLiteral("com.kylin.network"),
|
||||||
|
QDBusConnectionInterface::ReplaceExistingService,
|
||||||
|
QDBusConnectionInterface::DontAllowReplacement);
|
||||||
|
if (reply.value() == QDBusConnectionInterface::ServiceNotRegistered) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool res = QDBusConnection::sessionBus().registerObject("/com/kylin/network", this);
|
||||||
|
if (!res) {
|
||||||
|
QDBusConnection::sessionBus().interface()->unregisterService(QStringLiteral("com.kylin.network"));
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//无线列表
|
||||||
|
QVariantList DbusAdaptor::getWirelessList(QString devName)
|
||||||
|
{
|
||||||
|
QList<QStringList> list;
|
||||||
|
m_mainWindow->getWirelessList(devName, list);
|
||||||
|
QVariantList vList;
|
||||||
|
for (int i = 0; i < list.size(); ++i) {
|
||||||
|
vList.append(QVariant::fromValue(list.at(i)));
|
||||||
|
}
|
||||||
|
return vList;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DbusAdaptor::getWirelessSwitchBtnState()
|
||||||
|
{
|
||||||
|
return m_mainWindow->getWirelessSwitchBtnState();
|
||||||
|
}
|
||||||
|
|
||||||
|
//有线列表
|
||||||
|
QVariantList DbusAdaptor::getWiredList(QString devName)
|
||||||
|
{
|
||||||
|
QList<QStringList> list;
|
||||||
|
m_mainWindow->getWiredList(devName, list);
|
||||||
|
QVariantList vList;
|
||||||
|
for (int i = 0; i < list.size(); ++i) {
|
||||||
|
vList.append(QVariant::fromValue(list.at(i)));
|
||||||
|
}
|
||||||
|
return vList;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//有线开关
|
||||||
|
void DbusAdaptor::setWiredSwitchEnable(bool enable)
|
||||||
|
{
|
||||||
|
//todo mainwindow调用backend 对开关 打开/关闭
|
||||||
|
if (QGSettings::isSchemaInstalled(GSETTINGS_SCHEMA_KYLIN_NM)) {
|
||||||
|
QGSettings *gsetting = new QGSettings(GSETTINGS_SCHEMA_KYLIN_NM);
|
||||||
|
if (gsetting->get(KEY_WIRED_SWITCH).toBool() != enable) {
|
||||||
|
gsetting->set(KEY_WIRED_SWITCH, enable);
|
||||||
|
}
|
||||||
|
delete gsetting;
|
||||||
|
gsetting = nullptr;
|
||||||
|
} else {
|
||||||
|
qDebug()<<"isSchemaInstalled false";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//无线开关
|
||||||
|
void DbusAdaptor::setWirelessSwitchEnable(bool enable)
|
||||||
|
{
|
||||||
|
//todo mainwindow调用backend 对开关 打开/关闭
|
||||||
|
// if (QGSettings::isSchemaInstalled(GSETTINGS_SCHEMA_KYLIN_NM)) {
|
||||||
|
// QGSettings *gsetting = new QGSettings(GSETTINGS_SCHEMA_KYLIN_NM);
|
||||||
|
// if (gsetting->get(KEY_WIRELESS_SWITCH).toBool() != enable) {
|
||||||
|
// gsetting->set(KEY_WIRELESS_SWITCH, enable);
|
||||||
|
// }
|
||||||
|
// delete gsetting;
|
||||||
|
// gsetting = nullptr;
|
||||||
|
// } else {
|
||||||
|
// qDebug()<<"isSchemaInstalled false";
|
||||||
|
// }
|
||||||
|
m_mainWindow->setWirelessSwitchEnable(enable);
|
||||||
|
}
|
||||||
|
|
||||||
|
//启用/禁用网卡
|
||||||
|
void DbusAdaptor::setDeviceEnable(QString devName, bool enable)
|
||||||
|
{
|
||||||
|
m_mainWindow->setWiredDeviceEnable(devName, enable);
|
||||||
|
}
|
||||||
|
|
||||||
|
//设置默认网卡
|
||||||
|
//void DbusAdaptor::setDefaultWiredDevice(QString deviceName)
|
||||||
|
//{
|
||||||
|
// if (!checkDeviceExist(WIRED, deviceName)) {
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// setDefaultDevice(WIRED, deviceName);
|
||||||
|
// parent()->setWiredDefaultDevice(deviceName);
|
||||||
|
// return;
|
||||||
|
//}
|
||||||
|
|
||||||
|
//QString DbusAdaptor::getDefaultWiredDevice()
|
||||||
|
//{
|
||||||
|
// QSettings * m_settings = new QSettings(CONFIG_FILE_PATH, QSettings::IniFormat);
|
||||||
|
// m_settings->beginGroup("DEFAULTCARD");
|
||||||
|
// QString key("wired");
|
||||||
|
// QString deviceName = m_settings->value(key, "").toString();
|
||||||
|
// m_settings->endGroup();
|
||||||
|
// delete m_settings;
|
||||||
|
// m_settings = nullptr;
|
||||||
|
// return deviceName;
|
||||||
|
//}
|
||||||
|
|
||||||
|
//void DbusAdaptor::setDefaultWirelessDevice(QString deviceName)
|
||||||
|
//{
|
||||||
|
// if (!checkDeviceExist(WIRED, deviceName)) {
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// setDefaultDevice(WIRELESS, deviceName);
|
||||||
|
// parent()->setWirelessDefaultDevice(deviceName);
|
||||||
|
// return;
|
||||||
|
//}
|
||||||
|
|
||||||
|
//QString DbusAdaptor::getDefaultWirelessDevice()
|
||||||
|
//{
|
||||||
|
// QSettings * m_settings = new QSettings(CONFIG_FILE_PATH, QSettings::IniFormat);
|
||||||
|
// m_settings->beginGroup("DEFAULTCARD");
|
||||||
|
// QString key("wireless");
|
||||||
|
// QString deviceName = m_settings->value(key, "").toString();
|
||||||
|
// m_settings->endGroup();
|
||||||
|
// delete m_settings;
|
||||||
|
// m_settings = nullptr;
|
||||||
|
// return deviceName;
|
||||||
|
//}
|
||||||
|
|
||||||
|
//连接 根据网卡类型 参数1 0:lan 1:wlan 参数3 为ssid/uuid
|
||||||
|
void DbusAdaptor::activateConnect(int type, QString devName, QString ssid)
|
||||||
|
{
|
||||||
|
if (type == WIRED) {
|
||||||
|
m_mainWindow->activateWired(devName,ssid);
|
||||||
|
} else if (type == WIRELESS) {
|
||||||
|
m_mainWindow->activateWireless(devName,ssid);
|
||||||
|
} else {
|
||||||
|
qDebug() << "[DbusAdaptor] activateConnect type is invalid";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//断开连接 根据网卡类型 参数1 0:lan 1:wlan 参数3 为ssid/uuid
|
||||||
|
void DbusAdaptor::deActivateConnect(int type, QString devName, QString ssid)
|
||||||
|
{
|
||||||
|
if (type == WIRED) {
|
||||||
|
qDebug() << "deactivateWired";
|
||||||
|
m_mainWindow->deactivateWired(devName,ssid);
|
||||||
|
} else if (type == WIRELESS) {
|
||||||
|
m_mainWindow->deactivateWireless(devName,ssid);
|
||||||
|
} else {
|
||||||
|
qDebug() << "[DbusAdaptor] deactivateConnect type is invalid";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取设备列表和启用/禁用状态
|
||||||
|
QVariantMap DbusAdaptor::getDeviceListAndEnabled(int devType)
|
||||||
|
{
|
||||||
|
QMap<QString, bool> map;
|
||||||
|
map.clear();
|
||||||
|
getDeviceEnableState(devType, map);
|
||||||
|
QVariantMap vMap;
|
||||||
|
QMap<QString, bool>::const_iterator item = map.cbegin();
|
||||||
|
while (item != map.cend()) {
|
||||||
|
vMap.insert(item.key(), QVariant::fromValue(item.value()));
|
||||||
|
item ++;
|
||||||
|
}
|
||||||
|
return vMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取无线设备能力
|
||||||
|
QVariantMap DbusAdaptor::getWirelessDeviceCap()
|
||||||
|
{
|
||||||
|
QMap<QString, int> map;
|
||||||
|
m_mainWindow->getWirelessDeviceCap(map);
|
||||||
|
QVariantMap vMap;
|
||||||
|
QMap<QString, int>::const_iterator item = map.cbegin();
|
||||||
|
while (item != map.cend()) {
|
||||||
|
vMap.insert(item.key(), QVariant::fromValue(item.value()));
|
||||||
|
item ++;
|
||||||
|
}
|
||||||
|
return vMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
//唤起属性页 根据网卡类型 参数2 为ssid/uuid
|
||||||
|
void DbusAdaptor::showPropertyWidget(QString devName, QString ssid)
|
||||||
|
{
|
||||||
|
QString display = checkDisplay();
|
||||||
|
if (m_display == display) {
|
||||||
|
m_mainWindow->showPropertyWidget(devName,ssid);
|
||||||
|
} else {
|
||||||
|
Q_EMIT showPropertyWidgetSignal(display, devName, ssid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//唤起新建有线连接界面
|
||||||
|
void DbusAdaptor::showCreateWiredConnectWidget(QString devName)
|
||||||
|
{
|
||||||
|
QString display = checkDisplay();
|
||||||
|
if (m_display == display) {
|
||||||
|
m_mainWindow->showCreateWiredConnectWidget(devName);
|
||||||
|
} else {
|
||||||
|
Q_EMIT showCreateWiredConnectWidgetSignal(display, devName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//唤起加入其他无线网络界面
|
||||||
|
void DbusAdaptor::showAddOtherWlanWidget(QString devName)
|
||||||
|
{
|
||||||
|
QString display = checkDisplay();
|
||||||
|
if (m_display == display) {
|
||||||
|
qDebug() << "showAddOtherWlanWidget";
|
||||||
|
m_mainWindow->showAddOtherWlanWidget(devName);
|
||||||
|
} else {
|
||||||
|
qDebug() << display;
|
||||||
|
Q_EMIT showAddOtherWlanWidgetSignal(display, devName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//开启热点
|
||||||
|
void DbusAdaptor::activeWirelessAp(const QString apName, const QString apPassword, const QString band, const QString apDevice)
|
||||||
|
{
|
||||||
|
m_mainWindow->activeWirelessAp(apName, apPassword, band, apDevice);
|
||||||
|
}
|
||||||
|
|
||||||
|
//断开热点
|
||||||
|
void DbusAdaptor::deactiveWirelessAp(const QString apName, const QString uuid)
|
||||||
|
{
|
||||||
|
m_mainWindow->deactiveWirelessAp(apName, uuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取热点
|
||||||
|
QStringList DbusAdaptor::getStoredApInfo()
|
||||||
|
{
|
||||||
|
QStringList list;
|
||||||
|
list.clear();
|
||||||
|
m_mainWindow->getStoredApInfo(list);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取热点path
|
||||||
|
QString DbusAdaptor::getApConnectionPath(QString uuid)
|
||||||
|
{
|
||||||
|
QString path;
|
||||||
|
path.clear();
|
||||||
|
m_mainWindow->getApConnectionPath(path, uuid);
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取热点path
|
||||||
|
QString DbusAdaptor::getActiveConnectionPath(QString uuid)
|
||||||
|
{
|
||||||
|
QString path;
|
||||||
|
path.clear();
|
||||||
|
m_mainWindow->getActiveConnectionPath(path, uuid);
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList DbusAdaptor::getApInfoBySsid(QString devName, QString ssid)
|
||||||
|
{
|
||||||
|
QStringList list;
|
||||||
|
list.clear();
|
||||||
|
m_mainWindow->getApInfoBySsid(devName, ssid, list);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DbusAdaptor::showKylinNM(int type)
|
||||||
|
{
|
||||||
|
qDebug() << "display" << checkDisplay();
|
||||||
|
QString display = checkDisplay();
|
||||||
|
if (m_display == display) {
|
||||||
|
m_mainWindow->onShowMainWindow(type);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
Q_EMIT showKylinNMSignal(display, type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//扫描
|
||||||
|
void DbusAdaptor::reScan()
|
||||||
|
{
|
||||||
|
m_mainWindow->rescan();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DbusAdaptor::keyRingInit()
|
||||||
|
{
|
||||||
|
m_mainWindow->keyRingInit();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DbusAdaptor::keyRingClear()
|
||||||
|
{
|
||||||
|
m_mainWindow->keyRingClear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DbusAdaptor::connectToMainwindow()
|
||||||
|
{
|
||||||
|
connect(m_mainWindow, &MainWindow::lanAdd, this, &DbusAdaptor::lanAdd);
|
||||||
|
connect(m_mainWindow, &MainWindow::lanRemove, this, &DbusAdaptor::lanRemove);
|
||||||
|
connect(m_mainWindow, &MainWindow::lanUpdate, this, &DbusAdaptor::lanUpdate);
|
||||||
|
connect(m_mainWindow, &MainWindow::wlanAdd, this, &DbusAdaptor::wlanAdd);
|
||||||
|
connect(m_mainWindow, &MainWindow::wlanRemove, this, &DbusAdaptor::wlanRemove);
|
||||||
|
connect(m_mainWindow, &MainWindow::wlanactiveConnectionStateChanged, this, &DbusAdaptor::wlanactiveConnectionStateChanged);
|
||||||
|
connect(m_mainWindow, &MainWindow::lanActiveConnectionStateChanged, this, &DbusAdaptor::lanActiveConnectionStateChanged);
|
||||||
|
connect(m_mainWindow, &MainWindow::activateFailed, this, &DbusAdaptor::activateFailed);
|
||||||
|
connect(m_mainWindow, &MainWindow::deactivateFailed, this, &DbusAdaptor::deactivateFailed);
|
||||||
|
connect(m_mainWindow, &MainWindow::deviceStatusChanged, this, &DbusAdaptor::deviceStatusChanged);
|
||||||
|
connect(m_mainWindow, &MainWindow::wirelessDeviceStatusChanged, this, &DbusAdaptor::wirelessDeviceStatusChanged);
|
||||||
|
connect(m_mainWindow, &MainWindow::deviceNameChanged, this, &DbusAdaptor::deviceNameChanged);
|
||||||
|
connect(m_mainWindow, &MainWindow::wirelessSwitchBtnChanged, this, &DbusAdaptor::wirelessSwitchBtnChanged);
|
||||||
|
connect(m_mainWindow, &MainWindow::hotspotDeactivated, this, &DbusAdaptor::hotspotDeactivated);
|
||||||
|
connect(m_mainWindow, &MainWindow::hotspotActivated, this, &DbusAdaptor::hotspotActivated);
|
||||||
|
connect(m_mainWindow, &MainWindow::signalStrengthChange, this, &DbusAdaptor::signalStrengthChange);
|
||||||
|
connect(m_mainWindow, &MainWindow::secuTypeChange, this, &DbusAdaptor::secuTypeChange);
|
||||||
|
connect(m_mainWindow, &MainWindow::timeToUpdate, this, &DbusAdaptor::timeToUpdate);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString DbusAdaptor::checkDisplay()
|
||||||
|
{
|
||||||
|
uint pid = 0;
|
||||||
|
QDBusReply<uint> pidReply = connection().interface()->servicePid(message().service());
|
||||||
|
qDebug() << "caller pid: " << pidReply.value();
|
||||||
|
if(pidReply.isValid()) {
|
||||||
|
pid = pidReply.value();
|
||||||
|
} else {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
return displayFromPid(pid);;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString DbusAdaptor::displayFromPid(uint pid)
|
||||||
|
{
|
||||||
|
QFile environFile(QStringLiteral("/proc/%1/environ").arg(QString::number(pid)));
|
||||||
|
if (environFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||||
|
const QByteArray DISPLAY = qApp->property("sessionType").toString() == "wayland" ? QByteArrayLiteral("WAYLAND_DISPLAY")
|
||||||
|
: QByteArrayLiteral("DISPLAY");
|
||||||
|
const auto lines = environFile.readAll().split('\0');
|
||||||
|
for (const QByteArray &line : lines) {
|
||||||
|
const int equalsIdx = line.indexOf('=');
|
||||||
|
if (equalsIdx <= 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
const QByteArray key = line.left(equalsIdx);
|
||||||
|
if (key == DISPLAY) {
|
||||||
|
const QByteArray value = line.mid(equalsIdx + 1);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
#include <QtDBus/QtDBus>
|
#include <QtDBus/QtDBus>
|
||||||
#include <QtDBus/QDBusMetaType>
|
#include <QtDBus/QDBusMetaType>
|
||||||
|
#include "dbus_adaptor.h"
|
||||||
|
#include "dbus_interface.h"
|
||||||
|
|
||||||
#include "tabpage.h"
|
#include "tabpage.h"
|
||||||
#include "../dbus-interface/kylinnetworkdeviceresource.h"
|
#include "../dbus-interface/kylinnetworkdeviceresource.h"
|
||||||
|
@ -34,23 +36,19 @@ QT_END_NAMESPACE
|
||||||
|
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
|
||||||
class DbusAdaptor: public QDBusAbstractAdaptor
|
class DbusAdaptor: public QObject, protected QDBusContext
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_CLASSINFO("D-Bus Interface", "com.kylin.network")
|
Q_CLASSINFO("D-Bus Interface", "com.kylin.network")
|
||||||
public:
|
public:
|
||||||
DbusAdaptor(MainWindow *parent);
|
explicit DbusAdaptor(QString display, MainWindow *m, QObject *parent = nullptr);
|
||||||
virtual ~DbusAdaptor();
|
|
||||||
|
|
||||||
inline MainWindow *parent() const
|
|
||||||
{ return static_cast<MainWindow *>(QObject::parent()); }
|
|
||||||
|
|
||||||
public: // PROPERTIES
|
public: // PROPERTIES
|
||||||
public Q_SLOTS: // METHODS
|
public Q_SLOTS: // METHODS
|
||||||
//无线列表
|
//无线列表
|
||||||
QMap<QString, QVector<QStringList> > getWirelessList();
|
QVariantList getWirelessList(QString devName);
|
||||||
//有线列表
|
//有线列表
|
||||||
QMap<QString, QVector<QStringList>> getWiredList();
|
QVariantList getWiredList(QString devName);
|
||||||
//有线总开关
|
//有线总开关
|
||||||
Q_NOREPLY void setWiredSwitchEnable(bool enable);
|
Q_NOREPLY void setWiredSwitchEnable(bool enable);
|
||||||
//无线总开关
|
//无线总开关
|
||||||
|
@ -67,9 +65,9 @@ public Q_SLOTS: // METHODS
|
||||||
//断开连接 根据网卡类型 参数1 0:lan 1:wlan 参数3 为ssid/uuid
|
//断开连接 根据网卡类型 参数1 0:lan 1:wlan 参数3 为ssid/uuid
|
||||||
Q_NOREPLY void deActivateConnect(int type, QString devName, QString ssid);
|
Q_NOREPLY void deActivateConnect(int type, QString devName, QString ssid);
|
||||||
//获取设备列表和启用/禁用状态
|
//获取设备列表和启用/禁用状态
|
||||||
QMap<QString, bool> getDeviceListAndEnabled(int devType);
|
QVariantMap getDeviceListAndEnabled(int devType);
|
||||||
//获取无线设备能力
|
//获取无线设备能力
|
||||||
QMap<QString, int> getWirelessDeviceCap();
|
QVariantMap getWirelessDeviceCap();
|
||||||
//唤起属性页 根据网卡类型 参数2 为ssid/uuid
|
//唤起属性页 根据网卡类型 参数2 为ssid/uuid
|
||||||
Q_NOREPLY void showPropertyWidget(QString devName, QString ssid);
|
Q_NOREPLY void showPropertyWidget(QString devName, QString ssid);
|
||||||
//唤起新建有线连接界面
|
//唤起新建有线连接界面
|
||||||
|
@ -124,6 +122,29 @@ Q_SIGNALS: // SIGNALS
|
||||||
void secuTypeChange(QString devName, QString ssid, QString secuType);
|
void secuTypeChange(QString devName, QString ssid, QString secuType);
|
||||||
//列表排序
|
//列表排序
|
||||||
void timeToUpdate();
|
void timeToUpdate();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void showKylinNMSignal(QString display, int type);
|
||||||
|
|
||||||
|
//唤起属性页 根据网卡类型 参数2 为ssid/uuid
|
||||||
|
void showPropertyWidgetSignal(QString display, QString devName, QString ssid);
|
||||||
|
//唤起新建有线连接界面
|
||||||
|
void showCreateWiredConnectWidgetSignal(QString display, QString devName);
|
||||||
|
//唤起加入其他无线网络界面
|
||||||
|
void showAddOtherWlanWidgetSignal(QString display, QString devName);
|
||||||
|
|
||||||
|
private:
|
||||||
|
MainWindow *m_mainWindow;
|
||||||
|
QString m_display;
|
||||||
|
QDBusServiceWatcher *m_watcher = nullptr;
|
||||||
|
|
||||||
|
QString checkDisplay();
|
||||||
|
QString displayFromPid(uint pid);
|
||||||
|
void connectToMainwindow();
|
||||||
|
bool registerService();
|
||||||
|
private Q_SLOT:
|
||||||
|
void onServiceOwnerChanged(const QString &service, const QString &oldOwner, const QString &newOwner);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -0,0 +1,186 @@
|
||||||
|
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
|
||||||
|
<node>
|
||||||
|
<interface name="com.kylin.network">
|
||||||
|
<signal name="lanAdd">
|
||||||
|
<arg name="devName" type="s" direction="out"/>
|
||||||
|
<arg name="info" type="as" direction="out"/>
|
||||||
|
</signal>
|
||||||
|
<signal name="lanRemove">
|
||||||
|
<arg name="dbusPath" type="s" direction="out"/>
|
||||||
|
</signal>
|
||||||
|
<signal name="lanUpdate">
|
||||||
|
<arg name="devName" type="s" direction="out"/>
|
||||||
|
<arg name="info" type="as" direction="out"/>
|
||||||
|
</signal>
|
||||||
|
<signal name="wlanAdd">
|
||||||
|
<arg name="devName" type="s" direction="out"/>
|
||||||
|
<arg name="info" type="as" direction="out"/>
|
||||||
|
</signal>
|
||||||
|
<signal name="wlanRemove">
|
||||||
|
<arg name="devName" type="s" direction="out"/>
|
||||||
|
<arg name="ssid" type="s" direction="out"/>
|
||||||
|
</signal>
|
||||||
|
<signal name="wlanactiveConnectionStateChanged">
|
||||||
|
<arg name="devName" type="s" direction="out"/>
|
||||||
|
<arg name="ssid" type="s" direction="out"/>
|
||||||
|
<arg name="uuid" type="s" direction="out"/>
|
||||||
|
<arg name="status" type="i" direction="out"/>
|
||||||
|
</signal>
|
||||||
|
<signal name="lanActiveConnectionStateChanged">
|
||||||
|
<arg name="devName" type="s" direction="out"/>
|
||||||
|
<arg name="uuid" type="s" direction="out"/>
|
||||||
|
<arg name="status" type="i" direction="out"/>
|
||||||
|
</signal>
|
||||||
|
<signal name="activateFailed">
|
||||||
|
<arg name="errorMessage" type="s" direction="out"/>
|
||||||
|
</signal>
|
||||||
|
<signal name="deactivateFailed">
|
||||||
|
<arg name="errorMessage" type="s" direction="out"/>
|
||||||
|
</signal>
|
||||||
|
<signal name="deviceStatusChanged">
|
||||||
|
</signal>
|
||||||
|
<signal name="wirelessDeviceStatusChanged">
|
||||||
|
</signal>
|
||||||
|
<signal name="deviceNameChanged">
|
||||||
|
<arg name="oldName" type="s" direction="out"/>
|
||||||
|
<arg name="newName" type="s" direction="out"/>
|
||||||
|
<arg name="type" type="i" direction="out"/>
|
||||||
|
</signal>
|
||||||
|
<signal name="wirelessSwitchBtnChanged">
|
||||||
|
<arg name="state" type="b" direction="out"/>
|
||||||
|
</signal>
|
||||||
|
<signal name="hotspotDeactivated">
|
||||||
|
<arg name="devName" type="s" direction="out"/>
|
||||||
|
<arg name="ssid" type="s" direction="out"/>
|
||||||
|
</signal>
|
||||||
|
<signal name="hotspotActivated">
|
||||||
|
<arg name="devName" type="s" direction="out"/>
|
||||||
|
<arg name="ssid" type="s" direction="out"/>
|
||||||
|
<arg name="uuid" type="s" direction="out"/>
|
||||||
|
<arg name="activePath" type="s" direction="out"/>
|
||||||
|
<arg name="settingPath" type="s" direction="out"/>
|
||||||
|
</signal>
|
||||||
|
<signal name="signalStrengthChange">
|
||||||
|
<arg name="devName" type="s" direction="out"/>
|
||||||
|
<arg name="ssid" type="s" direction="out"/>
|
||||||
|
<arg name="strength" type="i" direction="out"/>
|
||||||
|
</signal>
|
||||||
|
<signal name="secuTypeChange">
|
||||||
|
<arg name="devName" type="s" direction="out"/>
|
||||||
|
<arg name="ssid" type="s" direction="out"/>
|
||||||
|
<arg name="secuType" type="s" direction="out"/>
|
||||||
|
</signal>
|
||||||
|
<signal name="timeToUpdate">
|
||||||
|
</signal>
|
||||||
|
<signal name="showKylinNMSignal">
|
||||||
|
<arg name="display" type="s" direction="out"/>
|
||||||
|
<arg name="type" type="i" direction="out"/>
|
||||||
|
</signal>
|
||||||
|
<signal name="showPropertyWidgetSignal">
|
||||||
|
<arg name="display" type="s" direction="out"/>
|
||||||
|
<arg name="devName" type="s" direction="out"/>
|
||||||
|
<arg name="ssid" type="s" direction="out"/>
|
||||||
|
</signal>
|
||||||
|
<signal name="showCreateWiredConnectWidgetSignal">
|
||||||
|
<arg name="display" type="s" direction="out"/>
|
||||||
|
<arg name="devName" type="s" direction="out"/>
|
||||||
|
</signal>
|
||||||
|
<signal name="showAddOtherWlanWidgetSignal">
|
||||||
|
<arg name="display" type="s" direction="out"/>
|
||||||
|
<arg name="devName" type="s" direction="out"/>
|
||||||
|
</signal>
|
||||||
|
<method name="getWirelessList">
|
||||||
|
<arg type="av" direction="out"/>
|
||||||
|
<arg name="devName" type="s" direction="in"/>
|
||||||
|
</method>
|
||||||
|
<method name="getWiredList">
|
||||||
|
<arg type="av" direction="out"/>
|
||||||
|
<arg name="devName" type="s" direction="in"/>
|
||||||
|
</method>
|
||||||
|
<method name="setWiredSwitchEnable">
|
||||||
|
<arg name="enable" type="b" direction="in"/>
|
||||||
|
<annotation name="org.freedesktop.DBus.Method.NoReply" value="true"/>
|
||||||
|
</method>
|
||||||
|
<method name="setWirelessSwitchEnable">
|
||||||
|
<arg name="enable" type="b" direction="in"/>
|
||||||
|
<annotation name="org.freedesktop.DBus.Method.NoReply" value="true"/>
|
||||||
|
</method>
|
||||||
|
<method name="setDeviceEnable">
|
||||||
|
<arg name="devName" type="s" direction="in"/>
|
||||||
|
<arg name="enable" type="b" direction="in"/>
|
||||||
|
<annotation name="org.freedesktop.DBus.Method.NoReply" value="true"/>
|
||||||
|
</method>
|
||||||
|
<method name="activateConnect">
|
||||||
|
<arg name="type" type="i" direction="in"/>
|
||||||
|
<arg name="devName" type="s" direction="in"/>
|
||||||
|
<arg name="ssid" type="s" direction="in"/>
|
||||||
|
<annotation name="org.freedesktop.DBus.Method.NoReply" value="true"/>
|
||||||
|
</method>
|
||||||
|
<method name="deActivateConnect">
|
||||||
|
<arg name="type" type="i" direction="in"/>
|
||||||
|
<arg name="devName" type="s" direction="in"/>
|
||||||
|
<arg name="ssid" type="s" direction="in"/>
|
||||||
|
<annotation name="org.freedesktop.DBus.Method.NoReply" value="true"/>
|
||||||
|
</method>
|
||||||
|
<method name="getDeviceListAndEnabled">
|
||||||
|
<arg type="a{sv}" direction="out"/>
|
||||||
|
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QVariantMap"/>
|
||||||
|
<arg name="devType" type="i" direction="in"/>
|
||||||
|
</method>
|
||||||
|
<method name="getWirelessDeviceCap">
|
||||||
|
<arg type="a{sv}" direction="out"/>
|
||||||
|
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QVariantMap"/>
|
||||||
|
</method>
|
||||||
|
<method name="showPropertyWidget">
|
||||||
|
<arg name="devName" type="s" direction="in"/>
|
||||||
|
<arg name="ssid" type="s" direction="in"/>
|
||||||
|
<annotation name="org.freedesktop.DBus.Method.NoReply" value="true"/>
|
||||||
|
</method>
|
||||||
|
<method name="showCreateWiredConnectWidget">
|
||||||
|
<arg name="devName" type="s" direction="in"/>
|
||||||
|
<annotation name="org.freedesktop.DBus.Method.NoReply" value="true"/>
|
||||||
|
</method>
|
||||||
|
<method name="showAddOtherWlanWidget">
|
||||||
|
<arg name="devName" type="s" direction="in"/>
|
||||||
|
<annotation name="org.freedesktop.DBus.Method.NoReply" value="true"/>
|
||||||
|
</method>
|
||||||
|
<method name="activeWirelessAp">
|
||||||
|
<arg name="apName" type="s" direction="in"/>
|
||||||
|
<arg name="apPassword" type="s" direction="in"/>
|
||||||
|
<arg name="band" type="s" direction="in"/>
|
||||||
|
<arg name="apDevice" type="s" direction="in"/>
|
||||||
|
</method>
|
||||||
|
<method name="deactiveWirelessAp">
|
||||||
|
<arg name="apName" type="s" direction="in"/>
|
||||||
|
<arg name="uuid" type="s" direction="in"/>
|
||||||
|
</method>
|
||||||
|
<method name="getStoredApInfo">
|
||||||
|
<arg type="as" direction="out"/>
|
||||||
|
</method>
|
||||||
|
<method name="getApInfoBySsid">
|
||||||
|
<arg type="as" direction="out"/>
|
||||||
|
<arg name="devName" type="s" direction="in"/>
|
||||||
|
<arg name="ssid" type="s" direction="in"/>
|
||||||
|
</method>
|
||||||
|
<method name="getApConnectionPath">
|
||||||
|
<arg type="s" direction="out"/>
|
||||||
|
<arg name="uuid" type="s" direction="in"/>
|
||||||
|
</method>
|
||||||
|
<method name="getActiveConnectionPath">
|
||||||
|
<arg type="s" direction="out"/>
|
||||||
|
<arg name="uuid" type="s" direction="in"/>
|
||||||
|
</method>
|
||||||
|
<method name="reScan">
|
||||||
|
</method>
|
||||||
|
<method name="keyRingInit">
|
||||||
|
</method>
|
||||||
|
<method name="keyRingClear">
|
||||||
|
</method>
|
||||||
|
<method name="showKylinNM">
|
||||||
|
<arg name="type" type="i" direction="in"/>
|
||||||
|
</method>
|
||||||
|
<method name="getWirelessSwitchBtnState">
|
||||||
|
<arg type="b" direction="out"/>
|
||||||
|
</method>
|
||||||
|
</interface>
|
||||||
|
</node>
|
|
@ -0,0 +1,191 @@
|
||||||
|
/*
|
||||||
|
* This file was generated by qdbusxml2cpp version 0.8
|
||||||
|
* Command line was: qdbusxml2cpp dbus.xml -a dbus_adaptor
|
||||||
|
*
|
||||||
|
* qdbusxml2cpp is Copyright (C) 2020 The Qt Company Ltd.
|
||||||
|
*
|
||||||
|
* This is an auto-generated file.
|
||||||
|
* Do not edit! All changes made to it will be lost.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "dbus_adaptor.h"
|
||||||
|
#include <QtCore/QMetaObject>
|
||||||
|
#include <QtCore/QByteArray>
|
||||||
|
#include <QtCore/QList>
|
||||||
|
#include <QtCore/QMap>
|
||||||
|
#include <QtCore/QString>
|
||||||
|
#include <QtCore/QStringList>
|
||||||
|
#include <QtCore/QVariant>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Implementation of adaptor class NetworkAdaptor
|
||||||
|
*/
|
||||||
|
|
||||||
|
NetworkAdaptor::NetworkAdaptor(QObject *parent)
|
||||||
|
: QDBusAbstractAdaptor(parent)
|
||||||
|
{
|
||||||
|
// constructor
|
||||||
|
setAutoRelaySignals(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
NetworkAdaptor::~NetworkAdaptor()
|
||||||
|
{
|
||||||
|
// destructor
|
||||||
|
}
|
||||||
|
|
||||||
|
void NetworkAdaptor::activateConnect(int type, const QString &devName, const QString &ssid)
|
||||||
|
{
|
||||||
|
// handle method call com.kylin.network.activateConnect
|
||||||
|
QMetaObject::invokeMethod(parent(), "activateConnect", Q_ARG(int, type), Q_ARG(QString, devName), Q_ARG(QString, ssid));
|
||||||
|
}
|
||||||
|
|
||||||
|
void NetworkAdaptor::activeWirelessAp(const QString &apName, const QString &apPassword, const QString &band, const QString &apDevice)
|
||||||
|
{
|
||||||
|
// handle method call com.kylin.network.activeWirelessAp
|
||||||
|
QMetaObject::invokeMethod(parent(), "activeWirelessAp", Q_ARG(QString, apName), Q_ARG(QString, apPassword), Q_ARG(QString, band), Q_ARG(QString, apDevice));
|
||||||
|
}
|
||||||
|
|
||||||
|
void NetworkAdaptor::deActivateConnect(int type, const QString &devName, const QString &ssid)
|
||||||
|
{
|
||||||
|
// handle method call com.kylin.network.deActivateConnect
|
||||||
|
QMetaObject::invokeMethod(parent(), "deActivateConnect", Q_ARG(int, type), Q_ARG(QString, devName), Q_ARG(QString, ssid));
|
||||||
|
}
|
||||||
|
|
||||||
|
void NetworkAdaptor::deactiveWirelessAp(const QString &apName, const QString &uuid)
|
||||||
|
{
|
||||||
|
// handle method call com.kylin.network.deactiveWirelessAp
|
||||||
|
QMetaObject::invokeMethod(parent(), "deactiveWirelessAp", Q_ARG(QString, apName), Q_ARG(QString, uuid));
|
||||||
|
}
|
||||||
|
|
||||||
|
QString NetworkAdaptor::getActiveConnectionPath(const QString &uuid)
|
||||||
|
{
|
||||||
|
// handle method call com.kylin.network.getActiveConnectionPath
|
||||||
|
QString out0;
|
||||||
|
QMetaObject::invokeMethod(parent(), "getActiveConnectionPath", Q_RETURN_ARG(QString, out0), Q_ARG(QString, uuid));
|
||||||
|
return out0;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString NetworkAdaptor::getApConnectionPath(const QString &uuid)
|
||||||
|
{
|
||||||
|
// handle method call com.kylin.network.getApConnectionPath
|
||||||
|
QString out0;
|
||||||
|
QMetaObject::invokeMethod(parent(), "getApConnectionPath", Q_RETURN_ARG(QString, out0), Q_ARG(QString, uuid));
|
||||||
|
return out0;
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList NetworkAdaptor::getApInfoBySsid(const QString &devName, const QString &ssid)
|
||||||
|
{
|
||||||
|
// handle method call com.kylin.network.getApInfoBySsid
|
||||||
|
QStringList out0;
|
||||||
|
QMetaObject::invokeMethod(parent(), "getApInfoBySsid", Q_RETURN_ARG(QStringList, out0), Q_ARG(QString, devName), Q_ARG(QString, ssid));
|
||||||
|
return out0;
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariantMap NetworkAdaptor::getDeviceListAndEnabled(int devType)
|
||||||
|
{
|
||||||
|
// handle method call com.kylin.network.getDeviceListAndEnabled
|
||||||
|
QVariantMap out0;
|
||||||
|
QMetaObject::invokeMethod(parent(), "getDeviceListAndEnabled", Q_RETURN_ARG(QVariantMap, out0), Q_ARG(int, devType));
|
||||||
|
return out0;
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList NetworkAdaptor::getStoredApInfo()
|
||||||
|
{
|
||||||
|
// handle method call com.kylin.network.getStoredApInfo
|
||||||
|
QStringList out0;
|
||||||
|
QMetaObject::invokeMethod(parent(), "getStoredApInfo", Q_RETURN_ARG(QStringList, out0));
|
||||||
|
return out0;
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariantList NetworkAdaptor::getWiredList(const QString &devName)
|
||||||
|
{
|
||||||
|
// handle method call com.kylin.network.getWiredList
|
||||||
|
QVariantList out0;
|
||||||
|
QMetaObject::invokeMethod(parent(), "getWiredList", Q_RETURN_ARG(QVariantList, out0), Q_ARG(QString, devName));
|
||||||
|
return out0;
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariantMap NetworkAdaptor::getWirelessDeviceCap()
|
||||||
|
{
|
||||||
|
// handle method call com.kylin.network.getWirelessDeviceCap
|
||||||
|
QVariantMap out0;
|
||||||
|
QMetaObject::invokeMethod(parent(), "getWirelessDeviceCap", Q_RETURN_ARG(QVariantMap, out0));
|
||||||
|
return out0;
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariantList NetworkAdaptor::getWirelessList(const QString &devName)
|
||||||
|
{
|
||||||
|
// handle method call com.kylin.network.getWirelessList
|
||||||
|
QVariantList out0;
|
||||||
|
QMetaObject::invokeMethod(parent(), "getWirelessList", Q_RETURN_ARG(QVariantList, out0), Q_ARG(QString, devName));
|
||||||
|
return out0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool NetworkAdaptor::getWirelessSwitchBtnState()
|
||||||
|
{
|
||||||
|
// handle method call com.kylin.network.getWirelessSwitchBtnState
|
||||||
|
bool out0;
|
||||||
|
QMetaObject::invokeMethod(parent(), "getWirelessSwitchBtnState", Q_RETURN_ARG(bool, out0));
|
||||||
|
return out0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void NetworkAdaptor::keyRingClear()
|
||||||
|
{
|
||||||
|
// handle method call com.kylin.network.keyRingClear
|
||||||
|
QMetaObject::invokeMethod(parent(), "keyRingClear");
|
||||||
|
}
|
||||||
|
|
||||||
|
void NetworkAdaptor::keyRingInit()
|
||||||
|
{
|
||||||
|
// handle method call com.kylin.network.keyRingInit
|
||||||
|
QMetaObject::invokeMethod(parent(), "keyRingInit");
|
||||||
|
}
|
||||||
|
|
||||||
|
void NetworkAdaptor::reScan()
|
||||||
|
{
|
||||||
|
// handle method call com.kylin.network.reScan
|
||||||
|
QMetaObject::invokeMethod(parent(), "reScan");
|
||||||
|
}
|
||||||
|
|
||||||
|
void NetworkAdaptor::setDeviceEnable(const QString &devName, bool enable)
|
||||||
|
{
|
||||||
|
// handle method call com.kylin.network.setDeviceEnable
|
||||||
|
QMetaObject::invokeMethod(parent(), "setDeviceEnable", Q_ARG(QString, devName), Q_ARG(bool, enable));
|
||||||
|
}
|
||||||
|
|
||||||
|
void NetworkAdaptor::setWiredSwitchEnable(bool enable)
|
||||||
|
{
|
||||||
|
// handle method call com.kylin.network.setWiredSwitchEnable
|
||||||
|
QMetaObject::invokeMethod(parent(), "setWiredSwitchEnable", Q_ARG(bool, enable));
|
||||||
|
}
|
||||||
|
|
||||||
|
void NetworkAdaptor::setWirelessSwitchEnable(bool enable)
|
||||||
|
{
|
||||||
|
// handle method call com.kylin.network.setWirelessSwitchEnable
|
||||||
|
QMetaObject::invokeMethod(parent(), "setWirelessSwitchEnable", Q_ARG(bool, enable));
|
||||||
|
}
|
||||||
|
|
||||||
|
void NetworkAdaptor::showAddOtherWlanWidget(const QString &devName)
|
||||||
|
{
|
||||||
|
// handle method call com.kylin.network.showAddOtherWlanWidget
|
||||||
|
QMetaObject::invokeMethod(parent(), "showAddOtherWlanWidget", Q_ARG(QString, devName));
|
||||||
|
}
|
||||||
|
|
||||||
|
void NetworkAdaptor::showCreateWiredConnectWidget(const QString &devName)
|
||||||
|
{
|
||||||
|
// handle method call com.kylin.network.showCreateWiredConnectWidget
|
||||||
|
QMetaObject::invokeMethod(parent(), "showCreateWiredConnectWidget", Q_ARG(QString, devName));
|
||||||
|
}
|
||||||
|
|
||||||
|
void NetworkAdaptor::showKylinNM(int type)
|
||||||
|
{
|
||||||
|
// handle method call com.kylin.network.showKylinNM
|
||||||
|
QMetaObject::invokeMethod(parent(), "showKylinNM", Q_ARG(int, type));
|
||||||
|
}
|
||||||
|
|
||||||
|
void NetworkAdaptor::showPropertyWidget(const QString &devName, const QString &ssid)
|
||||||
|
{
|
||||||
|
// handle method call com.kylin.network.showPropertyWidget
|
||||||
|
QMetaObject::invokeMethod(parent(), "showPropertyWidget", Q_ARG(QString, devName), Q_ARG(QString, ssid));
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,266 @@
|
||||||
|
/*
|
||||||
|
* This file was generated by qdbusxml2cpp version 0.8
|
||||||
|
* Command line was: qdbusxml2cpp dbus.xml -a dbus_adaptor
|
||||||
|
*
|
||||||
|
* qdbusxml2cpp is Copyright (C) 2020 The Qt Company Ltd.
|
||||||
|
*
|
||||||
|
* This is an auto-generated file.
|
||||||
|
* This file may have been hand-edited. Look for HAND-EDIT comments
|
||||||
|
* before re-generating it.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef DBUS_ADAPTOR_H
|
||||||
|
#define DBUS_ADAPTOR_H
|
||||||
|
|
||||||
|
#include <QtCore/QObject>
|
||||||
|
#include <QtDBus/QtDBus>
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
class QByteArray;
|
||||||
|
template<class T> class QList;
|
||||||
|
template<class Key, class Value> class QMap;
|
||||||
|
class QString;
|
||||||
|
class QStringList;
|
||||||
|
class QVariant;
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Adaptor class for interface com.kylin.network
|
||||||
|
*/
|
||||||
|
class NetworkAdaptor: public QDBusAbstractAdaptor
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
Q_CLASSINFO("D-Bus Interface", "com.kylin.network")
|
||||||
|
Q_CLASSINFO("D-Bus Introspection", ""
|
||||||
|
" <interface name=\"com.kylin.network\">\n"
|
||||||
|
" <signal name=\"lanAdd\">\n"
|
||||||
|
" <arg direction=\"out\" type=\"s\" name=\"devName\"/>\n"
|
||||||
|
" <arg direction=\"out\" type=\"as\" name=\"info\"/>\n"
|
||||||
|
" </signal>\n"
|
||||||
|
" <signal name=\"lanRemove\">\n"
|
||||||
|
" <arg direction=\"out\" type=\"s\" name=\"dbusPath\"/>\n"
|
||||||
|
" </signal>\n"
|
||||||
|
" <signal name=\"lanUpdate\">\n"
|
||||||
|
" <arg direction=\"out\" type=\"s\" name=\"devName\"/>\n"
|
||||||
|
" <arg direction=\"out\" type=\"as\" name=\"info\"/>\n"
|
||||||
|
" </signal>\n"
|
||||||
|
" <signal name=\"wlanAdd\">\n"
|
||||||
|
" <arg direction=\"out\" type=\"s\" name=\"devName\"/>\n"
|
||||||
|
" <arg direction=\"out\" type=\"as\" name=\"info\"/>\n"
|
||||||
|
" </signal>\n"
|
||||||
|
" <signal name=\"wlanRemove\">\n"
|
||||||
|
" <arg direction=\"out\" type=\"s\" name=\"devName\"/>\n"
|
||||||
|
" <arg direction=\"out\" type=\"s\" name=\"ssid\"/>\n"
|
||||||
|
" </signal>\n"
|
||||||
|
" <signal name=\"wlanactiveConnectionStateChanged\">\n"
|
||||||
|
" <arg direction=\"out\" type=\"s\" name=\"devName\"/>\n"
|
||||||
|
" <arg direction=\"out\" type=\"s\" name=\"ssid\"/>\n"
|
||||||
|
" <arg direction=\"out\" type=\"s\" name=\"uuid\"/>\n"
|
||||||
|
" <arg direction=\"out\" type=\"i\" name=\"status\"/>\n"
|
||||||
|
" </signal>\n"
|
||||||
|
" <signal name=\"lanActiveConnectionStateChanged\">\n"
|
||||||
|
" <arg direction=\"out\" type=\"s\" name=\"devName\"/>\n"
|
||||||
|
" <arg direction=\"out\" type=\"s\" name=\"uuid\"/>\n"
|
||||||
|
" <arg direction=\"out\" type=\"i\" name=\"status\"/>\n"
|
||||||
|
" </signal>\n"
|
||||||
|
" <signal name=\"activateFailed\">\n"
|
||||||
|
" <arg direction=\"out\" type=\"s\" name=\"errorMessage\"/>\n"
|
||||||
|
" </signal>\n"
|
||||||
|
" <signal name=\"deactivateFailed\">\n"
|
||||||
|
" <arg direction=\"out\" type=\"s\" name=\"errorMessage\"/>\n"
|
||||||
|
" </signal>\n"
|
||||||
|
" <signal name=\"deviceStatusChanged\"/>\n"
|
||||||
|
" <signal name=\"wirelessDeviceStatusChanged\"/>\n"
|
||||||
|
" <signal name=\"deviceNameChanged\">\n"
|
||||||
|
" <arg direction=\"out\" type=\"s\" name=\"oldName\"/>\n"
|
||||||
|
" <arg direction=\"out\" type=\"s\" name=\"newName\"/>\n"
|
||||||
|
" <arg direction=\"out\" type=\"i\" name=\"type\"/>\n"
|
||||||
|
" </signal>\n"
|
||||||
|
" <signal name=\"wirelessSwitchBtnChanged\">\n"
|
||||||
|
" <arg direction=\"out\" type=\"b\" name=\"state\"/>\n"
|
||||||
|
" </signal>\n"
|
||||||
|
" <signal name=\"hotspotDeactivated\">\n"
|
||||||
|
" <arg direction=\"out\" type=\"s\" name=\"devName\"/>\n"
|
||||||
|
" <arg direction=\"out\" type=\"s\" name=\"ssid\"/>\n"
|
||||||
|
" </signal>\n"
|
||||||
|
" <signal name=\"hotspotActivated\">\n"
|
||||||
|
" <arg direction=\"out\" type=\"s\" name=\"devName\"/>\n"
|
||||||
|
" <arg direction=\"out\" type=\"s\" name=\"ssid\"/>\n"
|
||||||
|
" <arg direction=\"out\" type=\"s\" name=\"uuid\"/>\n"
|
||||||
|
" <arg direction=\"out\" type=\"s\" name=\"activePath\"/>\n"
|
||||||
|
" <arg direction=\"out\" type=\"s\" name=\"settingPath\"/>\n"
|
||||||
|
" </signal>\n"
|
||||||
|
" <signal name=\"signalStrengthChange\">\n"
|
||||||
|
" <arg direction=\"out\" type=\"s\" name=\"devName\"/>\n"
|
||||||
|
" <arg direction=\"out\" type=\"s\" name=\"ssid\"/>\n"
|
||||||
|
" <arg direction=\"out\" type=\"i\" name=\"strength\"/>\n"
|
||||||
|
" </signal>\n"
|
||||||
|
" <signal name=\"secuTypeChange\">\n"
|
||||||
|
" <arg direction=\"out\" type=\"s\" name=\"devName\"/>\n"
|
||||||
|
" <arg direction=\"out\" type=\"s\" name=\"ssid\"/>\n"
|
||||||
|
" <arg direction=\"out\" type=\"s\" name=\"secuType\"/>\n"
|
||||||
|
" </signal>\n"
|
||||||
|
" <signal name=\"timeToUpdate\"/>\n"
|
||||||
|
" <signal name=\"showKylinNMSignal\">\n"
|
||||||
|
" <arg direction=\"out\" type=\"s\" name=\"display\"/>\n"
|
||||||
|
" <arg direction=\"out\" type=\"i\" name=\"type\"/>\n"
|
||||||
|
" </signal>\n"
|
||||||
|
" <signal name=\"showPropertyWidgetSignal\">\n"
|
||||||
|
" <arg direction=\"out\" type=\"s\" name=\"display\"/>\n"
|
||||||
|
" <arg direction=\"out\" type=\"s\" name=\"devName\"/>\n"
|
||||||
|
" <arg direction=\"out\" type=\"s\" name=\"ssid\"/>\n"
|
||||||
|
" </signal>\n"
|
||||||
|
" <signal name=\"showCreateWiredConnectWidgetSignal\">\n"
|
||||||
|
" <arg direction=\"out\" type=\"s\" name=\"display\"/>\n"
|
||||||
|
" <arg direction=\"out\" type=\"s\" name=\"devName\"/>\n"
|
||||||
|
" </signal>\n"
|
||||||
|
" <signal name=\"showAddOtherWlanWidgetSignal\">\n"
|
||||||
|
" <arg direction=\"out\" type=\"s\" name=\"display\"/>\n"
|
||||||
|
" <arg direction=\"out\" type=\"s\" name=\"devName\"/>\n"
|
||||||
|
" </signal>\n"
|
||||||
|
" <method name=\"getWirelessList\">\n"
|
||||||
|
" <arg direction=\"out\" type=\"av\"/>\n"
|
||||||
|
" <arg direction=\"in\" type=\"s\" name=\"devName\"/>\n"
|
||||||
|
" </method>\n"
|
||||||
|
" <method name=\"getWiredList\">\n"
|
||||||
|
" <arg direction=\"out\" type=\"av\"/>\n"
|
||||||
|
" <arg direction=\"in\" type=\"s\" name=\"devName\"/>\n"
|
||||||
|
" </method>\n"
|
||||||
|
" <method name=\"setWiredSwitchEnable\">\n"
|
||||||
|
" <arg direction=\"in\" type=\"b\" name=\"enable\"/>\n"
|
||||||
|
" <annotation value=\"true\" name=\"org.freedesktop.DBus.Method.NoReply\"/>\n"
|
||||||
|
" </method>\n"
|
||||||
|
" <method name=\"setWirelessSwitchEnable\">\n"
|
||||||
|
" <arg direction=\"in\" type=\"b\" name=\"enable\"/>\n"
|
||||||
|
" <annotation value=\"true\" name=\"org.freedesktop.DBus.Method.NoReply\"/>\n"
|
||||||
|
" </method>\n"
|
||||||
|
" <method name=\"setDeviceEnable\">\n"
|
||||||
|
" <arg direction=\"in\" type=\"s\" name=\"devName\"/>\n"
|
||||||
|
" <arg direction=\"in\" type=\"b\" name=\"enable\"/>\n"
|
||||||
|
" <annotation value=\"true\" name=\"org.freedesktop.DBus.Method.NoReply\"/>\n"
|
||||||
|
" </method>\n"
|
||||||
|
" <method name=\"activateConnect\">\n"
|
||||||
|
" <arg direction=\"in\" type=\"i\" name=\"type\"/>\n"
|
||||||
|
" <arg direction=\"in\" type=\"s\" name=\"devName\"/>\n"
|
||||||
|
" <arg direction=\"in\" type=\"s\" name=\"ssid\"/>\n"
|
||||||
|
" <annotation value=\"true\" name=\"org.freedesktop.DBus.Method.NoReply\"/>\n"
|
||||||
|
" </method>\n"
|
||||||
|
" <method name=\"deActivateConnect\">\n"
|
||||||
|
" <arg direction=\"in\" type=\"i\" name=\"type\"/>\n"
|
||||||
|
" <arg direction=\"in\" type=\"s\" name=\"devName\"/>\n"
|
||||||
|
" <arg direction=\"in\" type=\"s\" name=\"ssid\"/>\n"
|
||||||
|
" <annotation value=\"true\" name=\"org.freedesktop.DBus.Method.NoReply\"/>\n"
|
||||||
|
" </method>\n"
|
||||||
|
" <method name=\"getDeviceListAndEnabled\">\n"
|
||||||
|
" <arg direction=\"out\" type=\"a{sv}\"/>\n"
|
||||||
|
" <annotation value=\"QVariantMap\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n"
|
||||||
|
" <arg direction=\"in\" type=\"i\" name=\"devType\"/>\n"
|
||||||
|
" </method>\n"
|
||||||
|
" <method name=\"getWirelessDeviceCap\">\n"
|
||||||
|
" <arg direction=\"out\" type=\"a{sv}\"/>\n"
|
||||||
|
" <annotation value=\"QVariantMap\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n"
|
||||||
|
" </method>\n"
|
||||||
|
" <method name=\"showPropertyWidget\">\n"
|
||||||
|
" <arg direction=\"in\" type=\"s\" name=\"devName\"/>\n"
|
||||||
|
" <arg direction=\"in\" type=\"s\" name=\"ssid\"/>\n"
|
||||||
|
" <annotation value=\"true\" name=\"org.freedesktop.DBus.Method.NoReply\"/>\n"
|
||||||
|
" </method>\n"
|
||||||
|
" <method name=\"showCreateWiredConnectWidget\">\n"
|
||||||
|
" <arg direction=\"in\" type=\"s\" name=\"devName\"/>\n"
|
||||||
|
" <annotation value=\"true\" name=\"org.freedesktop.DBus.Method.NoReply\"/>\n"
|
||||||
|
" </method>\n"
|
||||||
|
" <method name=\"showAddOtherWlanWidget\">\n"
|
||||||
|
" <arg direction=\"in\" type=\"s\" name=\"devName\"/>\n"
|
||||||
|
" <annotation value=\"true\" name=\"org.freedesktop.DBus.Method.NoReply\"/>\n"
|
||||||
|
" </method>\n"
|
||||||
|
" <method name=\"activeWirelessAp\">\n"
|
||||||
|
" <arg direction=\"in\" type=\"s\" name=\"apName\"/>\n"
|
||||||
|
" <arg direction=\"in\" type=\"s\" name=\"apPassword\"/>\n"
|
||||||
|
" <arg direction=\"in\" type=\"s\" name=\"band\"/>\n"
|
||||||
|
" <arg direction=\"in\" type=\"s\" name=\"apDevice\"/>\n"
|
||||||
|
" </method>\n"
|
||||||
|
" <method name=\"deactiveWirelessAp\">\n"
|
||||||
|
" <arg direction=\"in\" type=\"s\" name=\"apName\"/>\n"
|
||||||
|
" <arg direction=\"in\" type=\"s\" name=\"uuid\"/>\n"
|
||||||
|
" </method>\n"
|
||||||
|
" <method name=\"getStoredApInfo\">\n"
|
||||||
|
" <arg direction=\"out\" type=\"as\"/>\n"
|
||||||
|
" </method>\n"
|
||||||
|
" <method name=\"getApInfoBySsid\">\n"
|
||||||
|
" <arg direction=\"out\" type=\"as\"/>\n"
|
||||||
|
" <arg direction=\"in\" type=\"s\" name=\"devName\"/>\n"
|
||||||
|
" <arg direction=\"in\" type=\"s\" name=\"ssid\"/>\n"
|
||||||
|
" </method>\n"
|
||||||
|
" <method name=\"getApConnectionPath\">\n"
|
||||||
|
" <arg direction=\"out\" type=\"s\"/>\n"
|
||||||
|
" <arg direction=\"in\" type=\"s\" name=\"uuid\"/>\n"
|
||||||
|
" </method>\n"
|
||||||
|
" <method name=\"getActiveConnectionPath\">\n"
|
||||||
|
" <arg direction=\"out\" type=\"s\"/>\n"
|
||||||
|
" <arg direction=\"in\" type=\"s\" name=\"uuid\"/>\n"
|
||||||
|
" </method>\n"
|
||||||
|
" <method name=\"reScan\"/>\n"
|
||||||
|
" <method name=\"keyRingInit\"/>\n"
|
||||||
|
" <method name=\"keyRingClear\"/>\n"
|
||||||
|
" <method name=\"showKylinNM\">\n"
|
||||||
|
" <arg direction=\"in\" type=\"i\" name=\"type\"/>\n"
|
||||||
|
" </method>\n"
|
||||||
|
" <method name=\"getWirelessSwitchBtnState\">\n"
|
||||||
|
" <arg direction=\"out\" type=\"b\"/>\n"
|
||||||
|
" </method>\n"
|
||||||
|
" </interface>\n"
|
||||||
|
"")
|
||||||
|
public:
|
||||||
|
NetworkAdaptor(QObject *parent);
|
||||||
|
virtual ~NetworkAdaptor();
|
||||||
|
|
||||||
|
public: // PROPERTIES
|
||||||
|
public Q_SLOTS: // METHODS
|
||||||
|
Q_NOREPLY void activateConnect(int type, const QString &devName, const QString &ssid);
|
||||||
|
void activeWirelessAp(const QString &apName, const QString &apPassword, const QString &band, const QString &apDevice);
|
||||||
|
Q_NOREPLY void deActivateConnect(int type, const QString &devName, const QString &ssid);
|
||||||
|
void deactiveWirelessAp(const QString &apName, const QString &uuid);
|
||||||
|
QString getActiveConnectionPath(const QString &uuid);
|
||||||
|
QString getApConnectionPath(const QString &uuid);
|
||||||
|
QStringList getApInfoBySsid(const QString &devName, const QString &ssid);
|
||||||
|
QVariantMap getDeviceListAndEnabled(int devType);
|
||||||
|
QStringList getStoredApInfo();
|
||||||
|
QVariantList getWiredList(const QString &devName);
|
||||||
|
QVariantMap getWirelessDeviceCap();
|
||||||
|
QVariantList getWirelessList(const QString &devName);
|
||||||
|
bool getWirelessSwitchBtnState();
|
||||||
|
void keyRingClear();
|
||||||
|
void keyRingInit();
|
||||||
|
void reScan();
|
||||||
|
Q_NOREPLY void setDeviceEnable(const QString &devName, bool enable);
|
||||||
|
Q_NOREPLY void setWiredSwitchEnable(bool enable);
|
||||||
|
Q_NOREPLY void setWirelessSwitchEnable(bool enable);
|
||||||
|
Q_NOREPLY void showAddOtherWlanWidget(const QString &devName);
|
||||||
|
Q_NOREPLY void showCreateWiredConnectWidget(const QString &devName);
|
||||||
|
void showKylinNM(int type);
|
||||||
|
Q_NOREPLY void showPropertyWidget(const QString &devName, const QString &ssid);
|
||||||
|
Q_SIGNALS: // SIGNALS
|
||||||
|
void activateFailed(const QString &errorMessage);
|
||||||
|
void deactivateFailed(const QString &errorMessage);
|
||||||
|
void deviceNameChanged(const QString &oldName, const QString &newName, int type);
|
||||||
|
void deviceStatusChanged();
|
||||||
|
void hotspotActivated(const QString &devName, const QString &ssid, const QString &uuid, const QString &activePath, const QString &settingPath);
|
||||||
|
void hotspotDeactivated(const QString &devName, const QString &ssid);
|
||||||
|
void lanActiveConnectionStateChanged(const QString &devName, const QString &uuid, int status);
|
||||||
|
void lanAdd(const QString &devName, const QStringList &info);
|
||||||
|
void lanRemove(const QString &dbusPath);
|
||||||
|
void lanUpdate(const QString &devName, const QStringList &info);
|
||||||
|
void secuTypeChange(const QString &devName, const QString &ssid, const QString &secuType);
|
||||||
|
void showAddOtherWlanWidgetSignal(const QString &display, const QString &devName);
|
||||||
|
void showCreateWiredConnectWidgetSignal(const QString &display, const QString &devName);
|
||||||
|
void showKylinNMSignal(const QString &display, int type);
|
||||||
|
void showPropertyWidgetSignal(const QString &display, const QString &devName, const QString &ssid);
|
||||||
|
void signalStrengthChange(const QString &devName, const QString &ssid, int strength);
|
||||||
|
void timeToUpdate();
|
||||||
|
void wirelessDeviceStatusChanged();
|
||||||
|
void wirelessSwitchBtnChanged(bool state);
|
||||||
|
void wlanAdd(const QString &devName, const QStringList &info);
|
||||||
|
void wlanRemove(const QString &devName, const QString &ssid);
|
||||||
|
void wlanactiveConnectionStateChanged(const QString &devName, const QString &ssid, const QString &uuid, int status);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,26 @@
|
||||||
|
/*
|
||||||
|
* This file was generated by qdbusxml2cpp version 0.8
|
||||||
|
* Command line was: qdbusxml2cpp dbus.xml -p dbus_interface
|
||||||
|
*
|
||||||
|
* qdbusxml2cpp is Copyright (C) 2020 The Qt Company Ltd.
|
||||||
|
*
|
||||||
|
* This is an auto-generated file.
|
||||||
|
* This file may have been hand-edited. Look for HAND-EDIT comments
|
||||||
|
* before re-generating it.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "dbus_interface.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Implementation of interface class ComKylinNetworkInterface
|
||||||
|
*/
|
||||||
|
|
||||||
|
ComKylinNetworkInterface::ComKylinNetworkInterface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent)
|
||||||
|
: QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
ComKylinNetworkInterface::~ComKylinNetworkInterface()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,224 @@
|
||||||
|
/*
|
||||||
|
* This file was generated by qdbusxml2cpp version 0.8
|
||||||
|
* Command line was: qdbusxml2cpp dbus.xml -p dbus_interface
|
||||||
|
*
|
||||||
|
* qdbusxml2cpp is Copyright (C) 2020 The Qt Company Ltd.
|
||||||
|
*
|
||||||
|
* This is an auto-generated file.
|
||||||
|
* Do not edit! All changes made to it will be lost.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef DBUS_INTERFACE_H
|
||||||
|
#define DBUS_INTERFACE_H
|
||||||
|
|
||||||
|
#include <QtCore/QObject>
|
||||||
|
#include <QtCore/QByteArray>
|
||||||
|
#include <QtCore/QList>
|
||||||
|
#include <QtCore/QMap>
|
||||||
|
#include <QtCore/QString>
|
||||||
|
#include <QtCore/QStringList>
|
||||||
|
#include <QtCore/QVariant>
|
||||||
|
#include <QtDBus/QtDBus>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Proxy class for interface com.kylin.network
|
||||||
|
*/
|
||||||
|
class ComKylinNetworkInterface: public QDBusAbstractInterface
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
static inline const char *staticInterfaceName()
|
||||||
|
{ return "com.kylin.network"; }
|
||||||
|
|
||||||
|
public:
|
||||||
|
ComKylinNetworkInterface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = nullptr);
|
||||||
|
|
||||||
|
~ComKylinNetworkInterface();
|
||||||
|
|
||||||
|
public Q_SLOTS: // METHODS
|
||||||
|
inline Q_NOREPLY void activateConnect(int type, const QString &devName, const QString &ssid)
|
||||||
|
{
|
||||||
|
QList<QVariant> argumentList;
|
||||||
|
argumentList << QVariant::fromValue(type) << QVariant::fromValue(devName) << QVariant::fromValue(ssid);
|
||||||
|
callWithArgumentList(QDBus::NoBlock, QStringLiteral("activateConnect"), argumentList);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline QDBusPendingReply<> activeWirelessAp(const QString &apName, const QString &apPassword, const QString &band, const QString &apDevice)
|
||||||
|
{
|
||||||
|
QList<QVariant> argumentList;
|
||||||
|
argumentList << QVariant::fromValue(apName) << QVariant::fromValue(apPassword) << QVariant::fromValue(band) << QVariant::fromValue(apDevice);
|
||||||
|
return asyncCallWithArgumentList(QStringLiteral("activeWirelessAp"), argumentList);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline Q_NOREPLY void deActivateConnect(int type, const QString &devName, const QString &ssid)
|
||||||
|
{
|
||||||
|
QList<QVariant> argumentList;
|
||||||
|
argumentList << QVariant::fromValue(type) << QVariant::fromValue(devName) << QVariant::fromValue(ssid);
|
||||||
|
callWithArgumentList(QDBus::NoBlock, QStringLiteral("deActivateConnect"), argumentList);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline QDBusPendingReply<> deactiveWirelessAp(const QString &apName, const QString &uuid)
|
||||||
|
{
|
||||||
|
QList<QVariant> argumentList;
|
||||||
|
argumentList << QVariant::fromValue(apName) << QVariant::fromValue(uuid);
|
||||||
|
return asyncCallWithArgumentList(QStringLiteral("deactiveWirelessAp"), argumentList);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline QDBusPendingReply<QString> getActiveConnectionPath(const QString &uuid)
|
||||||
|
{
|
||||||
|
QList<QVariant> argumentList;
|
||||||
|
argumentList << QVariant::fromValue(uuid);
|
||||||
|
return asyncCallWithArgumentList(QStringLiteral("getActiveConnectionPath"), argumentList);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline QDBusPendingReply<QString> getApConnectionPath(const QString &uuid)
|
||||||
|
{
|
||||||
|
QList<QVariant> argumentList;
|
||||||
|
argumentList << QVariant::fromValue(uuid);
|
||||||
|
return asyncCallWithArgumentList(QStringLiteral("getApConnectionPath"), argumentList);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline QDBusPendingReply<QStringList> getApInfoBySsid(const QString &devName, const QString &ssid)
|
||||||
|
{
|
||||||
|
QList<QVariant> argumentList;
|
||||||
|
argumentList << QVariant::fromValue(devName) << QVariant::fromValue(ssid);
|
||||||
|
return asyncCallWithArgumentList(QStringLiteral("getApInfoBySsid"), argumentList);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline QDBusPendingReply<QVariantMap> getDeviceListAndEnabled(int devType)
|
||||||
|
{
|
||||||
|
QList<QVariant> argumentList;
|
||||||
|
argumentList << QVariant::fromValue(devType);
|
||||||
|
return asyncCallWithArgumentList(QStringLiteral("getDeviceListAndEnabled"), argumentList);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline QDBusPendingReply<QStringList> getStoredApInfo()
|
||||||
|
{
|
||||||
|
QList<QVariant> argumentList;
|
||||||
|
return asyncCallWithArgumentList(QStringLiteral("getStoredApInfo"), argumentList);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline QDBusPendingReply<QVariantList> getWiredList(const QString &devName)
|
||||||
|
{
|
||||||
|
QList<QVariant> argumentList;
|
||||||
|
argumentList << QVariant::fromValue(devName);
|
||||||
|
return asyncCallWithArgumentList(QStringLiteral("getWiredList"), argumentList);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline QDBusPendingReply<QVariantMap> getWirelessDeviceCap()
|
||||||
|
{
|
||||||
|
QList<QVariant> argumentList;
|
||||||
|
return asyncCallWithArgumentList(QStringLiteral("getWirelessDeviceCap"), argumentList);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline QDBusPendingReply<QVariantList> getWirelessList(const QString &devName)
|
||||||
|
{
|
||||||
|
QList<QVariant> argumentList;
|
||||||
|
argumentList << QVariant::fromValue(devName);
|
||||||
|
return asyncCallWithArgumentList(QStringLiteral("getWirelessList"), argumentList);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline QDBusPendingReply<bool> getWirelessSwitchBtnState()
|
||||||
|
{
|
||||||
|
QList<QVariant> argumentList;
|
||||||
|
return asyncCallWithArgumentList(QStringLiteral("getWirelessSwitchBtnState"), argumentList);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline QDBusPendingReply<> keyRingClear()
|
||||||
|
{
|
||||||
|
QList<QVariant> argumentList;
|
||||||
|
return asyncCallWithArgumentList(QStringLiteral("keyRingClear"), argumentList);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline QDBusPendingReply<> keyRingInit()
|
||||||
|
{
|
||||||
|
QList<QVariant> argumentList;
|
||||||
|
return asyncCallWithArgumentList(QStringLiteral("keyRingInit"), argumentList);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline QDBusPendingReply<> reScan()
|
||||||
|
{
|
||||||
|
QList<QVariant> argumentList;
|
||||||
|
return asyncCallWithArgumentList(QStringLiteral("reScan"), argumentList);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline Q_NOREPLY void setDeviceEnable(const QString &devName, bool enable)
|
||||||
|
{
|
||||||
|
QList<QVariant> argumentList;
|
||||||
|
argumentList << QVariant::fromValue(devName) << QVariant::fromValue(enable);
|
||||||
|
callWithArgumentList(QDBus::NoBlock, QStringLiteral("setDeviceEnable"), argumentList);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline Q_NOREPLY void setWiredSwitchEnable(bool enable)
|
||||||
|
{
|
||||||
|
QList<QVariant> argumentList;
|
||||||
|
argumentList << QVariant::fromValue(enable);
|
||||||
|
callWithArgumentList(QDBus::NoBlock, QStringLiteral("setWiredSwitchEnable"), argumentList);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline Q_NOREPLY void setWirelessSwitchEnable(bool enable)
|
||||||
|
{
|
||||||
|
QList<QVariant> argumentList;
|
||||||
|
argumentList << QVariant::fromValue(enable);
|
||||||
|
callWithArgumentList(QDBus::NoBlock, QStringLiteral("setWirelessSwitchEnable"), argumentList);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline Q_NOREPLY void showAddOtherWlanWidget(const QString &devName)
|
||||||
|
{
|
||||||
|
QList<QVariant> argumentList;
|
||||||
|
argumentList << QVariant::fromValue(devName);
|
||||||
|
callWithArgumentList(QDBus::NoBlock, QStringLiteral("showAddOtherWlanWidget"), argumentList);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline Q_NOREPLY void showCreateWiredConnectWidget(const QString &devName)
|
||||||
|
{
|
||||||
|
QList<QVariant> argumentList;
|
||||||
|
argumentList << QVariant::fromValue(devName);
|
||||||
|
callWithArgumentList(QDBus::NoBlock, QStringLiteral("showCreateWiredConnectWidget"), argumentList);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline QDBusPendingReply<> showKylinNM(int type)
|
||||||
|
{
|
||||||
|
QList<QVariant> argumentList;
|
||||||
|
argumentList << QVariant::fromValue(type);
|
||||||
|
return asyncCallWithArgumentList(QStringLiteral("showKylinNM"), argumentList);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline Q_NOREPLY void showPropertyWidget(const QString &devName, const QString &ssid)
|
||||||
|
{
|
||||||
|
QList<QVariant> argumentList;
|
||||||
|
argumentList << QVariant::fromValue(devName) << QVariant::fromValue(ssid);
|
||||||
|
callWithArgumentList(QDBus::NoBlock, QStringLiteral("showPropertyWidget"), argumentList);
|
||||||
|
}
|
||||||
|
|
||||||
|
Q_SIGNALS: // SIGNALS
|
||||||
|
void activateFailed(const QString &errorMessage);
|
||||||
|
void deactivateFailed(const QString &errorMessage);
|
||||||
|
void deviceNameChanged(const QString &oldName, const QString &newName, int type);
|
||||||
|
void deviceStatusChanged();
|
||||||
|
void hotspotActivated(const QString &devName, const QString &ssid, const QString &uuid, const QString &activePath, const QString &settingPath);
|
||||||
|
void hotspotDeactivated(const QString &devName, const QString &ssid);
|
||||||
|
void lanActiveConnectionStateChanged(const QString &devName, const QString &uuid, int status);
|
||||||
|
void lanAdd(const QString &devName, const QStringList &info);
|
||||||
|
void lanRemove(const QString &dbusPath);
|
||||||
|
void lanUpdate(const QString &devName, const QStringList &info);
|
||||||
|
void secuTypeChange(const QString &devName, const QString &ssid, const QString &secuType);
|
||||||
|
void showAddOtherWlanWidgetSignal(const QString &display, const QString &devName);
|
||||||
|
void showCreateWiredConnectWidgetSignal(const QString &display, const QString &devName);
|
||||||
|
void showKylinNMSignal(const QString &display, int type);
|
||||||
|
void showPropertyWidgetSignal(const QString &display, const QString &devName, const QString &ssid);
|
||||||
|
void signalStrengthChange(const QString &devName, const QString &ssid, int strength);
|
||||||
|
void timeToUpdate();
|
||||||
|
void wirelessDeviceStatusChanged();
|
||||||
|
void wirelessSwitchBtnChanged(bool state);
|
||||||
|
void wlanAdd(const QString &devName, const QStringList &info);
|
||||||
|
void wlanRemove(const QString &devName, const QString &ssid);
|
||||||
|
void wlanactiveConnectionStateChanged(const QString &devName, const QString &ssid, const QString &uuid, int status);
|
||||||
|
};
|
||||||
|
|
||||||
|
namespace com {
|
||||||
|
namespace kylin {
|
||||||
|
typedef ::ComKylinNetworkInterface network;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
|
@ -1,279 +0,0 @@
|
||||||
/*
|
|
||||||
* This file was generated by qdbusxml2cpp version 0.8
|
|
||||||
* Command line was: qdbusxml2cpp com.kylin.weather.xml -a dbusadaptor -c DbusAdaptor -l MainWindow
|
|
||||||
*
|
|
||||||
* qdbusxml2cpp is Copyright (C) 2015 The Qt Company Ltd.
|
|
||||||
*
|
|
||||||
* This is an auto-generated file.
|
|
||||||
* Do not edit! All changes made to it will be lost.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "dbusadaptor.h"
|
|
||||||
#include <QtCore/QMetaObject>
|
|
||||||
#include <QtCore/QByteArray>
|
|
||||||
#include <QtCore/QList>
|
|
||||||
#include <QtCore/QMap>
|
|
||||||
#include <QtCore/QString>
|
|
||||||
#include <QtCore/QStringList>
|
|
||||||
#include <QtCore/QVariant>
|
|
||||||
|
|
||||||
const QByteArray GSETTINGS_SCHEMA_KYLIN_NM = "org.ukui.kylin-nm.switch";
|
|
||||||
const QString KEY_WIRELESS_SWITCH = "wirelessswitch";
|
|
||||||
const QString KEY_WIRED_SWITCH = "wiredswitch";
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Implementation of adaptor class DbusAdaptor
|
|
||||||
*/
|
|
||||||
|
|
||||||
DbusAdaptor::DbusAdaptor(MainWindow *parent)
|
|
||||||
: QDBusAbstractAdaptor(parent)
|
|
||||||
{
|
|
||||||
// constructor
|
|
||||||
qDBusRegisterMetaType<QMap<QString, bool> >();
|
|
||||||
qDBusRegisterMetaType<QMap<QString, int> >();
|
|
||||||
qDBusRegisterMetaType<QVector<QStringList> >();
|
|
||||||
qDBusRegisterMetaType<QMap<QString, QVector<QStringList> >>();
|
|
||||||
//setAutoRelaySignals(true)后会自动转发mainwindow发出的同名信号,因此不必再额外写一个转发
|
|
||||||
setAutoRelaySignals(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
DbusAdaptor::~DbusAdaptor()
|
|
||||||
{
|
|
||||||
// destructor
|
|
||||||
}
|
|
||||||
|
|
||||||
//无线列表
|
|
||||||
QMap<QString, QVector<QStringList> > DbusAdaptor::getWirelessList()
|
|
||||||
{
|
|
||||||
QMap<QString, QVector<QStringList> > map;
|
|
||||||
parent()->getWirelessList(map);
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DbusAdaptor::getWirelessSwitchBtnState()
|
|
||||||
{
|
|
||||||
return parent()->getWirelessSwitchBtnState();
|
|
||||||
}
|
|
||||||
|
|
||||||
//有线列表
|
|
||||||
QMap<QString, QVector<QStringList>> DbusAdaptor::getWiredList()
|
|
||||||
{
|
|
||||||
QMap<QString, QVector<QStringList>> map;
|
|
||||||
parent()->getWiredList(map);
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
//有线开关
|
|
||||||
void DbusAdaptor::setWiredSwitchEnable(bool enable)
|
|
||||||
{
|
|
||||||
//todo mainwindow调用backend 对开关 打开/关闭
|
|
||||||
if (QGSettings::isSchemaInstalled(GSETTINGS_SCHEMA_KYLIN_NM)) {
|
|
||||||
QGSettings *gsetting = new QGSettings(GSETTINGS_SCHEMA_KYLIN_NM);
|
|
||||||
if (gsetting->get(KEY_WIRED_SWITCH).toBool() != enable) {
|
|
||||||
gsetting->set(KEY_WIRED_SWITCH, enable);
|
|
||||||
}
|
|
||||||
delete gsetting;
|
|
||||||
gsetting = nullptr;
|
|
||||||
} else {
|
|
||||||
qDebug()<<"isSchemaInstalled false";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//无线开关
|
|
||||||
void DbusAdaptor::setWirelessSwitchEnable(bool enable)
|
|
||||||
{
|
|
||||||
//todo mainwindow调用backend 对开关 打开/关闭
|
|
||||||
// if (QGSettings::isSchemaInstalled(GSETTINGS_SCHEMA_KYLIN_NM)) {
|
|
||||||
// QGSettings *gsetting = new QGSettings(GSETTINGS_SCHEMA_KYLIN_NM);
|
|
||||||
// if (gsetting->get(KEY_WIRELESS_SWITCH).toBool() != enable) {
|
|
||||||
// gsetting->set(KEY_WIRELESS_SWITCH, enable);
|
|
||||||
// }
|
|
||||||
// delete gsetting;
|
|
||||||
// gsetting = nullptr;
|
|
||||||
// } else {
|
|
||||||
// qDebug()<<"isSchemaInstalled false";
|
|
||||||
// }
|
|
||||||
parent()->setWirelessSwitchEnable(enable);
|
|
||||||
}
|
|
||||||
|
|
||||||
//启用/禁用网卡
|
|
||||||
void DbusAdaptor::setDeviceEnable(QString devName, bool enable)
|
|
||||||
{
|
|
||||||
parent()->setWiredDeviceEnable(devName, enable);
|
|
||||||
}
|
|
||||||
|
|
||||||
//设置默认网卡
|
|
||||||
//void DbusAdaptor::setDefaultWiredDevice(QString deviceName)
|
|
||||||
//{
|
|
||||||
// if (!checkDeviceExist(WIRED, deviceName)) {
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// setDefaultDevice(WIRED, deviceName);
|
|
||||||
// parent()->setWiredDefaultDevice(deviceName);
|
|
||||||
// return;
|
|
||||||
//}
|
|
||||||
|
|
||||||
//QString DbusAdaptor::getDefaultWiredDevice()
|
|
||||||
//{
|
|
||||||
// QSettings * m_settings = new QSettings(CONFIG_FILE_PATH, QSettings::IniFormat);
|
|
||||||
// m_settings->beginGroup("DEFAULTCARD");
|
|
||||||
// QString key("wired");
|
|
||||||
// QString deviceName = m_settings->value(key, "").toString();
|
|
||||||
// m_settings->endGroup();
|
|
||||||
// delete m_settings;
|
|
||||||
// m_settings = nullptr;
|
|
||||||
// return deviceName;
|
|
||||||
//}
|
|
||||||
|
|
||||||
//void DbusAdaptor::setDefaultWirelessDevice(QString deviceName)
|
|
||||||
//{
|
|
||||||
// if (!checkDeviceExist(WIRED, deviceName)) {
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// setDefaultDevice(WIRELESS, deviceName);
|
|
||||||
// parent()->setWirelessDefaultDevice(deviceName);
|
|
||||||
// return;
|
|
||||||
//}
|
|
||||||
|
|
||||||
//QString DbusAdaptor::getDefaultWirelessDevice()
|
|
||||||
//{
|
|
||||||
// QSettings * m_settings = new QSettings(CONFIG_FILE_PATH, QSettings::IniFormat);
|
|
||||||
// m_settings->beginGroup("DEFAULTCARD");
|
|
||||||
// QString key("wireless");
|
|
||||||
// QString deviceName = m_settings->value(key, "").toString();
|
|
||||||
// m_settings->endGroup();
|
|
||||||
// delete m_settings;
|
|
||||||
// m_settings = nullptr;
|
|
||||||
// return deviceName;
|
|
||||||
//}
|
|
||||||
|
|
||||||
//连接 根据网卡类型 参数1 0:lan 1:wlan 参数3 为ssid/uuid
|
|
||||||
void DbusAdaptor::activateConnect(int type, QString devName, QString ssid)
|
|
||||||
{
|
|
||||||
if (type == WIRED) {
|
|
||||||
parent()->activateWired(devName,ssid);
|
|
||||||
} else if (type == WIRELESS) {
|
|
||||||
parent()->activateWireless(devName,ssid);
|
|
||||||
} else {
|
|
||||||
qDebug() << "[DbusAdaptor] activateConnect type is invalid";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//断开连接 根据网卡类型 参数1 0:lan 1:wlan 参数3 为ssid/uuid
|
|
||||||
void DbusAdaptor::deActivateConnect(int type, QString devName, QString ssid)
|
|
||||||
{
|
|
||||||
if (type == WIRED) {
|
|
||||||
qDebug() << "deactivateWired";
|
|
||||||
parent()->deactivateWired(devName,ssid);
|
|
||||||
} else if (type == WIRELESS) {
|
|
||||||
parent()->deactivateWireless(devName,ssid);
|
|
||||||
} else {
|
|
||||||
qDebug() << "[DbusAdaptor] deactivateConnect type is invalid";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//获取设备列表和启用/禁用状态
|
|
||||||
QMap<QString, bool> DbusAdaptor::getDeviceListAndEnabled(int devType)
|
|
||||||
{
|
|
||||||
QMap<QString, bool> map;
|
|
||||||
map.clear();
|
|
||||||
getDeviceEnableState(devType, map);
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
//获取无线设备能力
|
|
||||||
QMap<QString, int> DbusAdaptor::getWirelessDeviceCap()
|
|
||||||
{
|
|
||||||
QMap<QString, int> map;
|
|
||||||
parent()->getWirelessDeviceCap(map);
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
//唤起属性页 根据网卡类型 参数2 为ssid/uuid
|
|
||||||
void DbusAdaptor::showPropertyWidget(QString devName, QString ssid)
|
|
||||||
{
|
|
||||||
qDebug() << "showPropertyWidget";
|
|
||||||
parent()->showPropertyWidget(devName,ssid);
|
|
||||||
}
|
|
||||||
|
|
||||||
//唤起新建有线连接界面
|
|
||||||
void DbusAdaptor::showCreateWiredConnectWidget(QString devName)
|
|
||||||
{
|
|
||||||
qDebug() << "showCreateWiredConnectWidget";
|
|
||||||
parent()->showCreateWiredConnectWidget(devName);
|
|
||||||
}
|
|
||||||
|
|
||||||
//唤起加入其他无线网络界面
|
|
||||||
void DbusAdaptor::showAddOtherWlanWidget(QString devName)
|
|
||||||
{
|
|
||||||
qDebug() << "showAddOtherWlanWidget";
|
|
||||||
parent()->showAddOtherWlanWidget(devName);
|
|
||||||
}
|
|
||||||
|
|
||||||
//开启热点
|
|
||||||
void DbusAdaptor::activeWirelessAp(const QString apName, const QString apPassword, const QString band, const QString apDevice)
|
|
||||||
{
|
|
||||||
parent()->activeWirelessAp(apName, apPassword, band, apDevice);
|
|
||||||
}
|
|
||||||
|
|
||||||
//断开热点
|
|
||||||
void DbusAdaptor::deactiveWirelessAp(const QString apName, const QString uuid)
|
|
||||||
{
|
|
||||||
parent()->deactiveWirelessAp(apName, uuid);
|
|
||||||
}
|
|
||||||
|
|
||||||
//获取热点
|
|
||||||
QStringList DbusAdaptor::getStoredApInfo()
|
|
||||||
{
|
|
||||||
QStringList list;
|
|
||||||
list.clear();
|
|
||||||
parent()->getStoredApInfo(list);
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
//获取热点path
|
|
||||||
QString DbusAdaptor::getApConnectionPath(QString uuid)
|
|
||||||
{
|
|
||||||
QString path;
|
|
||||||
path.clear();
|
|
||||||
parent()->getApConnectionPath(path, uuid);
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
|
|
||||||
//获取热点path
|
|
||||||
QString DbusAdaptor::getActiveConnectionPath(QString uuid)
|
|
||||||
{
|
|
||||||
QString path;
|
|
||||||
path.clear();
|
|
||||||
parent()->getActiveConnectionPath(path, uuid);
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList DbusAdaptor::getApInfoBySsid(QString devName, QString ssid)
|
|
||||||
{
|
|
||||||
QStringList list;
|
|
||||||
list.clear();
|
|
||||||
parent()->getApInfoBySsid(devName, ssid, list);
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DbusAdaptor::showKylinNM(int type)
|
|
||||||
{
|
|
||||||
parent()->onShowMainWindow(type);
|
|
||||||
}
|
|
||||||
|
|
||||||
//扫描
|
|
||||||
void DbusAdaptor::reScan()
|
|
||||||
{
|
|
||||||
parent()->rescan();
|
|
||||||
}
|
|
||||||
|
|
||||||
void DbusAdaptor::keyRingInit()
|
|
||||||
{
|
|
||||||
parent()->keyRingInit();
|
|
||||||
}
|
|
||||||
|
|
||||||
void DbusAdaptor::keyRingClear()
|
|
||||||
{
|
|
||||||
parent()->keyRingClear();
|
|
||||||
}
|
|
|
@ -71,7 +71,7 @@ const QString intel = "V10SP1-edu";
|
||||||
#include <kwindowsystem.h>
|
#include <kwindowsystem.h>
|
||||||
#include <kwindowsystem_export.h>
|
#include <kwindowsystem_export.h>
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
|
MainWindow::MainWindow(QString display, QWidget *parent) : QMainWindow(parent), m_display(display)
|
||||||
{
|
{
|
||||||
firstlyStart();
|
firstlyStart();
|
||||||
}
|
}
|
||||||
|
@ -396,6 +396,26 @@ void MainWindow::initDbusConnnect()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
QDBusConnection::sessionBus().connect(QString("com.kylin.network"),
|
||||||
|
QString("/com/kylin/network"),
|
||||||
|
QString("com.kylin.network"),
|
||||||
|
QString("showKylinNMSignal"), this, SLOT(onShowKylinNMSlot(QString,int)));
|
||||||
|
|
||||||
|
QDBusConnection::sessionBus().connect(QString("com.kylin.network"),
|
||||||
|
QString("/com/kylin/network"),
|
||||||
|
QString("com.kylin.network"),
|
||||||
|
QString("showPropertyWidgetSignal"), this, SLOT(onShowPropertyWidgetSlot(QString,QString,QString)));
|
||||||
|
|
||||||
|
QDBusConnection::sessionBus().connect(QString("com.kylin.network"),
|
||||||
|
QString("/com/kylin/network"),
|
||||||
|
QString("com.kylin.network"),
|
||||||
|
QString("showCreateWiredConnectWidgetSignal"), this, SLOT(onShowCreateWiredConnectWidgetSlot(QString,QString)));
|
||||||
|
|
||||||
|
QDBusConnection::sessionBus().connect(QString("com.kylin.network"),
|
||||||
|
QString("/com/kylin/network"),
|
||||||
|
QString("com.kylin.network"),
|
||||||
|
QString("showAddOtherWlanWidgetSignal"), this, SLOT(onShowAddOtherWlanWidgetSlot(QString,QString)));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -861,13 +881,14 @@ void MainWindow::keyPressEvent(QKeyEvent *event)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief MainWindow::getWirelessList 获取wifi列表,供dbus调用
|
* @brief MainWindow::getWirelessList 获取wifi列表,供dbus调用
|
||||||
* @param map
|
* @param devName
|
||||||
|
* @param list
|
||||||
*/
|
*/
|
||||||
void MainWindow::getWirelessList(QMap<QString, QVector<QStringList> > &map)
|
void MainWindow::getWirelessList(QString devName, QList<QStringList> &list)
|
||||||
{
|
{
|
||||||
map.clear();
|
list.clear();
|
||||||
if (nullptr != m_wlanWidget) {
|
if (nullptr != m_wlanWidget) {
|
||||||
m_wlanWidget->getWirelessList(map);
|
m_wlanWidget->getWirelessList(devName, list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -882,11 +903,11 @@ bool MainWindow::getWirelessSwitchBtnState()
|
||||||
* @brief MainWindow::getWiredList 获取lan列表,供dbus调用
|
* @brief MainWindow::getWiredList 获取lan列表,供dbus调用
|
||||||
* @param map
|
* @param map
|
||||||
*/
|
*/
|
||||||
void MainWindow::getWiredList(QMap<QString, QVector<QStringList>> &map)
|
void MainWindow::getWiredList(QString devName, QList<QStringList> &list)
|
||||||
{
|
{
|
||||||
map.clear();
|
list.clear();
|
||||||
if (nullptr != m_lanWidget) {
|
if (nullptr != m_lanWidget) {
|
||||||
m_lanWidget->getWiredList(map);
|
m_lanWidget->getWiredList(devName, list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1041,3 +1062,32 @@ void MainWindow::keyRingClear()
|
||||||
{
|
{
|
||||||
agent_clear();
|
agent_clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::onShowKylinNMSlot(QString display, int type)
|
||||||
|
{
|
||||||
|
if (display == m_display) {
|
||||||
|
onShowMainWindow(type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//唤起属性页 根据网卡类型 参数2 为ssid/uuid
|
||||||
|
void MainWindow::onShowPropertyWidgetSlot(QString display, QString devName, QString ssid)
|
||||||
|
{
|
||||||
|
if (display == m_display) {
|
||||||
|
showPropertyWidget(devName, ssid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//唤起新建有线连接界面
|
||||||
|
void MainWindow::onShowCreateWiredConnectWidgetSlot(QString display, QString devName)
|
||||||
|
{
|
||||||
|
if (display == m_display) {
|
||||||
|
showCreateWiredConnectWidget(devName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//唤起加入其他无线网络界面
|
||||||
|
void MainWindow::onShowAddOtherWlanWidgetSlot(QString display, QString devName)
|
||||||
|
{
|
||||||
|
if (display == m_display) {
|
||||||
|
showAddOtherWlanWidget(devName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ class MainWindow : public QMainWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit MainWindow(QWidget *parent = nullptr);
|
explicit MainWindow(QString display, QWidget *parent = nullptr);
|
||||||
void showMainwindow();
|
void showMainwindow();
|
||||||
void hideMainwindow();
|
void hideMainwindow();
|
||||||
|
|
||||||
|
@ -69,8 +69,8 @@ public:
|
||||||
void setWirelessDefaultDevice(QString deviceName);
|
void setWirelessDefaultDevice(QString deviceName);
|
||||||
|
|
||||||
//for dbus
|
//for dbus
|
||||||
void getWirelessList(QMap<QString, QVector<QStringList> > &map);
|
void getWirelessList(QString devName, QList<QStringList> &list);
|
||||||
void getWiredList(QMap<QString, QVector<QStringList>> &map);
|
void getWiredList(QString devName, QList<QStringList> &list);
|
||||||
//开启热点
|
//开启热点
|
||||||
void activeWirelessAp(const QString apName, const QString apPassword, const QString wirelessBand, const QString apDevice);
|
void activeWirelessAp(const QString apName, const QString apPassword, const QString wirelessBand, const QString apDevice);
|
||||||
//断开热点
|
//断开热点
|
||||||
|
@ -204,6 +204,8 @@ private:
|
||||||
|
|
||||||
NetworkMode *m_networkMode;
|
NetworkMode *m_networkMode;
|
||||||
|
|
||||||
|
QString m_display;
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void onShowMainWindow(int type);
|
void onShowMainWindow(int type);
|
||||||
|
|
||||||
|
@ -221,6 +223,14 @@ private Q_SLOTS:
|
||||||
void onTimeUpdateTrayIcon();
|
void onTimeUpdateTrayIcon();
|
||||||
void onTabletModeChanged(bool mode);
|
void onTabletModeChanged(bool mode);
|
||||||
void onRefreshTrayIconTooltip();
|
void onRefreshTrayIconTooltip();
|
||||||
|
|
||||||
|
void onShowKylinNMSlot(QString display, int type);
|
||||||
|
//唤起属性页 根据网卡类型 参数2 为ssid/uuid
|
||||||
|
void onShowPropertyWidgetSlot(QString display, QString devName, QString ssid);
|
||||||
|
//唤起新建有线连接界面
|
||||||
|
void onShowCreateWiredConnectWidgetSlot(QString display, QString devName);
|
||||||
|
//唤起加入其他无线网络界面
|
||||||
|
void onShowAddOtherWlanWidgetSlot(QString display, QString devName);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MAINWINDOW_H
|
#endif // MAINWINDOW_H
|
||||||
|
|
|
@ -991,34 +991,29 @@ void LanPage::onConnectionStateChange(QString uuid,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LanPage::getWiredList(QMap<QString, QVector<QStringList> > &map)
|
void LanPage::getWiredList(QString devName, QList<QStringList> &list)
|
||||||
{
|
{
|
||||||
QStringList devlist;
|
QStringList devlist;
|
||||||
m_deviceResource->getNetworkDeviceList(NetworkManager::Device::Type::Ethernet, devlist);
|
m_deviceResource->getNetworkDeviceList(NetworkManager::Device::Type::Ethernet, devlist);
|
||||||
if (devlist.isEmpty()) {
|
if (!devlist.contains(devName)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_FOREACH (auto deviceName, devlist) {
|
QList<KyConnectItem *> activedList;
|
||||||
QList<KyConnectItem *> activedList;
|
QList<KyConnectItem *> deactivedList;
|
||||||
QList<KyConnectItem *> deactivedList;
|
m_activeResourse->getActiveConnectionList(devName,NetworkManager::ConnectionSettings::Wired,activedList);
|
||||||
QVector<QStringList> vector;
|
if (!activedList.isEmpty()) {
|
||||||
m_activeResourse->getActiveConnectionList(deviceName,NetworkManager::ConnectionSettings::Wired,activedList);
|
list.append(QStringList() << activedList.at(0)->m_connectName << activedList.at(0)->m_connectUuid << activedList.at(0)->m_connectPath);
|
||||||
if (!activedList.isEmpty()) {
|
} else {
|
||||||
vector.append(QStringList() << activedList.at(0)->m_connectName << activedList.at(0)->m_connectUuid << activedList.at(0)->m_connectPath);
|
list.append(QStringList()<<("--"));
|
||||||
} else {
|
}
|
||||||
vector.append(QStringList()<<("--"));
|
|
||||||
}
|
m_connectResourse->getConnectionList(devName, NetworkManager::ConnectionSettings::Wired, deactivedList); //未激活列表的显示
|
||||||
|
if (!deactivedList.isEmpty()) {
|
||||||
m_connectResourse->getConnectionList(deviceName, NetworkManager::ConnectionSettings::Wired, deactivedList); //未激活列表的显示
|
for (int i = 0; i < deactivedList.size(); i++) {
|
||||||
if (!deactivedList.isEmpty()) {
|
list.append(QStringList()<<deactivedList.at(i)->m_connectName<<deactivedList.at(i)->m_connectUuid << deactivedList.at(i)->m_connectPath);
|
||||||
for (int i = 0; i < deactivedList.size(); i++) {
|
}
|
||||||
vector.append(QStringList()<<deactivedList.at(i)->m_connectName<<deactivedList.at(i)->m_connectUuid << deactivedList.at(i)->m_connectPath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
map.insert(deviceName, vector);
|
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LanPage::sendLanUpdateSignal(KyConnectItem *p_connectItem)
|
void LanPage::sendLanUpdateSignal(KyConnectItem *p_connectItem)
|
||||||
|
|
|
@ -43,7 +43,7 @@ public:
|
||||||
~LanPage();
|
~LanPage();
|
||||||
|
|
||||||
//for dbus
|
//for dbus
|
||||||
void getWiredList(QMap<QString, QVector<QStringList> > &map);
|
void getWiredList(QString devName, QList<QStringList> &list);
|
||||||
void activateWired(const QString& devName, const QString& connUuid);
|
void activateWired(const QString& devName, const QString& connUuid);
|
||||||
void deactivateWired(const QString& devName, const QString& connUuid);
|
void deactivateWired(const QString& devName, const QString& connUuid);
|
||||||
void showDetailPage(QString devName, QString uuid);
|
void showDetailPage(QString devName, QString uuid);
|
||||||
|
|
|
@ -1359,72 +1359,61 @@ void WlanPage::onRefreshIconTimer()
|
||||||
}
|
}
|
||||||
|
|
||||||
//for dbus
|
//for dbus
|
||||||
void WlanPage::getWirelessList(QMap<QString, QVector<QStringList> > &map)
|
void WlanPage::getWirelessList(QString devName, QList<QStringList> &list)
|
||||||
{
|
{
|
||||||
QMap<QString,QStringList> actMap;
|
KyWirelessNetItem data;
|
||||||
m_wirelessNetResource->getWirelessActiveConnection(NetworkManager::ActiveConnection::State::Activated, actMap);
|
|
||||||
|
|
||||||
QMap<QString, QList<KyWirelessNetItem> > wlanMap;
|
QList<KyWirelessNetItem> wlanList;
|
||||||
if (!m_wirelessNetResource->getAllDeviceWifiNetwork(wlanMap)) {
|
if (!m_wirelessNetResource->getDeviceWifiNetwork(devName, wlanList)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QMap<QString, QList<KyWirelessNetItem> >::iterator iter = wlanMap.begin();
|
QString activeSsid ;
|
||||||
while (iter != wlanMap.end()) {
|
//先是已连接
|
||||||
QVector<QStringList> vector;
|
if (m_wirelessNetResource->getActiveWirelessNetItem(devName, data)) {
|
||||||
QString activeSsid ;
|
qDebug() << "find " << devName;
|
||||||
//先是已连接
|
QString ssid ="";
|
||||||
if (actMap.contains(iter.key())) {
|
m_wirelessNetResource->getSsidByUuid(data.m_connectUuid, ssid);
|
||||||
qDebug() << "find " <<iter.key();
|
if (m_wirelessNetResource->getWifiNetwork(devName, ssid, data)) {
|
||||||
KyWirelessNetItem data;
|
|
||||||
QString ssid ="";
|
|
||||||
m_wirelessNetResource->getSsidByUuid(actMap[iter.key()].at(0), ssid);
|
|
||||||
if (m_wirelessNetResource->getWifiNetwork(iter.key(), ssid, data)) {
|
|
||||||
int category = 0;
|
|
||||||
int signalStrength;
|
|
||||||
QString uni,secuType;
|
|
||||||
|
|
||||||
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
|
|
||||||
<< data.m_connectUuid
|
|
||||||
<< (m_connectResource->isApConnection(data.m_connectUuid) ? IsApConnection : NotApConnection)
|
|
||||||
<< QString::number(category));
|
|
||||||
activeSsid = data.m_NetSsid;
|
|
||||||
} else {
|
|
||||||
vector.append(QStringList("--"));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
vector.append(QStringList("--"));
|
|
||||||
}
|
|
||||||
//未连接
|
|
||||||
Q_FOREACH (auto itemData, iter.value()) {
|
|
||||||
if (itemData.m_NetSsid == activeSsid) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
int category = 0;
|
int category = 0;
|
||||||
category = itemData.getCategory(itemData.m_uni);
|
int signalStrength;
|
||||||
|
QString uni,secuType;
|
||||||
|
|
||||||
|
if (m_netDeviceResource->getActiveConnectionInfo(devName, signalStrength, uni, secuType)) {
|
||||||
|
category = data.getCategory(uni);
|
||||||
|
}
|
||||||
if (!m_showWifi6Plus && category == 2) {
|
if (!m_showWifi6Plus && category == 2) {
|
||||||
category = 1;
|
category = 1;
|
||||||
}
|
}
|
||||||
vector.append(QStringList()<<itemData.m_NetSsid
|
list.append(QStringList() << data.m_NetSsid
|
||||||
<< QString::number(itemData.m_signalStrength)
|
<< QString::number(signalStrength)
|
||||||
<< itemData.m_secuType
|
<< secuType
|
||||||
<< (m_connectResource->isApConnection(itemData.m_connectUuid) ? IsApConnection : NotApConnection)
|
<< data.m_connectUuid
|
||||||
|
<< (m_connectResource->isApConnection(data.m_connectUuid) ? IsApConnection : NotApConnection)
|
||||||
<< QString::number(category));
|
<< QString::number(category));
|
||||||
|
activeSsid = data.m_NetSsid;
|
||||||
|
} else {
|
||||||
|
list.append(QStringList("--"));
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
map.insert(iter.key(), vector);
|
list.append(QStringList("--"));
|
||||||
iter++;
|
}
|
||||||
|
//未连接
|
||||||
|
Q_FOREACH (auto itemData, wlanList) {
|
||||||
|
if (itemData.m_NetSsid == activeSsid) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
int category = 0;
|
||||||
|
category = itemData.getCategory(itemData.m_uni);
|
||||||
|
if (!m_showWifi6Plus && category == 2) {
|
||||||
|
category = 1;
|
||||||
|
}
|
||||||
|
list.append(QStringList()<<itemData.m_NetSsid
|
||||||
|
<< QString::number(itemData.m_signalStrength)
|
||||||
|
<< itemData.m_secuType
|
||||||
|
<< (m_connectResource->isApConnection(itemData.m_connectUuid) ? IsApConnection : NotApConnection)
|
||||||
|
<< QString::number(category));
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//for dbus
|
//for dbus
|
||||||
|
|
|
@ -52,7 +52,7 @@ public:
|
||||||
~WlanPage() = default;
|
~WlanPage() = default;
|
||||||
|
|
||||||
//for dbus
|
//for dbus
|
||||||
void getWirelessList(QMap<QString, QVector<QStringList> > &map);
|
void getWirelessList(QString devName, QList<QStringList> &list);
|
||||||
//开启热点
|
//开启热点
|
||||||
void activeWirelessAp(const QString apName, const QString apPassword, const QString wirelessBand, const QString apDevice);
|
void activeWirelessAp(const QString apName, const QString apPassword, const QString wirelessBand, const QString apDevice);
|
||||||
//断开热点
|
//断开热点
|
||||||
|
|
47
src/main.cpp
47
src/main.cpp
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
//#include "mainwindow.h"
|
//#include "mainwindow.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "dbusadaptor.h"
|
#include "dbus.h"
|
||||||
#include <QTranslator>
|
#include <QTranslator>
|
||||||
#include <QLocale>
|
#include <QLocale>
|
||||||
#include "qt-single-application.h"
|
#include "qt-single-application.h"
|
||||||
|
@ -125,30 +125,32 @@ int main(int argc, char *argv[])
|
||||||
parser.addOptions({swOption,snOption});
|
parser.addOptions({swOption,snOption});
|
||||||
parser.process(a);
|
parser.process(a);
|
||||||
|
|
||||||
|
QString display;
|
||||||
|
QString sessionType;
|
||||||
|
if(QString(getenv("XDG_SESSION_TYPE")) == "wayland") {
|
||||||
|
sessionType = "wayland";
|
||||||
|
display = getenv("WAYLAND_DISPLAY");
|
||||||
|
} else {
|
||||||
|
sessionType = "x11";
|
||||||
|
display = getenv("DISPLAY");
|
||||||
|
}
|
||||||
|
qDebug() << display;
|
||||||
|
|
||||||
QDBusInterface interface("com.kylin.network",
|
QDBusInterface interface("com.kylin.network",
|
||||||
"/com/kylin/network",
|
"/com/kylin/network",
|
||||||
"com.kylin.network",
|
"com.kylin.network",
|
||||||
QDBusConnection::sessionBus());
|
QDBusConnection::sessionBus());
|
||||||
if(interface.isValid()) {
|
|
||||||
if (parser.isSet(swOption))
|
if (a.isRunning()) {
|
||||||
{
|
if(interface.isValid()) {
|
||||||
interface.call(QStringLiteral("showKylinNM"), 1);
|
if (parser.isSet(swOption)) {
|
||||||
} else if (parser.isSet(snOption)){
|
interface.call(QStringLiteral("showKylinNM"), 1);
|
||||||
interface.call(QStringLiteral("showKylinNM"), 0);
|
} else if (parser.isSet(snOption)) {
|
||||||
} /*else {
|
interface.call(QStringLiteral("showKylinNM"), 0);
|
||||||
const QString serviceName = "com.kylin.network";
|
} else {
|
||||||
QDBusConnectionInterface *interface1 = QDBusConnection::sessionBus().interface();
|
|
||||||
QDBusReply<uint> pid = interface1->servicePid(serviceName);
|
|
||||||
qDebug() << "current display " << getenv("DISPLAY") << QApplication::applicationPid()
|
|
||||||
<< "exist kylin-nm display" << displayFromPid(pid.value());
|
|
||||||
if (getenv("DISPLAY") == displayFromPid(pid.value())) {
|
|
||||||
interface.call(QStringLiteral("showKylinNM"), 2);
|
interface.call(QStringLiteral("showKylinNM"), 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;*/
|
|
||||||
}
|
|
||||||
|
|
||||||
if (a.isRunning()) {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,7 +196,7 @@ int main(int argc, char *argv[])
|
||||||
::usleep(1000);
|
::usleep(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow w;
|
MainWindow w(display, nullptr);
|
||||||
a.setActivationWindow(&w);
|
a.setActivationWindow(&w);
|
||||||
w.setProperty("useStyleWindowManager", false); //禁用拖动
|
w.setProperty("useStyleWindowManager", false); //禁用拖动
|
||||||
a.setWindowIcon(QIcon::fromTheme("kylin-network"));
|
a.setWindowIcon(QIcon::fromTheme("kylin-network"));
|
||||||
|
@ -209,13 +211,8 @@ int main(int argc, char *argv[])
|
||||||
// w.setWindowFlags(Qt::CustomizeWindowHint | Qt::FramelessWindowHint /*| Qt::X11BypassWindowManagerHint*/);
|
// w.setWindowFlags(Qt::CustomizeWindowHint | Qt::FramelessWindowHint /*| Qt::X11BypassWindowManagerHint*/);
|
||||||
|
|
||||||
|
|
||||||
DbusAdaptor adaptor(&w);
|
DbusAdaptor adaptor(display, &w);
|
||||||
Q_UNUSED(adaptor);
|
Q_UNUSED(adaptor);
|
||||||
|
|
||||||
auto connection = QDBusConnection::sessionBus();
|
|
||||||
if (!connection.registerService("com.kylin.network") || !connection.registerObject("/com/kylin/network", &w)) {
|
|
||||||
qCritical() << "QDbus register service failed reason:" << connection.lastError();
|
|
||||||
}
|
|
||||||
|
|
||||||
return a.exec();
|
return a.exec();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue