diff options
author | Ivo Hinkelmann <ihi@openoffice.org> | 2006-12-20 17:15:59 +0000 |
---|---|---|
committer | Ivo Hinkelmann <ihi@openoffice.org> | 2006-12-20 17:15:59 +0000 |
commit | a2080ddfe3879757a2d4a7f74b1b0e1ef101b7ae (patch) | |
tree | f780d5377d5a510607b09d3e5c99eb6064c7b69e /desktop/source/pkgchk/unopkg | |
parent | 75d983eb2abbda974a4d4e8177c4cba9b067966a (diff) |
Fixed during integration
Diffstat (limited to 'desktop/source/pkgchk/unopkg')
-rw-r--r-- | desktop/source/pkgchk/unopkg/unopkg_app.cxx | 57 | ||||
-rw-r--r-- | desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx | 38 |
2 files changed, 66 insertions, 29 deletions
diff --git a/desktop/source/pkgchk/unopkg/unopkg_app.cxx b/desktop/source/pkgchk/unopkg/unopkg_app.cxx index 9f38145e635a..c7d0de51e2fe 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_app.cxx +++ b/desktop/source/pkgchk/unopkg/unopkg_app.cxx @@ -4,9 +4,9 @@ * * $RCSfile: unopkg_app.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: ihi $ $Date: 2006-12-19 11:46:08 $ + * last change: $Author: ihi $ $Date: 2006-12-20 18:15:59 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -42,12 +42,16 @@ #include "rtl/uri.hxx" #include "osl/thread.h" #include "osl/process.h" +#include "osl/conditn.hxx" +#include "cppuhelper/implbase1.hxx" #include "cppuhelper/exc_hlp.hxx" #include "comphelper/anytostring.hxx" #include "com/sun/star/deployment/thePackageManagerFactory.hpp" #include "com/sun/star/deployment/ui/PackageManagerDialog.hpp" #include "com/sun/star/ui/dialogs/XExecutableDialog.hpp" #include "boost/scoped_array.hpp" +#include "com/sun/star/ui/dialogs/XDialogClosedListener.hpp" + #include <stdio.h> #include <vector> @@ -107,6 +111,40 @@ const OptionInfo s_option_infos [] = { { 0, 0, '\0', false } }; +class DialogClosedListenerImpl : + public ::cppu::WeakImplHelper1< ui::dialogs::XDialogClosedListener > +{ + osl::Condition & m_rDialogClosedCondition; + +public: + DialogClosedListenerImpl( osl::Condition & rDialogClosedCondition ) + : m_rDialogClosedCondition( rDialogClosedCondition ) {} + + // XEventListener (base of XDialogClosedListener) + virtual void SAL_CALL disposing( lang::EventObject const & Source ) + throw (RuntimeException); + + // XDialogClosedListener + virtual void SAL_CALL dialogClosed( + ui::dialogs::DialogClosedEvent const & aEvent ) + throw (RuntimeException); +}; + +// XEventListener (base of XDialogClosedListener) +void DialogClosedListenerImpl::disposing( lang::EventObject const & ) + throw (RuntimeException) +{ + // nothing to do +} + +// XDialogClosedListener +void DialogClosedListenerImpl::dialogClosed( + ui::dialogs::DialogClosedEvent const & ) + throw (RuntimeException) +{ + m_rDialogClosedCondition.set(); +} + } // anon namespace //############################################################################## @@ -237,7 +275,7 @@ SAL_IMPLEMENT_MAIN() Reference< ::com::sun::star::ucb::XCommandEnvironment > xCmdEnv( createCmdEnv( xComponentContext, logFile, - option_force, option_verbose, option_shared ) ); + option_force, option_verbose) ); if (subcmd_add || subCommand.equalsAsciiL( @@ -290,9 +328,7 @@ SAL_IMPLEMENT_MAIN() } else if (subCommand.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("gui") )) { - //Reference<ui::dialogs::XExecutableDialog> xDialog( - // deployment::ui::PackageManagerDialog::createDefault( - // xComponentContext ) ); + ::std::size_t cUrls = cmdPackages.size(); ::boost::scoped_array<OUString> sarUrls(new OUString[cUrls]); OUString * arString = sarUrls.get(); @@ -305,7 +341,14 @@ SAL_IMPLEMENT_MAIN() deployment::ui::PackageManagerDialog::createAndInstall( xComponentContext, Sequence<OUString>(arString, cUrls), deploymentContext) ); - xDialog->startExecuteModal(Reference< ui::dialogs::XDialogClosedListener >()); + osl::Condition dialogEnded; + dialogEnded.reset(); + + Reference< ui::dialogs::XDialogClosedListener > xListener( + new DialogClosedListenerImpl( dialogEnded ) ); + + xDialog->startExecuteModal(xListener); + dialogEnded.wait(); } else { diff --git a/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx b/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx index 23b5e9409898..d8dc3d5ce396 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx +++ b/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx @@ -4,9 +4,9 @@ * * $RCSfile: unopkg_cmdenv.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: ihi $ $Date: 2006-12-19 11:46:18 $ + * last change: $Author: ihi $ $Date: 2006-12-20 18:15:49 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -54,6 +54,7 @@ #include "com/sun/star/deployment/VersionException.hpp" #include "com/sun/star/i18n/XCollator.hpp" #include "com/sun/star/i18n/CollatorOptions.hpp" +#include "com/sun/star/deployment/LicenseIndividualAgreementException.hpp" #include <stdio.h> #include "deployment.hrc" #include "dp_version.hxx" @@ -100,7 +101,6 @@ class CommandEnvironmentImpl sal_Int32 m_logLevel; bool m_option_force_overwrite; bool m_option_verbose; - bool m_option_shared; Reference< XComponentContext > m_xComponentContext; Reference< XProgressHandler > m_xLogFile; @@ -143,7 +143,6 @@ CommandEnvironmentImpl::CommandEnvironmentImpl( : m_logLevel(0), m_option_force_overwrite( option_force_overwrite ), m_option_verbose( option_verbose ), - m_option_shared(option_shared), m_xComponentContext(xComponentContext) { if (log_file.getLength() > 0) { @@ -271,6 +270,8 @@ void CommandEnvironmentImpl::handle( lang::WrappedTargetException wtExc; deployment::LicenseException licExc; deployment::InstallException instExc; + deployment::LicenseIndividualAgreementException licAgreementExc; + bool bLicenseException = false; if (request >>= wtExc) { // ignore intermediate errors of legacy packages, i.e. @@ -301,24 +302,17 @@ void CommandEnvironmentImpl::handle( update_( wtExc.TargetException ); } } + else if (request >>= licAgreementExc) + { + String sResMsg( ResId( RID_STR_UNOPKG_NO_SHARED_ALLOWED, DeploymentResMgr::get() ) ); + sResMsg.SearchAndReplaceAllAscii( "%NAME", licExc.ExtensionName ); + ::rtl::OString oMsg = ::rtl::OUStringToOString(sResMsg, osl_getThreadTextEncoding()); + fprintf(stdout, "\n%s\n\n", oMsg.getStr()); + abort = true; + } else if (request >>= licExc) { - bLicenseException = true; - //check if we run with shared switched and if every user must accept the license, - //which is an invalid case - if (m_option_shared == true && licExc.IndividualAgreement == sal_True) - { - String sResMsg( ResId( RID_STR_UNOPKG_NO_SHARED_ALLOWED, DeploymentResMgr::get() ) ); - sResMsg.SearchAndReplaceAllAscii( "%NAME", licExc.ExtensionName ); - ::rtl::OString oMsg = ::rtl::OUStringToOString(sResMsg, osl_getThreadTextEncoding()); - fprintf(stdout, "\n%s\n\n", oMsg.getStr()); - fflush(stdout); - abort = true; - } - else - { - printLicense(licExc.Text, approve, abort); - } + printLicense(licExc.Text, approve, abort); } else if (request >>= instExc) { @@ -454,10 +448,10 @@ Reference< XCommandEnvironment > createCmdEnv( Reference< XComponentContext > const & xContext, OUString const & logFile, bool option_force_overwrite, - bool option_verbose, bool option_shared ) + bool option_verbose) { return new CommandEnvironmentImpl( - xContext, logFile, option_force_overwrite, option_verbose, option_shared ); + xContext, logFile, option_force_overwrite, option_verbose); } } // unopkg |