Compare commits

...

1 Commits

Author SHA1 Message Date
Tobias Fella
cd70e2b47f Annotate functions in connections and port away from implicit onFoo 2025-08-08 11:16:27 +02:00
26 changed files with 52 additions and 52 deletions

View File

@@ -59,7 +59,7 @@ ApplicationWindow {
Connections { Connections {
target: mapView.map target: mapView.map
function onCopyrightLinkActivated() { function onCopyrightLinkActivated(link: string): void {
Qt.openUrlExternally(link); Qt.openUrlExternally(link);
} }
} }

View File

@@ -60,21 +60,21 @@ Kirigami.ApplicationWindow {
Connections { Connections {
target: LoginHelper target: LoginHelper
function onLoaded() { function onLoaded(): void {
root.load(); root.load();
} }
} }
Connections { Connections {
target: Registration target: Registration
function onLoaded() { function onLoaded(): void {
root.load(); root.load();
} }
} }
Connections { Connections {
target: root.quitAction target: root.quitAction
function onTriggered() { function onTriggered(): void {
Qt.quit(); Qt.quit();
} }
} }
@@ -98,7 +98,7 @@ Kirigami.ApplicationWindow {
Connections { Connections {
target: RoomManager target: RoomManager
function onCurrentRoomChanged() { function onCurrentRoomChanged(): void {
if (RoomManager.currentRoom && pageStack.depth <= 1 && root.initialized && Kirigami.Settings.isMobile) { if (RoomManager.currentRoom && pageStack.depth <= 1 && root.initialized && Kirigami.Settings.isMobile) {
let roomPage = pageStack.layers.push(Qt.createComponent('org.kde.neochat', 'RoomPage')); let roomPage = pageStack.layers.push(Qt.createComponent('org.kde.neochat', 'RoomPage'));
roomPage.backRequested.connect(event => { roomPage.backRequested.connect(event => {
@@ -107,31 +107,31 @@ Kirigami.ApplicationWindow {
} }
} }
function onAskJoinRoom(room) { function onAskJoinRoom(room: NeoChatRoom): void {
Qt.createComponent("org.kde.neochat", "JoinRoomDialog").createObject(root, { Qt.createComponent("org.kde.neochat", "JoinRoomDialog").createObject(root, {
room: room, room: room,
connection: root.connection connection: root.connection
}).open(); }).open();
} }
function onShowUserDetail(user, room) { function onShowUserDetail(user, room: NeoChatRoom): void {
root.showUserDetail(user, room); root.showUserDetail(user, room);
} }
function goToEvent(event) { function goToEvent(event: string): void {
if (event.length > 0) { if (event.length > 0) {
roomItem.goToEvent(event); roomItem.goToEvent(event);
} }
roomItem.forceActiveFocus(); roomItem.forceActiveFocus();
} }
function onAskDirectChatConfirmation(user) { function onAskDirectChatConfirmation(user): void {
Qt.createComponent("org.kde.neochat", "AskDirectChatConfirmation").createObject(this, { Qt.createComponent("org.kde.neochat", "AskDirectChatConfirmation").createObject(this, {
user: user user: user
}).open(); }).open();
} }
function onExternalUrl(url) { function onExternalUrl(url): void {
let dialog = Qt.createComponent("org.kde.neochat", "ConfirmUrlDialog").createObject(this); let dialog = Qt.createComponent("org.kde.neochat", "ConfirmUrlDialog").createObject(this);
dialog.link = url; dialog.link = url;
dialog.open(); dialog.open();

View File

@@ -72,7 +72,7 @@ Components.AlbumMaximizeComponent {
Connections { Connections {
target: MediaManager target: MediaManager
function onPlaybackStarted() { function onPlaybackStarted(): void {
if (currentItem.playbackState === MediaPlayer.PlayingState) { if (currentItem.playbackState === MediaPlayer.PlayingState) {
currentItem.pause(); currentItem.pause();
} }
@@ -82,7 +82,7 @@ Components.AlbumMaximizeComponent {
Connections { Connections {
target: currentRoom target: currentRoom
function onFileTransferProgress(id, progress, total) { function onFileTransferProgress(id: string, progress: int, total: int): void {
if (id == root.currentEventId) { if (id == root.currentEventId) {
root.downloadAction.progress = progress / total * 100.0; root.downloadAction.progress = progress / total * 100.0;
} }
@@ -130,7 +130,7 @@ Components.AlbumMaximizeComponent {
Connections { Connections {
target: RoomManager target: RoomManager
function onCloseFullScreen() { function onCloseFullScreen(): void {
root.close(); root.close();
} }
} }

View File

@@ -22,7 +22,7 @@ Kirigami.Page {
Connections { Connections {
target: root.QQC2.ApplicationWindow.window target: root.QQC2.ApplicationWindow.window
function onClosing() { function onClosing(): void {
root.destroy(); root.destroy();
} }
} }

View File

@@ -80,7 +80,7 @@ Kirigami.Page {
Connections { Connections {
target: root.currentRoom.connection target: root.currentRoom.connection
function onIsOnlineChanged() { function onIsOnlineChanged(): void {
if (!root.currentRoom.connection.isOnline) { if (!root.currentRoom.connection.isOnline) {
banner.text = i18nc("@info:status", "NeoChat is offline. Please check your network connection."); banner.text = i18nc("@info:status", "NeoChat is offline. Please check your network connection.");
banner.visible = true; banner.visible = true;
@@ -162,20 +162,20 @@ Kirigami.Page {
Connections { Connections {
target: RoomManager target: RoomManager
function onCurrentRoomChanged() { function onCurrentRoomChanged(): void {
if (root.currentRoom && root.currentRoom.isInvite) { if (root.currentRoom && root.currentRoom.isInvite) {
Controller.clearInvitationNotification(root.currentRoom.id); Controller.clearInvitationNotification(root.currentRoom.id);
} }
} }
function onGoToEvent(eventId) { function onGoToEvent(eventId: string): void {
(timelineViewLoader.item as TimelineView).goToEvent(eventId); (timelineViewLoader.item as TimelineView).goToEvent(eventId);
} }
} }
Connections { Connections {
target: root.currentRoom.connection target: root.currentRoom.connection
function onJoinedRoom(room, invited) { function onJoinedRoom(room: NeoChatRoom, invited: NeoChatRoom): void {
if (root.currentRoom.id === invited.id) { if (root.currentRoom.id === invited.id) {
RoomManager.resolveResource(room.id); RoomManager.resolveResource(room.id);
} }
@@ -195,13 +195,13 @@ Kirigami.Page {
Connections { Connections {
target: RoomManager target: RoomManager
function onShowMessage(messageType, message) { function onShowMessage(messageType: Kirigami.MessageType, message: string): void {
banner.text = message; banner.text = message;
banner.type = messageType; banner.type = messageType;
banner.visible = true; banner.visible = true;
} }
function onShowEventSource(eventId) { function onShowEventSource(eventId: string): void {
(root.Kirigami.PageStack.pageStack as Kirigami.PageRow).pushDialogLayer(Qt.createComponent('org.kde.neochat', 'MessageSourceSheet'), { (root.Kirigami.PageStack.pageStack as Kirigami.PageRow).pushDialogLayer(Qt.createComponent('org.kde.neochat', 'MessageSourceSheet'), {
sourceText: root.currentRoom.getEventJsonSource(eventId) sourceText: root.currentRoom.getEventJsonSource(eventId)
}, { }, {
@@ -210,7 +210,7 @@ Kirigami.Page {
}); });
} }
function onShowMessageMenu(eventId, author, messageComponentType, plainText, htmlText, selectedText, hoveredLink, isThread) { function onShowMessageMenu(eventId: string, author, messageComponentType, plainText: string, htmlText: string, selectedText: string, hoveredLink: string, isThread: bool): void {
const contextMenu = messageDelegateContextMenu.createObject(root, { const contextMenu = messageDelegateContextMenu.createObject(root, {
selectedText: selectedText, selectedText: selectedText,
hoveredLink: hoveredLink, hoveredLink: hoveredLink,

View File

@@ -177,7 +177,7 @@ QQC2.ComboBox {
Connections { Connections {
target: serverListModel target: serverListModel
function onServerCheckComplete(url, valid) { function onServerCheckComplete(url: string, valid: bool): void {
if (url == serverUrlField.text && valid) { if (url == serverUrlField.text && valid) {
serverUrlField.isValidServer = true; serverUrlField.isValidServer = true;
} }

View File

@@ -25,7 +25,7 @@ QQC2.Popup {
Connections { Connections {
target: RoomManager target: RoomManager
function onCurrentRoomChanged() { function onCurrentRoomChanged(): void {
root.close(); root.close();
} }
} }

View File

@@ -100,7 +100,7 @@ Kirigami.Page {
} }
Connections { Connections {
target: selectionTool.selectionArea target: selectionTool.selectionArea
function onDoubleClicked() { function onDoubleClicked(): void {
rootEditorView.crop(); rootEditorView.crop();
} }
} }

View File

@@ -39,7 +39,7 @@ LoginStep {
Connections { Connections {
target: Registration target: Registration
function onConnected(connection): void { function onConnected(connection: NeoChatConnection): void {
root.processed("Loading"); root.processed("Loading");
} }
} }

View File

@@ -23,7 +23,7 @@ LoginStep {
Connections { Connections {
target: Controller target: Controller
function onConnectionAdded(connection) { function onConnectionAdded(connection: NeoChatConnection): void {
connection.syncDone.connect(() => root.closeDialog()); connection.syncDone.connect(() => root.closeDialog());
} }
} }

View File

@@ -14,7 +14,7 @@ LoginStep {
Connections { Connections {
target: LoginHelper target: LoginHelper
function onConnected() { function onConnected(): void {
processed("Loading"); processed("Loading");
} }
} }

View File

@@ -18,10 +18,10 @@ LoginStep {
Connections { Connections {
target: LoginHelper target: LoginHelper
function onSsoUrlChanged() { function onSsoUrlChanged(): void {
UrlHelper.openUrl(LoginHelper.ssoUrl); UrlHelper.openUrl(LoginHelper.ssoUrl);
} }
function onConnected() { function onConnected(): void {
processed("Loading"); processed("Loading");
} }
} }

View File

@@ -214,7 +214,7 @@ Kirigami.Page {
Connections { Connections {
target: Registration target: Registration
function onNextStepChanged() { function onNextStepChanged(): void {
if (Registration.nextStep === "m.login.recaptcha") { if (Registration.nextStep === "m.login.recaptcha") {
stepConnections.onProcessed("Captcha"); stepConnections.onProcessed("Captcha");
} }
@@ -232,7 +232,7 @@ Kirigami.Page {
Connections { Connections {
target: LoginHelper target: LoginHelper
function onLoginErrorOccured(message) { function onLoginErrorOccured(message: string): void {
headerMessage.text = message; headerMessage.text = message;
headerMessage.visible = message.length > 0; headerMessage.visible = message.length > 0;
headerMessage.type = Kirigami.MessageType.Error; headerMessage.type = Kirigami.MessageType.Error;

View File

@@ -102,7 +102,7 @@ ColumnLayout {
Connections { Connections {
target: MediaManager target: MediaManager
function onPlaybackStarted() { function onPlaybackStarted(): void {
if (audio.playbackState === MediaPlayer.PlayingState) { if (audio.playbackState === MediaPlayer.PlayingState) {
audio.pause(); audio.pause();
} }

View File

@@ -70,7 +70,7 @@ ColumnLayout {
} }
Connections { Connections {
target: mapView.map target: mapView.map
function onCopyrightLinkActivated() { function onCopyrightLinkActivated(link: string): void {
Qt.openUrlExternally(link); Qt.openUrlExternally(link);
} }
} }

View File

@@ -68,7 +68,7 @@ ColumnLayout {
Connections { Connections {
target: mapView.map target: mapView.map
function onCopyrightLinkActivated(link: string) { function onCopyrightLinkActivated(link: string): void {
Qt.openUrlExternally(link); Qt.openUrlExternally(link);
} }
} }

View File

@@ -167,7 +167,7 @@ Video {
Connections { Connections {
target: MediaManager target: MediaManager
function onPlaybackStarted() { function onPlaybackStarted(): void {
if (root.playbackState === MediaPlayer.PlayingState) { if (root.playbackState === MediaPlayer.PlayingState) {
root.pause(); root.pause();
} }

View File

@@ -59,7 +59,7 @@ Kirigami.Page {
Connections { Connections {
target: mapView.map target: mapView.map
function onCopyrightLinkActivated(link: string) { function onCopyrightLinkActivated(link: string): void {
Qt.openUrlExternally(link); Qt.openUrlExternally(link);
} }
} }

View File

@@ -102,7 +102,7 @@ Kirigami.Page {
Connections { Connections {
target: root.Kirigami.PageStack.pageStack target: root.Kirigami.PageStack.pageStack
onWideModeChanged: { function onWideModeChanged(): void {
if ((root.Kirigami.PageStack.pageStack as Kirigami.PageRow).wideMode) { if ((root.Kirigami.PageStack.pageStack as Kirigami.PageRow).wideMode) {
root.Kirigami.PageStack.pop(); root.Kirigami.PageStack.pop();
} }

View File

@@ -93,14 +93,14 @@ Kirigami.Page {
Connections { Connections {
target: RoomManager target: RoomManager
function onCurrentSpaceChanged() { function onCurrentSpaceChanged(): void {
treeView.expandRecursively(); treeView.expandRecursively();
} }
} }
Connections { Connections {
target: RoomManager.sortFilterRoomTreeModel target: RoomManager.sortFilterRoomTreeModel
function onCurrentRoomChanged() { function onCurrentRoomChanged(): void {
treeView.positionViewAtIndex(RoomManager.sortFilterRoomTreeModel.currentRoomIndex(), TableView.AlignVCenter) treeView.positionViewAtIndex(RoomManager.sortFilterRoomTreeModel.currentRoomIndex(), TableView.AlignVCenter)
} }
} }
@@ -197,7 +197,7 @@ Kirigami.Page {
Connections { Connections {
target: NeoChatConfig target: NeoChatConfig
function onCompactRoomListChanged() { function onCompactRoomListChanged(): void {
treeView.collapseRecursively() treeView.collapseRecursively()
treeView.expandRecursively() treeView.expandRecursively()
} }

View File

@@ -266,7 +266,7 @@ FormCard.FormCardPage {
data: Connections { data: Connections {
target: root.connection target: root.connection
function onPasswordStatus(status) { function onPasswordStatus(status): void {
if (status === NeoChatConnection.Success) { if (status === NeoChatConnection.Success) {
confirmPassword.status = Kirigami.MessageType.Positive confirmPassword.status = Kirigami.MessageType.Positive
confirmPassword.statusMessage = i18nc("@info", "Password changed successfully"); confirmPassword.statusMessage = i18nc("@info", "Password changed successfully");

View File

@@ -123,7 +123,7 @@ FormCard.FormCardPage {
property Connections connections: Connections { property Connections connections: Connections {
target: Controller target: Controller
function onConnectionAdded() { function onConnectionAdded(): void {
if (pageStack.layers.depth > 2) { if (pageStack.layers.depth > 2) {
pageStack.layers.pop(); pageStack.layers.pop();
} }

View File

@@ -68,7 +68,7 @@ FormCard.FormCardPage {
Connections { Connections {
target: root.connection target: root.connection
function onIgnoredUsersListChanged() { function onIgnoredUsersListChanged(): void {
repeater.model = root.connection.ignoredUsers(); repeater.model = root.connection.ignoredUsers();
} }
} }

View File

@@ -180,7 +180,7 @@ FormCard.FormCardPage {
property Connections connections: Connections { property Connections connections: Connections {
target: room target: room
onEncryption: { function onEncryption(): void {
enableEncryptionSwitch.checked = room.usesEncryption; enableEncryptionSwitch.checked = room.usesEncryption;
} }
} }

View File

@@ -138,7 +138,7 @@ ColumnLayout {
Connections { Connections {
target: threePIdModel target: threePIdModel
function onModelReset() { function onModelReset(): void {
newCountryCode.text = "" newCountryCode.text = ""
} }
} }
@@ -178,7 +178,7 @@ ColumnLayout {
Connections { Connections {
target: threePIdModel target: threePIdModel
function onModelReset() { function onModelReset(): void {
newId.text = "" newId.text = ""
} }
} }

View File

@@ -149,27 +149,27 @@ QQC2.ScrollView {
Connections { Connections {
target: messageListView.model.sourceModel.timelineMessageModel target: messageListView.model.sourceModel.timelineMessageModel
function onModelAboutToBeReset() { function onModelAboutToBeReset(): void {
(root.QQC2.ApplicationWindow.window as Main).hoverLinkIndicator.text = ""; (root.QQC2.ApplicationWindow.window as Main).hoverLinkIndicator.text = "";
_private.hasScrolledUpBefore = false; _private.hasScrolledUpBefore = false;
} }
function onModelResetComplete() { function onModelResetComplete(): void {
messageListView.positionViewAtBeginning(); messageListView.positionViewAtBeginning();
} }
function onReadMarkerAdded() { function onReadMarkerAdded(): void {
if (root.markReadCondition == LibNeoChat.TimelineMarkReadCondition.EntryVisible && messageListView.allUnreadVisible()) { if (root.markReadCondition == LibNeoChat.TimelineMarkReadCondition.EntryVisible && messageListView.allUnreadVisible()) {
_private.room.markAllMessagesAsRead(); _private.room.markAllMessagesAsRead();
} }
} }
function onNewLocalUserEventAdded() { function onNewLocalUserEventAdded(): void {
messageListView.positionViewAtBeginning(); messageListView.positionViewAtBeginning();
_private.room.markAllMessagesAsRead(); _private.room.markAllMessagesAsRead();
} }
function onRoomAboutToChange(oldRoom, newRoom) { function onRoomAboutToChange(oldRoom: NeoChatRoom, newRoom: NeoChatRoom): void {
if (root.markReadCondition == LibNeoChat.TimelineMarkReadCondition.Exit || if (root.markReadCondition == LibNeoChat.TimelineMarkReadCondition.Exit ||
(root.markReadCondition == LibNeoChat.TimelineMarkReadCondition.ExitVisible && messageListView.allUnreadVisible()) (root.markReadCondition == LibNeoChat.TimelineMarkReadCondition.ExitVisible && messageListView.allUnreadVisible())
) { ) {
@@ -177,7 +177,7 @@ QQC2.ScrollView {
} }
} }
function onRoomChanged(oldRoom, newRoom) { function onRoomChanged(oldRoom: NeoChatRoom, newRoom: NeoChatRoom): void {
if (root.markReadCondition == LibNeoChat.TimelineMarkReadCondition.Entry) { if (root.markReadCondition == LibNeoChat.TimelineMarkReadCondition.Entry) {
newRoom.markAllMessagesAsRead(); newRoom.markAllMessagesAsRead();
} }