status-desktop/ui/app/AppLayouts/Chat/CommunityComponents/AccessExistingCommunityPopup.qml
Alexandra Betouni 4ee21ada05 feat(desktop) Added image function in Style
Introduced Style.svg() Style.png() Style.emoji() and
Style.icon() in Style.qml. Those should be used to
set the source in Images instead of using relative
paths. Usage:
Image {
   source: Style.svg("check)
   ....

Also moved all Singletons inside a new "utils"
folder and made it a QML module, to use
import utils 1.0 instead of relative paths

Closes #3678
2021-09-28 15:28:00 -04:00

93 lines
2.5 KiB
QML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import QtQuick 2.12
import QtQuick.Controls 2.3
import QtGraphicalEffects 1.13
import QtQuick.Dialogs 1.3
import utils 1.0
import "../../../../shared"
import "../../../../shared/status"
ModalPopup {
id: popup
width: 400
height: 400
property string keyValidationError: ""
function validate() {
keyValidationError = ""
if (keyInput.text.trim() === "") {
//% "You need to enter a key"
keyValidationError = qsTrId("you-need-to-enter-a-key")
}
return !keyValidationError
}
//% "Access existing community"
title: qsTrId("access-existing-community")
onClosed: {
popup.destroy();
}
Item {
anchors.fill: parent
StyledTextArea {
id: keyInput
//% "Community private key"
label: qsTrId("community-key")
placeholderText: "0x0..."
customHeight: 110
}
StyledText {
id: infoText1
//% "Entering a community key will grant you the ownership of that community. Please be responsible with it and dont share the key with people you dont trust."
text: qsTrId("entering-a-community-key-will-grant-you-the-ownership-of-that-community--please-be-responsible-with-it-and-don-t-share-the-key-with-people-you-don-t-trust-")
anchors.top: keyInput.bottom
wrapMode: Text.WordWrap
anchors.topMargin: Style.current.bigPadding
width: parent.width
font.pixelSize: 13
color: Style.current.secondaryText
}
}
footer: StatusButton {
id: btnBack
//% "Import"
text: qsTrId("import")
anchors.right: parent.right
onClicked: {
if (!validate()) {
return
}
let communityKey = keyInput.text.trim()
if (!communityKey.startsWith("0x")) {
communityKey = "0x" + communityKey
}
const error = chatsModel.communities.importCommunity(communityKey, Utils.uuid())
if (error) {
creatingError.text = error
return creatingError.open()
}
popup.close()
}
MessageDialog {
id: creatingError
//% "Error importing the community"
title: qsTrId("error-importing-the-community")
icon: StandardIcon.Critical
standardButtons: StandardButton.Ok
}
}
}