File indexing completed on 2024-05-05 17:01:33

0001 /***************************************************************************
0002     This class derives from QObject and encapsulates a profile item/name. 
0003     It is for use with QtQuick.
0004                              -------------------
0005     begin                : So 23 Nov 2014
0006     copyright            : (C) 2014-2019 by Alexander Reinholdt
0007     email                : alexander.reinholdt@kdemail.net
0008  ***************************************************************************/
0009 
0010 /***************************************************************************
0011  *   This program is free software; you can redistribute it and/or modify  *
0012  *   it under the terms of the GNU General Public License as published by  *
0013  *   the Free Software Foundation; either version 2 of the License, or     *
0014  *   (at your option) any later version.                                   *
0015  *                                                                         *
0016  *   This program is distributed in the hope that it will be useful, but   *
0017  *   WITHOUT ANY WARRANTY; without even the implied warranty of            *
0018  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
0019  *   General Public License for more details.                              *
0020  *                                                                         *
0021  *   You should have received a copy of the GNU General Public License     *
0022  *   along with this program; if not, write to the                         *
0023  *   Free Software Foundation, Inc., 51 Franklin Street, Suite 500, Boston,*
0024  *   MA 02110-1335, USA                                                    *
0025  ***************************************************************************/
0026 
0027 #ifndef SMB4KPROFILEOBJECT_H
0028 #define SMB4KPROFILEOBJECT_H
0029 
0030 // Qt includes
0031 #include <QObject>
0032 #include <QString>
0033 #include <QScopedPointer>
0034 
0035 // forward declarations
0036 class Smb4KProfileObjectPrivate;
0037 
0038 /**
0039  * This class derives from QObject and makes the name of a profile available
0040  * for use with QtQuick and Plasma.
0041  *
0042  * @author Alexander Reinholdt <alexander.reinholdt@kdemail.net>
0043  * @since 1.2.0
0044  */ 
0045 
0046 class Q_DECL_EXPORT Smb4KProfileObject : public QObject
0047 {
0048   Q_OBJECT
0049   Q_PROPERTY(QString profileName READ profileName WRITE setProfileName NOTIFY changed)
0050   Q_PROPERTY(bool isActiveProfile READ isActiveProfile WRITE setActiveProfile NOTIFY changed)
0051   
0052   friend class Smb4KProfileObjectPrivate;
0053   
0054   public:
0055     /**
0056      * The constructor
0057      * @param parent        The parent of this item
0058      */
0059     explicit Smb4KProfileObject(QObject *parent = 0);
0060   
0061     /**
0062      * The destructor
0063      */
0064     virtual ~Smb4KProfileObject();
0065     
0066     /**
0067      * This function returns the name of the profile.
0068      * @returns the name of the profile
0069      */
0070     QString profileName() const;
0071     
0072     /**
0073      * This function sets the name of the profile.
0074      * @param profileName   The name of the profile
0075      */
0076     void setProfileName(const QString &profileName);
0077     
0078     /**
0079      * This function returns TRUE if this is the active 
0080      * profile and FALSE otherwise.
0081      * @returns TRUE if this is the active profile.
0082      */
0083     bool isActiveProfile() const;
0084     
0085     /**
0086      * With this function you can mark this profile as the
0087      * active one.
0088      * @param active        Set this as the active profile
0089      */
0090     void setActiveProfile(bool active);
0091     
0092   Q_SIGNALS:
0093     /**
0094      * This signal is emitted if anything changed.
0095      */
0096     void changed();
0097     
0098   private:
0099     QScopedPointer<Smb4KProfileObjectPrivate> d;
0100 };
0101 
0102 #endif
0103