Version 6.4.0.3, tag libreoffice-6.4.0.3
[LibreOffice.git] / desktop / source / deployment / gui / dp_gui_updatedialog.hxx
blobe9cfd6f234f8a5c33b0db5b842843892f6bbfba3
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 #ifndef INCLUDED_DESKTOP_SOURCE_DEPLOYMENT_GUI_DP_GUI_UPDATEDIALOG_HXX
21 #define INCLUDED_DESKTOP_SOURCE_DEPLOYMENT_GUI_DP_GUI_UPDATEDIALOG_HXX
23 #include <sal/config.h>
25 #include <vector>
26 #include <com/sun/star/uno/Reference.hxx>
27 #include <com/sun/star/uno/Sequence.hxx>
28 #include <rtl/ref.hxx>
29 #include <rtl/ustring.hxx>
30 #include <tools/link.hxx>
31 #include <vcl/weld.hxx>
33 #include "dp_gui_updatedata.hxx"
35 /// @HTML
37 class Image;
38 class KeyEvent;
39 class MouseEvent;
40 class ResId;
41 namespace vcl { class Window; }
43 namespace com { namespace sun { namespace star {
44 namespace deployment { class XExtensionManager;
45 class XPackage; }
46 namespace uno { class XComponentContext; }
47 } } }
49 namespace dp_gui {
50 /**
51 The modal &ldquo;Check for Updates&rdquo; dialog.
53 class UpdateDialog: public weld::GenericDialogController {
54 public:
55 /**
56 Create an instance.
58 <p>Exactly one of <code>selectedPackages</code> and
59 <code>packageManagers</code> must be non-null.</p>
61 @param context
62 a non-null component context
64 @param parent
65 the parent window, may be null
67 @param vExtensionList
68 check for updates for the contained extensions. There must only be one extension with
69 a particular identifier. If one extension is installed in several repositories, then the
70 one with the highest version must be used, because it contains the latest known update
71 information.
73 UpdateDialog(
74 css::uno::Reference< css::uno::XComponentContext > const & context,
75 weld::Window * parent,
76 const std::vector< css::uno::Reference<
77 css::deployment::XPackage > > & vExtensionList,
78 std::vector< dp_gui::UpdateData > * updateData);
80 virtual ~UpdateDialog() override;
82 virtual short run() override;
84 void notifyMenubar( bool bPrepareOnly, bool bRecheckOnly );
85 static void createNotifyJob( bool bPrepareOnly,
86 css::uno::Sequence< css::uno::Sequence< OUString > > const &rItemList );
88 private:
89 UpdateDialog(UpdateDialog const &) = delete;
90 UpdateDialog& operator =(UpdateDialog const &) = delete;
92 struct DisabledUpdate;
93 struct SpecificError;
94 struct IgnoredUpdate;
95 struct Index;
96 friend struct Index;
97 class Thread;
98 friend class Thread;
100 friend class CheckListBox;
102 void insertItem(UpdateDialog::Index *pIndex, bool bEnableCheckBox);
103 void addAdditional(UpdateDialog::Index *pIndex, bool bEnableCheckBox);
104 bool isIgnoredUpdate( UpdateDialog::Index *pIndex );
106 void addEnabledUpdate( OUString const & name, dp_gui::UpdateData const & data );
107 void addDisabledUpdate( UpdateDialog::DisabledUpdate const & data );
108 void addSpecificError( UpdateDialog::SpecificError const & data );
110 void checkingDone();
112 void enableOk();
114 void getIgnoredUpdates();
116 void initDescription();
117 void clearDescription();
118 bool showDescription(css::uno::Reference<
119 css::deployment::XPackage > const & aExtension);
120 bool showDescription(std::pair< OUString, OUString > const & pairPublisher,
121 OUString const & sReleaseNotes);
122 bool showDescription( css::uno::Reference<
123 css::xml::dom::XNode > const & aUpdateInfo);
124 bool showDescription( const OUString& rDescription);
126 DECL_LINK(selectionHandler, weld::TreeView&, void);
127 DECL_LINK(allHandler, weld::ToggleButton&, void);
128 DECL_LINK(okHandler, weld::Button&, void);
129 DECL_LINK(closeHandler, weld::Button&, void);
130 typedef std::pair<int, int> row_col;
131 DECL_LINK(entryToggled, const row_col&, void);
133 css::uno::Reference< css::uno::XComponentContext > m_context;
134 OUString m_none;
135 OUString m_noInstallable;
136 OUString m_failure;
137 OUString m_unknownError;
138 OUString m_noDescription;
139 OUString m_noInstall;
140 OUString m_noDependency;
141 OUString m_noDependencyCurVer;
142 OUString m_browserbased;
143 OUString m_version;
144 OUString m_ignoredUpdate;
145 std::vector< dp_gui::UpdateData > m_enabledUpdates;
146 std::vector< UpdateDialog::DisabledUpdate > m_disabledUpdates;
147 std::vector< UpdateDialog::SpecificError > m_specificErrors;
148 std::vector< std::unique_ptr<UpdateDialog::IgnoredUpdate> > m_ignoredUpdates;
149 std::vector< std::unique_ptr<Index> > m_ListboxEntries;
150 std::vector< dp_gui::UpdateData > & m_updateData;
151 rtl::Reference< UpdateDialog::Thread > m_thread;
152 css::uno::Reference< css::deployment::XExtensionManager > m_xExtensionManager;
154 std::unique_ptr<weld::Label> m_xChecking;
155 std::unique_ptr<weld::Spinner> m_xThrobber;
156 std::unique_ptr<weld::Label> m_xUpdate;
157 std::unique_ptr<weld::TreeView> m_xUpdates;
158 std::unique_ptr<weld::CheckButton> m_xAll;
159 std::unique_ptr<weld::Label> m_xDescription;
160 std::unique_ptr<weld::Label> m_xPublisherLabel;
161 std::unique_ptr<weld::LinkButton> m_xPublisherLink;
162 std::unique_ptr<weld::Label> m_xReleaseNotesLabel;
163 std::unique_ptr<weld::LinkButton> m_xReleaseNotesLink;
164 std::unique_ptr<weld::TextView> m_xDescriptions;
165 std::unique_ptr<weld::Button> m_xOk;
166 std::unique_ptr<weld::Button> m_xClose;
167 std::unique_ptr<weld::Button> m_xHelp;
172 #endif
174 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */