IconModelRole now uses IconNameModelRole

This commit is contained in:
Albert Vaca 2015-05-17 18:48:10 -07:00
parent 519d67023c
commit 50f611f8e3

View file

@ -200,12 +200,10 @@ QVariant DevicesModel::data(const QModelIndex& index, int role) const
DeviceDbusInterface* device = m_deviceList[index.row()]; DeviceDbusInterface* device = m_deviceList[index.row()];
//FIXME: This function gets called lots of times, producing lots of dbus calls. Add a cache. //This function gets called lots of times, producing lots of dbus calls. Add a cache?
switch (role) { switch (role) {
case IconModelRole: { case IconModelRole: {
bool paired = device->isPaired(); QString icon = data(index, IconNameRole).toString();
bool reachable = device->isReachable();
QString icon = reachable? (paired? "user-online" : "user-busy") : "user-offline";
return QIcon::fromTheme(icon); return QIcon::fromTheme(icon);
} }
case IdModelRole: case IdModelRole: