| 199 | } |
| 200 | |
| 201 | QVariant DeviceModel::deviceField(const QModelIndex &index, |
| 202 | const QString &field) const { |
| 203 | if (!index.isValid()) |
| 204 | return {}; |
| 205 | Node *n = nodeFor(index); |
| 206 | if (n->type != DeviceNode || !n->device) |
| 207 | return {}; |
| 208 | const auto &d = *n->device; |
| 209 | if (field == "name") return d.name; |
| 210 | if (field == "status") return d.status; |
| 211 | if (field == "manufacturer") return d.manufacturer; |
| 212 | if (field == "driver") return d.driver; |
| 213 | if (field == "driverVersion") return d.driverVersion; |
| 214 | if (field == "driverDate") return d.driverDate; |
| 215 | if (field == "driverAuthor") return d.driverAuthor; |
| 216 | if (field == "location") return d.location; |
| 217 | if (field == "iconName") return d.disabled ? QStringLiteral("computer") : d.iconName; |
| 218 | if (field == "disabled") return d.disabled; |
| 219 | if (field == "isDkms") return d.isDkms; |
| 220 | if (field == "rawLocation") return d.rawLocation; |
| 221 | if (field == "sysfsPciPath") return d.sysfsPciPath; |
| 222 | if (field == "btAddress") return d.btAddress; |
| 223 | if (field == "noDriverNeeded") return d.noDriverNeeded; |
| 224 | if (field == "deviceType") { |
| 225 | if (n->parent && (n->parent->type == CategoryNode |
| 226 | || n->parent->type == DisabledCategoryNode)) |
| 227 | return n->parent->label; |
| 228 | return QStringLiteral("Hardware device"); |
| 229 | } |
| 230 | return {}; |
| 231 | } |
no outgoing calls
no test coverage detected