diff --git a/storybook/pages/ColorsPage.qml b/storybook/pages/ColorsPage.qml index 85d2bffef7..c8d4b68639 100644 --- a/storybook/pages/ColorsPage.qml +++ b/storybook/pages/ColorsPage.qml @@ -37,7 +37,7 @@ SplitView { padding: 0 text: "📋" font.pixelSize: 10 - onClicked: QClipboardProxy.copyTextToClipboard(textLabel.text) + onClicked: ClipboardUtils.setText(textLabel.text) ToolTip.text: "Copy color name" ToolTip.visible: hovered } @@ -58,7 +58,7 @@ SplitView { padding: 0 text: "📋" font.pixelSize: 10 - onClicked: QClipboardProxy.copyTextToClipboard(colorLabel.text) + onClicked: ClipboardUtils.setText(colorLabel.text) ToolTip.text: "Copy color value" ToolTip.visible: hovered } diff --git a/storybook/qmlTests/tests/tst_AmountToSend.qml b/storybook/qmlTests/tests/tst_AmountToSend.qml index da3bdec8f2..6f4657158a 100644 --- a/storybook/qmlTests/tests/tst_AmountToSend.qml +++ b/storybook/qmlTests/tests/tst_AmountToSend.qml @@ -200,7 +200,7 @@ Item { compare(amountToSend.empty, true) compare(amountToSend.amount, "0") - QClipboardProxy.copyTextToClipboard("1.0005") + ClipboardUtils.setText("1.0005") const textField = findChild(amountToSend, "amountToSend_textField") verify(!!textField) diff --git a/storybook/qmlTests/tests/tst_SendRecipientInput.qml b/storybook/qmlTests/tests/tst_SendRecipientInput.qml index 2c6548b093..1653028943 100644 --- a/storybook/qmlTests/tests/tst_SendRecipientInput.qml +++ b/storybook/qmlTests/tests/tst_SendRecipientInput.qml @@ -41,7 +41,7 @@ Item { controlUnderTest = createTemporaryObject(componentUnderTest, root) signalSpyClearClicked.clear() signalSpyValidateInputRequested.clear() - QClipboardProxy.clear() + ClipboardUtils.clear() } function test_basicGeometry() { diff --git a/ui/StatusQ/include/StatusQ/clipboardutils.h b/ui/StatusQ/include/StatusQ/clipboardutils.h index 864c21231c..7ee3d6dd53 100644 --- a/ui/StatusQ/include/StatusQ/clipboardutils.h +++ b/ui/StatusQ/include/StatusQ/clipboardutils.h @@ -52,7 +52,7 @@ public: return new ClipboardUtils; } - Q_INVOKABLE void copyTextToClipboard(const QString& text); + Q_INVOKABLE void setText(const QString& text); Q_INVOKABLE void clear(); signals: diff --git a/ui/StatusQ/src/clipboardutils.cpp b/ui/StatusQ/src/clipboardutils.cpp index dc385e6144..a263b6a934 100644 --- a/ui/StatusQ/src/clipboardutils.cpp +++ b/ui/StatusQ/src/clipboardutils.cpp @@ -72,7 +72,7 @@ QList ClipboardUtils::urls() const return m_clipboard->mimeData()->urls(); } -void ClipboardUtils::copyTextToClipboard(const QString &text) +void ClipboardUtils::setText(const QString &text) { m_clipboard->setText(text); } diff --git a/ui/StatusQ/src/plugin.cpp b/ui/StatusQ/src/plugin.cpp index e9b716d4d7..d6c7380bce 100644 --- a/ui/StatusQ/src/plugin.cpp +++ b/ui/StatusQ/src/plugin.cpp @@ -78,7 +78,7 @@ public: qmlRegisterType("StatusQ", 0, 1, "WritableProxyModel"); qmlRegisterType("StatusQ", 0, 1, "FormattedDoubleProperty"); - qmlRegisterSingletonType("StatusQ", 0, 1, "QClipboardProxy", &ClipboardUtils::qmlInstance); + qmlRegisterSingletonType("StatusQ", 0, 1, "ClipboardUtils", &ClipboardUtils::qmlInstance); qmlRegisterSingletonType("StatusQ", 0, 1, "UrlUtils", &UrlUtils::qmlInstance); qmlRegisterType("StatusQ", 0, 1, "ModelEntry"); diff --git a/ui/imports/shared/popups/send/controls/SendRecipientInput.qml b/ui/imports/shared/popups/send/controls/SendRecipientInput.qml index b7e0225a78..280737b32d 100644 --- a/ui/imports/shared/popups/send/controls/SendRecipientInput.qml +++ b/ui/imports/shared/popups/send/controls/SendRecipientInput.qml @@ -38,7 +38,7 @@ StatusInput { focusPolicy: Qt.NoFocus onClicked: { root.input.edit.forceActiveFocus() - root.text = QClipboardProxy.text // paste plain text + root.text = ClipboardUtils.text // paste plain text root.input.edit.cursorPosition = root.input.edit.length root.validateInputRequested() } @@ -66,7 +66,7 @@ StatusInput { function onKeyPressed(event) { if (event.matches(StandardKey.Paste)) { event.accepted = true - root.text = QClipboardProxy.text // paste plain text + root.text = ClipboardUtils.text // paste plain text } } } diff --git a/ui/imports/shared/status/StatusChatInput.qml b/ui/imports/shared/status/StatusChatInput.qml index f601740ab3..3228c84332 100644 --- a/ui/imports/shared/status/StatusChatInput.qml +++ b/ui/imports/shared/status/StatusChatInput.qml @@ -143,7 +143,7 @@ Rectangle { property int leftOfMentionIndex: -1 property int rightOfMentionIndex: -1 - readonly property int nbEmojisInClipboard: StatusQUtils.Emoji.nbEmojis(QClipboardProxy.html) + readonly property int nbEmojisInClipboard: StatusQUtils.Emoji.nbEmojis(ClipboardUtils.html) property bool emojiPopupOpened: false property bool stickersPopupOpened: false @@ -449,12 +449,12 @@ Rectangle { } if (event.matches(StandardKey.Paste)) { - if (QClipboardProxy.hasImage) { - const clipboardImage = QClipboardProxy.imageBase64 + if (ClipboardUtils.hasImage) { + const clipboardImage = ClipboardUtils.imageBase64 validateImagesAndShowImageArea([clipboardImage]) event.accepted = true - } else if (QClipboardProxy.hasText) { - const clipboardText = Utils.plainText(QClipboardProxy.text) + } else if (ClipboardUtils.hasText) { + const clipboardText = Utils.plainText(ClipboardUtils.text) // prevent repetitive & huge clipboard paste, where huge is total char count > than messageLimitHard const selectionLength = messageInputField.selectionEnd - messageInputField.selectionStart; if ((messageLength + clipboardText.length - selectionLength) > control.messageLimitHard) @@ -500,8 +500,8 @@ Rectangle { d.copiedTextFormatted = "" d.copiedMentionsPos = [] messageInputField.insert(d.copyTextStart, ((d.nbEmojisInClipboard === 0) ? - ("
" + StatusQUtils.StringUtils.escapeHtml(QClipboardProxy.text) + "
") - : StatusQUtils.Emoji.deparse(QClipboardProxy.html))); + ("
" + StatusQUtils.StringUtils.escapeHtml(ClipboardUtils.text) + "
") + : StatusQUtils.Emoji.deparse(ClipboardUtils.html))); } event.accepted = true } @@ -676,7 +676,7 @@ Rectangle { if (messageInputField.readOnly) { messageInputField.readOnly = false; - messageInputField.cursorPosition = (d.copyTextStart + QClipboardProxy.text.length + d.nbEmojisInClipboard); + messageInputField.cursorPosition = (d.copyTextStart + ClipboardUtils.text.length + d.nbEmojisInClipboard); }