summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2015-02-16 14:02:23 +0200
committerAndras Timar <andras.timar@collabora.com>2015-03-05 16:51:34 +0100
commita56459cae72f17ebeba408a451451880639bcabf (patch)
treef04c9470bfa58106ca0057d6c008fa7166d669e0
parent46868c9eebc5909f40f813414d74b9b5ea484a99 (diff)
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 (cherry picked from commit 24ad0629ae9edad83514e329e7173b94a8680ea6)
-rw-r--r--cui/Library_cui.mk1
-rw-r--r--cui/UIConfig_cui.mk1
-rw-r--r--cui/source/options/optinet2.cxx18
-rw-r--r--cui/source/options/optinet2.hxx6
-rw-r--r--cui/source/options/tsaurls.cxx120
-rw-r--r--cui/source/options/tsaurls.hxx40
-rw-r--r--cui/uiconfig/ui/optsecuritypage.ui75
-rw-r--r--cui/uiconfig/ui/tsaurldialog.ui230
-rw-r--r--officecfg/registry/schema/org/openoffice/Office/Common.xcs5
9 files changed, 494 insertions, 2 deletions
diff --git a/cui/Library_cui.mk b/cui/Library_cui.mk
index 1ac0ed757ea0..40509913e659 100644
--- a/cui/Library_cui.mk
+++ b/cui/Library_cui.mk
@@ -162,6 +162,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 \
diff --git a/cui/UIConfig_cui.mk b/cui/UIConfig_cui.mk
index cd1859219b54..c53ba4892b2a 100644
--- a/cui/UIConfig_cui.mk
+++ b/cui/UIConfig_cui.mk
@@ -180,6 +180,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 \
diff --git a/cui/source/options/optinet2.cxx b/cui/source/options/optinet2.cxx
index 893848327919..86a99682b685 100644
--- a/cui/source/options/optinet2.cxx
+++ b/cui/source/options/optinet2.cxx
@@ -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(Window* pParent, const SfxItemSet& rSet)
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(Window* pParent, const SfxItemSet& rSet)
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
diff --git a/cui/source/options/optinet2.hxx b/cui/source/options/optinet2.hxx
index c76a8eb97a92..1fc54b87d651 100644
--- a/cui/source/options/optinet2.hxx
+++ b/cui/source/options/optinet2.hxx
@@ -125,9 +125,7 @@ protected:
// class SvxSecurityTabPage ---------------------------------------------
class SvtSecurityOptions;
-
class CertPathDialog;
-
class SvxSecurityTabPage : public SfxTabPage
{
using TabPage::ActivatePage;
@@ -149,6 +147,9 @@ private:
VclContainer* m_pCertFrame;
PushButton* m_pCertPathPB;
+ VclContainer* m_pTSAURLsFrame;
+ PushButton* m_pTSAURLsPB;
+
SvtSecurityOptions* mpSecOptions;
svx::SecurityOptionsDialog* mpSecOptDlg;
@@ -163,6 +164,7 @@ private:
DECL_LINK(ShowPasswordsHdl, void *);
DECL_LINK(MacroSecPBHdl, void* );
DECL_LINK(CertPathPBHdl, void* );
+ DECL_LINK(TSAURLsPBHdl, void* );
void InitControls();
diff --git a/cui/source/options/tsaurls.cxx b/cui/source/options/tsaurls.cxx
new file mode 100644
index 000000000000..9db380135ed7
--- /dev/null
+++ b/cui/source/options/tsaurls.cxx
@@ -0,0 +1,120 @@
+/* -*- 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: */
diff --git a/cui/source/options/tsaurls.hxx b/cui/source/options/tsaurls.hxx
new file mode 100644
index 000000000000..aba749181ac5
--- /dev/null
+++ b/cui/source/options/tsaurls.hxx
@@ -0,0 +1,40 @@
+/* -*- 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: */
diff --git a/cui/uiconfig/ui/optsecuritypage.ui b/cui/uiconfig/ui/optsecuritypage.ui
index 55c94397d2ee..9690d3a5c515 100644
--- a/cui/uiconfig/ui/optsecuritypage.ui
+++ b/cui/uiconfig/ui/optsecuritypage.ui
@@ -8,6 +8,81 @@
<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>
<property name="can_focus">False</property>
diff --git a/cui/uiconfig/ui/tsaurldialog.ui b/cui/uiconfig/ui/tsaurldialog.ui
new file mode 100644
index 000000000000..37ed401cbe6c
--- /dev/null
+++ b/cui/uiconfig/ui/tsaurldialog.ui
@@ -0,0 +1,230 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.16.1 -->
+<interface>
+ <requires lib="gtk+" version="3.0"/>
+ <!-- interface-requires LibreOffice 1.0 -->
+ <object class="GtkDialog" id="TSAURLDialog">
+ <property name="can_focus">False</property>
+ <property name="border_width">6</property>
+ <property name="title" translatable="yes">Time Stamping Authority URLs</property>
+ <property name="type_hint">normal</property>
+ <child internal-child="vbox">
+ <object class="GtkBox" id="dialog-vbox1">
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">12</property>
+ <child internal-child="action_area">
+ <object class="GtkButtonBox" id="dialog-action_area1">
+ <property name="can_focus">False</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="ok">
+ <property name="label">gtk-ok</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="has_default">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="cancel">
+ <property name="label">gtk-cancel</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="help">
+ <property name="label">gtk-help</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="add">
+ <property name="label" translatable="yes">_Add...</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="has_default">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">3</property>
+ <property name="secondary">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="delete">
+ <property name="label" translatable="yes">_Delete...</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="has_default">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">4</property>
+ <property name="secondary">True</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkFrame" id="frame1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">none</property>
+ <child>
+ <object class="GtkAlignment" id="alignment1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="top_padding">6</property>
+ <property name="left_padding">12</property>
+ <child>
+ <object class="GtkGrid" id="grid1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="row_spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="label" translatable="yes">Add or delete Time Stamp Authority URLs</property>
+ <property name="use_underline">True</property>
+ <property name="wrap">True</property>
+ <property name="mnemonic_widget">paths</property>
+ <property name="max_width_chars">60</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="GtkGrid" id="grid2">
+ <property name="can_focus">False</property>
+ <property name="no_show_all">True</property>
+ <child>
+ <object class="GtkLabel" id="enteraurl">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="label" translatable="yes">Enter a Time Stamp Authority URL</property>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkScrolledWindow" id="scrolledwindow1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkTreeView" id="urls:border">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <child internal-child="selection">
+ <object class="GtkTreeSelection" id="urls-selection"/>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">2</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">TSA URL</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="0">ok</action-widget>
+ <action-widget response="0">cancel</action-widget>
+ <action-widget response="0">help</action-widget>
+ <action-widget response="0">add</action-widget>
+ </action-widgets>
+ </object>
+</interface>
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index 54707b2e835f..f03319b40d36 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -2518,6 +2518,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