diff --git a/qml/components/ImagePreview.qml b/qml/components/ImagePreview.qml
index 98a4d70..68dff15 100644
--- a/qml/components/ImagePreview.qml
+++ b/qml/components/ImagePreview.qml
@@ -26,7 +26,6 @@ Item {
property ListItem messageListItem
property MessageOverlayFlickable overlayFlickable
property var rawMessage: messageListItem ? messageListItem.myMessage : overlayFlickable.overlayMessage
- property var photoData: rawMessage.content.photo
readonly property int defaultHeight: Math.round(width * 2 / 3)
property bool highlighted
@@ -35,15 +34,19 @@ Item {
function clicked() {
pageStack.push(Qt.resolvedUrl("../pages/ImagePage.qml"), {
- "photoData" : imagePreviewItem.photoData,
- "pictureFileInformation" : imageFile.fileInformation
+ "photoData" : imagePreviewItem.rawMessage.content.photo
})
}
- Component.onCompleted: {
- if (photoData) {
+ Component.onCompleted: updateImage()
+
+ onRawMessageChanged: updateImage()
+
+ function updateImage() {
+ if (rawMessage.content.photo) {
// Check first which size fits best...
var photo
+ var photoData = rawMessage.content.photo
for (var i = 0; i < photoData.sizes.length; i++) {
photo = photoData.sizes[i].photo
if (photoData.sizes[i].width >= imagePreviewItem.width) {
diff --git a/qml/pages/ImagePage.qml b/qml/pages/ImagePage.qml
index eb301d7..9b057b5 100644
--- a/qml/pages/ImagePage.qml
+++ b/qml/pages/ImagePage.qml
@@ -18,6 +18,7 @@
*/
import QtQuick 2.6
import Sailfish.Silica 1.0
+import WerkWolf.Fernschreiber 1.0
import "../components"
import "../js/functions.js" as Functions
import "../js/debug.js" as Debug
@@ -28,9 +29,7 @@ Page {
backNavigation: !imageOnly
property var photoData;
- property var pictureFileInformation;
- property string imageUrl;
property int imageWidth;
property int imageHeight;
@@ -47,40 +46,31 @@ Page {
property bool imageOnly
Component.onCompleted: {
- updatePicture();
- }
-
- function updatePicture() {
- if (typeof photoData === "object") {
+ if (photoData) {
// Check first which size fits best...
+ var photo
for (var i = 0; i < photoData.sizes.length; i++) {
imagePage.imageWidth = photoData.sizes[i].width;
imagePage.imageHeight = photoData.sizes[i].height;
- imagePage.pictureFileInformation = photoData.sizes[i].photo;
+ photo = photoData.sizes[i].photo
if (photoData.sizes[i].width >= imagePage.width) {
break;
}
}
-
- if (imagePage.pictureFileInformation.local.is_downloading_completed) {
- imagePage.imageUrl = imagePage.pictureFileInformation.local.path;
- } else {
- tdLibWrapper.downloadFile(imagePage.pictureFileInformation.id);
+ if (photo) {
+ imageFile.fileInformation = photo
}
}
}
+ TDLibFile {
+ id: imageFile
+ tdlib: tdLibWrapper
+ autoLoad: true
+ }
+
Connections {
target: tdLibWrapper
- onFileUpdated: {
- if (fileId === imagePage.pictureFileInformation.id) {
- Debug.log("File updated, completed? ", fileInformation.local.is_downloading_completed);
- if (fileInformation.local.is_downloading_completed) {
- imagePage.pictureFileInformation = fileInformation;
- imagePage.imageUrl = fileInformation.local.path;
- }
- }
- }
onCopyToDownloadsSuccessful: {
appNotification.show(qsTr("Download of %1 successful.").arg(fileName), filePath);
}
@@ -96,11 +86,11 @@ Page {
interactive: !imageOnly
PullDownMenu {
- visible: !imageOnly && imageUrl
+ visible: !imageOnly && imageFile.isDownloadingCompleted && imageFile.path
MenuItem {
text: qsTr("Download Picture")
onClicked: {
- tdLibWrapper.copyFileToDownloads(imagePage.imageUrl);
+ tdLibWrapper.copyFileToDownloads(imageFile.path);
}
}
}
@@ -134,7 +124,7 @@ Page {
Image {
id: singleImage
- source: imageUrl
+ source: imageFile.isDownloadingCompleted ? imageFile.path : ""
width: imagePage.imageWidth * imagePage.sizingFactor
height: imagePage.imageHeight * imagePage.sizingFactor
anchors.centerIn: parent
diff --git a/translations/harbour-fernschreiber-ru.ts b/translations/harbour-fernschreiber-ru.ts
index 6a711af..515ee02 100644
--- a/translations/harbour-fernschreiber-ru.ts
+++ b/translations/harbour-fernschreiber-ru.ts
@@ -49,7 +49,7 @@
- Этот продукт использует Telegram API, но не одобрен или сертифицирован Telegram.
+ Этот продукт использует Telegram API, но не одобрен или сертифицирован Telegram FZ-LLC
@@ -1082,7 +1082,7 @@
- Сихронизация контактов с Телеграм
+ Синхронизировать с Телеграм
@@ -1592,7 +1592,7 @@
- Готов
+ Ожидание