mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-02 15:45:21 +00:00
fix: 解决任务栏跨端协同在paired状态变化后主动请求协同连接的问题。
其他地方操作跨端协同连接导致设备paired状态变化,任务栏跨端协同功能主动请求协同连接后续操作,会导致其他地方操作pair后直接设备共享的问题。 Log: 解决任务栏跨端协同在paired状态变化后主动请求协同连接的问题。 Influence: 任务栏设备协同连接功能。 Change-Id: Ie821de0cb36ad43476c860d5b3721be5a77b0699
This commit is contained in:
parent
3e84154462
commit
e6dd4cff31
@ -126,7 +126,7 @@ void CollaborationDevModel::updateDevice(const QStringList &devPaths)
|
||||
emit devicesChanged();
|
||||
}
|
||||
|
||||
const CollaborationDevice *CollaborationDevModel::getDevice(const QString &machinePath)
|
||||
CollaborationDevice *CollaborationDevModel::getDevice(const QString &machinePath)
|
||||
{
|
||||
return m_devices.value(machinePath, nullptr);
|
||||
}
|
||||
@ -138,6 +138,7 @@ CollaborationDevice::CollaborationDevice(const QString &devPath, QObject *parent
|
||||
, m_isPaired(false)
|
||||
, m_isCooperated(false)
|
||||
, m_isValid(false)
|
||||
, m_isCooperating(false)
|
||||
, m_devDbusInter(new QDBusInterface(CollaborationService, devPath, CollaborationInterface + QString(".Machine"),
|
||||
QDBusConnection::sessionBus(), this))
|
||||
{
|
||||
@ -204,6 +205,11 @@ bool CollaborationDevice::isCooperated() const
|
||||
return m_isCooperated;
|
||||
}
|
||||
|
||||
void CollaborationDevice::setDeviceIsCooperating(bool isCooperating)
|
||||
{
|
||||
m_isCooperating = isCooperating;
|
||||
}
|
||||
|
||||
void CollaborationDevice::onPropertyChanged(const QDBusMessage &msg)
|
||||
{
|
||||
QList<QVariant> arguments = msg.arguments();
|
||||
@ -218,10 +224,12 @@ void CollaborationDevice::onPropertyChanged(const QDBusMessage &msg)
|
||||
if (changedProps.contains("Paired")) {
|
||||
bool isPaired = changedProps.value("Paired").value<bool>();
|
||||
m_isPaired = isPaired;
|
||||
if (isPaired) {
|
||||
if (isPaired && m_isCooperating) {
|
||||
// paired 成功之后再去请求cooperate
|
||||
requestCooperate();
|
||||
} else {
|
||||
}
|
||||
|
||||
if (!isPaired){
|
||||
Q_EMIT pairedStateChanged(false);
|
||||
}
|
||||
} else if (changedProps.contains("Cooperating")) {
|
||||
|
@ -46,7 +46,7 @@ public:
|
||||
void checkServiceValid();
|
||||
|
||||
QList<CollaborationDevice *> devices() const;
|
||||
const CollaborationDevice *getDevice(const QString &machinePath);
|
||||
CollaborationDevice *getDevice(const QString &machinePath);
|
||||
|
||||
private slots:
|
||||
void onPropertyChanged(const QDBusMessage &msg);
|
||||
@ -86,6 +86,7 @@ public:
|
||||
QString deviceIcon() const;
|
||||
bool isPaired() const;
|
||||
bool isCooperated() const;
|
||||
void setDeviceIsCooperating(bool isCooperating);
|
||||
|
||||
private slots:
|
||||
void onPropertyChanged(const QDBusMessage &msg);
|
||||
@ -112,6 +113,9 @@ private:
|
||||
bool m_isCooperated;
|
||||
bool m_isValid;
|
||||
|
||||
// 标记任务栏点击触发协同连接
|
||||
bool m_isCooperating;
|
||||
|
||||
QDBusInterface *m_devDbusInter;
|
||||
};
|
||||
|
||||
|
@ -189,11 +189,12 @@ void DevCollaborationWidget::resetWidgetSize()
|
||||
void DevCollaborationWidget::itemClicked(const QModelIndex &index)
|
||||
{
|
||||
QString machinePath = index.data(DevItemDelegate::MachinePathDataRole).toString();
|
||||
const CollaborationDevice *device = m_deviceModel->getDevice(machinePath);
|
||||
CollaborationDevice *device = m_deviceModel->getDevice(machinePath);
|
||||
if (!device)
|
||||
return;
|
||||
|
||||
if (!device->isPaired()) {
|
||||
device->setDeviceIsCooperating(true);
|
||||
device->pair();
|
||||
if (!m_connectingDevices.contains(machinePath))
|
||||
m_connectingDevices.append(machinePath);
|
||||
@ -217,6 +218,7 @@ void DevCollaborationWidget::itemStatusChanged()
|
||||
if (!device)
|
||||
return;
|
||||
|
||||
device->setDeviceIsCooperating(false);
|
||||
QString machinePath = device->machinePath();
|
||||
if (m_deviceItemMap.contains(machinePath) && m_deviceItemMap[machinePath]) {
|
||||
// 更新item的连接状态
|
||||
|
Loading…
x
Reference in New Issue
Block a user