1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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>
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"
41 namespace vcl
{ class Window
; }
43 namespace com
{ namespace sun
{ namespace star
{
44 namespace deployment
{ class XExtensionManager
;
46 namespace uno
{ class XComponentContext
; }
51 The modal “Check for Updates” dialog.
53 class UpdateDialog
: public weld::GenericDialogController
{
58 <p>Exactly one of <code>selectedPackages</code> and
59 <code>packageManagers</code> must be non-null.</p>
62 a non-null component context
65 the parent window, may be null
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
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
);
89 UpdateDialog(UpdateDialog
const &) = delete;
90 UpdateDialog
& operator =(UpdateDialog
const &) = delete;
92 struct DisabledUpdate
;
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
);
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
;
135 OUString m_noInstallable
;
137 OUString m_unknownError
;
138 OUString m_noDescription
;
139 OUString m_noInstall
;
140 OUString m_noDependency
;
141 OUString m_noDependencyCurVer
;
142 OUString m_browserbased
;
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
;
174 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */