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