File indexing completed on 2024-04-14 04:56:43

0001 // SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com>
0002 // SPDX-License-Identifier: LGPL-2.1-or-later
0003 
0004 #pragma once
0005 
0006 #include "post.h"
0007 
0008 class ListEditorBackend : public QObject
0009 {
0010     Q_OBJECT
0011     QML_ELEMENT
0012 
0013     Q_PROPERTY(QString listId READ listId WRITE setListId NOTIFY listIdChanged)
0014     Q_PROPERTY(QString title MEMBER m_title NOTIFY titleChanged)
0015     Q_PROPERTY(bool exclusive MEMBER m_exclusive NOTIFY exclusiveChanged)
0016     Q_PROPERTY(bool loading READ loading NOTIFY loadingChanged)
0017 
0018 public:
0019     explicit ListEditorBackend(QObject *parent = nullptr);
0020 
0021     QString listId() const;
0022     void setListId(const QString &listId);
0023 
0024     bool loading() const;
0025 
0026 public Q_SLOTS:
0027     void submit();
0028     void deleteList();
0029     QStringList replyPolicies();
0030     int replyPolicyIndex() const;
0031     void setReplyPolicyIndex(int index);
0032 
0033 Q_SIGNALS:
0034     void listIdChanged();
0035     void titleChanged();
0036     void exclusiveChanged();
0037     void done();
0038     void loadingChanged();
0039 
0040 private:
0041     QString m_listId;
0042     QString m_title;
0043     QString m_repliesPolicy = QStringLiteral("none");
0044     bool m_exclusive = false;
0045     bool m_loading = false;
0046 };