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 {
target: mapView.map
function onCopyrightLinkActivated() {
function onCopyrightLinkActivated(link: string): void {
Qt.openUrlExternally(link);
}
}

View File

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

View File

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

View File

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

View File

@@ -80,7 +80,7 @@ Kirigami.Page {
Connections {
target: root.currentRoom.connection
function onIsOnlineChanged() {
function onIsOnlineChanged(): void {
if (!root.currentRoom.connection.isOnline) {
banner.text = i18nc("@info:status", "NeoChat is offline. Please check your network connection.");
banner.visible = true;
@@ -162,20 +162,20 @@ Kirigami.Page {
Connections {
target: RoomManager
function onCurrentRoomChanged() {
function onCurrentRoomChanged(): void {
if (root.currentRoom && root.currentRoom.isInvite) {
Controller.clearInvitationNotification(root.currentRoom.id);
}
}
function onGoToEvent(eventId) {
function onGoToEvent(eventId: string): void {
(timelineViewLoader.item as TimelineView).goToEvent(eventId);
}
}
Connections {
target: root.currentRoom.connection
function onJoinedRoom(room, invited) {
function onJoinedRoom(room: NeoChatRoom, invited: NeoChatRoom): void {
if (root.currentRoom.id === invited.id) {
RoomManager.resolveResource(room.id);
}
@@ -195,13 +195,13 @@ Kirigami.Page {
Connections {
target: RoomManager
function onShowMessage(messageType, message) {
function onShowMessage(messageType: Kirigami.MessageType, message: string): void {
banner.text = message;
banner.type = messageType;
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'), {
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, {
selectedText: selectedText,
hoveredLink: hoveredLink,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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