1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
|
/*
This class derives from QObject and encapsulates a profile item/name.
It is for use with QtQuick.
SPDX-FileCopyrightText: 2014-2021 Alexander Reinholdt <alexander.reinholdt@kdemail.net>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#ifndef SMB4KPROFILEOBJECT_H
#define SMB4KPROFILEOBJECT_H
// Qt includes
#include <QObject>
#include <QScopedPointer>
#include <QString>
// forward declarations
class Smb4KProfileObjectPrivate;
/**
* This class derives from QObject and makes the name of a profile available
* for use with QtQuick and Plasma.
*
* @author Alexander Reinholdt <alexander.reinholdt@kdemail.net>
* @since 1.2.0
*/
class Q_DECL_EXPORT Smb4KProfileObject : public QObject
{
Q_OBJECT
Q_PROPERTY(QString profileName READ profileName WRITE setProfileName NOTIFY changed)
Q_PROPERTY(bool isActiveProfile READ isActiveProfile WRITE setActiveProfile NOTIFY changed)
friend class Smb4KProfileObjectPrivate;
public:
/**
* The constructor
* @param parent The parent of this item
*/
explicit Smb4KProfileObject(QObject *parent = nullptr);
/**
* The destructor
*/
virtual ~Smb4KProfileObject();
/**
* This function returns the name of the profile.
* @returns the name of the profile
*/
QString profileName() const;
/**
* This function sets the name of the profile.
* @param profileName The name of the profile
*/
void setProfileName(const QString &profileName);
/**
* This function returns TRUE if this is the active
* profile and FALSE otherwise.
* @returns TRUE if this is the active profile.
*/
bool isActiveProfile() const;
/**
* With this function you can mark this profile as the
* active one.
* @param active Set this as the active profile
*/
void setActiveProfile(bool active);
Q_SIGNALS:
/**
* This signal is emitted if anything changed.
*/
void changed();
private:
QScopedPointer<Smb4KProfileObjectPrivate> d;
};
#endif
|