File indexing completed on 2022-11-29 20:00:36

0001 /*
0002  *  SPDX-FileCopyrightText: 2019 Jonah BrĂ¼chert <jbb@kaidan.im>
0003  *  SPDX-FileCopyrightText: 2019 Simon Schmeisser <s.schmeisser@gmx.net>
0004  *  SPDX-FileCopyrightText: 2020 Nicolas Fella <nicolas.fella@gmx.de>
0005  *
0006  *  SPDX-License-Identifier: GPL-3.0-or-later
0007  */
0008 
0009 #ifndef QRCA_H
0010 #define QRCA_H
0011 
0012 #include <KAboutData>
0013 #include <Prison/ScanResult>
0014 #include <QImage>
0015 #include <QObject>
0016 #include <QUrl>
0017 #include <QVariant>
0018 
0019 class QrCodeContent;
0020 
0021 class Qrca : public QObject
0022 {
0023     Q_OBJECT
0024     Q_PROPERTY(QString encodeText READ encodeText WRITE setEncodeText NOTIFY encodeTextChanged)
0025     Q_PROPERTY(KAboutData aboutData READ aboutData WRITE setAboutData NOTIFY aboutDataChanged)
0026 
0027 public:
0028     Qrca();
0029 
0030     static Q_INVOKABLE QUrl save(const QImage &image) noexcept;
0031     static Q_INVOKABLE void saveVCard(const QString &text) noexcept;
0032     static Q_INVOKABLE QString getVCardName(const QString &text) noexcept;
0033     Q_INVOKABLE void copyToClipboard(const QrCodeContent &content) noexcept;
0034     Q_INVOKABLE bool hasApplication(const QString &appId) const;
0035     Q_INVOKABLE QString applicationIconName(const QString &appId) const;
0036     Q_INVOKABLE void openInApplication(const QrCodeContent &content, const QString &appId);
0037     Q_INVOKABLE QString wifiName(const QString &wifiSetting) const;
0038     Q_INVOKABLE bool canConnectToWifi() const;
0039     Q_INVOKABLE void connectToWifi(const QString &wifiCode);
0040     Q_INVOKABLE QrCodeContent resultContent(const Prison::ScanResult &result);
0041 
0042     QString encodeText() const noexcept;
0043     void setEncodeText(const QString &encodeText) noexcept;
0044 
0045     KAboutData aboutData() const noexcept;
0046     void setAboutData(const KAboutData &aboutData) noexcept;
0047 
0048 signals:
0049     /**
0050      * Show passive notification
0051      */
0052     void passiveNotificationRequested(QString text);
0053 
0054     void encodeTextChanged();
0055     void aboutDataChanged();
0056 
0057 private:
0058     QString m_encodeText;
0059     KAboutData m_aboutData;
0060 };
0061 
0062 #endif // QRCA_H