From 63f0675169c7e773c18fcf800b7ebd1e2c1be873 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= Date: Sun, 31 Dec 2017 10:54:35 +0100 Subject: kscd: Fix device detection from Media Manager Commit d36f6096 in tdebase has changed the order of items in the device properties returned by Media Manager. The indexes of items used in kscd must be consistent with tdebase. This resolves Bug 2834 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Slávek Banko --- kscd/configWidget.cpp | 23 ++++++++++++++--------- kscd/kcompactdisc.cpp | 11 +++++------ 2 files changed, 19 insertions(+), 15 deletions(-) (limited to 'kscd') diff --git a/kscd/configWidget.cpp b/kscd/configWidget.cpp index 3a1ceff5..3cde9992 100644 --- a/kscd/configWidget.cpp +++ b/kscd/configWidget.cpp @@ -119,16 +119,21 @@ void configWidget::getMediaDevices() TQStringList::const_iterator it = list.begin(); TQStringList::const_iterator itEnd = list.end(); // it would be much better if libmediacommon was in tdelibs + // see tdebase/tdeioslave/media/libmediacommon/medium.h while (it != itEnd) { - it++; - if (it == itEnd) break; - TQString url="media:/"+(*it); // is it always right? ervin? - kdDebug() << "checking " << url << endl; - for (int i=0;i<9;i++) ++it; // go to mimetype (MIME_TYPE-NAME from medium.h) - kdDebug() << "Mime: " << *it << endl; - if (it!=itEnd && (*it)=="media/audiocd") { - kcfg_cdDevice->comboBox()->insertItem(url); - } + TQString url; + for ( int i = 0; i<12 && it != itEnd; i++, ++it ) { + if (i == 2) { // NAME + url = "media:/"+(*it); + kdDebug() << "checking " << url << endl; + } + if (i == 11) { // MIME_TYPE + kdDebug() << "Mime: " << *it << endl; + if ((*it)=="media/audiocd") { + kcfg_cdDevice->comboBox()->insertItem(url); + } + } + } while (it !=itEnd && (*it)!="---") ++it; // go to end of current device's properties ++it; } diff --git a/kscd/kcompactdisc.cpp b/kscd/kcompactdisc.cpp index debfc6e3..839a6577 100644 --- a/kscd/kcompactdisc.cpp +++ b/kscd/kcompactdisc.cpp @@ -241,15 +241,14 @@ TQString TDECompactDisc::urlToDevice(const TQString& device) DCOPRef mediamanager("kded", "mediamanager"); DCOPReply reply = mediamanager.call("properties(TQString)", deviceUrl.fileName()); TQStringList properties = reply; - if (!reply.isValid() || properties.count() < 6) - { + if (!reply.isValid() || properties.count() < 7 ) { kdError() << "Invalid reply from mediamanager" << endl; return defaultDevice; } - else - { - kdDebug() << "Reply from mediamanager " << properties[5] << endl; - return properties[5]; + else { + /* see DEVICE_NODE in tdebase/tdeioslave/media/libmediacommon/medium.h */ + kdDebug() << "Reply from mediamanager " << properties[6] << endl; + return properties[6]; } } -- cgit v1.2.1