[Libreoffice-commits] core.git: xmlsecurity/doc xmlsecurity/qa xmlsecurity/README.md

2023-08-25 Thread TokieSan (via logerrit)
 dev/null   |binary
 xmlsecurity/README.md  |   29 +++-
 xmlsecurity/doc/OpenDocumentSignatures-TestIntegration.odt |binary
 xmlsecurity/doc/OpenDocumentSignatures-Workflow.odg|binary
 xmlsecurity/doc/OpenDocumentSignatures.odt |binary
 xmlsecurity/doc/XMLSecurityFramework.odt   |binary
 xmlsecurity/qa/create-certs/create-dump-certs.sh   |   31 +
 7 files changed, 59 insertions(+), 1 deletion(-)

New commits:
commit a6636c451b54728741be0a770b053e093134b90d
Author: TokieSan 
AuthorDate: Tue Aug 22 09:42:11 2023 +0300
Commit: Thorsten Behrens 
CommitDate: Sat Aug 26 01:01:40 2023 +0200

XMLSecurity Module Documentation Update

Updated the README Documentation file for xmlsecurity module. Fixed
broken sxd file for signatures workflow. Added dumb certificates creator
shell script for testing purposes in qa.

Change-Id: Ibee17193a1a38348f2e7fc460dfdd0c54dd31f9b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155932
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 

diff --git a/xmlsecurity/README.md b/xmlsecurity/README.md
index b983f5dc5eb5..80259e6dcbf9 100644
--- a/xmlsecurity/README.md
+++ b/xmlsecurity/README.md
@@ -1,4 +1,6 @@
-# Stuff for Document Signing
+# Document Signing
+
+## Introduction
 
 This code provides dialogs, and infrastructure wrapping `libxmlsec` and
 `gpgme` that implements document signing.
@@ -10,6 +12,31 @@ to the digital signature of the document, when signing it.
 The document signing can be done both for the source ODF/OOXML files and
 the exported PDF files. It is also possible to sign existing PDF files.
 
+## Module Contents
+
+ * `doc`: OpenDocument workflow legacy information with some illustrations to 
have an idea of the workflow, for starters check 
`doc/OpenDocumentSignatures-Workflow.odt`.
+ * `inc`: Headers to a subset of source files inside the module, parts like 
`source/framework` have headers inside the folder.
+ * `qa`: Unit tests for signing and shell scripts for certificates creation 
for testing.
+ * `test_docs`: Documents & certificates used for testing.
+ * `source`: More on that below.
+ * `uiconfig`: User interface configuration for different dialogs, it is 
recommended to navigate from relevant source file to the .ui file linked in the 
class which will be under `uiconfig/ui`.
+ * `util`: UNO passive registration config for GPG/ NSS.
+
+## Source Primary Contents
+
+ * `component`: Main implementation of `DocumentDigitalSignatuers` where the 
interaction with security environment and certificates occur.
+ * `dialogs`: Certificate & Signatures management dialogs.
+   * `certificatechooser`: Dialog that allows you to find and choose 
certificates or signatures for encryption.
+   * `certificateviewer`: More detailed information about each certificate.
+   * `digitalsignaturesdialog`: Main window for signatures of the documents 
and the start point of signing document.
+ * `framework`: Various elements for verifying signatures and running security 
engine.
+ * `gpg`: The implementation of encrypting with GPG and security environment 
initialization.
+ * `helper`: Some helper classes that include signatures manager and the 
helpers for PDF signing, UriBinding, and XML signatures. It also include helper 
tools for XSecurityEnvironment.
+ * `xmlsec`: XML, NSS, MSCrypt encryption/ signing tools, more on the 
low-level side of actual implementation of algorithms.
+
+
+## PDF Testing
+
 To test the signed PDFs, one can use the `pdfverify` in this way:
 
 ./bin/run pdfverify $PWD/xmlsecurity/qa/unit/pdfsigning/data/2good.pdf
diff --git a/xmlsecurity/doc/OpenDocumentSignatures-TestIntegration.odt 
b/xmlsecurity/doc/OpenDocumentSignatures-TestIntegration.odt
new file mode 100644
index ..e90e4eaade2d
Binary files /dev/null and 
b/xmlsecurity/doc/OpenDocumentSignatures-TestIntegration.odt differ
diff --git a/xmlsecurity/doc/OpenDocumentSignatures-TestIntegration.sxw 
b/xmlsecurity/doc/OpenDocumentSignatures-TestIntegration.sxw
deleted file mode 100644
index 2973f08c8d8a..
Binary files a/xmlsecurity/doc/OpenDocumentSignatures-TestIntegration.sxw and 
/dev/null differ
diff --git a/xmlsecurity/doc/OpenDocumentSignatures-Workflow.odg 
b/xmlsecurity/doc/OpenDocumentSignatures-Workflow.odg
new file mode 100644
index ..f7331f024acd
Binary files /dev/null and 
b/xmlsecurity/doc/OpenDocumentSignatures-Workflow.odg differ
diff --git a/xmlsecurity/doc/OpenDocumentSignatures-Workflow.sxd 
b/xmlsecurity/doc/OpenDocumentSignatures-Workflow.sxd
deleted file mode 100644
index abc5f32c6151..
Binary files a/xmlsecurity/doc/OpenDocumentSignatures-Workflow.sxd and 
/dev/null differ
diff --git a/xmlsecurity/doc/OpenDocumentSignatures.odt 
b/xmlsecurity/doc/OpenDocumentSignatures.odt
new file mode 100644
index ..78ac14fc0b4f

[Libreoffice-commits] core.git: xmlsecurity/inc xmlsecurity/source xmlsecurity/uiconfig

2023-08-25 Thread TokieSan (via logerrit)
 xmlsecurity/inc/certificatechooser.hxx |   18 +++
 xmlsecurity/source/component/documentdigitalsignatures.cxx |   10 -
 xmlsecurity/source/dialogs/certificatechooser.cxx  |   14 ++
 xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx |8 -
 xmlsecurity/uiconfig/ui/selectcertificatedialog.ui |   68 +
 5 files changed, 89 insertions(+), 29 deletions(-)

New commits:
commit fb9874231fb242b4a6a7d1ce097e66dd4ed8f32e
Author: TokieSan 
AuthorDate: Sat Aug 5 18:26:55 2023 +0300
Commit: Thorsten Behrens 
CommitDate: Sat Aug 26 00:59:48 2023 +0200

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 

diff --git a/xmlsecurity/inc/certificatechooser.hxx 
b/xmlsecurity/inc/certificatechooser.hxx
index 8b1f5563d85f..4279781f6fa3 100644
--- a/xmlsecurity/inc/certificatechooser.hxx
+++ b/xmlsecurity/inc/certificatechooser.hxx
@@ -51,6 +51,8 @@ enum class UserAction
 class CertificateChooser final : public weld::GenericDialogController
 {
 private:
+static inline CertificateChooser* mxInstance = nullptr;
+
 std::vector< css::uno::Reference< css::xml::crypto::XXMLSecurityContext > 
> mxSecurityContexts;
 std::vector> mvUserData;
 
@@ -67,11 +69,12 @@ private:
 std::unique_ptrm_xFTDescription;
 std::unique_ptrm_xDescriptionED;
 std::unique_ptrm_xSearchBox;
+std::unique_ptr   m_xReloadBtn;
 
 std::unordered_map,
 css::uno::Sequence< css::uno::Reference< css::security::XCertificate > 
> > xMemCerts;
 
-
+DECL_LINK(ReloadButtonHdl, weld::Button&, void);
 DECL_LINK(ViewButtonHdl, weld::Button&, void);
 DECL_LINK(CertificateHighlightHdl, weld::TreeView&, void);
 DECL_LINK(CertificateSelectHdl, weld::TreeView&, bool);
@@ -79,7 +82,8 @@ private:
 
 void ImplShowCertificateDetails();
 void ImplInitialize(bool mbSearch = false);
-
+void ImplReloadCertificates();
+void ImplSecCtxToCerts(SvtUserOptions , bool bOnlyReload);
 static void HandleOneUsageBit(OUString& string, int& bits, int bit, 
TranslateId name);
 
 public:
@@ -88,6 +92,16 @@ public:
UserAction eAction);
 virtual ~CertificateChooser() override;
 
+static CertificateChooser* getInstance(weld::Window* _pParent,
+std::vector< css::uno::Reference< 
css::xml::crypto::XXMLSecurityContext > > && rxSecurityContexts,
+UserAction eAction) {
+if (!mxInstance)
+{
+mxInstance = new CertificateChooser(_pParent, 
std::move(rxSecurityContexts), eAction);
+}
+return mxInstance;
+}
+
 short run() override;
 
 css::uno::Sequence > 
GetSelectedCertificates();
diff --git a/xmlsecurity/source/component/documentdigitalsignatures.cxx 
b/xmlsecurity/source/component/documentdigitalsignatures.cxx
index 0fd029fc2d81..4ad63b36ed0b 100644
--- a/xmlsecurity/source/component/documentdigitalsignatures.cxx
+++ b/xmlsecurity/source/component/documentdigitalsignatures.cxx
@@ -709,14 +709,14 @@ 
DocumentDigitalSignatures::chooseCertificatesImpl(std::map&
 xSecContexts.push_back(aSignatureManager.getGpgSecurityContext());
 }
 
-CertificateChooser aChooser(Application::GetFrameWeld(mxParentWindow), 
std::move(xSecContexts), eAction);
+CertificateChooser* aChooser = 
CertificateChooser::getInstance(Application::GetFrameWeld(mxParentWindow), 
std::move(xSecContexts), eAction);
 
-if (aChooser.run() != RET_OK)
+if (aChooser->run() != RET_OK)
 return { Reference< css::security::XCertificate >(nullptr) };
 
-uno::Sequence< Reference< css::security::XCertificate > >  xCerts = 
aChooser.GetSelectedCertificates();
-rProperties["Description"] = aChooser.GetDescription();
-rProperties["Usage"] = aChooser.GetUsageText();
+uno::Sequence< Reference< css::security::XCertificate > >  xCerts = 
aChooser->GetSelectedCertificates();
+rProperties["Description"] = aChooser->GetDescription();
+rProperties["Usage"] = aChooser->GetUsageText();
 
 return xCerts;
 }
diff --git a/xmlsecurity/source/dialogs/certificatechooser.cxx 
b/xmlsecurity/source/dialogs/certificatechooser.cxx
index be3e88f9d453..a7ff02f1a583 100644
--- a/xmlsecurity/source/dialogs/certificatechooser.cxx
+++ b/xmlsecurity/source/dialogs/certificatechooser.cxx
@@ -52,6 +52,7 @@ CertificateChooser::CertificateChooser(weld::Window* _pParent,
 , m_xFTDescription(m_xBuilder->weld_label("description-label"))
 , 

[Libreoffice-commits] core.git: xmlsecurity/source xmlsecurity/uiconfig

2023-08-23 Thread TokieSan (via logerrit)
 xmlsecurity/source/dialogs/certificatechooser.cxx  |   17 ++---
 xmlsecurity/uiconfig/ui/selectcertificatedialog.ui |   36 -
 2 files changed, 5 insertions(+), 48 deletions(-)

New commits:
commit 9f327102c435887bbae650b3a573f44500b6f534
Author: TokieSan 
AuthorDate: Thu Aug 10 04:05:23 2023 +0300
Commit: Heiko Tietze 
CommitDate: Wed Aug 23 08:42:27 2023 +0200

Removed Type and Usage Columns from Certificate Chooser

Both columns are irrelevant in the main dialog's view, can be viewed
through viewing certificate's details.

Change-Id: I265a7e125c2679f3a05dba4414f4104f3a5cac2f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155746
Tested-by: Jenkins
Reviewed-by: Heiko Tietze 

diff --git a/xmlsecurity/source/dialogs/certificatechooser.cxx 
b/xmlsecurity/source/dialogs/certificatechooser.cxx
index c7f055deea16..be3e88f9d453 100644
--- a/xmlsecurity/source/dialogs/certificatechooser.cxx
+++ b/xmlsecurity/source/dialogs/certificatechooser.cxx
@@ -57,14 +57,6 @@ CertificateChooser::CertificateChooser(weld::Window* 
_pParent,
 m_xCertLB->set_size_request(nControlWidth, m_xCertLB->get_height_rows(12));
 m_xCertLB->make_sorted();
 
-std::vector aWidths
-{
-o3tl::narrowing(30*nControlWidth/100),
-o3tl::narrowing(30*nControlWidth/100),
-o3tl::narrowing(10*nControlWidth/100),
-o3tl::narrowing(20*nControlWidth/100)
-};
-m_xCertLB->set_column_fixed_widths(aWidths);
 m_xCertLB->connect_changed( LINK( this, CertificateChooser, 
CertificateHighlightHdl ) );
 m_xCertLB->connect_row_activated( LINK( this, CertificateChooser, 
CertificateSelectHdl ) );
 m_xViewBtn->connect_clicked( LINK( this, CertificateChooser, ViewButtonHdl 
) );
@@ -225,6 +217,7 @@ void CertificateChooser::ImplInitialize(bool mbSearch)
 mvUserData.push_back(userData);
 
 OUString sIssuer = xmlsec::GetContentPart( xCert->getIssuerName(), 
xCert->getCertificateKind());
+OUString sExpDate = utl::GetDateString(xCert->getNotValidAfter());
 
 // If we are searching and there is no match skip
 if (mbSearch
@@ -235,13 +228,11 @@ void CertificateChooser::ImplInitialize(bool mbSearch)
 
 m_xCertLB->append();
 int nRow = m_xCertLB->n_children() - 1;
-m_xCertLB->set_text(nRow, 
xmlsec::GetContentPart(xCert->getSubjectName(), xCert->getCertificateKind()), 
0);
-m_xCertLB->set_text(nRow, sIssuer, 1);
-m_xCertLB->set_text(nRow, 
xmlsec::GetCertificateKind(xCert->getCertificateKind()), 2);
-m_xCertLB->set_text(nRow, 
utl::GetDateString(xCert->getNotValidAfter()), 3);
-m_xCertLB->set_text(nRow, 
UsageInClearText(xCert->getCertificateUsage()), 4);
 OUString sId(weld::toId(userData.get()));
 m_xCertLB->set_id(nRow, sId);
+m_xCertLB->set_text(nRow, 
xmlsec::GetContentPart(xCert->getSubjectName(), xCert->getCertificateKind()), 
0);
+m_xCertLB->set_text(nRow, sIssuer, 1);
+m_xCertLB->set_text(nRow, sExpDate, 2);
 
 #if HAVE_FEATURE_GPGME
 // only GPG has preferred keys
diff --git a/xmlsecurity/uiconfig/ui/selectcertificatedialog.ui 
b/xmlsecurity/uiconfig/ui/selectcertificatedialog.ui
index b6fb9a9c5610..e476a7ddd61a 100644
--- a/xmlsecurity/uiconfig/ui/selectcertificatedialog.ui
+++ b/xmlsecurity/uiconfig/ui/selectcertificatedialog.ui
@@ -8,12 +8,8 @@
   
   
   
-  
-  
   
   
-  
-  
   
   
 
@@ -172,7 +168,7 @@
   
 True
 6
-Type
+Expiration date
 True
 2
 
@@ -183,36 +179,6 @@
 
   
 
-
-  
-True
-6
-Expiration date
-True
-3
-
-  
-  
-3
-  
-
-  
-
-
-  
-True
-6
-Certificate usage
-True
-4
-
-  
-  
-4
-  
-
-  
-
 
   
 Select the 
certificate that you want to digitally sign the current document 
with.


[Libreoffice-commits] core.git: xmlsecurity/uiconfig

2023-07-24 Thread TokieSan (via logerrit)
 xmlsecurity/uiconfig/ui/selectcertificatedialog.ui |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit e8d79381bf97d550920cec079fddf2b80927805a
Author: TokieSan 
AuthorDate: Fri Jul 21 19:22:27 2023 +0300
Commit: Thorsten Behrens 
CommitDate: Mon Jul 24 19:54:29 2023 +0200

Improved Accesibility String in Certificate Chooser Dialog

Change-Id: Ib9f93d626b7f2629ebfb17f0f0f43af8fe24d4ee
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154744
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 

diff --git a/xmlsecurity/uiconfig/ui/selectcertificatedialog.ui 
b/xmlsecurity/uiconfig/ui/selectcertificatedialog.ui
index b9214ba842c8..b6fb9a9c5610 100644
--- a/xmlsecurity/uiconfig/ui/selectcertificatedialog.ui
+++ b/xmlsecurity/uiconfig/ui/selectcertificatedialog.ui
@@ -253,7 +253,7 @@
 gtk-find
 
   
-Type certificate for 
searching.
+Search for certificate 
by issuer name or email.
   
 
   


[Libreoffice-commits] core.git: xmlsecurity/uiconfig

2023-07-24 Thread TokieSan (via logerrit)
 xmlsecurity/uiconfig/ui/selectcertificatedialog.ui |1 +
 1 file changed, 1 insertion(+)

New commits:
commit eef190228ac5d3334e26204adb11e5f4c6f373c4
Author: TokieSan 
AuthorDate: Sat Jul 22 23:07:48 2023 +0300
Commit: Thorsten Behrens 
CommitDate: Mon Jul 24 19:53:59 2023 +0200

Added search icon to certificate chooser dialog search box

Change-Id: I8abcee4739a218e9856fbf603792b480efe89dcc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154797
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 

diff --git a/xmlsecurity/uiconfig/ui/selectcertificatedialog.ui 
b/xmlsecurity/uiconfig/ui/selectcertificatedialog.ui
index 08a4c6d7366e..b9214ba842c8 100644
--- a/xmlsecurity/uiconfig/ui/selectcertificatedialog.ui
+++ b/xmlsecurity/uiconfig/ui/selectcertificatedialog.ui
@@ -250,6 +250,7 @@
 True
 True
 True
+gtk-find
 
   
 Type certificate for 
searching.


[Libreoffice-commits] core.git: xmlsecurity/inc xmlsecurity/source xmlsecurity/uiconfig

2023-07-20 Thread TokieSan (via logerrit)
 xmlsecurity/inc/certificatechooser.hxx |   10 ++
 xmlsecurity/source/dialogs/certificatechooser.cxx  |   78 ++---
 xmlsecurity/uiconfig/ui/selectcertificatedialog.ui |   27 +--
 3 files changed, 86 insertions(+), 29 deletions(-)

New commits:
commit ad6f23d2a3842c40f7c812003af4031150ea8183
Author: TokieSan 
AuthorDate: Tue Jul 18 21:54:31 2023 +0300
Commit: Thorsten Behrens 
CommitDate: Thu Jul 20 13:05:14 2023 +0200

Added searching and filtering features to certificate chooser dialog

Added a new search box in the certificate chooser dialog, introduced
local caching for certificates to allow instantaneous filtering and
searching. Modified viewing signatures function to allow searching
functionality.

Change-Id: I361a47da7bd5d24efcbfc17065935851db951c44
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154630
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 

diff --git a/xmlsecurity/inc/certificatechooser.hxx 
b/xmlsecurity/inc/certificatechooser.hxx
index 8ad4c3190f29..8b1f5563d85f 100644
--- a/xmlsecurity/inc/certificatechooser.hxx
+++ b/xmlsecurity/inc/certificatechooser.hxx
@@ -22,6 +22,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 namespace com::sun::star {
 namespace security { class XCertificate; }
@@ -64,13 +66,19 @@ private:
 std::unique_ptr   m_xOKBtn;
 std::unique_ptrm_xFTDescription;
 std::unique_ptrm_xDescriptionED;
+std::unique_ptrm_xSearchBox;
+
+std::unordered_map,
+css::uno::Sequence< css::uno::Reference< css::security::XCertificate > 
> > xMemCerts;
+
 
 DECL_LINK(ViewButtonHdl, weld::Button&, void);
 DECL_LINK(CertificateHighlightHdl, weld::TreeView&, void);
 DECL_LINK(CertificateSelectHdl, weld::TreeView&, bool);
+DECL_LINK(SearchModifyHdl, weld::Entry&, void);
 
 void ImplShowCertificateDetails();
-void ImplInitialize();
+void ImplInitialize(bool mbSearch = false);
 
 static void HandleOneUsageBit(OUString& string, int& bits, int bit, 
TranslateId name);
 
diff --git a/xmlsecurity/source/dialogs/certificatechooser.cxx 
b/xmlsecurity/source/dialogs/certificatechooser.cxx
index 3ac503521e72..c7f055deea16 100644
--- a/xmlsecurity/source/dialogs/certificatechooser.cxx
+++ b/xmlsecurity/source/dialogs/certificatechooser.cxx
@@ -30,7 +30,8 @@
 
 #include 
 #include 
-#include 
+#include 
+
 
 #include 
 #include 
@@ -50,9 +51,11 @@ CertificateChooser::CertificateChooser(weld::Window* 
_pParent,
 , m_xOKBtn(m_xBuilder->weld_button("ok"))
 , m_xFTDescription(m_xBuilder->weld_label("description-label"))
 , m_xDescriptionED(m_xBuilder->weld_entry("description"))
+, m_xSearchBox(m_xBuilder->weld_entry("searchbox"))
 {
 auto nControlWidth = m_xCertLB->get_approximate_digit_width() * 105;
 m_xCertLB->set_size_request(nControlWidth, m_xCertLB->get_height_rows(12));
+m_xCertLB->make_sorted();
 
 std::vector aWidths
 {
@@ -65,6 +68,7 @@ CertificateChooser::CertificateChooser(weld::Window* _pParent,
 m_xCertLB->connect_changed( LINK( this, CertificateChooser, 
CertificateHighlightHdl ) );
 m_xCertLB->connect_row_activated( LINK( this, CertificateChooser, 
CertificateSelectHdl ) );
 m_xViewBtn->connect_clicked( LINK( this, CertificateChooser, ViewButtonHdl 
) );
+m_xSearchBox->connect_changed(LINK(this, CertificateChooser, 
SearchModifyHdl));
 
 mxSecurityContexts = std::move(rxSecurityContexts);
 mbInitialized = false;
@@ -132,13 +136,20 @@ OUString CertificateChooser::UsageInClearText(int bits)
 return result;
 }
 
-void CertificateChooser::ImplInitialize()
+void CertificateChooser::ImplInitialize(bool mbSearch)
 {
-if ( mbInitialized )
+if (mbInitialized && !mbSearch)
 return;
 
+m_xCertLB->clear();
+m_xCertLB->freeze();
+
 SvtUserOptions aUserOpts;
 
+SvtSysLocale aSysLocale;
+const CharClass& rCharClass = aSysLocale.GetCharClass();
+const OUString aSearchStr(rCharClass.uppercase(m_xSearchBox->get_text()));
+
 switch (meAction)
 {
 case UserAction::Sign:
@@ -164,7 +175,8 @@ void CertificateChooser::ImplInitialize()
 
 }
 
-for (auto  : mxSecurityContexts)
+uno::Sequence> xCerts;
+for (auto& secContext : mxSecurityContexts)
 {
 if (!secContext.is())
 continue;
@@ -172,33 +184,39 @@ void CertificateChooser::ImplInitialize()
 if (!secEnvironment.is())
 continue;
 
-uno::Sequence< uno::Reference< security::XCertificate > > xCerts;
 try
 {
-if ( meAction == UserAction::Sign || meAction == 
UserAction::SelectSign)
-xCerts = secEnvironment->getPersonalCertificates();
+if (xMemCerts.count(secContext))
+{
+xCerts = xMemCerts[secContext];
+}
 else
-xCerts = secEnvironment->getAllCertificates();
+{
+ 

[Libreoffice-commits] core.git: cui/source cui/uiconfig officecfg/registry xmlsecurity/inc xmlsecurity/Module_xmlsecurity.mk xmlsecurity/source

2023-07-11 Thread TokieSan (via logerrit)
 cui/source/options/optinet2.cxx|   58 +
 cui/source/options/optinet2.hxx|4 
 cui/uiconfig/ui/optsecuritypage.ui |  391 +++--
 officecfg/registry/schema/org/openoffice/Office/Common.xcs |6 
 xmlsecurity/Module_xmlsecurity.mk  |4 
 xmlsecurity/inc/digitalsignaturesdialog.hxx|2 
 xmlsecurity/inc/strings.hrc|1 
 xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx |  160 ++---
 8 files changed, 401 insertions(+), 225 deletions(-)

New commits:
commit 92b6ffcd9f687cc54a0fc3801ca85c7e4d77512f
Author: TokieSan 
AuthorDate: Fri Jun 30 11:22:01 2023 +0300
Commit: Thorsten Behrens 
CommitDate: Tue Jul 11 16:30:59 2023 +0200

Allow selecting a custom certificate manager

Added a new option in Tools>Options>Security that allows choosing the
path of a different certificate manager.

Made Certificate Manager Button be disabled instead of hidden in case no
certificate manager is detected. Added a box notifying that the
certificate manager is opened (or not working in case it failed for some
reason).

Change-Id: I64a901766d4fb05c59c0f85fdf94c08a3ca4bdab
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153798
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 

diff --git a/cui/source/options/optinet2.cxx b/cui/source/options/optinet2.cxx
index 95d0ec18346b..cf879d056824 100644
--- a/cui/source/options/optinet2.cxx
+++ b/cui/source/options/optinet2.cxx
@@ -493,6 +493,8 @@ SvxSecurityTabPage::SvxSecurityTabPage(weld::Container* 
pPage, weld::DialogContr
 , m_xTSAURLsFrame(m_xBuilder->weld_container("tsaurls"))
 , m_xTSAURLsPB(m_xBuilder->weld_button("tsas"))
 , m_xNoPasswordSaveFT(m_xBuilder->weld_label("nopasswordsave"))
+, m_xCertMgrPathLB(m_xBuilder->weld_button("browse"))
+, m_xParameterEdit(m_xBuilder->weld_entry("parameterfield"))
 {
 //fdo#65595, we need height-for-width support here, but for now we can
 //bodge it
@@ -516,10 +518,46 @@ SvxSecurityTabPage::SvxSecurityTabPage(weld::Container* 
pPage, weld::DialogContr
 m_xMacroSecPB->connect_clicked( LINK( this, SvxSecurityTabPage, 
MacroSecPBHdl ) );
 m_xCertPathPB->connect_clicked( LINK( this, SvxSecurityTabPage, 
CertPathPBHdl ) );
 m_xTSAURLsPB->connect_clicked( LINK( this, SvxSecurityTabPage, 
TSAURLsPBHdl ) );
+m_xCertMgrPathLB->connect_clicked( LINK( this, SvxSecurityTabPage, 
CertMgrPBHdl ) );
 
 ActivatePage( rSet );
 }
 
+IMPL_LINK_NOARG(SvxSecurityTabPage, CertMgrPBHdl, weld::Button&, void)
+{
+try
+{
+FileDialogHelper 
aHelper(css::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE,
+ FileDialogFlags::NONE, nullptr);
+OUString sPath = m_xParameterEdit->get_text();
+if (sPath.isEmpty())
+sPath = "/usr/bin";
+
+OUString sUrl;
+osl::FileBase::getFileURLFromSystemPath(sPath, sUrl);
+aHelper.SetDisplayDirectory(sUrl);
+
+if (ERRCODE_NONE == aHelper.Execute())
+{
+sUrl = aHelper.GetPath();
+if (osl::FileBase::getSystemPathFromFileURL(sUrl, sPath) != 
osl::FileBase::E_None)
+{
+sPath.clear();
+}
+m_xParameterEdit->set_text(sPath);
+}
+std::shared_ptr pBatch(
+comphelper::ConfigurationChanges::create());
+OUString sCurCertMgr = m_xParameterEdit->get_text();
+
officecfg::Office::Common::Security::Scripting::CertMgrPath::set(sCurCertMgr, 
pBatch);
+pBatch->commit();
+}
+catch (const uno::Exception&)
+{
+TOOLS_WARN_EXCEPTION("cui.options", "CertMgrPBHdl");
+}
+}
+
 SvxSecurityTabPage::~SvxSecurityTabPage()
 {
 }
@@ -750,6 +788,17 @@ void SvxSecurityTabPage::InitControls()
 {
 m_xSavePasswordsCB->set_sensitive( false );
 }
+
+try
+{
+OUString sCurCertMgr = 
officecfg::Office::Common::Security::Scripting::CertMgrPath::get();
+
+if (!sCurCertMgr.isEmpty())
+m_xParameterEdit->set_text(sCurCertMgr);
+}
+catch (const uno::Exception&)
+{
+}
 }
 
 std::unique_ptr SvxSecurityTabPage::Create(weld::Container* pPage, 
weld::DialogController* pController, const SfxItemSet* rAttrSet )
@@ -803,6 +852,15 @@ bool SvxSecurityTabPage::FillItemSet( SfxItemSet* )
 CheckAndSave( SvtSecurityOptions::EOption::BlockUntrustedRefererLinks, 
m_xSecOptDlg->IsBlockUntrustedRefererLinksChecked(), bModified );
 }
 
+std::shared_ptr pBatch(
+comphelper::ConfigurationChanges::create());
+if (m_xParameterEdit->get_value_changed_from_saved())
+{
+OUString sCurCertMgr = m_xParameterEdit->get_text();
+
officecfg::Office::Common::Security::Scripting::CertMgrPath::set(sCurCertMgr, 
pBatch);
+pBatch->commit();
+}
+
 

[Libreoffice-commits] core.git: xmlsecurity/uiconfig

2023-07-11 Thread TokieSan (via logerrit)
 xmlsecurity/uiconfig/ui/selectcertificatedialog.ui |  101 +++--
 1 file changed, 54 insertions(+), 47 deletions(-)

New commits:
commit 6b0684b2c48bcd8fd6ded3817cbe12aa4e02b4dc
Author: TokieSan 
AuthorDate: Sun Jul 9 13:25:52 2023 +0300
Commit: Thorsten Behrens 
CommitDate: Tue Jul 11 13:57:57 2023 +0200

Allow columns' sorting in certificate chooser dialog

Allowed native GTK TreeViewColumn sorting for the Certificate Chooser
Dialog (selectcertificatedialog.ui)

Change-Id: I4acba667ebd6fd5801730bf4413a00149b3b6528
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154227
Tested-by: Jenkins
Reviewed-by: Heiko Tietze 
Reviewed-by: Thorsten Behrens 

diff --git a/xmlsecurity/uiconfig/ui/selectcertificatedialog.ui 
b/xmlsecurity/uiconfig/ui/selectcertificatedialog.ui
index 3296173792f7..fde094088e91 100644
--- a/xmlsecurity/uiconfig/ui/selectcertificatedialog.ui
+++ b/xmlsecurity/uiconfig/ui/selectcertificatedialog.ui
@@ -1,5 +1,5 @@
 
-
+
 
   
   
@@ -19,29 +19,29 @@
 
   
   
-False
-6
+False
+6
 Select 
Certificate
 False
 True
-dialog
+dialog
 
   
-False
+False
 vertical
 12
 
   
-False
-end
+False
+end
 
   
 _OK
 True
-True
-True
-True
-True
+True
+True
+True
+True
 True
   
   
@@ -54,8 +54,8 @@
   
 _Cancel
 True
-True
-True
+True
+True
 True
   
   
@@ -68,8 +68,8 @@
   
 _Help
 True
-True
-True
+True
+True
 True
   
   
@@ -83,58 +83,58 @@
   
 False
 True
-end
+end
 0
   
 
 
-  
+  
   
 True
-False
+False
 True
 True
-12
-12
+12
+12
 
   
-False
+False
 Select the certificate you want to use 
for signing:
 0
   
   
-0
-0
+0
+0
   
 
 
   
-False
+False
 Select the certificate you want to 
use for encryption:
 0
   
   
-0
-1
+0
+1
   
 
 
   
 True
-True
+True
 True
 True
-in
+in
 
   
 True
-True
-True
+True
+True
 True
 True
 liststore3
-0
-False
+0
+False
 
   
 
@@ -143,6 +143,8 @@
 True
 6
 Issued to
+True
+0
 
   
   
@@ -156,6 +158,8 @@
 True
 6
 Issued by
+True
+1
 
   
   
@@ -169,6 +173,8 @@
 True
 6
 Type
+True
+2
 
   
   
@@ -182,6 +188,8 @@
 True
 6
 Expiration date
+True
+3
 
   
   
@@ -195,6 +203,8 @@
 True
 6
 Certificate usage
+True
+4
 
   
   
@@ -212,16 +222,16 @@
 
   
   
-0
- 

[Libreoffice-commits] core.git: xmlsecurity/inc xmlsecurity/source xmlsecurity/uiconfig

2023-06-24 Thread TokieSan (via logerrit)
 xmlsecurity/inc/digitalsignaturesdialog.hxx|1 
 xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx |   75 ++---
 xmlsecurity/uiconfig/ui/digitalsignaturesdialog.ui |8 -
 3 files changed, 68 insertions(+), 16 deletions(-)

New commits:
commit 17ba20e132d581c2298969451b510fb69c19f5fe
Author: TokieSan 
AuthorDate: Tue Jun 20 22:52:03 2023 +0300
Commit: Thorsten Behrens 
CommitDate: Sat Jun 24 18:19:18 2023 +0200

Certificate Manager button is hidden in case no manager exists.

A new function is implemented to check for that in
digitalsignaturesdialog.cxx

Change-Id: I4cf1c710e6a145e8f0d10716cb81394bdcf7a74f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153367
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 

diff --git a/xmlsecurity/inc/digitalsignaturesdialog.hxx 
b/xmlsecurity/inc/digitalsignaturesdialog.hxx
index 218c3e99c8b3..21b048117670 100644
--- a/xmlsecurity/inc/digitalsignaturesdialog.hxx
+++ b/xmlsecurity/inc/digitalsignaturesdialog.hxx
@@ -89,6 +89,7 @@ private:
 voidImplGetSignatureInformations(bool bUseTempStream, bool 
bCacheLastSignature);
 voidImplFillSignaturesBox();
 voidImplShowSignaturesDetails();
+boolIsThereCertificateMgr();
 
 css::uno::Reference getCertificate(const 
SignatureInformation& rInfo);
 css::uno::Reference 
getSecurityEnvironmentForCertificate(
diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx 
b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
index 0a306a008db0..ed73366234df 100644
--- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
+++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
@@ -115,6 +115,16 @@ namespace
 
 m_nODF = nTmp;
 }
+const std::vector aGUIServersWindows = { 
u"Gpg4win\\kleopatra.exe",
+   
u"Gpg4win\\bin\\kleopatra.exe",
+   
u"GNU\\GnuPG\\kleopatra.exe",
+   
u"GNU\\GnuPG\\launch-gpa.exe",
+   u"GNU\\GnuPG\\gpa.exe",
+   u"GnuPG\\bin\\gpa.exe",
+   
u"GNU\\GnuPG\\bin\\kleopatra.exe",
+   
u"GNU\\GnuPG\\bin\\launch-gpa.exe",
+   
u"GNU\\GnuPG\\bin\\gpa.exe"};
+const std::vector aGUIServersNix = { u"kleopatra", 
u"seahorse", u"gpa", u"kgpg" };
 }
 
 DigitalSignaturesDialog::DigitalSignaturesDialog(
@@ -201,6 +211,11 @@ DigitalSignaturesDialog::DigitalSignaturesDialog(
 m_xRemoveBtn->hide();
 m_xStartCertMgrBtn->hide();
 }
+
+if ( !IsThereCertificateMgr() )
+{
+m_xStartCertMgrBtn->hide();
+}
 }
 
 DigitalSignaturesDialog::~DigitalSignaturesDialog()
@@ -473,22 +488,54 @@ IMPL_LINK_NOARG(DigitalSignaturesDialog, RemoveButtonHdl, 
weld::Button&, void)
 }
 }
 
+bool DigitalSignaturesDialog::IsThereCertificateMgr()
+{
+static std::vector aGUIServers;
+#ifdef _WIN32
+static const OUString aPath = [] {
+sal::systools::CoTaskMemAllocated sPath;
+HRESULT hr
+= SHGetKnownFolderPath(FOLDERID_ProgramFilesX86, KF_FLAG_DEFAULT, 
nullptr, );
+if (SUCCEEDED(hr))
+return OUString(o3tl::toU(sPath));
+return OUString();
+}();
+if (aPath.isEmpty())
+return false;
+aGUIServers = aGUIServersWindows;
+#else
+const char* cPath = getenv("PATH");
+if (!cPath)
+return false;
+OUString aPath(cPath, strlen(cPath), osl_getThreadTextEncoding());
+aGUIServers = aGUIServersNix;
+#endif
+
+if (aGUIServers.empty())
+return false;
+
+OUString sFoundGUIServer, sExecutable;
+
+for ( auto const  : aGUIServers )
+{
+osl::FileBase::RC searchError = 
osl::File::searchFileURL(OUString(rServer), aPath, sFoundGUIServer );
+if (searchError == osl::FileBase::E_None)
+{
+osl::File::getSystemPathFromFileURL( sFoundGUIServer, sExecutable 
);
+break;
+}
+}
+
+return ( !sExecutable.isEmpty() );
+}
+
 IMPL_LINK_NOARG(DigitalSignaturesDialog, CertMgrButtonHdl, weld::Button&, void)
 {
+static std::vector aGUIServers;
 #ifdef _WIN32
 // FIXME: call GpgME::dirInfo("bindir") somewhere in
 // SecurityEnvironmentGpg or whatnot
 // FIXME: perhaps poke GpgME for uiserver, and hope it returns something 
useful?
-static const std::u16string_view aGUIServers[] = { 
u"Gpg4win\\kleopatra.exe",
-   
u"Gpg4win\\bin\\kleopatra.exe",
-   
u"GNU\\GnuPG\\kleopatra.exe",
-   
u"GNU\\GnuPG\\launch-gpa.exe",
- 

[Libreoffice-commits] core.git: include/sfx2 sfx2/source xmlsecurity/source

2023-06-18 Thread TokieSan (via logerrit)
 include/sfx2/objsh.hxx |   10 +
 include/sfx2/strings.hrc   |1 
 sfx2/source/doc/guisaveas.cxx  |7 -
 sfx2/source/doc/objserv.cxx|   81 ++---
 xmlsecurity/source/component/documentdigitalsignatures.cxx |8 +
 5 files changed, 86 insertions(+), 21 deletions(-)

New commits:
commit 46722dbaa7795074e3c5043a76ae3f3a7782491e
Author: TokieSan 
AuthorDate: Tue Jun 6 21:51:42 2023 +0300
Commit: Thorsten Behrens 
CommitDate: Sun Jun 18 22:03:43 2023 +0200

tdf#155665 Adding option to remember signatures for each save

Added the option in digital signatures dialog to remember used
signature.

Implemented ResignDocument function in objserv.cxx to resign after
every save in case the option to remember signature is on.
Added a new dialog box that checks whether there is a need to
remember the signature.

Change-Id: Ia7dbcc952044e9542e3fe6cd84b5d6633fcd1461
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152687
Reviewed-by: Heiko Tietze 
Reviewed-by: Thorsten Behrens 
Tested-by: Thorsten Behrens 

diff --git a/include/sfx2/objsh.hxx b/include/sfx2/objsh.hxx
index b29fb43d77e4..15533c2954ca 100644
--- a/include/sfx2/objsh.hxx
+++ b/include/sfx2/objsh.hxx
@@ -190,6 +190,7 @@ private:
   // sal_False := new object
 boolbIsInGenerateThumbnail; //optimize thumbnail 
generate and store procedure to improve odt saving performance, i120030
 boolmbAvoidRecentDocs; ///< Avoid adding to the 
recent documents list, if not necessary.
+boolbRememberSignature; // Do we want to remember 
the signature.
 
 enum TriState   {undefined, yes, no};
 TriStatembContinueImportOnFilterExceptions = 
undefined; // try to import as much as possible
@@ -199,6 +200,8 @@ private:
 SAL_DLLPRIVATE void UpdateTime_Impl(const css::uno::Reference<
 css::document::XDocumentProperties> & i_xDocProps);
 
+css::uno::Sequence< css::security::DocumentSignatureInformation > 
rSignatureInfosRemembered;
+
 SAL_DLLPRIVATE bool SaveTo_Impl(SfxMedium , const SfxItemSet* pSet 
);
 
 protected:
@@ -350,13 +353,14 @@ public:
 void AfterSigning(bool bSignSuccess, bool bSignScriptingContent);
 bool HasValidSignatures() const;
 SignatureState  GetDocumentSignatureState();
-voidSignDocumentContent(weld::Window* 
pDialogParent);
+boolSignDocumentContent(weld::Window* 
pDialogParent);
 css::uno::Sequence 
GetDocumentSignatureInformation(
 bool bScriptingContent,
 const css::uno::Reference& 
xSigner
 = css::uno::Reference());
 
 bool SignDocumentContentUsingCertificate(const 
css::uno::Reference& xCertificate);
+bool ResignDocument(css::uno::Sequence< 
css::security::DocumentSignatureInformation >& rSignaturesInfo);
 
 void SignSignatureLine(weld::Window* pDialogParent, const OUString& 
aSignatureLineId,
const 
css::uno::Reference& xCert,
@@ -364,7 +368,7 @@ public:
const css::uno::Reference& 
xInvalidGraphic,
const OUString& aComment);
 SignatureState  GetScriptingSignatureState();
-voidSignScriptingContent(weld::Window* 
pDialogParent);
+boolSignScriptingContent(weld::Window* 
pDialogParent);
 DECL_DLLPRIVATE_LINK(SignDocumentHandler, weld::Button&, void);
 
 virtual std::shared_ptr 
CreateDocumentInfoDialog(weld::Window* pParent, const SfxItemSet& rItemSet);
@@ -458,6 +462,8 @@ public:
 /// Don't add to the recent documents - it's an expensive operation, 
sometimes it is not wanted.
 boolIsAvoidRecentDocs() const { return 
mbAvoidRecentDocs; }
 
+boolIsRememberingSignature() const { return 
bRememberSignature; }
+
 /// Don't add to the recent documents - it's an expensive operation, 
sometimes it is not wanted.
 voidAvoidRecentDocs(bool bAvoid) { 
mbAvoidRecentDocs = bAvoid; }
 
diff --git a/include/sfx2/strings.hrc b/include/sfx2/strings.hrc
index bd2c0b5d5630..3ccc50cb0947 100644
--- a/include/sfx2/strings.hrc
+++ b/include/sfx2/strings.hrc
@@ -149,6 +149,7 @@
 #define RID_SVXSTR_XMLSEC_QUERY_LOSINGSIGNATURE 
NC_("RID_SVXSTR_XMLSEC_QUERY_LOSINGSIGNATURE", "Saving will remove all existing 
signatures.\nDo you want to continue saving the document?")
 #define RID_SVXSTR_XMLSEC_QUERY_SAVEBEFORESIGN  
NC_("RID_SVXSTR_XMLSEC_QUERY_SAVEBEFORESIGN", "The document has to be saved 
before it can be signed.\nDo you want to save the document?")
 #define STR_QUERY_CANCELCHECKOUT

[Libreoffice-commits] core.git: officecfg/registry sw/inc sw/qa sw/sdi sw/source sw/uiconfig

2023-05-15 Thread TokieSan (via logerrit)
 officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu |8 ++
 sw/inc/cmdid.h  |1 
 sw/qa/uibase/shells/shells.cxx  |   29 
++
 sw/sdi/_textsh.sdi  |6 ++
 sw/sdi/swriter.sdi  |   18 
++
 sw/source/uibase/shells/textfld.cxx |   20 
++
 sw/uiconfig/swriter/menubar/menubar.xml |1 
 sw/uiconfig/swriter/popupmenu/table.xml |1 
 sw/uiconfig/swriter/popupmenu/text.xml  |1 
 9 files changed, 85 insertions(+)

New commits:
commit 627a601d1fcea0b3198654756d351b0b81600b49
Author: TokieSan 
AuthorDate: Sat Apr 15 19:05:12 2023 +0200
Commit: Miklos Vajna 
CommitDate: Mon May 15 08:56:46 2023 +0200

tdf#148979 Added option to update selected field

Added Uno command UpdateSelectedField, FN_UPDATE_SEL_FIELD
to support updating a single selected field

Change-Id: Ia1a2387e137f8a672a24056b13234d4275a77ca4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150450
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git 
a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu 
b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
index 8e9715c24acd..617901255c4b 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
@@ -1636,6 +1636,14 @@
   1
 
   
+  
+
+  Update Selected Field
+
+
+  1
+
+  
   
 
   E~xternal Links...
diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h
index 5459c63b8ff1..d330f36966bd 100644
--- a/sw/inc/cmdid.h
+++ b/sw/inc/cmdid.h
@@ -78,6 +78,7 @@ class SwUINumRuleItem;
 #define FN_EDIT_LINK_DLG(FN_EDIT + 9 )/* Edit link dialog */
 
 #define FN_NUMBER_BULLETS   (FN_EDIT + 21)/* Bullets */
+#define FN_UPDATE_SEL_FIELD (FN_EDIT + 22 )   /* Update selected field */
 #define FN_EDIT_IDX_ENTRY_DLG   (FN_EDIT + 23)/* Edit Index-Entry */
 #define FN_UPDATE_FIELDS(FN_EDIT + 26)/* Update fields */
 #define FN_EXECUTE_MACROFIELD   (FN_EDIT + 27)/* Execute macrofield */
diff --git a/sw/qa/uibase/shells/shells.cxx b/sw/qa/uibase/shells/shells.cxx
index 8c251cb09f87..c962f4a5d65e 100644
--- a/sw/qa/uibase/shells/shells.cxx
+++ b/sw/qa/uibase/shells/shells.cxx
@@ -28,6 +28,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -1049,6 +1050,34 @@ CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, 
testInsertTextFormFieldEndnote)
 CPPUNIT_ASSERT_EQUAL(OUString("result"), aActual);
 }
 
+CPPUNIT_TEST_FIXTURE(SwUibaseShellsTest, testUpdateSelectedField)
+{
+// Given an empty doc:
+createSwDoc();
+SwDoc* pDoc = getSwDoc();
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+SwPaM* pCursor = pDoc->GetEditShell()->GetCursor();
+
+// Insert a time field and select it:
+dispatchCommand(mxComponent, ".uno:InsertTimeField", {});
+
+pCursor->SetMark();
+pCursor->Move(fnMoveBackward);
+
+OUString aTimeFieldBefore, aTimeFieldAfter;
+pWrtShell->GetSelectedText(aTimeFieldBefore);
+
+// Wait for one second:
+osl::Thread::wait(std::chrono::seconds(1));
+
+// Update the field at cursor:
+dispatchCommand(mxComponent, ".uno:UpdateSelectedField", {});
+pWrtShell->GetSelectedText(aTimeFieldAfter);
+
+// Check that the selected field has changed:
+CPPUNIT_ASSERT(aTimeFieldAfter != aTimeFieldBefore);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/sdi/_textsh.sdi b/sw/sdi/_textsh.sdi
index 45f6eb7c9bdb..086a7622b137 100644
--- a/sw/sdi/_textsh.sdi
+++ b/sw/sdi/_textsh.sdi
@@ -1010,6 +1010,12 @@ interface BaseText
 StateMethod = StateField ;
 DisableFlags="SfxDisableFlags::SwOnProtectedCursor";
 ]
+FN_UPDATE_SEL_FIELD
+[
+ExecMethod = ExecField ;
+StateMethod = StateField ;
+DisableFlags="SfxDisableFlags::SwOnProtectedCursor";
+]
 FN_GLOSSARY_DLG // status()
 [
 ExecMethod = ExecGlossary ;
diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi
index 15d098cc996c..b765d861e34a 100644
--- a/sw/sdi/swriter.sdi
+++ b/sw/sdi/swriter.sdi
@@ -1246,6 +1246,24 @@ SfxVoidItem FieldDialog FN_EDIT_FIELD
 GroupId = SfxGroupId::Edit;
 ]
 
+SfxVoidItem UpdateSelectedField FN_UPDATE_SEL_FIELD
+()
+[
+AutoUpdate = FALSE,
+FastCall = FALSE,
+ReadOnlyDoc = FALSE,
+Toggle = FALSE,
+Container = FALSE,
+RecordAbsolute = FALSE,
+RecordPerSet;
+Asynchron;
+
+AccelConfig = TRUE,
+MenuConfig = TRUE,
+ToolBoxConfig = TRUE,
+GroupId = 

[Libreoffice-commits] core.git: sc/source

2023-04-19 Thread TokieSan (via logerrit)
 sc/source/ui/dbgui/scuiasciiopt.cxx |5 +
 sc/source/ui/inc/scuiasciiopt.hxx   |1 -
 2 files changed, 1 insertion(+), 5 deletions(-)

New commits:
commit be1fe4418caa8c26ea53fe1f9acbe36096d5e3a9
Author: TokieSan 
AuthorDate: Mon Mar 27 14:28:45 2023 +0200
Commit: Heiko Tietze 
CommitDate: Wed Apr 19 17:37:39 2023 +0200

tdf#150652 Column Type being disabled makes UX unintuitive

Columntype is no longer disabled by default.

Change-Id: I173ec35363278b397a2727cff234c0b4d936ff99
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149630
Tested-by: Jenkins
Reviewed-by: Heiko Tietze 
Reviewed-by: Andreas Heinisch 

diff --git a/sc/source/ui/dbgui/scuiasciiopt.cxx 
b/sc/source/ui/dbgui/scuiasciiopt.cxx
index df8f77c8553c..9f510c9d7e3d 100644
--- a/sc/source/ui/dbgui/scuiasciiopt.cxx
+++ b/sc/source/ui/dbgui/scuiasciiopt.cxx
@@ -339,7 +339,6 @@ ScImportAsciiDlg::ScImportAsciiDlg(weld::Window* pParent, 
std::u16string_view aD
 , mxCkbDetectNumber(m_xBuilder->weld_check_button("detectspecialnumbers"))
 , mxCkbEvaluateFormulas(m_xBuilder->weld_check_button("evaluateformulas"))
 , mxCkbSkipEmptyCells(m_xBuilder->weld_check_button("skipemptycells"))
-, mxFtType(m_xBuilder->weld_label("textcolumntype"))
 , mxLbType(m_xBuilder->weld_combo_box("columntype"))
 , mxAltTitle(m_xBuilder->weld_label("textalttitle"))
 , mxTableBox(new ScCsvTableBox(*m_xBuilder))
@@ -545,7 +544,6 @@ ScImportAsciiDlg::ScImportAsciiDlg(weld::Window* pParent, 
std::u16string_view aD
 }
 
 mxLbType->connect_changed( LINK( this, ScImportAsciiDlg, LbColTypeHdl ) );
-mxFtType->set_sensitive(false);
 mxLbType->set_sensitive(false);
 
 // *** table box preview ***
@@ -931,12 +929,11 @@ IMPL_LINK( ScImportAsciiDlg, ColTypeHdl, ScCsvTableBox&, 
rTableBox, void )
 bool bEmpty = (nType == CSV_TYPE_MULTI);
 bool bEnable = ((0 <= nType) && (nType < nTypeCount)) || bEmpty;
 
-mxFtType->set_sensitive( bEnable );
 mxLbType->set_sensitive( bEnable );
 
 if (bEmpty)
 mxLbType->set_active(-1);
-else if (bEnable)
+else
 mxLbType->set_active(nType);
 }
 
diff --git a/sc/source/ui/inc/scuiasciiopt.hxx 
b/sc/source/ui/inc/scuiasciiopt.hxx
index f966bd2be895..5649fb3da234 100644
--- a/sc/source/ui/inc/scuiasciiopt.hxx
+++ b/sc/source/ui/inc/scuiasciiopt.hxx
@@ -74,7 +74,6 @@ class ScImportAsciiDlg : public weld::GenericDialogController
 std::unique_ptr mxCkbEvaluateFormulas;
 std::unique_ptr mxCkbSkipEmptyCells;
 
-std::unique_ptr mxFtType;
 std::unique_ptr mxLbType;
 std::unique_ptr mxAltTitle;