mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 09:23:03 +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();
|
emit devicesChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
const CollaborationDevice *CollaborationDevModel::getDevice(const QString &machinePath)
|
CollaborationDevice *CollaborationDevModel::getDevice(const QString &machinePath)
|
||||||
{
|
{
|
||||||
return m_devices.value(machinePath, nullptr);
|
return m_devices.value(machinePath, nullptr);
|
||||||
}
|
}
|
||||||
@ -138,6 +138,7 @@ CollaborationDevice::CollaborationDevice(const QString &devPath, QObject *parent
|
|||||||
, m_isPaired(false)
|
, m_isPaired(false)
|
||||||
, m_isCooperated(false)
|
, m_isCooperated(false)
|
||||||
, m_isValid(false)
|
, m_isValid(false)
|
||||||
|
, m_isCooperating(false)
|
||||||
, m_devDbusInter(new QDBusInterface(CollaborationService, devPath, CollaborationInterface + QString(".Machine"),
|
, m_devDbusInter(new QDBusInterface(CollaborationService, devPath, CollaborationInterface + QString(".Machine"),
|
||||||
QDBusConnection::sessionBus(), this))
|
QDBusConnection::sessionBus(), this))
|
||||||
{
|
{
|
||||||
@ -204,6 +205,11 @@ bool CollaborationDevice::isCooperated() const
|
|||||||
return m_isCooperated;
|
return m_isCooperated;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CollaborationDevice::setDeviceIsCooperating(bool isCooperating)
|
||||||
|
{
|
||||||
|
m_isCooperating = isCooperating;
|
||||||
|
}
|
||||||
|
|
||||||
void CollaborationDevice::onPropertyChanged(const QDBusMessage &msg)
|
void CollaborationDevice::onPropertyChanged(const QDBusMessage &msg)
|
||||||
{
|
{
|
||||||
QList<QVariant> arguments = msg.arguments();
|
QList<QVariant> arguments = msg.arguments();
|
||||||
@ -218,10 +224,12 @@ void CollaborationDevice::onPropertyChanged(const QDBusMessage &msg)
|
|||||||
if (changedProps.contains("Paired")) {
|
if (changedProps.contains("Paired")) {
|
||||||
bool isPaired = changedProps.value("Paired").value<bool>();
|
bool isPaired = changedProps.value("Paired").value<bool>();
|
||||||
m_isPaired = isPaired;
|
m_isPaired = isPaired;
|
||||||
if (isPaired) {
|
if (isPaired && m_isCooperating) {
|
||||||
// paired 成功之后再去请求cooperate
|
// paired 成功之后再去请求cooperate
|
||||||
requestCooperate();
|
requestCooperate();
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
if (!isPaired){
|
||||||
Q_EMIT pairedStateChanged(false);
|
Q_EMIT pairedStateChanged(false);
|
||||||
}
|
}
|
||||||
} else if (changedProps.contains("Cooperating")) {
|
} else if (changedProps.contains("Cooperating")) {
|
||||||
|
@ -46,7 +46,7 @@ public:
|
|||||||
void checkServiceValid();
|
void checkServiceValid();
|
||||||
|
|
||||||
QList<CollaborationDevice *> devices() const;
|
QList<CollaborationDevice *> devices() const;
|
||||||
const CollaborationDevice *getDevice(const QString &machinePath);
|
CollaborationDevice *getDevice(const QString &machinePath);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onPropertyChanged(const QDBusMessage &msg);
|
void onPropertyChanged(const QDBusMessage &msg);
|
||||||
@ -86,6 +86,7 @@ public:
|
|||||||
QString deviceIcon() const;
|
QString deviceIcon() const;
|
||||||
bool isPaired() const;
|
bool isPaired() const;
|
||||||
bool isCooperated() const;
|
bool isCooperated() const;
|
||||||
|
void setDeviceIsCooperating(bool isCooperating);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onPropertyChanged(const QDBusMessage &msg);
|
void onPropertyChanged(const QDBusMessage &msg);
|
||||||
@ -112,6 +113,9 @@ private:
|
|||||||
bool m_isCooperated;
|
bool m_isCooperated;
|
||||||
bool m_isValid;
|
bool m_isValid;
|
||||||
|
|
||||||
|
// 标记任务栏点击触发协同连接
|
||||||
|
bool m_isCooperating;
|
||||||
|
|
||||||
QDBusInterface *m_devDbusInter;
|
QDBusInterface *m_devDbusInter;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -189,11 +189,12 @@ void DevCollaborationWidget::resetWidgetSize()
|
|||||||
void DevCollaborationWidget::itemClicked(const QModelIndex &index)
|
void DevCollaborationWidget::itemClicked(const QModelIndex &index)
|
||||||
{
|
{
|
||||||
QString machinePath = index.data(DevItemDelegate::MachinePathDataRole).toString();
|
QString machinePath = index.data(DevItemDelegate::MachinePathDataRole).toString();
|
||||||
const CollaborationDevice *device = m_deviceModel->getDevice(machinePath);
|
CollaborationDevice *device = m_deviceModel->getDevice(machinePath);
|
||||||
if (!device)
|
if (!device)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!device->isPaired()) {
|
if (!device->isPaired()) {
|
||||||
|
device->setDeviceIsCooperating(true);
|
||||||
device->pair();
|
device->pair();
|
||||||
if (!m_connectingDevices.contains(machinePath))
|
if (!m_connectingDevices.contains(machinePath))
|
||||||
m_connectingDevices.append(machinePath);
|
m_connectingDevices.append(machinePath);
|
||||||
@ -217,6 +218,7 @@ void DevCollaborationWidget::itemStatusChanged()
|
|||||||
if (!device)
|
if (!device)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
device->setDeviceIsCooperating(false);
|
||||||
QString machinePath = device->machinePath();
|
QString machinePath = device->machinePath();
|
||||||
if (m_deviceItemMap.contains(machinePath) && m_deviceItemMap[machinePath]) {
|
if (m_deviceItemMap.contains(machinePath) && m_deviceItemMap[machinePath]) {
|
||||||
// 更新item的连接状态
|
// 更新item的连接状态
|
||||||
|
Loading…
x
Reference in New Issue
Block a user