Try something for the too large context menu

This commit is contained in:
Sebastian Wolf 2021-02-14 21:57:48 +01:00
parent 22c30f334d
commit d9991cce79
No known key found for this signature in database
GPG key ID: CEA9522B5F38A90A
16 changed files with 1314 additions and 1067 deletions

View file

@ -78,6 +78,13 @@ ListItem {
chatView.manuallyScrolledToBottom = false; chatView.manuallyScrolledToBottom = false;
} }
Connections {
target: messageOptionsDrawer
onCloseRequested: {
messageListItem.highlighted = false;
}
}
Loader { Loader {
id: contextMenuLoader id: contextMenuLoader
active: false active: false
@ -110,18 +117,21 @@ ListItem {
onClicked: messageListItem.editMessage() onClicked: messageListItem.editMessage()
text: qsTr("Edit Message") text: qsTr("Edit Message")
} }
MenuItem {
onClicked: {
Clipboard.text = Functions.getMessageText(myMessage, true, userInformation.id, true);
}
text: qsTr("Copy Message to Clipboard")
}
MenuItem { MenuItem {
onClicked: { onClicked: {
page.toggleMessageSelection(myMessage); page.toggleMessageSelection(myMessage);
} }
text: qsTr("Select Message") text: qsTr("Select Message")
} }
MenuItem {
onClicked: {
messageOptionsDrawer.myMessage = myMessage;
messageOptionsDrawer.userInformation = userInformation;
messageListItem.highlighted = true;
messageOptionsDrawer.open = true;
}
text: qsTr("More Options...")
}
MenuItem { MenuItem {
onClicked: { onClicked: {
if (myMessage.is_pinned) { if (myMessage.is_pinned) {

View file

@ -681,6 +681,95 @@ Page {
} }
} }
Drawer {
id: messageOptionsDrawer
property var myMessage: ({})
property var userInformation: ({})
signal closeRequested();
anchors.fill: parent
dock: chatPage.isPortrait ? Dock.Top : Dock.Right
background: SilicaListView {
anchors.fill: parent
model: ListModel {
id: myListModel
property var actions: {
"copyToClipboard": function() { Clipboard.text = Functions.getMessageText(messageOptionsDrawer.myMessage, true, messageOptionsDrawer.userInformation.id, true) },
"pinMessage": function() {
if (messageOptionsDrawer.myMessage.is_pinned) {
Remorse.popupAction(page, qsTr("Message unpinned"), function() { tdLibWrapper.unpinMessage(chatPage.chatInformation.id, messageOptionsDrawer.myMessage.id);
pinnedMessageItem.requestCloseMessage(); } );
} else {
tdLibWrapper.pinMessage(chatPage.chatInformation.id, messageOptionsDrawer.myMessage.id);
}
}
}
property var conditions: {
"copyToClipboard": function() { return true; },
"pinMessage": function() { return canPinMessages(); }
}
property var texts: {
"copyToClipboard": function() { return qsTr("Copy Message to Clipboard"); },
"pinMessage": function() { return messageOptionsDrawer.myMessage.is_pinned ? qsTr("Unpin Message") : qsTr("Pin Message"); }
}
ListElement {
elementActionName: "copyToClipboard"
}
ListElement {
elementActionName: "pinMessage"
}
}
header: Row {
width: parent.width - ( 4 * Theme.horizontalPageMargin)
height: messageOptionsLabel.height + Theme.paddingLarge + ( chatPage.isPortrait ? ( 2 * Theme.paddingSmall ) : 0 )
anchors.horizontalCenter: parent.horizontalCenter
spacing: Theme.paddingMedium
Label {
id: messageOptionsLabel
text: qsTr("Message Options")
color: Theme.highlightColor
font.pixelSize: Theme.fontSizeLarge
width: parent.width - closeMessageOptionsButton.width - Theme.paddingMedium
anchors.verticalCenter: parent.verticalCenter
horizontalAlignment: Text.AlignRight
}
IconButton {
id: closeMessageOptionsButton
icon.source: "image://theme/icon-m-clear"
anchors.verticalCenter: parent.verticalCenter
onClicked: {
messageOptionsDrawer.closeRequested();
messageOptionsDrawer.open = false;
}
}
}
delegate: ListItem {
width: parent.width
visible: myListModel.actions[conditions]()
onClicked: {
myListModel.actions[elementActionName]();
}
Label {
width: parent.width - ( 2 * Theme.horizontalPageMargin )
text: myListModel.texts[elementActionName]();
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
horizontalAlignment: Text.AlignHCenter
}
}
VerticalScrollDecorator {}
}
SilicaFlickable { SilicaFlickable {
id: chatContainer id: chatContainer
@ -1002,7 +1091,7 @@ Page {
function scrollToIndex(index) { function scrollToIndex(index) {
if(index > 0 && index < chatView.count) { if(index > 0 && index < chatView.count) {
positionViewAtIndex(index, ListView.Contain) positionViewAtIndex(index, ListView.Contain)
// currentIndex = index; // currentIndex = index;
if(index === chatView.count - 1) { if(index === chatView.count - 1) {
manuallyScrolledToBottom = true; manuallyScrolledToBottom = true;
} }
@ -1847,6 +1936,10 @@ Page {
} }
} }
}
Loader { Loader {
id: selectedMessagesActions id: selectedMessagesActions
asynchronous: true asynchronous: true

View file

@ -12,7 +12,7 @@ Name: harbour-fernschreiber
Summary: Fernschreiber is a Telegram client for Sailfish OS Summary: Fernschreiber is a Telegram client for Sailfish OS
Version: 0.7.1 Version: 0.7.1
Release: 2 Release: 3
Group: Qt/Qt Group: Qt/Qt
License: LICENSE License: LICENSE
URL: http://werkwolf.eu/ URL: http://werkwolf.eu/

View file

@ -1,7 +1,7 @@
Name: harbour-fernschreiber Name: harbour-fernschreiber
Summary: Fernschreiber is a Telegram client for Sailfish OS Summary: Fernschreiber is a Telegram client for Sailfish OS
Version: 0.7.1 Version: 0.7.1
Release: 2 Release: 3
# The contents of the Group field should be one of the groups listed here: # The contents of the Group field should be one of the groups listed here:
# https://github.com/mer-tools/spectacle/blob/master/data/GROUPS # https://github.com/mer-tools/spectacle/blob/master/data/GROUPS
Group: Qt/Qt Group: Qt/Qt

View file

@ -435,6 +435,14 @@
<source>Location (%1/%2)</source> <source>Location (%1/%2)</source>
<translation>Standort (%1/%2)</translation> <translation>Standort (%1/%2)</translation>
</message> </message>
<message>
<source>Copy Message to Clipboard</source>
<translation type="unfinished">Nachricht in die Zwischenablage kopieren</translation>
</message>
<message>
<source>Message Options</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>ChatSelectionPage</name> <name>ChatSelectionPage</name>
@ -991,6 +999,10 @@
<source>Unpin Message</source> <source>Unpin Message</source>
<translation>Nachricht losheften</translation> <translation>Nachricht losheften</translation>
</message> </message>
<message>
<source>More Options...</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>MessageListViewItemSimple</name> <name>MessageListViewItemSimple</name>

View file

@ -435,6 +435,14 @@
<source>Location (%1/%2)</source> <source>Location (%1/%2)</source>
<translation>Location (%1/%2)</translation> <translation>Location (%1/%2)</translation>
</message> </message>
<message>
<source>Copy Message to Clipboard</source>
<translation type="unfinished">Copy Message to Clipboard</translation>
</message>
<message>
<source>Message Options</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>ChatSelectionPage</name> <name>ChatSelectionPage</name>
@ -993,6 +1001,10 @@ messages</numerusform>
<source>Unpin Message</source> <source>Unpin Message</source>
<translation>Unpin Message</translation> <translation>Unpin Message</translation>
</message> </message>
<message>
<source>More Options...</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>MessageListViewItemSimple</name> <name>MessageListViewItemSimple</name>

View file

@ -435,6 +435,14 @@
<source>Location (%1/%2)</source> <source>Location (%1/%2)</source>
<translation>Ubicación (%1/%2)</translation> <translation>Ubicación (%1/%2)</translation>
</message> </message>
<message>
<source>Copy Message to Clipboard</source>
<translation type="unfinished">Copiar</translation>
</message>
<message>
<source>Message Options</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>ChatSelectionPage</name> <name>ChatSelectionPage</name>
@ -991,6 +999,10 @@
<source>Unpin Message</source> <source>Unpin Message</source>
<translation>Desanclar mensaje</translation> <translation>Desanclar mensaje</translation>
</message> </message>
<message>
<source>More Options...</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>MessageListViewItemSimple</name> <name>MessageListViewItemSimple</name>

View file

@ -435,6 +435,14 @@
<source>Location (%1/%2)</source> <source>Location (%1/%2)</source>
<translation>Sijainti (%1/%2)</translation> <translation>Sijainti (%1/%2)</translation>
</message> </message>
<message>
<source>Copy Message to Clipboard</source>
<translation type="unfinished">Kopioi viesti leikepöydälle</translation>
</message>
<message>
<source>Message Options</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>ChatSelectionPage</name> <name>ChatSelectionPage</name>
@ -992,6 +1000,10 @@
<source>Unpin Message</source> <source>Unpin Message</source>
<translation>Poista viestin kiinnitys</translation> <translation>Poista viestin kiinnitys</translation>
</message> </message>
<message>
<source>More Options...</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>MessageListViewItemSimple</name> <name>MessageListViewItemSimple</name>

View file

@ -425,6 +425,14 @@
<source>Location (%1/%2)</source> <source>Location (%1/%2)</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Copy Message to Clipboard</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Message Options</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>ChatSelectionPage</name> <name>ChatSelectionPage</name>
@ -977,6 +985,10 @@
<source>Unpin Message</source> <source>Unpin Message</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>More Options...</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>MessageListViewItemSimple</name> <name>MessageListViewItemSimple</name>

View file

@ -435,6 +435,14 @@
<source>Location (%1/%2)</source> <source>Location (%1/%2)</source>
<translation>Posizione(%1/%2)</translation> <translation>Posizione(%1/%2)</translation>
</message> </message>
<message>
<source>Copy Message to Clipboard</source>
<translation type="unfinished">Copia messaggio nella clipboard</translation>
</message>
<message>
<source>Message Options</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>ChatSelectionPage</name> <name>ChatSelectionPage</name>
@ -991,6 +999,10 @@
<source>Unpin Message</source> <source>Unpin Message</source>
<translation>Togli messaggio in evidenza</translation> <translation>Togli messaggio in evidenza</translation>
</message> </message>
<message>
<source>More Options...</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>MessageListViewItemSimple</name> <name>MessageListViewItemSimple</name>

View file

@ -445,6 +445,14 @@
<source>Location (%1/%2)</source> <source>Location (%1/%2)</source>
<translation>Lokalizacja (%1/%2)</translation> <translation>Lokalizacja (%1/%2)</translation>
</message> </message>
<message>
<source>Copy Message to Clipboard</source>
<translation type="unfinished">Skopiuj wiadomość do schowka</translation>
</message>
<message>
<source>Message Options</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>ChatSelectionPage</name> <name>ChatSelectionPage</name>
@ -1005,6 +1013,10 @@
<source>Unpin Message</source> <source>Unpin Message</source>
<translation>Odepnij wiadomość</translation> <translation>Odepnij wiadomość</translation>
</message> </message>
<message>
<source>More Options...</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>MessageListViewItemSimple</name> <name>MessageListViewItemSimple</name>

View file

@ -445,6 +445,14 @@
<source>Location (%1/%2)</source> <source>Location (%1/%2)</source>
<translation>Местоположение (%1/%2)</translation> <translation>Местоположение (%1/%2)</translation>
</message> </message>
<message>
<source>Copy Message to Clipboard</source>
<translation type="unfinished">Скопировать в буфер обмена</translation>
</message>
<message>
<source>Message Options</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>ChatSelectionPage</name> <name>ChatSelectionPage</name>
@ -1008,6 +1016,10 @@
<source>Unpin Message</source> <source>Unpin Message</source>
<translation>Открепить сообщение</translation> <translation>Открепить сообщение</translation>
</message> </message>
<message>
<source>More Options...</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>MessageListViewItemSimple</name> <name>MessageListViewItemSimple</name>

View file

@ -445,6 +445,14 @@
<source>Location (%1/%2)</source> <source>Location (%1/%2)</source>
<translation>Poloha (%1/%2)</translation> <translation>Poloha (%1/%2)</translation>
</message> </message>
<message>
<source>Copy Message to Clipboard</source>
<translation type="unfinished">Kopírovať správu do schránky</translation>
</message>
<message>
<source>Message Options</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>ChatSelectionPage</name> <name>ChatSelectionPage</name>
@ -1005,6 +1013,10 @@
<source>Unpin Message</source> <source>Unpin Message</source>
<translation>Odopnúť správu</translation> <translation>Odopnúť správu</translation>
</message> </message>
<message>
<source>More Options...</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>MessageListViewItemSimple</name> <name>MessageListViewItemSimple</name>

View file

@ -435,6 +435,14 @@
<source>Location (%1/%2)</source> <source>Location (%1/%2)</source>
<translation>Plats (%1/%2)</translation> <translation>Plats (%1/%2)</translation>
</message> </message>
<message>
<source>Copy Message to Clipboard</source>
<translation type="unfinished">Kopiera meddelandet till urklipp</translation>
</message>
<message>
<source>Message Options</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>ChatSelectionPage</name> <name>ChatSelectionPage</name>
@ -991,6 +999,10 @@
<source>Unpin Message</source> <source>Unpin Message</source>
<translation>Lösgör meddelandet</translation> <translation>Lösgör meddelandet</translation>
</message> </message>
<message>
<source>More Options...</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>MessageListViewItemSimple</name> <name>MessageListViewItemSimple</name>

View file

@ -425,6 +425,14 @@
<source>Location (%1/%2)</source> <source>Location (%1/%2)</source>
<translation> (%1/%2)</translation> <translation> (%1/%2)</translation>
</message> </message>
<message>
<source>Copy Message to Clipboard</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Message Options</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>ChatSelectionPage</name> <name>ChatSelectionPage</name>
@ -978,6 +986,10 @@
<source>Unpin Message</source> <source>Unpin Message</source>
<translation></translation> <translation></translation>
</message> </message>
<message>
<source>More Options...</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>MessageListViewItemSimple</name> <name>MessageListViewItemSimple</name>

View file

@ -435,6 +435,14 @@
<source>Location (%1/%2)</source> <source>Location (%1/%2)</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Copy Message to Clipboard</source>
<translation type="unfinished">Copy Message to Clipboard</translation>
</message>
<message>
<source>Message Options</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>ChatSelectionPage</name> <name>ChatSelectionPage</name>
@ -991,6 +999,10 @@
<source>Unpin Message</source> <source>Unpin Message</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>More Options...</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>MessageListViewItemSimple</name> <name>MessageListViewItemSimple</name>