diff options
Diffstat (limited to 'desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx')
-rw-r--r-- | desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx | 104 |
1 files changed, 52 insertions, 52 deletions
diff --git a/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx b/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx index 685ce8b7c533..cfc42aa8d88c 100644 --- a/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx +++ b/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -64,7 +64,7 @@ #include "com/sun/star/deployment/ui/LicenseDialog.hpp" #include "com/sun/star/task/XInteractionHandler.hpp" #include "com/sun/star/ui/dialogs/XExecutableDialog.hpp" -#include "com/sun/star/ui/dialogs/ExecutableDialogResults.hpp" +#include "com/sun/star/ui/dialogs/ExecutableDialogResults.hpp" #include "com/sun/star/task/XInteractionAbort.hpp" #include "com/sun/star/task/XInteractionApprove.hpp" @@ -106,7 +106,7 @@ public: void stop(); - + private: Thread(Thread &); // not defined @@ -145,12 +145,12 @@ class UpdateCommandEnv friend class UpdateInstallDialog::Thread; UpdateInstallDialog & m_updateDialog; - ::rtl::Reference<UpdateInstallDialog::Thread> m_installThread; + ::rtl::Reference<UpdateInstallDialog::Thread> m_installThread; cssu::Reference< cssu::XComponentContext > m_xContext; public: virtual ~UpdateCommandEnv(); - UpdateCommandEnv( cssu::Reference< cssu::XComponentContext > const & xCtx, + UpdateCommandEnv( cssu::Reference< cssu::XComponentContext > const & xCtx, UpdateInstallDialog & updateDialog, ::rtl::Reference<UpdateInstallDialog::Thread>const & thread); @@ -199,13 +199,13 @@ void UpdateInstallDialog::Thread::stop() { UpdateInstallDialog::Thread::~Thread() {} -void UpdateInstallDialog::Thread::execute() +void UpdateInstallDialog::Thread::execute() { try { - downloadExtensions(); + downloadExtensions(); installExtensions(); } - catch (...) + catch (...) { } @@ -218,7 +218,7 @@ void UpdateInstallDialog::Thread::execute() { //make sure m_dialog is still alive SolarMutexGuard g; - if (! m_stop) + if (! m_stop) m_dialog.updateDone(); } //UpdateCommandEnv keeps a reference to Thread and prevents destruction. Therefore remove it. @@ -227,7 +227,7 @@ void UpdateInstallDialog::Thread::execute() UpdateInstallDialog::UpdateInstallDialog( - Window * parent, + Window * parent, std::vector<dp_gui::UpdateData> & aVecUpdateData, cssu::Reference< cssu::XComponentContext > const & xCtx): ModalDialog( @@ -245,7 +245,7 @@ UpdateInstallDialog::UpdateInstallDialog( m_sErrorDownload(String(DpGuiResId(RID_DLG_UPDATE_INSTALL_ERROR_DOWNLOAD))), m_sErrorInstallation(String(DpGuiResId(RID_DLG_UPDATE_INSTALL_ERROR_INSTALLATION))), m_sErrorLicenseDeclined(String(DpGuiResId(RID_DLG_UPDATE_INSTALL_ERROR_LIC_DECLINED))), - m_sNoInstall(String(DpGuiResId(RID_DLG_UPDATE_INSTALL_EXTENSION_NOINSTALL))), + m_sNoInstall(String(DpGuiResId(RID_DLG_UPDATE_INSTALL_EXTENSION_NOINSTALL))), m_sThisErrorOccurred(String(DpGuiResId(RID_DLG_UPDATE_INSTALL_THIS_ERROR_OCCURRED))), m_ft_action(this, DpGuiResId(RID_DLG_UPDATE_INSTALL_DOWNLOADING)), m_statusbar(this,DpGuiResId(RID_DLG_UPDATE_INSTALL_STATUSBAR)), @@ -269,21 +269,21 @@ UpdateInstallDialog::UpdateInstallDialog( UpdateInstallDialog::~UpdateInstallDialog() {} -BOOL UpdateInstallDialog::Close() +BOOL UpdateInstallDialog::Close() { m_thread->stop(); return ModalDialog::Close(); } -short UpdateInstallDialog::Execute() -{ +short UpdateInstallDialog::Execute() +{ m_thread->launch(); return ModalDialog::Execute(); } // make sure the solar mutex is locked before calling -void UpdateInstallDialog::updateDone() +void UpdateInstallDialog::updateDone() { if (!m_bError) m_mle_info.InsertText(m_sNoErrors); @@ -293,8 +293,8 @@ void UpdateInstallDialog::updateDone() } // make sure the solar mutex is locked before calling //sets an error message in the text area -void UpdateInstallDialog::setError(INSTALL_ERROR err, ::rtl::OUString const & sExtension, - OUString const & exceptionMessage) +void UpdateInstallDialog::setError(INSTALL_ERROR err, ::rtl::OUString const & sExtension, + OUString const & exceptionMessage) { String sError; m_bError = true; @@ -302,13 +302,13 @@ void UpdateInstallDialog::setError(INSTALL_ERROR err, ::rtl::OUString const & sE switch (err) { case ERROR_DOWNLOAD: - sError = m_sErrorDownload; + sError = m_sErrorDownload; break; case ERROR_INSTALLATION: - sError = m_sErrorInstallation; + sError = m_sErrorInstallation; break; case ERROR_LICENSE_DECLINED: - sError = m_sErrorLicenseDeclined; + sError = m_sErrorLicenseDeclined; break; default: @@ -316,14 +316,14 @@ void UpdateInstallDialog::setError(INSTALL_ERROR err, ::rtl::OUString const & sE } sError.SearchAndReplace(String(OUSTR("%NAME")), String(sExtension), 0); - //We want to have an empty line between the error messages. However, + //We want to have an empty line between the error messages. However, //there shall be no empty line after the last entry. if (m_bNoEntry) m_bNoEntry = false; else m_mle_info.InsertText(OUSTR("\n")); m_mle_info.InsertText(sError); - //Insert more information about the error + //Insert more information about the error if (exceptionMessage.getLength()) m_mle_info.InsertText(m_sThisErrorOccurred + exceptionMessage + OUSTR("\n")); @@ -331,13 +331,13 @@ void UpdateInstallDialog::setError(INSTALL_ERROR err, ::rtl::OUString const & sE m_mle_info.InsertText(OUSTR("\n")); } -void UpdateInstallDialog::setError(OUString const & exceptionMessage) +void UpdateInstallDialog::setError(OUString const & exceptionMessage) { m_bError = true; m_mle_info.InsertText(exceptionMessage + OUSTR("\n")); } -IMPL_LINK(UpdateInstallDialog, cancelHandler, void *, EMPTYARG) +IMPL_LINK(UpdateInstallDialog, cancelHandler, void *, EMPTYARG) { m_thread->stop(); EndDialog(RET_CANCEL); @@ -348,7 +348,7 @@ IMPL_LINK(UpdateInstallDialog, cancelHandler, void *, EMPTYARG) void UpdateInstallDialog::Thread::downloadExtensions() { - try + try { //create the download directory in the temp folder OUString sTempDir; @@ -358,35 +358,35 @@ void UpdateInstallDialog::Thread::downloadExtensions() //create a unique name for the directory OUString tempEntry, destFolder; if (::osl::File::createTempFile(&sTempDir, 0, &tempEntry ) != ::osl::File::E_None) - throw cssu::Exception(OUSTR("Could not create a temporary file in ") + sTempDir + + throw cssu::Exception(OUSTR("Could not create a temporary file in ") + sTempDir + OUSTR(". No extensions will be installed"), 0 ); - + tempEntry = tempEntry.copy( tempEntry.lastIndexOf( '/' ) + 1 ); - + destFolder = dp_misc::makeURL( sTempDir, tempEntry ); destFolder += OUSTR("_"); m_sDownloadFolder = destFolder; - try + try { dp_misc::create_folder(0, destFolder, m_updateCmdEnv.get(), true ); - } catch (cssu::Exception & e) + } catch (cssu::Exception & e) { throw cssu::Exception(e.Message + OUSTR(" No extensions will be installed."), 0); } - + sal_uInt16 count = 0; typedef std::vector<UpdateData>::iterator It; for (It i = m_aVecUpdateData.begin(); i != m_aVecUpdateData.end(); i++) { UpdateData & curData = *i; - + if (!curData.aUpdateInfo.is() || curData.aUpdateSource.is()) continue; - //We assume that m_aVecUpdateData contains only information about extensions which + //We assume that m_aVecUpdateData contains only information about extensions which //can be downloaded directly. OSL_ASSERT(curData.sWebsiteURL.getLength() == 0); - + //update the name of the extension which is to be downloaded { SolarMutexGuard g; @@ -405,7 +405,7 @@ void UpdateInstallDialog::Thread::downloadExtensions() OSL_ENSURE(seqDownloadURLs.getLength() > 0, "No download URL provided!"); for (sal_Int32 j = 0; j < seqDownloadURLs.getLength(); j++) { - try + try { OSL_ENSURE(seqDownloadURLs[j].getLength() > 0, "Download URL is empty!"); download(seqDownloadURLs[j], curData); @@ -420,7 +420,7 @@ void UpdateInstallDialog::Thread::downloadExtensions() //cases. Therefore ignore and continue. continue; } - } + } //update the progress and display download error { SolarMutexGuard g; @@ -441,11 +441,11 @@ void UpdateInstallDialog::Thread::downloadExtensions() buf.appendAscii(". "); buf.append(j->second.Message); } - m_dialog.setError(UpdateInstallDialog::ERROR_DOWNLOAD, curData.aInstalledPackage->getDisplayName(), + m_dialog.setError(UpdateInstallDialog::ERROR_DOWNLOAD, curData.aInstalledPackage->getDisplayName(), buf.makeStringAndClear()); } } - + } } catch (cssu::Exception & e) @@ -472,7 +472,7 @@ void UpdateInstallDialog::Thread::installExtensions() sal_uInt16 count = 0; typedef std::vector<UpdateData>::iterator It; for (It i = m_aVecUpdateData.begin(); i != m_aVecUpdateData.end(); i++, count++) - { + { //update the name of the extension which is to be installed { SolarMutexGuard g; @@ -551,7 +551,7 @@ void UpdateInstallDialog::Thread::installExtensions() { exc = e; bError = true; - } + } if (bLicenseDeclined) { @@ -559,7 +559,7 @@ void UpdateInstallDialog::Thread::installExtensions() if (m_stop) { return; } - m_dialog.setError(UpdateInstallDialog::ERROR_LICENSE_DECLINED, + m_dialog.setError(UpdateInstallDialog::ERROR_LICENSE_DECLINED, curData.aInstalledPackage->getDisplayName(), OUString()); } else if (!xExtension.is() || bError) @@ -568,7 +568,7 @@ void UpdateInstallDialog::Thread::installExtensions() if (m_stop) { return; } - m_dialog.setError(UpdateInstallDialog::ERROR_INSTALLATION, + m_dialog.setError(UpdateInstallDialog::ERROR_INSTALLATION, curData.aInstalledPackage->getDisplayName(), exc.Message); } } @@ -587,7 +587,7 @@ void UpdateInstallDialog::Thread::removeTempDownloads() { if (m_sDownloadFolder.getLength()) { - dp_misc::erase_path(m_sDownloadFolder, + dp_misc::erase_path(m_sDownloadFolder, cssu::Reference<css::ucb::XCommandEnvironment>(),false /* no throw: ignore errors */ ); //remove also the temp file which we have used to create the unique name OUString tempFile = m_sDownloadFolder.copy(0, m_sDownloadFolder.getLength() - 1); @@ -619,16 +619,16 @@ void UpdateInstallDialog::Thread::download(OUString const & sDownloadURL, Update destFolder = dp_misc::makeURL( m_sDownloadFolder, tempEntry ); destFolder += OUSTR("_"); - + ::ucbhelper::Content destFolderContent; dp_misc::create_folder( &destFolderContent, destFolder, m_updateCmdEnv.get() ); - ::ucbhelper::Content sourceContent; - dp_misc::create_ucb_content( &sourceContent, sDownloadURL, m_updateCmdEnv.get() ); + ::ucbhelper::Content sourceContent; + dp_misc::create_ucb_content( &sourceContent, sDownloadURL, m_updateCmdEnv.get() ); const OUString sTitle(sourceContent.getPropertyValue( dp_misc::StrTitle::get() ).get<OUString>() ); - + if (destFolderContent.transferContent( sourceContent, ::ucbhelper::InsertOperation_COPY, sTitle, css::ucb::NameClash::OVERWRITE )) @@ -648,7 +648,7 @@ void UpdateInstallDialog::Thread::download(OUString const & sDownloadURL, Update // ------------------------------------------------------------------------------------------------------- -UpdateCommandEnv::UpdateCommandEnv( cssu::Reference< cssu::XComponentContext > const & xCtx, +UpdateCommandEnv::UpdateCommandEnv( cssu::Reference< cssu::XComponentContext > const & xCtx, UpdateInstallDialog & updateDialog, ::rtl::Reference<UpdateInstallDialog::Thread>const & thread) : m_updateDialog( updateDialog ), @@ -686,8 +686,8 @@ void UpdateCommandEnv::handle( OSL_ASSERT( request.getValueTypeClass() == cssu::TypeClass_EXCEPTION ); dp_misc::TRACE(OUSTR("[dp_gui_cmdenv.cxx] incoming request:\n") + ::comphelper::anyToString(request) + OUSTR("\n\n")); - - css::deployment::VersionException verExc; + + css::deployment::VersionException verExc; bool approve = false; bool abort = false; @@ -695,7 +695,7 @@ void UpdateCommandEnv::handle( { //We must catch the version exception during the update, //because otherwise the user would be confronted with the dialogs, asking //them if they want to replace an already installed version of the same extension. - //During an update we assume that we always want to replace the old version with the + //During an update we assume that we always want to replace the old version with the //new version. approve = true; } @@ -727,7 +727,7 @@ void UpdateCommandEnv::handle( else if (abort) { cssu::Reference< css::task::XInteractionAbort > xInteractionAbort( pConts[ pos ], cssu::UNO_QUERY ); - if (xInteractionAbort.is()) { + if (xInteractionAbort.is()) { xInteractionAbort->select(); // don't query again for ongoing continuations: abort = false; |