1 /*************************************************************************** 2 This class derives from QObject and encapsulates a profile item/name. 3 It is for use with QtQuick. 4 ------------------- 5 begin : So 23 Nov 2014 6 copyright : (C) 2014-2019 by Alexander Reinholdt 7 email : alexander.reinholdt@kdemail.net 8 ***************************************************************************/ 9 10 /*************************************************************************** 11 * This program is free software; you can redistribute it and/or modify * 12 * it under the terms of the GNU General Public License as published by * 13 * the Free Software Foundation; either version 2 of the License, or * 14 * (at your option) any later version. * 15 * * 16 * This program is distributed in the hope that it will be useful, but * 17 * WITHOUT ANY WARRANTY; without even the implied warranty of * 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 19 * General Public License for more details. * 20 * * 21 * You should have received a copy of the GNU General Public License * 22 * along with this program; if not, write to the * 23 * Free Software Foundation, Inc., 51 Franklin Street, Suite 500, Boston,* 24 * MA 02110-1335, USA * 25 ***************************************************************************/ 26 27 #ifndef SMB4KPROFILEOBJECT_H 28 #define SMB4KPROFILEOBJECT_H 29 30 // Qt includes 31 #include <QObject> 32 #include <QString> 33 #include <QScopedPointer> 34 35 // forward declarations 36 class Smb4KProfileObjectPrivate; 37 38 /** Smb4KProfileObject(QObject * parent)39 * This class derives from QObject and makes the name of a profile available 40 * for use with QtQuick and Plasma. 41 * 42 * @author Alexander Reinholdt <alexander.reinholdt@kdemail.net> 43 * @since 1.2.0 44 */ 45 46 class Q_DECL_EXPORT Smb4KProfileObject : public QObject 47 { 48 Q_OBJECT 49 Q_PROPERTY(QString profileName READ profileName WRITE setProfileName NOTIFY changed) 50 Q_PROPERTY(bool isActiveProfile READ isActiveProfile WRITE setActiveProfile NOTIFY changed) 51 52 friend class Smb4KProfileObjectPrivate; 53 54 public: 55 /** 56 * The constructor 57 * @param parent The parent of this item 58 */ 59 explicit Smb4KProfileObject(QObject *parent = 0); 60 61 /** 62 * The destructor 63 */ 64 virtual ~Smb4KProfileObject(); 65 66 /** 67 * This function returns the name of the profile. 68 * @returns the name of the profile 69 */ 70 QString profileName() const; 71 72 /** 73 * This function sets the name of the profile. 74 * @param profileName The name of the profile 75 */ 76 void setProfileName(const QString &profileName); 77 78 /** 79 * This function returns TRUE if this is the active 80 * profile and FALSE otherwise. 81 * @returns TRUE if this is the active profile. 82 */ 83 bool isActiveProfile() const; 84 85 /** 86 * With this function you can mark this profile as the 87 * active one. 88 * @param active Set this as the active profile 89 */ 90 void setActiveProfile(bool active); 91 92 Q_SIGNALS: 93 /** 94 * This signal is emitted if anything changed. 95 */ 96 void changed(); 97 98 private: 99 QScopedPointer<Smb4KProfileObjectPrivate> d; 100 }; 101 102 #endif 103 104