Kaydet (Commit) 24ad0629 authored tarafından Tor Lillqvist's avatar Tor Lillqvist

tdf#88427: Add GUI to enter and maintain a list of Time Stamping Authorities

It is just a simple list of entered URLs, accessed from the Security page. No
sanity checks for now. No selection of a "default" one for now. Implementation
is much simpler this way. The actual selection of one TSA (or none) is done
when exporting to PDF.

Change-Id: I0392eabc9b9629a6f0a767d1b2337622a61c120f
üst bd5d65e5
......@@ -168,6 +168,7 @@ $(eval $(call gb_Library_add_exception_objects,cui,\
cui/source/options/sdbcdriverenum \
cui/source/options/securityoptions \
cui/source/options/treeopt \
cui/source/options/tsaurls \
cui/source/options/webconninfo \
cui/source/tabpages/align \
cui/source/tabpages/autocdlg \
......
......@@ -197,6 +197,7 @@ $(eval $(call gb_UIConfig_add_uifiles,cui,\
cui/uiconfig/ui/textflowpage \
cui/uiconfig/ui/thesaurus \
cui/uiconfig/ui/transparencytabpage \
cui/uiconfig/ui/tsaurldialog \
cui/uiconfig/ui/twolinespage \
cui/uiconfig/ui/wordcompletionpage \
cui/uiconfig/ui/zoomdialog \
......
......@@ -85,6 +85,7 @@
#include "securityoptions.hxx"
#include "webconninfo.hxx"
#include "certpath.hxx"
#include "tsaurls.hxx"
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
......@@ -601,6 +602,8 @@ SvxSecurityTabPage::SvxSecurityTabPage(vcl::Window* pParent, const SfxItemSet& r
get(m_pMacroSecPB, "macro");
get(m_pCertFrame, "certificatepath");
get(m_pCertPathPB, "cert");
get(m_pTSAURLsFrame, "tsaurls");
get(m_pTSAURLsPB, "tsas");
m_sPasswordStoringDeactivateStr = get<FixedText>("nopasswordsave")->GetText();
InitControls();
......@@ -612,6 +615,7 @@ SvxSecurityTabPage::SvxSecurityTabPage(vcl::Window* pParent, const SfxItemSet& r
m_pShowConnectionsPB->SetClickHdl( LINK( this, SvxSecurityTabPage, ShowPasswordsHdl ) );
m_pMacroSecPB->SetClickHdl( LINK( this, SvxSecurityTabPage, MacroSecPBHdl ) );
m_pCertPathPB->SetClickHdl( LINK( this, SvxSecurityTabPage, CertPathPBHdl ) );
m_pTSAURLsPB->SetClickHdl( LINK( this, SvxSecurityTabPage, TSAURLsPBHdl ) );
ActivatePage( rSet );
}
......@@ -782,6 +786,20 @@ IMPL_LINK_NOARG(SvxSecurityTabPage, CertPathPBHdl)
return 0;
}
IMPL_LINK_NOARG(SvxSecurityTabPage, TSAURLsPBHdl)
{
// Unlike the mpCertPathDlg, we *don't* keep the same dialog object around between
// invocations. Seems clearer to my little brain that way.
TSAURLsDialog* pTSAURLsDlg = new TSAURLsDialog(this);
pTSAURLsDlg->Execute();
delete pTSAURLsDlg;
return 0;
}
IMPL_LINK_NOARG(SvxSecurityTabPage, MacroSecPBHdl)
{
try
......
......@@ -123,9 +123,7 @@ protected:
// class SvxSecurityTabPage ---------------------------------------------
class SvtSecurityOptions;
class CertPathDialog;
class SvxSecurityTabPage : public SfxTabPage
{
using TabPage::ActivatePage;
......@@ -147,6 +145,9 @@ private:
VclContainer* m_pCertFrame;
PushButton* m_pCertPathPB;
VclContainer* m_pTSAURLsFrame;
PushButton* m_pTSAURLsPB;
SvtSecurityOptions* mpSecOptions;
svx::SecurityOptionsDialog* mpSecOptDlg;
......@@ -161,6 +162,7 @@ private:
DECL_LINK(ShowPasswordsHdl, void *);
DECL_LINK(MacroSecPBHdl, void* );
DECL_LINK(CertPathPBHdl, void* );
DECL_LINK(TSAURLsPBHdl, void* );
void InitControls();
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include <officecfg/Office/Common.hxx>
#include <svx/svxdlg.hxx>
#include <cuires.hrc>
#include "tsaurls.hxx"
#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
using namespace ::com::sun::star;
TSAURLsDialog::TSAURLsDialog(vcl::Window* pParent)
: ModalDialog(pParent, "TSAURLDialog", "cui/ui/tsaurldialog.ui")
{
get(m_pAddBtn, "add");
get(m_pDeleteBtn, "delete");
get(m_pOKBtn, "ok");
get(m_pURLListBox, "urls");
m_pURLListBox->SetDropDownLineCount(8);
m_pURLListBox->set_width_request(m_pURLListBox->approximate_char_width() * 32);
m_pOKBtn->Disable();
m_pAddBtn->SetClickHdl( LINK( this, TSAURLsDialog, AddHdl_Impl ) );
m_pDeleteBtn->SetClickHdl( LINK( this, TSAURLsDialog, DeleteHdl_Impl ) );
m_pOKBtn->SetClickHdl( LINK( this, TSAURLsDialog, OKHdl_Impl ) );
try
{
css::uno::Sequence<OUString> aUserSetTSAURLs(officecfg::Office::Common::Security::Scripting::TSAURLs::get());
for (auto i = aUserSetTSAURLs.begin(); i != aUserSetTSAURLs.end(); ++i)
{
AddTSAURL(*i);
}
}
catch (const uno::Exception &e)
{
SAL_WARN("cui.options", "TSAURLsDialog::TSAURLsDialog(): caught exception" << e.Message);
}
}
IMPL_LINK_NOARG(TSAURLsDialog, OKHdl_Impl)
{
std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
css::uno::Sequence<OUString> aNewValue(m_aURLs.size());
size_t n(0);
for (auto i = m_aURLs.cbegin(); i != m_aURLs.cend(); ++i)
aNewValue[n++] = *i;
officecfg::Office::Common::Security::Scripting::TSAURLs::set(aNewValue, batch);
batch->commit();
EndDialog(RET_OK);
return 0;
}
TSAURLsDialog::~TSAURLsDialog()
{
}
void TSAURLsDialog::AddTSAURL(const OUString& rURL)
{
m_aURLs.insert(rURL);
m_pURLListBox->SetUpdateMode(false);
m_pURLListBox->Clear();
for (auto i = m_aURLs.cbegin(); i != m_aURLs.cend(); ++i)
{
m_pURLListBox->InsertEntry(*i);
}
m_pURLListBox->SetUpdateMode(true);
}
IMPL_LINK_NOARG(TSAURLsDialog, AddHdl_Impl)
{
OUString aURL;
OUString aDesc( get<FixedText>("enteraurl")->GetText() );
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
boost::scoped_ptr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog( m_pAddBtn, aURL, aDesc));
if ( pDlg->Execute() == RET_OK )
{
pDlg->GetName( aURL );
AddTSAURL(aURL);
m_pOKBtn->Enable();
}
return 0;
}
IMPL_LINK_NOARG(TSAURLsDialog, DeleteHdl_Impl)
{
sal_Int32 nSel = m_pURLListBox->GetSelectEntryPos();
if (nSel == LISTBOX_ENTRY_NOTFOUND)
return 0;
m_aURLs.erase(m_pURLListBox->GetEntry(nSel));
m_pURLListBox->RemoveEntry(nSel);
m_pOKBtn->Enable();
return 0;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef INCLUDED_CUI_SOURCE_OPTIONS_TSAURLS_HXX
#define INCLUDED_CUI_SOURCE_OPTIONS_TSAURLS_HXX
#include <vcl/lstbox.hxx>
#include <vcl/button.hxx>
class TSAURLsDialog : public ModalDialog
{
private:
ListBox* m_pURLListBox;
PushButton* m_pAddBtn;
PushButton* m_pDeleteBtn;
OKButton* m_pOKBtn;
DECL_LINK(AddHdl_Impl, void *);
DECL_LINK(DeleteHdl_Impl, void *);
DECL_LINK(OKHdl_Impl, void *);
std::set<OUString> m_aURLs;
void AddTSAURL(const OUString &rURL);
public:
TSAURLsDialog(vcl::Window* pParent);
virtual ~TSAURLsDialog();
};
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -7,6 +7,81 @@
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="row_spacing">12</property>
<child>
<object class="GtkFrame" id="tsaurls">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkAlignment" id="alignment5">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="top_padding">6</property>
<property name="left_padding">12</property>
<child>
<object class="GtkGrid" id="grid8">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="column_spacing">24</property>
<child>
<object class="GtkLabel" id="label9">
<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">Maintain a list of Time Stamping Authority (TSA) URLs to be optionally for digital signatures in PDF export.</property>
<property name="wrap">True</property>
<property name="max_width_chars">56</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="tsas">
<property name="label" translatable="yes">_TSAs...</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="valign">center</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="label10">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">TSAs</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">4</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkFrame" id="certificatepath">
<property name="visible">True</property>
......
This diff is collapsed.
......@@ -2510,6 +2510,11 @@
<desc>Contains the path to the users NSS certificate directory.</desc>
</info>
</prop>
<prop oor:name="TSAURLs" oor:type="oor:string-list" oor:nillable="false">
<info>
<desc>Contains the URLs or Time Stamping Authority servers.</desc>
</info>
</prop>
<prop oor:name="WarnPrintDoc" oor:type="xs:boolean" oor:nillable="false">
<info>
<desc>Specifies whether to warn when printing documents with
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment