weld ImpPDFTabSigningPage

Change-Id: Ia81f3f2ac3644e496ab679dc8e274b2d50f64edd
Reviewed-on: https://gerrit.libreoffice.org/56020
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
Caolán McNamara
2018-06-18 11:52:33 +01:00
parent 37210da00a
commit ace8342c76
3 changed files with 73 additions and 94 deletions

View File

@@ -1574,48 +1574,29 @@ IMPL_LINK_NOARG(ImplErrorDialog, SelectHdl, weld::TreeView&, void)
} }
/// The digital signatures tab page /// The digital signatures tab page
ImpPDFTabSigningPage::ImpPDFTabSigningPage(vcl::Window* pParent, const SfxItemSet& rCoreSet) ImpPDFTabSigningPage::ImpPDFTabSigningPage(TabPageParent pParent, const SfxItemSet& rCoreSet)
: SfxTabPage(pParent, "PdfSignPage","filter/ui/pdfsignpage.ui", &rCoreSet) : SfxTabPage(pParent, "filter/ui/pdfsignpage.ui", "PdfSignPage", &rCoreSet)
, maSignCertificate() , 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"); mxPbSignCertSelect->set_sensitive(false);
get(mpPbSignCertSelect, "select"); mxPbSignCertSelect->connect_clicked(LINK(this, ImpPDFTabSigningPage, ClickmaPbSignCertSelect));
get(mpPbSignCertClear, "clear"); mxPbSignCertClear->connect_clicked(LINK(this, ImpPDFTabSigningPage, ClickmaPbSignCertClear));
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 ) );
} }
ImpPDFTabSigningPage::~ImpPDFTabSigningPage() ImpPDFTabSigningPage::~ImpPDFTabSigningPage()
{ {
disposeOnce();
} }
IMPL_LINK_NOARG(ImpPDFTabSigningPage, ClickmaPbSignCertSelect, weld::Button&, void)
void ImpPDFTabSigningPage::dispose()
{ {
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( Reference< security::XDocumentDigitalSignatures > xSigner(
security::DocumentDigitalSignatures::createWithVersion( security::DocumentDigitalSignatures::createWithVersion(
comphelper::getProcessComponentContext(), "1.2" ) ); comphelper::getProcessComponentContext(), "1.2" ) );
@@ -1626,13 +1607,13 @@ IMPL_LINK_NOARG( ImpPDFTabSigningPage, ClickmaPbSignCertSelect, Button*, void )
if (maSignCertificate.is()) if (maSignCertificate.is())
{ {
mpEdSignCert->SetText(maSignCertificate->getSubjectName()); mxEdSignCert->set_text(maSignCertificate->getSubjectName());
mpPbSignCertClear->Enable(); mxPbSignCertClear->set_sensitive(true);
mpEdSignLocation->Enable(); mxEdSignLocation->set_sensitive(true);
mpEdSignPassword->Enable(); mxEdSignPassword->set_sensitive(true);
mpEdSignContactInfo->Enable(); mxEdSignContactInfo->set_sensitive(true);
mpEdSignReason->Enable(); mxEdSignReason->set_sensitive(true);
mpEdSignReason->SetText(aDescription); mxEdSignReason->set_text(aDescription);
try try
{ {
@@ -1642,7 +1623,7 @@ IMPL_LINK_NOARG( ImpPDFTabSigningPage, ClickmaPbSignCertSelect, Button*, void )
const css::uno::Sequence<OUString>& rTSAURLs = aTSAURLs.get(); const css::uno::Sequence<OUString>& rTSAURLs = aTSAURLs.get();
for (auto const& elem : rTSAURLs) 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 more than only the "None" entry is there, enable the ListBox
if (mpLBSignTSA->GetEntryCount() > 1) if (mxLBSignTSA->get_count() > 1)
mpLBSignTSA->Enable(); mxLBSignTSA->set_sensitive(true);
} }
} }
IMPL_LINK_NOARG(ImpPDFTabSigningPage, ClickmaPbSignCertClear, weld::Button&, void)
IMPL_LINK_NOARG( ImpPDFTabSigningPage, ClickmaPbSignCertClear, Button*, void )
{ {
mpEdSignCert->SetText(""); mxEdSignCert->set_text("");
maSignCertificate.clear(); maSignCertificate.clear();
mpPbSignCertClear->Enable( false ); mxPbSignCertClear->set_sensitive(false);
mpEdSignLocation->Enable( false ); mxEdSignLocation->set_sensitive(false);
mpEdSignPassword->Enable( false ); mxEdSignPassword->set_sensitive(false);
mpEdSignContactInfo->Enable( false ); mxEdSignContactInfo->set_sensitive(false);
mpEdSignReason->Enable( false ); mxEdSignReason->set_sensitive(false);
mpLBSignTSA->Enable( false ); mxLBSignTSA->set_sensitive(false);
} }
VclPtr<SfxTabPage> ImpPDFTabSigningPage::Create( TabPageParent pParent, VclPtr<SfxTabPage> ImpPDFTabSigningPage::Create( TabPageParent pParent,
const SfxItemSet* rAttrSet) const SfxItemSet* rAttrSet)
{ {
return VclPtr<ImpPDFTabSigningPage>::Create( pParent.pParent, *rAttrSet ); return VclPtr<ImpPDFTabSigningPage>::Create(pParent, *rAttrSet);
} }
void ImpPDFTabSigningPage::GetFilterConfigItem( ImpPDFTabDialog* paParent ) void ImpPDFTabSigningPage::GetFilterConfigItem( ImpPDFTabDialog* paParent )
{ {
paParent->mbSignPDF = maSignCertificate.is(); paParent->mbSignPDF = maSignCertificate.is();
paParent->maSignCertificate = maSignCertificate; paParent->maSignCertificate = maSignCertificate;
paParent->msSignLocation = mpEdSignLocation->GetText(); paParent->msSignLocation = mxEdSignLocation->get_text();
paParent->msSignPassword = mpEdSignPassword->GetText(); paParent->msSignPassword = mxEdSignPassword->get_text();
paParent->msSignContact = mpEdSignContactInfo->GetText(); paParent->msSignContact = mxEdSignContactInfo->get_text();
paParent->msSignReason = mpEdSignReason->GetText(); paParent->msSignReason = mxEdSignReason->get_text();
// Entry 0 is 'None' // Entry 0 is 'None'
if (mpLBSignTSA->GetSelectedEntryPos() >= 1) if (mxLBSignTSA->get_active() >= 1)
paParent->msSignTSA = mpLBSignTSA->GetSelectedEntry(); paParent->msSignTSA = mxLBSignTSA->get_active_text();
} }
void ImpPDFTabSigningPage::SetFilterConfigItem( const ImpPDFTabDialog* paParent ) void ImpPDFTabSigningPage::SetFilterConfigItem( const ImpPDFTabDialog* paParent )
{ {
mxEdSignLocation->set_sensitive(false);
mpEdSignLocation->Enable( false ); mxEdSignPassword->set_sensitive(false);
mpEdSignPassword->Enable( false ); mxEdSignContactInfo->set_sensitive(false);
mpEdSignContactInfo->Enable( false ); mxEdSignReason->set_sensitive(false);
mpEdSignReason->Enable( false ); mxLBSignTSA->set_sensitive(false);
mpLBSignTSA->Enable( false ); mxPbSignCertClear->set_sensitive(false);
mpPbSignCertClear->Enable( false );
if (paParent->mbSignPDF) if (paParent->mbSignPDF)
{ {
mpEdSignPassword->SetText(paParent->msSignPassword); mxEdSignPassword->set_text(paParent->msSignPassword);
mpEdSignLocation->SetText(paParent->msSignLocation); mxEdSignLocation->set_text(paParent->msSignLocation);
mpEdSignContactInfo->SetText(paParent->msSignContact); mxEdSignContactInfo->set_text(paParent->msSignContact);
mpEdSignReason->SetText(paParent->msSignReason); mxEdSignReason->set_text(paParent->msSignReason);
maSignCertificate = paParent->maSignCertificate; maSignCertificate = paParent->maSignCertificate;
} }
} }

View File

@@ -405,24 +405,24 @@ public:
//class to implement the digital signing //class to implement the digital signing
class ImpPDFTabSigningPage : public SfxTabPage 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; css::uno::Reference< css::security::XCertificate > maSignCertificate;
DECL_LINK( ClickmaPbSignCertSelect, Button*, void ); std::unique_ptr<weld::Entry> mxEdSignCert;
DECL_LINK( ClickmaPbSignCertClear, Button*, void ); 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: public:
ImpPDFTabSigningPage( vcl::Window* pParent, const SfxItemSet& rSet ); ImpPDFTabSigningPage(TabPageParent pParent, const SfxItemSet& rSet);
virtual ~ImpPDFTabSigningPage() override; virtual ~ImpPDFTabSigningPage() override;
virtual void dispose() override;
static VclPtr<SfxTabPage> Create( TabPageParent pParent, const SfxItemSet* rAttrSet ); static VclPtr<SfxTabPage> Create( TabPageParent pParent, const SfxItemSet* rAttrSet );
void GetFilterConfigItem( ImpPDFTabDialog* paParent); void GetFilterConfigItem( ImpPDFTabDialog* paParent);
@@ -431,5 +431,4 @@ public:
#endif // INCLUDED_FILTER_SOURCE_PDF_IMPDIALOG_HXX #endif // INCLUDED_FILTER_SOURCE_PDF_IMPDIALOG_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 --> <!-- Generated with glade 3.22.1 -->
<interface domain="flt"> <interface domain="flt">
<requires lib="gtk+" version="3.18"/> <requires lib="gtk+" version="3.18"/>
<object class="GtkFrame" id="PdfSignPage"> <object class="GtkFrame" id="PdfSignPage">
@@ -33,10 +33,10 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="hexpand">True</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="label" translatable="yes" context="pdfsignpage|label2">Use this certificate to digitally sign PDF documents:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">cert</property> <property name="mnemonic_widget">cert</property>
<property name="xalign">0</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
@@ -48,6 +48,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="activates_default">True</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
@@ -106,6 +107,7 @@
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="visibility">False</property> <property name="visibility">False</property>
<property name="activates_default">True</property>
</object> </object>
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">1</property>
@@ -117,6 +119,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="activates_default">True</property>
</object> </object>
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">1</property>
@@ -128,6 +131,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="activates_default">True</property>
</object> </object>
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">1</property>
@@ -139,6 +143,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="activates_default">True</property>
</object> </object>
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">1</property>
@@ -149,7 +154,6 @@
<object class="GtkComboBoxText" id="tsa"> <object class="GtkComboBoxText" id="tsa">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="has_entry">False</property>
<items> <items>
<item translatable="yes" context="pdfsignpage|tsa">None</item> <item translatable="yes" context="pdfsignpage|tsa">None</item>
</items> </items>
@@ -163,10 +167,10 @@
<object class="GtkLabel" id="label7"> <object class="GtkLabel" id="label7">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</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="label" translatable="yes" context="pdfsignpage|label7">Certificate password:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">password</property> <property name="mnemonic_widget">password</property>
<property name="xalign">1</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
@@ -177,10 +181,10 @@
<object class="GtkLabel" id="label12"> <object class="GtkLabel" id="label12">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes" context="pdfsignpage|label12">Location:</property> <property name="label" translatable="yes" context="pdfsignpage|label12">Location:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">location</property> <property name="mnemonic_widget">location</property>
<property name="xalign">1</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
@@ -191,10 +195,10 @@
<object class="GtkLabel" id="label13"> <object class="GtkLabel" id="label13">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</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="label" translatable="yes" context="pdfsignpage|label13">Contact information:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">contact</property> <property name="mnemonic_widget">contact</property>
<property name="xalign">1</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
@@ -205,10 +209,10 @@
<object class="GtkLabel" id="label14"> <object class="GtkLabel" id="label14">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes" context="pdfsignpage|label14">Reason:</property> <property name="label" translatable="yes" context="pdfsignpage|label14">Reason:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">reason</property> <property name="mnemonic_widget">reason</property>
<property name="xalign">1</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
@@ -219,10 +223,10 @@
<object class="GtkLabel" id="label15"> <object class="GtkLabel" id="label15">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</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="label" translatable="yes" context="pdfsignpage|label15">Time Stamp Authority:</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">tsa</property> <property name="mnemonic_widget">tsa</property>
<property name="xalign">1</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>