use insert function instead of for loop
[LibreOffice.git] / desktop / source / deployment / gui / dp_gui_dialog2.cxx
blobcf53dddff48ad1018c05f85856ef2954ccdb999c
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <config_extensions.h>
22 #include <strings.hrc>
23 #include <helpids.h>
25 #include "dp_gui.h"
26 #include "dp_gui_dialog2.hxx"
27 #include "dp_gui_extlistbox.hxx"
28 #include <dp_shared.hxx>
29 #include "dp_gui_theextmgr.hxx"
30 #include "dp_gui_extensioncmdqueue.hxx"
31 #include <dp_misc.h>
32 #include <dp_update.hxx>
33 #include <dp_identifier.hxx>
35 #include <fpicker/strings.hrc>
37 #include <utility>
38 #include <vcl/commandevent.hxx>
39 #include <vcl/svapp.hxx>
41 #include <sal/log.hxx>
42 #include <rtl/ustrbuf.hxx>
44 #include <svtools/restartdialog.hxx>
46 #include <sfx2/filedlghelper.hxx>
47 #include <sfx2/sfxdlg.hxx>
49 #include <comphelper/anytostring.hxx>
50 #include <cppuhelper/exc_hlp.hxx>
51 #include <cppuhelper/supportsservice.hxx>
53 #include <comphelper/processfactory.hxx>
54 #include <comphelper/diagnose_ex.hxx>
55 #include <unotools/configmgr.hxx>
57 #include <com/sun/star/deployment/DeploymentException.hpp>
58 #include <com/sun/star/lang/IllegalArgumentException.hpp>
59 #include <com/sun/star/system/SystemShellExecuteFlags.hpp>
60 #include <com/sun/star/system/SystemShellExecute.hpp>
62 #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
63 #include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
64 #include <com/sun/star/ui/dialogs/XFilePicker3.hpp>
66 #include <officecfg/Office/ExtensionManager.hxx>
68 #include <map>
69 #include <memory>
70 #include <vector>
72 using namespace ::com::sun::star;
73 using namespace ::com::sun::star::system;
76 namespace dp_gui {
78 constexpr OUStringLiteral USER_PACKAGE_MANAGER = u"user";
79 constexpr OUString SHARED_PACKAGE_MANAGER = u"shared"_ustr;
80 constexpr OUStringLiteral BUNDLED_PACKAGE_MANAGER = u"bundled";
82 // ExtBoxWithBtns_Impl
83 class ExtBoxWithBtns_Impl : public ExtensionBox_Impl
85 bool m_bInterfaceLocked;
87 ExtMgrDialog* m_pParent;
89 void SetButtonStatus( const TEntry_Impl& rEntry );
90 OUString ShowPopupMenu( const Point &rPos, const tools::Long nPos );
92 public:
93 explicit ExtBoxWithBtns_Impl(std::unique_ptr<weld::ScrolledWindow> xScroll);
95 void InitFromDialog(ExtMgrDialog *pParentDialog);
97 virtual bool MouseButtonDown( const MouseEvent& rMEvt ) override;
98 virtual bool Command( const CommandEvent& rCEvt ) override;
100 virtual void RecalcAll() override;
101 virtual void selectEntry( const tools::Long nPos ) override;
103 void enableButtons( bool bEnable );
106 ExtBoxWithBtns_Impl::ExtBoxWithBtns_Impl(std::unique_ptr<weld::ScrolledWindow> xScroll)
107 : ExtensionBox_Impl(std::move(xScroll))
108 , m_bInterfaceLocked(false)
109 , m_pParent(nullptr)
113 void ExtBoxWithBtns_Impl::InitFromDialog(ExtMgrDialog *pParentDialog)
115 setExtensionManager(pParentDialog->getExtensionManager());
117 m_pParent = pParentDialog;
120 void ExtBoxWithBtns_Impl::RecalcAll()
122 const sal_Int32 nActive = getSelIndex();
124 if ( nActive != ExtensionBox_Impl::ENTRY_NOTFOUND )
126 SetButtonStatus( GetEntryData( nActive) );
128 else
130 m_pParent->enableOptionsButton( false );
131 m_pParent->enableRemoveButton( false );
132 m_pParent->enableEnableButton( false );
135 ExtensionBox_Impl::RecalcAll();
139 //This function may be called with nPos < 0
140 void ExtBoxWithBtns_Impl::selectEntry( const tools::Long nPos )
142 if ( HasActive() && ( nPos == getSelIndex() ) )
143 return;
145 ExtensionBox_Impl::selectEntry( nPos );
148 void ExtBoxWithBtns_Impl::SetButtonStatus(const TEntry_Impl& rEntry)
150 bool bShowOptionBtn = true;
152 rEntry->m_bHasButtons = false;
153 if ( ( rEntry->m_eState == REGISTERED ) || ( rEntry->m_eState == NOT_AVAILABLE ) )
155 m_pParent->enableButtontoEnable( false );
157 else
159 m_pParent->enableButtontoEnable( true );
160 bShowOptionBtn = false;
163 if ( ( !rEntry->m_bUser || ( rEntry->m_eState == NOT_AVAILABLE ) || rEntry->m_bMissingDeps )
164 && !rEntry->m_bMissingLic )
166 m_pParent->enableEnableButton( false );
168 else
170 m_pParent->enableEnableButton( !rEntry->m_bLocked );
171 rEntry->m_bHasButtons = true;
174 if ( rEntry->m_bHasOptions && bShowOptionBtn )
176 m_pParent->enableOptionsButton( true );
177 rEntry->m_bHasButtons = true;
179 else
181 m_pParent->enableOptionsButton( false );
184 if ( rEntry->m_bUser || rEntry->m_bShared )
186 m_pParent->enableRemoveButton( !rEntry->m_bLocked );
187 rEntry->m_bHasButtons = true;
189 else
191 m_pParent->enableRemoveButton( false );
195 bool ExtBoxWithBtns_Impl::Command(const CommandEvent& rCEvt)
197 if (rCEvt.GetCommand() != CommandEventId::ContextMenu)
198 return ExtensionBox_Impl::Command(rCEvt);
200 const Point aMousePos(rCEvt.GetMousePosPixel());
201 const auto nPos = PointToPos(aMousePos);
202 OUString sCommand = ShowPopupMenu(aMousePos, nPos);
204 if (sCommand == "CMD_ENABLE")
205 m_pParent->enablePackage( GetEntryData( nPos )->m_xPackage, true );
206 else if (sCommand == "CMD_DISABLE")
207 m_pParent->enablePackage( GetEntryData( nPos )->m_xPackage, false );
208 else if (sCommand == "CMD_UPDATE")
209 m_pParent->updatePackage( GetEntryData( nPos )->m_xPackage );
210 else if (sCommand == "CMD_REMOVE")
211 m_pParent->removePackage( GetEntryData( nPos )->m_xPackage );
212 else if (sCommand == "CMD_SHOW_LICENSE")
214 m_pParent->incBusy();
215 ShowLicenseDialog aLicenseDlg(m_pParent->getDialog(), GetEntryData(nPos)->m_xPackage);
216 aLicenseDlg.run();
217 m_pParent->decBusy();
220 return true;
223 OUString ExtBoxWithBtns_Impl::ShowPopupMenu( const Point & rPos, const tools::Long nPos )
225 if ( nPos >= static_cast<tools::Long>(getItemCount()) )
226 return u"CMD_NONE"_ustr;
228 std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(nullptr, u"desktop/ui/extensionmenu.ui"_ustr));
229 std::unique_ptr<weld::Menu> xPopup(xBuilder->weld_menu(u"menu"_ustr));
231 #if ENABLE_EXTENSION_UPDATE
232 xPopup->append(u"CMD_UPDATE"_ustr, DpResId( RID_CTX_ITEM_CHECK_UPDATE ) );
233 #endif
235 if ( ! GetEntryData( nPos )->m_bLocked )
237 if ( GetEntryData( nPos )->m_bUser )
239 if ( GetEntryData( nPos )->m_eState == REGISTERED )
240 xPopup->append(u"CMD_DISABLE"_ustr, DpResId(RID_CTX_ITEM_DISABLE));
241 else if ( GetEntryData( nPos )->m_eState != NOT_AVAILABLE )
242 xPopup->append(u"CMD_ENABLE"_ustr, DpResId(RID_CTX_ITEM_ENABLE));
244 if (!officecfg::Office::ExtensionManager::ExtensionSecurity::DisableExtensionRemoval::get())
246 xPopup->append(u"CMD_REMOVE"_ustr, DpResId(RID_CTX_ITEM_REMOVE));
250 if ( !GetEntryData( nPos )->m_sLicenseText.isEmpty() )
251 xPopup->append(u"CMD_SHOW_LICENSE"_ustr, DpResId(RID_STR_SHOW_LICENSE_CMD));
253 return xPopup->popup_at_rect(GetDrawingArea(), tools::Rectangle(rPos, Size(1, 1)));
256 bool ExtBoxWithBtns_Impl::MouseButtonDown( const MouseEvent& rMEvt )
258 if (m_bInterfaceLocked)
259 return false;
260 return ExtensionBox_Impl::MouseButtonDown(rMEvt);
263 void ExtBoxWithBtns_Impl::enableButtons( bool bEnable )
265 m_bInterfaceLocked = ! bEnable;
267 if ( bEnable )
269 sal_Int32 nIndex = getSelIndex();
270 if ( nIndex != ExtensionBox_Impl::ENTRY_NOTFOUND )
271 SetButtonStatus( GetEntryData( nIndex ) );
273 else
275 m_pParent->enableEnableButton( false );
276 m_pParent->enableOptionsButton( false );
277 m_pParent->enableRemoveButton( false );
281 // DialogHelper
283 DialogHelper::DialogHelper(const uno::Reference< uno::XComponentContext > &xContext,
284 weld::Window* pWindow)
285 : m_pWindow(pWindow)
286 , m_nEventID(nullptr)
288 m_xContext = xContext;
291 DialogHelper::~DialogHelper()
293 if ( m_nEventID )
294 Application::RemoveUserEvent( m_nEventID );
298 bool DialogHelper::IsSharedPkgMgr( const uno::Reference< deployment::XPackage > &xPackage )
300 return xPackage->getRepositoryName() == SHARED_PACKAGE_MANAGER;
303 bool DialogHelper::continueOnSharedExtension( const uno::Reference< deployment::XPackage > &xPackage,
304 weld::Widget* pParent,
305 TranslateId pResID,
306 bool &bHadWarning )
308 if ( !bHadWarning && IsSharedPkgMgr( xPackage ) )
310 const SolarMutexGuard guard;
311 incBusy();
312 std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pParent,
313 VclMessageType::Warning, VclButtonsType::OkCancel, DpResId(pResID)));
314 bHadWarning = true;
316 bool bRet = RET_OK == xBox->run();
317 xBox.reset();
318 decBusy();
319 return bRet;
321 else
322 return true;
325 void DialogHelper::openWebBrowser(const OUString& sURL, const OUString& sTitle)
327 if ( sURL.isEmpty() ) // Nothing to do, when the URL is empty
328 return;
332 uno::Reference< XSystemShellExecute > xSystemShellExecute(
333 SystemShellExecute::create(m_xContext));
334 //throws css::lang::IllegalArgumentException, css::system::SystemShellExecuteException
335 xSystemShellExecute->execute( sURL, OUString(), SystemShellExecuteFlags::URIS_ONLY );
337 catch ( const uno::Exception& )
339 uno::Any exc( ::cppu::getCaughtException() );
340 OUString msg( ::comphelper::anyToString( exc ) );
341 const SolarMutexGuard guard;
342 incBusy();
343 std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(getFrameWeld(),
344 VclMessageType::Warning, VclButtonsType::Ok, msg));
345 xErrorBox->set_title(sTitle);
346 xErrorBox->run();
347 xErrorBox.reset();
348 decBusy();
352 bool DialogHelper::installExtensionWarn(std::u16string_view rExtensionName)
354 const SolarMutexGuard guard;
356 // Check if extension installation is disabled in the expert configurations
357 if (officecfg::Office::ExtensionManager::ExtensionSecurity::DisableExtensionInstallation::get())
359 incBusy();
360 std::unique_ptr<weld::MessageDialog> xWarnBox(Application::CreateMessageDialog(getFrameWeld(),
361 VclMessageType::Warning, VclButtonsType::Ok,
362 DpResId(RID_STR_WARNING_INSTALL_EXTENSION_DISABLED)));
363 xWarnBox->run();
364 xWarnBox.reset();
365 decBusy();
367 return false;
370 incBusy();
371 std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(getFrameWeld(),
372 VclMessageType::Warning, VclButtonsType::OkCancel,
373 DpResId(RID_STR_WARNING_INSTALL_EXTENSION)));
374 OUString sText(xInfoBox->get_primary_text());
375 sText = sText.replaceAll("%NAME", rExtensionName);
376 xInfoBox->set_primary_text(sText);
378 bool bRet = RET_OK == xInfoBox->run();
379 xInfoBox.reset();
380 decBusy();
381 return bRet;
384 bool DialogHelper::installForAllUsers(bool &bInstallForAll)
386 const SolarMutexGuard guard;
387 incBusy();
388 std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(getFrameWeld(), u"desktop/ui/installforalldialog.ui"_ustr));
389 std::unique_ptr<weld::MessageDialog> xQuery(xBuilder->weld_message_dialog(u"InstallForAllDialog"_ustr));
390 short nRet = xQuery->run();
391 xQuery.reset();
392 decBusy();
393 if (nRet == RET_CANCEL)
394 return false;
396 bInstallForAll = ( nRet == RET_NO );
397 return true;
400 void DialogHelper::PostUserEvent( const Link<void*,void>& rLink, void* pCaller )
402 if ( m_nEventID )
403 Application::RemoveUserEvent( m_nEventID );
405 m_nEventID = Application::PostUserEvent(rLink, pCaller);
408 // ExtMgrDialog
409 ExtMgrDialog::ExtMgrDialog(weld::Window *pParent, TheExtensionManager *pManager)
410 : GenericDialogController(pParent, u"desktop/ui/extensionmanager.ui"_ustr, u"ExtensionManagerDialog"_ustr)
411 , DialogHelper(pManager->getContext(), m_xDialog.get())
412 , m_sAddPackages(DpResId(RID_STR_ADD_PACKAGES))
413 , m_bHasProgress(false)
414 , m_bProgressChanged(false)
415 , m_bStartProgress(false)
416 , m_bStopProgress(false)
417 , m_bEnableWarning(false)
418 , m_bDisableWarning(false)
419 , m_bDeleteWarning(false)
420 , m_bClosed(false)
421 , m_nProgress(0)
422 , m_aIdle( "ExtMgrDialog m_aIdle TimeOutHdl" )
423 , m_pManager(pManager)
424 , m_xExtensionBox(new ExtBoxWithBtns_Impl(m_xBuilder->weld_scrolled_window(u"scroll"_ustr, true)))
425 , m_xExtensionBoxWnd(new weld::CustomWeld(*m_xBuilder, u"extensions"_ustr, *m_xExtensionBox))
426 , m_xOptionsBtn(m_xBuilder->weld_button(u"optionsbtn"_ustr))
427 , m_xAddBtn(m_xBuilder->weld_button(u"addbtn"_ustr))
428 , m_xRemoveBtn(m_xBuilder->weld_button(u"removebtn"_ustr))
429 , m_xEnableBtn(m_xBuilder->weld_button(u"enablebtn"_ustr))
430 , m_xUpdateBtn(m_xBuilder->weld_button(u"updatebtn"_ustr))
431 , m_xCloseBtn(m_xBuilder->weld_button(u"close"_ustr))
432 , m_xBundledCbx(m_xBuilder->weld_check_button(u"bundled"_ustr))
433 , m_xSharedCbx(m_xBuilder->weld_check_button(u"shared"_ustr))
434 , m_xUserCbx(m_xBuilder->weld_check_button(u"user"_ustr))
435 , m_xGetExtensions(m_xBuilder->weld_link_button(u"getextensions"_ustr))
436 , m_xProgressText(m_xBuilder->weld_label(u"progressft"_ustr))
437 , m_xProgressBar(m_xBuilder->weld_progress_bar(u"progressbar"_ustr))
438 , m_xCancelBtn(m_xBuilder->weld_button(u"cancel"_ustr))
439 , m_xSearchEntry(m_xBuilder->weld_entry(u"search"_ustr))
441 m_xExtensionBox->InitFromDialog(this);
443 m_xEnableBtn->set_help_id(HID_EXTENSION_MANAGER_LISTBOX_ENABLE);
445 m_xOptionsBtn->connect_clicked( LINK( this, ExtMgrDialog, HandleOptionsBtn ) );
446 m_xAddBtn->connect_clicked( LINK( this, ExtMgrDialog, HandleAddBtn ) );
447 m_xRemoveBtn->connect_clicked( LINK( this, ExtMgrDialog, HandleRemoveBtn ) );
448 m_xEnableBtn->connect_clicked( LINK( this, ExtMgrDialog, HandleEnableBtn ) );
449 m_xCloseBtn->connect_clicked( LINK( this, ExtMgrDialog, HandleCloseBtn ) );
451 m_xCancelBtn->connect_clicked( LINK( this, ExtMgrDialog, HandleCancelBtn ) );
453 m_xBundledCbx->connect_toggled( LINK( this, ExtMgrDialog, HandleExtTypeCbx ) );
454 m_xSharedCbx->connect_toggled( LINK( this, ExtMgrDialog, HandleExtTypeCbx ) );
455 m_xUserCbx->connect_toggled( LINK( this, ExtMgrDialog, HandleExtTypeCbx ) );
457 m_xSearchEntry->connect_changed( LINK( this, ExtMgrDialog, HandleSearch ) );
459 m_xBundledCbx->set_active(true);
460 m_xSharedCbx->set_active(true);
461 m_xUserCbx->set_active(true);
463 m_xProgressBar->hide();
465 #if ENABLE_EXTENSION_UPDATE
466 m_xUpdateBtn->connect_clicked( LINK( this, ExtMgrDialog, HandleUpdateBtn ) );
467 m_xUpdateBtn->set_sensitive(false);
468 #else
469 m_xUpdateBtn->hide();
470 #endif
472 if (officecfg::Office::ExtensionManager::ExtensionSecurity::DisableExtensionInstallation::get())
474 m_xAddBtn->set_sensitive(false);
475 m_xAddBtn->set_tooltip_text(DpResId(RID_STR_WARNING_INSTALL_EXTENSION_DISABLED));
477 if (officecfg::Office::ExtensionManager::ExtensionSecurity::DisableExtensionRemoval::get())
479 m_xRemoveBtn->set_sensitive(false);
480 m_xRemoveBtn->set_tooltip_text(DpResId(RID_STR_WARNING_REMOVE_EXTENSION_DISABLED));
483 m_aIdle.SetPriority(TaskPriority::LOWEST);
484 m_aIdle.SetInvokeHandler( LINK( this, ExtMgrDialog, TimeOutHdl ) );
487 ExtMgrDialog::~ExtMgrDialog()
489 m_aIdle.Stop();
492 void ExtMgrDialog::setGetExtensionsURL( const OUString &rURL )
494 m_xGetExtensions->set_uri( rURL );
497 void ExtMgrDialog::addPackageToList( const uno::Reference< deployment::XPackage > &xPackage,
498 bool bLicenseMissing )
500 const SolarMutexGuard aGuard;
501 m_xUpdateBtn->set_sensitive(true);
503 bool bSearchMatch = m_xSearchEntry->get_text().isEmpty();
504 if (!m_xSearchEntry->get_text().isEmpty()
505 && xPackage->getDisplayName().toAsciiLowerCase().indexOf(
506 m_xSearchEntry->get_text().toAsciiLowerCase())
507 >= 0)
509 bSearchMatch = true;
512 if (!bSearchMatch)
513 return;
515 if (m_xBundledCbx->get_active() && (xPackage->getRepositoryName() == BUNDLED_PACKAGE_MANAGER) )
517 m_xExtensionBox->addEntry( xPackage, bLicenseMissing );
519 else if (m_xSharedCbx->get_active() && (xPackage->getRepositoryName() == SHARED_PACKAGE_MANAGER) )
521 m_xExtensionBox->addEntry( xPackage, bLicenseMissing );
523 else if (m_xUserCbx->get_active() && (xPackage->getRepositoryName() == USER_PACKAGE_MANAGER ))
525 m_xExtensionBox->addEntry( xPackage, bLicenseMissing );
529 void ExtMgrDialog::updateList()
531 // re-creates the list of packages with addEntry selecting the packages
532 prepareChecking();
533 m_pManager->createPackageList();
534 checkEntries();
537 void ExtMgrDialog::prepareChecking()
539 m_xExtensionBox->prepareChecking();
542 void ExtMgrDialog::checkEntries()
544 const SolarMutexGuard guard;
545 m_xExtensionBox->checkEntries();
548 bool ExtMgrDialog::removeExtensionWarn(std::u16string_view rExtensionName)
550 const SolarMutexGuard guard;
551 incBusy();
552 std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(m_xDialog.get(),
553 VclMessageType::Warning, VclButtonsType::OkCancel,
554 DpResId(RID_STR_WARNING_REMOVE_EXTENSION)));
556 OUString sText(xInfoBox->get_primary_text());
557 sText = sText.replaceAll("%NAME", rExtensionName);
558 xInfoBox->set_primary_text(sText);
560 bool bRet = RET_OK == xInfoBox->run();
561 xInfoBox.reset();
562 decBusy();
564 return bRet;
567 void ExtMgrDialog::enablePackage( const uno::Reference< deployment::XPackage > &xPackage,
568 bool bEnable )
570 if ( !xPackage.is() )
571 return;
573 if ( bEnable )
575 if (!continueOnSharedExtension(xPackage, m_xDialog.get(), RID_STR_WARNING_ENABLE_SHARED_EXTENSION, m_bEnableWarning))
576 return;
578 else
580 if (!continueOnSharedExtension(xPackage, m_xDialog.get(), RID_STR_WARNING_DISABLE_SHARED_EXTENSION, m_bDisableWarning))
581 return;
584 m_pManager->getCmdQueue()->enableExtension( xPackage, bEnable );
588 void ExtMgrDialog::removePackage( const uno::Reference< deployment::XPackage > &xPackage )
590 if ( !xPackage.is() )
591 return;
593 if ( !IsSharedPkgMgr( xPackage ) || m_bDeleteWarning )
595 if ( ! removeExtensionWarn( xPackage->getDisplayName() ) )
596 return;
599 if (!continueOnSharedExtension(xPackage, m_xDialog.get(), RID_STR_WARNING_REMOVE_SHARED_EXTENSION, m_bDeleteWarning))
600 return;
602 m_pManager->getCmdQueue()->removeExtension( xPackage );
606 void ExtMgrDialog::updatePackage( const uno::Reference< deployment::XPackage > &xPackage )
608 if ( !xPackage.is() )
609 return;
611 // get the extension with highest version
612 uno::Sequence<uno::Reference<deployment::XPackage> > seqExtensions =
613 m_pManager->getExtensionManager()->getExtensionsWithSameIdentifier(
614 dp_misc::getIdentifier(xPackage), xPackage->getName(), uno::Reference<ucb::XCommandEnvironment>());
615 uno::Reference<deployment::XPackage> extension =
616 dp_misc::getExtensionWithHighestVersion(seqExtensions);
617 OSL_ASSERT(extension.is());
618 std::vector< css::uno::Reference< css::deployment::XPackage > > vEntries { extension };
620 m_pManager->getCmdQueue()->checkForUpdates( std::move(vEntries) );
624 bool ExtMgrDialog::acceptLicense( const uno::Reference< deployment::XPackage > &xPackage )
626 if ( !xPackage.is() )
627 return false;
629 m_pManager->getCmdQueue()->acceptLicense( xPackage );
631 return true;
635 uno::Sequence< OUString > ExtMgrDialog::raiseAddPicker()
637 sfx2::FileDialogHelper aDlgHelper(ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, FileDialogFlags::NONE, m_xDialog.get());
638 aDlgHelper.SetContext(sfx2::FileDialogHelper::ExtensionManager);
639 const uno::Reference<ui::dialogs::XFilePicker3>& xFilePicker = aDlgHelper.GetFilePicker();
640 xFilePicker->setTitle( m_sAddPackages );
642 // collect and set filter list:
643 typedef std::map< OUString, OUString > t_string2string;
644 t_string2string title2filter;
645 OUStringBuffer supportedFilters;
647 const uno::Sequence< uno::Reference< deployment::XPackageTypeInfo > > packageTypes(
648 m_pManager->getExtensionManager()->getSupportedPackageTypes() );
650 for ( uno::Reference< deployment::XPackageTypeInfo > const & xPackageType : packageTypes )
652 const OUString filter( xPackageType->getFileFilter() );
653 if (!filter.isEmpty())
655 const OUString title( xPackageType->getShortDescription() );
656 const std::pair< t_string2string::iterator, bool > insertion(
657 title2filter.emplace( title, filter ) );
658 if (!supportedFilters.isEmpty())
659 supportedFilters.append(';');
660 supportedFilters.append(filter);
661 if ( ! insertion.second )
662 { // already existing, append extensions:
663 insertion.first->second = insertion.first->second +
664 ";" + filter;
669 static const OUString StrAllFiles = []()
671 const SolarMutexGuard guard;
672 std::locale loc = Translate::Create("fps");
673 return Translate::get(STR_FILTERNAME_ALL, loc);
674 }();
676 // All files at top:
677 xFilePicker->appendFilter( StrAllFiles, u"*.*"_ustr );
678 xFilePicker->appendFilter( DpResId(RID_STR_ALL_SUPPORTED), supportedFilters.makeStringAndClear() );
679 // then supported ones:
680 for (auto const& elem : title2filter)
684 xFilePicker->appendFilter( elem.first, elem.second );
686 catch (const lang::IllegalArgumentException &)
688 TOOLS_WARN_EXCEPTION( "desktop", "" );
691 xFilePicker->setCurrentFilter( DpResId(RID_STR_ALL_SUPPORTED) );
693 if ( xFilePicker->execute() != ui::dialogs::ExecutableDialogResults::OK )
694 return uno::Sequence<OUString>(); // cancelled
696 uno::Sequence< OUString > files( xFilePicker->getSelectedFiles() );
697 OSL_ASSERT( files.hasElements() );
698 return files;
701 void ExtMgrDialog::enableOptionsButton( bool bEnable )
703 m_xOptionsBtn->set_sensitive( bEnable );
706 void ExtMgrDialog::enableRemoveButton( bool bEnable )
708 m_xRemoveBtn->set_sensitive( bEnable && !officecfg::Office::ExtensionManager::ExtensionSecurity::DisableExtensionRemoval::get());
710 if (officecfg::Office::ExtensionManager::ExtensionSecurity::DisableExtensionRemoval::get())
712 m_xRemoveBtn->set_tooltip_text(DpResId(RID_STR_WARNING_REMOVE_EXTENSION_DISABLED));
714 else
716 m_xRemoveBtn->set_tooltip_text(u""_ustr);
720 void ExtMgrDialog::enableEnableButton( bool bEnable )
722 m_xEnableBtn->set_sensitive( bEnable );
725 void ExtMgrDialog::enableButtontoEnable( bool bEnable )
727 if (bEnable)
729 m_xEnableBtn->set_label( DpResId( RID_CTX_ITEM_ENABLE ) );
730 m_xEnableBtn->set_help_id( HID_EXTENSION_MANAGER_LISTBOX_ENABLE );
732 else
734 m_xEnableBtn->set_label( DpResId( RID_CTX_ITEM_DISABLE ) );
735 m_xEnableBtn->set_help_id( HID_EXTENSION_MANAGER_LISTBOX_DISABLE );
739 IMPL_LINK_NOARG(ExtMgrDialog, HandleCancelBtn, weld::Button&, void)
741 if ( m_xAbortChannel.is() )
745 m_xAbortChannel->sendAbort();
747 catch ( const uno::RuntimeException & )
749 TOOLS_WARN_EXCEPTION( "dbaccess", "" );
754 IMPL_LINK_NOARG(ExtMgrDialog, HandleCloseBtn, weld::Button&, void)
756 bool bCallClose = true;
758 //only suggest restart if modified and this is the first close attempt
759 if (!m_bClosed && m_pManager->isModified())
761 m_pManager->clearModified();
763 //only suggest restart if we're actually running, e.g. not from standalone unopkg gui
764 if (dp_misc::office_is_running())
766 SolarMutexGuard aGuard;
767 bCallClose = !::svtools::executeRestartDialog(comphelper::getProcessComponentContext(),
768 m_xDialog.get(),
769 svtools::RESTART_REASON_EXTENSION_INSTALL);
773 if (bCallClose)
774 m_xDialog->response(RET_CANCEL);
777 IMPL_LINK( ExtMgrDialog, startProgress, void*, _bLockInterface, void )
779 SolarMutexGuard aGuard;
780 bool bLockInterface = static_cast<bool>(_bLockInterface);
782 if ( m_bStartProgress && !m_bHasProgress )
783 m_aIdle.Start();
785 if ( m_bStopProgress )
787 if ( m_xProgressBar->get_visible() )
788 m_xProgressBar->set_percentage( 100 );
789 m_xAbortChannel.clear();
791 SAL_INFO( "desktop.deployment", " startProgress handler: stop" );
793 else
795 SAL_INFO( "desktop.deployment", " startProgress handler: start" );
798 m_xCancelBtn->set_sensitive( bLockInterface );
799 m_xAddBtn->set_sensitive( !bLockInterface && !officecfg::Office::ExtensionManager::ExtensionSecurity::DisableExtensionInstallation::get());
800 if (officecfg::Office::ExtensionManager::ExtensionSecurity::DisableExtensionInstallation::get())
802 m_xAddBtn->set_tooltip_text(DpResId(RID_STR_WARNING_INSTALL_EXTENSION_DISABLED));
804 else
806 m_xAddBtn->set_tooltip_text(u""_ustr);
809 m_xUpdateBtn->set_sensitive( !bLockInterface && m_xExtensionBox->getItemCount() );
810 m_xExtensionBox->enableButtons( !bLockInterface );
812 clearEventID();
816 void ExtMgrDialog::showProgress( bool _bStart )
818 SolarMutexGuard aGuard;
820 bool bStart = _bStart;
822 if ( bStart )
824 m_nProgress = 0;
825 m_bStartProgress = true;
826 SAL_INFO( "desktop.deployment", "showProgress start" );
828 else
830 m_nProgress = 100;
831 m_bStopProgress = true;
832 SAL_INFO( "desktop.deployment", "showProgress stop!" );
835 DialogHelper::PostUserEvent( LINK( this, ExtMgrDialog, startProgress ), reinterpret_cast<void*>(bStart) );
836 m_aIdle.Start();
840 void ExtMgrDialog::updateProgress( const tools::Long nProgress )
842 SolarMutexGuard aGuard;
843 if ( m_nProgress != nProgress )
845 m_nProgress = nProgress;
846 m_aIdle.Start();
851 void ExtMgrDialog::updateProgress( const OUString &rText,
852 const uno::Reference< task::XAbortChannel > &xAbortChannel)
854 SolarMutexGuard aGuard;
856 m_xAbortChannel = xAbortChannel;
857 m_sProgressText = rText;
858 m_bProgressChanged = true;
859 m_aIdle.Start();
863 void ExtMgrDialog::updatePackageInfo( const uno::Reference< deployment::XPackage > &xPackage )
865 const SolarMutexGuard aGuard;
866 m_xExtensionBox->updateEntry( xPackage );
869 IMPL_LINK_NOARG(ExtMgrDialog, HandleOptionsBtn, weld::Button&, void)
871 const sal_Int32 nActive = m_xExtensionBox->getSelIndex();
873 if ( nActive != ExtensionBox_Impl::ENTRY_NOTFOUND )
875 SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
877 OUString sExtensionId = m_xExtensionBox->GetEntryData( nActive )->m_xPackage->getIdentifier().Value;
878 ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateOptionsDialog(m_xDialog.get(), sExtensionId));
880 pDlg->Execute();
884 IMPL_LINK_NOARG(ExtMgrDialog, HandleAddBtn, weld::Button&, void)
886 incBusy();
888 uno::Sequence< OUString > aFileList = raiseAddPicker();
890 if ( aFileList.hasElements() )
892 m_pManager->installPackage( aFileList[0] );
895 decBusy();
898 IMPL_LINK_NOARG(ExtMgrDialog, HandleRemoveBtn, weld::Button&, void)
900 const sal_Int32 nActive = m_xExtensionBox->getSelIndex();
902 if ( nActive != ExtensionBox_Impl::ENTRY_NOTFOUND )
904 TEntry_Impl pEntry = m_xExtensionBox->GetEntryData( nActive );
905 removePackage( pEntry->m_xPackage );
909 IMPL_LINK_NOARG(ExtMgrDialog, HandleEnableBtn, weld::Button&, void)
911 const sal_Int32 nActive = m_xExtensionBox->getSelIndex();
913 if ( nActive != ExtensionBox_Impl::ENTRY_NOTFOUND )
915 TEntry_Impl pEntry = m_xExtensionBox->GetEntryData( nActive );
917 if ( pEntry->m_bMissingLic )
918 acceptLicense( pEntry->m_xPackage );
919 else
921 const bool bEnable( pEntry->m_eState != REGISTERED );
922 enablePackage( pEntry->m_xPackage, bEnable );
927 IMPL_LINK_NOARG(ExtMgrDialog, HandleExtTypeCbx, weld::Toggleable&, void)
929 updateList();
932 IMPL_LINK_NOARG(ExtMgrDialog, HandleSearch, weld::Entry&, void)
934 updateList();
937 IMPL_LINK_NOARG(ExtMgrDialog, HandleUpdateBtn, weld::Button&, void)
939 #if ENABLE_EXTENSION_UPDATE
940 m_pManager->checkUpdates();
941 #else
942 (void) this;
943 #endif
946 IMPL_LINK_NOARG(ExtMgrDialog, TimeOutHdl, Timer *, void)
948 SolarMutexGuard aGuard;
949 if ( m_bStopProgress )
951 m_bHasProgress = false;
952 m_bStopProgress = false;
953 m_xProgressText->hide();
954 m_xProgressBar->hide();
955 m_xCancelBtn->hide();
957 else
959 if ( m_bProgressChanged )
961 m_bProgressChanged = false;
962 m_xProgressText->set_label(m_sProgressText);
965 if ( m_bStartProgress )
967 m_bStartProgress = false;
968 m_bHasProgress = true;
969 m_xProgressBar->show();
970 m_xProgressText->show();
971 m_xCancelBtn->set_sensitive(true);
972 m_xCancelBtn->show();
975 if ( m_xProgressBar->get_visible() )
976 m_xProgressBar->set_percentage( static_cast<sal_uInt16>(m_nProgress) );
980 void ExtMgrDialog::Close()
982 m_pManager->terminateDialog();
983 m_bClosed = true;
986 //UpdateRequiredDialog
987 UpdateRequiredDialog::UpdateRequiredDialog(weld::Window *pParent, TheExtensionManager *pManager)
988 : GenericDialogController(pParent, u"desktop/ui/updaterequireddialog.ui"_ustr, u"UpdateRequiredDialog"_ustr)
989 , DialogHelper(pManager->getContext(), m_xDialog.get())
990 , m_sCloseText(DpResId(RID_STR_CLOSE_BTN))
991 , m_bHasProgress(false)
992 , m_bProgressChanged(false)
993 , m_bStartProgress(false)
994 , m_bStopProgress(false)
995 , m_bHasLockedEntries(false)
996 , m_nProgress(0)
997 , m_aIdle( "UpdateRequiredDialog m_aIdle TimeOutHdl" )
998 , m_pManager(pManager)
999 , m_xExtensionBox(new ExtensionBox_Impl(m_xBuilder->weld_scrolled_window(u"scroll"_ustr, true)))
1000 , m_xExtensionBoxWnd(new weld::CustomWeld(*m_xBuilder, u"extensions"_ustr, *m_xExtensionBox))
1001 , m_xUpdateNeeded(m_xBuilder->weld_label(u"updatelabel"_ustr))
1002 , m_xUpdateBtn(m_xBuilder->weld_button(u"ok"_ustr))
1003 , m_xCloseBtn(m_xBuilder->weld_button(u"disable"_ustr))
1004 , m_xCancelBtn(m_xBuilder->weld_button(u"cancel"_ustr))
1005 , m_xProgressText(m_xBuilder->weld_label(u"progresslabel"_ustr))
1006 , m_xProgressBar(m_xBuilder->weld_progress_bar(u"progress"_ustr))
1008 m_xExtensionBox->setExtensionManager(pManager);
1010 m_xUpdateBtn->connect_clicked( LINK( this, UpdateRequiredDialog, HandleUpdateBtn ) );
1011 m_xCloseBtn->connect_clicked( LINK( this, UpdateRequiredDialog, HandleCloseBtn ) );
1012 m_xCancelBtn->connect_clicked( LINK( this, UpdateRequiredDialog, HandleCancelBtn ) );
1014 OUString aText = m_xUpdateNeeded->get_label();
1015 aText = aText.replaceAll(
1016 "%PRODUCTNAME", utl::ConfigManager::getProductName());
1017 m_xUpdateNeeded->set_label(aText);
1019 m_xProgressBar->hide();
1020 m_xUpdateBtn->set_sensitive( false );
1021 m_xCloseBtn->grab_focus();
1023 m_aIdle.SetPriority( TaskPriority::LOWEST );
1024 m_aIdle.SetInvokeHandler( LINK( this, UpdateRequiredDialog, TimeOutHdl ) );
1027 UpdateRequiredDialog::~UpdateRequiredDialog()
1029 m_aIdle.Stop();
1032 void UpdateRequiredDialog::addPackageToList( const uno::Reference< deployment::XPackage > &xPackage,
1033 bool bLicenseMissing )
1035 // We will only add entries to the list with unsatisfied dependencies
1036 if ( !bLicenseMissing && !checkDependencies( xPackage ) )
1038 m_bHasLockedEntries |= m_pManager->isReadOnly( xPackage );
1039 const SolarMutexGuard aGuard;
1040 m_xUpdateBtn->set_sensitive(true);
1041 m_xExtensionBox->addEntry( xPackage );
1046 void UpdateRequiredDialog::prepareChecking()
1048 m_xExtensionBox->prepareChecking();
1052 void UpdateRequiredDialog::checkEntries()
1054 const SolarMutexGuard guard;
1055 m_xExtensionBox->checkEntries();
1057 if ( ! hasActiveEntries() )
1059 m_xCloseBtn->set_label( m_sCloseText );
1060 m_xCloseBtn->grab_focus();
1065 IMPL_LINK_NOARG(UpdateRequiredDialog, HandleCancelBtn, weld::Button&, void)
1067 if ( m_xAbortChannel.is() )
1071 m_xAbortChannel->sendAbort();
1073 catch ( const uno::RuntimeException & )
1075 TOOLS_WARN_EXCEPTION( "desktop", "" );
1081 IMPL_LINK( UpdateRequiredDialog, startProgress, void*, _bLockInterface, void )
1083 SolarMutexGuard aGuard;
1084 bool bLockInterface = static_cast<bool>(_bLockInterface);
1086 if ( m_bStartProgress && !m_bHasProgress )
1087 m_aIdle.Start();
1089 if ( m_bStopProgress )
1091 if ( m_xProgressBar->get_visible() )
1092 m_xProgressBar->set_percentage( 100 );
1093 m_xAbortChannel.clear();
1094 SAL_INFO( "desktop.deployment", " startProgress handler: stop" );
1096 else
1098 SAL_INFO( "desktop.deployment", " startProgress handler: start" );
1101 m_xCancelBtn->set_sensitive( bLockInterface );
1102 m_xUpdateBtn->set_sensitive( false );
1103 clearEventID();
1107 void UpdateRequiredDialog::showProgress( bool _bStart )
1109 SolarMutexGuard aGuard;
1111 bool bStart = _bStart;
1113 if ( bStart )
1115 m_nProgress = 0;
1116 m_bStartProgress = true;
1117 SAL_INFO( "desktop.deployment", "showProgress start" );
1119 else
1121 m_nProgress = 100;
1122 m_bStopProgress = true;
1123 SAL_INFO( "desktop.deployment", "showProgress stop!" );
1126 DialogHelper::PostUserEvent( LINK( this, UpdateRequiredDialog, startProgress ), reinterpret_cast<void*>(bStart) );
1127 m_aIdle.Start();
1131 void UpdateRequiredDialog::updateProgress( const tools::Long nProgress )
1133 SolarMutexGuard aGuard;
1134 if ( m_nProgress != nProgress )
1136 m_nProgress = nProgress;
1137 m_aIdle.Start();
1142 void UpdateRequiredDialog::updateProgress( const OUString &rText,
1143 const uno::Reference< task::XAbortChannel > &xAbortChannel)
1145 SolarMutexGuard aGuard;
1147 m_xAbortChannel = xAbortChannel;
1148 m_sProgressText = rText;
1149 m_bProgressChanged = true;
1150 m_aIdle.Start();
1154 void UpdateRequiredDialog::updatePackageInfo( const uno::Reference< deployment::XPackage > &xPackage )
1156 // We will remove all updated packages with satisfied dependencies, but
1157 // we will show all disabled entries so the user sees the result
1158 // of the 'disable all' button
1159 const SolarMutexGuard aGuard;
1160 if ( isEnabled( xPackage ) && checkDependencies( xPackage ) )
1161 m_xExtensionBox->removeEntry( xPackage );
1162 else
1163 m_xExtensionBox->updateEntry( xPackage );
1165 if ( ! hasActiveEntries() )
1167 m_xCloseBtn->set_label( m_sCloseText );
1168 m_xCloseBtn->grab_focus();
1173 IMPL_LINK_NOARG(UpdateRequiredDialog, HandleUpdateBtn, weld::Button&, void)
1175 std::vector< uno::Reference< deployment::XPackage > > vUpdateEntries;
1177 SolarMutexGuard aGuard;
1179 sal_Int32 nCount = m_xExtensionBox->GetEntryCount();
1181 for ( sal_Int32 i = 0; i < nCount; ++i )
1183 TEntry_Impl pEntry = m_xExtensionBox->GetEntryData( i );
1184 vUpdateEntries.push_back( pEntry->m_xPackage );
1188 m_pManager->getCmdQueue()->checkForUpdates( std::move(vUpdateEntries) );
1192 IMPL_LINK_NOARG(UpdateRequiredDialog, HandleCloseBtn, weld::Button&, void)
1194 SolarMutexGuard aGuard;
1196 if ( !isBusy() )
1198 if ( m_bHasLockedEntries )
1199 m_xDialog->response(-1);
1200 else if ( hasActiveEntries() )
1201 disableAllEntries();
1202 else
1203 m_xDialog->response(RET_CANCEL);
1208 IMPL_LINK_NOARG(UpdateRequiredDialog, TimeOutHdl, Timer *, void)
1210 if ( m_bStopProgress )
1212 m_bHasProgress = false;
1213 m_bStopProgress = false;
1214 m_xProgressText->hide();
1215 m_xProgressBar->hide();
1216 m_xCancelBtn->hide();
1218 else
1220 if ( m_bProgressChanged )
1222 m_bProgressChanged = false;
1223 m_xProgressText->set_label( m_sProgressText );
1226 if ( m_bStartProgress )
1228 m_bStartProgress = false;
1229 m_bHasProgress = true;
1230 m_xProgressBar->show();
1231 m_xProgressText->show();
1232 m_xCancelBtn->set_sensitive(true);
1233 m_xCancelBtn->show();
1236 if (m_xProgressBar->get_visible())
1237 m_xProgressBar->set_percentage(m_nProgress);
1241 // VCL::Dialog
1242 short UpdateRequiredDialog::run()
1244 //ToDo
1245 //I believe m_bHasLockedEntries was used to prevent showing extensions which cannot
1246 //be disabled because they are in a read only repository. However, disabling extensions
1247 //is now always possible because the registration data of all repositories
1248 //are in the user installation.
1249 //Therefore all extensions could be displayed and all the handling around m_bHasLockedEntries
1250 //could be removed.
1251 if ( m_bHasLockedEntries )
1253 // Set other text, disable update btn, remove not shared entries from list;
1254 m_xUpdateNeeded->set_label( DpResId( RID_STR_NO_ADMIN_PRIVILEGE ) );
1255 m_xCloseBtn->set_label( DpResId( RID_STR_EXIT_BTN ) );
1256 m_xUpdateBtn->set_sensitive( false );
1257 m_xExtensionBox->RemoveUnlocked();
1260 return GenericDialogController::run();
1263 // Check dependencies of all packages
1265 bool UpdateRequiredDialog::isEnabled( const uno::Reference< deployment::XPackage > &xPackage )
1267 bool bRegistered = false;
1268 try {
1269 beans::Optional< beans::Ambiguous< sal_Bool > > option( xPackage->isRegistered( uno::Reference< task::XAbortChannel >(),
1270 uno::Reference< ucb::XCommandEnvironment >() ) );
1271 if ( option.IsPresent )
1273 ::beans::Ambiguous< sal_Bool > const & reg = option.Value;
1274 if ( reg.IsAmbiguous )
1275 bRegistered = false;
1276 else
1277 bRegistered = reg.Value;
1279 else
1280 bRegistered = false;
1282 catch ( const uno::RuntimeException & ) { throw; }
1283 catch (const uno::Exception & ) {
1284 TOOLS_WARN_EXCEPTION( "desktop", "" );
1285 bRegistered = false;
1288 return bRegistered;
1291 // Checks the dependencies no matter if the extension is enabled or disabled!
1292 bool UpdateRequiredDialog::checkDependencies( const uno::Reference< deployment::XPackage > &xPackage )
1294 bool bDependenciesValid = false;
1295 try {
1296 bDependenciesValid = xPackage->checkDependencies( uno::Reference< ucb::XCommandEnvironment >() );
1298 catch ( const deployment::DeploymentException & ) {}
1299 return bDependenciesValid;
1303 bool UpdateRequiredDialog::hasActiveEntries()
1305 bool bRet = false;
1306 tools::Long nCount = m_xExtensionBox->GetEntryCount();
1307 for ( tools::Long nIndex = 0; nIndex < nCount; nIndex++ )
1309 TEntry_Impl pEntry = m_xExtensionBox->GetEntryData( nIndex );
1311 if ( isEnabled(pEntry->m_xPackage) && !checkDependencies( pEntry->m_xPackage ) )
1313 bRet = true;
1314 break;
1318 return bRet;
1322 void UpdateRequiredDialog::disableAllEntries()
1324 SolarMutexGuard aGuard;
1326 incBusy();
1328 tools::Long nCount = m_xExtensionBox->GetEntryCount();
1329 for ( tools::Long nIndex = 0; nIndex < nCount; nIndex++ )
1331 TEntry_Impl pEntry = m_xExtensionBox->GetEntryData( nIndex );
1332 m_pManager->getCmdQueue()->enableExtension( pEntry->m_xPackage, false );
1335 decBusy();
1337 if ( ! hasActiveEntries() )
1338 m_xCloseBtn->set_label( m_sCloseText );
1341 // ShowLicenseDialog
1342 ShowLicenseDialog::ShowLicenseDialog(weld::Window* pParent,
1343 const uno::Reference< deployment::XPackage> &xPackage)
1344 : GenericDialogController(pParent, u"desktop/ui/showlicensedialog.ui"_ustr, u"ShowLicenseDialog"_ustr)
1345 , m_xLicenseText(m_xBuilder->weld_text_view(u"textview"_ustr))
1347 m_xLicenseText->set_size_request(m_xLicenseText->get_approximate_digit_width() * 72,
1348 m_xLicenseText->get_height_rows(21));
1349 m_xLicenseText->set_text(xPackage->getLicenseText());
1352 ShowLicenseDialog::~ShowLicenseDialog()
1356 // UpdateRequiredDialogService
1358 UpdateRequiredDialogService::UpdateRequiredDialogService( SAL_UNUSED_PARAMETER uno::Sequence< uno::Any > const&,
1359 uno::Reference< uno::XComponentContext > xComponentContext )
1360 : m_xComponentContext(std::move( xComponentContext ))
1364 // XServiceInfo
1365 OUString UpdateRequiredDialogService::getImplementationName()
1367 return u"com.sun.star.comp.deployment.ui.UpdateRequiredDialog"_ustr;
1370 sal_Bool UpdateRequiredDialogService::supportsService( const OUString& ServiceName )
1372 return cppu::supportsService(this, ServiceName);
1375 css::uno::Sequence< OUString > UpdateRequiredDialogService::getSupportedServiceNames()
1377 return { u"com.sun.star.deployment.ui.UpdateRequiredDialog"_ustr };
1381 // XExecutableDialog
1383 void UpdateRequiredDialogService::setTitle( OUString const & )
1388 sal_Int16 UpdateRequiredDialogService::execute()
1390 ::rtl::Reference< ::dp_gui::TheExtensionManager > xManager( TheExtensionManager::get(
1391 m_xComponentContext) );
1392 xManager->createDialog( true );
1393 sal_Int16 nRet = xManager->execute();
1395 return nRet;
1399 } //namespace dp_gui
1401 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */