Commit Graph
646 Commits
Author SHA1 Message Date
Michael Weghorn 03d5d803c4 weld: Switch TreeView selection changed signal param to ItemView
Switch the param for the signal and handlers used when
the selection in a weld::TreeView changes from weld::TreeView&
to the base class, weld::ItemView&.

This is in preparation of moving the logic to the weld::ItemView
base class in an upcoming commit.

Handler implementations that require a weld::TreeView
instance can use the one that the signal is connected
to, e.g. use the class member directly inside of the
implementation instead of using the param (as is done
in most of the places anyway).

Change-Id: I0bbf8fe1dbd95906a5224155d48d832bcd144532
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/203366
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2026-04-10 06:36:08 +02:00
Michael Weghorn 8ff8ad952e weld: Rename row activation related TreeView members to match IconView
Rename methods and field related to signalling activation
of a weld::TreeView row to use the same names as the equivalent
ones for signalling activation of an entry in weld::IconView:

* weld::TreeView::m_aRowActivatedHdl -> weld::TreeView::m_aItemActivatedHdl
* weld::TreeView::signal_row_activated -> weld::TreeView::signal_item_activated
* weld::TreeView::connect_row_activated -> weld::TreeView::connect_item_activated

This is in preparation of deduplicating the weld::TreeView
and weld::IconView implementations for these by moving them
to the common weld::ItemView base class in an upcoming commit.

Change-Id: I4ca4dec1295c57cea574b68fd41b89c12144c4f9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/203350
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2026-04-10 06:29:43 +02:00
Michael Weghorn 11789e47ac weld: Pass activated row in TreeView::signal_row_activated
This is basically the weld::TreeView version of earlier
commit

        Change-Id: I8ca62ac32108f01e2055d5ef9301de22eb5b1931
        Author: Michael Weghorn <m.weghorn@posteo.de>
        Date:   Wed Apr 8 12:35:25 2026 +0200

            weld: Pass activated item in IconView::signal_item_activated

applying an equivalent change for weld::IconView instead
of weld::TreeView. See that commit for more details/background.

For weld::TreeView, the weld::TreeIter refers to
a full row (and columns are handled separately
by a column index in the weld::TreeView API).

As for the above commit:
Initially, leave the logic of the existing signal handlers/callbackes
(in dialog implementations) unchanged. At least some of them
will be simplified in upcoming commits to use the
newly passed weld::TreeIter param directly instead of
determining the current/activated row a different
way.

Change-Id: Ie6a962702d4f7f069b2f7b77a22a78722b2a6408
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/203331
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2026-04-09 10:21:45 +02:00
Michael Weghorn fbcfd00fb7 weld: Move weld::Dialog to own header/source
Move the class out of weld.hxx into its own header and source
file, in order to make it easier to keep an overview and to avoid
having to recompile ~all UI code when the class is
modified.

Change-Id: Ic47dac553fc065c5c9cddbf31e33012314dbe43d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199073
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2026-02-11 07:32:57 +01:00
Michael Weghorn ab3635b2f3 weld: Move weld::MessageDialog to own header
Move the class out of weld.hxx into its own header, in
order to make it easier to keep an overview and to avoid
having to recompile ~all UI code when the class is
modified.

Change-Id: I5b23b02151c75bb49831a2bbf8d515eb0b54415e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199068
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
2026-02-11 07:32:45 +01:00
Gabor Kelemen 495fa42afa tdf#146619 Use more forward declarations in include/vcl/weld/
after recent split of these headers

This shaves off another 150M input

Change-Id: Ia4e42781cdc6fd6e795c9fb55c6c24dd641b8f0d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197339
Reviewed-by: Gabor Kelemen <gabor.kelemen@collabora.com>
Tested-by: Jenkins
2026-01-31 11:06:42 +01:00
Michael Weghorn 82edaf048b weld: Return std::unique_ptr in weld::ItemView::get_selected
So far, the method had a weld:::TreeView* out param
and a bool return value, which indicated whether
or not a selected item actually exists (and was
set in the passed TreeIter).

Drop the method param and instead return a
std::unique_ptr<weld::TreeIter>. If it doesn't
own a pointer, there is no selection (i.e. the
case previously indicated by a `false` return
value). If it owns a weld::TreeIter, then
that one points to the (first) selected item.

This simplifies using this as it is no longer
necessary to separately create weld::TreeIter to
pass as an out param first, e.g.

    std::unique_ptr<weld::TreeIter> pEntry = rMyIconView.make_iterator());
    if (rMyIconView.get_selected(xEntry.get()))
    {
        // do sth
    }

now turns into

    if (std::unique_ptr<weld::TreeIter> xEntry = rMyIconView->get_selected())
    {
        // do sth
    }

Adjust all callers accordingly.

It might be worth looking into doing something
similar for other methods (e.g.
weld::ItemView::get_iter_first) as well.

Change-Id: I83146fc8d68a92d50eed9bd635bf91b1450ce495
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196039
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2025-12-22 09:18:39 +01:00
Michael Weghorn 5b16b3acc6 weld: Move weld.hxx and weldutils.hxx to new include/vcl/weld subdir
This is in preparation of moving code out of weld.hxx
to separate headers/source files, in order to make it
easier to keep an overview and to avoid having to
recompile ~all UI code when anything changes.

Also move weldutils.cxx to a new vcl/source/weld
directory.

Change-Id: Ia75b42f21e560dd248307282a522f186a64cd742
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195777
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2025-12-17 18:20:13 +01:00
Noel Grandin 4e2b089020 loplugin:stringloop
resurrect the plugin and run it over the codebase

Change-Id: I443a75961124aabd1e62b3c4bc166d52e4621b52
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194870
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
2025-12-01 14:25:01 +01:00
Caolán McNamara d752e23e41 drop coverity workarounds that no longer seem needed
since version 2024

Change-Id: I81b3c04087f0f9db181311cbfdd95a04b229b1be
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189276
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins
2025-08-10 11:51:43 +02:00
Caolán McNamara 5568801a46 cid#1556634 Variable copied when it could be moved
cid#1659641 Variable copied when it could be moved
cid#1659647 Variable copied when it could be moved
cid#1659650 Variable copied when it could be moved
cid#1659663 Variable copied when it could be moved
cid#1659685 Variable copied when it could be moved
cid#1659698 Variable copied when it could be moved
cid#1659703 Variable copied when it could be moved
cid#1659705 Variable copied when it could be moved

Change-Id: If0d399dcce73d47be105ac4b1c342bcc010c56c5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189181
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2025-08-09 00:45:51 +02:00
Mike Kaganski 3a4961af43 Use o3tl::{get,set}Environment instead of resp. osl_* functions
Simplifies the code, and avoids OUString internals access.
Also replace some getenv calls.

Change-Id: I5f7dc492fe87ea1fbaad6a61bc54e21f0f0c5aef
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187974
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2025-07-17 07:03:19 +02:00
Caolán McNamara 9e96f6977c column width missing in signature treeview column list
which causes some problems.

reproduce on desktop with:

SAL_USE_VCLPLUGIN=gen ./instdir/program/soffice xmlsecurity/qa/unit/signing/data/signatureline.odt
and the column with heading "Signature type" appears blank unless you
select the seperator between it and Description and move it, at which
point "XAdES" appears

while in lokit there is a out-of-bound crash:

 #8  0x00007f830d436902 in abort () from target:/lib64/libc.so.6
 #9  0x00007f830d6a84e9 in __gnu_debug::_Error_formatter::_M_error() const [clone .cold] () from target:/lib64/libstdc++.so.6
 #10 0x00007f830518aa13 in std::__debug::vector<std::unique_ptr<SvLBoxTab, std::default_delete<SvLBoxTab> >, std::allocator<std::unique_ptr<SvLBoxTab, std::default_delete<SvLBoxTab> > > >::operator[] (this=0x4e31dfa8, __n=6) at /usr/include/c++/14/debug/vector:517
 #11 0x00007f8305183b4d in SvTreeListBox::GetTab (this=0x4e31dbb0, pEntry=0x4e349e00, pItem=0x4b857ab0) at vcl/source/treelist/treelistbox.cxx:3203
 #12 0x00007f830513529c in lcl_DumpEntryAndSiblings (rJsonWriter=..., pEntry=0x4e349e00, pTabListBox=0x4e31dbb0, bCheckButtons=false)
     at vcl/source/treelist/svtabbx.cxx:102
 #13 0x00007f8305135f7b in SvTabListBox::DumpAsPropertyTree (this=0x4e31dbb0, rJsonWriter=...) at vcl/source/treelist/svtabbx.cxx:217
 #14 0x00007f830513868b in SvHeaderTabListBox::DumpAsPropertyTree (this=0x4e31dbb0, rJsonWriter=...) at vcl/source/treelist/svtabbx.cxx:647
 #15 0x00007f83058951b1 in JSDialogNotifyIdle::generateWidgetUpdate (this=0x4e32b530, pWindow=...) at vcl/jsdialog/jsdialogsender.cxx:111

Change-Id: Ia617d18c9cdf1170f50cbda3082e548777196dcd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187351
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
(cherry picked from commit 1cb5d4338d8467645494b5723b35aba031aea51b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187360
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins
2025-07-04 10:45:17 +02:00
Miklos Vajna 7d4222d008 cool#10630 doc electronic sign: fix insertion of the signature line
Have electronic signing configured in the LOK client, try to insert a
signature line, you'll get a certificate picker, while we don't have a
cert during esign.

What's in fact needed for creating the signature line is just a name
(previously extracted from the certificate), we can survive the lack of
actual certificate.

Fix the problem by adding a new External parameter to
.uno:InsertSignatureLine to hint that the certificate chooser should not
be opened, instead the editor name (used for comments already) should be
used. Add a new CertificateOrName in svl/ and use that in all places
where previously we wanted a certificate but in fact it's enough to have
a certificate or a name to create the signature line.

The name on the signature line is just visual feedback, the actual name
on the crypto signature is still not based on untrusted used input.

Change-Id: Ib7008112a8e28a9e7d9649745e6021dd6b6b9c39
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180193
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2025-01-13 17:53:43 +01:00
Michael Weghorn 57d532057b weld: Rename weld::Treeview selection signal/connect
Rename weld::TreeView member + methods to clarify
that these are about selection changes:

* m_aChangeHdl to m_aSelectionChangedHdl,
* signal_changed to signal_selection_changed
* connect_changed to connect_selection_changed

In GtkInstanceTreeview, also rename the
related methods calling signal_selection_changed
accordingly for consistency.

Change-Id: I299d7930484677395a0bdd0ff105df18688f2e04
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178023
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-12-07 11:15:03 +01:00
Miklos Vajna 0de900cec7 cool#9992 lok doc sign, hash extract: time for getCommandValues('Signature')
The final goal of this API is to give time & hash information about the
PDF signature, so once a 3rd-party produces the PKCS#7 signature, that
can be added to the document and the actual PDF sign can be re-run with
the same parameters.

This commit continues the replacement of XCertificate with
svl::crypto::SigningContext up to the point that the timestamp used in
svl/ can be exposed on the LOK API.

This is done by updating DocumentSignatureManager::add(),
PDFSignatureHelper::SetX509Certificate(),
vcl::filter::PDFDocument::Sign() and finally the svl::crypto::Signing
ctor to work with the signing context instead of an XCertificate
directly.

Time reporting works now, so add a test for that. The digest part still
needs doing.

Change-Id: I83f1274cd420b67194b7caf12b1027e623d4f7fe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176404
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
2024-11-11 21:54:23 +01:00
Noel Grandin ed0b12f4ea no need to take a copy of the getProcessComponentContext return value
we can just take a "const &".

(found by running clang-tidy with the
performance-unnecessary-copy-initialization warning)

Change-Id: I20fd208c65303da78170b1ac06c638fdf3aa094b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176267
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
2024-11-08 15:23:52 +01:00
Mike Kaganski 7e5f69aa33 Make tools::Time ctor taking sal_Int64 private
This ctor is meant to set the value of nTime directly; and that value
is not nanoseconds, but an encoded value, using SEC_/MIN_/HOUR_MASK.
But in some places, this ctor was misused for setting of nanoseconds,
which would only accidentally work for values less than one second.
All places that initialized tools::Time with 0, now use EMPTY.

This makes the ctor private; and for the very few cases where really
the encoded value of nTime is stored / restored, fromEncodedTime is
introduced.

Change-Id: I1f1994bd9aab1b51a41b1de637619049fe820da4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175283
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-10-21 10:30:58 +02:00
Xisco Fauli b237267685 tdf#163486: PVS: identical sub-expressions
Since
commit ad6f23d2a3
Author: TokieSan <eltokhy@aucegypt.edu>
Date:   Tue Jul 18 21:54:31 2023 +0300

    Added searching and filtering features to certificate chooser dialog

V501 	There are identical sub-expressions 'rCharClass.uppercase(sIssuer).indexOf(aSearchStr) < 0' to the left and to the right of the '&&' operator.

Change-Id: Ifdc4b371e6d8f79ad43236e10b86e8e5b03204a9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175284
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2024-10-20 21:59:37 +02:00
Miklos Vajna ced420ca70 cool#9992 lok doc sign: convert the certificate chooser dialog to async
1) Move the try-catch around assing a signature inside the block that
   already got the response from the certificate chooser, it's unlikely
   that choosing the certificate (and not yet signing) would fail.

2) Convert the dialog to async and allow it to be a jsdialog.

3) Hide not relevant widgets for LOK: we have a single signing
   certificate, so the search entry is not useful.

   The refresh button has an unclear purpose, as it was initially added
   in commit fb9874231f (Caching
   Certificates in the CertificateChooser dialog session-wise, 2023-08-26),
   but later commit efe414c4a8 (Don't reuse
   CertificateChooser instances, 2024-02-07) disabled this chaching. In any
   case, the certificate won't change during the lifetime of a single LOK
   view, so hide that as well.

4) Invoke the inner certificate viewer in an async way, too.

Change-Id: Ibf618ea7632cf801d1d9180b9aa7dd193c45ffda
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174215
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
2024-09-30 14:55:40 +02:00
Miklos Vajna a581dbf982 cool#9992 lok doc sign: only take sign cert from the view in the cert chooser
Have two views, in case both of them haver sign certs configured in the
NSS database, then the cert chooser would present both, which is not
wanted.

The problem is that the NSS database contains sign certs from all views,
so working from the database is not what we want for the LOK case.

Fix the problem by passing the SfxViewShell from the sign dialog to the
certificate chooser dialog, and then the chooser can work from the view
in LOK mode.

Searching for other uses of getPersonalCertificates(), the comphelper/
one is not relevant for the LOK case (gpg is disabled there); the PDF
case is only for the UNO API, so those don't necessarily need adjusting.

Change-Id: Ic7027b8d218b2bde3c8bf134a4b11c14fd9c3570
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174002
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
2024-09-27 10:01:30 +02:00
Miklos Vajna c57434559c cool#9992 lok doc sign: conditionally show the add button in the sign dialog
Open the sign dialog, the Add button is hidden, even if the LOK clients
initializes the view with a working signing certificate.

SfxMedium::SignContents_Impl() knows the correct view, but by the time
the execution arrives to the DigitalSignaturesDialog ctor, this info is
lost, so we don't know what is the current view.

Fix the problem by looking up the view of the object shell at UNO
command dispatch time, and passing that around, so the signature dialog
can also access it. If the view has a signing certificate configured,
then allow signing.

The certificate chooser triggered by this button still needs fixing.

Change-Id: I1fae63cea27ea1e68e938879f4507f53ade484f1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173964
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
2024-09-26 11:06:06 +02:00
Miklos Vajna 40ba7a5c25 cool#9992 lok doc sign: implement signature removal
Open an already signed document, click on the sign icon on the status
bar, notice how the button to remove a signature is hidden.

This was added in commit 71a8bad4b9
(jsdialog: enable Digital Signatures dialog, 2022-01-24), which exposed
the signatures dialog as a read-only jsdialog. The dialog was improved
recently to be a read-write jsdialog, so this is no longer needed.

But then DigitalSignaturesDialog::canRemove() had an inner non-async
message dialog. Fix that by converting canRemove() to async.

An additional problem could be that the document is not marked as
modified, so the LOK client code doesn't notice the document is updated
(to not have a signature), but we do update the last mod timestamp of
the file, which is meant to be enough.

Change-Id: I8e7ee22e4b1b8ce59dee3617bb2f22f8d734f31d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173428
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
2024-09-16 16:26:18 +02:00
Miklos Vajna 81d3aefd85 [API CHANGE] XDocumentDigitalSignatures: remove deprecated / unused functions
Some functions were already a stub and only aborted on calling them.
The *Package* functions were added in commit
c9ed2f359a (INTEGRATION: CWS xmlsec08
(1.4.24); FILE MERGED 2005/02/22 13:07:19 mt 1.4.24.1: #i36682# Accept
separate Stream for signatures..., 2005-03-10), but it seems nobody
called them.

This also means that DocumentSignatureMode is now never set to
DocumentSignatureMode::Package, so remove that as well.

It seems to be unlikely that this non-published service was used by
3rd-party code, since it was specific to the needs of sfx2/ code, not
generic functionality that could be useful in other contexts.

Change-Id: Icfed9a0e6568f6eb21f9236901af01f1915bf2f8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173313
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2024-09-13 10:27:14 +02:00
Miklos Vajna e5a0209d4b cool#9992 lok doc sign: allow sign of macros & the document itself in one step
Sign a document with macros (via file -> digital signatures -> digital
signatures), realize that you still get a warning on file open, sign the
macros in the document (via tools -> macros -> digital signature),
realize that you did this in the wrong order, so now you have to re-sign
the doc content.

The reason for this is that the macro signature only signs the macro
parts of the document (so you can still edit the document and the
signature is valid, as long as you don't touch macros), while the doc
content signature signs everything, including the macro signature, so
the order of the two matters.

Solve this trouble by adding a new setting that allows doing the two
signatures in one step. Do this by extending the doc content signing
code with an optional pre-step that first signs the document macros.
This is a bit tricky to do, since xmlsecurity/ gets an RW signature
stream and a RO document storage from sfx2/, but transferring one more
signature stream can solve this trouble.

Other tricky parts of the change:
1) The crypto signing is always done by libxmlsec, so
   DigitalSignaturesDialog::SetScriptingSignatureStream() has to update
   the storage of the sign manager's sign helper, otherwise, the hashes in
   the macro signature will be empty.
2) Signing reads the RO storage, so normally the macro signature
   would not be part of the doc signature when creating both signatures
   inside a single dialog. (The storage is only committed after the
   dialog ends.) Fix this problem by extending
   DocumentSignatureManager::add() and UriBindingHelper::OpenInputStream()
   to provide kind of an overlay when xmlsecurity/ gets a script signature
   stream: this way the macro signature will be part of the doc signature
   while the dialog is in progress. No overlay is needed later, once both
   streams are committed to the storage on dialog end.

Change-Id: Ic2728689997165595991d5ec59c7a2683286e22d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173263
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
2024-09-12 16:53:06 +02:00
Moritz Duge 6c640ee266 tdf#161909: show where the certs in the CertificateChooser are from
The NSS password dialog naming the Mozilla profile only shows up for
X.509 certs outside Windows. And the user may wrongly assume GPG keys
are from Thunderbird.

Change-Id: I23706309d57fe30cddcbcac16d7f3e20ee397f16
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171645
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
2024-08-13 01:09:51 +02:00
Moritz Duge 9383f83b05 tdf#161909: request GPG keys exclusively for chooseCertificatesImpl
For ODF encryption, only GPG keys are allowed. And key selection for this currently only works correctly, because all X.509 implementations (nss and mscrypt) yield empty results when asked for public keys (encryption).

This commit is a first step to make the selection for GPG keys explicit.
Other code still needs to be changed to make use of this new function
argument.

Change-Id: Ia6b8ecb901c0f54a9a58b1bd0efaa7154ffbd285
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171638
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
2024-08-13 01:07:28 +02:00
Moritz Duge 156c3c1e5a tdf#161909: Show key type in CertificateViewer.
Change-Id: I4277e342c573525dd668d0365b1d686fe33fd914
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171500
Reviewed-by: Moritz Duge <moritz.duge@allotropia.de>
Reviewed-by: Sarper Akdemir <sarper.akdemir@allotropia.de>
Tested-by: Jenkins
2024-08-08 10:34:29 +02:00
Sarper Akdemir 9786f8ea59 tdf#159040 tdf#162206: better the user key selection and test sign with default
fix GPG CertificateImpl::getSHA1Thumbprint not returning a
sequence of bytes as the thumbprint. (that is what the
documented API states, and what all of the code assumed.)

now /org.openoffice.UserProfile/Data/signingkey and
encryptionkey stores the key's SHA1Thumbprint for better
identification of keys. Previously on the key name was being
used.

fix annoying NSS Certificate Database password prompt
appearing on Tools->Options if the certificate database is
password protected.

improve Tools->Options->UserData user key selection and
display of information.

add a ui test for "Sign with default certificate"
interaction in the save dialog.

Change-Id: I1036856003f58f494838e0f81ca0fe18e821f528
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171395
Tested-by: Jenkins
Reviewed-by: Sarper Akdemir <sarper.akdemir@allotropia.de>
2024-08-05 13:15:31 +02:00
Moritz Duge 36a5899896 tdf#161909: Fix resizing and behavior for "View Certificate" dialog.
- Set appropriate larger default size.
- Disable editing of details area.
- Add comments to distinguish GPG and X.509 code.

Change-Id: Idcca012c1eef96c6daa78498e85da6f70c97a90f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170004
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
2024-07-25 10:21:39 +02:00
Samuel Mehrbrodt a19aa47546 tdf#161871 Revert "Removed Type and Usage Columns from Certificate Chooser"
The commit broke the display of all columns except the first one in all
backends except gtk3.

Also it's not clear why those columns are deemed superfluous;
see discussion in tdf#161871

This reverts commit 9f327102c4.

Change-Id: Idc3496122137f98c23bb7df8e36b17281fc948d3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170491
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>
2024-07-15 13:00:41 +02:00
Samuel Mehrbrodt b7a6d5752a tdf#108828 Show certificate selector again after cancelling password dialog
Change-Id: I0a57204c1885ca300d22832e5469d8918aec9ba6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170384
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>
2024-07-11 20:57:40 +02:00
Noel Grandin 6e26799069 loplugin:ostr in xmlsecurity
Change-Id: Ifb936c230f68447b3bb5993705adb5e5b790371f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167668
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
2024-05-15 18:03:51 +02:00
Moritz Duge 3bb9b0565a fix crash in CertificateChooser for GPG
mvUserData is still needed to keep it's content from being deleted.

Revert "Drop unused instance variable."

This reverts commit 687ae6ca01.

Change-Id: I689cfdaf8d4d62a3b53ff7fb318dc8c70b9e1c2d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167020
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
Tested-by: Jenkins
2024-05-03 15:39:52 +02:00
Moritz Duge 687ae6ca01 Drop unused instance variable.
Change-Id: Iee32e4348526e54e0cc45a54e55eddb6479248e0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166968
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>
2024-05-02 08:41:17 +02:00
Rafał Dobrakowski a0c53ab438 tdf#146619 Remove unused #includes from C/C++ files
the 'xmlsecurity' module was cleaned

Change-Id: If8fae797ed5586888022ecb09bab690d68ae7bd9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165593
Tested-by: Jenkins
Reviewed-by: Gabor Kelemen <gabor.kelemen.extern@allotropia.de>
2024-04-02 17:30:55 +02:00
Rafał Dobrakowski 03b00e03c2 tdf#146619 Remove unused #includes from C/C++ files
'xmlsecurity' module was cleaned.

Add some headers from xmlsec-wrapper.h in preparation
for its removal

Change-Id: Id66e6d40d4d5d980626832c0e2f6255fc31b4bcf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164639
Tested-by: Jenkins
Reviewed-by: Gabor Kelemen <gabor.kelemen.extern@allotropia.de>
2024-03-28 12:50:41 +01:00
Rafael Lima 6178387f7b tdf#159985 Warn about the need to reload file after changing macro security level
Change-Id: I191fd5d676d6d54fb0ef15652420afdceab2fc78
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164810
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
2024-03-19 14:48:34 +01:00
Gabor Kelemen f35ff76607 Remove SaveODFItem class
This is effectively unused since:
commit d22ab7b444

Change-Id: I6f646b7daf845035196fc9dde4ff270b8143d37a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164645
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
2024-03-12 18:49:26 +01:00
Patrick Luby ce8d6b6836 Related: tdf#152524 eliminate UserData struct name collision
The cui module has its own UserData struct and when building with
--enable-mergelibs=more, this data collision will cause a crash
when deleting a UserData instance in the xmlsecurity module because
the cui module already has its own, unrelated UserData struct.

Change-Id: I6418b049c72a2e902c9b5076b72fd240f65a593d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164404
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-03-05 18:35:14 +01:00
Patrick Luby efe414c4a8 Don't reuse CertificateChooser instances
Reusing the same instance will, in the following case, lead to a
crash. It appears that the CertificateChooser is getting disposed
somewhere as mpDialogImpl in its base class ends up being null:

1. Create an empty Writer document and add a digital signature
   in the Digital Signatures dialog
2. File > Save As the document, check the "Encrypt with GPG key"
   checkbox, press Encrypt, and crash in Dialog::ImplStartExecute()

Change-Id: I9aaa1bd449622e018b502d68c53d397255a1b61a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163065
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-by: Patrick Luby <guibomacdev@gmail.com>
2024-02-07 14:40:50 +01:00
Caolán McNamara cf4514d4e7 Resolves: tdf#156352 disable sorting while adding rows
looks like the new row gets sorted immediately when added as an empty
row into the first row, so accessing it by index later to set it text/id
get an unexpected result.

pause sorting while inserting the entries and enable it again when
finished for the easiest fix.

Change-Id: Ib028b193afbf2b9026841b19419e012b70448e39
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162993
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-02-05 13:41:00 +01:00
Patrick Luby 538f7b45c0 tdf#147291 add more default certificate manager application for macOS
Add the following applications to the macOS GUI servers list:

- Trusted Key Manager - CertEurope
- SCInterface Manager and SmartCard tools

Change-Id: Iec78171c6e82f0a072f5f06b79606560a8cc03cc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162942
Tested-by: Jenkins
Reviewed-by: Patrick Luby <guibomacdev@gmail.com>
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-02-05 09:03:56 +01:00
Patrick Luby 29bf86f7cb tdf#159307 add default macOS certificate manager applications
Most, if not all, of the Linux certificate manager applications are
not available on macOS so create a separate list for macOS.

Also, fix uncloseable windows due to uncaught exceptions thrown by
XSystemShellExecute::execute(). Failure to catch such exceptions
would cause the document window to be uncloseable and the application
to be unquittable.

Change-Id: I9bc6dc9c6c9d054252b634874045cb066023214a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162887
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-02-02 07:55:01 +01:00
Stephan Bergmann 32ef7cea77 tdf#159307 Fix GetCertificateManager
...which had always cut off an existing path ever since
92b6ffcd9f "Allow selecting a custom certificate
manager", for reasons that are unclear to me.

So if an existing setting contains at least one slash (or backslash, on
Windows), try to use it as-is; otherwise, keep searching for it in aPath.  (And,
in any case, make sure to report back the given value in sExecutable.)

Change-Id: I8b2b6ac7a449d7afd02e029ff46d4c79e6b824e1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162703
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-01-30 07:38:28 +01:00
Mike Kaganski 0fa827dbb2 Drop std::as_const from css::uno::Sequence iterations
Obsoleted by commit 2484de6728 (Remove
non-const Sequence::begin()/end() in internal code, 2021-10-15) and
commit fb3c04bd19 (Drop non-const
Sequence::operator[] in internal code, 2021-11-05).

Change-Id: Idbafef5d34c0d4771cbbf75b9db9712e504164cd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162640
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-01-27 12:43:48 +01:00
Michael Stahl 4eebf31e38 xmlsecurity: remove "AdES-compliant signature" checkbox
This is essentially a footgun because the user can accidentally turn it
off and get non-AdES signatures which use obsolete SHA1 hashes.

Unfortunately it turns out that the initial setting of the checkbox only
works for ODF, because OOXML have m_sODFVersion set to "1.0" due to some
defaulting code somewhere.

So what this checkbox actually did is unintentionally disable XAdES
signatures for OOXML by default.

Now that i actually test it by setting ODF version 1.1 in
Tools->Options, it turns out that signing ODF 1.1 documents isn't
possible at all, a dialog pops up that says "Signing documents
requires ODF 1.2 (OpenOffice.org 3.x)".

Change-Id: I0eaf590c290b2c0ee0ff890ed73f0dbea4cf0ce3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160785
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2023-12-15 10:52:04 +01:00
Michael Stahl 53c64cce13 xmlsecurity: fix assert in CertificateChooser::ImplInitialize()
gtk3/gtkinst.cxx:15371: virtual void (anonymous namespace)::GtkInstanceTreeView::select(int): Assertion `gtk_tree_view_get_model(m_pTreeView) && "don't select when frozen, select after thaw. Note selection doesn't survive a freeze"' failed.

(regression from commit ad6f23d2a3)

Change-Id: I8c0639e755188731bdd211f9d71a830d7afeeaa6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160786
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2023-12-15 10:51:22 +01:00
Arnaud VERSINI 0c4913e03e xmlsecurity : simplify DigitalSignature
Change-Id: I05777731f1d69b5714942411401afb5fd605d726
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155668
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-09-19 11:29:49 +02:00
TokieSan fb9874231f Caching Certificates in the CertificateChooser dialog session-wise
Added the functionality of caching certificates per session using a
single instance with internal memoization. Added Reload Certificates
button in case of certificate changes in-session. Updated all instances
of certifcate chooser in the codebase to work with the new change.

Change-Id: Icb25a2b2e9787b029fa6189f70bd4ba3b6806f60
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155373
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
2023-08-26 00:59:48 +02:00