void DeviceActionsDialog::setDevice(const Solid::Device &device) { m_device = device; QString label = device.vendor(); if (!label.isEmpty()) label+=' '; label+= device.product(); setWindowTitle(label); m_view.iconLabel->setPixmap(KIcon(device.icon()).pixmap(64)); m_view.descriptionLabel->setText(device.vendor()+' '+device.product()); setWindowIcon(KIcon(device.icon())); }
QVariant FilePlacesItem::deviceData(int role) const { Solid::Device d = device(); if (!d.isValid()) return QVariant(); switch (role) { case Qt::DecorationRole: return QIcon::fromTheme(d.icon()); case Qt::DisplayRole: return d.description(); case VFilePlacesModel::UrlRole: if (m_access) return QUrl::fromLocalFile(m_access->filePath()); else if (m_disc && (m_disc->availableContent() && Solid::OpticalDisc::Audio) != 0) { QString device = d.as<Solid::Block>()->device(); return QUrl(QString("audiocd:///?device=%1").arg(device)); } case VFilePlacesModel::FixedDeviceRole: { Solid::StorageDrive *drive = 0; Solid::Device parentDevice = d; while (parentDevice.isValid() && !drive) { drive = parentDevice.as<Solid::StorageDrive>(); parentDevice = parentDevice.parent(); } if (drive) return !drive->isHotpluggable() && !drive->isRemovable(); return true; } break; default: break; } return QVariant(); }