LibreOffice Module desktop (master)  1
dp_gui_updatedialog.hxx
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 #pragma once
21 
22 #include <sal/config.h>
23 
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>
31 
32 #include "dp_gui_updatedata.hxx"
33 
35 
36 class Image;
37 class KeyEvent;
38 class MouseEvent;
39 class ResId;
40 
41 namespace com::sun::star {
42  namespace deployment { class XExtensionManager;
43  class XPackage; }
44  namespace uno { class XComponentContext; }
45 }
46 
47 namespace dp_gui {
52 public:
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);
76 
77  virtual ~UpdateDialog() override;
78 
79  virtual short run() override;
80 
81  void notifyMenubar( bool bPrepareOnly, bool bRecheckOnly );
82  static void createNotifyJob( bool bPrepareOnly,
83  css::uno::Sequence< css::uno::Sequence< OUString > > const &rItemList );
84 
85 private:
86  UpdateDialog(UpdateDialog const &) = delete;
87  UpdateDialog& operator =(UpdateDialog const &) = delete;
88 
89  struct DisabledUpdate;
90  struct SpecificError;
91  struct IgnoredUpdate;
92  struct Index;
93  friend struct Index;
94  class Thread;
95  friend class Thread;
96 
97  friend class CheckListBox;
98 
99  void insertItem(const UpdateDialog::Index *pIndex, bool bEnableCheckBox);
100  void addAdditional(const UpdateDialog::Index *pIndex, bool bEnableCheckBox);
101  bool isIgnoredUpdate( UpdateDialog::Index *pIndex );
102 
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 );
106 
107  void checkingDone();
108 
109  void enableOk();
110 
111  void getIgnoredUpdates();
112 
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);
122 
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);
128 
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;
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;
148  css::uno::Reference< css::deployment::XExtensionManager > m_xExtensionManager;
149 
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;
164 };
165 
166 }
167 
168 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::unique_ptr< weld::TextView > m_xDescriptions
std::unique_ptr< weld::Button > m_xHelp
bool showDescription(css::uno::Reference< css::deployment::XPackage > const &aExtension)
std::vector< UpdateDialog::SpecificError > m_specificErrors
std::vector< dp_gui::UpdateData > m_enabledUpdates
UpdateDialog(css::uno::Reference< css::uno::XComponentContext > const &context, weld::Window *parent, std::vector< css::uno::Reference< css::deployment::XPackage > > &&vExtensionList, std::vector< dp_gui::UpdateData > *updateData)
Create an instance.
std::unique_ptr< weld::Label > m_xDescription
void insertItem(const UpdateDialog::Index *pIndex, bool bEnableCheckBox)
virtual short run() override
void notifyMenubar(bool bPrepareOnly, bool bRecheckOnly)
static void createNotifyJob(bool bPrepareOnly, css::uno::Sequence< css::uno::Sequence< OUString > > const &rItemList)
std::unique_ptr< weld::Label > m_xChecking
rtl::Reference< UpdateDialog::Thread > m_thread
std::vector< dp_gui::UpdateData > & m_updateData
UpdateDialog & operator=(UpdateDialog const &)=delete
std::unique_ptr< weld::LinkButton > m_xPublisherLink
std::pair< const TreeIter &, int > iter_col
std::unique_ptr< weld::TreeView > m_xUpdates
std::unique_ptr< weld::Button > m_xClose
void addSpecificError(UpdateDialog::SpecificError const &data)
std::vector< std::unique_ptr< Index > > m_ListboxEntries
std::unique_ptr< weld::Spinner > m_xThrobber
std::unique_ptr< weld::Label > m_xReleaseNotesLabel
bool isIgnoredUpdate(UpdateDialog::Index *pIndex)
std::unique_ptr< weld::CheckButton > m_xAll
The modal “Check for Updates” dialog.
void addAdditional(const UpdateDialog::Index *pIndex, bool bEnableCheckBox)
std::unique_ptr< weld::Button > m_xOk
css::uno::Reference< css::uno::XComponentContext > m_context
std::vector< UpdateDialog::DisabledUpdate > m_disabledUpdates
std::vector< std::unique_ptr< UpdateDialog::IgnoredUpdate > > m_ignoredUpdates
std::unique_ptr< weld::Label > m_xPublisherLabel
DECL_LINK(selectionHandler, weld::TreeView &, void)
std::unique_ptr< weld::LinkButton > m_xReleaseNotesLink
std::unique_ptr< weld::Label > m_xUpdate
void addDisabledUpdate(UpdateDialog::DisabledUpdate const &data)
virtual ~UpdateDialog() override
Definition: dp_gui.h:22
void addEnabledUpdate(OUString const &name, dp_gui::UpdateData const &data)
struct _ADOIndex Index
css::uno::Reference< css::deployment::XExtensionManager > m_xExtensionManager