Modernize AboutData registration

This commit is contained in:
Tobias Fella
2022-11-26 00:59:17 +01:00
parent 933bf1877f
commit 03f4234483
4 changed files with 4 additions and 21 deletions

View File

@@ -541,17 +541,6 @@ void Controller::markAllMessagesAsRead(Connection *conn)
}
}
void Controller::setAboutData(const KAboutData &aboutData)
{
m_aboutData = aboutData;
Q_EMIT aboutDataChanged();
}
KAboutData Controller::aboutData() const
{
return m_aboutData;
}
bool Controller::supportSystemTray() const
{
#ifdef Q_OS_ANDROID

View File

@@ -6,7 +6,6 @@
#include <QObject>
#include <QQuickItem>
#include <KAboutData>
#include <KFormat>
#include <jobs/basejob.h>
@@ -36,7 +35,6 @@ class Controller : public QObject
Q_PROPERTY(bool quitOnLastWindowClosed READ quitOnLastWindowClosed WRITE setQuitOnLastWindowClosed NOTIFY quitOnLastWindowClosedChanged)
Q_PROPERTY(Quotient::Connection *activeConnection READ activeConnection WRITE setActiveConnection NOTIFY activeConnectionChanged)
Q_PROPERTY(bool busy READ busy WRITE setBusy NOTIFY busyChanged)
Q_PROPERTY(KAboutData aboutData READ aboutData WRITE setAboutData NOTIFY aboutDataChanged)
Q_PROPERTY(bool supportSystemTray READ supportSystemTray CONSTANT)
Q_PROPERTY(bool hasWindowSystem READ hasWindowSystem CONSTANT)
Q_PROPERTY(bool isOnline READ isOnline NOTIFY isOnlineChanged)
@@ -67,9 +65,6 @@ public:
[[nodiscard]] bool busy() const;
void setBusy(bool busy);
void setAboutData(const KAboutData &aboutData);
[[nodiscard]] KAboutData aboutData() const;
[[nodiscard]] bool supportSystemTray() const;
bool saveAccessTokenToFile(const Quotient::AccountSettings &account, const QByteArray &accessToken);
@@ -122,7 +117,6 @@ private:
bool m_isOnline = true;
QMap<Quotient::Room *, int> m_notificationCounts;
KAboutData m_aboutData;
bool hasWindowSystem() const;
#ifdef QUOTIENT_07
void handleNotifications();
@@ -148,7 +142,6 @@ Q_SIGNALS:
void quitOnLastWindowClosedChanged();
void unreadCountChanged();
void activeConnectionChanged();
void aboutDataChanged();
void passwordStatus(Controller::PasswordStatus _t1);
void userConsentRequired(QUrl url);
void testConnectionResult(const QString &connection, bool usable);

View File

@@ -256,6 +256,9 @@ int main(int argc, char *argv[])
qRegisterMetaType<QVector<EmojiEntry>>("QVector<EmojiEntry>");
#endif
#endif
qmlRegisterSingletonType("org.kde.neochat", 1, 0, "About", [](QQmlEngine *engine, QJSEngine *) -> QJSValue {
return engine->toScriptValue(KAboutData::applicationData());
});
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
qRegisterMetaTypeStreamOperators<Emoji>();
@@ -274,8 +277,6 @@ int main(int argc, char *argv[])
parser.process(app);
about.processCommandLine(&parser);
Controller::instance().setAboutData(about);
engine.addImageProvider(QLatin1String("mxc"), new MatrixImageProvider);
engine.addImageProvider(QLatin1String("blurhash"), new BlurhashImageProvider);

View File

@@ -9,5 +9,5 @@ import org.kde.neochat 1.0
MobileForm.AboutPage {
title: i18nc("@title:window", "About NeoChat")
aboutData: Controller.aboutData
aboutData: About
}