diff options
author | Hans-Joachim Lankenau <hjs@openoffice.org> | 2010-12-17 16:42:38 +0100 |
---|---|---|
committer | Hans-Joachim Lankenau <hjs@openoffice.org> | 2010-12-17 16:42:38 +0100 |
commit | 4a2bf7287695e8b501657ed2ed082c47cc9c9df0 (patch) | |
tree | 88ea6e798d9ac494cf50de54cdab930cb7299fc5 /desktop | |
parent | 06ef0faa30025f0dbbc62c498a7c577c70e097c3 (diff) | |
parent | 8b8ffa54a73587bfb28eab13126e2bb3295a2389 (diff) |
CWS-TOOLING: integrate CWS dv22
Diffstat (limited to 'desktop')
16 files changed, 743 insertions, 381 deletions
diff --git a/desktop/source/deployment/gui/dp_gui.hrc b/desktop/source/deployment/gui/dp_gui.hrc index 5f52b042edf3..dcde55654a30 100755 --- a/desktop/source/deployment/gui/dp_gui.hrc +++ b/desktop/source/deployment/gui/dp_gui.hrc @@ -106,7 +106,7 @@ #define RID_DLG_UPDATE_LINE 8 #define RID_DLG_UPDATE_HELP 9 #define RID_DLG_UPDATE_OK 10 -#define RID_DLG_UPDATE_CANCEL 11 +#define RID_DLG_UPDATE_CLOSE 11 #define RID_DLG_UPDATE_NORMALALERT 12 #define RID_DLG_UPDATE_HIGHCONTRASTALERT 13 #define RID_DLG_UPDATE_ERROR 14 @@ -127,6 +127,11 @@ #define RID_DLG_UPDATE_RELEASENOTES_LINK 29 #define RID_DLG_UPDATE_NOUPDATE 30 #define RID_DLG_UPDATE_VERSION 31 +#define RID_DLG_UPDATE_IGNORE 32 +#define RID_DLG_UPDATE_ENABLE 33 +#define RID_DLG_UPDATE_IGNORE_ALL 34 +#define RID_DLG_UPDATE_IGNORED_UPDATE 35 + #define RID_DLG_UPDATEINSTALL (RID_DEPLOYMENT_GUI_START + 20) @@ -163,6 +168,7 @@ #define RID_STR_NO_ADMIN_PRIVILEGE (RID_DEPLOYMENT_GUI_START+95) #define RID_STR_ERROR_MISSING_DEPENDENCIES (RID_DEPLOYMENT_GUI_START+96) #define RID_STR_ERROR_MISSING_LICENSE (RID_DEPLOYMENT_GUI_START+97) +#define RID_STR_SHOW_LICENSE_CMD (RID_DEPLOYMENT_GUI_START+98) #define WARNINGBOX_CONCURRENTINSTANCE (RID_DEPLOYMENT_GUI_START+100) @@ -172,6 +178,7 @@ #define RID_WARNINGBOX_REMOVE_SHARED_EXTENSION (RID_DEPLOYMENT_GUI_START+104) #define RID_WARNINGBOX_ENABLE_SHARED_EXTENSION (RID_DEPLOYMENT_GUI_START+105) #define RID_WARNINGBOX_DISABLE_SHARED_EXTENSION (RID_DEPLOYMENT_GUI_START+106) +#define RID_DLG_SHOW_LICENSE (RID_DEPLOYMENT_GUI_START+107) #define RID_DLG_LICENSE RID_DEPLOYMENT_LICENSE_START diff --git a/desktop/source/deployment/gui/dp_gui_dialog.src b/desktop/source/deployment/gui/dp_gui_dialog.src index 665dbe5934d7..c9fd19c25592 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog.src +++ b/desktop/source/deployment/gui/dp_gui_dialog.src @@ -119,6 +119,11 @@ String RID_STR_ERROR_MISSING_LICENSE Text [ en-US ] = "This extension is disabled because you haven't accepted the license yet.\n"; }; +String RID_STR_SHOW_LICENSE_CMD +{ + Text [ en-US ] = "Show license"; +}; + // Dialog layout // --------------------------------------------------- // row 1 | multi line edit @@ -293,6 +298,35 @@ ModalDialog RID_DLG_LICENSE }; +ModalDialog RID_DLG_SHOW_LICENSE +{ + Text [ en-US ] = "Extension Software License Agreement"; + Size = MAP_APPFONT( 300, 200 ); + OutputSize = TRUE; + SVLook = TRUE; + Moveable = TRUE; + Closeable = TRUE; + Sizeable = TRUE; + + MultiLineEdit ML_LICENSE + { + Pos = MAP_APPFONT( 5, 5 ); + Size = MAP_APPFONT( 300 - 10, 200 - 15 - RSC_CD_PUSHBUTTON_HEIGHT ); + Border = TRUE; + VScroll = TRUE; + ReadOnly = TRUE; + }; + + OKButton RID_EM_BTN_CLOSE + { + TabStop = TRUE; + DefButton = TRUE; + Text [ en-US ] = "Close"; + Pos = MAP_APPFONT( (300-RSC_CD_PUSHBUTTON_WIDTH)/2, 200 - 5 - RSC_CD_PUSHBUTTON_HEIGHT ); + Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT ); + }; +}; + WarningBox RID_WARNINGBOX_INSTALL_EXTENSION { diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx index 44d1e30f74b6..8fd0f4c754d0 100644..100755 --- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx @@ -39,8 +39,10 @@ #include "dp_gui_theextmgr.hxx" #include "dp_gui_extensioncmdqueue.hxx" #include "dp_misc.h" +#include "dp_ucb.h" #include "dp_update.hxx" #include "dp_identifier.hxx" +#include "dp_descriptioninfoset.hxx" #include "vcl/ctrl.hxx" #include "vcl/menu.hxx" @@ -118,7 +120,8 @@ enum MENU_COMMAND CMD_REMOVE = 1, CMD_ENABLE, CMD_DISABLE, - CMD_UPDATE + CMD_UPDATE, + CMD_SHOW_LICENSE }; class ExtBoxWithBtns_Impl : public ExtensionBox_Impl @@ -224,13 +227,10 @@ const Size ExtBoxWithBtns_Impl::GetMinOutputSizePixel() const // ----------------------------------------------------------------------- void ExtBoxWithBtns_Impl::RecalcAll() { - ExtensionBox_Impl::RecalcAll(); - const sal_Int32 nActive = getSelIndex(); if ( nActive != EXTENSION_LISTBOX_ENTRY_NOTFOUND ) { - SetButtonPos( GetEntryRect( nActive ) ); SetButtonStatus( GetEntryData( nActive) ); } else @@ -239,6 +239,11 @@ void ExtBoxWithBtns_Impl::RecalcAll() m_pEnableBtn->Hide(); m_pRemoveBtn->Hide(); } + + ExtensionBox_Impl::RecalcAll(); + + if ( nActive != EXTENSION_LISTBOX_ENTRY_NOTFOUND ) + SetButtonPos( GetEntryRect( nActive ) ); } @@ -363,28 +368,29 @@ bool ExtBoxWithBtns_Impl::HandleTabKey( bool bReverse ) // ----------------------------------------------------------------------- MENU_COMMAND ExtBoxWithBtns_Impl::ShowPopupMenu( const Point & rPos, const long nPos ) { - if ( ( nPos >= 0 ) && ( nPos < (long) getItemCount() ) ) - { - if ( ! GetEntryData( nPos )->m_bLocked ) - { - PopupMenu aPopup; - - aPopup.InsertItem( CMD_UPDATE, DialogHelper::getResourceString( RID_CTX_ITEM_CHECK_UPDATE ) ); + if ( nPos >= (long) getItemCount() ) + return CMD_NONE; - if ( GetEntryData( nPos )->m_bUser ) - { - if ( GetEntryData( nPos )->m_eState == REGISTERED ) - aPopup.InsertItem( CMD_DISABLE, DialogHelper::getResourceString( RID_CTX_ITEM_DISABLE ) ); - else if ( GetEntryData( nPos )->m_eState != NOT_AVAILABLE ) - aPopup.InsertItem( CMD_ENABLE, DialogHelper::getResourceString( RID_CTX_ITEM_ENABLE ) ); - } + PopupMenu aPopup; - aPopup.InsertItem( CMD_REMOVE, DialogHelper::getResourceString( RID_CTX_ITEM_REMOVE ) ); + aPopup.InsertItem( CMD_UPDATE, DialogHelper::getResourceString( RID_CTX_ITEM_CHECK_UPDATE ) ); - return (MENU_COMMAND) aPopup.Execute( this, rPos ); + if ( ! GetEntryData( nPos )->m_bLocked ) + { + if ( GetEntryData( nPos )->m_bUser ) + { + if ( GetEntryData( nPos )->m_eState == REGISTERED ) + aPopup.InsertItem( CMD_DISABLE, DialogHelper::getResourceString( RID_CTX_ITEM_DISABLE ) ); + else if ( GetEntryData( nPos )->m_eState != NOT_AVAILABLE ) + aPopup.InsertItem( CMD_ENABLE, DialogHelper::getResourceString( RID_CTX_ITEM_ENABLE ) ); } + aPopup.InsertItem( CMD_REMOVE, DialogHelper::getResourceString( RID_CTX_ITEM_REMOVE ) ); } - return CMD_NONE; + + if ( GetEntryData( nPos )->m_sLicenseText.Len() ) + aPopup.InsertItem( CMD_SHOW_LICENSE, DialogHelper::getResourceString( RID_STR_SHOW_LICENSE_CMD ) ); + + return (MENU_COMMAND) aPopup.Execute( this, rPos ); } //------------------------------------------------------------------------------ @@ -409,6 +415,12 @@ void ExtBoxWithBtns_Impl::MouseButtonDown( const MouseEvent& rMEvt ) break; case CMD_REMOVE: m_pParent->removePackage( GetEntryData( nPos )->m_xPackage ); break; + case CMD_SHOW_LICENSE: + { + ShowLicenseDialog aLicenseDlg( m_pParent, GetEntryData( nPos )->m_xPackage ); + aLicenseDlg.Execute(); + break; + } } } else if ( rMEvt.IsLeft() ) @@ -1742,6 +1754,42 @@ void UpdateRequiredDialog::disableAllEntries() m_aCloseBtn.SetText( m_sCloseText ); } +//------------------------------------------------------------------------------ +// ShowLicenseDialog +//------------------------------------------------------------------------------ +ShowLicenseDialog::ShowLicenseDialog( Window * pParent, + const uno::Reference< deployment::XPackage > &xPackage ) : + ModalDialog( pParent, DialogHelper::getResId( RID_DLG_SHOW_LICENSE ) ), + m_aLicenseText( this, DialogHelper::getResId( ML_LICENSE ) ), + m_aCloseBtn( this, DialogHelper::getResId( RID_EM_BTN_CLOSE ) ) +{ + FreeResource(); + + OUString aText = xPackage->getLicenseText(); + m_aLicenseText.SetText( aText ); +} + +//------------------------------------------------------------------------------ +ShowLicenseDialog::~ShowLicenseDialog() +{} + +//------------------------------------------------------------------------------ +void ShowLicenseDialog::Resize() +{ + Size aTotalSize( GetOutputSizePixel() ); + Size aTextSize( aTotalSize.Width() - RSC_SP_DLG_INNERBORDER_LEFT - RSC_SP_DLG_INNERBORDER_RIGHT, + aTotalSize.Height() - RSC_SP_DLG_INNERBORDER_TOP - 2*RSC_SP_DLG_INNERBORDER_BOTTOM + - m_aCloseBtn.GetSizePixel().Height() ); + + m_aLicenseText.SetPosSizePixel( Point( RSC_SP_DLG_INNERBORDER_LEFT, RSC_SP_DLG_INNERBORDER_TOP ), + aTextSize ); + + Point aBtnPos( (aTotalSize.Width() - m_aCloseBtn.GetSizePixel().Width())/2, + aTotalSize.Height() - RSC_SP_DLG_INNERBORDER_BOTTOM + - m_aCloseBtn.GetSizePixel().Height() ); + m_aCloseBtn.SetPosPixel( aBtnPos ); +} + //================================================================================= // UpdateRequiredDialogService //================================================================================= diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.hxx b/desktop/source/deployment/gui/dp_gui_dialog2.hxx index f0a85cce98c0..755c3aadcbdf 100755..100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.hxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.hxx @@ -35,6 +35,7 @@ #include "svtools/fixedhyper.hxx" #include "svtools/prgsbar.hxx" +#include "svtools/svmedit.hxx" #include "osl/conditn.hxx" #include "osl/mutex.hxx" @@ -246,6 +247,20 @@ public: }; //============================================================================== +class ShowLicenseDialog : public ModalDialog +{ + MultiLineEdit m_aLicenseText; + OKButton m_aCloseBtn; + +public: + ShowLicenseDialog( Window * pParent, + const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ); + virtual ~ShowLicenseDialog(); + + virtual void Resize(); +}; + +//============================================================================== class UpdateRequiredDialogService : public ::cppu::WeakImplHelper1< ::com::sun::star::ui::dialogs::XExecutableDialog > { ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const m_xComponentContext; diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx index 5f9de3965199..54495de410dc 100644 --- a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx +++ b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx @@ -76,6 +76,7 @@ Entry_Impl::Entry_Impl( const uno::Reference< deployment::XPackage > &xPackage, m_sTitle = xPackage->getDisplayName(); m_sVersion = xPackage->getVersion(); m_sDescription = xPackage->getDescription(); + m_sLicenseText = xPackage->getLicenseText(); beans::StringPair aInfo( m_xPackage->getPublisherInfo() ); m_sPublisher = aInfo.First; diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.hxx b/desktop/source/deployment/gui/dp_gui_extlistbox.hxx index 762f50296690..cbf9e27a8da1 100644 --- a/desktop/source/deployment/gui/dp_gui_extlistbox.hxx +++ b/desktop/source/deployment/gui/dp_gui_extlistbox.hxx @@ -81,6 +81,7 @@ struct Entry_Impl String m_sPublisher; String m_sPublisherURL; String m_sErrorText; + String m_sLicenseText; Image m_aIcon; Image m_aIconHC; svt::FixedHyperlink *m_pPublisher; diff --git a/desktop/source/deployment/gui/dp_gui_updatedata.hxx b/desktop/source/deployment/gui/dp_gui_updatedata.hxx index 76eb8af31e8e..1112de0b34e8 100644..100755 --- a/desktop/source/deployment/gui/dp_gui_updatedata.hxx +++ b/desktop/source/deployment/gui/dp_gui_updatedata.hxx @@ -28,6 +28,7 @@ #define INCLUDED_DP_GUI_UPDATEDATA_HXX #include "sal/config.h" +#include "tools/solar.h" #include "rtl/ustring.hxx" #include "com/sun/star/uno/Reference.hxx" @@ -80,6 +81,10 @@ struct UpdateData //are to be ignored. ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > aUpdateSource; + + // ID to find this entry in the update listbox + USHORT m_nID; + bool m_bIgnored; }; } diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx index b27cd8da81fe..44f335dd509d 100644..100755 --- a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx +++ b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx @@ -50,7 +50,9 @@ #include "com/sun/star/beans/NamedValue.hpp" #include "com/sun/star/beans/Optional.hpp" #include "com/sun/star/beans/PropertyValue.hpp" +#include "com/sun/star/beans/XPropertySet.hpp" #include "com/sun/star/container/XNameAccess.hpp" +#include "com/sun/star/container/XNameContainer.hpp" #include "com/sun/star/deployment/DeploymentException.hpp" #include "com/sun/star/deployment/UpdateInformationProvider.hpp" #include "com/sun/star/deployment/XPackage.hpp" @@ -62,6 +64,7 @@ #include "com/sun/star/frame/XDispatchProvider.hpp" #include "com/sun/star/lang/IllegalArgumentException.hpp" #include "com/sun/star/lang/XMultiComponentFactory.hpp" +#include "com/sun/star/lang/XSingleServiceFactory.hpp" #include "com/sun/star/system/SystemShellExecuteFlags.hpp" #include "com/sun/star/system/XSystemShellExecute.hpp" #include "com/sun/star/task/XAbortChannel.hpp" @@ -76,6 +79,7 @@ #include "com/sun/star/uno/Sequence.hxx" #include "com/sun/star/uno/XInterface.hpp" #include "com/sun/star/util/URL.hpp" +#include "com/sun/star/util/XChangesBatch.hpp" #include "com/sun/star/util/XURLTransformer.hpp" #include "com/sun/star/xml/dom/XElement.hpp" #include "com/sun/star/xml/dom/XNode.hpp" @@ -129,16 +133,23 @@ namespace com { namespace sun { namespace star { namespace uno { class XComponentContext; } } } } -namespace css = ::com::sun::star; - +using namespace ::com::sun::star; using dp_gui::UpdateDialog; namespace { static sal_Unicode const LF = 0x000A; static sal_Unicode const CR = 0x000D; +static const USHORT CMD_ENABLE_UPDATE = 1; +static const USHORT CMD_IGNORE_UPDATE = 2; +static const USHORT CMD_IGNORE_ALL_UPDATES = 3; + +#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) ) + +#define IGNORED_UPDATES OUSTR("/org.openoffice.Office.ExtensionManager/ExtensionUpdateData/IgnoredUpdates") +#define PROPERTY_VERSION OUSTR("Version") -enum Kind { ENABLED_UPDATE, DISABLED_UPDATE, GENERAL_ERROR, SPECIFIC_ERROR }; +enum Kind { ENABLED_UPDATE, DISABLED_UPDATE, SPECIFIC_ERROR }; rtl::OUString confineToParagraph(rtl::OUString const & text) { // Confine arbitrary text to a single paragraph in a dp_gui::AutoScrollEdit. @@ -151,86 +162,64 @@ rtl::OUString confineToParagraph(rtl::OUString const & text) { struct UpdateDialog::DisabledUpdate { rtl::OUString name; - css::uno::Sequence< rtl::OUString > unsatisfiedDependencies; + uno::Sequence< rtl::OUString > unsatisfiedDependencies; // We also want to show release notes and publisher for disabled updates ::com::sun::star::uno::Reference< ::com::sun::star::xml::dom::XNode > aUpdateInfo; + USHORT m_nID; }; struct UpdateDialog::SpecificError { rtl::OUString name; rtl::OUString message; + USHORT m_nID; }; -union UpdateDialog::IndexUnion{ - std::vector< dp_gui::UpdateData >::size_type enabledUpdate; - std::vector< UpdateDialog::DisabledUpdate >::size_type disabledUpdate; - std::vector< rtl::OUString >::size_type generalError; - std::vector< UpdateDialog::SpecificError >::size_type specificError; -}; - -struct UpdateDialog::Index { - static std::auto_ptr< UpdateDialog::Index const > newEnabledUpdate( - std::vector< dp_gui::UpdateData >::size_type n); - - static std::auto_ptr< UpdateDialog::Index const > newDisabledUpdate( - std::vector< UpdateDialog::DisabledUpdate >::size_type n); +//------------------------------------------------------------------------------ +struct UpdateDialog::IgnoredUpdate { + rtl::OUString sExtensionID; + rtl::OUString sVersion; + bool bRemoved; - static std::auto_ptr< UpdateDialog::Index const > newGeneralError( - std::vector< rtl::OUString >::size_type n); - - static std::auto_ptr< UpdateDialog::Index const > newSpecificError( - std::vector< UpdateDialog::SpecificError >::size_type n); - - Kind kind; - IndexUnion index; - -private: - explicit Index(Kind theKind); + IgnoredUpdate( const rtl::OUString &rExtensionID, const rtl::OUString &rVersion ); }; -std::auto_ptr< UpdateDialog::Index const > -UpdateDialog::Index::newEnabledUpdate( - std::vector< dp_gui::UpdateData >::size_type n) -{ - UpdateDialog::Index * p = new UpdateDialog::Index(ENABLED_UPDATE); - p->index.enabledUpdate = n; - return std::auto_ptr< UpdateDialog::Index const >(p); -} - -std::auto_ptr< UpdateDialog::Index const > -UpdateDialog::Index::newDisabledUpdate( - std::vector< UpdateDialog::DisabledUpdate >::size_type n) -{ - UpdateDialog::Index * p = new UpdateDialog::Index(DISABLED_UPDATE); - p->index.disabledUpdate = n; - return std::auto_ptr< UpdateDialog::Index const >(p); -} +//------------------------------------------------------------------------------ +UpdateDialog::IgnoredUpdate::IgnoredUpdate( const rtl::OUString &rExtensionID, const rtl::OUString &rVersion ): + sExtensionID( rExtensionID ), + sVersion( rVersion ), + bRemoved( false ) +{} -std::auto_ptr< UpdateDialog::Index const > UpdateDialog::Index::newGeneralError( - std::vector< rtl::OUString >::size_type n) +//------------------------------------------------------------------------------ +struct UpdateDialog::Index { - UpdateDialog::Index * p = new UpdateDialog::Index(GENERAL_ERROR); - p->index.generalError = n; - return std::auto_ptr< UpdateDialog::Index const >(p); -} + Kind m_eKind; + bool m_bIgnored; + USHORT m_nID; + USHORT m_nIndex; + rtl::OUString m_aName; -std::auto_ptr< UpdateDialog::Index const > -UpdateDialog::Index::newSpecificError( - std::vector< UpdateDialog::SpecificError >::size_type n) -{ - UpdateDialog::Index * p = new UpdateDialog::Index(SPECIFIC_ERROR); - p->index.specificError = n; - return std::auto_ptr< UpdateDialog::Index const >(p); -} + Index( Kind theKind, USHORT nID, USHORT nIndex, const rtl::OUString &rName ); +}; -UpdateDialog::Index::Index(Kind theKind): kind(theKind) {} +//------------------------------------------------------------------------------ +UpdateDialog::Index::Index( Kind theKind, USHORT nID, USHORT nIndex, const rtl::OUString &rName ): + m_eKind( theKind ), + m_bIgnored( false ), + m_nID( nID ), + m_nIndex( nIndex ), + m_aName( rName ) +{} +//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ class UpdateDialog::Thread: public dp_gui::Thread { public: Thread( - css::uno::Reference< css::uno::XComponentContext > const & context, + uno::Reference< uno::XComponentContext > const & context, UpdateDialog & dialog, - const std::vector< css::uno::Reference< css::deployment::XPackage > > & vExtensionList); + const std::vector< uno::Reference< deployment::XPackage > > & vExtensionList); void stop(); @@ -240,16 +229,16 @@ private: struct Entry { explicit Entry( - css::uno::Reference< css::deployment::XPackage > const & thePackage, + uno::Reference< deployment::XPackage > const & thePackage, rtl::OUString const & theVersion); - css::uno::Reference< css::deployment::XPackage > package; + uno::Reference< deployment::XPackage > package; rtl::OUString version; //Indicates that the extension provides its own update URLs. //If this is true, then we must not use the default update //URL to find the update information. bool bProvidesOwnUpdate; - css::uno::Reference< css::xml::dom::XNode > info; + uno::Reference< xml::dom::XNode > info; UpdateDialog::DisabledUpdate disableUpdate; dp_gui::UpdateData updateData; }; @@ -261,20 +250,20 @@ private: virtual void execute(); #if 0 - void handleGeneralError(css::uno::Any const & exception) const; + void handleGeneralError(uno::Any const & exception) const; #endif void handleSpecificError( - css::uno::Reference< css::deployment::XPackage > const & package, - css::uno::Any const & exception) const; + uno::Reference< deployment::XPackage > const & package, + uno::Any const & exception) const; - css::uno::Sequence< css::uno::Reference< css::xml::dom::XElement > > + uno::Sequence< uno::Reference< xml::dom::XElement > > getUpdateInformation( - css::uno::Reference< css::deployment::XPackage > const & package, - css::uno::Sequence< rtl::OUString > const & urls, + uno::Reference< deployment::XPackage > const & package, + uno::Sequence< rtl::OUString > const & urls, rtl::OUString const & identifier) const; void getOwnUpdateInformation( - css::uno::Reference< css::deployment::XPackage > const & package, + uno::Reference< deployment::XPackage > const & package, Map * map); ::rtl::OUString getUpdateDisplayString( @@ -286,40 +275,40 @@ private: dp_gui::UpdateData & out_data) const; bool update( - UpdateDialog::DisabledUpdate const & du, - dp_gui::UpdateData const & data) const; + UpdateDialog::DisabledUpdate & du, + dp_gui::UpdateData & data) const; - css::uno::Reference< css::uno::XComponentContext > m_context; + uno::Reference< uno::XComponentContext > m_context; UpdateDialog & m_dialog; - std::vector< css::uno::Reference< css::deployment::XPackage > > m_vExtensionList; - css::uno::Reference< css::deployment::XUpdateInformationProvider > m_updateInformation; - css::uno::Reference< css::task::XInteractionHandler > m_xInteractionHdl; + std::vector< uno::Reference< deployment::XPackage > > m_vExtensionList; + uno::Reference< deployment::XUpdateInformationProvider > m_updateInformation; + uno::Reference< task::XInteractionHandler > m_xInteractionHdl; // guarded by Application::GetSolarMutex(): - css::uno::Reference< css::task::XAbortChannel > m_abort; + uno::Reference< task::XAbortChannel > m_abort; bool m_stop; }; UpdateDialog::Thread::Thread( - css::uno::Reference< css::uno::XComponentContext > const & context, + uno::Reference< uno::XComponentContext > const & context, UpdateDialog & dialog, - const std::vector< css::uno::Reference< css::deployment::XPackage > > &vExtensionList): + const std::vector< uno::Reference< deployment::XPackage > > &vExtensionList): m_context(context), m_dialog(dialog), m_vExtensionList(vExtensionList), m_updateInformation( - css::deployment::UpdateInformationProvider::create(context)), + deployment::UpdateInformationProvider::create(context)), m_stop(false) { if( m_context.is() ) { - css::uno::Reference< css::lang::XMultiComponentFactory > xServiceManager( m_context->getServiceManager() ); + uno::Reference< lang::XMultiComponentFactory > xServiceManager( m_context->getServiceManager() ); if( xServiceManager.is() ) { - m_xInteractionHdl = css::uno::Reference< css::task::XInteractionHandler > ( + m_xInteractionHdl = uno::Reference< task::XInteractionHandler > ( xServiceManager->createInstanceWithContext( OUSTR( "com.sun.star.task.InteractionHandler" ), m_context), - css::uno::UNO_QUERY ); + uno::UNO_QUERY ); if ( m_xInteractionHdl.is() ) m_updateInformation->setInteractionHandler( m_xInteractionHdl ); } @@ -327,7 +316,7 @@ UpdateDialog::Thread::Thread( } void UpdateDialog::Thread::stop() { - css::uno::Reference< css::task::XAbortChannel > abort; + uno::Reference< task::XAbortChannel > abort; { vos::OGuard g(Application::GetSolarMutex()); abort = m_abort; @@ -340,7 +329,7 @@ void UpdateDialog::Thread::stop() { } UpdateDialog::Thread::Entry::Entry( - css::uno::Reference< css::deployment::XPackage > const & thePackage, + uno::Reference< deployment::XPackage > const & thePackage, rtl::OUString const & theVersion): package(thePackage), @@ -353,7 +342,7 @@ UpdateDialog::Thread::Entry::Entry( UpdateDialog::Thread::~Thread() { if ( m_xInteractionHdl.is() ) - m_updateInformation->setInteractionHandler( css::uno::Reference< css::task::XInteractionHandler > () ); + m_updateInformation->setInteractionHandler( uno::Reference< task::XInteractionHandler > () ); } void UpdateDialog::Thread::execute() @@ -364,16 +353,16 @@ void UpdateDialog::Thread::execute() return; } } - css::uno::Reference<css::deployment::XExtensionManager> extMgr = - css::deployment::ExtensionManager::get(m_context); + uno::Reference<deployment::XExtensionManager> extMgr = + deployment::ExtensionManager::get(m_context); - std::vector<std::pair<css::uno::Reference<css::deployment::XPackage>, css::uno::Any > > errors; + std::vector<std::pair<uno::Reference<deployment::XPackage>, uno::Any > > errors; dp_misc::UpdateInfoMap updateInfoMap = dp_misc::getOnlineUpdateInfos( m_context, extMgr, m_updateInformation, &m_vExtensionList, errors); - typedef std::vector<std::pair<css::uno::Reference<css::deployment::XPackage>, - css::uno::Any> >::const_iterator ITERROR; + typedef std::vector<std::pair<uno::Reference<deployment::XPackage>, + uno::Any> >::const_iterator ITERROR; for (ITERROR ite = errors.begin(); ite != errors.end(); ite ++) handleSpecificError(ite->first, ite->second); @@ -392,12 +381,12 @@ void UpdateDialog::Thread::execute() rtl::OUString sVersionUser; rtl::OUString sVersionShared; rtl::OUString sVersionBundled; - css::uno::Sequence< css::uno::Reference< css::deployment::XPackage> > extensions; + uno::Sequence< uno::Reference< deployment::XPackage> > extensions; try { extensions = extMgr->getExtensionsWithSameIdentifier( dp_misc::getIdentifier(info.extension), info.extension->getName(), - css::uno::Reference<css::ucb::XCommandEnvironment>()); - } catch (css::lang::IllegalArgumentException& ) { + uno::Reference<ucb::XCommandEnvironment>()); + } catch (lang::IllegalArgumentException& ) { OSL_ASSERT(0); } OSL_ASSERT(extensions.getLength() == 3); @@ -415,7 +404,7 @@ void UpdateDialog::Thread::execute() dp_misc::UPDATE_SOURCE sourceShared = dp_misc::isUpdateSharedExtension( bSharedReadOnly, sVersionShared, sVersionBundled, sOnlineVersion); - css::uno::Reference<css::deployment::XPackage> updateSource; + uno::Reference<deployment::XPackage> updateSource; if (sourceUser != dp_misc::UPDATE_SOURCE_NONE) { if (sourceUser == dp_misc::UPDATE_SOURCE_SHARED) @@ -452,11 +441,11 @@ void UpdateDialog::Thread::execute() } } #if 0 -void UpdateDialog::Thread::handleGeneralError(css::uno::Any const & exception) +void UpdateDialog::Thread::handleGeneralError(uno::Any const & exception) const { rtl::OUString message; - css::uno::Exception e; + uno::Exception e; if (exception >>= e) { message = e.Message; } @@ -468,13 +457,13 @@ void UpdateDialog::Thread::handleGeneralError(css::uno::Any const & exception) #endif //Parameter package can be null void UpdateDialog::Thread::handleSpecificError( - css::uno::Reference< css::deployment::XPackage > const & package, - css::uno::Any const & exception) const + uno::Reference< deployment::XPackage > const & package, + uno::Any const & exception) const { UpdateDialog::SpecificError data; if (package.is()) data.name = package->getDisplayName(); - css::uno::Exception e; + uno::Exception e; if (exception >>= e) { data.message = e.Message; } @@ -516,7 +505,7 @@ void UpdateDialog::Thread::handleSpecificError( /** out_data will only be filled if all dependencies are ok. */ void UpdateDialog::Thread::prepareUpdateData( - css::uno::Reference< css::xml::dom::XNode > const & updateInfo, + uno::Reference< xml::dom::XNode > const & updateInfo, UpdateDialog::DisabledUpdate & out_du, dp_gui::UpdateData & out_data) const { @@ -524,7 +513,7 @@ void UpdateDialog::Thread::prepareUpdateData( return; dp_misc::DescriptionInfoset infoset(m_context, updateInfo); OSL_ASSERT(infoset.getVersion().getLength() != 0); - css::uno::Sequence< css::uno::Reference< css::xml::dom::XElement > > ds( + uno::Sequence< uno::Reference< xml::dom::XElement > > ds( dp_misc::Dependencies::check(infoset)); out_du.aUpdateInfo = updateInfo; @@ -547,8 +536,8 @@ void UpdateDialog::Thread::prepareUpdateData( } bool UpdateDialog::Thread::update( - UpdateDialog::DisabledUpdate const & du, - dp_gui::UpdateData const & data) const + UpdateDialog::DisabledUpdate & du, + dp_gui::UpdateData & data) const { bool ret = false; if (du.unsatisfiedDependencies.getLength() == 0) @@ -570,9 +559,9 @@ bool UpdateDialog::Thread::update( // UpdateDialog ---------------------------------------------------------- UpdateDialog::UpdateDialog( - css::uno::Reference< css::uno::XComponentContext > const & context, + uno::Reference< uno::XComponentContext > const & context, Window * parent, - const std::vector<css::uno::Reference< css::deployment::XPackage > > &vExtensionList, + const std::vector<uno::Reference< deployment::XPackage > > &vExtensionList, std::vector< dp_gui::UpdateData > * updateData): ModalDialog(parent,DpGuiResId(RID_DLG_UPDATE)), m_context(context), @@ -592,7 +581,7 @@ UpdateDialog::UpdateDialog( m_line(this, DpGuiResId(RID_DLG_UPDATE_LINE)), m_help(this, DpGuiResId(RID_DLG_UPDATE_HELP)), m_ok(this, DpGuiResId(RID_DLG_UPDATE_OK)), - m_cancel(this, DpGuiResId(RID_DLG_UPDATE_CANCEL)), + m_close(this, DpGuiResId(RID_DLG_UPDATE_CLOSE)), m_error(String(DpGuiResId(RID_DLG_UPDATE_ERROR))), m_none(String(DpGuiResId(RID_DLG_UPDATE_NONE))), m_noInstallable(String(DpGuiResId(RID_DLG_UPDATE_NOINSTALLABLE))), @@ -604,71 +593,84 @@ UpdateDialog::UpdateDialog( m_noDependencyCurVer(String(DpGuiResId(RID_DLG_UPDATE_NODEPENDENCY_CUR_VER))), m_browserbased(String(DpGuiResId(RID_DLG_UPDATE_BROWSERBASED))), m_version(String(DpGuiResId(RID_DLG_UPDATE_VERSION))), + m_ignoredUpdate(String(DpGuiResId(RID_DLG_UPDATE_IGNORED_UPDATE))), m_updateData(*updateData), m_thread( new UpdateDialog::Thread( context, *this, vExtensionList)), m_nFirstLineDelta(0), - m_nOneLineMissing(0) + m_nOneLineMissing(0), + m_nLastID(1), + m_bModified( false ) // TODO: check! // , // m_extensionManagerDialog(extensionManagerDialog) { OSL_ASSERT(updateData != NULL); - m_xExtensionManager = css::deployment::ExtensionManager::get( context ); + m_xExtensionManager = deployment::ExtensionManager::get( context ); - css::uno::Reference< css::awt::XToolkit > toolkit; + uno::Reference< awt::XToolkit > toolkit; try { - toolkit = css::uno::Reference< css::awt::XToolkit >( - (css::uno::Reference< css::lang::XMultiComponentFactory >( + toolkit = uno::Reference< awt::XToolkit >( + (uno::Reference< lang::XMultiComponentFactory >( m_context->getServiceManager(), - css::uno::UNO_QUERY_THROW)-> + uno::UNO_QUERY_THROW)-> createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.Toolkit")), m_context)), - css::uno::UNO_QUERY_THROW); - } catch (css::uno::RuntimeException &) { + uno::UNO_QUERY_THROW); + } catch (uno::RuntimeException &) { throw; - } catch (css::uno::Exception & e) { - throw css::uno::RuntimeException(e.Message, e.Context); + } catch (uno::Exception & e) { + throw uno::RuntimeException(e.Message, e.Context); } Control c(this, DpGuiResId(RID_DLG_UPDATE_THROBBER)); Point pos(c.GetPosPixel()); Size size(c.GetSizePixel()); try { - m_throbber = css::uno::Reference< css::awt::XThrobber >( + m_throbber = uno::Reference< awt::XThrobber >( toolkit->createWindow( - css::awt::WindowDescriptor( - css::awt::WindowClass_SIMPLE, + awt::WindowDescriptor( + awt::WindowClass_SIMPLE, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Throbber")), GetComponentInterface(), 0, - css::awt::Rectangle( + awt::Rectangle( pos.X(), pos.Y(), size.Width(), size.Height()), - css::awt::WindowAttribute::SHOW)), - css::uno::UNO_QUERY_THROW); - } catch (css::lang::IllegalArgumentException & e) { - throw css::uno::RuntimeException(e.Message, e.Context); + awt::WindowAttribute::SHOW)), + uno::UNO_QUERY_THROW); + } catch (lang::IllegalArgumentException & e) { + throw uno::RuntimeException(e.Message, e.Context); } m_updates.SetSelectHdl(LINK(this, UpdateDialog, selectionHandler)); m_all.SetToggleHdl(LINK(this, UpdateDialog, allHandler)); m_ok.SetClickHdl(LINK(this, UpdateDialog, okHandler)); - m_cancel.SetClickHdl(LINK(this, UpdateDialog, cancelHandler)); + m_close.SetClickHdl(LINK(this, UpdateDialog, closeHandler)); if ( ! dp_misc::office_is_running()) m_help.Disable(); FreeResource(); initDescription(); + getIgnoredUpdates(); } -UpdateDialog::~UpdateDialog() { - for (USHORT i = 0; i < m_updates.getItemCount(); ++i) { - delete static_cast< UpdateDialog::Index const * >( - m_updates.GetEntryData(i)); +//------------------------------------------------------------------------------ +UpdateDialog::~UpdateDialog() +{ + storeIgnoredUpdates(); + + for ( std::vector< UpdateDialog::Index* >::iterator i( m_ListboxEntries.begin() ); i != m_ListboxEntries.end(); ++i ) + { + delete (*i); + } + for ( std::vector< UpdateDialog::IgnoredUpdate* >::iterator i( m_ignoredUpdates.begin() ); i != m_ignoredUpdates.end(); ++i ) + { + delete (*i); } } +//------------------------------------------------------------------------------ BOOL UpdateDialog::Close() { m_thread->stop(); return ModalDialog::Close(); @@ -680,29 +682,45 @@ short UpdateDialog::Execute() { return ModalDialog::Execute(); } -UpdateDialog::CheckListBox::CheckListBox( - UpdateDialog & dialog, ResId const & resource, - Image const & normalStaticImage, Image const & highContrastStaticImage): - SvxCheckListBox( - &dialog, resource, normalStaticImage, highContrastStaticImage), +//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ +UpdateDialog::CheckListBox::CheckListBox( UpdateDialog & dialog, ResId const & resource, + Image const & normalStaticImage, + Image const & highContrastStaticImage ): + SvxCheckListBox( &dialog, resource, normalStaticImage, highContrastStaticImage ), + m_ignoreUpdate( String( DpGuiResId( RID_DLG_UPDATE_IGNORE ) ) ), + m_ignoreAllUpdates( String( DpGuiResId( RID_DLG_UPDATE_IGNORE_ALL ) ) ), + m_enableUpdate( String( DpGuiResId( RID_DLG_UPDATE_ENABLE ) ) ), m_dialog(dialog) {} +//------------------------------------------------------------------------------ UpdateDialog::CheckListBox::~CheckListBox() {} +//------------------------------------------------------------------------------ USHORT UpdateDialog::CheckListBox::getItemCount() const { ULONG i = GetEntryCount(); OSL_ASSERT(i <= std::numeric_limits< USHORT >::max()); return sal::static_int_cast< USHORT >(i); } -void UpdateDialog::CheckListBox::MouseButtonDown(MouseEvent const & event) { +//------------------------------------------------------------------------------ +void UpdateDialog::CheckListBox::MouseButtonDown( MouseEvent const & event ) +{ // When clicking on a selected entry in an SvxCheckListBox, the entry's // checkbox is toggled on mouse button down: - SvxCheckListBox::MouseButtonDown(event); + SvxCheckListBox::MouseButtonDown( event ); + + if ( event.IsRight() ) + { + handlePopupMenu( event.GetPosPixel() ); + } + m_dialog.enableOk(); } +//------------------------------------------------------------------------------ void UpdateDialog::CheckListBox::MouseButtonUp(MouseEvent const & event) { // When clicking on an entry's checkbox in an SvxCheckListBox, the entry's // checkbox is toggled on mouse button up: @@ -715,25 +733,82 @@ void UpdateDialog::CheckListBox::KeyInput(KeyEvent const & event) { m_dialog.enableOk(); } -void UpdateDialog::insertItem( - rtl::OUString const & name, USHORT position, - std::auto_ptr< UpdateDialog::Index const > index, SvLBoxButtonKind kind) +//------------------------------------------------------------------------------ +void UpdateDialog::CheckListBox::handlePopupMenu( const Point &rPos ) { - m_updates.InsertEntry( - name, position, - const_cast< void * >(static_cast< void const * >(index.release())), - kind); - //TODO #i72487#: UpdateDialog::Index potentially leaks as the exception - // behavior of SvxCheckListBox::InsertEntry is unspecified + SvListEntry *pData = GetEntry( rPos ); + + if ( pData ) + { + USHORT nEntryPos = GetSelectEntryPos(); + UpdateDialog::Index * p = static_cast< UpdateDialog::Index * >( GetEntryData( nEntryPos ) ); + + if ( ( p->m_eKind == ENABLED_UPDATE ) || ( p->m_eKind == DISABLED_UPDATE ) ) + { + PopupMenu aPopup; + + if ( p->m_bIgnored ) + aPopup.InsertItem( CMD_ENABLE_UPDATE, m_enableUpdate ); + else + { + aPopup.InsertItem( CMD_IGNORE_UPDATE, m_ignoreUpdate ); + aPopup.InsertItem( CMD_IGNORE_ALL_UPDATES, m_ignoreAllUpdates ); + } + + USHORT aCmd = aPopup.Execute( this, rPos ); + if ( ( aCmd == CMD_IGNORE_UPDATE ) || ( aCmd == CMD_IGNORE_ALL_UPDATES ) ) + { + p->m_bIgnored = true; + if ( p->m_eKind == ENABLED_UPDATE ) + { + RemoveEntry( nEntryPos ); + m_dialog.addAdditional( p, SvLBoxButtonKind_disabledCheckbox ); + } + if ( aCmd == CMD_IGNORE_UPDATE ) + m_dialog.setIgnoredUpdate( p, true, false ); + else + m_dialog.setIgnoredUpdate( p, true, true ); + // TODO: reselect entry to display new description! + } + else if ( aCmd == CMD_ENABLE_UPDATE ) + { + p->m_bIgnored = false; + if ( p->m_eKind == ENABLED_UPDATE ) + { + RemoveEntry( nEntryPos ); + m_dialog.insertItem( p, SvLBoxButtonKind_enabledCheckbox ); + } + m_dialog.setIgnoredUpdate( p, false, false ); + } + } + } } -void UpdateDialog::addAdditional( - rtl::OUString const & name, USHORT position, - std::auto_ptr< UpdateDialog::Index const > index, SvLBoxButtonKind kind) +//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ +USHORT UpdateDialog::insertItem( UpdateDialog::Index *pEntry, SvLBoxButtonKind kind ) +{ + m_updates.InsertEntry( pEntry->m_aName, LISTBOX_APPEND, static_cast< void * >( pEntry ), kind ); + + for ( USHORT i = m_updates.getItemCount(); i != 0 ; ) + { + i -= 1; + UpdateDialog::Index const * p = static_cast< UpdateDialog::Index const * >( m_updates.GetEntryData( i ) ); + if ( p == pEntry ) + return i; + } + OSL_ASSERT(0); + return 0; +} + +//------------------------------------------------------------------------------ +void UpdateDialog::addAdditional( UpdateDialog::Index * index, SvLBoxButtonKind kind ) { m_all.Enable(); - if (m_all.IsChecked()) { - insertItem(name, position, index, kind); + if (m_all.IsChecked()) + { + insertItem( index, kind ); m_update.Enable(); m_updates.Enable(); m_description.Enable(); @@ -741,71 +816,81 @@ void UpdateDialog::addAdditional( } } -void UpdateDialog::addEnabledUpdate( - rtl::OUString const & name, dp_gui::UpdateData const & data) +//------------------------------------------------------------------------------ +void UpdateDialog::addEnabledUpdate( rtl::OUString const & name, + dp_gui::UpdateData & data ) { - std::vector< dp_gui::UpdateData >::size_type n = m_enabledUpdates.size(); - m_enabledUpdates.push_back(data); - insertItem( - name, sal::static_int_cast< USHORT >(n), - UpdateDialog::Index::newEnabledUpdate(n), - SvLBoxButtonKind_enabledCheckbox); - // position overflow is rather harmless - m_updates.CheckEntryPos(sal::static_int_cast< USHORT >(n)); - //TODO #i72487#: fragile computation; insertItem should instead return - // pos + USHORT nIndex = sal::static_int_cast< USHORT >( m_enabledUpdates.size() ); + UpdateDialog::Index *pEntry = new UpdateDialog::Index( ENABLED_UPDATE, m_nLastID, nIndex, name ); + + data.m_nID = m_nLastID; + m_nLastID += 1; + + m_enabledUpdates.push_back( data ); + m_ListboxEntries.push_back( pEntry ); + + if ( ! isIgnoredUpdate( pEntry ) ) + { + USHORT nPos = insertItem( pEntry, SvLBoxButtonKind_enabledCheckbox ); + m_updates.CheckEntryPos( nPos ); + } + else + addAdditional( pEntry, SvLBoxButtonKind_disabledCheckbox ); + m_update.Enable(); m_updates.Enable(); m_description.Enable(); m_descriptions.Enable(); } -void UpdateDialog::addDisabledUpdate(UpdateDialog::DisabledUpdate const & data) +//------------------------------------------------------------------------------ +void UpdateDialog::addDisabledUpdate( UpdateDialog::DisabledUpdate & data ) { - std::vector< UpdateDialog::DisabledUpdate >::size_type n = - m_disabledUpdates.size(); - m_disabledUpdates.push_back(data); - addAdditional( - data.name, sal::static_int_cast< USHORT >(m_enabledUpdates.size() + n), - UpdateDialog::Index::newDisabledUpdate(n), - SvLBoxButtonKind_disabledCheckbox); - // position overflow is rather harmless -} -#if 0 -void UpdateDialog::addGeneralError(rtl::OUString const & message) { - std::vector< rtl::OUString >::size_type n = m_generalErrors.size(); - m_generalErrors.push_back(message); - addAdditional( - m_error, - sal::static_int_cast< USHORT >( - m_enabledUpdates.size() + m_disabledUpdates.size() + n), - UpdateDialog::Index::newGeneralError(n), SvLBoxButtonKind_staticImage); - // position overflow is rather harmless + USHORT nIndex = sal::static_int_cast< USHORT >( m_disabledUpdates.size() ); + UpdateDialog::Index *pEntry = new UpdateDialog::Index( DISABLED_UPDATE, m_nLastID, nIndex, data.name ); + + data.m_nID = m_nLastID; + m_nLastID += 1; + + m_disabledUpdates.push_back( data ); + m_ListboxEntries.push_back( pEntry ); + + isIgnoredUpdate( pEntry ); + addAdditional( pEntry, SvLBoxButtonKind_disabledCheckbox ); } -#endif -void UpdateDialog::addSpecificError(UpdateDialog::SpecificError const & data) { - std::vector< UpdateDialog::SpecificError >::size_type n = - m_specificErrors.size(); - m_specificErrors.push_back(data); - addAdditional( - data.name, LISTBOX_APPEND, UpdateDialog::Index::newSpecificError(n), - SvLBoxButtonKind_staticImage); + +//------------------------------------------------------------------------------ +void UpdateDialog::addSpecificError( UpdateDialog::SpecificError & data ) +{ + USHORT nIndex = sal::static_int_cast< USHORT >( m_specificErrors.size() ); + UpdateDialog::Index *pEntry = new UpdateDialog::Index( DISABLED_UPDATE, m_nLastID, nIndex, data.name ); + + data.m_nID = m_nLastID; + m_nLastID += 1; + + m_specificErrors.push_back( data ); + m_ListboxEntries.push_back( pEntry ); + + addAdditional( pEntry, SvLBoxButtonKind_staticImage); } void UpdateDialog::checkingDone() { m_checking.Hide(); m_throbber->stop(); - css::uno::Reference< css::awt::XWindow >( - m_throbber, css::uno::UNO_QUERY_THROW)->setVisible(false); + uno::Reference< awt::XWindow >( + m_throbber, uno::UNO_QUERY_THROW)->setVisible(false); if (m_updates.getItemCount() == 0) { clearDescription(); m_description.Enable(); m_descriptions.Enable(); - showDescription( - ( m_disabledUpdates.empty() && m_generalErrors.empty() && m_specificErrors.empty() ) - ? m_none : m_noInstallable, false ); + + if ( m_disabledUpdates.empty() && m_specificErrors.empty() && m_ignoredUpdates.empty() ) + showDescription( m_none, false ); + else + showDescription( m_noInstallable, false ); } + enableOk(); } @@ -817,7 +902,7 @@ void UpdateDialog::enableOk() { // ********************************************************************************* void UpdateDialog::createNotifyJob( bool bPrepareOnly, - css::uno::Sequence< css::uno::Sequence< rtl::OUString > > &rItemList ) + uno::Sequence< uno::Sequence< rtl::OUString > > &rItemList ) { if ( !dp_misc::office_is_running() ) return; @@ -825,51 +910,51 @@ void UpdateDialog::createNotifyJob( bool bPrepareOnly, // notify update check job try { - css::uno::Reference< css::lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); - css::uno::Reference< css::lang::XMultiServiceFactory > xConfigProvider( + uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); + uno::Reference< lang::XMultiServiceFactory > xConfigProvider( xFactory->createInstance( OUSTR( "com.sun.star.configuration.ConfigurationProvider" )), - css::uno::UNO_QUERY_THROW); + uno::UNO_QUERY_THROW); - css::beans::PropertyValue aProperty; + beans::PropertyValue aProperty; aProperty.Name = OUSTR( "nodepath" ); - aProperty.Value = css::uno::makeAny( OUSTR("org.openoffice.Office.Addons/AddonUI/OfficeHelp/UpdateCheckJob") ); + aProperty.Value = uno::makeAny( OUSTR("org.openoffice.Office.Addons/AddonUI/OfficeHelp/UpdateCheckJob") ); - css::uno::Sequence< css::uno::Any > aArgumentList( 1 ); - aArgumentList[0] = css::uno::makeAny( aProperty ); + uno::Sequence< uno::Any > aArgumentList( 1 ); + aArgumentList[0] = uno::makeAny( aProperty ); - css::uno::Reference< css::container::XNameAccess > xNameAccess( + uno::Reference< container::XNameAccess > xNameAccess( xConfigProvider->createInstanceWithArguments( OUSTR("com.sun.star.configuration.ConfigurationAccess"), aArgumentList ), - css::uno::UNO_QUERY_THROW ); + uno::UNO_QUERY_THROW ); - css::util::URL aURL; + util::URL aURL; xNameAccess->getByName(OUSTR("URL")) >>= aURL.Complete; - css::uno::Reference < css::util::XURLTransformer > xTransformer( xFactory->createInstance( OUSTR( "com.sun.star.util.URLTransformer" ) ), - css::uno::UNO_QUERY_THROW ); + uno::Reference < util::XURLTransformer > xTransformer( xFactory->createInstance( OUSTR( "com.sun.star.util.URLTransformer" ) ), + uno::UNO_QUERY_THROW ); xTransformer->parseStrict(aURL); - css::uno::Reference < css::frame::XDesktop > xDesktop( xFactory->createInstance( OUSTR( "com.sun.star.frame.Desktop" ) ), - css::uno::UNO_QUERY_THROW ); - css::uno::Reference< css::frame::XDispatchProvider > xDispatchProvider( xDesktop->getCurrentFrame(), - css::uno::UNO_QUERY_THROW ); - css::uno::Reference< css::frame::XDispatch > xDispatch = xDispatchProvider->queryDispatch(aURL, rtl::OUString(), 0); + uno::Reference < frame::XDesktop > xDesktop( xFactory->createInstance( OUSTR( "com.sun.star.frame.Desktop" ) ), + uno::UNO_QUERY_THROW ); + uno::Reference< frame::XDispatchProvider > xDispatchProvider( xDesktop->getCurrentFrame(), + uno::UNO_QUERY_THROW ); + uno::Reference< frame::XDispatch > xDispatch = xDispatchProvider->queryDispatch(aURL, rtl::OUString(), 0); if( xDispatch.is() ) { - css::uno::Sequence< css::beans::PropertyValue > aPropList(2); + uno::Sequence< beans::PropertyValue > aPropList(2); aProperty.Name = OUSTR( "updateList" ); - aProperty.Value = css::uno::makeAny( rItemList ); + aProperty.Value = uno::makeAny( rItemList ); aPropList[0] = aProperty; aProperty.Name = OUSTR( "prepareOnly" ); - aProperty.Value = css::uno::makeAny( bPrepareOnly ); + aProperty.Value = uno::makeAny( bPrepareOnly ); aPropList[1] = aProperty; xDispatch->dispatch(aURL, aPropList ); } } - catch( const css::uno::Exception& e ) + catch( const uno::Exception& e ) { dp_misc::TRACE( OUSTR("Caught exception: ") + e.Message + OUSTR("\n thread terminated.\n\n")); @@ -882,26 +967,26 @@ void UpdateDialog::notifyMenubar( bool bPrepareOnly, bool bRecheckOnly ) if ( !dp_misc::office_is_running() ) return; - css::uno::Sequence< css::uno::Sequence< rtl::OUString > > aItemList; + uno::Sequence< uno::Sequence< rtl::OUString > > aItemList; sal_Int32 nCount = 0; if ( ! bRecheckOnly ) { for ( sal_Int16 i = 0; i < m_updates.getItemCount(); ++i ) { - css::uno::Sequence< rtl::OUString > aItem(2); + uno::Sequence< rtl::OUString > aItem(2); UpdateDialog::Index const * p = static_cast< UpdateDialog::Index const * >(m_updates.GetEntryData(i)); - if ( p->kind == ENABLED_UPDATE ) + if ( p->m_eKind == ENABLED_UPDATE ) { - dp_gui::UpdateData aUpdData = m_enabledUpdates[ p->index.enabledUpdate ]; + dp_gui::UpdateData aUpdData = m_enabledUpdates[ p->m_nIndex ]; aItem[0] = dp_misc::getIdentifier( aUpdData.aInstalledPackage ); dp_misc::DescriptionInfoset aInfoset( m_context, aUpdData.aUpdateInfo ); aItem[1] = aInfoset.getVersion(); } - else if ( p->kind == DISABLED_UPDATE ) + else if ( p->m_eKind == DISABLED_UPDATE ) continue; else continue; @@ -911,6 +996,8 @@ void UpdateDialog::notifyMenubar( bool bPrepareOnly, bool bRecheckOnly ) nCount += 1; } } + + storeIgnoredUpdates(); createNotifyJob( bPrepareOnly, aItemList ); } @@ -984,17 +1071,17 @@ void UpdateDialog::clearDescription() m_descriptions.SetPosSizePixel( m_aFirstLinePos, m_aFirstLineSize ); } -bool UpdateDialog::showDescription(css::uno::Reference< css::xml::dom::XNode > const & aUpdateInfo) +bool UpdateDialog::showDescription(uno::Reference< xml::dom::XNode > const & aUpdateInfo) { dp_misc::DescriptionInfoset infoset(m_context, aUpdateInfo); return showDescription(infoset.getLocalizedPublisherNameAndURL(), infoset.getLocalizedReleaseNotesURL()); } -bool UpdateDialog::showDescription(css::uno::Reference< css::deployment::XPackage > const & aExtension) +bool UpdateDialog::showDescription(uno::Reference< deployment::XPackage > const & aExtension) { OSL_ASSERT(aExtension.is()); - css::beans::StringPair pubInfo = aExtension->getPublisherInfo(); + beans::StringPair pubInfo = aExtension->getPublisherInfo(); return showDescription(std::make_pair(pubInfo.First, pubInfo.Second), OUSTR("")); } @@ -1057,7 +1144,7 @@ bool UpdateDialog::showDescription( const String& rDescription, bool bWithPublis return true; } -bool UpdateDialog::isReadOnly( const css::uno::Reference< css::deployment::XPackage > &xPackage ) const +bool UpdateDialog::isReadOnly( const uno::Reference< deployment::XPackage > &xPackage ) const { if ( m_xExtensionManager.is() && xPackage.is() ) { @@ -1067,6 +1154,162 @@ bool UpdateDialog::isReadOnly( const css::uno::Reference< css::deployment::XPack return true; } +//------------------------------------------------------------------------------ +void UpdateDialog::getIgnoredUpdates() +{ + uno::Reference< lang::XMultiServiceFactory > xConfig( m_context->getServiceManager()->createInstanceWithContext( + OUSTR("com.sun.star.configuration.ConfigurationProvider"), m_context ), uno::UNO_QUERY_THROW); + beans::NamedValue aValue( OUSTR("nodepath"), uno::Any( IGNORED_UPDATES ) ); + uno::Sequence< uno::Any > args(1); + args[0] <<= aValue; + + uno::Reference< container::XNameAccess > xNameAccess( xConfig->createInstanceWithArguments( OUSTR("com.sun.star.configuration.ConfigurationAccess"), args), uno::UNO_QUERY_THROW ); + uno::Sequence< rtl::OUString > aElementNames = xNameAccess->getElementNames(); + + for ( sal_Int32 i = 0; i < aElementNames.getLength(); i++ ) + { + ::rtl::OUString aIdentifier = aElementNames[i]; + ::rtl::OUString aVersion; + + uno::Any aPropValue( uno::Reference< beans::XPropertySet >( xNameAccess->getByName( aIdentifier ), uno::UNO_QUERY_THROW )->getPropertyValue( PROPERTY_VERSION ) ); + aPropValue >>= aVersion; + IgnoredUpdate *pData = new IgnoredUpdate( aIdentifier, aVersion ); + m_ignoredUpdates.push_back( pData ); + } +} + +//------------------------------------------------------------------------------ +void UpdateDialog::storeIgnoredUpdates() +{ + if ( m_bModified && ( m_ignoredUpdates.size() != 0 ) ) + { + uno::Reference< lang::XMultiServiceFactory > xConfig( m_context->getServiceManager()->createInstanceWithContext( + OUSTR("com.sun.star.configuration.ConfigurationProvider"), m_context ), uno::UNO_QUERY_THROW ); + beans::NamedValue aValue( OUSTR("nodepath"), uno::Any( IGNORED_UPDATES ) ); + uno::Sequence< uno::Any > args(1); + args[0] <<= aValue; + + uno::Reference< container::XNameContainer > xNameContainer( xConfig->createInstanceWithArguments( + OUSTR("com.sun.star.configuration.ConfigurationUpdateAccess"), args ), uno::UNO_QUERY_THROW ); + + for ( std::vector< UpdateDialog::IgnoredUpdate* >::iterator i( m_ignoredUpdates.begin() ); i != m_ignoredUpdates.end(); ++i ) + { + if ( xNameContainer->hasByName( (*i)->sExtensionID ) ) + { + if ( (*i)->bRemoved ) + xNameContainer->removeByName( (*i)->sExtensionID ); + else + uno::Reference< beans::XPropertySet >( xNameContainer->getByName( (*i)->sExtensionID ), uno::UNO_QUERY_THROW )->setPropertyValue( PROPERTY_VERSION, uno::Any( (*i)->sVersion ) ); + } + else if ( ! (*i)->bRemoved ) + { + uno::Reference< beans::XPropertySet > elem( uno::Reference< lang::XSingleServiceFactory >( xNameContainer, uno::UNO_QUERY_THROW )->createInstance(), uno::UNO_QUERY_THROW ); + elem->setPropertyValue( PROPERTY_VERSION, uno::Any( (*i)->sVersion ) ); + xNameContainer->insertByName( (*i)->sExtensionID, uno::Any( elem ) ); + } + } + + uno::Reference< util::XChangesBatch > xChangesBatch( xNameContainer, uno::UNO_QUERY ); + if ( xChangesBatch.is() && xChangesBatch->hasPendingChanges() ) + xChangesBatch->commitChanges(); + } + + m_bModified = false; +} + +//------------------------------------------------------------------------------ +bool UpdateDialog::isIgnoredUpdate( UpdateDialog::Index * index ) +{ + bool bIsIgnored = false; + + if ( m_ignoredUpdates.size() != 0 ) + { + rtl::OUString aExtensionID; + rtl::OUString aVersion; + + if ( index->m_eKind == ENABLED_UPDATE ) + { + dp_gui::UpdateData aUpdData = m_enabledUpdates[ index->m_nIndex ]; + aExtensionID = dp_misc::getIdentifier( aUpdData.aInstalledPackage ); + aVersion = aUpdData.updateVersion; + } + else if ( index->m_eKind == DISABLED_UPDATE ) + { + DisabledUpdate &rData = m_disabledUpdates[ index->m_nIndex ]; + dp_misc::DescriptionInfoset aInfoset( m_context, rData.aUpdateInfo ); + ::boost::optional< ::rtl::OUString > aID( aInfoset.getIdentifier() ); + if ( aID ) + aExtensionID = *aID; + aVersion = aInfoset.getVersion(); + } + + for ( std::vector< UpdateDialog::IgnoredUpdate* >::iterator i( m_ignoredUpdates.begin() ); i != m_ignoredUpdates.end(); ++i ) + { + if ( (*i)->sExtensionID == aExtensionID ) + { + if ( ( (*i)->sVersion.getLength() == 0 ) || ( (*i)->sVersion == aVersion ) ) + { + bIsIgnored = true; + index->m_bIgnored = true; + } + else // when we find another update of an ignored version, we will remove the old one to keep the ignored list small + (*i)->bRemoved = true; + break; + } + } + } + + return bIsIgnored; +} + +//------------------------------------------------------------------------------ +void UpdateDialog::setIgnoredUpdate( UpdateDialog::Index *pIndex, bool bIgnore, bool bIgnoreAll ) +{ + rtl::OUString aExtensionID; + rtl::OUString aVersion; + + m_bModified = true; + + if ( pIndex->m_eKind == ENABLED_UPDATE ) + { + dp_gui::UpdateData aUpdData = m_enabledUpdates[ pIndex->m_nIndex ]; + aExtensionID = dp_misc::getIdentifier( aUpdData.aInstalledPackage ); + if ( !bIgnoreAll ) + aVersion = aUpdData.updateVersion; + } + else if ( pIndex->m_eKind == DISABLED_UPDATE ) + { + DisabledUpdate &rData = m_disabledUpdates[ pIndex->m_nIndex ]; + dp_misc::DescriptionInfoset aInfoset( m_context, rData.aUpdateInfo ); + ::boost::optional< ::rtl::OUString > aID( aInfoset.getIdentifier() ); + if ( aID ) + aExtensionID = *aID; + if ( !bIgnoreAll ) + aVersion = aInfoset.getVersion(); + } + + if ( aExtensionID.getLength() ) + { + bool bFound = false; + for ( std::vector< UpdateDialog::IgnoredUpdate* >::iterator i( m_ignoredUpdates.begin() ); i != m_ignoredUpdates.end(); ++i ) + { + if ( (*i)->sExtensionID == aExtensionID ) + { + (*i)->sVersion = aVersion; + (*i)->bRemoved = !bIgnore; + bFound = true; + break; + } + } + if ( bIgnore && !bFound ) + { + IgnoredUpdate *pData = new IgnoredUpdate( aExtensionID, aVersion ); + m_ignoredUpdates.push_back( pData ); + } + } +} + +//------------------------------------------------------------------------------ IMPL_LINK(UpdateDialog, selectionHandler, void *, EMPTYARG) { rtl::OUStringBuffer b; @@ -1075,38 +1318,32 @@ IMPL_LINK(UpdateDialog, selectionHandler, void *, EMPTYARG) m_updates.GetEntryData(m_updates.GetSelectEntryPos())); clearDescription(); - if (p != NULL) + if ( p != NULL ) { - //When the index is greater or equal than the amount of enabled updates then the "Show all" - //button is probably checked. Then we show first all enabled and then the disabled - //updates. - USHORT pos = m_updates.GetSelectEntryPos(); - const std::vector< dp_gui::UpdateData >::size_type sizeEnabled = - m_enabledUpdates.size(); - const std::vector< UpdateDialog::DisabledUpdate >::size_type sizeDisabled = - m_disabledUpdates.size(); - if (pos < sizeEnabled) - { - if (m_enabledUpdates[pos].aUpdateSource.is()) - bInserted = showDescription(m_enabledUpdates[pos].aUpdateSource); - else - bInserted = showDescription(m_enabledUpdates[pos].aUpdateInfo); - } - else if (pos >= sizeEnabled - && pos < (sizeEnabled + sizeDisabled)) - bInserted = showDescription(m_disabledUpdates[pos - sizeEnabled].aUpdateInfo); + USHORT pos = p->m_nIndex; - switch (p->kind) + switch (p->m_eKind) { case ENABLED_UPDATE: { - b.append(m_noDescription); + if ( m_enabledUpdates[ pos ].aUpdateSource.is() ) + bInserted = showDescription( m_enabledUpdates[ pos ].aUpdateSource ); + else + bInserted = showDescription( m_enabledUpdates[ pos ].aUpdateInfo ); + + if ( p->m_bIgnored ) + b.append( m_ignoredUpdate ); + break; } case DISABLED_UPDATE: { - UpdateDialog::DisabledUpdate & data = m_disabledUpdates[ - p->index.disabledUpdate]; + bInserted = showDescription( m_disabledUpdates[pos].aUpdateInfo ); + + if ( p->m_bIgnored ) + b.append( m_ignoredUpdate ); + + UpdateDialog::DisabledUpdate & data = m_disabledUpdates[ pos ]; if (data.unsatisfiedDependencies.getLength() != 0) { // create error string for version mismatch @@ -1139,23 +1376,12 @@ IMPL_LINK(UpdateDialog, selectionHandler, void *, EMPTYARG) } break; } - case GENERAL_ERROR: - { - rtl::OUString & msg = m_generalErrors[p->index.generalError]; - b.append(m_failure); - b.append(LF); - b.append(msg.getLength() == 0 ? m_unknownError : msg); - break; - } case SPECIFIC_ERROR: { - UpdateDialog::SpecificError & data = m_specificErrors[ - p->index.specificError]; + UpdateDialog::SpecificError & data = m_specificErrors[ pos ]; b.append(m_failure); b.append(LF); - b.append( - data.message.getLength() == 0 - ? m_unknownError : data.message); + b.append( data.message.getLength() == 0 ? m_unknownError : data.message ); break; } default: @@ -1164,56 +1390,37 @@ IMPL_LINK(UpdateDialog, selectionHandler, void *, EMPTYARG) } } + if ( b.getLength() == 0 ) + b.append( m_noDescription ); + showDescription( b.makeStringAndClear(), bInserted ); return 0; } -IMPL_LINK(UpdateDialog, allHandler, void *, EMPTYARG) { - if (m_all.IsChecked()) { +IMPL_LINK(UpdateDialog, allHandler, void *, EMPTYARG) +{ + if (m_all.IsChecked()) + { m_update.Enable(); m_updates.Enable(); m_description.Enable(); m_descriptions.Enable(); - std::vector< UpdateDialog::DisabledUpdate >::size_type n1 = 0; - for (std::vector< UpdateDialog::DisabledUpdate >::iterator i( - m_disabledUpdates.begin()); - i != m_disabledUpdates.end(); ++i) - { - insertItem( - i->name, LISTBOX_APPEND, - UpdateDialog::Index::newDisabledUpdate(n1++), - SvLBoxButtonKind_disabledCheckbox); - } - std::vector< rtl::OUString >::size_type n2 = 0; - for (std::vector< rtl::OUString >::iterator i(m_generalErrors.begin()); - i != m_generalErrors.end(); ++i) + + for (std::vector< UpdateDialog::Index* >::iterator i( m_ListboxEntries.begin() ); + i != m_ListboxEntries.end(); ++i ) { - insertItem( - m_error, LISTBOX_APPEND, - UpdateDialog::Index::newGeneralError(n2++), - SvLBoxButtonKind_staticImage); + if ( (*i)->m_bIgnored || ( (*i)->m_eKind != ENABLED_UPDATE ) ) + insertItem( (*i), SvLBoxButtonKind_disabledCheckbox ); } - std::vector< UpdateDialog::SpecificError >::size_type n3 = 0; - for (std::vector< UpdateDialog::SpecificError >::iterator i( - m_specificErrors.begin()); - i != m_specificErrors.end(); ++i) + } + else + { + for ( USHORT i = 0; i < m_updates.getItemCount(); ) { - insertItem( - i->name, LISTBOX_APPEND, - UpdateDialog::Index::newSpecificError(n3++), - SvLBoxButtonKind_staticImage); - } - } else { - for (USHORT i = 0; i < m_updates.getItemCount();) { - UpdateDialog::Index const * p = - static_cast< UpdateDialog::Index const * >( - m_updates.GetEntryData(i)); - if (p->kind != ENABLED_UPDATE) { + UpdateDialog::Index const * p = static_cast< UpdateDialog::Index const * >( m_updates.GetEntryData(i) ); + if ( p->m_bIgnored || ( p->m_eKind != ENABLED_UPDATE ) ) + { m_updates.RemoveEntry(i); - //TODO #i72487#: UpdateDialog::Index potentially leaks as - // SvxCheckListBox::RemoveEntry's exception behavior is - // unspecified - delete p; } else { ++i; } @@ -1260,8 +1467,8 @@ IMPL_LINK(UpdateDialog, okHandler, void *, EMPTYARG) UpdateDialog::Index const * p = static_cast< UpdateDialog::Index const * >( m_updates.GetEntryData(i)); - if (p->kind == ENABLED_UPDATE && m_updates.IsChecked(i)) { - m_updateData.push_back(m_enabledUpdates[p->index.enabledUpdate]); + if (p->m_eKind == ENABLED_UPDATE && m_updates.IsChecked(i)) { + m_updateData.push_back( m_enabledUpdates[ p->m_nIndex ] ); } } @@ -1269,7 +1476,7 @@ IMPL_LINK(UpdateDialog, okHandler, void *, EMPTYARG) return 0; } -IMPL_LINK(UpdateDialog, cancelHandler, void *, EMPTYARG) { +IMPL_LINK(UpdateDialog, closeHandler, void *, EMPTYARG) { m_thread->stop(); EndDialog(RET_CANCEL); return 0; @@ -1285,15 +1492,15 @@ IMPL_LINK( UpdateDialog, hyperlink_clicked, svt::FixedHyperlink*, pHyperlink ) try { - css::uno::Reference< css::system::XSystemShellExecute > xSystemShellExecute( + uno::Reference< com::sun::star::system::XSystemShellExecute > xSystemShellExecute( m_context->getServiceManager()->createInstanceWithContext( OUSTR( "com.sun.star.system.SystemShellExecute" ), - m_context), css::uno::UNO_QUERY_THROW); - //throws css::lang::IllegalArgumentException, css::system::SystemShellExecuteException + m_context), uno::UNO_QUERY_THROW); + //throws lang::IllegalArgumentException, system::SystemShellExecuteException xSystemShellExecute->execute( - sURL, ::rtl::OUString(), css::system::SystemShellExecuteFlags::DEFAULTS); + sURL, ::rtl::OUString(), com::sun::star::system::SystemShellExecuteFlags::DEFAULTS); } - catch (css::uno::Exception& ) + catch (uno::Exception& ) { } diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.hxx b/desktop/source/deployment/gui/dp_gui_updatedialog.hxx index 32c317cb8735..54e645f195d8 100644..100755 --- a/desktop/source/deployment/gui/dp_gui_updatedialog.hxx +++ b/desktop/source/deployment/gui/dp_gui_updatedialog.hxx @@ -112,8 +112,7 @@ private: struct DisabledUpdate; struct SpecificError; - union IndexUnion; - friend union IndexUnion; + struct IgnoredUpdate; struct Index; friend struct Index; class Thread; @@ -135,40 +134,36 @@ private: void operator =(UpdateDialog::CheckListBox &); // not defined virtual void MouseButtonDown(MouseEvent const & event); - virtual void MouseButtonUp(MouseEvent const & event); - virtual void KeyInput(KeyEvent const & event); + void handlePopupMenu( const Point &rPos ); + + rtl::OUString m_ignoreUpdate; + rtl::OUString m_ignoreAllUpdates; + rtl::OUString m_enableUpdate; UpdateDialog & m_dialog; }; friend class CheckListBox; - void insertItem( - rtl::OUString const & name, USHORT position, - std::auto_ptr< UpdateDialog::Index const > index, - SvLBoxButtonKind kind); - - void addAdditional( - rtl::OUString const & name, USHORT position, - std::auto_ptr< UpdateDialog::Index const > index, - SvLBoxButtonKind kind); + USHORT insertItem( UpdateDialog::Index *pIndex, SvLBoxButtonKind kind ); + void addAdditional( UpdateDialog::Index *pIndex, SvLBoxButtonKind kind ); + bool isIgnoredUpdate( UpdateDialog::Index *pIndex ); + void setIgnoredUpdate( UpdateDialog::Index *pIndex, bool bIgnore, bool bIgnoreAll ); - void addEnabledUpdate( - rtl::OUString const & name, dp_gui::UpdateData const & data); - - void addDisabledUpdate(UpdateDialog::DisabledUpdate const & data); -#if 0 - void addGeneralError(rtl::OUString const & message); -#endif - void addSpecificError(UpdateDialog::SpecificError const & data); + void addEnabledUpdate( rtl::OUString const & name, dp_gui::UpdateData & data ); + void addDisabledUpdate( UpdateDialog::DisabledUpdate & data ); + void addSpecificError( UpdateDialog::SpecificError & data ); void checkingDone(); void enableOk(); + void getIgnoredUpdates(); + void storeIgnoredUpdates(); + void initDescription(); void clearDescription(); bool showDescription(::com::sun::star::uno::Reference< @@ -183,7 +178,7 @@ private: DECL_LINK(selectionHandler, void *); DECL_LINK(allHandler, void *); DECL_LINK(okHandler, void *); - DECL_LINK(cancelHandler, void *); + DECL_LINK(closeHandler, void *); DECL_LINK(hyperlink_clicked, svt::FixedHyperlink *); com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > @@ -202,7 +197,7 @@ private: FixedLine m_line; HelpButton m_help; PushButton m_ok; - CancelButton m_cancel; + PushButton m_close; rtl::OUString m_error; rtl::OUString m_none; rtl::OUString m_noInstallable; @@ -214,18 +209,22 @@ private: rtl::OUString m_noDependencyCurVer; rtl::OUString m_browserbased; rtl::OUString m_version; + rtl::OUString m_ignoredUpdate; std::vector< dp_gui::UpdateData > m_enabledUpdates; std::vector< UpdateDialog::DisabledUpdate > m_disabledUpdates; - std::vector< rtl::OUString > m_generalErrors; std::vector< UpdateDialog::SpecificError > m_specificErrors; + std::vector< UpdateDialog::IgnoredUpdate* > m_ignoredUpdates; + std::vector< Index* > m_ListboxEntries; std::vector< dp_gui::UpdateData > & m_updateData; rtl::Reference< UpdateDialog::Thread > m_thread; ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XExtensionManager > m_xExtensionManager; - Point m_aFirstLinePos; - Size m_aFirstLineSize; - long m_nFirstLineDelta; - long m_nOneLineMissing; + Point m_aFirstLinePos; + Size m_aFirstLineSize; + long m_nFirstLineDelta; + long m_nOneLineMissing; + USHORT m_nLastID; + bool m_bModified; }; } diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.src b/desktop/source/deployment/gui/dp_gui_updatedialog.src index 20b7d30988fd..4da431733e31 100644..100755 --- a/desktop/source/deployment/gui/dp_gui_updatedialog.src +++ b/desktop/source/deployment/gui/dp_gui_updatedialog.src @@ -199,7 +199,7 @@ ModalDialog RID_DLG_UPDATE { Text[en-US] = "~Install"; DefButton = TRUE; }; - CancelButton RID_DLG_UPDATE_CANCEL { + PushButton RID_DLG_UPDATE_CLOSE { Pos = MAP_APPFONT( RSC_SP_DLG_INNERBORDER_LEFT + LOCAL_WIDTH - RSC_CD_PUSHBUTTON_WIDTH, (RSC_SP_DLG_INNERBORDER_TOP + RSC_CD_FIXEDTEXT_HEIGHT + @@ -208,6 +208,7 @@ ModalDialog RID_DLG_UPDATE { RSC_SP_CTRL_DESC_Y + LOCAL_LIST_HEIGHT2 + RSC_SP_FLGR_SPACE_Y + RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_SPACE_Y)); Size = MAP_APPFONT(RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT); + Text[en-US] = "Close"; }; Image RID_DLG_UPDATE_NORMALALERT { @@ -227,7 +228,7 @@ ModalDialog RID_DLG_UPDATE { Text[en-US] = "No new updates are available."; }; String RID_DLG_UPDATE_NOINSTALLABLE { - Text[en-US] = "No installable updates are available. To see all updates, mark the check box 'Show all updates'."; + Text[en-US] = "No installable updates are available. To see ignored or disabled updates, mark the check box 'Show all updates'."; }; String RID_DLG_UPDATE_FAILURE { Text[en-US] = "An error occurred:"; @@ -236,7 +237,7 @@ ModalDialog RID_DLG_UPDATE { Text[en-US] = "Unknown error."; }; String RID_DLG_UPDATE_NODESCRIPTION { - Text[en-US] = "No descriptions available for this extension."; + Text[en-US] = "No more details are available for this update."; }; String RID_DLG_UPDATE_NOINSTALL { Text[en-US] = "The extension cannot be updated because:"; @@ -250,10 +251,21 @@ ModalDialog RID_DLG_UPDATE { String RID_DLG_UPDATE_BROWSERBASED { Text[en-US] = "browser based update"; }; - String RID_DLG_UPDATE_VERSION { Text[en-US] = "Version"; }; + String RID_DLG_UPDATE_IGNORE { + Text[en-US] = "Ignore this Update"; + }; + String RID_DLG_UPDATE_IGNORE_ALL { + Text[en-US] = "Ignore all Updates"; + }; + String RID_DLG_UPDATE_ENABLE { + Text[en-US] = "Enable Updates"; + }; + String RID_DLG_UPDATE_IGNORED_UPDATE { + Text[en-US] = "This update will be ignored.\n"; + }; }; WarningBox RID_WARNINGBOX_UPDATE_SHARED_EXTENSION diff --git a/desktop/source/deployment/misc/dp_misc.src b/desktop/source/deployment/misc/dp_misc.src index 0d341122af16..ae810d2c7851 100644..100755 --- a/desktop/source/deployment/misc/dp_misc.src +++ b/desktop/source/deployment/misc/dp_misc.src @@ -32,7 +32,7 @@ String RID_DEPLYOMENT_DEPENDENCIES_UNKNOWN { }; String RID_DEPLYOMENT_DEPENDENCIES_MIN { - Text[en-US] = "Extensions requires at least OpenOffice.org %VERSION"; + Text[en-US] = "Extension requires at least OpenOffice.org %VERSION"; }; String RID_DEPLYOMENT_DEPENDENCIES_MAX { diff --git a/desktop/source/deployment/registry/dp_backend.cxx b/desktop/source/deployment/registry/dp_backend.cxx index d781ba9e40ef..fa53d4e78a15 100644..100755 --- a/desktop/source/deployment/registry/dp_backend.cxx +++ b/desktop/source/deployment/registry/dp_backend.cxx @@ -520,6 +520,15 @@ OUString Package::getDescription() throw ( } //______________________________________________________________________________ +OUString Package::getLicenseText() throw ( + deployment::ExtensionRemovedException,RuntimeException) +{ + if (m_bRemoved) + throw deployment::ExtensionRemovedException(); + return OUString(); +} + +//______________________________________________________________________________ Sequence<OUString> Package::getUpdateInformationURLs() throw ( deployment::ExtensionRemovedException, RuntimeException) { diff --git a/desktop/source/deployment/registry/inc/dp_backend.h b/desktop/source/deployment/registry/inc/dp_backend.h index 3e6bd95c6c77..20fc2a8dc7e1 100644..100755 --- a/desktop/source/deployment/registry/inc/dp_backend.h +++ b/desktop/source/deployment/registry/inc/dp_backend.h @@ -237,6 +237,9 @@ public: virtual ::rtl::OUString SAL_CALL getDescription() throw (css::deployment::ExtensionRemovedException, css::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getLicenseText() + throw (css::deployment::ExtensionRemovedException, + css::uno::RuntimeException); virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getUpdateInformationURLs() throw (css::deployment::ExtensionRemovedException, diff --git a/desktop/source/deployment/registry/package/dp_package.cxx b/desktop/source/deployment/registry/package/dp_package.cxx index 7f262d66684b..262bbef420f2 100755 --- a/desktop/source/deployment/registry/package/dp_package.cxx +++ b/desktop/source/deployment/registry/package/dp_package.cxx @@ -190,6 +190,9 @@ class BackendImpl : public ImplBaseT virtual OUString SAL_CALL getDescription() throw (deployment::ExtensionRemovedException, RuntimeException); + virtual OUString SAL_CALL getLicenseText() + throw (deployment::ExtensionRemovedException, RuntimeException); + virtual void SAL_CALL exportTo( OUString const & destFolderURL, OUString const & newTitle, sal_Int32 nameClashAction, @@ -1003,6 +1006,31 @@ OUString BackendImpl::PackageImpl::getDescription() } //______________________________________________________________________________ +OUString BackendImpl::PackageImpl::getLicenseText() + throw (deployment::ExtensionRemovedException, RuntimeException) +{ + if (m_bRemoved) + throw deployment::ExtensionRemovedException(); + + OUString sLicense; + DescriptionInfoset aInfo = getDescriptionInfoset(); + + ::boost::optional< SimpleLicenseAttributes > aSimplLicAttr = aInfo.getSimpleLicenseAttributes(); + if ( aSimplLicAttr ) + { + OUString aLicenseURL = aInfo.getLocalizedLicenseURL(); + + if ( aLicenseURL.getLength() ) + { + OUString aFullURL = m_url_expanded + OUSTR("/") + aLicenseURL; + sLicense = getTextFromURL( Reference< ucb::XCommandEnvironment >(), aFullURL); + } + } + + return sLicense; +} + +//______________________________________________________________________________ void BackendImpl::PackageImpl::exportTo( OUString const & destFolderURL, OUString const & newTitle, sal_Int32 nameClashAction, Reference<ucb::XCommandEnvironment> const & xCmdEnv ) diff --git a/desktop/source/deployment/registry/sfwk/dp_sfwk.cxx b/desktop/source/deployment/registry/sfwk/dp_sfwk.cxx index 8a4ee1b45fbc..f3195701fc7c 100644..100755 --- a/desktop/source/deployment/registry/sfwk/dp_sfwk.cxx +++ b/desktop/source/deployment/registry/sfwk/dp_sfwk.cxx @@ -88,6 +88,7 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend OUString const & identifier); // XPackage virtual OUString SAL_CALL getDescription() throw (RuntimeException); + virtual OUString SAL_CALL getLicenseText() throw (RuntimeException); }; friend class PackageImpl; @@ -133,6 +134,12 @@ OUString BackendImpl::PackageImpl::getDescription() throw (RuntimeException) } //______________________________________________________________________________ +OUString BackendImpl::PackageImpl::getLicenseText() throw (RuntimeException) +{ + return Package::getDescription(); +} + +//______________________________________________________________________________ BackendImpl::PackageImpl::PackageImpl( ::rtl::Reference<BackendImpl> const & myBackend, OUString const & url, OUString const & libType, bool bRemoved, diff --git a/desktop/util/ooverinfo2.rc b/desktop/util/ooverinfo2.rc index 8bc39767f04a..17af6818551e 100644..100755 --- a/desktop/util/ooverinfo2.rc +++ b/desktop/util/ooverinfo2.rc @@ -25,21 +25,7 @@ * *************************************************************************/ -#define VERSION 3 -#define SUBVERSION 3 -//#define VERVARIANT 0 -// .0 + VER_CONCEPT -// .100 + VER_ALPHA -// .200 + VER_BETA -// .300 + VER_GAMMA -// .500 + VER_FINAL -//#define VER_CONCEPT 0 -//#define VER_BETA 6 -#define VER_FINAL 0 - -#define VER_DAY 1 -#define VER_MONTH 1 -#define VER_YEAR 2010 +#include "version.hrc" // ----------------------------------------------------------------------- |