mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-24 02:42:48 +00:00
solid: check for ID_MTP_DEVICE property first in PortableMediaPlayer::supportedProtocols()
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
0ebac46482
commit
8df2371006
1 changed files with 7 additions and 9 deletions
|
@ -82,17 +82,12 @@ PortableMediaPlayer::~PortableMediaPlayer()
|
||||||
|
|
||||||
QStringList PortableMediaPlayer::supportedProtocols() const
|
QStringList PortableMediaPlayer::supportedProtocols() const
|
||||||
{
|
{
|
||||||
/* There are multiple packages that set ID_MEDIA_PLAYER:
|
// libmtp sets ID_MTP_DEVICE to numeric 1 and this always denotes MTP-compatible player
|
||||||
* * gphoto2 sets it to numeric 1 (for _some_ cameras it supports) and it hopefully
|
if (m_device->deviceProperty("ID_MTP_DEVICE").toInt() == 1) {
|
||||||
* means MTP-compatible device.
|
|
||||||
* * libmtp >= 1.0.4 sets it to numeric 1 and this always denotes MTP-compatible player.
|
|
||||||
* * media-player-info sets it to a string that denotes a name of the .mpi file with
|
|
||||||
* additional info.
|
|
||||||
*/
|
|
||||||
if (m_device->deviceProperty("ID_MEDIA_PLAYER").toInt() == 1) {
|
|
||||||
return QStringList() << "mtp";
|
return QStringList() << "mtp";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// media-player-info sets it to a string that denotes a name of the .mpi file with additional info
|
||||||
QString mpiFileName = mediaPlayerInfoFilePath();
|
QString mpiFileName = mediaPlayerInfoFilePath();
|
||||||
if (mpiFileName.isEmpty()) {
|
if (mpiFileName.isEmpty()) {
|
||||||
return QStringList();
|
return QStringList();
|
||||||
|
@ -133,7 +128,10 @@ QVariant PortableMediaPlayer::driverHandle(const QString &driver) const
|
||||||
QString PortableMediaPlayer::mediaPlayerInfoFilePath() const
|
QString PortableMediaPlayer::mediaPlayerInfoFilePath() const
|
||||||
{
|
{
|
||||||
QString relativeFilename(m_device->deviceProperty("ID_MEDIA_PLAYER"));
|
QString relativeFilename(m_device->deviceProperty("ID_MEDIA_PLAYER"));
|
||||||
if (relativeFilename.isEmpty()) {
|
if (relativeFilename.toInt() == 1) {
|
||||||
|
// not set by media-player-info
|
||||||
|
return QString();
|
||||||
|
} else if (relativeFilename.isEmpty()) {
|
||||||
qWarning() << "We attached PortableMediaPlayer interface to device" << m_device->udi()
|
qWarning() << "We attached PortableMediaPlayer interface to device" << m_device->udi()
|
||||||
<< "but m_device->deviceProperty(\"ID_MEDIA_PLAYER\") is empty???";
|
<< "but m_device->deviceProperty(\"ID_MEDIA_PLAYER\") is empty???";
|
||||||
return QString();
|
return QString();
|
||||||
|
|
Loading…
Add table
Reference in a new issue