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 namespace vcl { class Window; }
41 
42 namespace com::sun::star {
43  namespace deployment { class XExtensionManager;
44  class XPackage; }
45  namespace uno { class XComponentContext; }
46 }
47 
48 namespace dp_gui {
53 public:
73  css::uno::Reference< css::uno::XComponentContext > const & context,
74  weld::Window * parent,
75  const std::vector< css::uno::Reference<
76  css::deployment::XPackage > > & vExtensionList,
77  std::vector< dp_gui::UpdateData > * updateData);
78 
79  virtual ~UpdateDialog() override;
80 
81  virtual short run() override;
82 
83  void notifyMenubar( bool bPrepareOnly, bool bRecheckOnly );
84  static void createNotifyJob( bool bPrepareOnly,
85  css::uno::Sequence< css::uno::Sequence< OUString > > const &rItemList );
86 
87 private:
88  UpdateDialog(UpdateDialog const &) = delete;
89  UpdateDialog& operator =(UpdateDialog const &) = delete;
90 
91  struct DisabledUpdate;
92  struct SpecificError;
93  struct IgnoredUpdate;
94  struct Index;
95  friend struct Index;
96  class Thread;
97  friend class Thread;
98 
99  friend class CheckListBox;
100 
101  void insertItem(UpdateDialog::Index *pIndex, bool bEnableCheckBox);
102  void addAdditional(UpdateDialog::Index *pIndex, bool bEnableCheckBox);
103  bool isIgnoredUpdate( UpdateDialog::Index *pIndex );
104 
105  void addEnabledUpdate( OUString const & name, dp_gui::UpdateData const & data );
106  void addDisabledUpdate( UpdateDialog::DisabledUpdate const & data );
107  void addSpecificError( UpdateDialog::SpecificError const & data );
108 
109  void checkingDone();
110 
111  void enableOk();
112 
113  void getIgnoredUpdates();
114 
115  void initDescription();
116  void clearDescription();
117  bool showDescription(css::uno::Reference<
118  css::deployment::XPackage > const & aExtension);
119  bool showDescription(std::pair< OUString, OUString > const & pairPublisher,
120  OUString const & sReleaseNotes);
121  bool showDescription( css::uno::Reference<
122  css::xml::dom::XNode > const & aUpdateInfo);
123  bool showDescription( const OUString& rDescription);
124 
125  DECL_LINK(selectionHandler, weld::TreeView&, void);
126  DECL_LINK(allHandler, weld::ToggleButton&, void);
127  DECL_LINK(okHandler, weld::Button&, void);
128  DECL_LINK(closeHandler, weld::Button&, void);
129  DECL_LINK(entryToggled, const weld::TreeView::iter_col&, void);
130 
131  css::uno::Reference< css::uno::XComponentContext > m_context;
132  OUString m_none;
133  OUString m_noInstallable;
134  OUString m_failure;
135  OUString m_unknownError;
136  OUString m_noDescription;
137  OUString m_noInstall;
138  OUString m_noDependency;
140  OUString m_browserbased;
141  OUString m_version;
142  OUString m_ignoredUpdate;
143  std::vector< dp_gui::UpdateData > m_enabledUpdates;
144  std::vector< UpdateDialog::DisabledUpdate > m_disabledUpdates;
145  std::vector< UpdateDialog::SpecificError > m_specificErrors;
146  std::vector< std::unique_ptr<UpdateDialog::IgnoredUpdate> > m_ignoredUpdates;
147  std::vector< std::unique_ptr<Index> > m_ListboxEntries;
148  std::vector< dp_gui::UpdateData > & m_updateData;
150  css::uno::Reference< css::deployment::XExtensionManager > m_xExtensionManager;
151 
152  std::unique_ptr<weld::Label> m_xChecking;
153  std::unique_ptr<weld::Spinner> m_xThrobber;
154  std::unique_ptr<weld::Label> m_xUpdate;
155  std::unique_ptr<weld::TreeView> m_xUpdates;
156  std::unique_ptr<weld::CheckButton> m_xAll;
157  std::unique_ptr<weld::Label> m_xDescription;
158  std::unique_ptr<weld::Label> m_xPublisherLabel;
159  std::unique_ptr<weld::LinkButton> m_xPublisherLink;
160  std::unique_ptr<weld::Label> m_xReleaseNotesLabel;
161  std::unique_ptr<weld::LinkButton> m_xReleaseNotesLink;
162  std::unique_ptr<weld::TextView> m_xDescriptions;
163  std::unique_ptr<weld::Button> m_xOk;
164  std::unique_ptr<weld::Button> m_xClose;
165  std::unique_ptr<weld::Button> m_xHelp;
166 };
167 
168 }
169 
170 /* 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
std::unique_ptr< weld::Label > m_xDescription
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
UpdateDialog(css::uno::Reference< css::uno::XComponentContext > const &context, weld::Window *parent, const std::vector< css::uno::Reference< css::deployment::XPackage > > &vExtensionList, std::vector< dp_gui::UpdateData > *updateData)
Create an instance.
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
void insertItem(UpdateDialog::Index *pIndex, bool bEnableCheckBox)
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(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