diff --git a/CHANGELOG.md b/CHANGELOG.md index 30561b3ee..2b1925229 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## 4.4.0 - [Undefined] +## 4.4.1 - [undefined] + +### Fixed +- Fix codec downloading on Windows and popup progress bar. + +## 4.4.0 - 2022-04-04 ### Added - Features: diff --git a/linphone-app/src/components/file/FileDownloader.cpp b/linphone-app/src/components/file/FileDownloader.cpp index 256a97999..de186b3ba 100644 --- a/linphone-app/src/components/file/FileDownloader.cpp +++ b/linphone-app/src/components/file/FileDownloader.cpp @@ -29,259 +29,267 @@ // ============================================================================= namespace { - constexpr char cDefaultFileName[] = "download"; +constexpr char cDefaultFileName[] = "download"; } static QString getDownloadFilePath (const QString &folder, const QUrl &url, const bool& overwrite) { - QFileInfo fileInfo(url.path()); - QString fileName = fileInfo.fileName(); - if (fileName.isEmpty()) - fileName = cDefaultFileName; - - fileName.prepend(folder); - if( overwrite && QFile::exists(fileName)) - QFile::remove(fileName); - if (!QFile::exists(fileName)) - return fileName; - - // Already exists, don't overwrite. - QString baseName = fileInfo.completeBaseName(); - if (baseName.isEmpty()) - baseName = cDefaultFileName; - - QString suffix = fileInfo.suffix(); - if (!suffix.isEmpty()) - suffix.prepend("."); - - for (int i = 1; true; ++i) { - fileName = folder + baseName + "(" + QString::number(i) + ")" + suffix; - if (!QFile::exists(fileName)) - break; - } - return fileName; + QFileInfo fileInfo(url.path()); + QString fileName = fileInfo.fileName(); + if (fileName.isEmpty()) + fileName = cDefaultFileName; + + fileName.prepend(folder); + if( overwrite && QFile::exists(fileName)) + QFile::remove(fileName); + if (!QFile::exists(fileName)) + return fileName; + + // Already exists, don't overwrite. + QString baseName = fileInfo.completeBaseName(); + if (baseName.isEmpty()) + baseName = cDefaultFileName; + + QString suffix = fileInfo.suffix(); + if (!suffix.isEmpty()) + suffix.prepend("."); + + for (int i = 1; true; ++i) { + fileName = folder + baseName + "(" + QString::number(i) + ")" + suffix; + if (!QFile::exists(fileName)) + break; + } + return fileName; } static bool isHttpRedirect (QNetworkReply *reply) { - Q_CHECK_PTR(reply); - int statusCode = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); - return statusCode == 301 || statusCode == 302 || statusCode == 303 - || statusCode == 305 || statusCode == 307 || statusCode == 308; + Q_CHECK_PTR(reply); + int statusCode = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); + return statusCode == 301 || statusCode == 302 || statusCode == 303 + || statusCode == 305 || statusCode == 307 || statusCode == 308; } // ----------------------------------------------------------------------------- void FileDownloader::download () { - if (mDownloading) { - qWarning() << "Unable to download file. Already downloading!"; - return; - } - setDownloading(true); - - QNetworkRequest request(mUrl); - request.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true); - mNetworkReply = mManager.get(request); - - QNetworkReply *data = mNetworkReply.data(); - - QObject::connect(data, &QNetworkReply::readyRead, this, &FileDownloader::handleReadyData); - QObject::connect(data, &QNetworkReply::finished, this, &FileDownloader::handleDownloadFinished); - QObject::connect(data, QNonConstOverload::of(&QNetworkReply::error), this, &FileDownloader::handleError); - QObject::connect(data, &QNetworkReply::downloadProgress, this, &FileDownloader::handleDownloadProgress); - - #if QT_CONFIG(ssl) - QObject::connect(data, &QNetworkReply::sslErrors, this, &FileDownloader::handleSslErrors); - #endif - - if (mDownloadFolder.isEmpty()) { - if(CoreManager::isInstanciated()) - mDownloadFolder = CoreManager::getInstance()->getSettingsModel()->getDownloadFolder(); - else - mDownloadFolder = QDir::cleanPath(Utils::coreStringToAppString(Paths::getDownloadDirPath ()) + QDir::separator()); - emit downloadFolderChanged(mDownloadFolder); - } - - Q_ASSERT(!mDestinationFile.isOpen()); - mDestinationFile.setFileName(getDownloadFilePath(QDir::cleanPath(mDownloadFolder) + QDir::separator(), mUrl, mOverwriteFile)); - if (!mDestinationFile.open(QIODevice::WriteOnly)) - emitOutputError(); - else { - mTimeoutReadBytes = 0; - mTimeout.start(); - } + if (mDownloading) { + qWarning() << "Unable to download file. Already downloading!"; + return; + } + setDownloading(true); + + QNetworkRequest request(mUrl); + request.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true); + mNetworkReply = mManager.get(request); + + QNetworkReply *data = mNetworkReply.data(); + + QObject::connect(data, &QNetworkReply::readyRead, this, &FileDownloader::handleReadyData); + QObject::connect(data, &QNetworkReply::finished, this, &FileDownloader::handleDownloadFinished); +#if QT_VERSION > QT_VERSION_CHECK(5, 15, 0) + QObject::connect(data, &QNetworkReply::errorOccurred, this, &FileDownloader::handleError); +#else + QObject::connect(data, QNonConstOverload::of(&QNetworkReply::error), this, &FileDownloader::handleError); +#endif + QObject::connect(data, &QNetworkReply::downloadProgress, this, &FileDownloader::handleDownloadProgress); + +#if QT_CONFIG(ssl) + QObject::connect(data, &QNetworkReply::sslErrors, this, &FileDownloader::handleSslErrors); +#endif + + if (mDownloadFolder.isEmpty()) { + if(CoreManager::isInstanciated()) + mDownloadFolder = CoreManager::getInstance()->getSettingsModel()->getDownloadFolder(); + else + mDownloadFolder = QDir::cleanPath(Utils::coreStringToAppString(Paths::getDownloadDirPath ()) + QDir::separator()); + emit downloadFolderChanged(mDownloadFolder); + } + + Q_ASSERT(!mDestinationFile.isOpen()); + mDestinationFile.setFileName(getDownloadFilePath(QDir::cleanPath(mDownloadFolder) + QDir::separator(), mUrl, mOverwriteFile)); + if (!mDestinationFile.open(QIODevice::WriteOnly)) + emitOutputError(); + else { + mTimeoutReadBytes = 0; + mTimeout.start(); + } } bool FileDownloader::remove () { - return mDestinationFile.exists() && !mDestinationFile.isOpen() && mDestinationFile.remove(); + return mDestinationFile.exists() && !mDestinationFile.isOpen() && mDestinationFile.remove(); } void FileDownloader::emitOutputError () { - qWarning() << QStringLiteral("Could not write into `%1` (%2).") - .arg(mDestinationFile.fileName()).arg(mDestinationFile.errorString()); - mNetworkReply->abort(); + qWarning() << QStringLiteral("Could not write into `%1` (%2).") + .arg(mDestinationFile.fileName()).arg(mDestinationFile.errorString()); + mNetworkReply->abort(); } void FileDownloader::cleanDownloadEnd () { - mTimeout.stop(); - mNetworkReply->deleteLater(); - setDownloading(false); + mTimeout.stop(); + mNetworkReply->deleteLater(); + setDownloading(false); } void FileDownloader::handleReadyData () { - QByteArray data = mNetworkReply->readAll(); - if (mDestinationFile.write(data) == -1) - emitOutputError(); + QByteArray data = mNetworkReply->readAll(); + if (mDestinationFile.write(data) == -1) + emitOutputError(); } void FileDownloader::handleDownloadFinished() { - if (mNetworkReply->error() != QNetworkReply::NoError) - return; - - if (isHttpRedirect(mNetworkReply)) { - qWarning() << QStringLiteral("Request was redirected."); - mDestinationFile.remove(); - cleanDownloadEnd(); - emit downloadFailed(); - } else { - qInfo() << QStringLiteral("Download of %1 finished to %2").arg(mUrl.toString(), mDestinationFile.fileName()); - mDestinationFile.close(); - cleanDownloadEnd(); - emit downloadFinished(mDestinationFile.fileName()); - } + if (mNetworkReply->error() != QNetworkReply::NoError) + return; + + if (isHttpRedirect(mNetworkReply)) { + qWarning() << QStringLiteral("Request was redirected."); + mDestinationFile.remove(); + cleanDownloadEnd(); + emit downloadFailed(); + } else { + qInfo() << QStringLiteral("Download of %1 finished to %2").arg(mUrl.toString(), mDestinationFile.fileName()); + mDestinationFile.close(); + cleanDownloadEnd(); + emit downloadFinished(mDestinationFile.fileName()); + } } void FileDownloader::handleError (QNetworkReply::NetworkError code) { - if (code != QNetworkReply::OperationCanceledError) - qWarning() << QStringLiteral("Download of %1 failed: %2") - .arg(mUrl.toString()).arg(mNetworkReply->errorString()); - mDestinationFile.remove(); - - cleanDownloadEnd(); - - emit downloadFailed(); + if (code != QNetworkReply::OperationCanceledError) + qWarning() << QStringLiteral("Download of %1 failed: %2") + .arg(mUrl.toString()).arg(mNetworkReply->errorString()); + mDestinationFile.remove(); + + cleanDownloadEnd(); + + emit downloadFailed(); } void FileDownloader::handleSslErrors (const QList &sslErrors) { - #if QT_CONFIG(ssl) - for (const QSslError &error : sslErrors) - qWarning() << QStringLiteral("SSL error: %1").arg(error.errorString()); - #else - Q_UNUSED(sslErrors); - #endif +#if QT_CONFIG(ssl) + for (const QSslError &error : sslErrors) + qWarning() << QStringLiteral("SSL error: %1").arg(error.errorString()); +#else + Q_UNUSED(sslErrors); +#endif } void FileDownloader::handleTimeout () { - if (mReadBytes == mTimeoutReadBytes) { - qWarning() << QStringLiteral("Download of %1 failed: timeout.").arg(mUrl.toString()); - mNetworkReply->abort(); - } else - mTimeoutReadBytes = mReadBytes; + if (mReadBytes == mTimeoutReadBytes) { + qWarning() << QStringLiteral("Download of %1 failed: timeout.").arg(mUrl.toString()); + mNetworkReply->abort(); + } else + mTimeoutReadBytes = mReadBytes; } void FileDownloader::handleDownloadProgress (qint64 readBytes, qint64 totalBytes) { - setReadBytes(readBytes); - setTotalBytes(totalBytes); + setReadBytes(readBytes); + setTotalBytes(totalBytes); } // ----------------------------------------------------------------------------- QUrl FileDownloader::getUrl () const { - return mUrl; + return mUrl; } void FileDownloader::setUrl (const QUrl &url) { - if (mDownloading) { - qWarning() << QStringLiteral("Unable to set url, a file is downloading."); - return; - } - - if (mUrl != url) { - mUrl = url; - emit urlChanged(mUrl); - } + if (mDownloading) { + qWarning() << QStringLiteral("Unable to set url, a file is downloading."); + return; + } + + if (mUrl != url) { + mUrl = url; + if(!QSslSocket::supportsSsl() && mUrl.scheme() == "https") { + qWarning() << "Https has been requested but SSL is not supported. Fallback to http. Install manually OpenSSL libraries in your PATH."; + mUrl.setScheme("http"); + } + emit urlChanged(mUrl); + } } QString FileDownloader::getDownloadFolder () const { - return mDownloadFolder; + return mDownloadFolder; } void FileDownloader::setDownloadFolder (const QString &downloadFolder) { - if (mDownloading) { - qWarning() << QStringLiteral("Unable to set download folder, a file is downloading."); - return; - } - - if (mDownloadFolder != downloadFolder) { - mDownloadFolder = downloadFolder; - emit downloadFolderChanged(mDownloadFolder); - } + if (mDownloading) { + qWarning() << QStringLiteral("Unable to set download folder, a file is downloading."); + return; + } + + if (mDownloadFolder != downloadFolder) { + mDownloadFolder = downloadFolder; + emit downloadFolderChanged(mDownloadFolder); + } } QString FileDownloader::getDestinationFileName () const{ - return mDestinationFile.fileName(); + return mDestinationFile.fileName(); } void FileDownloader::setOverwriteFile(const bool &overwrite){ - mOverwriteFile = overwrite; + mOverwriteFile = overwrite; } QString FileDownloader::synchronousDownload(const QUrl &url, const QString &destinationFolder, const bool &overwriteFile){ - QString filePath; - FileDownloader downloader; - if(url.isRelative()) - qWarning() << "FileDownloader: The specified URL is not valid"; - else{ - bool isOver = false; - bool * pIsOver = &isOver; - downloader.setUrl(url); - downloader.setOverwriteFile(overwriteFile); - downloader.setDownloadFolder(destinationFolder); - connect(&downloader, &FileDownloader::downloadFinished, [pIsOver]()mutable{ - *pIsOver=true; - }); - connect(&downloader, &FileDownloader::downloadFailed, [pIsOver]()mutable{ - *pIsOver=true; - }); - downloader.download(); - if(QTest::qWaitFor([&]() {return isOver;}, DefaultTimeout)){ - filePath = downloader.getDestinationFileName(); - if(!QFile::exists(filePath)) { - filePath = ""; - qWarning() << "FileDownloader: Cannot download the specified file"; - } - } - } - return filePath; + QString filePath; + FileDownloader downloader; + if(url.isRelative()) + qWarning() << "FileDownloader: The specified URL is not valid"; + else{ + bool isOver = false; + bool * pIsOver = &isOver; + downloader.setUrl(url); + downloader.setOverwriteFile(overwriteFile); + downloader.setDownloadFolder(destinationFolder); + connect(&downloader, &FileDownloader::downloadFinished, [pIsOver]()mutable{ + *pIsOver=true; + }); + connect(&downloader, &FileDownloader::downloadFailed, [pIsOver]()mutable{ + *pIsOver=true; + }); + downloader.download(); + if(QTest::qWaitFor([&]() {return isOver;}, DefaultTimeout)){ + filePath = downloader.getDestinationFileName(); + if(!QFile::exists(filePath)) { + filePath = ""; + qWarning() << "FileDownloader: Cannot download the specified file"; + } + } + } + return filePath; } qint64 FileDownloader::getReadBytes () const { - return mReadBytes; + return mReadBytes; } void FileDownloader::setReadBytes (qint64 readBytes) { - if (mReadBytes != readBytes) { - mReadBytes = readBytes; - emit readBytesChanged(readBytes); - } + if (mReadBytes != readBytes) { + mReadBytes = readBytes; + emit readBytesChanged(readBytes); + } } qint64 FileDownloader::getTotalBytes () const { - return mTotalBytes; + return mTotalBytes; } void FileDownloader::setTotalBytes (qint64 totalBytes) { - if (mTotalBytes != totalBytes) { - mTotalBytes = totalBytes; - emit totalBytesChanged(totalBytes); - } + if (mTotalBytes != totalBytes) { + mTotalBytes = totalBytes; + emit totalBytesChanged(totalBytes); + } } bool FileDownloader::getDownloading () const { - return mDownloading; + return mDownloading; } void FileDownloader::setDownloading (bool downloading) { - if (mDownloading != downloading) { - mDownloading = downloading; - emit downloadingChanged(downloading); - } + if (mDownloading != downloading) { + mDownloading = downloading; + emit downloadingChanged(downloading); + } } diff --git a/linphone-app/src/components/file/FileExtractor.cpp b/linphone-app/src/components/file/FileExtractor.cpp index a762351f6..2f56d4590 100644 --- a/linphone-app/src/components/file/FileExtractor.cpp +++ b/linphone-app/src/components/file/FileExtractor.cpp @@ -38,28 +38,28 @@ FileExtractor::FileExtractor (QObject *parent) : QObject(parent) {} FileExtractor::~FileExtractor () {} void FileExtractor::extract () { - if (mExtracting) { - qWarning() << "Unable to extract file. Already extracting!"; - return; - } - setExtracting(true); - QFileInfo fileInfo(mFile); - if(!fileInfo.isReadable()){ - emitExtractFailed(-1); - return; - } - - mDestinationFile = QDir::cleanPath(mExtractFolder) + QDir::separator() + (mExtractName.isEmpty() ? fileInfo.completeBaseName() : mExtractName); - if(QFile::exists(mDestinationFile) && !QFile::remove(mDestinationFile)){ - emitOutputError(); - return; - } - if( mTimer == nullptr){ - mTimer = new QTimer(this); - QObject::connect(mTimer, &QTimer::timeout, this, &FileExtractor::handleExtraction); - } + if (mExtracting) { + qWarning() << "Unable to extract file. Already extracting!"; + return; + } + setExtracting(true); + QFileInfo fileInfo(mFile); + if(!fileInfo.isReadable()){ + emitExtractFailed(-1); + return; + } + + mDestinationFile = QDir::cleanPath(mExtractFolder) + QDir::separator() + (mExtractName.isEmpty() ? fileInfo.completeBaseName() : mExtractName); + if(QFile::exists(mDestinationFile) && !QFile::remove(mDestinationFile)){ + emitOutputError(); + return; + } + if( mTimer == nullptr){ + mTimer = new QTimer(this); + QObject::connect(mTimer, &QTimer::timeout, this, &FileExtractor::handleExtraction); + } #ifdef WIN32 -// Test the presence of bzip2 in the system + // Test the presence of bzip2 in the system QProcess process; process.closeReadChannel(QProcess::StandardOutput); process.closeReadChannel(QProcess::StandardError); @@ -76,17 +76,19 @@ void FileExtractor::extract () { fileDownloader->setDownloadFolder(Utils::coreStringToAppString(Paths::getToolsDirPath())); QObject::connect(fileDownloader, &FileDownloader::totalBytesChanged, this, &FileExtractor::setTotalBytes); QObject::connect(fileDownloader, &FileDownloader::readBytesChanged, this, &FileExtractor::setReadBytes); - - QObject::connect(fileDownloader, &FileDownloader::downloadFinished, [fileDownloader, timer, downloadStep ]()mutable { + + QObject::connect(fileDownloader, &FileDownloader::downloadFinished, [fileDownloader, timer, downloadStep,this ]()mutable { if( downloadStep++ == 0){ fileDownloader->setUrl(QUrl(Constants::LinphoneBZip2_dll)); fileDownloader->download(); }else { fileDownloader->deleteLater(); + QObject::disconnect(fileDownloader, &FileDownloader::totalBytesChanged, this, &FileExtractor::setTotalBytes); + QObject::disconnect(fileDownloader, &FileDownloader::readBytesChanged, this, &FileExtractor::setReadBytes); timer->start(); } }); - + QObject::connect(fileDownloader, &FileDownloader::downloadFailed, [fileDownloader, this]() { fileDownloader->deleteLater(); emitExtractorFailed(); @@ -99,141 +101,138 @@ void FileExtractor::extract () { } bool FileExtractor::remove () { - return QFile::exists(mDestinationFile) && QFile::remove(mDestinationFile); + return QFile::exists(mDestinationFile) && QFile::remove(mDestinationFile); } QString FileExtractor::getFile () const { - return mFile; + return mFile; } void FileExtractor::setFile (const QString &file) { - if (mExtracting) { - qWarning() << QStringLiteral("Unable to set file, a file is extracting."); - return; - } - if (mFile != file) { - mFile = file; - emit fileChanged(mFile); - } + if (mExtracting) { + qWarning() << QStringLiteral("Unable to set file, a file is extracting."); + return; + } + if (mFile != file) { + mFile = file; + emit fileChanged(mFile); + } } QString FileExtractor::getExtractFolder () const { - return mExtractFolder; + return mExtractFolder; } void FileExtractor::setExtractFolder (const QString &extractFolder) { - if (mExtracting) { - qWarning() << QStringLiteral("Unable to set extract folder, a file is extracting."); - return; - } - if (mExtractFolder != extractFolder) { - mExtractFolder = extractFolder; - emit extractFolderChanged(mExtractFolder); - } + if (mExtracting) { + qWarning() << QStringLiteral("Unable to set extract folder, a file is extracting."); + return; + } + if (mExtractFolder != extractFolder) { + mExtractFolder = extractFolder; + emit extractFolderChanged(mExtractFolder); + } } QString FileExtractor::getExtractName () const { - return mExtractName; + return mExtractName; } void FileExtractor::setExtractName (const QString &extractName) { - if (mExtracting) { - qWarning() << QStringLiteral("Unable to set extract name, a file is extracting."); - return; - } - if (mExtractName != extractName) { - mExtractName = extractName; - emit extractNameChanged(mExtractName); - } + if (mExtracting) { + qWarning() << QStringLiteral("Unable to set extract name, a file is extracting."); + return; + } + if (mExtractName != extractName) { + mExtractName = extractName; + emit extractNameChanged(mExtractName); + } } bool FileExtractor::getExtracting () const { - return mExtracting; + return mExtracting; } void FileExtractor::setExtracting (bool extracting) { - if (mExtracting != extracting) { - mExtracting = extracting; - emit extractingChanged(extracting); - } + if (mExtracting != extracting) { + mExtracting = extracting; + emit extractingChanged(extracting); + } } qint64 FileExtractor::getReadBytes () const { - return mReadBytes; + return mReadBytes; } void FileExtractor::setReadBytes (qint64 readBytes) { - if (mReadBytes != readBytes) { mReadBytes = readBytes; emit readBytesChanged(readBytes); - } } qint64 FileExtractor::getTotalBytes () const { - return mTotalBytes; + return mTotalBytes; } void FileExtractor::setTotalBytes (qint64 totalBytes) { - if (mTotalBytes != totalBytes) { mTotalBytes = totalBytes; emit totalBytesChanged(totalBytes); - } } void FileExtractor::clean () { - if (mTimer) { - mTimer->stop(); - mTimer->deleteLater(); - mTimer = nullptr; - } - setExtracting(false); + if (mTimer) { + mTimer->stop(); + mTimer->deleteLater(); + mTimer = nullptr; + } + setExtracting(false); } void FileExtractor::emitExtractorFailed () { - qWarning() << QStringLiteral("Unable to extract file `%1`. bzip2 is unavailable, please install it.") - .arg(mFile); - clean(); - emit extractFailed(); + qWarning() << QStringLiteral("Unable to extract file `%1`. bzip2 is unavailable, please install it.") + .arg(mFile); + clean(); + emit extractFailed(); } void FileExtractor::emitExtractFailed (int error) { - qWarning() << QStringLiteral("Unable to extract file with bzip2: `%1` (code: %2).") - .arg(mFile).arg(error); - clean(); - emit extractFailed(); + qWarning() << QStringLiteral("Unable to extract file with bzip2: `%1` (code: %2).") + .arg(mFile).arg(error); + clean(); + emit extractFailed(); } void FileExtractor::emitExtractFinished () { - clean(); - emit extractFinished(); + clean(); + emit extractFinished(); } void FileExtractor::emitOutputError () { - qWarning() << QStringLiteral("Could not write into `%1`.") - .arg(mDestinationFile); - clean(); - emit extractFailed(); + qWarning() << QStringLiteral("Could not write into `%1`.") + .arg(mDestinationFile); + clean(); + emit extractFailed(); } void FileExtractor::handleExtraction () { - QString tempDestination = mDestinationFile+"."+QFileInfo(mFile).suffix(); - QStringList args; - args.push_back("-dq"); - args.push_back(tempDestination); - QFile::copy(mFile, tempDestination); + QString tempDestination = mDestinationFile+"."+QFileInfo(mFile).suffix(); + QStringList args; + args.push_back("-dq"); + args.push_back(tempDestination); + QFile::copy(mFile, tempDestination); #ifdef WIN32 - int result = QProcess::execute("bzip2.exe", args); - if( result == -2) - result = QProcess::execute(Utils::coreStringToAppString(Paths::getToolsDirPath())+"\\bzip2.exe", args); + int result = QProcess::execute("bzip2.exe", args); + if( result == -2) + result = QProcess::execute(Utils::coreStringToAppString(Paths::getToolsDirPath())+"\\bzip2.exe", args); #else - int result = QProcess::execute("bzip2", args); + int result = QProcess::execute("bzip2", args); #endif - if(QFile::exists(tempDestination)) - QFile::remove(tempDestination); - if (result == 0) - emitExtractFinished(); - else if (result > 0) - emitExtractFailed(result); - else if(result == -2) - emitExtractorFailed(); - else - emitOutputError(); + if(QFile::exists(tempDestination)) + QFile::remove(tempDestination); + if (result == 0){ + setReadBytes(getTotalBytes()); + emitExtractFinished(); + }else if (result > 0) + emitExtractFailed(result); + else if(result == -2) + emitExtractorFailed(); + else + emitOutputError(); } diff --git a/linphone-app/ui/modules/Linphone/Dialog/OnlineInstallerDialog.qml b/linphone-app/ui/modules/Linphone/Dialog/OnlineInstallerDialog.qml index 4db6d2f93..f77350019 100644 --- a/linphone-app/ui/modules/Linphone/Dialog/OnlineInstallerDialog.qml +++ b/linphone-app/ui/modules/Linphone/Dialog/OnlineInstallerDialog.qml @@ -89,7 +89,7 @@ DialogPlus { to: target.totalBytes value: target.readBytes - indeterminate : true + indeterminate : target.totalBytes == 0 background: Rectangle { color: OnlineInstallerDialogStyle.column.bar.background.color diff --git a/linphone-sdk b/linphone-sdk index fdfb9a2c8..54d354122 160000 --- a/linphone-sdk +++ b/linphone-sdk @@ -1 +1 @@ -Subproject commit fdfb9a2c8de008c4fedc9bd2a9f08459bfa7ec2d +Subproject commit 54d3541222e6a9faeb63a652f0d3d86837bbecdd