Skip to content
Snippets Groups Projects
Unverified Commit 95f1c4d7 authored by Sébastien Blin's avatar Sébastien Blin
Browse files

messagelistmodel: use correct total size on incoming file

use the size from the daemon if the file is downloaded, else
use the size from the commit.

Change-Id: Ia4e7123558e93a1ab0879feab9a141ceefaf183a
GitLab: #833
parent 452efbc7
No related branches found
No related tags found
No related merge requests found
...@@ -206,7 +206,8 @@ Loader { ...@@ -206,7 +206,8 @@ Loader {
transferStats.progress !== transferStats.totalSize) { transferStats.progress !== transferStats.totalSize) {
res += UtilsAdapter.humanFileSize(transferStats.progress) + " / " res += UtilsAdapter.humanFileSize(transferStats.progress) + " / "
} }
res += UtilsAdapter.humanFileSize(transferStats.totalSize) var totalSize = transferStats.totalSize !== 0 ? transferStats.totalSize : TotalSize
res += UtilsAdapter.humanFileSize(totalSize)
} }
return res + " - " + MessagesAdapter.getStatusString(Status) return res + " - " + MessagesAdapter.getStatusString(Status)
} }
......
...@@ -3778,7 +3778,7 @@ ConversationModel::getTransferInfo(const QString& conversationId, ...@@ -3778,7 +3778,7 @@ ConversationModel::getTransferInfo(const QString& conversationId,
return; return;
} else { } else {
QString path; QString path;
qlonglong bytesProgress, totalSize; qlonglong bytesProgress = 0, totalSize = 0;
owner.dataTransferModel owner.dataTransferModel
->fileTransferInfo(owner.id, conversationId, fileId, path, totalSize, bytesProgress); ->fileTransferInfo(owner.id, conversationId, fileId, path, totalSize, bytesProgress);
info.path = path; info.path = path;
......
...@@ -391,6 +391,8 @@ MessageListModel::dataForItem(item_t item, int, int role) const ...@@ -391,6 +391,8 @@ MessageListModel::dataForItem(item_t item, int, int role) const
return repliedMsg == -1 return repliedMsg == -1
? QVariant("") ? QVariant("")
: QVariant(data(repliedMsg, Role::Body).toString().replace("\n", " ")); : QVariant(data(repliedMsg, Role::Body).toString().replace("\n", " "));
case Role::TotalSize:
return QVariant(item.second.commit["totalSize"].toInt());
case Role::TransferName: case Role::TransferName:
return QVariant(item.second.commit["displayName"]); return QVariant(item.second.commit["displayName"]);
case Role::Readers: case Role::Readers:
......
...@@ -47,6 +47,7 @@ struct Info; ...@@ -47,6 +47,7 @@ struct Info;
X(ReplyTo) \ X(ReplyTo) \
X(ReplyToBody) \ X(ReplyToBody) \
X(ReplyToAuthor) \ X(ReplyToAuthor) \
X(TotalSize) \
X(TransferName) \ X(TransferName) \
X(Readers) X(Readers)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment