summaryrefslogtreecommitdiffstats
path: root/desktop/source/deployment/gui/dp_gui_dialog2.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/source/deployment/gui/dp_gui_dialog2.cxx')
-rw-r--r--desktop/source/deployment/gui/dp_gui_dialog2.cxx74
1 files changed, 50 insertions, 24 deletions
diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx
index 3169904aa4a6..03885b161941 100644
--- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx
+++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx
@@ -34,6 +34,7 @@
#include <fpicker/strings.hrc>
+#include <utility>
#include <vcl/commandevent.hxx>
#include <vcl/svapp.hxx>
@@ -51,7 +52,7 @@
#include <cppuhelper/supportsservice.hxx>
#include <comphelper/processfactory.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <unotools/configmgr.hxx>
#include <com/sun/star/deployment/DeploymentException.hpp>
@@ -76,7 +77,7 @@ using namespace ::com::sun::star::system;
namespace dp_gui {
constexpr OUStringLiteral USER_PACKAGE_MANAGER = u"user";
-constexpr OUStringLiteral SHARED_PACKAGE_MANAGER = u"shared";
+constexpr OUString SHARED_PACKAGE_MANAGER = u"shared"_ustr;
constexpr OUStringLiteral BUNDLED_PACKAGE_MANAGER = u"bundled";
// ExtBoxWithBtns_Impl
@@ -87,7 +88,7 @@ class ExtBoxWithBtns_Impl : public ExtensionBox_Impl
ExtMgrDialog* m_pParent;
void SetButtonStatus( const TEntry_Impl& rEntry );
- OString ShowPopupMenu( const Point &rPos, const tools::Long nPos );
+ OUString ShowPopupMenu( const Point &rPos, const tools::Long nPos );
public:
explicit ExtBoxWithBtns_Impl(std::unique_ptr<weld::ScrolledWindow> xScroll);
@@ -199,7 +200,7 @@ bool ExtBoxWithBtns_Impl::Command(const CommandEvent& rCEvt)
const Point aMousePos(rCEvt.GetMousePosPixel());
const auto nPos = PointToPos(aMousePos);
- OString sCommand = ShowPopupMenu(aMousePos, nPos);
+ OUString sCommand = ShowPopupMenu(aMousePos, nPos);
if (sCommand == "CMD_ENABLE")
m_pParent->enablePackage( GetEntryData( nPos )->m_xPackage, true );
@@ -220,7 +221,7 @@ bool ExtBoxWithBtns_Impl::Command(const CommandEvent& rCEvt)
return true;
}
-OString ExtBoxWithBtns_Impl::ShowPopupMenu( const Point & rPos, const tools::Long nPos )
+OUString ExtBoxWithBtns_Impl::ShowPopupMenu( const Point & rPos, const tools::Long nPos )
{
if ( nPos >= static_cast<tools::Long>(getItemCount()) )
return "CMD_NONE";
@@ -436,6 +437,7 @@ ExtMgrDialog::ExtMgrDialog(weld::Window *pParent, TheExtensionManager *pManager)
, m_xProgressText(m_xBuilder->weld_label("progressft"))
, m_xProgressBar(m_xBuilder->weld_progress_bar("progressbar"))
, m_xCancelBtn(m_xBuilder->weld_button("cancel"))
+ , m_xSearchEntry(m_xBuilder->weld_entry("search"))
{
m_xExtensionBox->InitFromDialog(this);
@@ -453,6 +455,8 @@ ExtMgrDialog::ExtMgrDialog(weld::Window *pParent, TheExtensionManager *pManager)
m_xSharedCbx->connect_toggled( LINK( this, ExtMgrDialog, HandleExtTypeCbx ) );
m_xUserCbx->connect_toggled( LINK( this, ExtMgrDialog, HandleExtTypeCbx ) );
+ m_xSearchEntry->connect_changed( LINK( this, ExtMgrDialog, HandleSearch ) );
+
m_xBundledCbx->set_active(true);
m_xSharedCbx->set_active(true);
m_xUserCbx->set_active(true);
@@ -497,6 +501,18 @@ void ExtMgrDialog::addPackageToList( const uno::Reference< deployment::XPackage
const SolarMutexGuard aGuard;
m_xUpdateBtn->set_sensitive(true);
+ bool bSearchMatch = m_xSearchEntry->get_text().isEmpty();
+ if (!m_xSearchEntry->get_text().isEmpty()
+ && xPackage->getDisplayName().toAsciiLowerCase().indexOf(
+ m_xSearchEntry->get_text().toAsciiLowerCase())
+ >= 0)
+ {
+ bSearchMatch = true;
+ }
+
+ if (!bSearchMatch)
+ return;
+
if (m_xBundledCbx->get_active() && (xPackage->getRepositoryName() == BUNDLED_PACKAGE_MANAGER) )
{
m_xExtensionBox->addEntry( xPackage, bLicenseMissing );
@@ -511,6 +527,14 @@ void ExtMgrDialog::addPackageToList( const uno::Reference< deployment::XPackage
}
}
+void ExtMgrDialog::updateList()
+{
+ // re-creates the list of packages with addEntry selecting the packages
+ prepareChecking();
+ m_pManager->createPackageList();
+ checkEntries();
+}
+
void ExtMgrDialog::prepareChecking()
{
m_xExtensionBox->prepareChecking();
@@ -753,7 +777,7 @@ IMPL_LINK_NOARG(ExtMgrDialog, HandleCloseBtn, weld::Button&, void)
IMPL_LINK( ExtMgrDialog, startProgress, void*, _bLockInterface, void )
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ std::unique_lock aGuard( m_aMutex );
bool bLockInterface = static_cast<bool>(_bLockInterface);
if ( m_bStartProgress && !m_bHasProgress )
@@ -792,7 +816,7 @@ IMPL_LINK( ExtMgrDialog, startProgress, void*, _bLockInterface, void )
void ExtMgrDialog::showProgress( bool _bStart )
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ std::unique_lock aGuard( m_aMutex );
bool bStart = _bStart;
@@ -818,7 +842,7 @@ void ExtMgrDialog::updateProgress( const tools::Long nProgress )
{
if ( m_nProgress != nProgress )
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ std::unique_lock aGuard( m_aMutex );
m_nProgress = nProgress;
m_aIdle.Start();
}
@@ -828,7 +852,7 @@ void ExtMgrDialog::updateProgress( const tools::Long nProgress )
void ExtMgrDialog::updateProgress( const OUString &rText,
const uno::Reference< task::XAbortChannel > &xAbortChannel)
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ std::unique_lock aGuard( m_aMutex );
m_xAbortChannel = xAbortChannel;
m_sProgressText = rText;
@@ -903,10 +927,12 @@ IMPL_LINK_NOARG(ExtMgrDialog, HandleEnableBtn, weld::Button&, void)
IMPL_LINK_NOARG(ExtMgrDialog, HandleExtTypeCbx, weld::Toggleable&, void)
{
- // re-creates the list of packages with addEntry selecting the packages
- prepareChecking();
- m_pManager->createPackageList();
- checkEntries();
+ updateList();
+}
+
+IMPL_LINK_NOARG(ExtMgrDialog, HandleSearch, weld::Entry&, void)
+{
+ updateList();
}
IMPL_LINK_NOARG(ExtMgrDialog, HandleUpdateBtn, weld::Button&, void)
@@ -1054,7 +1080,7 @@ IMPL_LINK_NOARG(UpdateRequiredDialog, HandleCancelBtn, weld::Button&, void)
IMPL_LINK( UpdateRequiredDialog, startProgress, void*, _bLockInterface, void )
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ std::unique_lock aGuard( m_aMutex );
bool bLockInterface = static_cast<bool>(_bLockInterface);
if ( m_bStartProgress && !m_bHasProgress )
@@ -1080,7 +1106,7 @@ IMPL_LINK( UpdateRequiredDialog, startProgress, void*, _bLockInterface, void )
void UpdateRequiredDialog::showProgress( bool _bStart )
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ std::unique_lock aGuard( m_aMutex );
bool bStart = _bStart;
@@ -1106,7 +1132,7 @@ void UpdateRequiredDialog::updateProgress( const tools::Long nProgress )
{
if ( m_nProgress != nProgress )
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ std::unique_lock aGuard( m_aMutex );
m_nProgress = nProgress;
m_aIdle.Start();
}
@@ -1116,7 +1142,7 @@ void UpdateRequiredDialog::updateProgress( const tools::Long nProgress )
void UpdateRequiredDialog::updateProgress( const OUString &rText,
const uno::Reference< task::XAbortChannel > &xAbortChannel)
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ std::unique_lock aGuard( m_aMutex );
m_xAbortChannel = xAbortChannel;
m_sProgressText = rText;
@@ -1146,7 +1172,7 @@ void UpdateRequiredDialog::updatePackageInfo( const uno::Reference< deployment::
IMPL_LINK_NOARG(UpdateRequiredDialog, HandleUpdateBtn, weld::Button&, void)
{
- ::osl::ClearableMutexGuard aGuard( m_aMutex );
+ std::unique_lock aGuard( m_aMutex );
std::vector< uno::Reference< deployment::XPackage > > vUpdateEntries;
sal_Int32 nCount = m_xExtensionBox->GetEntryCount();
@@ -1157,7 +1183,7 @@ IMPL_LINK_NOARG(UpdateRequiredDialog, HandleUpdateBtn, weld::Button&, void)
vUpdateEntries.push_back( pEntry->m_xPackage );
}
- aGuard.clear();
+ aGuard.unlock();
m_pManager->getCmdQueue()->checkForUpdates( std::move(vUpdateEntries) );
}
@@ -1165,7 +1191,7 @@ IMPL_LINK_NOARG(UpdateRequiredDialog, HandleUpdateBtn, weld::Button&, void)
IMPL_LINK_NOARG(UpdateRequiredDialog, HandleCloseBtn, weld::Button&, void)
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ std::unique_lock aGuard( m_aMutex );
if ( !isBusy() )
{
@@ -1276,7 +1302,7 @@ bool UpdateRequiredDialog::checkDependencies( const uno::Reference< deployment::
bool UpdateRequiredDialog::hasActiveEntries()
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ std::unique_lock aGuard( m_aMutex );
bool bRet = false;
tools::Long nCount = m_xExtensionBox->GetEntryCount();
@@ -1297,7 +1323,7 @@ bool UpdateRequiredDialog::hasActiveEntries()
void UpdateRequiredDialog::disableAllEntries()
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ std::unique_lock aGuard( m_aMutex );
incBusy();
@@ -1332,8 +1358,8 @@ ShowLicenseDialog::~ShowLicenseDialog()
// UpdateRequiredDialogService
UpdateRequiredDialogService::UpdateRequiredDialogService( SAL_UNUSED_PARAMETER uno::Sequence< uno::Any > const&,
- uno::Reference< uno::XComponentContext > const& xComponentContext )
- : m_xComponentContext( xComponentContext )
+ uno::Reference< uno::XComponentContext > xComponentContext )
+ : m_xComponentContext(std::move( xComponentContext ))
{
}