Line data Source code
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 : #ifndef INCLUDED_DESKTOP_SOURCE_DEPLOYMENT_GUI_DP_GUI_UPDATEDIALOG_HXX
21 : #define INCLUDED_DESKTOP_SOURCE_DEPLOYMENT_GUI_DP_GUI_UPDATEDIALOG_HXX
22 :
23 : #include <sal/config.h>
24 :
25 : #include <vector>
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 <svtools/svlbitm.hxx>
31 : #include <svx/checklbx.hxx>
32 : #include <tools/link.hxx>
33 : #include <vcl/layout.hxx>
34 : #include <vcl/button.hxx>
35 : #include <vcl/dialog.hxx>
36 : #include <vcl/fixed.hxx>
37 : #include <vcl/fixedhyper.hxx>
38 : #include <vcl/throbber.hxx>
39 :
40 : #include "dp_gui_updatedata.hxx"
41 :
42 : /// @HTML
43 :
44 : class Image;
45 : class KeyEvent;
46 : class MouseEvent;
47 : class ResId;
48 : namespace vcl { class Window; }
49 :
50 : namespace com { namespace sun { namespace star {
51 : namespace deployment { class XExtensionManager;
52 : class XPackage; }
53 : namespace uno { class XComponentContext; }
54 : } } }
55 :
56 : namespace dp_gui {
57 : /**
58 : The modal “Check for Updates” dialog.
59 : */
60 : class UpdateDialog: public ModalDialog {
61 : public:
62 : /**
63 : Create an instance.
64 :
65 : <p>Exactly one of <code>selectedPackages</code> and
66 : <code>packageManagers</code> must be non-null.</p>
67 :
68 : @param context
69 : a non-null component context
70 :
71 : @param parent
72 : the parent window, may be null
73 :
74 : @param vExtensionList
75 : check for updates for the contained extensions. There must only be one extension with
76 : a particular identifier. If one extension is installed in several repositories, then the
77 : one with the highest version must be used, because it contains the latest known update
78 : information.
79 : */
80 : UpdateDialog(
81 : com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > const & context,
82 : vcl::Window * parent,
83 : const std::vector< com::sun::star::uno::Reference<
84 : com::sun::star::deployment::XPackage > > & vExtensionList,
85 : std::vector< dp_gui::UpdateData > * updateData);
86 :
87 : virtual ~UpdateDialog();
88 : virtual void dispose() SAL_OVERRIDE;
89 :
90 : virtual bool Close() SAL_OVERRIDE;
91 :
92 : virtual short Execute() SAL_OVERRIDE;
93 :
94 : void notifyMenubar( bool bPrepareOnly, bool bRecheckOnly );
95 : static void createNotifyJob( bool bPrepareOnly,
96 : com::sun::star::uno::Sequence< com::sun::star::uno::Sequence< OUString > > &rItemList );
97 :
98 : private:
99 : UpdateDialog(UpdateDialog &) SAL_DELETED_FUNCTION;
100 : void operator =(UpdateDialog &) SAL_DELETED_FUNCTION;
101 :
102 : struct DisabledUpdate;
103 : struct SpecificError;
104 : struct IgnoredUpdate;
105 : struct Index;
106 : friend struct Index;
107 : class Thread;
108 : friend class Thread;
109 :
110 0 : class CheckListBox: public SvxCheckListBox {
111 : public:
112 : CheckListBox(
113 : vcl::Window* pParent, UpdateDialog & dialog);
114 :
115 : sal_uInt16 getItemCount() const;
116 :
117 : private:
118 : CheckListBox(UpdateDialog::CheckListBox &) SAL_DELETED_FUNCTION;
119 : void operator =(UpdateDialog::CheckListBox &) SAL_DELETED_FUNCTION;
120 :
121 : virtual void MouseButtonDown(MouseEvent const & event) SAL_OVERRIDE;
122 : virtual void MouseButtonUp(MouseEvent const & event) SAL_OVERRIDE;
123 : virtual void KeyInput(KeyEvent const & event) SAL_OVERRIDE;
124 :
125 : void handlePopupMenu( const Point &rPos );
126 :
127 : OUString m_ignoreUpdate;
128 : OUString m_ignoreAllUpdates;
129 : OUString m_enableUpdate;
130 : UpdateDialog & m_dialog;
131 : };
132 :
133 :
134 : friend class CheckListBox;
135 :
136 : sal_uInt16 insertItem( UpdateDialog::Index *pIndex, SvLBoxButtonKind kind );
137 : void addAdditional( UpdateDialog::Index *pIndex, SvLBoxButtonKind kind );
138 : bool isIgnoredUpdate( UpdateDialog::Index *pIndex );
139 : void setIgnoredUpdate( UpdateDialog::Index *pIndex, bool bIgnore, bool bIgnoreAll );
140 :
141 : void addEnabledUpdate( OUString const & name, dp_gui::UpdateData & data );
142 : void addDisabledUpdate( UpdateDialog::DisabledUpdate & data );
143 : void addSpecificError( UpdateDialog::SpecificError & data );
144 :
145 : void checkingDone();
146 :
147 : void enableOk();
148 :
149 : void getIgnoredUpdates();
150 : void storeIgnoredUpdates();
151 :
152 : void initDescription();
153 : void clearDescription();
154 : bool showDescription(::com::sun::star::uno::Reference<
155 : ::com::sun::star::deployment::XPackage > const & aExtension);
156 : bool showDescription(std::pair< OUString, OUString > const & pairPublisher,
157 : OUString const & sReleaseNotes);
158 : bool showDescription( ::com::sun::star::uno::Reference<
159 : ::com::sun::star::xml::dom::XNode > const & aUpdateInfo);
160 : bool showDescription( const OUString& rDescription);
161 : bool isReadOnly( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ) const;
162 :
163 : DECL_LINK(selectionHandler, void *);
164 : DECL_LINK(allHandler, void *);
165 : DECL_LINK(okHandler, void *);
166 : DECL_LINK(closeHandler, void *);
167 : DECL_LINK(hyperlink_clicked, FixedHyperlink *);
168 :
169 : com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
170 : m_context;
171 : VclPtr<FixedText> m_pchecking;
172 : VclPtr<Throbber> m_pthrobber;
173 : VclPtr<FixedText> m_pUpdate;
174 : VclPtr<VclViewport> m_pContainer;
175 : VclPtr<UpdateDialog::CheckListBox> m_pUpdates;
176 : VclPtr<CheckBox> m_pAll;
177 : VclPtr<FixedText> m_pDescription;
178 : VclPtr<FixedText> m_pPublisherLabel;
179 : VclPtr<FixedHyperlink> m_pPublisherLink;
180 : VclPtr<FixedText> m_pReleaseNotesLabel;
181 : VclPtr<FixedHyperlink> m_pReleaseNotesLink;
182 : VclPtr<VclMultiLineEdit> m_pDescriptions;
183 : VclPtr<HelpButton> m_pHelp;
184 : VclPtr<PushButton> m_pOk;
185 : VclPtr<PushButton> m_pClose;
186 : OUString m_error;
187 : OUString m_none;
188 : OUString m_noInstallable;
189 : OUString m_failure;
190 : OUString m_unknownError;
191 : OUString m_noDescription;
192 : OUString m_noInstall;
193 : OUString m_noDependency;
194 : OUString m_noDependencyCurVer;
195 : OUString m_browserbased;
196 : OUString m_version;
197 : OUString m_ignoredUpdate;
198 : std::vector< dp_gui::UpdateData > m_enabledUpdates;
199 : std::vector< UpdateDialog::DisabledUpdate > m_disabledUpdates;
200 : std::vector< UpdateDialog::SpecificError > m_specificErrors;
201 : std::vector< UpdateDialog::IgnoredUpdate* > m_ignoredUpdates;
202 : std::vector< Index* > m_ListboxEntries;
203 : std::vector< dp_gui::UpdateData > & m_updateData;
204 : rtl::Reference< UpdateDialog::Thread > m_thread;
205 : ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XExtensionManager > m_xExtensionManager;
206 :
207 : Point m_aFirstLinePos;
208 : Size m_aFirstLineSize;
209 : long m_nFirstLineDelta;
210 : long m_nOneLineMissing;
211 : sal_uInt16 m_nLastID;
212 : bool m_bModified;
213 : };
214 :
215 : }
216 :
217 : #endif
218 :
219 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|