Commit d72ebc4c authored by Albert Vaca Cintora's avatar Albert Vaca Cintora

Workaround to make devices be correctly filtered again.

Flags in QML are not working correctly (as they are in Qt5), so we will
use integer values for the flags for now.
parent 4ef2a07f
......@@ -85,19 +85,14 @@ void DevicesModel::deviceStatusChanged(const QString& id)
refreshDeviceList();
}
DevicesModel::StatusFlags DevicesModel::displayFilter() const
int DevicesModel::displayFilter() const
{
return m_displayFilter;
}
void DevicesModel::setDisplayFilter(int flags)
{
setDisplayFilter((StatusFlags)flags);
}
void DevicesModel::setDisplayFilter(DevicesModel::StatusFlags flags)
{
m_displayFilter = flags;
m_displayFilter = (StatusFlag)flags;
refreshDeviceList();
}
......
......@@ -35,7 +35,7 @@ class KDECONNECTINTERFACES_EXPORT DevicesModel
: public QAbstractListModel
{
Q_OBJECT
Q_PROPERTY(StatusFlags displayFilter READ displayFilter WRITE setDisplayFilter)
Q_PROPERTY(int displayFilter READ displayFilter WRITE setDisplayFilter)
Q_PROPERTY(int count READ rowCount NOTIFY rowsChanged)
public:
......@@ -52,13 +52,14 @@ public:
StatusReachable = 0x02
};
Q_DECLARE_FLAGS(StatusFlags, StatusFlag)
Q_FLAGS(StatusFlags)
Q_ENUMS(StatusFlag)
DevicesModel(QObject *parent = 0);
virtual ~DevicesModel();
void setDisplayFilter(StatusFlags flags);
void setDisplayFilter(int flags);
StatusFlags displayFilter() const;
int displayFilter() const;
virtual QVariant data(const QModelIndex& index, int role) const;
virtual int rowCount(const QModelIndex& parent = QModelIndex()) const;
......@@ -80,7 +81,8 @@ private:
DaemonDbusInterface* m_dbusInterface;
QList<DeviceDbusInterface*> m_deviceList;
StatusFlags m_displayFilter;
};
//Q_DECLARE_OPERATORS_FOR_FLAGS(DevicesModel::StatusFlags)
#endif // DEVICESMODEL_H
......@@ -23,7 +23,7 @@ import org.kde.plasma.core 0.1 as PlasmaCore
import org.kde.plasma.components 0.1 as PlasmaComponents
import org.kde.plasma.extras 0.1 as PlasmaExtras
import org.kde.plasma.graphicswidgets 0.1 as PlasmaWidgets
import org.kde.kdeconnect 1.0 as KdeConnect
import org.kde.kdeconnect 1.0
Item {
id: kdeconnect
......@@ -66,9 +66,9 @@ Item {
flickableItem: ListView {
id: devicesView
anchors.fill: parent
model: KdeConnect.DevicesModel {
model: DevicesModel {
id: connectDeviceModel
displayFilter: StatusPaired | StatusReachable
displayFilter: 3
}
delegate: DeviceDelegate { }
onCountChanged: shouldPlasmoidBeShown()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment