Start implementing new message selection system

This commit is contained in:
miruka
2020-03-25 23:06:51 -04:00
parent 710dba09ec
commit 3852357614
12 changed files with 130 additions and 13 deletions

View File

@@ -21,6 +21,7 @@ Image {
property bool animate: true
property bool animated:
utils.urlExtension(image.source).toLowerCase() === "gif"
property bool enabledAnimatedPausing: true
property alias radius: roundMask.radius
property alias showProgressBar: progressBarLoader.active
@@ -74,7 +75,9 @@ Image {
property bool userPaused: ! window.settings.media.autoPlayGIF
TapHandler {
enabled: image.enabledAnimatedPausing
onTapped: parent.userPaused = ! parent.userPaused
gesturePolicy: TapHandler.ReleaseWithinBounds
}
HIcon {

View File

@@ -68,6 +68,31 @@ ListView {
property bool allowDragging: true
property alias cursorShape: mouseArea.cursorShape
property int currentItemHeight: currentItem ? currentItem.height : 0
property var checkedDelegates: ({})
property int selectedCount: Object.keys(checkedDelegates).length
function delegatesChecked(...indices) {
for (const i of indices) {
const model = listView.model.get(i)
checkedDelegates[model.id] = model
}
checkedDelegatesChanged()
}
function delegatesUnchecked(...indices) {
for (const i of indices) {
const model = listView.model.get(i)
delete checkedDelegates[model.id]
}
checkedDelegatesChanged()
}
function getSortedCheckedDelegates() {
return Object.values(checkedDelegates).sort(
(a, b) => a.date > b.date ? 1 : -1
)
}
Connections {

View File

@@ -13,11 +13,13 @@ TextEdit {
tabStopDistance: 4 * 4 // 4 spaces
readOnly: true
persistentSelection: true
activeFocusOnPress: false
focus: false
onLinkActivated: Qt.openUrlExternally(link)
onLinkActivated: if (enableLinkActivation) Qt.openUrlExternally(link)
property bool enableLinkActivation: true
function selectWordAt(position) {

View File

@@ -9,6 +9,7 @@ HButton {
signal leftClicked()
signal rightClicked()
signal longPressed()
default property alias additionalData: contentItem.data
@@ -106,6 +107,7 @@ HButton {
TapHandler {
acceptedButtons: Qt.LeftButton
onTapped: leftClicked()
onLongPressed: tile.longPressed()
}
TapHandler {