47
47
foreach(const Solid::Device &device, Solid::Device::listFromType(Solid::DeviceInterface::OpticalDrive)) {
48
48
kDebug() << device.udi().toLatin1().constData();
49
49
const Solid::Block *b = device.as<Solid::Block>();
50
55
const Solid::OpticalDrive *o = device.as<Solid::OpticalDrive>();
51
56
Solid::OpticalDrive::MediumTypes mediumType = o->supportedMedia();
53
url = KUrl::fromPath(b->device().toLatin1());
58
url = KUrl::fromPath(QLatin1String( b->device().toLatin1() ));
59
//TODO translate them ?
55
60
if(mediumType < Solid::OpticalDrive::Cdrw) {
61
type = QLatin1String( "CD-ROM" );
57
62
} else if(mediumType < Solid::OpticalDrive::Dvd) {
63
type = QLatin1String( "CDRW" );
59
64
} else if(mediumType < Solid::OpticalDrive::Dvdr) {
65
type = QLatin1String( "DVD-ROM" );
61
66
} else if(mediumType < Solid::OpticalDrive::Bd) {
67
type = QLatin1String( "DVDRW" );
63
68
} else if(mediumType < Solid::OpticalDrive::HdDvd) {
69
type = QLatin1String( "Blu-ray" );
66
type = "High Density DVD";
71
type = QLatin1String( "High Density DVD" );
69
74
if(!device.vendor().isEmpty())
70
name = (QString('[') + type + " - " + device.vendor() + " - " + device.product() + ']');
75
name = (QLatin1Char('[') + type + QLatin1String( " - " ) + device.vendor() + QLatin1String( " - " ) + device.product() + QLatin1Char( ']' ));
72
name = (QString('[') + type + " - unknown vendor - " + device.product() + ']');
77
name = (QLatin1Char('[') + type + QLatin1String( " - unknown vendor - " ) + device.product() + QLatin1Char( ']' ));
74
79
cdromsNameToDeviceUrl.insert(name, url);
75
80
cdromsNameToUdi.insert(name, device.udi());
100
105
QString KCompactDisc::urlToDevice(const KUrl& deviceUrl)
102
if(deviceUrl.protocol() == "media" || deviceUrl.protocol() == "system") {
107
if(deviceUrl.protocol() == QLatin1String( "media" ) || deviceUrl.protocol() == QLatin1String( "system" )) {
103
108
kDebug() << "Asking mediamanager for " << deviceUrl.fileName();
105
QDBusInterface mediamanager( "org.kde.kded", "/modules/mediamanager", "org.kde.MediaManager" );
106
QDBusReply<QStringList> reply = mediamanager.call("properties", deviceUrl.fileName());
110
QDBusInterface mediamanager( QLatin1String( "org.kde.kded" ), QLatin1String( "/modules/mediamanager" ), QLatin1String( "org.kde.MediaManager" ) );
111
QDBusReply<QStringList> reply = mediamanager.call(QLatin1String( "properties" ), deviceUrl.fileName());
108
113
QStringList properties = reply;
109
114
if(!reply.isValid() || properties.count() < 6) {
125
130
QStringList list;
132
list << QLatin1String( "phonon" )
131
133
#if defined(HAVE_LIBASOUND2)
134
<< QLatin1String( "alsa" )
134
136
#if defined(sun) || defined(__sun__)
137
<< QLatin1String( "sun" )
528
528
bool KCompactDisc::setDevice(const QString &deviceName, unsigned volume,
529
529
bool digitalPlayback, const QString &audioSystem, const QString &audioDevice)
531
QString as = digitalPlayback ? audioSystem : QString("cdin");
532
QString ad = digitalPlayback ? audioDevice : QString();
531
const QString as = digitalPlayback ? audioSystem : QLatin1String("cdin");
532
const QString ad = digitalPlayback ? audioDevice : QString();
533
533
kDebug() << "Device init: " << deviceName << ", " << as << ", " << ad;
535
if(dummy_ptr->moveInterface(deviceName, as, ad)) {
535
if(d_ptr->moveInterface(deviceName, as, ad)) {
536
536
setVolume(volume);