File indexing completed on 2024-05-12 04:01:51

0001 /*
0002     SPDX-FileCopyrightText: 2011 Mario Bensi <mbensi@ipsquad.net>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006 
0007 #ifndef SOLID_NETWORKSHARE_H
0008 #define SOLID_NETWORKSHARE_H
0009 
0010 #include <solid/solid_export.h>
0011 
0012 #include <solid/deviceinterface.h>
0013 
0014 #include <QUrl>
0015 
0016 namespace Solid
0017 {
0018 class Device;
0019 class NetworkSharePrivate;
0020 
0021 /**
0022  * @class Solid::NetworkShare networkshare.h <Solid/NetworkShare>
0023  *
0024  * NetworkShare interface.
0025  *
0026  * a NetworkShare interface is used to determine the type of
0027  * network access.
0028  * @since 4.7
0029  */
0030 class SOLID_EXPORT NetworkShare : public DeviceInterface
0031 {
0032     Q_OBJECT
0033     Q_PROPERTY(ShareType type READ type)
0034     Q_PROPERTY(QUrl url READ url)
0035     Q_DECLARE_PRIVATE(NetworkShare)
0036     friend class Device;
0037 
0038 private:
0039     /**
0040      * Creates a new NetworkShare object.
0041      * You generally won't need this. It's created when necessary using
0042      * Device::as().
0043      *
0044      * @param backendObject the device interface object provided by the backend
0045      * @see Solid::Device::as()
0046      */
0047     SOLID_NO_EXPORT explicit NetworkShare(QObject *backendObject);
0048 
0049 public:
0050     /**
0051      * Destroys a NetworkShare object.
0052      */
0053     ~NetworkShare() override;
0054 
0055     /**
0056      * This enum type defines the type of networkShare device can be.
0057      *
0058      * - Unknown : a unsupported network protocol
0059      * - Nfs : nfs protocol
0060      * - Cifs : samba protocol
0061      * - Smb3 : samba protocol (version 3)
0062      */
0063 
0064     enum ShareType { Unknown, Nfs, Cifs, Smb3 };
0065     Q_ENUM(ShareType)
0066 
0067     /**
0068      * Get the Solid::DeviceInterface::Type of the NetworkShare device interface.
0069      *
0070      * @return the NetworkShare device interface type
0071      * @see Solid::DeviceInterface::Type
0072      */
0073     static Type deviceInterfaceType()
0074     {
0075         return DeviceInterface::NetworkShare;
0076     }
0077 
0078     /**
0079      * Retrieves the type of network share
0080      *
0081      * @return the type of network share
0082      */
0083     ShareType type() const;
0084 
0085     /**
0086      * Retrieves the url of network share
0087      *
0088      * @return the url of network share
0089      */
0090     QUrl url() const;
0091 };
0092 }
0093 
0094 #endif