LibreOffice Module desktop (master) 1
dp_gui_dialog2.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#include <config_extensions.h>
21
22#include <strings.hrc>
23#include <helpids.h>
24
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"
31#include <dp_misc.h>
32#include <dp_update.hxx>
33#include <dp_identifier.hxx>
34
35#include <fpicker/strings.hrc>
36
37#include <utility>
38#include <vcl/commandevent.hxx>
39#include <vcl/svapp.hxx>
40
41#include <osl/mutex.hxx>
42#include <sal/log.hxx>
43#include <rtl/ustrbuf.hxx>
44
46
48#include <sfx2/sfxdlg.hxx>
49
53
57
58#include <com/sun/star/deployment/DeploymentException.hpp>
59#include <com/sun/star/lang/IllegalArgumentException.hpp>
60#include <com/sun/star/system/SystemShellExecuteFlags.hpp>
61#include <com/sun/star/system/SystemShellExecute.hpp>
62
63#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
64#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
65#include <com/sun/star/ui/dialogs/XFilePicker3.hpp>
66
67#include <officecfg/Office/ExtensionManager.hxx>
68
69#include <map>
70#include <memory>
71#include <vector>
72
73using namespace ::com::sun::star;
74using namespace ::com::sun::star::system;
75
76
77namespace dp_gui {
78
79constexpr OUStringLiteral USER_PACKAGE_MANAGER = u"user";
80constexpr OUStringLiteral SHARED_PACKAGE_MANAGER = u"shared";
81constexpr OUStringLiteral BUNDLED_PACKAGE_MANAGER = u"bundled";
82
83// ExtBoxWithBtns_Impl
85{
87
89
90 void SetButtonStatus( const TEntry_Impl& rEntry );
91 OUString ShowPopupMenu( const Point &rPos, const tools::Long nPos );
92
93public:
94 explicit ExtBoxWithBtns_Impl(std::unique_ptr<weld::ScrolledWindow> xScroll);
95
96 void InitFromDialog(ExtMgrDialog *pParentDialog);
97
98 virtual bool MouseButtonDown( const MouseEvent& rMEvt ) override;
99 virtual bool Command( const CommandEvent& rCEvt ) override;
100
101 virtual void RecalcAll() override;
102 virtual void selectEntry( const tools::Long nPos ) override;
103
104 void enableButtons( bool bEnable );
105};
106
107ExtBoxWithBtns_Impl::ExtBoxWithBtns_Impl(std::unique_ptr<weld::ScrolledWindow> xScroll)
108 : ExtensionBox_Impl(std::move(xScroll))
109 , m_bInterfaceLocked(false)
110 , m_pParent(nullptr)
111{
112}
113
115{
117
118 m_pParent = pParentDialog;
119}
120
122{
123 const sal_Int32 nActive = getSelIndex();
124
125 if ( nActive != ExtensionBox_Impl::ENTRY_NOTFOUND )
126 {
127 SetButtonStatus( GetEntryData( nActive) );
128 }
129 else
130 {
134 }
135
137}
138
139
140//This function may be called with nPos < 0
142{
143 if ( HasActive() && ( nPos == getSelIndex() ) )
144 return;
145
147}
148
150{
151 bool bShowOptionBtn = true;
152
153 rEntry->m_bHasButtons = false;
154 if ( ( rEntry->m_eState == REGISTERED ) || ( rEntry->m_eState == NOT_AVAILABLE ) )
155 {
157 }
158 else
159 {
161 bShowOptionBtn = false;
162 }
163
164 if ( ( !rEntry->m_bUser || ( rEntry->m_eState == NOT_AVAILABLE ) || rEntry->m_bMissingDeps )
165 && !rEntry->m_bMissingLic )
166 {
168 }
169 else
170 {
171 m_pParent->enableEnableButton( !rEntry->m_bLocked );
172 rEntry->m_bHasButtons = true;
173 }
174
175 if ( rEntry->m_bHasOptions && bShowOptionBtn )
176 {
178 rEntry->m_bHasButtons = true;
179 }
180 else
181 {
183 }
184
185 if ( rEntry->m_bUser || rEntry->m_bShared )
186 {
187 m_pParent->enableRemoveButton( !rEntry->m_bLocked );
188 rEntry->m_bHasButtons = true;
189 }
190 else
191 {
193 }
194}
195
197{
198 if (rCEvt.GetCommand() != CommandEventId::ContextMenu)
199 return ExtensionBox_Impl::Command(rCEvt);
200
201 const Point aMousePos(rCEvt.GetMousePosPixel());
202 const auto nPos = PointToPos(aMousePos);
203 OUString sCommand = ShowPopupMenu(aMousePos, nPos);
204
205 if (sCommand == "CMD_ENABLE")
207 else if (sCommand == "CMD_DISABLE")
209 else if (sCommand == "CMD_UPDATE")
211 else if (sCommand == "CMD_REMOVE")
213 else if (sCommand == "CMD_SHOW_LICENSE")
214 {
217 aLicenseDlg.run();
219 }
220
221 return true;
222}
223
224OUString ExtBoxWithBtns_Impl::ShowPopupMenu( const Point & rPos, const tools::Long nPos )
225{
226 if ( nPos >= static_cast<tools::Long>(getItemCount()) )
227 return "CMD_NONE";
228
229 std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(nullptr, "desktop/ui/extensionmenu.ui"));
230 std::unique_ptr<weld::Menu> xPopup(xBuilder->weld_menu("menu"));
231
232#if ENABLE_EXTENSION_UPDATE
233 xPopup->append("CMD_UPDATE", DpResId( RID_CTX_ITEM_CHECK_UPDATE ) );
234#endif
235
236 if ( ! GetEntryData( nPos )->m_bLocked )
237 {
238 if ( GetEntryData( nPos )->m_bUser )
239 {
240 if ( GetEntryData( nPos )->m_eState == REGISTERED )
241 xPopup->append("CMD_DISABLE", DpResId(RID_CTX_ITEM_DISABLE));
242 else if ( GetEntryData( nPos )->m_eState != NOT_AVAILABLE )
243 xPopup->append("CMD_ENABLE", DpResId(RID_CTX_ITEM_ENABLE));
244 }
245 if (!officecfg::Office::ExtensionManager::ExtensionSecurity::DisableExtensionRemoval::get())
246 {
247 xPopup->append("CMD_REMOVE", DpResId(RID_CTX_ITEM_REMOVE));
248 }
249 }
250
251 if ( !GetEntryData( nPos )->m_sLicenseText.isEmpty() )
252 xPopup->append("CMD_SHOW_LICENSE", DpResId(RID_STR_SHOW_LICENSE_CMD));
253
254 return xPopup->popup_at_rect(GetDrawingArea(), tools::Rectangle(rPos, Size(1, 1)));
255}
256
258{
260 return false;
262}
263
265{
266 m_bInterfaceLocked = ! bEnable;
267
268 if ( bEnable )
269 {
270 sal_Int32 nIndex = getSelIndex();
273 }
274 else
275 {
279 }
280}
281
282// DialogHelper
283
285 weld::Window* pWindow)
286 : m_pWindow(pWindow)
287 , m_nEventID(nullptr)
288{
290}
291
293{
294 if ( m_nEventID )
296}
297
298
300{
301 return xPackage->getRepositoryName() == SHARED_PACKAGE_MANAGER;
302}
303
305 weld::Widget* pParent,
306 TranslateId pResID,
307 bool &bHadWarning )
308{
309 if ( !bHadWarning && IsSharedPkgMgr( xPackage ) )
310 {
311 const SolarMutexGuard guard;
312 incBusy();
313 std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pParent,
314 VclMessageType::Warning, VclButtonsType::OkCancel, DpResId(pResID)));
315 bHadWarning = true;
316
317 bool bRet = RET_OK == xBox->run();
318 xBox.reset();
319 decBusy();
320 return bRet;
321 }
322 else
323 return true;
324}
325
326void DialogHelper::openWebBrowser(const OUString& sURL, const OUString& sTitle)
327{
328 if ( sURL.isEmpty() ) // Nothing to do, when the URL is empty
329 return;
330
331 try
332 {
333 uno::Reference< XSystemShellExecute > xSystemShellExecute(
335 //throws css::lang::IllegalArgumentException, css::system::SystemShellExecuteException
336 xSystemShellExecute->execute( sURL, OUString(), SystemShellExecuteFlags::URIS_ONLY );
337 }
338 catch ( const uno::Exception& )
339 {
340 uno::Any exc( ::cppu::getCaughtException() );
341 OUString msg( ::comphelper::anyToString( exc ) );
342 const SolarMutexGuard guard;
343 incBusy();
344 std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(getFrameWeld(),
345 VclMessageType::Warning, VclButtonsType::Ok, msg));
346 xErrorBox->set_title(sTitle);
347 xErrorBox->run();
348 xErrorBox.reset();
349 decBusy();
350 }
351}
352
353bool DialogHelper::installExtensionWarn(std::u16string_view rExtensionName)
354{
355 const SolarMutexGuard guard;
356
357 // Check if extension installation is disabled in the expert configurations
358 if (officecfg::Office::ExtensionManager::ExtensionSecurity::DisableExtensionInstallation::get())
359 {
360 incBusy();
361 std::unique_ptr<weld::MessageDialog> xWarnBox(Application::CreateMessageDialog(getFrameWeld(),
362 VclMessageType::Warning, VclButtonsType::Ok,
363 DpResId(RID_STR_WARNING_INSTALL_EXTENSION_DISABLED)));
364 xWarnBox->run();
365 xWarnBox.reset();
366 decBusy();
367
368 return false;
369 }
370
371 incBusy();
372 std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(getFrameWeld(),
373 VclMessageType::Warning, VclButtonsType::OkCancel,
374 DpResId(RID_STR_WARNING_INSTALL_EXTENSION)));
375 OUString sText(xInfoBox->get_primary_text());
376 sText = sText.replaceAll("%NAME", rExtensionName);
377 xInfoBox->set_primary_text(sText);
378
379 bool bRet = RET_OK == xInfoBox->run();
380 xInfoBox.reset();
381 decBusy();
382 return bRet;
383}
384
385bool DialogHelper::installForAllUsers(bool &bInstallForAll)
386{
387 const SolarMutexGuard guard;
388 incBusy();
389 std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(getFrameWeld(), "desktop/ui/installforalldialog.ui"));
390 std::unique_ptr<weld::MessageDialog> xQuery(xBuilder->weld_message_dialog("InstallForAllDialog"));
391 short nRet = xQuery->run();
392 xQuery.reset();
393 decBusy();
394 if (nRet == RET_CANCEL)
395 return false;
396
397 bInstallForAll = ( nRet == RET_NO );
398 return true;
399}
400
401void DialogHelper::PostUserEvent( const Link<void*,void>& rLink, void* pCaller )
402{
403 if ( m_nEventID )
405
406 m_nEventID = Application::PostUserEvent(rLink, pCaller);
407}
408
409// ExtMgrDialog
411 : GenericDialogController(pParent, "desktop/ui/extensionmanager.ui", "ExtensionManagerDialog")
412 , DialogHelper(pManager->getContext(), m_xDialog.get())
413 , m_sAddPackages(DpResId(RID_STR_ADD_PACKAGES))
414 , m_bHasProgress(false)
415 , m_bProgressChanged(false)
416 , m_bStartProgress(false)
417 , m_bStopProgress(false)
418 , m_bEnableWarning(false)
419 , m_bDisableWarning(false)
420 , m_bDeleteWarning(false)
421 , m_bClosed(false)
422 , m_nProgress(0)
423 , m_aIdle( "ExtMgrDialog m_aIdle TimeOutHdl" )
424 , m_pManager(pManager)
425 , m_xExtensionBox(new ExtBoxWithBtns_Impl(m_xBuilder->weld_scrolled_window("scroll", true)))
426 , m_xExtensionBoxWnd(new weld::CustomWeld(*m_xBuilder, "extensions", *m_xExtensionBox))
427 , m_xOptionsBtn(m_xBuilder->weld_button("optionsbtn"))
428 , m_xAddBtn(m_xBuilder->weld_button("addbtn"))
429 , m_xRemoveBtn(m_xBuilder->weld_button("removebtn"))
430 , m_xEnableBtn(m_xBuilder->weld_button("enablebtn"))
431 , m_xUpdateBtn(m_xBuilder->weld_button("updatebtn"))
432 , m_xCloseBtn(m_xBuilder->weld_button("close"))
433 , m_xBundledCbx(m_xBuilder->weld_check_button("bundled"))
434 , m_xSharedCbx(m_xBuilder->weld_check_button("shared"))
435 , m_xUserCbx(m_xBuilder->weld_check_button("user"))
436 , m_xGetExtensions(m_xBuilder->weld_link_button("getextensions"))
437 , m_xProgressText(m_xBuilder->weld_label("progressft"))
438 , m_xProgressBar(m_xBuilder->weld_progress_bar("progressbar"))
439 , m_xCancelBtn(m_xBuilder->weld_button("cancel"))
440 , m_xSearchEntry(m_xBuilder->weld_entry("search"))
441{
442 m_xExtensionBox->InitFromDialog(this);
443
445
446 m_xOptionsBtn->connect_clicked( LINK( this, ExtMgrDialog, HandleOptionsBtn ) );
447 m_xAddBtn->connect_clicked( LINK( this, ExtMgrDialog, HandleAddBtn ) );
448 m_xRemoveBtn->connect_clicked( LINK( this, ExtMgrDialog, HandleRemoveBtn ) );
449 m_xEnableBtn->connect_clicked( LINK( this, ExtMgrDialog, HandleEnableBtn ) );
450 m_xCloseBtn->connect_clicked( LINK( this, ExtMgrDialog, HandleCloseBtn ) );
451
452 m_xCancelBtn->connect_clicked( LINK( this, ExtMgrDialog, HandleCancelBtn ) );
453
454 m_xBundledCbx->connect_toggled( LINK( this, ExtMgrDialog, HandleExtTypeCbx ) );
455 m_xSharedCbx->connect_toggled( LINK( this, ExtMgrDialog, HandleExtTypeCbx ) );
456 m_xUserCbx->connect_toggled( LINK( this, ExtMgrDialog, HandleExtTypeCbx ) );
457
458 m_xSearchEntry->connect_changed( LINK( this, ExtMgrDialog, HandleSearch ) );
459
460 m_xBundledCbx->set_active(true);
461 m_xSharedCbx->set_active(true);
462 m_xUserCbx->set_active(true);
463
464 m_xProgressBar->hide();
465
466#if ENABLE_EXTENSION_UPDATE
467 m_xUpdateBtn->connect_clicked( LINK( this, ExtMgrDialog, HandleUpdateBtn ) );
468 m_xUpdateBtn->set_sensitive(false);
469#else
470 m_xUpdateBtn->hide();
471#endif
472
473 if (officecfg::Office::ExtensionManager::ExtensionSecurity::DisableExtensionInstallation::get())
474 {
475 m_xAddBtn->set_sensitive(false);
476 m_xAddBtn->set_tooltip_text(DpResId(RID_STR_WARNING_INSTALL_EXTENSION_DISABLED));
477 }
478 if (officecfg::Office::ExtensionManager::ExtensionSecurity::DisableExtensionRemoval::get())
479 {
480 m_xRemoveBtn->set_sensitive(false);
481 m_xRemoveBtn->set_tooltip_text(DpResId(RID_STR_WARNING_REMOVE_EXTENSION_DISABLED));
482 }
483
484 m_aIdle.SetPriority(TaskPriority::LOWEST);
485 m_aIdle.SetInvokeHandler( LINK( this, ExtMgrDialog, TimeOutHdl ) );
486}
487
489{
490 m_aIdle.Stop();
491}
492
493void ExtMgrDialog::setGetExtensionsURL( const OUString &rURL )
494{
495 m_xGetExtensions->set_uri( rURL );
496}
497
499 bool bLicenseMissing )
500{
501 const SolarMutexGuard aGuard;
502 m_xUpdateBtn->set_sensitive(true);
503
504 bool bSearchMatch = m_xSearchEntry->get_text().isEmpty();
505 if (!m_xSearchEntry->get_text().isEmpty()
506 && xPackage->getDisplayName().toAsciiLowerCase().indexOf(
507 m_xSearchEntry->get_text().toAsciiLowerCase())
508 >= 0)
509 {
510 bSearchMatch = true;
511 }
512
513 if (!bSearchMatch)
514 return;
515
516 if (m_xBundledCbx->get_active() && (xPackage->getRepositoryName() == BUNDLED_PACKAGE_MANAGER) )
517 {
518 m_xExtensionBox->addEntry( xPackage, bLicenseMissing );
519 }
520 else if (m_xSharedCbx->get_active() && (xPackage->getRepositoryName() == SHARED_PACKAGE_MANAGER) )
521 {
522 m_xExtensionBox->addEntry( xPackage, bLicenseMissing );
523 }
524 else if (m_xUserCbx->get_active() && (xPackage->getRepositoryName() == USER_PACKAGE_MANAGER ))
525 {
526 m_xExtensionBox->addEntry( xPackage, bLicenseMissing );
527 }
528}
529
531{
532 // re-creates the list of packages with addEntry selecting the packages
535 checkEntries();
536}
537
539{
540 m_xExtensionBox->prepareChecking();
541}
542
544{
545 const SolarMutexGuard guard;
546 m_xExtensionBox->checkEntries();
547}
548
549bool ExtMgrDialog::removeExtensionWarn(std::u16string_view rExtensionName)
550{
551 const SolarMutexGuard guard;
552 incBusy();
553 std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(m_xDialog.get(),
554 VclMessageType::Warning, VclButtonsType::OkCancel,
555 DpResId(RID_STR_WARNING_REMOVE_EXTENSION)));
556
557 OUString sText(xInfoBox->get_primary_text());
558 sText = sText.replaceAll("%NAME", rExtensionName);
559 xInfoBox->set_primary_text(sText);
560
561 bool bRet = RET_OK == xInfoBox->run();
562 xInfoBox.reset();
563 decBusy();
564
565 return bRet;
566}
567
569 bool bEnable )
570{
571 if ( !xPackage.is() )
572 return;
573
574 if ( bEnable )
575 {
576 if (!continueOnSharedExtension(xPackage, m_xDialog.get(), RID_STR_WARNING_ENABLE_SHARED_EXTENSION, m_bEnableWarning))
577 return;
578 }
579 else
580 {
581 if (!continueOnSharedExtension(xPackage, m_xDialog.get(), RID_STR_WARNING_DISABLE_SHARED_EXTENSION, m_bDisableWarning))
582 return;
583 }
584
585 m_pManager->getCmdQueue()->enableExtension( xPackage, bEnable );
586}
587
588
590{
591 if ( !xPackage.is() )
592 return;
593
594 if ( !IsSharedPkgMgr( xPackage ) || m_bDeleteWarning )
595 {
596 if ( ! removeExtensionWarn( xPackage->getDisplayName() ) )
597 return;
598 }
599
600 if (!continueOnSharedExtension(xPackage, m_xDialog.get(), RID_STR_WARNING_REMOVE_SHARED_EXTENSION, m_bDeleteWarning))
601 return;
602
603 m_pManager->getCmdQueue()->removeExtension( xPackage );
604}
605
606
608{
609 if ( !xPackage.is() )
610 return;
611
612 // get the extension with highest version
614 m_pManager->getExtensionManager()->getExtensionsWithSameIdentifier(
615 dp_misc::getIdentifier(xPackage), xPackage->getName(), uno::Reference<ucb::XCommandEnvironment>());
618 OSL_ASSERT(extension.is());
619 std::vector< css::uno::Reference< css::deployment::XPackage > > vEntries { extension };
620
621 m_pManager->getCmdQueue()->checkForUpdates( std::move(vEntries) );
622}
623
624
626{
627 if ( !xPackage.is() )
628 return false;
629
630 m_pManager->getCmdQueue()->acceptLicense( xPackage );
631
632 return true;
633}
634
635
637{
638 sfx2::FileDialogHelper aDlgHelper(ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, FileDialogFlags::NONE, m_xDialog.get());
640 const uno::Reference<ui::dialogs::XFilePicker3>& xFilePicker = aDlgHelper.GetFilePicker();
641 xFilePicker->setTitle( m_sAddPackages );
642
643 // collect and set filter list:
644 typedef std::map< OUString, OUString > t_string2string;
645 t_string2string title2filter;
646 OUStringBuffer supportedFilters;
647
649 m_pManager->getExtensionManager()->getSupportedPackageTypes() );
650
651 for ( uno::Reference< deployment::XPackageTypeInfo > const & xPackageType : packageTypes )
652 {
653 const OUString filter( xPackageType->getFileFilter() );
654 if (!filter.isEmpty())
655 {
656 const OUString title( xPackageType->getShortDescription() );
657 const std::pair< t_string2string::iterator, bool > insertion(
658 title2filter.emplace( title, filter ) );
659 if (!supportedFilters.isEmpty())
660 supportedFilters.append(';');
661 supportedFilters.append(filter);
662 if ( ! insertion.second )
663 { // already existing, append extensions:
664 insertion.first->second = insertion.first->second +
665 ";" + filter;
666 }
667 }
668 }
669
670 static const OUString StrAllFiles = []()
671 {
672 const SolarMutexGuard guard;
673 std::locale loc = Translate::Create("fps");
674 return Translate::get(STR_FILTERNAME_ALL, loc);
675 }();
676
677 // All files at top:
678 xFilePicker->appendFilter( StrAllFiles, "*.*" );
679 xFilePicker->appendFilter( DpResId(RID_STR_ALL_SUPPORTED), supportedFilters.makeStringAndClear() );
680 // then supported ones:
681 for (auto const& elem : title2filter)
682 {
683 try
684 {
685 xFilePicker->appendFilter( elem.first, elem.second );
686 }
687 catch (const lang::IllegalArgumentException &)
688 {
689 TOOLS_WARN_EXCEPTION( "desktop", "" );
690 }
691 }
692 xFilePicker->setCurrentFilter( DpResId(RID_STR_ALL_SUPPORTED) );
693
694 if ( xFilePicker->execute() != ui::dialogs::ExecutableDialogResults::OK )
695 return uno::Sequence<OUString>(); // cancelled
696
697 uno::Sequence< OUString > files( xFilePicker->getSelectedFiles() );
698 OSL_ASSERT( files.hasElements() );
699 return files;
700}
701
703{
704 m_xOptionsBtn->set_sensitive( bEnable );
705}
706
708{
709 m_xRemoveBtn->set_sensitive( bEnable && !officecfg::Office::ExtensionManager::ExtensionSecurity::DisableExtensionRemoval::get());
710
711 if (officecfg::Office::ExtensionManager::ExtensionSecurity::DisableExtensionRemoval::get())
712 {
713 m_xRemoveBtn->set_tooltip_text(DpResId(RID_STR_WARNING_REMOVE_EXTENSION_DISABLED));
714 }
715 else
716 {
717 m_xRemoveBtn->set_tooltip_text("");
718 }
719}
720
722{
723 m_xEnableBtn->set_sensitive( bEnable );
724}
725
727{
728 if (bEnable)
729 {
730 m_xEnableBtn->set_label( DpResId( RID_CTX_ITEM_ENABLE ) );
732 }
733 else
734 {
735 m_xEnableBtn->set_label( DpResId( RID_CTX_ITEM_DISABLE ) );
737 }
738}
739
741{
742 if ( m_xAbortChannel.is() )
743 {
744 try
745 {
746 m_xAbortChannel->sendAbort();
747 }
748 catch ( const uno::RuntimeException & )
749 {
750 TOOLS_WARN_EXCEPTION( "dbaccess", "" );
751 }
752 }
753}
754
756{
757 bool bCallClose = true;
758
759 //only suggest restart if modified and this is the first close attempt
760 if (!m_bClosed && m_pManager->isModified())
761 {
762 m_pManager->clearModified();
763
764 //only suggest restart if we're actually running, e.g. not from standalone unopkg gui
766 {
767 SolarMutexGuard aGuard;
768 bCallClose = !::svtools::executeRestartDialog(comphelper::getProcessComponentContext(),
769 m_xDialog.get(),
771 }
772 }
773
774 if (bCallClose)
775 m_xDialog->response(RET_CANCEL);
776}
777
778IMPL_LINK( ExtMgrDialog, startProgress, void*, _bLockInterface, void )
779{
780 std::unique_lock aGuard( m_aMutex );
781 bool bLockInterface = static_cast<bool>(_bLockInterface);
782
783 if ( m_bStartProgress && !m_bHasProgress )
784 m_aIdle.Start();
785
786 if ( m_bStopProgress )
787 {
788 if ( m_xProgressBar->get_visible() )
789 m_xProgressBar->set_percentage( 100 );
790 m_xAbortChannel.clear();
791
792 SAL_INFO( "desktop.deployment", " startProgress handler: stop" );
793 }
794 else
795 {
796 SAL_INFO( "desktop.deployment", " startProgress handler: start" );
797 }
798
799 m_xCancelBtn->set_sensitive( bLockInterface );
800 m_xAddBtn->set_sensitive( !bLockInterface && !officecfg::Office::ExtensionManager::ExtensionSecurity::DisableExtensionInstallation::get());
801 if (officecfg::Office::ExtensionManager::ExtensionSecurity::DisableExtensionInstallation::get())
802 {
803 m_xAddBtn->set_tooltip_text(DpResId(RID_STR_WARNING_INSTALL_EXTENSION_DISABLED));
804 }
805 else
806 {
807 m_xAddBtn->set_tooltip_text("");
808 }
809
810 m_xUpdateBtn->set_sensitive( !bLockInterface && m_xExtensionBox->getItemCount() );
811 m_xExtensionBox->enableButtons( !bLockInterface );
812
813 clearEventID();
814}
815
816
817void ExtMgrDialog::showProgress( bool _bStart )
818{
819 std::unique_lock aGuard( m_aMutex );
820
821 bool bStart = _bStart;
822
823 if ( bStart )
824 {
825 m_nProgress = 0;
826 m_bStartProgress = true;
827 SAL_INFO( "desktop.deployment", "showProgress start" );
828 }
829 else
830 {
831 m_nProgress = 100;
832 m_bStopProgress = true;
833 SAL_INFO( "desktop.deployment", "showProgress stop!" );
834 }
835
836 DialogHelper::PostUserEvent( LINK( this, ExtMgrDialog, startProgress ), reinterpret_cast<void*>(bStart) );
837 m_aIdle.Start();
838}
839
840
842{
843 if ( m_nProgress != nProgress )
844 {
845 std::unique_lock aGuard( m_aMutex );
846 m_nProgress = nProgress;
847 m_aIdle.Start();
848 }
849}
850
851
852void ExtMgrDialog::updateProgress( const OUString &rText,
853 const uno::Reference< task::XAbortChannel > &xAbortChannel)
854{
855 std::unique_lock aGuard( m_aMutex );
856
857 m_xAbortChannel = xAbortChannel;
858 m_sProgressText = rText;
859 m_bProgressChanged = true;
860 m_aIdle.Start();
861}
862
863
865{
866 const SolarMutexGuard aGuard;
867 m_xExtensionBox->updateEntry( xPackage );
868}
869
870IMPL_LINK_NOARG(ExtMgrDialog, HandleOptionsBtn, weld::Button&, void)
871{
872 const sal_Int32 nActive = m_xExtensionBox->getSelIndex();
873
874 if ( nActive != ExtensionBox_Impl::ENTRY_NOTFOUND )
875 {
877
878 OUString sExtensionId = m_xExtensionBox->GetEntryData( nActive )->m_xPackage->getIdentifier().Value;
879 ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateOptionsDialog(m_xDialog.get(), sExtensionId));
880
881 pDlg->Execute();
882 }
883}
884
886{
887 incBusy();
888
889 uno::Sequence< OUString > aFileList = raiseAddPicker();
890
891 if ( aFileList.hasElements() )
892 {
893 m_pManager->installPackage( aFileList[0] );
894 }
895
896 decBusy();
897}
898
900{
901 const sal_Int32 nActive = m_xExtensionBox->getSelIndex();
902
903 if ( nActive != ExtensionBox_Impl::ENTRY_NOTFOUND )
904 {
905 TEntry_Impl pEntry = m_xExtensionBox->GetEntryData( nActive );
906 removePackage( pEntry->m_xPackage );
907 }
908}
909
911{
912 const sal_Int32 nActive = m_xExtensionBox->getSelIndex();
913
914 if ( nActive != ExtensionBox_Impl::ENTRY_NOTFOUND )
915 {
916 TEntry_Impl pEntry = m_xExtensionBox->GetEntryData( nActive );
917
918 if ( pEntry->m_bMissingLic )
919 acceptLicense( pEntry->m_xPackage );
920 else
921 {
922 const bool bEnable( pEntry->m_eState != REGISTERED );
923 enablePackage( pEntry->m_xPackage, bEnable );
924 }
925 }
926}
927
929{
930 updateList();
931}
932
934{
935 updateList();
936}
937
939{
940#if ENABLE_EXTENSION_UPDATE
941 m_pManager->checkUpdates();
942#else
943 (void) this;
944#endif
945}
946
947IMPL_LINK_NOARG(ExtMgrDialog, TimeOutHdl, Timer *, void)
948{
949 if ( m_bStopProgress )
950 {
951 m_bHasProgress = false;
952 m_bStopProgress = false;
953 m_xProgressText->hide();
954 m_xProgressBar->hide();
955 m_xCancelBtn->hide();
956 }
957 else
958 {
959 if ( m_bProgressChanged )
960 {
961 m_bProgressChanged = false;
962 m_xProgressText->set_label(m_sProgressText);
963 }
964
965 if ( m_bStartProgress )
966 {
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();
973 }
974
975 if ( m_xProgressBar->get_visible() )
976 m_xProgressBar->set_percentage( static_cast<sal_uInt16>(m_nProgress) );
977 }
978}
979
981{
983 m_bClosed = true;
984}
985
986//UpdateRequiredDialog
988 : GenericDialogController(pParent, "desktop/ui/updaterequireddialog.ui", "UpdateRequiredDialog")
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("scroll", true)))
1000 , m_xExtensionBoxWnd(new weld::CustomWeld(*m_xBuilder, "extensions", *m_xExtensionBox))
1001 , m_xUpdateNeeded(m_xBuilder->weld_label("updatelabel"))
1002 , m_xUpdateBtn(m_xBuilder->weld_button("ok"))
1003 , m_xCloseBtn(m_xBuilder->weld_button("disable"))
1004 , m_xCancelBtn(m_xBuilder->weld_button("cancel"))
1005 , m_xProgressText(m_xBuilder->weld_label("progresslabel"))
1006 , m_xProgressBar(m_xBuilder->weld_progress_bar("progress"))
1007{
1008 m_xExtensionBox->setExtensionManager(pManager);
1009
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 ) );
1013
1014 OUString aText = m_xUpdateNeeded->get_label();
1015 aText = aText.replaceAll(
1016 "%PRODUCTNAME", utl::ConfigManager::getProductName());
1017 m_xUpdateNeeded->set_label(aText);
1018
1019 m_xProgressBar->hide();
1020 m_xUpdateBtn->set_sensitive( false );
1021 m_xCloseBtn->grab_focus();
1022
1023 m_aIdle.SetPriority( TaskPriority::LOWEST );
1024 m_aIdle.SetInvokeHandler( LINK( this, UpdateRequiredDialog, TimeOutHdl ) );
1025}
1026
1028{
1029 m_aIdle.Stop();
1030}
1031
1033 bool bLicenseMissing )
1034{
1035 // We will only add entries to the list with unsatisfied dependencies
1036 if ( !bLicenseMissing && !checkDependencies( xPackage ) )
1037 {
1039 const SolarMutexGuard aGuard;
1040 m_xUpdateBtn->set_sensitive(true);
1041 m_xExtensionBox->addEntry( xPackage );
1042 }
1043}
1044
1045
1047{
1048 m_xExtensionBox->prepareChecking();
1049}
1050
1051
1053{
1054 const SolarMutexGuard guard;
1055 m_xExtensionBox->checkEntries();
1056
1057 if ( ! hasActiveEntries() )
1058 {
1059 m_xCloseBtn->set_label( m_sCloseText );
1060 m_xCloseBtn->grab_focus();
1061 }
1062}
1063
1064
1066{
1067 if ( m_xAbortChannel.is() )
1068 {
1069 try
1070 {
1071 m_xAbortChannel->sendAbort();
1072 }
1073 catch ( const uno::RuntimeException & )
1074 {
1075 TOOLS_WARN_EXCEPTION( "desktop", "" );
1076 }
1077 }
1078}
1079
1080
1081IMPL_LINK( UpdateRequiredDialog, startProgress, void*, _bLockInterface, void )
1082{
1083 std::unique_lock aGuard( m_aMutex );
1084 bool bLockInterface = static_cast<bool>(_bLockInterface);
1085
1086 if ( m_bStartProgress && !m_bHasProgress )
1087 m_aIdle.Start();
1088
1089 if ( m_bStopProgress )
1090 {
1091 if ( m_xProgressBar->get_visible() )
1092 m_xProgressBar->set_percentage( 100 );
1093 m_xAbortChannel.clear();
1094 SAL_INFO( "desktop.deployment", " startProgress handler: stop" );
1095 }
1096 else
1097 {
1098 SAL_INFO( "desktop.deployment", " startProgress handler: start" );
1099 }
1100
1101 m_xCancelBtn->set_sensitive( bLockInterface );
1102 m_xUpdateBtn->set_sensitive( false );
1103 clearEventID();
1104}
1105
1106
1108{
1109 std::unique_lock aGuard( m_aMutex );
1110
1111 bool bStart = _bStart;
1112
1113 if ( bStart )
1114 {
1115 m_nProgress = 0;
1116 m_bStartProgress = true;
1117 SAL_INFO( "desktop.deployment", "showProgress start" );
1118 }
1119 else
1120 {
1121 m_nProgress = 100;
1122 m_bStopProgress = true;
1123 SAL_INFO( "desktop.deployment", "showProgress stop!" );
1124 }
1125
1126 DialogHelper::PostUserEvent( LINK( this, UpdateRequiredDialog, startProgress ), reinterpret_cast<void*>(bStart) );
1127 m_aIdle.Start();
1128}
1129
1130
1132{
1133 if ( m_nProgress != nProgress )
1134 {
1135 std::unique_lock aGuard( m_aMutex );
1136 m_nProgress = nProgress;
1137 m_aIdle.Start();
1138 }
1139}
1140
1141
1142void UpdateRequiredDialog::updateProgress( const OUString &rText,
1143 const uno::Reference< task::XAbortChannel > &xAbortChannel)
1144{
1145 std::unique_lock aGuard( m_aMutex );
1146
1147 m_xAbortChannel = xAbortChannel;
1148 m_sProgressText = rText;
1149 m_bProgressChanged = true;
1150 m_aIdle.Start();
1151}
1152
1153
1155{
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 );
1164
1165 if ( ! hasActiveEntries() )
1166 {
1167 m_xCloseBtn->set_label( m_sCloseText );
1168 m_xCloseBtn->grab_focus();
1169 }
1170}
1171
1172
1174{
1175 std::unique_lock aGuard( m_aMutex );
1176
1177 std::vector< uno::Reference< deployment::XPackage > > vUpdateEntries;
1178 sal_Int32 nCount = m_xExtensionBox->GetEntryCount();
1179
1180 for ( sal_Int32 i = 0; i < nCount; ++i )
1181 {
1182 TEntry_Impl pEntry = m_xExtensionBox->GetEntryData( i );
1183 vUpdateEntries.push_back( pEntry->m_xPackage );
1184 }
1185
1186 aGuard.unlock();
1187
1188 m_pManager->getCmdQueue()->checkForUpdates( std::move(vUpdateEntries) );
1189}
1190
1191
1193{
1194 std::unique_lock aGuard( m_aMutex );
1195
1196 if ( !isBusy() )
1197 {
1198 if ( m_bHasLockedEntries )
1199 m_xDialog->response(-1);
1200 else if ( hasActiveEntries() )
1201 disableAllEntries();
1202 else
1203 m_xDialog->response(RET_CANCEL);
1204 }
1205}
1206
1207
1209{
1210 if ( m_bStopProgress )
1211 {
1212 m_bHasProgress = false;
1213 m_bStopProgress = false;
1214 m_xProgressText->hide();
1215 m_xProgressBar->hide();
1216 m_xCancelBtn->hide();
1217 }
1218 else
1219 {
1220 if ( m_bProgressChanged )
1221 {
1222 m_bProgressChanged = false;
1223 m_xProgressText->set_label( m_sProgressText );
1224 }
1225
1226 if ( m_bStartProgress )
1227 {
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();
1234 }
1235
1236 if (m_xProgressBar->get_visible())
1237 m_xProgressBar->set_percentage(m_nProgress);
1238 }
1239}
1240
1241// VCL::Dialog
1243{
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 )
1252 {
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();
1258 }
1259
1260 return GenericDialogController::run();
1261}
1262
1263// Check dependencies of all packages
1264
1266{
1267 bool bRegistered = false;
1268 try {
1269 beans::Optional< beans::Ambiguous< sal_Bool > > option( xPackage->isRegistered( uno::Reference< task::XAbortChannel >(),
1271 if ( option.IsPresent )
1272 {
1273 ::beans::Ambiguous< sal_Bool > const & reg = option.Value;
1274 if ( reg.IsAmbiguous )
1275 bRegistered = false;
1276 else
1277 bRegistered = reg.Value;
1278 }
1279 else
1280 bRegistered = false;
1281 }
1282 catch ( const uno::RuntimeException & ) { throw; }
1283 catch (const uno::Exception & ) {
1284 TOOLS_WARN_EXCEPTION( "desktop", "" );
1285 bRegistered = false;
1286 }
1287
1288 return bRegistered;
1289}
1290
1291// Checks the dependencies no matter if the extension is enabled or disabled!
1293{
1294 bool bDependenciesValid = false;
1295 try {
1296 bDependenciesValid = xPackage->checkDependencies( uno::Reference< ucb::XCommandEnvironment >() );
1297 }
1298 catch ( const deployment::DeploymentException & ) {}
1299 return bDependenciesValid;
1300}
1301
1302
1304{
1305 std::unique_lock aGuard( m_aMutex );
1306
1307 bool bRet = false;
1308 tools::Long nCount = m_xExtensionBox->GetEntryCount();
1309 for ( tools::Long nIndex = 0; nIndex < nCount; nIndex++ )
1310 {
1311 TEntry_Impl pEntry = m_xExtensionBox->GetEntryData( nIndex );
1312
1313 if ( isEnabled(pEntry->m_xPackage) && !checkDependencies( pEntry->m_xPackage ) )
1314 {
1315 bRet = true;
1316 break;
1317 }
1318 }
1319
1320 return bRet;
1321}
1322
1323
1325{
1326 std::unique_lock aGuard( m_aMutex );
1327
1328 incBusy();
1329
1330 tools::Long nCount = m_xExtensionBox->GetEntryCount();
1331 for ( tools::Long nIndex = 0; nIndex < nCount; nIndex++ )
1332 {
1333 TEntry_Impl pEntry = m_xExtensionBox->GetEntryData( nIndex );
1334 m_pManager->getCmdQueue()->enableExtension( pEntry->m_xPackage, false );
1335 }
1336
1337 decBusy();
1338
1339 if ( ! hasActiveEntries() )
1340 m_xCloseBtn->set_label( m_sCloseText );
1341}
1342
1343// ShowLicenseDialog
1346 : GenericDialogController(pParent, "desktop/ui/showlicensedialog.ui", "ShowLicenseDialog")
1347 , m_xLicenseText(m_xBuilder->weld_text_view("textview"))
1348{
1349 m_xLicenseText->set_size_request(m_xLicenseText->get_approximate_digit_width() * 72,
1350 m_xLicenseText->get_height_rows(21));
1351 m_xLicenseText->set_text(xPackage->getLicenseText());
1352}
1353
1355{
1356}
1357
1358// UpdateRequiredDialogService
1359
1362 : m_xComponentContext(std::move( xComponentContext ))
1363{
1364}
1365
1366// XServiceInfo
1368{
1369 return "com.sun.star.comp.deployment.ui.UpdateRequiredDialog";
1370}
1371
1373{
1374 return cppu::supportsService(this, ServiceName);
1375}
1376
1378{
1379 return { "com.sun.star.deployment.ui.UpdateRequiredDialog" };
1380}
1381
1382
1383// XExecutableDialog
1384
1386{
1387}
1388
1389
1391{
1394 xManager->createDialog( true );
1395 sal_Int16 nRet = xManager->execute();
1396
1397 return nRet;
1398}
1399
1400
1401} //namespace dp_gui
1402
1403/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Reference< XExecutableDialog > m_xDialog
static ImplSVEvent * PostUserEvent(const Link< void *, void > &rLink, void *pCaller=nullptr, bool bReferenceLink=false)
static std::unique_ptr< weld::Builder > CreateBuilder(weld::Widget *pParent, const OUString &rUIFile, bool bMobile=false, sal_uInt64 nLOKWindowId=0)
static void RemoveUserEvent(ImplSVEvent *nUserEvent)
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, const ILibreOfficeKitNotifier *pNotifier=nullptr)
CommandEventId GetCommand() const
const Point & GetMousePosPixel() const
virtual void Start(bool bStartTimer=true) override
static SfxAbstractDialogFactory * Create()
virtual VclPtr< VclAbstractDialog > CreateOptionsDialog(weld::Window *pParent, const OUString &rExtensionId)=0
void SetPriority(TaskPriority ePriority)
void Stop()
void SetInvokeHandler(const Link< Timer *, void > &rLink)
bool installForAllUsers(bool &bInstallForAll)
void openWebBrowser(const OUString &rURL, const OUString &rTitle)
bool continueOnSharedExtension(const css::uno::Reference< css::deployment::XPackage > &, weld::Widget *pParent, TranslateId pResID, bool &bHadWarning)
ImplSVEvent * m_nEventID
css::uno::Reference< css::uno::XComponentContext > m_xContext
weld::Window * getFrameWeld() const
bool installExtensionWarn(std::u16string_view rExtensionURL)
DialogHelper(const css::uno::Reference< css::uno::XComponentContext > &, weld::Window *pWindow)
void PostUserEvent(const Link< void *, void > &rLink, void *pCaller)
static bool IsSharedPkgMgr(const css::uno::Reference< css::deployment::XPackage > &)
void enableButtons(bool bEnable)
void InitFromDialog(ExtMgrDialog *pParentDialog)
virtual bool MouseButtonDown(const MouseEvent &rMEvt) override
virtual void RecalcAll() override
ExtBoxWithBtns_Impl(std::unique_ptr< weld::ScrolledWindow > xScroll)
virtual bool Command(const CommandEvent &rCEvt) override
void SetButtonStatus(const TEntry_Impl &rEntry)
virtual void selectEntry(const tools::Long nPos) override
OUString ShowPopupMenu(const Point &rPos, const tools::Long nPos)
void enableButtontoEnable(bool bEnable)
css::uno::Reference< css::task::XAbortChannel > m_xAbortChannel
std::unique_ptr< weld::Button > m_xRemoveBtn
virtual void showProgress(bool bStart) override
TheExtensionManager * m_pManager
std::unique_ptr< weld::LinkButton > m_xGetExtensions
std::unique_ptr< weld::Button > m_xCancelBtn
bool acceptLicense(const css::uno::Reference< css::deployment::XPackage > &xPackage)
virtual ~ExtMgrDialog() override
void removePackage(const css::uno::Reference< css::deployment::XPackage > &xPackage)
bool removeExtensionWarn(std::u16string_view rExtensionTitle)
const OUString m_sAddPackages
std::unique_ptr< weld::Button > m_xCloseBtn
void updatePackage(const css::uno::Reference< css::deployment::XPackage > &xPackage)
std::unique_ptr< weld::Button > m_xUpdateBtn
virtual void prepareChecking() override
void enableEnableButton(bool bEnable)
std::unique_ptr< weld::CheckButton > m_xBundledCbx
void enableRemoveButton(bool bEnable)
std::unique_ptr< weld::Button > m_xAddBtn
ExtMgrDialog(weld::Window *pParent, TheExtensionManager *pManager)
virtual void updatePackageInfo(const css::uno::Reference< css::deployment::XPackage > &xPackage) override
void enablePackage(const css::uno::Reference< css::deployment::XPackage > &xPackage, bool bEnable)
std::unique_ptr< weld::CheckButton > m_xSharedCbx
virtual void updateProgress(const OUString &rText, const css::uno::Reference< css::task::XAbortChannel > &xAbortChannel) override
std::unique_ptr< weld::CheckButton > m_xUserCbx
css::uno::Sequence< OUString > raiseAddPicker()
std::unique_ptr< weld::Button > m_xEnableBtn
TheExtensionManager * getExtensionManager() const
void enableOptionsButton(bool bEnable)
std::unique_ptr< weld::Entry > m_xSearchEntry
virtual void addPackageToList(const css::uno::Reference< css::deployment::XPackage > &, bool bLicenseMissing=false) override
void setGetExtensionsURL(const OUString &rURL)
std::unique_ptr< ExtBoxWithBtns_Impl > m_xExtensionBox
std::unique_ptr< weld::ProgressBar > m_xProgressBar
std::unique_ptr< weld::Button > m_xOptionsBtn
virtual void checkEntries() override
virtual void selectEntry(const tools::Long nPos)
tools::Long PointToPos(const Point &rPos)
void setExtensionManager(TheExtensionManager *pManager)
virtual bool MouseButtonDown(const MouseEvent &rMEvt) override
TEntry_Impl const & GetEntryData(tools::Long nPos)
void enableExtension(const css::uno::Reference< css::deployment::XPackage > &rPackage, const bool bEnable)
void acceptLicense(const css::uno::Reference< css::deployment::XPackage > &rPackage)
void checkForUpdates(std::vector< css::uno::Reference< css::deployment::XPackage > > &&vList)
void removeExtension(const css::uno::Reference< css::deployment::XPackage > &rPackage)
virtual ~ShowLicenseDialog() override
ShowLicenseDialog(weld::Window *pParent, const css::uno::Reference< css::deployment::XPackage > &xPackage)
std::unique_ptr< weld::TextView > m_xLicenseText
static ::rtl::Reference< TheExtensionManager > get(css::uno::Reference< css::uno::XComponentContext > const &xContext, css::uno::Reference< css::awt::XWindow > const &xParent=nullptr, OUString const &view=OUString())
ExtensionCmdQueue * getCmdQueue() const
const css::uno::Reference< css::deployment::XExtensionManager > & getExtensionManager() const
bool isReadOnly(const css::uno::Reference< css::deployment::XPackage > &xPackage) const
virtual void SAL_CALL setTitle(OUString const &title) override
css::uno::Reference< css::uno::XComponentContext > const m_xComponentContext
UpdateRequiredDialogService(css::uno::Sequence< css::uno::Any > const &args, css::uno::Reference< css::uno::XComponentContext > xComponentContext)
virtual sal_Int16 SAL_CALL execute() override
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual OUString SAL_CALL getImplementationName() override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
static bool isEnabled(const css::uno::Reference< css::deployment::XPackage > &xPackage)
std::unique_ptr< ExtensionBox_Impl > m_xExtensionBox
virtual void checkEntries() override
std::unique_ptr< weld::Button > m_xUpdateBtn
std::unique_ptr< weld::ProgressBar > m_xProgressBar
virtual void updatePackageInfo(const css::uno::Reference< css::deployment::XPackage > &xPackage) override
static bool checkDependencies(const css::uno::Reference< css::deployment::XPackage > &xPackage)
virtual void showProgress(bool bStart) override
virtual ~UpdateRequiredDialog() override
TheExtensionManager * m_pManager
std::unique_ptr< weld::Label > m_xUpdateNeeded
virtual void updateProgress(const OUString &rText, const css::uno::Reference< css::task::XAbortChannel > &xAbortChannel) override
std::unique_ptr< weld::Button > m_xCloseBtn
std::unique_ptr< weld::Button > m_xCancelBtn
css::uno::Reference< css::task::XAbortChannel > m_xAbortChannel
virtual void prepareChecking() override
UpdateRequiredDialog(weld::Window *pParent, TheExtensionManager *pManager)
virtual short run() override
virtual void addPackageToList(const css::uno::Reference< css::deployment::XPackage > &, bool bLicenseMissing=false) override
const css::uno::Reference< css::ui::dialogs::XFilePicker3 > & GetFilePicker() const
void SetContext(Context _eNewContext)
static OUString getProductName()
weld::DrawingArea * GetDrawingArea() const
virtual bool Command(const CommandEvent &)
virtual short run()
virtual Dialog * getDialog() override
std::shared_ptr< weld::Dialog > m_xDialog
int nCount
#define TOOLS_WARN_EXCEPTION(area, stream)
uno::Reference< deployment::XPackage > m_xPackage
Reference< XComponentContext > const m_xComponentContext
OUString DpResId(TranslateId aId)
Definition: dp_misc.cxx:555
float u
constexpr OUStringLiteral HID_EXTENSION_MANAGER_LISTBOX_DISABLE
Definition: helpids.h:25
constexpr OUStringLiteral HID_EXTENSION_MANAGER_LISTBOX_ENABLE
Definition: helpids.h:24
std::mutex m_aMutex
static uno::Reference< css::uno::XComponentContext > xContext
Definition: init.cxx:2642
sal_Int32 nIndex
sal_uInt16 nPos
#define SAL_INFO(area, stream)
std::locale Create(std::string_view aPrefixName, const LanguageTag &rLocale)
OUString get(TranslateId sContextAndId, const std::locale &loc)
Reference< XComponentContext > getProcessComponentContext()
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
Definition: dp_gui.h:22
@ REGISTERED
Definition: dp_gui.h:24
@ NOT_AVAILABLE
Definition: dp_gui.h:24
constexpr OUStringLiteral SHARED_PACKAGE_MANAGER
IMPL_LINK(ExtMgrDialog, startProgress, void *, _bLockInterface, void)
IMPL_LINK_NOARG(ExtMgrDialog, HandleCancelBtn, weld::Button &, void)
constexpr OUStringLiteral USER_PACKAGE_MANAGER
std::shared_ptr< Entry_Impl > TEntry_Impl
constexpr OUStringLiteral BUNDLED_PACKAGE_MANAGER
bool office_is_running()
Definition: dp_misc.cxx:331
DESKTOP_DEPLOYMENTMISC_DLLPUBLIC css::uno::Reference< css::deployment::XPackage > getExtensionWithHighestVersion(css::uno::Sequence< css::uno::Reference< css::deployment::XPackage > > const &seqExtensionsWithSameId)
DESKTOP_DEPLOYMENTMISC_DLLPUBLIC OUString getIdentifier(css::uno::Reference< css::deployment::XPackage > const &package)
Gets the identifier of a package.
css::uno::Reference< css::deployment::XPackageRegistry > create(css::uno::Reference< css::deployment::XPackageRegistry > const &xRootRegistry, OUString const &context, OUString const &cachePath, css::uno::Reference< css::uno::XComponentContext > const &xComponentContext)
int i
RESTART_REASON_EXTENSION_INSTALL
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
long Long
ToolBarManager * m_pManager
JCOPY_OPTION option
unsigned char sal_Bool
RET_OK
RET_CANCEL
RET_NO