Use ClipboardUtils.text instead of backend-dependent getFromClipboard
This commit is contained in:
parent
a8940a71f5
commit
9c3b8fc34b
|
@ -3,6 +3,7 @@ import QtQuick.Controls 2.15
|
||||||
import QtQml 2.15
|
import QtQml 2.15
|
||||||
import QtQml.Models 2.15
|
import QtQml.Models 2.15
|
||||||
|
|
||||||
|
import StatusQ 0.1
|
||||||
import StatusQ.Core.Utils 0.1
|
import StatusQ.Core.Utils 0.1
|
||||||
|
|
||||||
import QtTest 1.15
|
import QtTest 1.15
|
||||||
|
@ -133,9 +134,7 @@ Item {
|
||||||
|
|
||||||
itemUnderTest.dictionary.append(expectedSeedPhrase.map((word) => ({seedWord: word})))
|
itemUnderTest.dictionary.append(expectedSeedPhrase.map((word) => ({seedWord: word})))
|
||||||
|
|
||||||
const clipboardHelper = createTemporaryQmlObject("import QtQuick 2.15; QtObject { property var getFromClipboard }", root)
|
ClipboardUtils.setText(expectedSeedPhrase.join(" "))
|
||||||
clipboardHelper.getFromClipboard = () => expectedSeedPhrase.join(" ")
|
|
||||||
Utils.globalUtilsInst = clipboardHelper
|
|
||||||
|
|
||||||
// Trigger the paste action
|
// Trigger the paste action
|
||||||
keyClick("v", Qt.ControlModifier)
|
keyClick("v", Qt.ControlModifier)
|
||||||
|
@ -239,9 +238,7 @@ Item {
|
||||||
|
|
||||||
itemUnderTest.dictionary.append(dictionaryVariation.map((word) => ({seedWord: word})))
|
itemUnderTest.dictionary.append(dictionaryVariation.map((word) => ({seedWord: word})))
|
||||||
|
|
||||||
const clipboardHelper = createTemporaryQmlObject("import QtQuick 2.15; QtObject { property var getFromClipboard }", root)
|
ClipboardUtils.setText(expectedSeedPhrase.join(" "))
|
||||||
clipboardHelper.getFromClipboard = () => expectedSeedPhrase.join(" ")
|
|
||||||
Utils.globalUtilsInst = clipboardHelper
|
|
||||||
|
|
||||||
// Trigger the paste action
|
// Trigger the paste action
|
||||||
keyClick("v", Qt.ControlModifier)
|
keyClick("v", Qt.ControlModifier)
|
||||||
|
|
|
@ -4,6 +4,7 @@ import QtQuick.Layouts 1.14
|
||||||
|
|
||||||
import utils 1.0
|
import utils 1.0
|
||||||
|
|
||||||
|
import StatusQ 0.1
|
||||||
import StatusQ.Controls 0.1
|
import StatusQ.Controls 0.1
|
||||||
import StatusQ.Controls.Validators 0.1
|
import StatusQ.Controls.Validators 0.1
|
||||||
import StatusQ.Core 0.1
|
import StatusQ.Core 0.1
|
||||||
|
@ -110,7 +111,7 @@ StatusModal {
|
||||||
size: StatusBaseButton.Size.Tiny
|
size: StatusBaseButton.Size.Tiny
|
||||||
text: qsTr("Paste")
|
text: qsTr("Paste")
|
||||||
onClicked: {
|
onClicked: {
|
||||||
d.realChatKey = root.contactsStore.getFromClipboard()
|
d.realChatKey = ClipboardUtils.text
|
||||||
d.showPasteButton = false
|
d.showPasteButton = false
|
||||||
d.textChanged(d.realChatKey)
|
d.textChanged(d.realChatKey)
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,10 +51,6 @@ QtObject {
|
||||||
return root.globalUtilsInst.generateAlias(pubKey)
|
return root.globalUtilsInst.generateAlias(pubKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
function getFromClipboard() {
|
|
||||||
return root.globalUtilsInst.getFromClipboard()
|
|
||||||
}
|
|
||||||
|
|
||||||
function isMyMutualContact(pubKey) {
|
function isMyMutualContact(pubKey) {
|
||||||
return root.contactsModule.isMyMutualContact(pubKey)
|
return root.contactsModule.isMyMutualContact(pubKey)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import QtQuick 2.14
|
import QtQuick 2.14
|
||||||
import QtQuick.Layouts 1.14
|
import QtQuick.Layouts 1.14
|
||||||
|
|
||||||
|
import StatusQ 0.1
|
||||||
import StatusQ.Core 0.1
|
import StatusQ.Core 0.1
|
||||||
import StatusQ.Core.Theme 0.1
|
import StatusQ.Core.Theme 0.1
|
||||||
import StatusQ.Core.Utils 0.1
|
import StatusQ.Core.Utils 0.1
|
||||||
|
@ -96,7 +97,7 @@ ColumnLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
function pasteWords () {
|
function pasteWords () {
|
||||||
const clipboardText = Utils.getFromClipboard()
|
const clipboardText = ClipboardUtils.text
|
||||||
|
|
||||||
// Split words separated by commas and or blank spaces (spaces, enters, tabs)
|
// Split words separated by commas and or blank spaces (spaces, enters, tabs)
|
||||||
const words = clipboardText.trim().split(/[, \s]+/)
|
const words = clipboardText.trim().split(/[, \s]+/)
|
||||||
|
|
|
@ -19,8 +19,4 @@ QtObject {
|
||||||
property var submitPopup: function(){}
|
property var submitPopup: function(){}
|
||||||
property var changeSeedPhrase: function(){}
|
property var changeSeedPhrase: function(){}
|
||||||
property var validSeedPhrase: function(){}
|
property var validSeedPhrase: function(){}
|
||||||
|
|
||||||
function getFromClipboard() {
|
|
||||||
return globalUtils.getFromClipboard()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ import QtQuick 2.14
|
||||||
import QtQuick.Controls 2.14
|
import QtQuick.Controls 2.14
|
||||||
import QtQuick.Layouts 1.14
|
import QtQuick.Layouts 1.14
|
||||||
|
|
||||||
|
import StatusQ 0.1
|
||||||
import StatusQ.Core 0.1
|
import StatusQ.Core 0.1
|
||||||
import StatusQ.Core.Theme 0.1
|
import StatusQ.Core.Theme 0.1
|
||||||
import StatusQ.Controls 0.1
|
import StatusQ.Controls 0.1
|
||||||
|
@ -79,7 +80,7 @@ Item {
|
||||||
size: StatusBaseButton.Size.Tiny
|
size: StatusBaseButton.Size.Tiny
|
||||||
text: qsTr("Paste")
|
text: qsTr("Paste")
|
||||||
onClicked: {
|
onClicked: {
|
||||||
privKeyInput.text = root.store.getFromClipboard()
|
privKeyInput.text = ClipboardUtils.text
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -714,10 +714,6 @@ QtObject {
|
||||||
return text
|
return text
|
||||||
}
|
}
|
||||||
|
|
||||||
function getFromClipboard() {
|
|
||||||
return globalUtilsInst.getFromClipboard()
|
|
||||||
}
|
|
||||||
|
|
||||||
function copyImageToClipboardByUrl(content) {
|
function copyImageToClipboardByUrl(content) {
|
||||||
globalUtilsInst.copyImageToClipboardByUrl(content)
|
globalUtilsInst.copyImageToClipboardByUrl(content)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue