use insert function instead of for loop
[LibreOffice.git] / desktop / source / deployment / gui / dp_gui_updatedialog.hxx
blobcbf376955d22150a1e197a42bdbe888dc8e47ea0
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 <vector>
25 #include <com/sun/star/uno/Reference.hxx>
26 #include <com/sun/star/uno/Sequence.hxx>
27 #include <rtl/ref.hxx>
28 #include <rtl/ustring.hxx>
29 #include <tools/link.hxx>
30 #include <vcl/weld.hxx>
32 #include "dp_gui_updatedata.hxx"
34 /// @HTML
36 class Image;
37 class KeyEvent;
38 class MouseEvent;
39 class ResId;
41 namespace com::sun::star {
42 namespace deployment { class XExtensionManager;
43 class XPackage; }
44 namespace uno { class XComponentContext; }
47 namespace dp_gui {
48 /**
49 The modal &ldquo;Check for Updates&rdquo; dialog.
51 class UpdateDialog: public weld::GenericDialogController {
52 public:
53 /**
54 Create an instance.
56 <p>Exactly one of <code>selectedPackages</code> and
57 <code>packageManagers</code> must be non-null.</p>
59 @param context
60 a non-null component context
62 @param parent
63 the parent window, may be null
65 @param vExtensionList
66 check for updates for the contained extensions. There must only be one extension with
67 a particular identifier. If one extension is installed in several repositories, then the
68 one with the highest version must be used, because it contains the latest known update
69 information.
71 UpdateDialog(
72 css::uno::Reference< css::uno::XComponentContext > const & context,
73 weld::Window * parent,
74 std::vector< css::uno::Reference< css::deployment::XPackage > > && vExtensionList,
75 std::vector< dp_gui::UpdateData > * updateData);
77 virtual ~UpdateDialog() override;
79 virtual short run() override;
81 void notifyMenubar( bool bPrepareOnly, bool bRecheckOnly );
82 static void createNotifyJob( bool bPrepareOnly,
83 css::uno::Sequence< css::uno::Sequence< OUString > > const &rItemList );
85 private:
86 UpdateDialog(UpdateDialog const &) = delete;
87 UpdateDialog& operator =(UpdateDialog const &) = delete;
89 struct DisabledUpdate;
90 struct SpecificError;
91 struct IgnoredUpdate;
92 struct Index;
93 friend struct Index;
94 class Thread;
95 friend class Thread;
97 friend class CheckListBox;
99 void insertItem(const UpdateDialog::Index *pIndex, bool bEnableCheckBox);
100 void addAdditional(const UpdateDialog::Index *pIndex, bool bEnableCheckBox);
101 bool isIgnoredUpdate( UpdateDialog::Index *pIndex );
103 void addEnabledUpdate( OUString const & name, dp_gui::UpdateData const & data );
104 void addDisabledUpdate( UpdateDialog::DisabledUpdate const & data );
105 void addSpecificError( UpdateDialog::SpecificError const & data );
107 void checkingDone();
109 void enableOk();
111 void getIgnoredUpdates();
113 void initDescription();
114 void clearDescription();
115 bool showDescription(css::uno::Reference<
116 css::deployment::XPackage > const & aExtension);
117 bool showDescription(std::pair< OUString, OUString > const & pairPublisher,
118 OUString const & sReleaseNotes);
119 bool showDescription( css::uno::Reference<
120 css::xml::dom::XNode > const & aUpdateInfo);
121 bool showDescription( const OUString& rDescription);
123 DECL_LINK(selectionHandler, weld::TreeView&, void);
124 DECL_LINK(allHandler, weld::Toggleable&, void);
125 DECL_LINK(okHandler, weld::Button&, void);
126 DECL_LINK(closeHandler, weld::Button&, void);
127 DECL_LINK(entryToggled, const weld::TreeView::iter_col&, void);
129 css::uno::Reference< css::uno::XComponentContext > m_context;
130 OUString m_none;
131 OUString m_noInstallable;
132 OUString m_failure;
133 OUString m_unknownError;
134 OUString m_noDescription;
135 OUString m_noInstall;
136 OUString m_noDependency;
137 OUString m_noDependencyCurVer;
138 OUString m_browserbased;
139 OUString m_version;
140 OUString m_ignoredUpdate;
141 std::vector< dp_gui::UpdateData > m_enabledUpdates;
142 std::vector< UpdateDialog::DisabledUpdate > m_disabledUpdates;
143 std::vector< UpdateDialog::SpecificError > m_specificErrors;
144 std::vector< std::unique_ptr<UpdateDialog::IgnoredUpdate> > m_ignoredUpdates;
145 std::vector< std::unique_ptr<Index> > m_ListboxEntries;
146 std::vector< dp_gui::UpdateData > & m_updateData;
147 rtl::Reference< UpdateDialog::Thread > m_thread;
148 css::uno::Reference< css::deployment::XExtensionManager > m_xExtensionManager;
150 std::unique_ptr<weld::Label> m_xChecking;
151 std::unique_ptr<weld::Spinner> m_xThrobber;
152 std::unique_ptr<weld::Label> m_xUpdate;
153 std::unique_ptr<weld::TreeView> m_xUpdates;
154 std::unique_ptr<weld::CheckButton> m_xAll;
155 std::unique_ptr<weld::Label> m_xDescription;
156 std::unique_ptr<weld::Label> m_xPublisherLabel;
157 std::unique_ptr<weld::LinkButton> m_xPublisherLink;
158 std::unique_ptr<weld::Label> m_xReleaseNotesLabel;
159 std::unique_ptr<weld::LinkButton> m_xReleaseNotesLink;
160 std::unique_ptr<weld::TextView> m_xDescriptions;
161 std::unique_ptr<weld::Button> m_xOk;
162 std::unique_ptr<weld::Button> m_xClose;
163 std::unique_ptr<weld::Button> m_xHelp;
168 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */