From 6fef6ad5f1c7138ebe0bc07174ad28a62c493231 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Thu, 26 Oct 2023 21:43:05 +0200 Subject: [PATCH] Enable even more qml linter warnings --- .qmllint.ini | 41 ++++++++++--------- resources/qml/SelfVerificationCheck.qml | 4 +- resources/qml/TimelineEvent.qml | 2 + resources/qml/ToggleButton.qml | 1 - resources/qml/TypingIndicator.qml | 1 - .../qml/components/ReorderableListview.qml | 1 - resources/qml/delegates/Pill.qml | 1 - .../device-verification/DigitVerification.qml | 1 - .../NewVerificationRequest.qml | 1 - resources/qml/device-verification/Success.qml | 1 - resources/qml/dialogs/InputDialog.qml | 5 +-- .../qml/dialogs/PhoneNumberInputDialog.qml | 5 +-- resources/qml/ui/Snackbar.qml | 2 +- 13 files changed, 30 insertions(+), 36 deletions(-) diff --git a/.qmllint.ini b/.qmllint.ini index 4781a741..387b5163 100644 --- a/.qmllint.ini +++ b/.qmllint.ini @@ -36,32 +36,33 @@ ResourcePath= #VarUsedBeforeDeclaration=warning #WithStatement=warning -AccessSingletonViaObject=disable -AttachedPropertyReuse=disable +AccessSingletonViaObject=warning +AttachedPropertyReuse=warning +# https://bugreports.qt.io/browse/QTBUG-115439 -> set to disabled until Qt6.7 BadSignalHandlerParameters=disable CompilerWarnings=disable -Deprecated=disable -DuplicatePropertyBinding=disable -DuplicatedName=disable +Deprecated=warning +DuplicatePropertyBinding=warning +DuplicatedName=warning ImportFailure=disable -IncompatibleType=disable -InheritanceCycle=disable -InvalidLintDirective=disable -LintPluginWarnings=disable +IncompatibleType=warning +InheritanceCycle=warning +InvalidLintDirective=warning +LintPluginWarnings=warning MissingProperty=disable MissingType=disable -MultilineStrings=info -NonListProperty=disable -PrefixedImportType=disable +MultilineStrings=warning +NonListProperty=warning +PrefixedImportType=warning PropertyAliasCycles=disable -ReadOnlyProperty=disable -RequiredProperty=disable -RestrictedType=disable -TopLevelComponent=disable -UncreatableType=disable +ReadOnlyProperty=warning +RequiredProperty=warning +RestrictedType=warning +TopLevelComponent=warning +UncreatableType=warning UnqualifiedAccess=disable UnresolvedType=disable UnusedImports=info -UseProperFunction=disable -VarUsedBeforeDeclaration=disable -WithStatement=disable +UseProperFunction=warning +VarUsedBeforeDeclaration=warning +WithStatement=warning diff --git a/resources/qml/SelfVerificationCheck.qml b/resources/qml/SelfVerificationCheck.qml index 1752df0e..42617f07 100644 --- a/resources/qml/SelfVerificationCheck.qml +++ b/resources/qml/SelfVerificationCheck.qml @@ -45,14 +45,14 @@ Item { Label { Layout.fillWidth: true Layout.margins: Nheko.paddingMedium - Layout.maximumWidth: (Overlay.overlay ? Overlay.overlay.width : 400) - Nheko.paddingMedium * 4 + Layout.maximumWidth: (showRecoverKeyDialog.Overlay.overlay ? showRecoverKeyDialog.Overlay.overlay.width : 400) - Nheko.paddingMedium * 4 color: palette.text text: qsTr("This is your recovery key. You will need it to restore access to your encrypted messages and verification keys. Keep this safe. Don't share it with anyone and don't lose it! Do not pass go! Do not collect $200!") wrapMode: Text.Wrap } TextEdit { Layout.alignment: Qt.AlignHCenter - Layout.maximumWidth: (Overlay.overlay ? Overlay.overlay.width : 400) - Nheko.paddingMedium * 4 + Layout.maximumWidth: (showRecoverKeyDialog.Overlay.overlay ? showRecoverKeyDialog.Overlay.overlay.width : 400) - Nheko.paddingMedium * 4 color: palette.text font.bold: true horizontalAlignment: TextEdit.AlignHCenter diff --git a/resources/qml/TimelineEvent.qml b/resources/qml/TimelineEvent.qml index c6f432ee..3cc239c9 100644 --- a/resources/qml/TimelineEvent.qml +++ b/resources/qml/TimelineEvent.qml @@ -14,6 +14,7 @@ EventDelegateChooser { required property bool isStateEvent + // qmllint disable required EventDelegateChoice { roleValues: [MtxEvent.TextMessage, MtxEvent.NoticeMessage, MtxEvent.ElementEffectMessage, MtxEvent.UnknownMessage,] @@ -258,4 +259,5 @@ EventDelegateChooser { text: "Unsupported: " + typeString } } + // qmllint enable required } diff --git a/resources/qml/ToggleButton.qml b/resources/qml/ToggleButton.qml index f48fcb68..50ed5187 100644 --- a/resources/qml/ToggleButton.qml +++ b/resources/qml/ToggleButton.qml @@ -5,7 +5,6 @@ import QtQuick 2.5 import QtQuick 2.12 import QtQuick.Controls 2.12 -import im.nheko 1.0 Switch { id: toggleButton diff --git a/resources/qml/TypingIndicator.qml b/resources/qml/TypingIndicator.qml index b6c502d8..c681a2f9 100644 --- a/resources/qml/TypingIndicator.qml +++ b/resources/qml/TypingIndicator.qml @@ -5,7 +5,6 @@ import QtQuick 2.9 import QtQuick.Controls 2.3 import QtQuick.Layouts 1.2 -import im.nheko 1.0 Item { Layout.fillWidth: true diff --git a/resources/qml/components/ReorderableListview.qml b/resources/qml/components/ReorderableListview.qml index 689f8267..b5d5f5e5 100644 --- a/resources/qml/components/ReorderableListview.qml +++ b/resources/qml/components/ReorderableListview.qml @@ -4,7 +4,6 @@ import QtQuick import QtQml.Models -import im.nheko Item { id: root diff --git a/resources/qml/delegates/Pill.qml b/resources/qml/delegates/Pill.qml index 3f981d4d..c9ca1ed3 100644 --- a/resources/qml/delegates/Pill.qml +++ b/resources/qml/delegates/Pill.qml @@ -4,7 +4,6 @@ import QtQuick 2.5 import QtQuick.Controls 2.1 -import im.nheko 1.0 Label { property bool isStateEvent diff --git a/resources/qml/device-verification/DigitVerification.qml b/resources/qml/device-verification/DigitVerification.qml index 33cc59f4..148b3f65 100644 --- a/resources/qml/device-verification/DigitVerification.qml +++ b/resources/qml/device-verification/DigitVerification.qml @@ -5,7 +5,6 @@ import QtQuick 2.3 import QtQuick.Controls 2.3 import QtQuick.Layouts 1.10 -import im.nheko 1.0 ColumnLayout { property string title: qsTr("Verification Code") diff --git a/resources/qml/device-verification/NewVerificationRequest.qml b/resources/qml/device-verification/NewVerificationRequest.qml index 9a9ab703..6f6de8c7 100644 --- a/resources/qml/device-verification/NewVerificationRequest.qml +++ b/resources/qml/device-verification/NewVerificationRequest.qml @@ -5,7 +5,6 @@ import QtQuick 2.3 import QtQuick.Controls 2.3 import QtQuick.Layouts 1.10 -import im.nheko 1.0 ColumnLayout { property string title: flow.sender ? qsTr("Send Verification Request") : qsTr("Received Verification Request") diff --git a/resources/qml/device-verification/Success.qml b/resources/qml/device-verification/Success.qml index 4b60a5a3..9fe69bdf 100644 --- a/resources/qml/device-verification/Success.qml +++ b/resources/qml/device-verification/Success.qml @@ -5,7 +5,6 @@ import QtQuick 2.3 import QtQuick.Controls 2.3 import QtQuick.Layouts 1.10 -import im.nheko 1.0 ColumnLayout { property string title: qsTr("Successful Verification") diff --git a/resources/qml/dialogs/InputDialog.qml b/resources/qml/dialogs/InputDialog.qml index 49becc67..8bd95d09 100644 --- a/resources/qml/dialogs/InputDialog.qml +++ b/resources/qml/dialogs/InputDialog.qml @@ -13,7 +13,7 @@ ApplicationWindow { property alias prompt: promptLabel.text property alias echoMode: statusInput.echoMode - property var onAccepted: undefined + signal accepted(text: string) modality: Qt.NonModal flags: Qt.Dialog @@ -55,8 +55,7 @@ ApplicationWindow { standardButtons: DialogButtonBox.Ok | DialogButtonBox.Cancel onAccepted: { - if (inputDialog.onAccepted) - inputDialog.onAccepted(statusInput.text); + inputDialog.accepted(statusInput.text); inputDialog.close(); } diff --git a/resources/qml/dialogs/PhoneNumberInputDialog.qml b/resources/qml/dialogs/PhoneNumberInputDialog.qml index f1b8eef8..f9bff31c 100644 --- a/resources/qml/dialogs/PhoneNumberInputDialog.qml +++ b/resources/qml/dialogs/PhoneNumberInputDialog.qml @@ -13,7 +13,7 @@ ApplicationWindow { property alias prompt: promptLabel.text property alias echoMode: statusInput.echoMode - property var onAccepted: undefined + signal accepted(countryCode: string, text: string) modality: Qt.NonModal flags: Qt.Dialog @@ -1729,8 +1729,7 @@ ApplicationWindow { footer: DialogButtonBox { standardButtons: DialogButtonBox.Ok | DialogButtonBox.Cancel onAccepted: { - if (inputDialog.onAccepted) - inputDialog.onAccepted(numberPrefix.model.get(numberPrefix.currentIndex).i, statusInput.text); + inputDialog.accepted(numberPrefix.model.get(numberPrefix.currentIndex).i, statusInput.text); inputDialog.close(); } diff --git a/resources/qml/ui/Snackbar.qml b/resources/qml/ui/Snackbar.qml index 0d334079..3c526d8d 100644 --- a/resources/qml/ui/Snackbar.qml +++ b/resources/qml/ui/Snackbar.qml @@ -49,7 +49,7 @@ Popup { contentItem: Label { color: palette.light - width: Math.max(Overlay.overlay? Overlay.overlay.width/2 : 0, 400) + width: Math.max(snackbar.Overlay.overlay? snackbar.Overlay.overlay.width/2 : 0, 400) text: snackbar.currentMessage font.bold: true }