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,17 +95,40 @@ Item {
anchors.centerIn: parent anchors.centerIn: parent
} }
Button { Column {
id: openDocumentButton id: openDocumentArea
preferredWidth: Theme.buttonWidthMedium
anchors.centerIn: parent
text: qsTr("Open Document")
visible: false visible: false
highlighted: documentPreviewItem.highlighted || down spacing: Theme.paddingMedium
onClicked: { width: parent.width
documentPreviewItem.openRequested = true;
tdLibWrapper.openFileOnDevice(documentData.document.local.path); onVisibleChanged: {
visible ? (documentPreviewItem.height = openDocumentArea.height) : (documentPreviewItem.height = Theme.itemSizeLarge);
}
Button {
id: openDocumentButton
preferredWidth: Theme.buttonWidthMedium
anchors.horizontalCenter: parent.horizontalCenter
text: qsTr("Open Document")
highlighted: documentPreviewItem.highlighted || down
onClicked: {
documentPreviewItem.openRequested = true;
tdLibWrapper.openFileOnDevice(documentData.document.local.path);
}
}
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>