File indexing completed on 2025-02-23 04:27:37
0001 /**************************************************************************************** 0002 * Copyright (c) 2006-2007 Maximilian Kossick <maximilian.kossick@googlemail.com> * 0003 * Copyright (c) 2011 Peter C. Ndikuwera <pndiku@gmail.com> * 0004 * * 0005 * This program is free software; you can redistribute it and/or modify it under * 0006 * the terms of the GNU General Public License as published by the Free Software * 0007 * Foundation; either version 2 of the License, or (at your option) any later * 0008 * version. * 0009 * * 0010 * This program is distributed in the hope that it will be useful, but WITHOUT ANY * 0011 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * 0012 * PARTICULAR PURPOSE. See the GNU General Public License for more details. * 0013 * * 0014 * You should have received a copy of the GNU General Public License along with * 0015 * this program. If not, see <http://www.gnu.org/licenses/>. * 0016 ****************************************************************************************/ 0017 0018 #ifndef SMBDEVICEHANDLER_H 0019 #define SMBDEVICEHANDLER_H 0020 0021 #include "core-impl/collections/db/MountPointManager.h" 0022 0023 class SmbDeviceHandlerFactory : public DeviceHandlerFactory 0024 { 0025 public: 0026 explicit SmbDeviceHandlerFactory( QObject *parent ) : DeviceHandlerFactory( parent ) {} 0027 ~SmbDeviceHandlerFactory() override; 0028 0029 bool canHandle( const Solid::Device &device ) const override; 0030 0031 bool canCreateFromMedium() const override; 0032 0033 DeviceHandler* createHandler( const Solid::Device &device, const QString &uuid, QSharedPointer<SqlStorage> s ) const override; 0034 0035 bool canCreateFromConfig() const override; 0036 0037 DeviceHandler* createHandler( const KSharedConfigPtr &c, QSharedPointer<SqlStorage> s ) const override; 0038 0039 QString type() const override; 0040 }; 0041 0042 /** 0043 @author Maximilian Kossick <maximilian.kossick@googlemail.com> 0044 */ 0045 class SmbDeviceHandler : public DeviceHandler 0046 { 0047 public: 0048 SmbDeviceHandler(); 0049 SmbDeviceHandler(int deviceId, const QString &mountPoint, const QString &udi ); 0050 SmbDeviceHandler(int deviceId, const QString &server, const QString &share, const QString &mountPoint, const QString &udi ); 0051 0052 ~SmbDeviceHandler() override; 0053 0054 bool isAvailable() const override; 0055 QString type() const override; 0056 int getDeviceID( ) override; 0057 const QString &getDevicePath() const override; 0058 void getURL( QUrl &absolutePath, const QUrl &relativePath ) override; 0059 void getPlayableURL( QUrl &absolutePath, const QUrl &relativePath ) override; 0060 bool deviceMatchesUdi( const QString &udi ) const override; 0061 0062 private: 0063 0064 int m_deviceID; 0065 QString m_server; 0066 QString m_share; 0067 const QString m_mountPoint; 0068 QString m_udi; 0069 0070 }; 0071 0072 #endif