File indexing completed on 2025-01-19 04:24:32
0001 /**************************************************************************************** 0002 * Copyright (c) 2009 Alejandro Wainzinger <aikawarazuni@gmail.com> * 0003 * * 0004 * This program is free software; you can redistribute it and/or modify it under * 0005 * the terms of the GNU General Public License as published by the Free Software * 0006 * Foundation; either version 2 of the License, or (at your option) any later * 0007 * version. * 0008 * * 0009 * This program is distributed in the hope that it will be useful, but WITHOUT ANY * 0010 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * 0011 * PARTICULAR PURPOSE. See the GNU General Public License for more details. * 0012 * * 0013 * You should have received a copy of the GNU General Public License along with * 0014 * this program. If not, see <http://www.gnu.org/licenses/>. * 0015 ****************************************************************************************/ 0016 0017 #include "MtpConnectionAssistant.h" 0018 #include "MtpDeviceInfo.h" 0019 0020 #include "MediaDeviceCache.h" // for mountpoint 0021 0022 #include "core/support/Debug.h" 0023 0024 #include <QString> 0025 0026 #include <solid/device.h> 0027 #include <solid/portablemediaplayer.h> 0028 0029 MtpConnectionAssistant::~MtpConnectionAssistant() 0030 { 0031 } 0032 0033 bool 0034 MtpConnectionAssistant::identify( const QString& udi ) 0035 { 0036 DEBUG_BLOCK 0037 0038 Solid::Device device; 0039 0040 device = Solid::Device( udi ); 0041 if( !device.is<Solid::PortableMediaPlayer>() ) 0042 { 0043 debug() << "Not a PMP"; 0044 return false; 0045 } 0046 0047 Solid::PortableMediaPlayer *pmp = device.as<Solid::PortableMediaPlayer>(); 0048 0049 debug() << "Supported Protocols: " << pmp->supportedProtocols(); 0050 0051 return pmp->supportedProtocols().contains( "mtp" ); 0052 } 0053 0054 0055 MediaDeviceInfo* 0056 MtpConnectionAssistant::deviceInfo( const QString& udi ) 0057 { 0058 MediaDeviceInfo* info = new MtpDeviceInfo( udi ); 0059 return info; 0060 } 0061