filter/source/pdf/impdialog.cxx |   35 ++++++++++++++++++-----------------
 1 file changed, 18 insertions(+), 17 deletions(-)

New commits:
commit 12407f0668b042f5cbdffbddf65dc864c809d180
Author:     Eloi Montañés <e...@ilsrv.com>
AuthorDate: Thu Oct 3 15:22:36 2024 +0200
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Thu Oct 10 07:20:04 2024 +0200

    tdf#163359: Fix duplication of TSA URLs on Signing Dialog
    
    When using the Signing tab on the "Export as PDF" dialog, the TSA URLs will 
be
    appended to the ComboBox each time a certificate is selected. Thus, if a 
user
    selects a certificate and then another (or the same) is selected the 
ComboBox
    will end up with duplicated values.
    This patch moves the code to append the TSA URLs to the function that sets 
up
    the signing page, fixing the problem.
    
    Change-Id: I93d9cb61e10f18b0c33765d63a5ce47c92e588bf
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174424
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/filter/source/pdf/impdialog.cxx b/filter/source/pdf/impdialog.cxx
index b24414ea9e98..547f9526338e 100644
--- a/filter/source/pdf/impdialog.cxx
+++ b/filter/source/pdf/impdialog.cxx
@@ -1775,6 +1775,24 @@ 
ImpPDFTabSigningPage::ImpPDFTabSigningPage(weld::Container* pPage, weld::DialogC
     mxPbSignCertSelect->set_sensitive(true);
     mxPbSignCertSelect->connect_clicked(LINK(this, ImpPDFTabSigningPage, 
ClickmaPbSignCertSelect));
     mxPbSignCertClear->connect_clicked(LINK(this, ImpPDFTabSigningPage, 
ClickmaPbSignCertClear));
+
+    // Populate the TSA ComboBox
+    try
+    {
+        std::optional<css::uno::Sequence<OUString>> 
aTSAURLs(officecfg::Office::Common::Security::Scripting::TSAURLs::get());
+        if (aTSAURLs)
+        {
+            const css::uno::Sequence<OUString>& rTSAURLs = *aTSAURLs;
+            for (auto const& elem : rTSAURLs)
+            {
+                mxLBSignTSA->append_text(elem);
+            }
+        }
+    }
+    catch (const uno::Exception &)
+    {
+        TOOLS_INFO_EXCEPTION("filter.pdf", "TSAURLsDialog::TSAURLsDialog()");
+    }
 }
 
 ImpPDFTabSigningPage::~ImpPDFTabSigningPage()
@@ -1804,23 +1822,6 @@ IMPL_LINK_NOARG(ImpPDFTabSigningPage, 
ClickmaPbSignCertSelect, weld::Button&, vo
     mxEdSignReason->set_sensitive(true);
     mxEdSignReason->set_text(aDescription);
 
-    try
-    {
-        std::optional<css::uno::Sequence<OUString>> 
aTSAURLs(officecfg::Office::Common::Security::Scripting::TSAURLs::get());
-        if (aTSAURLs)
-        {
-            const css::uno::Sequence<OUString>& rTSAURLs = *aTSAURLs;
-            for (auto const& elem : rTSAURLs)
-            {
-                mxLBSignTSA->append_text(elem);
-            }
-        }
-    }
-    catch (const uno::Exception &)
-    {
-        TOOLS_INFO_EXCEPTION("filter.pdf", "TSAURLsDialog::TSAURLsDialog()");
-    }
-
     // If more than only the "None" entry is there, enable the ListBox
     if (mxLBSignTSA->get_count() > 1)
         mxLBSignTSA->set_sensitive(true);

Reply via email to