File indexing completed on 2025-01-05 04:35:36

0001 /*
0002     SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0003     SPDX-FileCopyrightText: 2020 Harald Sitter <sitter@kde.org>
0004 */
0005 
0006 #pragma once
0007 
0008 #include <QObject>
0009 
0010 enum class HelpfulAction {
0011     None,
0012     AddUserToGroup
0013 };
0014 
0015 class GroupManager : public QObject
0016 {
0017     Q_OBJECT
0018     Q_PROPERTY(QString errorText MEMBER m_errorText NOTIFY errorTextChanged)
0019     Q_PROPERTY(QString errorExplanation MEMBER m_errorExplanation NOTIFY errorExplanationChanged)
0020     Q_PROPERTY(bool hasHelpfulAction MEMBER m_hasHelpfulAction NOTIFY hasHelpfulActionChanged)
0021     Q_PROPERTY(QString helpfulActionIcon MEMBER m_helpfulActionIcon NOTIFY helpfulActionIconChanged)
0022     Q_PROPERTY(QString helpfulActionText MEMBER m_helpfulActionText NOTIFY helpfulActionTextChanged)
0023     Q_PROPERTY(bool ready MEMBER m_ready NOTIFY isReadyChanged)
0024 public:
0025     explicit GroupManager(QObject *parent = nullptr);
0026 
0027 public Q_SLOTS:
0028     void performHelpfulAction();
0029 
0030 Q_SIGNALS:
0031     void isReadyChanged();
0032     void errorTextChanged();
0033     void errorExplanationChanged();
0034     void hasHelpfulActionChanged();
0035     void helpfulActionIconChanged();
0036     void helpfulActionTextChanged();
0037     void helpfulActionError(const QString &error);
0038     void needsReboot();
0039 
0040 private:
0041     bool m_ready = false;
0042     QString m_targetGroup;
0043     QString m_user;
0044     QString m_errorText;
0045     QString m_errorExplanation;
0046     HelpfulAction m_helpfulAction;
0047     bool m_hasHelpfulAction = false;
0048     QString m_helpfulActionIcon;
0049     QString m_helpfulActionText;
0050 };