Show AccountData in Devtools
This commit is contained in:
@@ -326,6 +326,7 @@ qt_add_qml_module(neochat URI org.kde.neochat NO_PLUGIN
|
||||
qml/ShareDialog.qml
|
||||
qml/FeatureFlagPage.qml
|
||||
qml/IgnoredUsersDialog.qml
|
||||
qml/AccountData.qml
|
||||
RESOURCES
|
||||
qml/confetti.png
|
||||
qml/glowdot.png
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "neochatconnection.h"
|
||||
|
||||
#include <QImageReader>
|
||||
#include <QJsonDocument>
|
||||
|
||||
#include "controller.h"
|
||||
#include "jobs/neochatchangepasswordjob.h"
|
||||
@@ -434,4 +435,9 @@ void NeoChatConnection::setIsOnline(bool isOnline)
|
||||
Q_EMIT isOnlineChanged();
|
||||
}
|
||||
|
||||
QString NeoChatConnection::accountDataJsonString(const QString &type) const
|
||||
{
|
||||
return QString::fromUtf8(QJsonDocument(accountDataJson(type)).toJson());
|
||||
}
|
||||
|
||||
#include "moc_neochatconnection.cpp"
|
||||
|
||||
@@ -113,6 +113,11 @@ public:
|
||||
*/
|
||||
Q_INVOKABLE void openOrCreateDirectChat(Quotient::User *user);
|
||||
|
||||
/**
|
||||
* @brief Get the account data with \param type as a formatted JSON string.
|
||||
*/
|
||||
Q_INVOKABLE QString accountDataJsonString(const QString &type) const;
|
||||
|
||||
qsizetype directChatNotifications() const;
|
||||
qsizetype homeNotifications() const;
|
||||
bool directChatInvites() const;
|
||||
|
||||
35
src/qml/AccountData.qml
Normal file
35
src/qml/AccountData.qml
Normal file
@@ -0,0 +1,35 @@
|
||||
// SPDX-FileCopyrightText: 2024 Tobias Fella <tobias.fella@kde.org>
|
||||
// SPDX-License-Identifier: LGPL-2.0-or-later
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Controls as QQC2
|
||||
import QtQuick.Layouts
|
||||
|
||||
import org.kde.kirigami as Kirigami
|
||||
import org.kde.kirigamiaddons.formcard as FormCard
|
||||
|
||||
import org.kde.neochat
|
||||
|
||||
ColumnLayout {
|
||||
id: root
|
||||
|
||||
required property NeoChatConnection connection
|
||||
|
||||
FormCard.FormHeader {
|
||||
title: i18nc("@title:group", "Account Data")
|
||||
}
|
||||
FormCard.FormCard {
|
||||
Repeater {
|
||||
model: root.connection.accountDataEventTypes
|
||||
delegate: FormCard.FormButtonDelegate {
|
||||
text: modelData
|
||||
onClicked: applicationWindow().pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/MessageSourceSheet.qml", {
|
||||
sourceText: root.connection.accountDataJsonString(modelData)
|
||||
}, {
|
||||
title: i18nc("@title:window", "Event Source"),
|
||||
width: Kirigami.Units.gridUnit * 25
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,9 @@ FormCard.FormCardPage {
|
||||
QQC2.TabButton {
|
||||
text: qsTr("Server Info")
|
||||
}
|
||||
QQC2.TabButton {
|
||||
text: i18nc("@title:tab", "Account Data")
|
||||
}
|
||||
QQC2.TabButton {
|
||||
text: i18nc("@title:tab", "Feature Flags")
|
||||
}
|
||||
@@ -46,6 +49,9 @@ FormCard.FormCardPage {
|
||||
ServerData {
|
||||
connection: root.connection
|
||||
}
|
||||
AccountData {
|
||||
connection: root.connection
|
||||
}
|
||||
FeatureFlagPage {}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user