Commit b5241ed2 authored by Martin Straka's avatar Martin Straka

Removed total attachment size computing from send message method

parent 4c41aee8
...@@ -681,8 +681,6 @@ void IsdsWrapper::sendMessage(const QString &userName, qint64 dmID, ...@@ -681,8 +681,6 @@ void IsdsWrapper::sendMessage(const QString &userName, qint64 dmID,
envelope.setDmPublishOwnID(dmPublishOwnID ? Isds::Type::BOOL_TRUE : envelope.setDmPublishOwnID(dmPublishOwnID ? Isds::Type::BOOL_TRUE :
Isds::Type::BOOL_FALSE); Isds::Type::BOOL_FALSE);
int totalAttachmentSizeKBs = 0;
FileDb *fDb = GlobInstcs::fileDbsPtr->accessFileDb( FileDb *fDb = GlobInstcs::fileDbsPtr->accessFileDb(
GlobInstcs::setPtr->dbsLocation, userName, GlobInstcs::setPtr->dbsLocation, userName,
(*GlobInstcs::acntMapPtr)[userName].storeToDisk()); (*GlobInstcs::acntMapPtr)[userName].storeToDisk());
...@@ -715,19 +713,15 @@ void IsdsWrapper::sendMessage(const QString &userName, qint64 dmID, ...@@ -715,19 +713,15 @@ void IsdsWrapper::sendMessage(const QString &userName, qint64 dmID,
// load file content from database, valid file ID // load file content from database, valid file ID
document = fDb->getFileFromDb(file.fileId()); document = fDb->getFileFromDb(file.fileId());
document.setFileMetaType(fileMetaType); document.setFileMetaType(fileMetaType);
totalAttachmentSizeKBs += document.binaryContent().size() / 1024;
} else if (file.fileId() == Files::DB_ZFO_ID) { } else if (file.fileId() == Files::DB_ZFO_ID) {
// load zfo content from zfo database // load zfo content from zfo database
document.setBase64Content( document.setBase64Content(
GlobInstcs::zfoDbPtr->getZfoContentFromDb(dmID, GlobInstcs::zfoDbPtr->getZfoContentFromDb(dmID,
(*GlobInstcs::acntMapPtr)[userName].isTestAccount())); (*GlobInstcs::acntMapPtr)[userName].isTestAccount()));
totalAttachmentSizeKBs += document.binaryContent().size() / 1024;
GlobInstcs::zfoDbPtr->updateZfoLastAccessTime(dmID, GlobInstcs::zfoDbPtr->updateZfoLastAccessTime(dmID,
(*GlobInstcs::acntMapPtr)[userName].isTestAccount()); (*GlobInstcs::acntMapPtr)[userName].isTestAccount());
} else if (!file.filePath().isEmpty()) { } else if (!file.filePath().isEmpty()) {
// load file content from storage (path) // load file content from storage (path)
QFileInfo fi(file.filePath());
totalAttachmentSizeKBs += fi.size() / 1024;
QFile fin(file.filePath()); QFile fin(file.filePath());
if (!fin.open(QIODevice::ReadOnly)) { if (!fin.open(QIODevice::ReadOnly)) {
Dialogues::errorMessage(Dialogues::CRITICAL, Dialogues::errorMessage(Dialogues::CRITICAL,
...@@ -746,7 +740,8 @@ void IsdsWrapper::sendMessage(const QString &userName, qint64 dmID, ...@@ -746,7 +740,8 @@ void IsdsWrapper::sendMessage(const QString &userName, qint64 dmID,
fileMetaType = Isds::Type::FMT_ENCLOSURE; fileMetaType = Isds::Type::FMT_ENCLOSURE;
} }
envelope.setDmAttachmentSize(totalAttachmentSizeKBs); /* Set total attachment size in KB from attachment model. */
envelope.setDmAttachmentSize(attachModel->dataSizeSum() / 1024);
const QList<DataboxModelEntry> dbList = databoxModel->allEntries(); const QList<DataboxModelEntry> dbList = databoxModel->allEntries();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment