diff --git a/src/main.cpp b/src/main.cpp index d8599f8ce..243cad6a9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -261,6 +261,7 @@ int main(int argc, char *argv[]) qmlRegisterUncreatableType("org.kde.neochat", 1, 0, "PushNotificationAction", "ENUM"); qmlRegisterUncreatableType("org.kde.neochat", 1, 0, "NeoChatRoomType", "ENUM"); qmlRegisterUncreatableType("org.kde.neochat", 1, 0, "NeoChatUser", {}); + qmlRegisterUncreatableType("org.kde.neochat", 1, 0, "NeoChatRoom", {}); qRegisterMetaType("User*"); qRegisterMetaType("const User*"); diff --git a/src/qml/Component/ChatBox/ChatBar.qml b/src/qml/Component/ChatBox/ChatBar.qml index f4b428513..3d624dc6f 100644 --- a/src/qml/Component/ChatBox/ChatBar.qml +++ b/src/qml/Component/ChatBox/ChatBar.qml @@ -36,7 +36,7 @@ QQC2.Control { /** * @brief The current room that user is viewing. */ - property var currentRoom + property NeoChatRoom currentRoom /** * @brief The QQC2.TextArea object. diff --git a/src/qml/Component/ChatBox/ChatBox.qml b/src/qml/Component/ChatBox/ChatBox.qml index 3648375d9..a19a8d5bb 100644 --- a/src/qml/Component/ChatBox/ChatBox.qml +++ b/src/qml/Component/ChatBox/ChatBox.qml @@ -35,7 +35,7 @@ ColumnLayout { /** * @brief The current room that user is viewing. */ - property var currentRoom + property NeoChatRoom currentRoom /** * @brief The chatBar object diff --git a/src/qml/Component/ChatBox/LocationChooser.qml b/src/qml/Component/ChatBox/LocationChooser.qml index 276b357b0..a95da91bd 100644 --- a/src/qml/Component/ChatBox/LocationChooser.qml +++ b/src/qml/Component/ChatBox/LocationChooser.qml @@ -11,10 +11,12 @@ import org.kde.kirigamiaddons.labs.components 1.0 as Components import org.kde.kirigami 2.15 as Kirigami +import org.kde.neochat 1.0 + Components.AbstractMaximizeComponent { id: root - required property var room + required property NeoChatRoom room property var location title: i18n("Choose a Location") diff --git a/src/qml/Component/InvitationView.qml b/src/qml/Component/InvitationView.qml index 4a87373ab..b0e405987 100644 --- a/src/qml/Component/InvitationView.qml +++ b/src/qml/Component/InvitationView.qml @@ -12,7 +12,7 @@ import org.kde.neochat 1.0 Kirigami.PlaceholderMessage { id: root - required property var currentRoom + required property NeoChatRoom currentRoom text: i18n("Accept this invitation?") RowLayout { @@ -32,4 +32,4 @@ Kirigami.PlaceholderMessage { } } } -} \ No newline at end of file +} diff --git a/src/qml/Component/QuickSwitcher.qml b/src/qml/Component/QuickSwitcher.qml index 9823aed2f..81e44c6de 100644 --- a/src/qml/Component/QuickSwitcher.qml +++ b/src/qml/Component/QuickSwitcher.qml @@ -89,7 +89,7 @@ QQC2.Dialog { delegate: Kirigami.BasicListItem { id: roomListItem - required property var currentRoom + required property NeoChatRoom currentRoom required property string displayName required property int index required property int notificationCount diff --git a/src/qml/Component/Timeline/MessageEditComponent.qml b/src/qml/Component/Timeline/MessageEditComponent.qml index 2a1ddc67e..b18796bc7 100644 --- a/src/qml/Component/Timeline/MessageEditComponent.qml +++ b/src/qml/Component/Timeline/MessageEditComponent.qml @@ -11,7 +11,7 @@ import org.kde.neochat 1.0 QQC2.TextArea { id: root - property var room + property NeoChatRoom room onRoomChanged: room.chatBoxEditIdChanged.connect(updateEditText) property string messageId diff --git a/src/qml/Component/TimelineView.qml b/src/qml/Component/TimelineView.qml index 418e74a68..9d6fbcd40 100644 --- a/src/qml/Component/TimelineView.qml +++ b/src/qml/Component/TimelineView.qml @@ -15,7 +15,7 @@ import org.kde.neochat 1.0 QQC2.ScrollView { id: root - required property var currentRoom + required property NeoChatRoom currentRoom readonly property bool isLoaded: root.width * root.height > 10 readonly property bool atYEnd: messageListView.atYEnd diff --git a/src/qml/Dialog/ConfirmEncryptionDialog.qml b/src/qml/Dialog/ConfirmEncryptionDialog.qml index 3e9c64893..9976be976 100644 --- a/src/qml/Dialog/ConfirmEncryptionDialog.qml +++ b/src/qml/Dialog/ConfirmEncryptionDialog.qml @@ -10,7 +10,7 @@ import org.kde.kirigami 2.15 as Kirigami QQC2.Dialog { id: confirmEncryptionDialog - property var room + property NeoChatRoom room ColumnLayout { Kirigami.Heading { diff --git a/src/qml/Dialog/PowerLevelDialog.qml b/src/qml/Dialog/PowerLevelDialog.qml index 5377137e6..9d84789c5 100644 --- a/src/qml/Dialog/PowerLevelDialog.qml +++ b/src/qml/Dialog/PowerLevelDialog.qml @@ -13,7 +13,7 @@ Kirigami.OverlaySheet { id: root title: i18n("Edit user power level") - property var room + property NeoChatRoom room property var userId property int powerLevel diff --git a/src/qml/Dialog/UserDetailDialog.qml b/src/qml/Dialog/UserDetailDialog.qml index 5d7796313..5bc838762 100644 --- a/src/qml/Dialog/UserDetailDialog.qml +++ b/src/qml/Dialog/UserDetailDialog.qml @@ -15,7 +15,7 @@ Kirigami.OverlaySheet { signal closed() - property var room + property NeoChatRoom room property var user parent: applicationWindow().overlay diff --git a/src/qml/Menu/Timeline/BanSheet.qml b/src/qml/Menu/Timeline/BanSheet.qml index 40705f28b..d3438dbd2 100644 --- a/src/qml/Menu/Timeline/BanSheet.qml +++ b/src/qml/Menu/Timeline/BanSheet.qml @@ -10,7 +10,7 @@ import org.kde.kirigami 2.20 as Kirigami Kirigami.Page { id: banSheet - property var room + property NeoChatRoom room property string userId title: i18n("Ban User") diff --git a/src/qml/Menu/Timeline/RemoveSheet.qml b/src/qml/Menu/Timeline/RemoveSheet.qml index 250a246a3..b75989d3d 100644 --- a/src/qml/Menu/Timeline/RemoveSheet.qml +++ b/src/qml/Menu/Timeline/RemoveSheet.qml @@ -10,7 +10,7 @@ import org.kde.kirigami 2.20 as Kirigami Kirigami.Page { id: deleteSheet - property var room + property NeoChatRoom room property string eventId property string userId: "" diff --git a/src/qml/Menu/Timeline/ReportSheet.qml b/src/qml/Menu/Timeline/ReportSheet.qml index 1d424292d..dbaf681ea 100644 --- a/src/qml/Menu/Timeline/ReportSheet.qml +++ b/src/qml/Menu/Timeline/ReportSheet.qml @@ -10,7 +10,7 @@ import org.kde.kirigami 2.20 as Kirigami Kirigami.Page { id: reportSheet - property var room + property NeoChatRoom room property string eventId title: i18n("Report Message") diff --git a/src/qml/Page/DevtoolsPage.qml b/src/qml/Page/DevtoolsPage.qml index fa1794cb7..974df9461 100644 --- a/src/qml/Page/DevtoolsPage.qml +++ b/src/qml/Page/DevtoolsPage.qml @@ -12,7 +12,7 @@ import org.kde.neochat 1.0 Kirigami.Page { id: devtoolsPage - property var room + property NeoChatRoom room title: i18n("Developer Tools") diff --git a/src/qml/Page/InviteUserPage.qml b/src/qml/Page/InviteUserPage.qml index 2300c72bd..398a286c8 100644 --- a/src/qml/Page/InviteUserPage.qml +++ b/src/qml/Page/InviteUserPage.qml @@ -12,7 +12,7 @@ import org.kde.neochat 1.0 Kirigami.ScrollablePage { id: root - property var room + property NeoChatRoom room title: i18n("Invite a User") diff --git a/src/qml/Page/JoinRoomPage.qml b/src/qml/Page/JoinRoomPage.qml index a59f589e9..1be0d6eee 100644 --- a/src/qml/Page/JoinRoomPage.qml +++ b/src/qml/Page/JoinRoomPage.qml @@ -28,7 +28,7 @@ Kirigami.ScrollablePage { Kirigami.SearchField { id: identifierField property bool isRoomAlias: text.match(/#(.+):(.+)/g) - property var room: isRoomAlias ? connection.roomByAlias(text) : null + property NeoChatRoom room: isRoomAlias ? connection.roomByAlias(text) : null property bool isJoined: room != null Layout.fillWidth: true diff --git a/src/qml/Page/RoomList/CollapsedRoomDelegate.qml b/src/qml/Page/RoomList/CollapsedRoomDelegate.qml index 3092d0f7a..f0e3acc87 100644 --- a/src/qml/Page/RoomList/CollapsedRoomDelegate.qml +++ b/src/qml/Page/RoomList/CollapsedRoomDelegate.qml @@ -16,7 +16,7 @@ import './' as RoomList QQC2.ItemDelegate { id: root - required property var currentRoom + required property NeoChatRoom currentRoom required property bool categoryVisible required property string filterText required property string avatar diff --git a/src/qml/Page/RoomList/ContextMenu.qml b/src/qml/Page/RoomList/ContextMenu.qml index c1fff2b26..700ef6e99 100644 --- a/src/qml/Page/RoomList/ContextMenu.qml +++ b/src/qml/Page/RoomList/ContextMenu.qml @@ -15,7 +15,7 @@ import org.kde.neochat 1.0 */ Loader { id: root - property var room + property NeoChatRoom room signal closed() Component { diff --git a/src/qml/Page/RoomList/RoomDelegate.qml b/src/qml/Page/RoomList/RoomDelegate.qml index 48fff1b3e..1702c2a8a 100644 --- a/src/qml/Page/RoomList/RoomDelegate.qml +++ b/src/qml/Page/RoomList/RoomDelegate.qml @@ -19,7 +19,7 @@ Kirigami.BasicListItem { required property int index required property int notificationCount required property int highlightCount - required property var currentRoom + required property NeoChatRoom currentRoom required property bool categoryVisible required property string filterText required property string avatar diff --git a/src/qml/Page/RoomList/SpaceListContextMenu.qml b/src/qml/Page/RoomList/SpaceListContextMenu.qml index 21b09213b..322256c59 100644 --- a/src/qml/Page/RoomList/SpaceListContextMenu.qml +++ b/src/qml/Page/RoomList/SpaceListContextMenu.qml @@ -15,7 +15,7 @@ import org.kde.neochat 1.0 */ Loader { id: root - property var room + property NeoChatRoom room signal closed() Component { diff --git a/src/qml/Page/RoomPage.qml b/src/qml/Page/RoomPage.qml index 2a07c7460..595fd9c82 100644 --- a/src/qml/Page/RoomPage.qml +++ b/src/qml/Page/RoomPage.qml @@ -16,7 +16,7 @@ Kirigami.Page { id: root /// Not readonly because of the separate window view. - property var currentRoom: RoomManager.currentRoom + property NeoChatRoom currentRoom: RoomManager.currentRoom property bool loading: !root.currentRoom || (root.currentRoom.timelineSize === 0 && !root.currentRoom.allHistoryLoaded) /// Used to determine if scrolling to the bottom should mark the message as unread property bool hasScrolledUpBefore: false; diff --git a/src/qml/Page/RoomWindow.qml b/src/qml/Page/RoomWindow.qml index 2978d3e26..6f5766796 100644 --- a/src/qml/Page/RoomWindow.qml +++ b/src/qml/Page/RoomWindow.qml @@ -7,9 +7,11 @@ import QtQuick.Layouts 1.15 import org.kde.kirigami 2.15 as Kirigami +import org.kde.neochat 1.0 + Kirigami.ApplicationWindow { id: window - required property var currentRoom + required property NeoChatRoom currentRoom minimumWidth: Kirigami.Units.gridUnit * 10 minimumHeight: Kirigami.Units.gridUnit * 15 diff --git a/src/qml/Page/SearchPage.qml b/src/qml/Page/SearchPage.qml index ed44a55d5..459178bbb 100644 --- a/src/qml/Page/SearchPage.qml +++ b/src/qml/Page/SearchPage.qml @@ -12,7 +12,7 @@ import org.kde.neochat 1.0 Kirigami.ScrollablePage { id: searchPage - property var currentRoom + property NeoChatRoom currentRoom title: i18nc("@action:title", "Search Messages") diff --git a/src/qml/Panel/RoomDrawer.qml b/src/qml/Panel/RoomDrawer.qml index 4ac842b90..c96aac6d7 100644 --- a/src/qml/Panel/RoomDrawer.qml +++ b/src/qml/Panel/RoomDrawer.qml @@ -13,7 +13,7 @@ import org.kde.neochat 1.0 Kirigami.OverlayDrawer { id: roomDrawer - readonly property var room: RoomManager.currentRoom + readonly property NeoChatRoom room: RoomManager.currentRoom width: actualWidth diff --git a/src/qml/RoomSettings/Categories.qml b/src/qml/RoomSettings/Categories.qml index 82066c93f..068a95fe4 100644 --- a/src/qml/RoomSettings/Categories.qml +++ b/src/qml/RoomSettings/Categories.qml @@ -7,7 +7,7 @@ import QtQuick.Layouts 1.15 Kirigami.CategorizedSettings { id: root - property var room + property NeoChatRoom room objectName: "settingsPage" actions: [ diff --git a/src/qml/RoomSettings/General.qml b/src/qml/RoomSettings/General.qml index 609285bc1..9b38b849a 100644 --- a/src/qml/RoomSettings/General.qml +++ b/src/qml/RoomSettings/General.qml @@ -15,7 +15,7 @@ import org.kde.neochat 1.0 Kirigami.ScrollablePage { id: root - property var room + property NeoChatRoom room title: i18n("General") diff --git a/src/qml/RoomSettings/Permissions.qml b/src/qml/RoomSettings/Permissions.qml index 2b302a5a8..496bf2da1 100644 --- a/src/qml/RoomSettings/Permissions.qml +++ b/src/qml/RoomSettings/Permissions.qml @@ -14,7 +14,7 @@ import org.kde.neochat 1.0 Kirigami.ScrollablePage { id: root - property var room + property NeoChatRoom room title: i18nc('@title:window', 'Permissions') diff --git a/src/qml/RoomSettings/PushNotification.qml b/src/qml/RoomSettings/PushNotification.qml index 5e95fe1ec..cc4b454b3 100644 --- a/src/qml/RoomSettings/PushNotification.qml +++ b/src/qml/RoomSettings/PushNotification.qml @@ -12,7 +12,7 @@ import org.kde.neochat 1.0 Kirigami.ScrollablePage { - property var room + property NeoChatRoom room title: i18nc('@title:window', 'Notifications') diff --git a/src/qml/RoomSettings/Security.qml b/src/qml/RoomSettings/Security.qml index ac183bd12..148afeb86 100644 --- a/src/qml/RoomSettings/Security.qml +++ b/src/qml/RoomSettings/Security.qml @@ -13,7 +13,7 @@ import org.kde.neochat 1.0 Kirigami.ScrollablePage { id: root - property var room + property NeoChatRoom room property string needUpgradeRoom: i18n("You need to upgrade this room to a newer version to enable this setting.") title: i18n("Security")