| 1 |
/**************************************************************************************** |
| 2 |
* Copyright (c) 2009 Alejandro Wainzinger <[email protected]> * |
| 3 |
* * |
| 4 |
* This program is free software; you can redistribute it and/or modify it under * |
| 5 |
* the terms of the GNU General Public License as published by the Free Software * |
| 6 |
* Foundation; either version 2 of the License, or (at your option) any later * |
| 7 |
* version. * |
| 8 |
* * |
| 9 |
* This program is distributed in the hope that it will be useful, but WITHOUT ANY * |
| 10 |
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * |
| 11 |
* PARTICULAR PURPOSE. See the GNU General Public License for more details. * |
| 12 |
* * |
| 13 |
* You should have received a copy of the GNU General Public License along with * |
| 14 |
* this program. If not, see <http://www.gnu.org/licenses/>. * |
| 15 |
****************************************************************************************/ |
| 16 |
|
| 17 |
#include "MtpConnectionAssistant.h" |
| 18 |
#include "MtpDeviceInfo.h" |
| 19 |
|
| 20 |
#include "MediaDeviceCache.h" // for mountpoint |
| 21 |
|
| 22 |
#include "core/support/Debug.h" |
| 23 |
|
| 24 |
#include <QString> |
| 25 |
|
| 26 |
#include <solid/device.h> |
| 27 |
#include <solid/portablemediaplayer.h> |
| 28 |
|
| 29 |
MtpConnectionAssistant::~MtpConnectionAssistant() |
| 30 |
{ |
| 31 |
} |
| 32 |
|
| 33 |
bool |
| 34 |
MtpConnectionAssistant::identify( const QString& udi ) |
| 35 |
{ |
| 36 |
DEBUG_BLOCK |
| 37 |
|
| 38 |
Solid::Device device; |
| 39 |
|
| 40 |
device = Solid::Device( udi ); |
| 41 |
if( !device.is<Solid::PortableMediaPlayer>() ) |
| 42 |
{ |
| 43 |
debug() << "Not a PMP"; |
| 44 |
return false; |
| 45 |
} |
| 46 |
|
| 47 |
Solid::PortableMediaPlayer *pmp = device.as<Solid::PortableMediaPlayer>(); |
| 48 |
|
| 49 |
debug() << "Supported Protocols: " << pmp->supportedProtocols(); |
| 50 |
|
| 51 |
return pmp->supportedProtocols().contains( QStringLiteral("mtp") ); |
| 52 |
} |
| 53 |
|
| 54 |
|
| 55 |
MediaDeviceInfo* |
| 56 |
MtpConnectionAssistant::deviceInfo( const QString& udi ) |
| 57 |
{ |
| 58 |
MediaDeviceInfo* info = new MtpDeviceInfo( udi ); |
| 59 |
return info; |
| 60 |
} |
| 61 |
|