status-desktop/ui/imports/shared/status/StatusChatImageExtensionValidator.qml
Lukáš Tinkl 623333ab8c fix: improve image type detection
- use the same approach as status-go to detect the image type, relying
on "magic" type matching instead of looking at the file extension (now
using C++ and QMime*)
- add a little error popup when the user tries to upload an unsupported
image type while creating/editing a community
- expose all the image related properties from the C++ backend instead
of constructing and duplicating them in QML
- cleanup some unused/dead code

Fixes #16668
2024-11-04 10:29:01 +01:00

23 lines
569 B
QML

import QtQuick 2.15
import StatusQ 0.1
import utils 1.0
StatusChatImageValidator {
id: root
errorMessage: qsTr("Format not supported.")
secondaryErrorMessage: qsTr("Upload %1 only").arg(UrlUtils.validPreferredImageExtensions.map(ext => ext.toUpperCase() + "s").join(", "))
onImagesChanged: {
let isValid = true
root.validImages = images.filter(img => {
const isImage = Utils.isValidDragNDropImage(img)
isValid = isValid && isImage
return isImage
})
root.isValid = isValid
}
}