Add button to copy document to Downloads folder

This commit is contained in:
Sebastian Wolf 2021-01-10 20:26:29 +01:00
parent d4935a4968
commit be2f08553b
No known key found for this signature in database
GPG key ID: CEA9522B5F38A90A
12 changed files with 79 additions and 12 deletions

View file

@ -41,9 +41,9 @@ Item {
if (documentData) { if (documentData) {
if (documentData.document.local.is_downloading_completed) { if (documentData.document.local.is_downloading_completed) {
downloadDocumentButton.visible = false; downloadDocumentButton.visible = false;
openDocumentButton.visible = true; openDocumentArea.visible = true;
} else { } else {
openDocumentButton.visible = false; openDocumentArea.visible = false;
downloadDocumentButton.visible = true; downloadDocumentButton.visible = true;
} }
} }
@ -57,7 +57,7 @@ Item {
downloadingProgressBar.visible = false; downloadingProgressBar.visible = false;
documentData.document = fileInformation; documentData.document = fileInformation;
downloadDocumentButton.visible = false; downloadDocumentButton.visible = false;
openDocumentButton.visible = true; openDocumentArea.visible = true;
if (documentPreviewItem.openRequested) { if (documentPreviewItem.openRequested) {
documentPreviewItem.openRequested = false; documentPreviewItem.openRequested = false;
tdLibWrapper.openFileOnDevice(documentData.document.local.path); tdLibWrapper.openFileOnDevice(documentData.document.local.path);
@ -95,12 +95,21 @@ Item {
anchors.centerIn: parent anchors.centerIn: parent
} }
Column {
id: openDocumentArea
visible: false
spacing: Theme.paddingMedium
width: parent.width
onVisibleChanged: {
visible ? (documentPreviewItem.height = openDocumentArea.height) : (documentPreviewItem.height = Theme.itemSizeLarge);
}
Button { Button {
id: openDocumentButton id: openDocumentButton
preferredWidth: Theme.buttonWidthMedium preferredWidth: Theme.buttonWidthMedium
anchors.centerIn: parent anchors.horizontalCenter: parent.horizontalCenter
text: qsTr("Open Document") text: qsTr("Open Document")
visible: false
highlighted: documentPreviewItem.highlighted || down highlighted: documentPreviewItem.highlighted || down
onClicked: { onClicked: {
documentPreviewItem.openRequested = true; documentPreviewItem.openRequested = true;
@ -108,4 +117,18 @@ Item {
} }
} }
Button {
id: copyDocumentButton
preferredWidth: Theme.buttonWidthMedium
anchors.horizontalCenter: parent.horizontalCenter
text: qsTr("Copy Document to Downloads")
highlighted: documentPreviewItem.highlighted || down
onClicked: {
tdLibWrapper.copyFileToDownloads(documentData.document.local.path);
}
}
}
} }

View file

@ -492,6 +492,10 @@
<source>Open Document</source> <source>Open Document</source>
<translation>Dokument öffnen</translation> <translation>Dokument öffnen</translation>
</message> </message>
<message>
<source>Copy Document to Downloads</source>
<translation>Dokument zu Downloads kopieren</translation>
</message>
</context> </context>
<context> <context>
<name>EditGroupChatPermissionsColumn</name> <name>EditGroupChatPermissionsColumn</name>

View file

@ -492,6 +492,10 @@
<source>Open Document</source> <source>Open Document</source>
<translation>Open Document</translation> <translation>Open Document</translation>
</message> </message>
<message>
<source>Copy Document to Downloads</source>
<translation>Copy Document to Downloads</translation>
</message>
</context> </context>
<context> <context>
<name>EditGroupChatPermissionsColumn</name> <name>EditGroupChatPermissionsColumn</name>

View file

@ -482,6 +482,10 @@
<source>Open Document</source> <source>Open Document</source>
<translation>Abrir Documento</translation> <translation>Abrir Documento</translation>
</message> </message>
<message>
<source>Copy Document to Downloads</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>EditGroupChatPermissionsColumn</name> <name>EditGroupChatPermissionsColumn</name>

View file

@ -493,6 +493,10 @@
<source>Open Document</source> <source>Open Document</source>
<translation>Avaa dokumentti</translation> <translation>Avaa dokumentti</translation>
</message> </message>
<message>
<source>Copy Document to Downloads</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>EditGroupChatPermissionsColumn</name> <name>EditGroupChatPermissionsColumn</name>

View file

@ -482,6 +482,10 @@
<source>Open Document</source> <source>Open Document</source>
<translation>Dokumentum megyitása</translation> <translation>Dokumentum megyitása</translation>
</message> </message>
<message>
<source>Copy Document to Downloads</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>EditGroupChatPermissionsColumn</name> <name>EditGroupChatPermissionsColumn</name>

View file

@ -492,6 +492,10 @@
<source>Open Document</source> <source>Open Document</source>
<translation>Apri documento</translation> <translation>Apri documento</translation>
</message> </message>
<message>
<source>Copy Document to Downloads</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>EditGroupChatPermissionsColumn</name> <name>EditGroupChatPermissionsColumn</name>

View file

@ -502,6 +502,10 @@
<source>Open Document</source> <source>Open Document</source>
<translation>Otwórz dokument</translation> <translation>Otwórz dokument</translation>
</message> </message>
<message>
<source>Copy Document to Downloads</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>EditGroupChatPermissionsColumn</name> <name>EditGroupChatPermissionsColumn</name>

View file

@ -502,6 +502,10 @@
<source>Open Document</source> <source>Open Document</source>
<translation>Открыть документ</translation> <translation>Открыть документ</translation>
</message> </message>
<message>
<source>Copy Document to Downloads</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>EditGroupChatPermissionsColumn</name> <name>EditGroupChatPermissionsColumn</name>

View file

@ -492,6 +492,10 @@
<source>Open Document</source> <source>Open Document</source>
<translation>Öppna dokument</translation> <translation>Öppna dokument</translation>
</message> </message>
<message>
<source>Copy Document to Downloads</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>EditGroupChatPermissionsColumn</name> <name>EditGroupChatPermissionsColumn</name>

View file

@ -483,6 +483,10 @@
<source>Open Document</source> <source>Open Document</source>
<translation></translation> <translation></translation>
</message> </message>
<message>
<source>Copy Document to Downloads</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>EditGroupChatPermissionsColumn</name> <name>EditGroupChatPermissionsColumn</name>

View file

@ -492,6 +492,10 @@
<source>Open Document</source> <source>Open Document</source>
<translation>Open Document</translation> <translation>Open Document</translation>
</message> </message>
<message>
<source>Copy Document to Downloads</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>EditGroupChatPermissionsColumn</name> <name>EditGroupChatPermissionsColumn</name>