File indexing completed on 2024-04-21 05:01:42
0001 /* 0002 This class derives from QObject and encapsulates a profile item/name. 0003 It is for use with QtQuick. 0004 0005 SPDX-FileCopyrightText: 2014-2021 Alexander Reinholdt <alexander.reinholdt@kdemail.net> 0006 SPDX-License-Identifier: GPL-2.0-or-later 0007 */ 0008 0009 #ifndef SMB4KPROFILEOBJECT_H 0010 #define SMB4KPROFILEOBJECT_H 0011 0012 // Qt includes 0013 #include <QObject> 0014 #include <QScopedPointer> 0015 #include <QString> 0016 0017 // forward declarations 0018 class Smb4KProfileObjectPrivate; 0019 0020 /** 0021 * This class derives from QObject and makes the name of a profile available 0022 * for use with QtQuick and Plasma. 0023 * 0024 * @author Alexander Reinholdt <alexander.reinholdt@kdemail.net> 0025 * @since 1.2.0 0026 */ 0027 0028 class Q_DECL_EXPORT Smb4KProfileObject : public QObject 0029 { 0030 Q_OBJECT 0031 Q_PROPERTY(QString profileName READ profileName WRITE setProfileName NOTIFY changed) 0032 Q_PROPERTY(bool isActiveProfile READ isActiveProfile WRITE setActiveProfile NOTIFY changed) 0033 0034 friend class Smb4KProfileObjectPrivate; 0035 0036 public: 0037 /** 0038 * The constructor 0039 * @param parent The parent of this item 0040 */ 0041 explicit Smb4KProfileObject(QObject *parent = nullptr); 0042 0043 /** 0044 * The destructor 0045 */ 0046 virtual ~Smb4KProfileObject(); 0047 0048 /** 0049 * This function returns the name of the profile. 0050 * @returns the name of the profile 0051 */ 0052 QString profileName() const; 0053 0054 /** 0055 * This function sets the name of the profile. 0056 * @param profileName The name of the profile 0057 */ 0058 void setProfileName(const QString &profileName); 0059 0060 /** 0061 * This function returns TRUE if this is the active 0062 * profile and FALSE otherwise. 0063 * @returns TRUE if this is the active profile. 0064 */ 0065 bool isActiveProfile() const; 0066 0067 /** 0068 * With this function you can mark this profile as the 0069 * active one. 0070 * @param active Set this as the active profile 0071 */ 0072 void setActiveProfile(bool active); 0073 0074 Q_SIGNALS: 0075 /** 0076 * This signal is emitted if anything changed. 0077 */ 0078 void changed(); 0079 0080 private: 0081 QScopedPointer<Smb4KProfileObjectPrivate> d; 0082 }; 0083 0084 #endif