use insert function instead of for loop
[LibreOffice.git] / desktop / source / deployment / gui / dp_gui_extensioncmdqueue.hxx
blob3703d1e8c52c5c79d40bd0c0f0fd4bda338166dc
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 #pragma once
22 #include <sal/config.h>
24 #include <com/sun/star/uno/Reference.hxx>
25 #include <rtl/ref.hxx>
27 #include <vector>
29 #include "dp_gui_updatedata.hxx"
31 /// @HTML
33 namespace com::sun::star {
34 namespace task { class XInteractionRequest; }
35 namespace uno { class XComponentContext; }
38 namespace dp_gui {
40 class DialogHelper;
41 class TheExtensionManager;
43 /**
44 Manages installing of extensions in the GUI mode. Requests for installing
45 Extensions can be asynchronous. For example, the Extension Manager is running
46 in an office process and someone uses the system integration to install an Extension.
47 That is, the user double clicks an extension symbol in a file browser, which then
48 causes an invocation of "unopkg gui ext". When at that time the Extension Manager
49 already performs a task, triggered by the user (for example, add, update, disable,
50 enable) then adding of the extension will be postponed until the user has finished
51 the task.
53 This class also ensures that the extensions are not installed in the main thread.
54 Doing so would cause a deadlock because of the progress bar which needs to be constantly
55 updated.
57 class ExtensionCmdQueue {
59 public:
60 /**
61 Create an instance.
63 ExtensionCmdQueue( DialogHelper * pDialogHelper,
64 TheExtensionManager *pManager,
65 const css::uno::Reference< css::uno::XComponentContext > & rContext);
67 ~ExtensionCmdQueue();
69 void addExtension( const OUString &rExtensionURL,
70 const OUString &rRepository,
71 const bool bWarnUser );
72 void removeExtension( const css::uno::Reference< css::deployment::XPackage > &rPackage );
73 void enableExtension( const css::uno::Reference< css::deployment::XPackage > &rPackage,
74 const bool bEnable );
75 void checkForUpdates( std::vector< css::uno::Reference< css::deployment::XPackage > > && vList );
76 void acceptLicense( const css::uno::Reference< css::deployment::XPackage > &rPackage );
77 static void syncRepositories( const css::uno::Reference< css::uno::XComponentContext > & xContext );
79 bool isBusy();
80 private:
81 ExtensionCmdQueue(ExtensionCmdQueue const &) = delete;
82 ExtensionCmdQueue& operator =(ExtensionCmdQueue const &) = delete;
84 class Thread;
86 rtl::Reference< Thread > m_thread;
89 void handleInteractionRequest( const css::uno::Reference< css::uno::XComponentContext > & xContext,
90 const css::uno::Reference< css::task::XInteractionRequest > & xRequest );
94 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */