Skip to content

Commit

Permalink
chore: V23接口改造适配
Browse files Browse the repository at this point in the history
V23接口改造适配

Log: V23接口改造适配
Influence: 无
Task: https://pms.uniontech.com/task-view-207483.html
Change-Id: I3d5bfa9d3a2fc27440c41b5edacaebc7c3cf5fcf
  • Loading branch information
ssk-wh committed Dec 6, 2022
1 parent f5a479b commit a473734
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 27 deletions.
2 changes: 1 addition & 1 deletion dock-network-plugin/network.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"api": "2.0.0",
"primary" : true,
"depends-daemon-dbus-service": "com.deepin.daemon.Network"
"depends-daemon-dbus-service": "org.deepin.dde.Network1"
}
6 changes: 3 additions & 3 deletions dock-network-plugin/networkplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ const QString NetworkPlugin::itemCommand(const QString &itemKey)
Q_UNUSED(itemKey)
if (m_networkHelper->needShowControlCenter()) {
return QString("dbus-send --print-reply "
"--dest=com.deepin.dde.ControlCenter "
"/com/deepin/dde/ControlCenter "
"com.deepin.dde.ControlCenter.ShowModule "
"--dest=org.deepin.dde.ControlCenter1"
"/org/deepin/dde/ControlCenter1"
"org.deepin.dde.ControlCenter1.ShowModule "
"\"string:network\"");
}

Expand Down
8 changes: 4 additions & 4 deletions dss-network-plugin/network_module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ NetworkModule::NetworkModule(QObject *parent)
: QObject(parent)
, m_lastState(NetworkManager::Device::State::UnknownState)
{
QDBusConnection::sessionBus().connect("com.deepin.dde.lockFront", "/com/deepin/dde/lockFront", "com.deepin.dde.lockFront", "Visible", this, SLOT(updateLockScreenStatus(bool)));
QDBusConnection::sessionBus().connect("org.deepin.dde.LockFront1", "/org/deepin/dde/LockFront1", "org.deepin.dde.LockFront1", "Visible", this, SLOT(updateLockScreenStatus(bool)));
m_isLockModel = (-1 == qAppName().indexOf("greeter"));
if (!m_isLockModel) {
dde::network::NetworkController::setServiceType(dde::network::ServiceLoadType::LoadFromManager);
Expand All @@ -203,9 +203,9 @@ NetworkModule::NetworkModule(QObject *parent)
if (m_isLockModel) {
m_networkDialog->setServerName("dde-network-dialog" + QString::number(getuid()) + "lock");
} else {
QDBusMessage lock = QDBusMessage::createMethodCall("com.deepin.dde.LockService", "/com/deepin/dde/LockService", "com.deepin.dde.LockService", "CurrentUser");
QDBusMessage lock = QDBusMessage::createMethodCall("org.deepin.dde.LockService1", "/org/deepin/dde/LockService1", "org.deepin.dde.LockService1", "CurrentUser");
QDBusConnection::systemBus().callWithCallback(lock, this, SLOT(onUserChanged(QString)));
QDBusConnection::systemBus().connect("com.deepin.dde.LockService", "/com/deepin/dde/LockService", "com.deepin.dde.LockService", "UserChanged", this, SLOT(onUserChanged(QString)));
QDBusConnection::systemBus().connect("org.deepin.dde.LockService1", "/org/deepin/dde/LockService1", "org.deepin.dde.LockService1", "UserChanged", this, SLOT(onUserChanged(QString)));

connect(m_networkHelper, &NetworkPluginHelper::addDevice, this, &NetworkModule::onAddDevice);
for (dde::network::NetworkDeviceBase *device : dde::network::NetworkController::instance()->devices()) {
Expand Down Expand Up @@ -319,7 +319,7 @@ void NetworkModule::onUserChanged(QString json)
if (!doc.isObject())
return;
int uid = doc.object().value("Uid").toInt();
QDBusInterface user("com.deepin.daemon.Accounts", QString("/com/deepin/daemon/Accounts/User%1").arg(uid), "com.deepin.daemon.Accounts.User", QDBusConnection::systemBus());
QDBusInterface user("org.deepin.dde.Accounts1", QString("/org/deepin/dde/Accounts1/User%1").arg(uid), "org.deepin.dde.Accounts1.User", QDBusConnection::systemBus());
installTranslator(user.property("Locale").toString().split(".").first());
}

Expand Down
4 changes: 2 additions & 2 deletions src/ipconfilctchecker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
#include <networkmanagerqt/manager.h>
#include <networkmanagerqt/device.h>

const static QString networkService = "com.deepin.daemon.Network";
const static QString networkPath = "/com/deepin/daemon/Network";
const static QString networkService = "org.deepin.dde.Network1";
const static QString networkPath = "/org/deepin/dde/Network1";

using namespace dde::network;

Expand Down
22 changes: 10 additions & 12 deletions src/networkdbusproxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,22 @@
#include <QDBusPendingReply>
#include <QDebug>

const QString NetworkService = QStringLiteral("com.deepin.daemon.Network");
const QString NetworkPath = QStringLiteral("/com/deepin/daemon/Network");
const QString NetworkInterface = QStringLiteral("com.deepin.daemon.Network");
const QString NetworkService = QStringLiteral("org.deepin.dde.Network1");
const QString NetworkPath = QStringLiteral("/org/deepin/dde/Network1");
const QString NetworkInterface = QStringLiteral("org.deepin.dde.Network1");

const QString ProxyChainsService = QStringLiteral("com.deepin.daemon.Network");
const QString ProxyChainsPath = QStringLiteral("/com/deepin/daemon/Network/ProxyChains");
const QString ProxyChainsInterface = QStringLiteral("com.deepin.daemon.Network.ProxyChains");
const QString ProxyChainsService = QStringLiteral("org.deepin.dde.Network1");
const QString ProxyChainsPath = QStringLiteral("/org/deepin/dde/Network1/ProxyChains");
const QString ProxyChainsInterface = QStringLiteral("org.deepin.dde.Network1.ProxyChains");

const QString AirplaneModeService = QStringLiteral("com.deepin.daemon.AirplaneMode");
const QString AirplaneModePath = QStringLiteral("/com/deepin/daemon/AirplaneMode");
const QString AirplaneModeInterface = QStringLiteral("com.deepin.daemon.AirplaneMode");
const QString AirplaneModeService = QStringLiteral("org.deepin.dde.AirplaneMode1");
const QString AirplaneModePath = QStringLiteral("/org/deepin/dde/AirplaneMode1");
const QString AirplaneModeInterface = QStringLiteral("org.deepin.dde.AirplaneMode1");

const QString PropertiesInterface = QStringLiteral("org.freedesktop.DBus.Properties");
const QString PropertiesChanged = QStringLiteral("PropertiesChanged");
using namespace dde::network;

//"com.deepin.daemon.AirplaneMode", "/com/deepin/daemon/AirplaneMode", "com.deepin.daemon.AirplaneMode", QDBusConnection::systemBus());

NetworkDBusProxy::NetworkDBusProxy(QObject *parent)
: QObject(parent)
, m_networkInter(new DCCDBusInterface(NetworkService, NetworkPath, NetworkInterface, QDBusConnection::sessionBus(), this))
Expand Down Expand Up @@ -134,7 +132,7 @@ bool NetworkDBusProxy::enabled()

void NetworkDBusProxy::ShowPage(const QString &url)
{
QDBusMessage message = QDBusMessage::createMethodCall("com.deepin.dde.ControlCenter", "/com/deepin/dde/ControlCenter", "com.deepin.dde.ControlCenter", "ShowPage");
QDBusMessage message = QDBusMessage::createMethodCall("org.deepin.dde.ControlCenter1", "/org/deepin/dde/ControlCenter1", "org.deepin.dde.ControlCenter1", "ShowPage");
message << QVariant::fromValue(url);
QDBusConnection::sessionBus().asyncCall(message);
}
Expand Down
4 changes: 2 additions & 2 deletions src/realize/devicemanagerrealize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ DeviceManagerRealize::~DeviceManagerRealize()

bool DeviceManagerRealize::isEnabled() const
{
QDBusInterface dbusInter("com.deepin.system.Network", "/com/deepin/system/Network", "com.deepin.system.Network", QDBusConnection::systemBus());
QDBusInterface dbusInter("org.deepin.dde.Network1", "/org/deepin/dde/Network1", "org.deepin.dde.Network1", QDBusConnection::systemBus());
QDBusPendingCall reply = dbusInter.asyncCall("IsDeviceEnabled", m_wDevice->uni());
reply.waitForFinished();
QDBusPendingReply<bool> replyResult = reply.reply();
Expand Down Expand Up @@ -205,7 +205,7 @@ void DeviceManagerRealize::setEnabled(bool enabled)
bool currentEnabled = isEnabled();
if (currentEnabled != enabled) {
qInfo() << "set Device " << m_wDevice->uni() << " enabled:" << (enabled ? "true" : "false");
QDBusInterface dbusInter("com.deepin.system.Network", "/com/deepin/system/Network", "com.deepin.system.Network", QDBusConnection::systemBus());
QDBusInterface dbusInter("org.deepin.dde.Network1", "/org/deepin/dde/Network1", "org.deepin.dde.Network1", QDBusConnection::systemBus());
QDBusReply<QDBusObjectPath> reply = dbusInter.call("EnableDevice", m_wDevice->uni(), enabled);
if (enabled) {
// 如果是开启,则让其自动连接
Expand Down
6 changes: 3 additions & 3 deletions src/realize/networkmanagerprocesser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
using namespace dde::network;
using namespace NetworkManager;

const static QString networkService = "com.deepin.daemon.Network";
const static QString networkPath = "/com/deepin/daemon/Network";
const static QString networkService = "org.deepin.dde.Network1";
const static QString networkPath = "/org/deepin/dde/Network1";

NetworkManagerProcesser::NetworkManagerProcesser(QObject *parent)
: NetworkProcesser(parent)
Expand Down Expand Up @@ -76,7 +76,7 @@ void NetworkManagerProcesser::initConnections()
connect(m_ipChecker, &IPConfilctChecker::conflictStatusChanged, this, [ ] (NetworkDeviceBase *device, const bool confilct) {
Q_EMIT device->deviceStatusChanged(confilct ? DeviceStatus::IpConfilct : device->deviceStatus());
});
QDBusConnection::systemBus().connect("com.deepin.system.Network", "/com/deepin/system/Network", "com.deepin.system.Network", "DeviceEnabled", this, SLOT(onDeviceEnabledChanged(QDBusObjectPath, bool)));
QDBusConnection::systemBus().connect("org.deepin.dde.Network1", "/org/deepin/dde/Network1", "org.deepin.dde.Network1", "DeviceEnabled", this, SLOT(onDeviceEnabledChanged(QDBusObjectPath, bool)));
}

QList<NetworkDeviceBase *> NetworkManagerProcesser::devices()
Expand Down

0 comments on commit a473734

Please sign in to comment.