🐞 fix(文件传输): 优化下载文件逻辑

添加文件全部下载完成处理,防止传入的从手机获取的文件大小错误导致进度未完成
This commit is contained in:
huheng@kylinos.cn 2023-04-26 16:45:37 +08:00
parent 902d74b0ed
commit 4c431d4ca6
1 changed files with 40 additions and 37 deletions

View File

@ -270,6 +270,10 @@ void FtpManager::ftpCommandFinished(int commandId, bool error)
delete file;
file = nullptr;
m_downFiles.remove(commandId);
if (m_downFiles.isEmpty() && !m_isFree) {
m_isFree = true;
Q_EMIT sigUpdateTransferProgress(0, 0);
}
return;
}
@ -319,8 +323,8 @@ void FtpManager::ftpCommandFinished(int commandId, bool error)
Q_EMIT sigCurrentDirectoryList(m_currentAllFiles);
} else {
QString downloadPath = m_taskDownload.value(0);
qInfo() << "CommandFinished: Successfully obtained the list under "
+ m_taskDownloadMap.value(downloadPath).currentPath + " directory!";
qInfo() << "CommandFinished: Successfully obtained the list under " +
m_taskDownloadMap.value(downloadPath).currentPath + " directory!";
QList<FileInfo> currentDownloadFiles;
QStringList dirPathList;
if (m_taskDownloadMap.value(downloadPath).fileList.isEmpty()) {
@ -791,7 +795,6 @@ void FtpManager::clearErrorFiles()
}
}
void FtpManager::connectFtp()
{
if (m_reconnectNum >= RECONNECT_MAX_NUM) {