summary refs log tree commit diff
path: root/src/ui/UIA.h
blob: fb047451ddf8eb97f3cdb04959f7da2336e7283d (plain) (blame)
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
// SPDX-FileCopyrightText: 2021 Nheko Contributors
//
// SPDX-License-Identifier: GPL-3.0-or-later

#pragma once

#include <QObject>

#include <MatrixClient.h>

class UIA : public QObject
{
    Q_OBJECT

    Q_PROPERTY(QString title READ title NOTIFY titleChanged)

public:
    static UIA *instance();

    UIA(QObject *parent = nullptr)
      : QObject(parent)
    {}

    mtx::http::UIAHandler genericHandler(QString context);

    QString title() const { return title_; }

public slots:
    void continuePassword(QString password);

signals:
    void password();

    void titleChanged();

private:
    std::optional<mtx::http::UIAHandler> currentHandler;
    mtx::user_interactive::Unauthorized currentStatus;
    QString title_;
};