Take into account the integrated filter in the DevicesModel
This commit is contained in:
parent
63bb2bda85
commit
fda4556dfc
2 changed files with 9 additions and 7 deletions
|
@ -84,10 +84,13 @@ void DevicesModel::deviceAdded(const QString& id)
|
||||||
const QModelIndex idx = index(row, 0);
|
const QModelIndex idx = index(row, 0);
|
||||||
Q_EMIT dataChanged(idx, idx);
|
Q_EMIT dataChanged(idx, idx);
|
||||||
} else {
|
} else {
|
||||||
|
DeviceDbusInterface* dev = new DeviceDbusInterface(id, this);
|
||||||
|
if (dev->isReachable() == bool(m_displayFilter & StatusReachable) && dev->isPaired() == bool(m_displayFilter & StatusPaired)) {
|
||||||
beginInsertRows(QModelIndex(), m_deviceList.count(), m_deviceList.count());
|
beginInsertRows(QModelIndex(), m_deviceList.count(), m_deviceList.count());
|
||||||
appendDevice(id);
|
appendDevice(dev);
|
||||||
endInsertRows();
|
endInsertRows();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DevicesModel::deviceRemoved(const QString& id)
|
void DevicesModel::deviceRemoved(const QString& id)
|
||||||
|
@ -152,14 +155,13 @@ void DevicesModel::receivedDeviceList(QDBusPendingCallWatcher* watcher)
|
||||||
|
|
||||||
beginInsertRows(QModelIndex(), 0, deviceIds.count()-1);
|
beginInsertRows(QModelIndex(), 0, deviceIds.count()-1);
|
||||||
Q_FOREACH(const QString& id, deviceIds) {
|
Q_FOREACH(const QString& id, deviceIds) {
|
||||||
appendDevice(id);
|
appendDevice(new DeviceDbusInterface(id, this));
|
||||||
}
|
}
|
||||||
endInsertRows();
|
endInsertRows();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DevicesModel::appendDevice(const QString& id)
|
void DevicesModel::appendDevice(DeviceDbusInterface* dev)
|
||||||
{
|
{
|
||||||
DeviceDbusInterface* dev = new DeviceDbusInterface(id, this);
|
|
||||||
m_deviceList.append(dev);
|
m_deviceList.append(dev);
|
||||||
connect(dev, SIGNAL(nameChanged(QString)), SLOT(nameChanged(QString)));
|
connect(dev, SIGNAL(nameChanged(QString)), SLOT(nameChanged(QString)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,7 +83,7 @@ Q_SIGNALS:
|
||||||
private:
|
private:
|
||||||
void clearDevices();
|
void clearDevices();
|
||||||
int rowForDeviceId(const QString& id) const;
|
int rowForDeviceId(const QString& id) const;
|
||||||
void appendDevice(const QString& id);
|
void appendDevice(DeviceDbusInterface* dev);
|
||||||
|
|
||||||
DaemonDbusInterface* m_dbusInterface;
|
DaemonDbusInterface* m_dbusInterface;
|
||||||
QVector<DeviceDbusInterface*> m_deviceList;
|
QVector<DeviceDbusInterface*> m_deviceList;
|
||||||
|
|
Loading…
Reference in a new issue