diff --git a/libretroshare/src/ft/ftcontroller.cc b/libretroshare/src/ft/ftcontroller.cc index 71e46d777..d30817dcd 100644 --- a/libretroshare/src/ft/ftcontroller.cc +++ b/libretroshare/src/ft/ftcontroller.cc @@ -1685,7 +1685,6 @@ bool ftController::FileDetails(const std::string &hash, FileInfo &info) /* extract details */ info.hash = hash; info.fname = it->second->mName; - info.lastTS = it->second->mCreator->lastRecvTimeStamp(); info.storage_permission_flags.clear() ; info.transfer_info_flags = it->second->mFlags ; info.priority = SPEED_NORMAL ; @@ -1703,7 +1702,10 @@ bool ftController::FileDetails(const std::string &hash, FileInfo &info) { it->second->mTransfer->getFileSources(peerIds); info.priority = it->second->mTransfer->downloadPriority() ; + info.lastTS = it->second->mCreator->lastRecvTimeStamp(); } + else + info.lastTS = 0; double totalRate = 0; uint32_t tfRate = 0; diff --git a/retroshare-gui/src/gui/FileTransfer/TransfersDialog.cpp b/retroshare-gui/src/gui/FileTransfer/TransfersDialog.cpp index f85b3d4c2..f8a332852 100644 --- a/retroshare-gui/src/gui/FileTransfer/TransfersDialog.cpp +++ b/retroshare-gui/src/gui/FileTransfer/TransfersDialog.cpp @@ -937,12 +937,25 @@ int TransfersDialog::addItem(int row, const FileInfo &fileInfo, const std::map::max(); + qint64 qi64LastDL = fileInfo.lastTS ; //std::numeric_limits::max(); - QString strPath = QString::fromUtf8(fileInfo.path.c_str()); - QString strPathAfterDL = strPath; - strPathAfterDL.replace(QString::fromUtf8(rsFiles->getDownloadDirectory().c_str()),""); - QStringList qslPath = strPathAfterDL.split("/"); + if (qi64LastDL == 0) // file is complete, or any raison why the time has not been set properly + { + QFileInfo file; + + if (fileInfo.downloadStatus == FT_STATE_COMPLETE) + file = QFileInfo(QString::fromUtf8(fileInfo.path.c_str()), QString::fromUtf8(fileInfo.fname.c_str())); + else + file = QFileInfo(QString::fromUtf8(rsFiles->getPartialsDirectory().c_str()), QString::fromUtf8(fileInfo.hash.c_str())); + + /*Get Last Access on File */ + if (file.exists()) + qi64LastDL = file.lastModified().toTime_t(); + } + QString strPath = QString::fromUtf8(fileInfo.path.c_str()); + QString strPathAfterDL = strPath; + strPathAfterDL.replace(QString::fromUtf8(rsFiles->getDownloadDirectory().c_str()),""); + QStringList qslPath = strPathAfterDL.split("/"); FileChunksInfo fcinfo; if (!rsFiles->FileDownloadChunksDetails(fileInfo.hash, fcinfo)) {