From 73b1fb3f842f654e253bacb8d04bf5b95ad272fc Mon Sep 17 00:00:00 2001 From: Joachim Lingner Date: Tue, 3 Aug 2010 15:21:37 +0200 Subject: dv21 #i113524# prevent online update for bundled extensions --- desktop/source/deployment/misc/dp_update.cxx | 84 ++++++++++++++++++++++------ 1 file changed, 67 insertions(+), 17 deletions(-) mode change 100755 => 100644 desktop/source/deployment/misc/dp_update.cxx (limited to 'desktop/source/deployment') diff --git a/desktop/source/deployment/misc/dp_update.cxx b/desktop/source/deployment/misc/dp_update.cxx old mode 100755 new mode 100644 index 52011f1f0ca0..fb6efe0b79aa --- a/desktop/source/deployment/misc/dp_update.cxx +++ b/desktop/source/deployment/misc/dp_update.cxx @@ -90,8 +90,6 @@ getUpdateInformation( Reference const & Sequence >(); } -//Put in anonymous namespace - void getOwnUpdateInfos( Reference const & xContext, Reference const & updateInformation, @@ -185,6 +183,56 @@ void getDefaultUpdateInfos( } } +bool containsBundledOnly(Sequence > const & sameIdExtensions) +{ + OSL_ASSERT(sameIdExtensions.getLength() == 3); + if (!sameIdExtensions[0].is() && !sameIdExtensions[1].is() && sameIdExtensions[2].is()) + return true; + else + return false; +} +/** Returns true if the list of extensions are bundled extensions and there are no + other extensions with the same identifier in the shared or user repository. + If extensionList is NULL, then it is checked if there are only bundled extensions. +*/ +bool onlyBundledExtensions( + Reference const & xExtMgr, + std::vector< Reference > const * extensionList) +{ + OSL_ASSERT(xExtMgr.is()); + bool onlyBundled = true; + if (extensionList) + { + typedef std::vector >::const_iterator CIT; + for (CIT i = extensionList->begin(); i != extensionList->end(); i++) + { + Sequence > seqExt = xExtMgr->getExtensionsWithSameIdentifier( + dp_misc::getIdentifier(*i), (*i)->getName(), Reference()); + + if (!containsBundledOnly(seqExt)) + { + onlyBundled = false; + break; + } + + } + } + else + { + const uno::Sequence< uno::Sequence< Reference > > seqAllExt = + xExtMgr->getAllExtensions(Reference(), Reference()); + + for (int pos = seqAllExt.getLength(); pos --; ) + { + if (!containsBundledOnly(seqAllExt[pos])) + { + onlyBundled = false; + break; + } + } + } + return onlyBundled; +} } // anon namespace @@ -233,13 +281,14 @@ UPDATE_SOURCE isUpdateUserExtension( retVal = UPDATE_SOURCE_ONLINE; } - else if (bundledVersion.getLength()) - { - int index = determineHighestVersion( - OUString(), OUString(), bundledVersion, onlineVersion); - if (index == 3) - retVal = UPDATE_SOURCE_ONLINE; - } + //No update for bundled extensions, they are updated only by the setup + //else if (bundledVersion.getLength()) + //{ + // int index = determineHighestVersion( + // OUString(), OUString(), bundledVersion, onlineVersion); + // if (index == 3) + // retVal = UPDATE_SOURCE_ONLINE; + //} } else { @@ -278,13 +327,14 @@ UPDATE_SOURCE isUpdateSharedExtension( else if (index == 3) retVal = UPDATE_SOURCE_ONLINE; } - else if (bundledVersion.getLength()) - { - int index = determineHighestVersion( - OUString(), OUString(), bundledVersion, onlineVersion); - if (index == 3) - retVal = UPDATE_SOURCE_ONLINE; - } + //No update for bundled extensions, they are updated only by the setup + //else if (bundledVersion.getLength()) + //{ + // int index = determineHighestVersion( + // OUString(), OUString(), bundledVersion, onlineVersion); + // if (index == 3) + // retVal = UPDATE_SOURCE_ONLINE; + //} return retVal; } @@ -332,7 +382,7 @@ UpdateInfoMap getOnlineUpdateInfos( { OSL_ASSERT(xExtMgr.is()); UpdateInfoMap infoMap; - if (!xExtMgr.is()) + if (!xExtMgr.is() || onlyBundledExtensions(xExtMgr, extensionList)) return infoMap; if (!extensionList) -- cgit From 3a3e4a7b24f97b14bfa1162e679d12e29bd6e878 Mon Sep 17 00:00:00 2001 From: Dirk Voelzke Date: Thu, 19 Aug 2010 16:07:49 +0200 Subject: dv21:#i113524# No update menu entry for bundled extensions --- desktop/source/deployment/gui/dp_gui_dialog2.cxx | 30 ++++++++++++++---------- 1 file changed, 17 insertions(+), 13 deletions(-) (limited to 'desktop/source/deployment') diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx index 87f70e449b9d..44d1e30f74b6 100755 --- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx @@ -363,24 +363,28 @@ bool ExtBoxWithBtns_Impl::HandleTabKey( bool bReverse ) // ----------------------------------------------------------------------- MENU_COMMAND ExtBoxWithBtns_Impl::ShowPopupMenu( const Point & rPos, const long nPos ) { - if ( nPos >= (long) getItemCount() ) - return CMD_NONE; + if ( ( nPos >= 0 ) && ( nPos < (long) getItemCount() ) ) + { + if ( ! GetEntryData( nPos )->m_bLocked ) + { + PopupMenu aPopup; - PopupMenu aPopup; + aPopup.InsertItem( CMD_UPDATE, DialogHelper::getResourceString( RID_CTX_ITEM_CHECK_UPDATE ) ); - aPopup.InsertItem( CMD_UPDATE, DialogHelper::getResourceString( RID_CTX_ITEM_CHECK_UPDATE ) ); + 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 ) ); + } - if ( ! GetEntryData( nPos )->m_bLocked ) - { - 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 ) ); - aPopup.InsertItem( CMD_REMOVE, DialogHelper::getResourceString( RID_CTX_ITEM_REMOVE ) ); + return (MENU_COMMAND) aPopup.Execute( this, rPos ); + } } - - return (MENU_COMMAND) aPopup.Execute( this, rPos ); + return CMD_NONE; } //------------------------------------------------------------------------------ -- cgit