diff options
author | Dirk Voelzke <dv@openoffice.org> | 2010-05-06 11:15:51 +0200 |
---|---|---|
committer | Dirk Voelzke <dv@openoffice.org> | 2010-05-06 11:15:51 +0200 |
commit | 465099eb825f40ec15af1499444263cbb3d7df19 (patch) | |
tree | a5e381f64a76e26b0bf3f2c2eb4371a3a6f74f14 /extensions | |
parent | 9385764450cc74df8ef985dba686e0d504c28917 (diff) |
dv12#i88957# improved handling of downloading new versions
Diffstat (limited to 'extensions')
-rwxr-xr-x[-rw-r--r--] | extensions/source/update/check/download.cxx | 15 | ||||
-rwxr-xr-x[-rw-r--r--] | extensions/source/update/check/updatecheck.cxx | 19 | ||||
-rwxr-xr-x[-rw-r--r--] | extensions/source/update/check/updatecheckconfig.cxx | 2 |
3 files changed, 26 insertions, 10 deletions
diff --git a/extensions/source/update/check/download.cxx b/extensions/source/update/check/download.cxx index 9e10abf27a0e..09d90f1eaa83 100644..100755 --- a/extensions/source/update/check/download.cxx +++ b/extensions/source/update/check/download.cxx @@ -305,6 +305,19 @@ bool curl_run(const rtl::OUString& rURL, OutData& out, const rtl::OString& aProx ret = true; } + if ( CURLE_PARTIAL_FILE == cc ) + { + // this sometimes happens, when a user throws away his user data, but has already + // completed the download of an update. + double fDownloadSize; + curl_easy_getinfo( pCURL, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &fDownloadSize ); + if ( -1 == fDownloadSize ) + { + out.Handler->downloadFinished(out.File); + ret = true; + } + } + // Avoid target file being removed else if( (CURLE_ABORTED_BY_CALLBACK == cc) || out.StopCondition.check() ) ret = true; @@ -388,7 +401,7 @@ Download::start(const rtl::OUString& rURL, const rtl::OUString& rFile, const rtl aFile = rtl::OUString(); } else - m_aHandler->downloadStarted( aFile, 1 ); + m_aHandler->downloadStarted( aFile, 0 ); } else { diff --git a/extensions/source/update/check/updatecheck.cxx b/extensions/source/update/check/updatecheck.cxx index d89233e88dc2..d65a97e49dc6 100644..100755 --- a/extensions/source/update/check/updatecheck.cxx +++ b/extensions/source/update/check/updatecheck.cxx @@ -824,7 +824,7 @@ UpdateCheck::initialize(const uno::Sequence< beans::NamedValue >& rValues, if( nDownloadSize > 0 ) { - if ( nDownloadSize == nFileSize ) // we have already downloaded everthing + if ( nDownloadSize <= nFileSize ) // we have already downloaded everthing { bContinueDownload = false; bDownloadAvailable = true; @@ -1177,15 +1177,18 @@ UpdateCheck::downloadProgressAt(sal_Int8 nPercent) void UpdateCheck::downloadStarted(const rtl::OUString& rLocalFileName, sal_Int64 nFileSize) { - osl::MutexGuard aGuard(m_aMutex); + if ( nFileSize > 0 ) + { + osl::MutexGuard aGuard(m_aMutex); - rtl::Reference< UpdateCheckConfig > aModel(UpdateCheckConfig::get(m_xContext)); - aModel->storeLocalFileName(rLocalFileName, nFileSize); + rtl::Reference< UpdateCheckConfig > aModel(UpdateCheckConfig::get(m_xContext)); + aModel->storeLocalFileName(rLocalFileName, nFileSize); - // Bring-up release note for position 1 .. - const rtl::OUString aURL(getReleaseNote(m_aUpdateInfo, 1, aModel->isAutoDownloadEnabled())); - if( aURL.getLength() > 0 ) - showReleaseNote(aURL); + // Bring-up release note for position 1 .. + const rtl::OUString aURL(getReleaseNote(m_aUpdateInfo, 1, aModel->isAutoDownloadEnabled())); + if( aURL.getLength() > 0 ) + showReleaseNote(aURL); + } } //------------------------------------------------------------------------------ diff --git a/extensions/source/update/check/updatecheckconfig.cxx b/extensions/source/update/check/updatecheckconfig.cxx index b3e559c5f136..9f78b33270c2 100644..100755 --- a/extensions/source/update/check/updatecheckconfig.cxx +++ b/extensions/source/update/check/updatecheckconfig.cxx @@ -398,7 +398,7 @@ UpdateCheckConfig::storeLocalFileName(const rtl::OUString& rLocalFileName, sal_I if( m_xContainer->hasByName(aNameList[i]) ) m_xContainer->replaceByName(aNameList[i], aValueList[i]); else - m_xContainer->insertByName(aNameList[i],aValueList[i]); + m_xContainer->insertByName(aNameList[i], aValueList[i]); } commitChanges(); |