fix(@deaktop/chat): drag & drop to upload a file/picture is not working
Also checked and updated drag and drop feature to work in commmunities fixes #3495
This commit is contained in:
parent
d8222a49de
commit
d8e669d013
|
@ -28,6 +28,7 @@ Item {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
property alias appSettings: appSettings
|
property alias appSettings: appSettings
|
||||||
|
property alias appLayout: appLayout
|
||||||
property var newVersionJSON: JSON.parse(utilsModel.newVersion)
|
property var newVersionJSON: JSON.parse(utilsModel.newVersion)
|
||||||
property bool profilePopupOpened: false
|
property bool profilePopupOpened: false
|
||||||
property bool networkGuarded: profileModel.network.current === Constants.networkMainnet || (profileModel.network.current === Constants.networkRopsten && appSettings.stickersEnsRopsten)
|
property bool networkGuarded: profileModel.network.current === Constants.networkMainnet || (profileModel.network.current === Constants.networkRopsten && appSettings.stickersEnsRopsten)
|
||||||
|
@ -254,6 +255,8 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusAppLayout {
|
StatusAppLayout {
|
||||||
|
id: appLayout
|
||||||
|
|
||||||
width: parent.width
|
width: parent.width
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.topMargin: (versionWarning.visible || mnemonicBackupWarning.visible) ? 32 : 0
|
anchors.topMargin: (versionWarning.visible || mnemonicBackupWarning.visible) ? 32 : 0
|
||||||
|
|
12
ui/main.qml
12
ui/main.qml
|
@ -320,12 +320,10 @@ StatusWindow {
|
||||||
property alias droppedUrls: rptDraggedPreviews.model
|
property alias droppedUrls: rptDraggedPreviews.model
|
||||||
readonly property int chatView: Utils.getAppSectionIndex(Constants.chat)
|
readonly property int chatView: Utils.getAppSectionIndex(Constants.chat)
|
||||||
readonly property int timelineView: Utils.getAppSectionIndex(Constants.timeline)
|
readonly property int timelineView: Utils.getAppSectionIndex(Constants.timeline)
|
||||||
property bool enabled: containsDrag &&
|
property bool enabled: !drag.source && !!loader.item && !!loader.item.appLayout &&
|
||||||
drag.source.objectName !== "chatItem" &&
|
|
||||||
drag.source.objectName !== "chatListCategory" && loader.item &&
|
|
||||||
(
|
(
|
||||||
// in chat view
|
// in chat view
|
||||||
(loader.item.currentView === chatView &&
|
(loader.item.appLayout.appView.currentIndex === chatView &&
|
||||||
(
|
(
|
||||||
// in a one-to-one chat
|
// in a one-to-one chat
|
||||||
chatsModel.channelView.activeChannel.chatType === Constants.chatTypeOneToOne ||
|
chatsModel.channelView.activeChannel.chatType === Constants.chatTypeOneToOne ||
|
||||||
|
@ -334,7 +332,7 @@ StatusWindow {
|
||||||
)
|
)
|
||||||
) ||
|
) ||
|
||||||
// in timeline view
|
// in timeline view
|
||||||
loader.item.currentView === timelineView ||
|
loader.item.appLayout.appView.currentIndex === timelineView ||
|
||||||
// In community section
|
// In community section
|
||||||
chatsModel.communities.activeCommunity.active
|
chatsModel.communities.activeCommunity.active
|
||||||
)
|
)
|
||||||
|
@ -355,7 +353,7 @@ StatusWindow {
|
||||||
cleanup()
|
cleanup()
|
||||||
}
|
}
|
||||||
onEntered: {
|
onEntered: {
|
||||||
if (!enabled) {
|
if (!enabled || !!drag.source) {
|
||||||
drag.accepted = false
|
drag.accepted = false
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -378,7 +376,7 @@ StatusWindow {
|
||||||
|
|
||||||
states: [
|
states: [
|
||||||
State {
|
State {
|
||||||
when: dragTarget.enabled
|
when: dragTarget.enabled && dragTarget.containsDrag
|
||||||
PropertyChanges {
|
PropertyChanges {
|
||||||
target: dropRectangle
|
target: dropRectangle
|
||||||
color: Style.current.background
|
color: Style.current.background
|
||||||
|
|
Loading…
Reference in New Issue