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

Caolán McNamara caolanm at redhat.com
Mon Jun 18 13:51:54 UTC 2018


 filter/source/pdf/impdialog.cxx   |  122 +++++++++++++++-----------------------
 filter/source/pdf/impdialog.hxx   |   25 +++----
 filter/uiconfig/ui/pdfsignpage.ui |   20 +++---
 3 files changed, 73 insertions(+), 94 deletions(-)

New commits:
commit ace8342c767a71a208ed3c9978bfd62ae97c2b6a
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Jun 18 11:52:33 2018 +0100

    weld ImpPDFTabSigningPage
    
    Change-Id: Ia81f3f2ac3644e496ab679dc8e274b2d50f64edd
    Reviewed-on: https://gerrit.libreoffice.org/56020
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/filter/source/pdf/impdialog.cxx b/filter/source/pdf/impdialog.cxx
index 60abf0148597..fbb8425d9f49 100644
--- a/filter/source/pdf/impdialog.cxx
+++ b/filter/source/pdf/impdialog.cxx
@@ -1574,48 +1574,29 @@ IMPL_LINK_NOARG(ImplErrorDialog, SelectHdl, weld::TreeView&, void)
 }
 
 /// The digital signatures tab page
-ImpPDFTabSigningPage::ImpPDFTabSigningPage(vcl::Window* pParent, const SfxItemSet& rCoreSet)
-    : SfxTabPage(pParent, "PdfSignPage","filter/ui/pdfsignpage.ui", &rCoreSet)
+ImpPDFTabSigningPage::ImpPDFTabSigningPage(TabPageParent pParent, const SfxItemSet& rCoreSet)
+    : SfxTabPage(pParent, "filter/ui/pdfsignpage.ui", "PdfSignPage", &rCoreSet)
     , maSignCertificate()
+    , mxEdSignCert(m_xBuilder->weld_entry("cert"))
+    , mxPbSignCertSelect(m_xBuilder->weld_button("select"))
+    , mxPbSignCertClear(m_xBuilder->weld_button("clear"))
+    , mxEdSignPassword(m_xBuilder->weld_entry("password"))
+    , mxEdSignLocation(m_xBuilder->weld_entry("location"))
+    , mxEdSignContactInfo(m_xBuilder->weld_entry("contact"))
+    , mxEdSignReason(m_xBuilder->weld_entry("reason"))
+    , mxLBSignTSA(m_xBuilder->weld_combo_box_text("tsa"))
 {
-    get(mpEdSignCert, "cert");
-    get(mpPbSignCertSelect, "select");
-    get(mpPbSignCertClear, "clear");
-    get(mpEdSignPassword, "password");
-    get(mpEdSignLocation, "location");
-    get(mpEdSignContactInfo, "contact");
-    get(mpEdSignReason, "reason");
-    get(mpLBSignTSA, "tsa");
-
-    mpPbSignCertSelect->Enable();
-    mpPbSignCertSelect->SetClickHdl( LINK( this, ImpPDFTabSigningPage, ClickmaPbSignCertSelect ) );
-    mpPbSignCertClear->SetClickHdl( LINK( this, ImpPDFTabSigningPage, ClickmaPbSignCertClear ) );
+    mxPbSignCertSelect->set_sensitive(false);
+    mxPbSignCertSelect->connect_clicked(LINK(this, ImpPDFTabSigningPage, ClickmaPbSignCertSelect));
+    mxPbSignCertClear->connect_clicked(LINK(this, ImpPDFTabSigningPage, ClickmaPbSignCertClear));
 }
 
-
 ImpPDFTabSigningPage::~ImpPDFTabSigningPage()
 {
-    disposeOnce();
 }
 
-
-void ImpPDFTabSigningPage::dispose()
+IMPL_LINK_NOARG(ImpPDFTabSigningPage, ClickmaPbSignCertSelect, weld::Button&, void)
 {
-    mpEdSignCert.clear();
-    mpPbSignCertSelect.clear();
-    mpPbSignCertClear.clear();
-    mpEdSignPassword.clear();
-    mpEdSignLocation.clear();
-    mpEdSignContactInfo.clear();
-    mpEdSignReason.clear();
-    mpLBSignTSA.clear();
-    SfxTabPage::dispose();
-}
-
-
-IMPL_LINK_NOARG( ImpPDFTabSigningPage, ClickmaPbSignCertSelect, Button*, void )
-{
-
     Reference< security::XDocumentDigitalSignatures > xSigner(
         security::DocumentDigitalSignatures::createWithVersion(
             comphelper::getProcessComponentContext(), "1.2" ) );
@@ -1626,13 +1607,13 @@ IMPL_LINK_NOARG( ImpPDFTabSigningPage, ClickmaPbSignCertSelect, Button*, void )
 
     if (maSignCertificate.is())
     {
-        mpEdSignCert->SetText(maSignCertificate->getSubjectName());
-        mpPbSignCertClear->Enable();
-        mpEdSignLocation->Enable();
-        mpEdSignPassword->Enable();
-        mpEdSignContactInfo->Enable();
-        mpEdSignReason->Enable();
-        mpEdSignReason->SetText(aDescription);
+        mxEdSignCert->set_text(maSignCertificate->getSubjectName());
+        mxPbSignCertClear->set_sensitive(true);
+        mxEdSignLocation->set_sensitive(true);
+        mxEdSignPassword->set_sensitive(true);
+        mxEdSignContactInfo->set_sensitive(true);
+        mxEdSignReason->set_sensitive(true);
+        mxEdSignReason->set_text(aDescription);
 
         try
         {
@@ -1642,7 +1623,7 @@ IMPL_LINK_NOARG( ImpPDFTabSigningPage, ClickmaPbSignCertSelect, Button*, void )
                 const css::uno::Sequence<OUString>& rTSAURLs = aTSAURLs.get();
                 for (auto const& elem : rTSAURLs)
                 {
-                    mpLBSignTSA->InsertEntry(elem);
+                    mxLBSignTSA->append_text(elem);
                 }
             }
         }
@@ -1652,62 +1633,57 @@ IMPL_LINK_NOARG( ImpPDFTabSigningPage, ClickmaPbSignCertSelect, Button*, void )
         }
 
         // If more than only the "None" entry is there, enable the ListBox
-        if (mpLBSignTSA->GetEntryCount() > 1)
-            mpLBSignTSA->Enable();
+        if (mxLBSignTSA->get_count() > 1)
+            mxLBSignTSA->set_sensitive(true);
     }
 }
 
-
-IMPL_LINK_NOARG( ImpPDFTabSigningPage, ClickmaPbSignCertClear, Button*, void )
+IMPL_LINK_NOARG(ImpPDFTabSigningPage, ClickmaPbSignCertClear, weld::Button&, void)
 {
-    mpEdSignCert->SetText("");
+    mxEdSignCert->set_text("");
     maSignCertificate.clear();
-    mpPbSignCertClear->Enable( false );
-    mpEdSignLocation->Enable( false );
-    mpEdSignPassword->Enable( false );
-    mpEdSignContactInfo->Enable( false );
-    mpEdSignReason->Enable( false );
-    mpLBSignTSA->Enable( false );
+    mxPbSignCertClear->set_sensitive(false);
+    mxEdSignLocation->set_sensitive(false);
+    mxEdSignPassword->set_sensitive(false);
+    mxEdSignContactInfo->set_sensitive(false);
+    mxEdSignReason->set_sensitive(false);
+    mxLBSignTSA->set_sensitive(false);
 }
 
-
 VclPtr<SfxTabPage> ImpPDFTabSigningPage::Create( TabPageParent pParent,
                                                  const SfxItemSet* rAttrSet)
 {
-    return VclPtr<ImpPDFTabSigningPage>::Create( pParent.pParent, *rAttrSet );
+    return VclPtr<ImpPDFTabSigningPage>::Create(pParent, *rAttrSet);
 }
 
-
 void ImpPDFTabSigningPage::GetFilterConfigItem( ImpPDFTabDialog* paParent  )
 {
     paParent->mbSignPDF = maSignCertificate.is();
     paParent->maSignCertificate = maSignCertificate;
-    paParent->msSignLocation = mpEdSignLocation->GetText();
-    paParent->msSignPassword = mpEdSignPassword->GetText();
-    paParent->msSignContact = mpEdSignContactInfo->GetText();
-    paParent->msSignReason = mpEdSignReason->GetText();
+    paParent->msSignLocation = mxEdSignLocation->get_text();
+    paParent->msSignPassword = mxEdSignPassword->get_text();
+    paParent->msSignContact = mxEdSignContactInfo->get_text();
+    paParent->msSignReason = mxEdSignReason->get_text();
     // Entry 0 is 'None'
-    if (mpLBSignTSA->GetSelectedEntryPos() >= 1)
-        paParent->msSignTSA = mpLBSignTSA->GetSelectedEntry();
+    if (mxLBSignTSA->get_active() >= 1)
+        paParent->msSignTSA = mxLBSignTSA->get_active_text();
 }
 
-
 void ImpPDFTabSigningPage::SetFilterConfigItem( const  ImpPDFTabDialog* paParent )
 {
-
-    mpEdSignLocation->Enable( false );
-    mpEdSignPassword->Enable( false );
-    mpEdSignContactInfo->Enable( false );
-    mpEdSignReason->Enable( false );
-    mpLBSignTSA->Enable( false );
-    mpPbSignCertClear->Enable( false );
+    mxEdSignLocation->set_sensitive(false);
+    mxEdSignPassword->set_sensitive(false);
+    mxEdSignContactInfo->set_sensitive(false);
+    mxEdSignReason->set_sensitive(false);
+    mxLBSignTSA->set_sensitive(false);
+    mxPbSignCertClear->set_sensitive(false);
 
     if (paParent->mbSignPDF)
     {
-        mpEdSignPassword->SetText(paParent->msSignPassword);
-        mpEdSignLocation->SetText(paParent->msSignLocation);
-        mpEdSignContactInfo->SetText(paParent->msSignContact);
-        mpEdSignReason->SetText(paParent->msSignReason);
+        mxEdSignPassword->set_text(paParent->msSignPassword);
+        mxEdSignLocation->set_text(paParent->msSignLocation);
+        mxEdSignContactInfo->set_text(paParent->msSignContact);
+        mxEdSignReason->set_text(paParent->msSignReason);
         maSignCertificate = paParent->maSignCertificate;
     }
 }
diff --git a/filter/source/pdf/impdialog.hxx b/filter/source/pdf/impdialog.hxx
index 8f09a32cf3f3..477081b2eaa5 100644
--- a/filter/source/pdf/impdialog.hxx
+++ b/filter/source/pdf/impdialog.hxx
@@ -405,24 +405,24 @@ public:
 //class to implement the digital signing
 class ImpPDFTabSigningPage : public SfxTabPage
 {
-    VclPtr<Edit>                mpEdSignCert;
-    VclPtr<PushButton>          mpPbSignCertSelect;
-    VclPtr<PushButton>          mpPbSignCertClear;
-    VclPtr<Edit>                mpEdSignPassword;
-    VclPtr<Edit>                mpEdSignLocation;
-    VclPtr<Edit>                mpEdSignContactInfo;
-    VclPtr<Edit>                mpEdSignReason;
-    VclPtr<ListBox>             mpLBSignTSA;
     css::uno::Reference< css::security::XCertificate > maSignCertificate;
 
-    DECL_LINK( ClickmaPbSignCertSelect, Button*, void );
-    DECL_LINK( ClickmaPbSignCertClear, Button*, void );
+    std::unique_ptr<weld::Entry> mxEdSignCert;
+    std::unique_ptr<weld::Button> mxPbSignCertSelect;
+    std::unique_ptr<weld::Button> mxPbSignCertClear;
+    std::unique_ptr<weld::Entry> mxEdSignPassword;
+    std::unique_ptr<weld::Entry> mxEdSignLocation;
+    std::unique_ptr<weld::Entry> mxEdSignContactInfo;
+    std::unique_ptr<weld::Entry> mxEdSignReason;
+    std::unique_ptr<weld::ComboBoxText> mxLBSignTSA;
+
+    DECL_LINK(ClickmaPbSignCertSelect, weld::Button&, void);
+    DECL_LINK(ClickmaPbSignCertClear, weld::Button&, void);
 
 public:
-                                ImpPDFTabSigningPage( vcl::Window* pParent, const SfxItemSet& rSet );
+    ImpPDFTabSigningPage(TabPageParent pParent, const SfxItemSet& rSet);
     virtual                     ~ImpPDFTabSigningPage() override;
 
-    virtual void                dispose() override;
     static VclPtr<SfxTabPage>   Create( TabPageParent pParent, const SfxItemSet* rAttrSet );
 
     void                        GetFilterConfigItem( ImpPDFTabDialog* paParent);
@@ -431,5 +431,4 @@ public:
 
 #endif // INCLUDED_FILTER_SOURCE_PDF_IMPDIALOG_HXX
 
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/uiconfig/ui/pdfsignpage.ui b/filter/uiconfig/ui/pdfsignpage.ui
index 0382a926bb61..a75b5faf9341 100644
--- a/filter/uiconfig/ui/pdfsignpage.ui
+++ b/filter/uiconfig/ui/pdfsignpage.ui
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.22.1 -->
 <interface domain="flt">
   <requires lib="gtk+" version="3.18"/>
   <object class="GtkFrame" id="PdfSignPage">
@@ -33,10 +33,10 @@
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <property name="hexpand">True</property>
-                    <property name="xalign">0</property>
                     <property name="label" translatable="yes" context="pdfsignpage|label2">Use this certificate to digitally sign PDF documents:</property>
                     <property name="use_underline">True</property>
                     <property name="mnemonic_widget">cert</property>
+                    <property name="xalign">0</property>
                   </object>
                   <packing>
                     <property name="left_attach">0</property>
@@ -48,6 +48,7 @@
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="hexpand">True</property>
+                    <property name="activates_default">True</property>
                   </object>
                   <packing>
                     <property name="left_attach">0</property>
@@ -106,6 +107,7 @@
                     <property name="can_focus">True</property>
                     <property name="hexpand">True</property>
                     <property name="visibility">False</property>
+                    <property name="activates_default">True</property>
                   </object>
                   <packing>
                     <property name="left_attach">1</property>
@@ -117,6 +119,7 @@
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="hexpand">True</property>
+                    <property name="activates_default">True</property>
                   </object>
                   <packing>
                     <property name="left_attach">1</property>
@@ -128,6 +131,7 @@
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="hexpand">True</property>
+                    <property name="activates_default">True</property>
                   </object>
                   <packing>
                     <property name="left_attach">1</property>
@@ -139,6 +143,7 @@
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="hexpand">True</property>
+                    <property name="activates_default">True</property>
                   </object>
                   <packing>
                     <property name="left_attach">1</property>
@@ -149,7 +154,6 @@
                   <object class="GtkComboBoxText" id="tsa">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
-                    <property name="has_entry">False</property>
                     <items>
                       <item translatable="yes" context="pdfsignpage|tsa">None</item>
                     </items>
@@ -163,10 +167,10 @@
                   <object class="GtkLabel" id="label7">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="xalign">1</property>
                     <property name="label" translatable="yes" context="pdfsignpage|label7">Certificate password:</property>
                     <property name="use_underline">True</property>
                     <property name="mnemonic_widget">password</property>
+                    <property name="xalign">1</property>
                   </object>
                   <packing>
                     <property name="left_attach">0</property>
@@ -177,10 +181,10 @@
                   <object class="GtkLabel" id="label12">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="xalign">1</property>
                     <property name="label" translatable="yes" context="pdfsignpage|label12">Location:</property>
                     <property name="use_underline">True</property>
                     <property name="mnemonic_widget">location</property>
+                    <property name="xalign">1</property>
                   </object>
                   <packing>
                     <property name="left_attach">0</property>
@@ -191,10 +195,10 @@
                   <object class="GtkLabel" id="label13">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="xalign">1</property>
                     <property name="label" translatable="yes" context="pdfsignpage|label13">Contact information:</property>
                     <property name="use_underline">True</property>
                     <property name="mnemonic_widget">contact</property>
+                    <property name="xalign">1</property>
                   </object>
                   <packing>
                     <property name="left_attach">0</property>
@@ -205,10 +209,10 @@
                   <object class="GtkLabel" id="label14">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="xalign">1</property>
                     <property name="label" translatable="yes" context="pdfsignpage|label14">Reason:</property>
                     <property name="use_underline">True</property>
                     <property name="mnemonic_widget">reason</property>
+                    <property name="xalign">1</property>
                   </object>
                   <packing>
                     <property name="left_attach">0</property>
@@ -219,10 +223,10 @@
                   <object class="GtkLabel" id="label15">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="xalign">1</property>
                     <property name="label" translatable="yes" context="pdfsignpage|label15">Time Stamp Authority:</property>
                     <property name="use_underline">True</property>
                     <property name="mnemonic_widget">tsa</property>
+                    <property name="xalign">1</property>
                   </object>
                   <packing>
                     <property name="left_attach">0</property>


More information about the Libreoffice-commits mailing list