summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cui/AllLangResTarget_cui.mk1
-rw-r--r--cui/Library_cui.mk1
-rw-r--r--cui/source/inc/cuires.hrc4
-rw-r--r--cui/source/inc/helpid.hrc1
-rw-r--r--cui/source/options/certpath.cxx266
-rw-r--r--cui/source/options/certpath.hrc72
-rw-r--r--cui/source/options/certpath.hxx69
-rw-r--r--cui/source/options/certpath.src110
-rw-r--r--cui/source/options/fontsubs.cxx8
-rw-r--r--cui/source/options/optinet2.cxx52
-rw-r--r--cui/source/options/optinet2.hrc5
-rw-r--r--cui/source/options/optinet2.hxx15
-rw-r--r--cui/source/options/optinet2.src20
-rw-r--r--cui/source/options/optjava.cxx4
-rw-r--r--cui/source/options/optjava.src2
-rw-r--r--cui/source/options/webconninfo.cxx6
-rw-r--r--officecfg/registry/schema/org/openoffice/Office/Common.xcs5
-rw-r--r--svx/inc/svx/simptabl.hxx4
-rw-r--r--xmlsecurity/source/xmlsec/nss/nssinitializer.cxx83
19 files changed, 664 insertions, 64 deletions
diff --git a/cui/AllLangResTarget_cui.mk b/cui/AllLangResTarget_cui.mk
index c4ef420d76b5..b0cd1def25c8 100644
--- a/cui/AllLangResTarget_cui.mk
+++ b/cui/AllLangResTarget_cui.mk
@@ -83,6 +83,7 @@ $(eval $(call gb_SrsTarget_add_files,cui/res,\
cui/source/dialogs/tbxform.src \
cui/source/dialogs/thesdlg.src \
cui/source/dialogs/zoom.src \
+ cui/source/options/certpath.src \
cui/source/options/connpooloptions.src \
cui/source/options/dbregister.src \
cui/source/options/doclinkdialog.src \
diff --git a/cui/Library_cui.mk b/cui/Library_cui.mk
index 125130650cb8..089014e99f6c 100644
--- a/cui/Library_cui.mk
+++ b/cui/Library_cui.mk
@@ -134,6 +134,7 @@ $(eval $(call gb_Library_add_exception_objects,cui,\
cui/source/factory/cuiresmgr \
cui/source/factory/dlgfact \
cui/source/factory/init \
+ cui/source/options/certpath \
cui/source/options/cfgchart \
cui/source/options/connpoolconfig \
cui/source/options/connpooloptions \
diff --git a/cui/source/inc/cuires.hrc b/cui/source/inc/cuires.hrc
index b78294249515..17ca8b58357d 100644
--- a/cui/source/inc/cuires.hrc
+++ b/cui/source/inc/cuires.hrc
@@ -173,7 +173,7 @@
#define RID_SVXERR_JRE_NOT_RECOGNIZED (RID_SVX_START + 256)
#define RID_SVXERR_JRE_FAILED_VERSION (RID_SVX_START + 257)
#define RID_SVX_MSGBOX_JAVA_RESTART ( RID_SVX_START + 0 )
-#define RID_SVX_MSGBOX_JAVA_RESTART2 ( RID_SVX_START + 1 )
+#define RID_SVX_MSGBOX_OPTIONS_RESTART ( RID_SVX_START + 1 )
#define RID_SVXDLG_LNG_ED_NUM_PREBREAK (RID_SVX_START + 830)
#define RID_SVXDLG_EDIT_MODULES (RID_SVX_START + 831)
#define RID_SVXSTR_PATH_NAME_START (RID_SVX_START + 1003)
@@ -434,6 +434,8 @@
#define RID_CUISTR_CONTROLS_INVISIBLE (RID_SVX_START + 1196)
#define RID_CUISTR_CONTROLS_INSERTTABLE (RID_SVX_START + 1197)
+#define RID_SVXDLG_CERTPATH (RID_SVX_START + 1198)
+
#define RID_CUI_DIALOG_COLORPICKER (RID_SVX_START + 3)
#endif
diff --git a/cui/source/inc/helpid.hrc b/cui/source/inc/helpid.hrc
index ea1bcd1d487e..65c71807bbee 100644
--- a/cui/source/inc/helpid.hrc
+++ b/cui/source/inc/helpid.hrc
@@ -397,6 +397,7 @@
#define HID_DLG_PASSWORD_TO_OPEN_MODIFY_PASSWORD_TO_MODIFY "CUI_HID_DLG_PASSWORD_TO_OPEN_MODIFY_PASSWORD_TO_MODIFY"
#define HID_DLG_PASSWORD_TO_OPEN_MODIFY_CONFIRM_PASSWORD_TO_MODIFY "CUI_HID_DLG_PASSWORD_TO_OPEN_MODIFY_CONFIRM_PASSWORD_TO_MODIFY"
#define HID_HYPERLINK_DIALOG "CUI_HID_HYPERLINK_DIALOG"
+#define HID_DLG_CERTPATH "CUI_HID_DLG_CERTPATH"
#endif
diff --git a/cui/source/options/certpath.cxx b/cui/source/options/certpath.cxx
new file mode 100644
index 000000000000..b2201255d04b
--- /dev/null
+++ b/cui/source/options/certpath.cxx
@@ -0,0 +1,266 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2012 Red Hat, Inc., Caolán McNamara <caolanm@redhat.com>
+ * (initial developer)
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include <officecfg/Office/Common.hxx>
+#include <osl/file.hxx>
+#include <osl/security.hxx>
+#include <svtools/stdctrl.hxx>
+#include <unotools/securityoptions.hxx>
+#include <cuires.hrc>
+#include "certpath.hxx"
+#include "certpath.hrc"
+#include "dialmgr.hxx"
+
+#include <com/sun/star/mozilla/XMozillaBootstrap.hpp>
+#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
+#include <com/sun/star/ui/dialogs/XFolderPicker.hpp>
+#include <comphelper/processfactory.hxx>
+
+using namespace ::com::sun::star;
+
+CertPathDialog::CertPathDialog( Window* pParent ) :
+ ModalDialog( pParent, CUI_RES( RID_SVXDLG_CERTPATH ) )
+ , m_aCertPathFL ( this, CUI_RES( FL_CERTPATH ) )
+ , m_aCertPathFT ( this, CUI_RES( FT_CERTPATH ) )
+ , m_aCertPathListContainer( this, CUI_RES( LB_CERTPATH ) )
+ , m_aCertPathList( m_aCertPathListContainer )
+ , m_aAddBtn ( this, CUI_RES( PB_ADD ) )
+ , m_aButtonsFL ( this, CUI_RES( FL_BUTTONS ) )
+ , m_aOKBtn ( this, CUI_RES( PB_OK ) )
+ , m_aCancelBtn ( this, CUI_RES( PB_CANCEL ) )
+ , m_aHelpBtn ( this, CUI_RES( PB_HELP ) )
+ , m_sAddDialogText(ResId::toString(CUI_RES(STR_ADDDLGTEXT)))
+ , m_sManual(ResId::toString(CUI_RES(STR_MANUAL)))
+{
+ static long aStaticTabs[]=
+ {
+ 3, 0, 10, 70
+ };
+
+ m_aCertPathList.SvxSimpleTable::SetTabs( aStaticTabs );
+
+ rtl::OUString sProfile(ResId::toString(CUI_RES(STR_PROFILE)));
+ rtl::OUString sDirectory(ResId::toString(CUI_RES(STR_DIRECTORY)));
+
+ rtl::OUStringBuffer sHeader;
+ sHeader.append('\t').append(sProfile).append('\t').append(sDirectory);
+ m_aCertPathList.InsertHeaderEntry( sHeader.makeStringAndClear(), HEADERBAR_APPEND, HIB_LEFT );
+ m_aCertPathList.SetCheckButtonHdl( LINK( this, CertPathDialog, CheckHdl_Impl ) );
+
+ m_aAddBtn.SetClickHdl( LINK( this, CertPathDialog, AddHdl_Impl ) );
+ m_aOKBtn.SetClickHdl( LINK( this, CertPathDialog, OKHdl_Impl ) );
+
+ FreeResource();
+
+ try
+ {
+ mozilla::MozillaProductType productTypes[3] = {
+ mozilla::MozillaProductType_Thunderbird,
+ mozilla::MozillaProductType_Firefox,
+ mozilla::MozillaProductType_Mozilla };
+ const char* productNames[3] = {
+ "thunderbird",
+ "firefox",
+ "mozilla" };
+ sal_Int32 nProduct = SAL_N_ELEMENTS(productTypes);
+
+ uno::Reference<uno::XInterface> xInstance = comphelper::getProcessServiceFactory()->createInstance(
+ "com.sun.star.mozilla.MozillaBootstrap");
+
+ uno::Reference<mozilla::XMozillaBootstrap> xMozillaBootstrap(xInstance, uno::UNO_QUERY_THROW);
+
+ for (sal_Int32 i = 0; i < nProduct; ++i)
+ {
+ ::rtl::OUString profile = xMozillaBootstrap->getDefaultProfile(productTypes[i]);
+
+ if (!profile.isEmpty())
+ {
+ ::rtl::OUString sProfilePath = xMozillaBootstrap->getProfilePath( productTypes[i], profile );
+ rtl::OUStringBuffer sEntry;
+ sEntry.append('\t').appendAscii(productNames[i]).append(':').append(profile).append('\t').append(sProfilePath);
+ SvLBoxEntry *pEntry = m_aCertPathList.InsertEntry(sEntry.makeStringAndClear());
+ rtl::OUString* pCertPath = new rtl::OUString(sProfilePath);
+ pEntry->SetUserData(pCertPath);
+ }
+ }
+ }
+ catch (const uno::Exception&)
+ {
+ }
+
+ SvLBoxEntry *pEntry = m_aCertPathList.GetEntry(0);
+ if (pEntry)
+ {
+ m_aCertPathList.SetCheckButtonState(pEntry, SV_BUTTON_CHECKED);
+ HandleCheckEntry(pEntry);
+ }
+
+ try
+ {
+ rtl::OUString sUserSetCertPath =
+ officecfg::Office::Common::Security::Scripting::CertDir::get().get_value_or(rtl::OUString());
+
+ if (!sUserSetCertPath.isEmpty())
+ AddCertPath(m_sManual, sUserSetCertPath);
+ }
+ catch (const uno::Exception &e)
+ {
+ SAL_WARN("cui.options", "CertPathDialog::CertPathDialog(): caught exception" << e.Message);
+ }
+
+ const char* pEnv = getenv("MOZILLA_CERTIFICATE_FOLDER");
+ if (pEnv)
+ AddCertPath("$MOZILLA_CERTIFICATE_FOLDER", rtl::OUString(pEnv, strlen(pEnv), osl_getThreadTextEncoding()));
+}
+
+IMPL_LINK_NOARG(CertPathDialog, OKHdl_Impl)
+{
+ fprintf(stderr, "dir is %s\n", rtl::OUStringToOString(getDirectory(), RTL_TEXTENCODING_UTF8).getStr());
+
+ try
+ {
+ boost::shared_ptr< comphelper::ConfigurationChanges > batch(
+ comphelper::ConfigurationChanges::create());
+ officecfg::Office::Common::Security::Scripting::CertDir::set(
+ getDirectory(), batch);
+ batch->commit();
+ }
+ catch (const uno::Exception &e)
+ {
+ SAL_WARN("cui.options", "CertPathDialog::OKHdl_Impl(): caught exception" << e.Message);
+ }
+
+ EndDialog(true);
+
+ return 0;
+}
+
+rtl::OUString CertPathDialog::getDirectory() const
+{
+ SvLBoxEntry* pEntry = m_aCertPathList.FirstSelected();
+ void* pCertPath = pEntry ? pEntry->GetUserData() : NULL;
+ return pCertPath ? *static_cast<rtl::OUString*>(pCertPath) : rtl::OUString();
+}
+
+CertPathDialog::~CertPathDialog()
+{
+ SvLBoxEntry* pEntry = m_aCertPathList.First();
+ while (pEntry)
+ {
+ rtl::OUString* pCertPath = static_cast<rtl::OUString*>(pEntry->GetUserData());
+ delete pCertPath;
+ pEntry = m_aCertPathList.Next( pEntry );
+ }
+}
+
+IMPL_LINK( CertPathDialog, CheckHdl_Impl, SvxSimpleTable *, pList )
+{
+ SvLBoxEntry* pEntry = pList ? m_aCertPathList.GetEntry(m_aCertPathList.GetCurMousePoint())
+ : m_aCertPathList.FirstSelected();
+ if (pEntry)
+ m_aCertPathList.HandleEntryChecked(pEntry);
+ return 0;
+}
+
+void CertPathDialog::HandleCheckEntry( SvLBoxEntry* _pEntry )
+{
+ m_aCertPathList.Select( _pEntry, true );
+ SvButtonState eState = m_aCertPathList.GetCheckButtonState( _pEntry );
+
+ if (SV_BUTTON_CHECKED == eState)
+ {
+ // uncheck the other entries
+ SvLBoxEntry* pEntry = m_aCertPathList.First();
+ while (pEntry)
+ {
+ if (pEntry != _pEntry)
+ m_aCertPathList.SetCheckButtonState(pEntry, SV_BUTTON_UNCHECKED);
+ pEntry = m_aCertPathList.Next(pEntry);
+ }
+ }
+ else
+ m_aCertPathList.SetCheckButtonState(_pEntry, SV_BUTTON_CHECKED);
+}
+
+void CertPathDialog::AddCertPath(const rtl::OUString &rProfile, const rtl::OUString &rPath)
+{
+ SvLBoxEntry* pEntry = m_aCertPathList.First();
+ while (pEntry)
+ {
+ rtl::OUString* pCertPath = static_cast<rtl::OUString*>(pEntry->GetUserData());
+ //already exists, just select the original one
+ if (pCertPath->equals(rPath))
+ {
+ m_aCertPathList.SetCheckButtonState(pEntry, SV_BUTTON_CHECKED);
+ HandleCheckEntry(pEntry);
+ return;
+ }
+ pEntry = m_aCertPathList.Next(pEntry);
+ }
+
+ rtl::OUStringBuffer sEntry;
+ sEntry.append('\t').append(rProfile).append('\t').append(rPath);
+ pEntry = m_aCertPathList.InsertEntry(sEntry.makeStringAndClear());
+ rtl::OUString* pCertPath = new rtl::OUString(rPath);
+ pEntry->SetUserData(pCertPath);
+ m_aCertPathList.SetCheckButtonState(pEntry, SV_BUTTON_CHECKED);
+ HandleCheckEntry(pEntry);
+}
+
+IMPL_LINK_NOARG(CertPathDialog, AddHdl_Impl)
+{
+ try
+ {
+ uno::Reference<uno::XInterface> xInstance = comphelper::getProcessServiceFactory()->createInstance(
+ "com.sun.star.ui.dialogs.FolderPicker");
+
+ uno::Reference<ui::dialogs::XFolderPicker> xFolderPicker(xInstance, uno::UNO_QUERY_THROW);
+
+ rtl::OUString sURL;
+ osl::Security().getHomeDir(sURL);
+ xFolderPicker->setDisplayDirectory(sURL);
+ xFolderPicker->setDescription(m_sAddDialogText);
+
+ if (xFolderPicker->execute() == ui::dialogs::ExecutableDialogResults::OK)
+ {
+ sURL = xFolderPicker->getDirectory();
+ rtl::OUString aPath;
+ if (osl::FileBase::E_None == osl::FileBase::getSystemPathFromFileURL(sURL, aPath))
+ AddCertPath(m_sManual, aPath);
+ }
+ }
+ catch (const uno::Exception&)
+ {
+ SAL_WARN( "cui.options", "CertPathDialog::AddHdl_Impl(): caught exception" );
+ }
+
+ return 0;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/options/certpath.hrc b/cui/source/options/certpath.hrc
new file mode 100644
index 000000000000..98f885cb70c8
--- /dev/null
+++ b/cui/source/options/certpath.hrc
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2012 Red Hat, Inc., Caolán McNamara <caolanm@redhat.com>
+ * (initial developer)
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#ifndef _CUI_CERTPATH_HRC
+#define _CUI_CERTPATH_HRC
+
+#define FL_CERTPATH 1
+#define FT_CERTPATH 2
+#define LB_CERTPATH 3
+#define PB_ADD 4
+#define FL_BUTTONS 5
+#define PB_OK 6
+#define PB_CANCEL 7
+#define PB_HELP 8
+#define STR_ADDDLGTEXT 9
+#define STR_MANUAL 10
+#define STR_PROFILE 11
+#define STR_DIRECTORY 12
+
+#define DLG_WIDTH 260
+
+#define COL_0 (RSC_SP_DLG_INNERBORDER_LEFT)
+#define COL_1 (COL_0+RSC_SP_FLGR_SPACE_X)
+#define COL_2 (COL_1+RSC_SP_CHK_TEXTINDENT)
+#define COL_4 (DLG_WIDTH-RSC_SP_DLG_INNERBORDER_RIGHT)
+#define COL_3 (COL_4-RSC_SP_FLGR_SPACE_X)
+
+#define COL_C (COL_4-RSC_CD_PUSHBUTTON_WIDTH)
+#define COL_B (COL_C-RSC_SP_CTRL_X-RSC_CD_PUSHBUTTON_WIDTH)
+#define COL_A (COL_B-RSC_SP_CTRL_GROUP_X-RSC_CD_PUSHBUTTON_WIDTH)
+
+#define CHECKBOX_WIDTH ((COL_3-COL_2-RSC_SP_CTRL_X)/2)
+
+#define ROW_0 (RSC_SP_DLG_INNERBORDER_TOP)
+#define ROW_1 (ROW_0+RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_FLGR_SPACE_Y)
+#define ROW_2 (ROW_1+2*RSC_CD_FIXEDTEXT_HEIGHT+RSC_SP_FLGR_SPACE_Y)
+#define ROW_3 (ROW_2+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_FLGR_SPACE_Y)
+#define ROW_4 (ROW_3+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_FLGR_SPACE_Y)
+#define ROW_5 (ROW_4+RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_FLGR_SPACE_Y)
+#define ROW_6 (ROW_5+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_FLGR_SPACE_Y)
+#define ROW_7 (ROW_6+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_FLGR_SPACE_Y)
+#define ROW_8 (ROW_7+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_FLGR_SPACE_Y)
+#define ROW_9 (ROW_8+RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_FLGR_SPACE_Y)
+#define ROW_10 (ROW_9+RSC_CD_PUSHBUTTON_HEIGHT+RSC_SP_DLG_INNERBORDER_BOTTOM)
+
+#endif // #ifndef _CUI_CERTPATH_HRC
diff --git a/cui/source/options/certpath.hxx b/cui/source/options/certpath.hxx
new file mode 100644
index 000000000000..8c54c3f2b95d
--- /dev/null
+++ b/cui/source/options/certpath.hxx
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2012 Red Hat, Inc., Caolán McNamara <caolanm@redhat.com>
+ * (initial developer)
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#ifndef _CUI_CERTPATH_HXX
+#define _CUI_CERTPATH_HXX
+
+#include <sfx2/basedlgs.hxx>
+#include <svx/simptabl.hxx>
+#include <vcl/button.hxx>
+#include <vcl/fixed.hxx>
+#include "radiobtnbox.hxx"
+
+class CertPathDialog : public ModalDialog
+{
+private:
+ FixedLine m_aCertPathFL;
+ FixedText m_aCertPathFT;
+ SvxSimpleTableContainer m_aCertPathListContainer;
+ svx::SvxRadioButtonListBox m_aCertPathList;
+ PushButton m_aAddBtn;
+ FixedLine m_aButtonsFL;
+ OKButton m_aOKBtn;
+ CancelButton m_aCancelBtn;
+ HelpButton m_aHelpBtn;
+ rtl::OUString m_sAddDialogText;
+ rtl::OUString m_sManual;
+
+ DECL_LINK(CheckHdl_Impl, SvxSimpleTable *);
+ DECL_LINK(AddHdl_Impl, void *);
+ DECL_LINK(OKHdl_Impl, void *);
+
+ void HandleCheckEntry(SvLBoxEntry* _pEntry);
+ void AddCertPath(const rtl::OUString &rProfile, const rtl::OUString &rPath);
+public:
+ CertPathDialog(Window* pParent);
+ ~CertPathDialog();
+
+ rtl::OUString getDirectory() const;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/options/certpath.src b/cui/source/options/certpath.src
new file mode 100644
index 000000000000..5c821c78c82a
--- /dev/null
+++ b/cui/source/options/certpath.src
@@ -0,0 +1,110 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2012 Red Hat, Inc., Caolán McNamara <caolanm@redhat.com>
+ * (initial developer)
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include <svtools/controldims.hrc>
+#include "certpath.hrc"
+#include <cuires.hrc>
+#include "helpid.hrc"
+
+ModalDialog RID_SVXDLG_CERTPATH
+{
+ HelpID = HID_DLG_CERTPATH ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( DLG_WIDTH , ROW_10 ) ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ Text [ en-US ] = "Certificate Path" ;
+ FixedLine FL_CERTPATH
+ {
+ Pos = MAP_APPFONT ( COL_0 , ROW_0 ) ;
+ Size = MAP_APPFONT ( 248 , RSC_CD_FIXEDLINE_HEIGHT ) ;
+ Text [ en-US ] = "Certificate Path" ;
+ };
+ FixedText FT_CERTPATH
+ {
+ Pos = MAP_APPFONT ( COL_1 , ROW_1 ) ;
+ Size = MAP_APPFONT ( COL_C - COL_1 - RSC_SP_FLGR_SPACE_X , ROW_2 - ROW_1 ) ;
+ Wordbreak = TRUE;
+ Text [ en-US ] = "Select or add the correct Network Security Services Certificate directory to use for digital signatures:" ;
+ };
+ Control LB_CERTPATH
+ {
+ Pos = MAP_APPFONT ( COL_1 , ROW_2 ) ;
+ Size = MAP_APPFONT ( COL_C - COL_1 - RSC_SP_FLGR_SPACE_X, ROW_8 - ROW_2 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ };
+ PushButton PB_ADD
+ {
+ Pos = MAP_APPFONT ( COL_C , ROW_2 ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ Text [ en-US ] = "~Add..." ;
+ };
+ FixedLine FL_BUTTONS
+ {
+ Pos = MAP_APPFONT( 0, ROW_8 );
+ Size = MAP_APPFONT( DLG_WIDTH, RSC_CD_FIXEDLINE_HEIGHT );
+ };
+ OKButton PB_OK
+ {
+ Pos = MAP_APPFONT ( COL_A , ROW_9 ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton PB_CANCEL
+ {
+ Pos = MAP_APPFONT ( COL_B , ROW_9 ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton PB_HELP
+ {
+ Pos = MAP_APPFONT ( COL_C , ROW_9 ) ;
+ Size = MAP_APPFONT ( RSC_CD_PUSHBUTTON_WIDTH , RSC_CD_PUSHBUTTON_HEIGHT ) ;
+ TabStop = TRUE ;
+ };
+ String STR_ADDDLGTEXT
+ {
+ Text [ en-US ] = "Select a Certificate directory" ;
+ };
+ String STR_MANUAL
+ {
+ Text [ en-US ] = "manual" ;
+ };
+ String STR_PROFILE
+ {
+ Text [ en-US ] = "Profile" ;
+ };
+ String STR_DIRECTORY
+ {
+ Text [ en-US ] = "Directory" ;
+ };
+};
diff --git a/cui/source/options/fontsubs.cxx b/cui/source/options/fontsubs.cxx
index d59c5eeb3739..9bbe165acb2d 100644
--- a/cui/source/options/fontsubs.cxx
+++ b/cui/source/options/fontsubs.cxx
@@ -134,12 +134,12 @@ SvxFontSubstTabPage::SvxFontSubstTabPage( Window* pParent,
sHeader += sHeader4;
aCheckLB.InsertHeaderEntry(sHeader);
- HeaderBar* pBar = aCheckLB.GetTheHeaderBar();
+ HeaderBar &rBar = aCheckLB.GetTheHeaderBar();
- HeaderBarItemBits nBits = pBar->GetItemBits(1) | HIB_FIXEDPOS | HIB_FIXED;
+ HeaderBarItemBits nBits = rBar.GetItemBits(1) | HIB_FIXEDPOS | HIB_FIXED;
nBits &= ~HIB_CLICKABLE;
- pBar->SetItemBits(1, nBits);
- pBar->SetItemBits(2, nBits);
+ rBar.SetItemBits(1, nBits);
+ rBar.SetItemBits(2, nBits);
sal_uInt16 nHeight;
for(nHeight = 6; nHeight <= 16; nHeight++)
diff --git a/cui/source/options/optinet2.cxx b/cui/source/options/optinet2.cxx
index 1fee25edae55..e612e2e40f76 100644
--- a/cui/source/options/optinet2.cxx
+++ b/cui/source/options/optinet2.cxx
@@ -99,6 +99,7 @@
#include "com/sun/star/task/XPasswordContainer.hpp"
#include "securityoptions.hxx"
#include "webconninfo.hxx"
+#include "certpath.hxx"
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -665,8 +666,13 @@ SvxSecurityTabPage::SvxSecurityTabPage( Window* pParent, const SfxItemSet& rSet
,maMacroSecFI ( this, CUI_RES( FI_SEC_MACROSEC ) )
,maMacroSecPB ( this, CUI_RES( PB_SEC_MACROSEC ) )
+ ,m_aCertPathFL ( this, CUI_RES( FL_SEC_CERTPATH ) )
+ ,m_aCertPathFI ( this, CUI_RES( FI_SEC_CERTPATH ) )
+ ,m_aCertPathPB ( this, CUI_RES( PB_SEC_CERTPATH ) )
+
,mpSecOptions ( new SvtSecurityOptions )
,mpSecOptDlg ( NULL )
+ ,mpCertPathDlg ( NULL )
,msPasswordStoringDeactivateStr( CUI_RES( STR_SEC_NOPASSWDSAVE ) )
@@ -681,12 +687,15 @@ SvxSecurityTabPage::SvxSecurityTabPage( Window* pParent, const SfxItemSet& rSet
maMasterPasswordCB.SetClickHdl( LINK( this, SvxSecurityTabPage, MasterPasswordCBHdl ) );
maShowConnectionsPB.SetClickHdl( LINK( this, SvxSecurityTabPage, ShowPasswordsHdl ) );
maMacroSecPB.SetClickHdl( LINK( this, SvxSecurityTabPage, MacroSecPBHdl ) );
+ m_aCertPathPB.SetClickHdl( LINK( this, SvxSecurityTabPage, CertPathPBHdl ) );
ActivatePage( rSet );
}
SvxSecurityTabPage::~SvxSecurityTabPage()
{
+ delete mpCertPathDlg;
+
delete mpSecOptions;
delete mpSecOptDlg;
}
@@ -840,6 +849,23 @@ IMPL_LINK_NOARG(SvxSecurityTabPage, ShowPasswordsHdl)
return 0;
}
+IMPL_LINK_NOARG(SvxSecurityTabPage, CertPathPBHdl)
+{
+ if (!mpCertPathDlg)
+ mpCertPathDlg = new CertPathDialog(this);
+
+ rtl::OUString sOrig = mpCertPathDlg->getDirectory();
+ short nRet = mpCertPathDlg->Execute();
+
+ if (nRet == RET_OK && sOrig != mpCertPathDlg->getDirectory())
+ {
+ WarningBox aWarnBox(this, CUI_RES(RID_SVX_MSGBOX_OPTIONS_RESTART));
+ aWarnBox.Execute();
+ }
+
+ return 0;
+}
+
IMPL_LINK_NOARG(SvxSecurityTabPage, MacroSecPBHdl)
{
try
@@ -870,19 +896,24 @@ void SvxSecurityTabPage::InitControls()
&& mpSecOptions->IsReadOnly( SvtSecurityOptions::E_MACRO_TRUSTEDAUTHORS )
&& mpSecOptions->IsReadOnly( SvtSecurityOptions::E_SECUREURLS ) ) )
{
+ //Move these up
+ m_aCertPathFL.SetPosPixel(maMacroSecFL.GetPosPixel());
+ m_aCertPathFI.SetPosPixel(maMacroSecFI.GetPosPixel());
+ m_aCertPathPB.SetPosPixel(maMacroSecPB.GetPosPixel());
+
+ //Hide these
maMacroSecFL.Hide();
maMacroSecFI.Hide();
maMacroSecPB.Hide();
}
// one button too small for its text?
- sal_Int32 i = 0;
long nBtnTextWidth = 0;
Window* pButtons[] = { &maSecurityOptionsPB, &maMasterPasswordPB,
- &maShowConnectionsPB, &maMacroSecPB };
+ &maShowConnectionsPB, &maMacroSecPB, &m_aCertPathPB };
Window** pButton = pButtons;
const sal_Int32 nBCount = SAL_N_ELEMENTS( pButtons );
- for ( ; i < nBCount; ++i, ++pButton )
+ for (sal_Int32 i = 0; i < nBCount; ++i, ++pButton )
{
long nTemp = (*pButton)->GetCtrlTextWidth( (*pButton)->GetText() );
if ( nTemp > nBtnTextWidth )
@@ -909,7 +940,7 @@ void SvxSecurityTabPage::InitControls()
nExtra = ( nExtra < nMaxExtra ) ? nExtra : nMaxExtra;
}
- for ( i = 0; i < nBCount; ++i, ++pButton )
+ for (sal_Int32 i = 0; i < nBCount; ++i, ++pButton )
{
Point aNewPos = (*pButton)->GetPosPixel();
aNewPos.X() -= nDelta;
@@ -919,10 +950,10 @@ void SvxSecurityTabPage::InitControls()
}
Window* pControls[] = { &maSecurityOptionsFI, &maSavePasswordsCB,
- &maMasterPasswordFI, &maMacroSecFI };
+ &maMasterPasswordFI, &maMacroSecFI, &m_aCertPathFI };
Window** pControl = pControls;
const sal_Int32 nCCount = SAL_N_ELEMENTS( pControls );
- for ( i = 0; i < nCCount; ++i, ++pControl )
+ for (sal_Int32 i = 0; i < nCCount; ++i, ++pControl )
{
Size aNewSize = (*pControl)->GetSizePixel();
aNewSize.Width() -= nDelta;
@@ -966,6 +997,11 @@ void SvxSecurityTabPage::InitControls()
maSavePasswordsCB.Enable( sal_False );
}
+#ifndef UNX
+ m_aCertPathFL.Hide();
+ m_aCertPathFI.Hide();
+ m_aCertPathPB.Hide();
+#endif
}
@@ -1026,10 +1062,6 @@ sal_Bool SvxSecurityTabPage::FillItemSet( SfxItemSet& )
void SvxSecurityTabPage::Reset( const SfxItemSet& )
{
- SfxObjectShell* pCurDocShell = SfxObjectShell::Current();
- if( pCurDocShell )
- {
- }
}
MozPluginTabPage::MozPluginTabPage(Window* pParent, const SfxItemSet& rSet)
diff --git a/cui/source/options/optinet2.hrc b/cui/source/options/optinet2.hrc
index d39495f8d25b..a4c1781aadfe 100644
--- a/cui/source/options/optinet2.hrc
+++ b/cui/source/options/optinet2.hrc
@@ -93,6 +93,9 @@
#define FL_SEC_MACROSEC 19
#define FI_SEC_MACROSEC 20
#define PB_SEC_MACROSEC 21
+#define FL_SEC_CERTPATH 22
+#define FI_SEC_CERTPATH 23
+#define PB_SEC_CERTPATH 24
#define STR_SEC_NOPASSWDSAVE 12
@@ -119,6 +122,8 @@
#define ROW_7 (ROW_6+3*RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_CTRL_DESC_Y)
#define ROW_7a (ROW_7-RSC_SP_FLGR_SPACE_Y-RSC_CD_PUSHBUTTON_HEIGHT)
#define ROW_8 (ROW_7+RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_CTRL_DESC_Y)
+#define ROW_9 (ROW_8+3*RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_CTRL_DESC_Y)
+#define ROW_9a (ROW_9-RSC_SP_FLGR_SPACE_Y-RSC_CD_PUSHBUTTON_HEIGHT)
// Defines - JavaScriptDisableQueryBox_Impl -------------------------------
diff --git a/cui/source/options/optinet2.hxx b/cui/source/options/optinet2.hxx
index ac0d42512ff8..30f249a25eba 100644
--- a/cui/source/options/optinet2.hxx
+++ b/cui/source/options/optinet2.hxx
@@ -152,6 +152,8 @@ protected:
class SvtSecurityOptions;
+class CertPathDialog;
+
class SvxSecurityTabPage : public SfxTabPage
{
using TabPage::ActivatePage;
@@ -173,17 +175,24 @@ private:
FixedInfo maMacroSecFI;
PushButton maMacroSecPB;
+ FixedLine m_aCertPathFL;
+ FixedInfo m_aCertPathFI;
+ PushButton m_aCertPathPB;
+
SvtSecurityOptions* mpSecOptions;
svx::SecurityOptionsDialog* mpSecOptDlg;
+ CertPathDialog* mpCertPathDlg;
+
String msPasswordStoringDeactivateStr;
DECL_LINK(SecurityOptionsHdl, void *);
- DECL_LINK( SavePasswordHdl, void* );
+ DECL_LINK(SavePasswordHdl, void* );
DECL_LINK(MasterPasswordHdl, void *);
- DECL_LINK( MasterPasswordCBHdl, void* );
+ DECL_LINK(MasterPasswordCBHdl, void* );
DECL_LINK(ShowPasswordsHdl, void *);
- DECL_LINK( MacroSecPBHdl, void* );
+ DECL_LINK(MacroSecPBHdl, void* );
+ DECL_LINK(CertPathPBHdl, void* );
void InitControls();
diff --git a/cui/source/options/optinet2.src b/cui/source/options/optinet2.src
index 353ededbb016..029c46e311bb 100644
--- a/cui/source/options/optinet2.src
+++ b/cui/source/options/optinet2.src
@@ -371,6 +371,25 @@ TabPage RID_SVXPAGE_INET_SECURITY
Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
Text [ en-US ] = "Macro Security...";
};
+ FixedLine FL_SEC_CERTPATH
+ {
+ Pos = MAP_APPFONT( COL_0, ROW_7 );
+ Size = MAP_APPFONT( COL_4-COL_0, RSC_CD_FIXEDLINE_HEIGHT );
+ Text [ en-US ] = "Certificate Path";
+ };
+ FixedText FI_SEC_CERTPATH
+ {
+ Pos = MAP_APPFONT( COL_1, ROW_8 );
+ Size = MAP_APPFONT( COL_2-COL_1, 3*RSC_CD_FIXEDLINE_HEIGHT );
+ Wordbreak = TRUE;
+ Text [ en-US ] = "Select the Network Security Services certificate directory to use for digital signatures.";
+ };
+ PushButton PB_SEC_CERTPATH
+ {
+ Pos = MAP_APPFONT( COL_3, ROW_9a );
+ Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
+ Text [ en-US ] = "Certificate...";
+ };
String STR_SEC_NOPASSWDSAVE
{
Text [ en-US ] = "Disabling the function to persistently store passwords deletes the list of passwords stored and resets the master password.\n\nDo you want to delete password list and reset master password?";
@@ -478,4 +497,3 @@ TabPage RID_SVXPAGE_INET_MAIL
};
// ******************************************************************* EOF
-
diff --git a/cui/source/options/optjava.cxx b/cui/source/options/optjava.cxx
index db3743bd4678..06a1402f23d5 100644
--- a/cui/source/options/optjava.cxx
+++ b/cui/source/options/optjava.cxx
@@ -302,7 +302,7 @@ IMPL_LINK_NOARG(SvxJavaOptionsPage, ParameterHdl_Impl)
(void)eErr;
if ( bRunning )
{
- WarningBox aWarnBox( this, CUI_RES( RID_SVX_MSGBOX_JAVA_RESTART2 ) );
+ WarningBox aWarnBox( this, CUI_RES( RID_SVX_MSGBOX_OPTIONS_RESTART ) );
aWarnBox.Execute();
}
}
@@ -346,7 +346,7 @@ IMPL_LINK_NOARG(SvxJavaOptionsPage, ClassPathHdl_Impl)
(void)eErr;
if ( bRunning )
{
- WarningBox aWarnBox( this, CUI_RES( RID_SVX_MSGBOX_JAVA_RESTART2 ) );
+ WarningBox aWarnBox( this, CUI_RES( RID_SVX_MSGBOX_OPTIONS_RESTART ) );
aWarnBox.Execute();
}
}
diff --git a/cui/source/options/optjava.src b/cui/source/options/optjava.src
index db052d1c5fd8..6e7a42931571 100644
--- a/cui/source/options/optjava.src
+++ b/cui/source/options/optjava.src
@@ -290,7 +290,7 @@ WarningBox RID_SVX_MSGBOX_JAVA_RESTART
Message [ en-US ] = "For the selected Java runtime environment to work properly, %PRODUCTNAME must be restarted.\nPlease restart %PRODUCTNAME now." ;
};
-WarningBox RID_SVX_MSGBOX_JAVA_RESTART2
+WarningBox RID_SVX_MSGBOX_OPTIONS_RESTART
{
BUTTONS = WB_OK ;
DEFBUTTON = WB_DEF_OK ;
diff --git a/cui/source/options/webconninfo.cxx b/cui/source/options/webconninfo.cxx
index 3775b71021d7..96752a109af2 100644
--- a/cui/source/options/webconninfo.cxx
+++ b/cui/source/options/webconninfo.cxx
@@ -55,7 +55,7 @@ PasswordTable::PasswordTable(SvxSimpleTableContainer& rParent, WinBits nBits)
void PasswordTable::InsertHeaderItem( sal_uInt16 nColumn, const String& rText, HeaderBarItemBits nBits )
{
- GetTheHeaderBar()->InsertItem( nColumn, rText, 0, nBits );
+ GetTheHeaderBar().InsertItem( nColumn, rText, 0, nBits );
}
void PasswordTable::ResetTabs()
@@ -68,7 +68,7 @@ void PasswordTable::Resort( bool bForced )
sal_uInt16 nColumn = GetSelectedCol();
if ( 0 == nColumn || bForced ) // only the first column is sorted
{
- HeaderBarItemBits nBits = GetTheHeaderBar()->GetItemBits(1);
+ HeaderBarItemBits nBits = GetTheHeaderBar().GetItemBits(1);
sal_Bool bUp = ( ( nBits & HIB_UPARROW ) == HIB_UPARROW );
SvSortMode eMode = SortAscending;
@@ -83,7 +83,7 @@ void PasswordTable::Resort( bool bForced )
nBits &= ~HIB_DOWNARROW;
nBits |= HIB_UPARROW;
}
- GetTheHeaderBar()->SetItemBits( 1, nBits );
+ GetTheHeaderBar().SetItemBits( 1, nBits );
SvTreeList* pListModel = GetModel();
pListModel->SetSortMode( eMode );
pListModel->Resort();
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index d2ce68161894..7dd0e7ed8eff 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -2960,6 +2960,11 @@
</info>
<value>true</value>
</prop>
+ <prop oor:name="CertDir" oor:type="xs:string">
+ <info>
+ <desc>Contains the path to the users NSS certificate directory.</desc>
+ </info>
+ </prop>
<prop
oor:name="WarnPrintDoc" oor:type="xs:boolean" oor:nillable="false">
<info>
diff --git a/svx/inc/svx/simptabl.hxx b/svx/inc/svx/simptabl.hxx
index 9e7a0692f1fe..b12314f3da6e 100644
--- a/svx/inc/svx/simptabl.hxx
+++ b/svx/inc/svx/simptabl.hxx
@@ -97,8 +97,6 @@ protected:
virtual void Command( const CommandEvent& rCEvt );
virtual StringCompare ColCompare(SvLBoxEntry*,SvLBoxEntry*);
- HeaderBar* GetTheHeaderBar(){return &aHeaderBar;}
-
public:
SvxSimpleTable(SvxSimpleTableContainer& rParent, WinBits nBits = WB_BORDER);
@@ -156,6 +154,8 @@ public:
const Link& GetHeaderBarDblClickHdl() const { return aHeaderBarDblClickLink; }
void SetHeaderBarHelpId(const rtl::OString& rHelpId) {aHeaderBar.SetHelpId(rHelpId);}
+
+ HeaderBar& GetTheHeaderBar() {return aHeaderBar;}
};
diff --git a/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx b/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx
index e51ac3dde3b0..531d71638c1d 100644
--- a/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx
+++ b/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx
@@ -53,6 +53,8 @@
#include <com/sun/star/xml/crypto/DigestID.hpp>
#include <com/sun/star/xml/crypto/CipherID.hpp>
+#include <officecfg/Office/Common.hxx>
+
#include <sal/types.h>
#include <rtl/instance.hxx>
#include <rtl/bootstrap.hxx>
@@ -177,50 +179,57 @@ void deleteRootsModule()
::rtl::OString getMozillaCurrentProfile( const css::uno::Reference< css::lang::XMultiServiceFactory > &rxMSF )
{
- ::rtl::OString sResult;
// first, try to get the profile from "MOZILLA_CERTIFICATE_FOLDER"
- char* pEnv = getenv( "MOZILLA_CERTIFICATE_FOLDER" );
- if ( pEnv )
+ const char* pEnv = getenv("MOZILLA_CERTIFICATE_FOLDER");
+ if (pEnv)
+ return rtl::OString(pEnv);
+
+ // second, try to get saved user-preference
+ try
{
- sResult = ::rtl::OString( pEnv );
- RTL_LOGFILE_PRODUCT_TRACE1( "XMLSEC: Using env MOZILLA_CERTIFICATE_FOLDER: %s", sResult.getStr() );
+ rtl::OUString sUserSetCertPath =
+ officecfg::Office::Common::Security::Scripting::CertDir::get().get_value_or(rtl::OUString());
+
+ if (!sUserSetCertPath.isEmpty())
+ return rtl::OUStringToOString(sUserSetCertPath, osl_getThreadTextEncoding());
}
- else
+ catch (const uno::Exception &e)
+ {
+ SAL_WARN("xmlsecurity", "getMozillaCurrentProfile: caught exception" << e.Message);
+ }
+
+ // third, dig around to see if there's one available
+ mozilla::MozillaProductType productTypes[3] = {
+ mozilla::MozillaProductType_Thunderbird,
+ mozilla::MozillaProductType_Firefox,
+ mozilla::MozillaProductType_Mozilla };
+ int nProduct = SAL_N_ELEMENTS(productTypes);
+
+ uno::Reference<uno::XInterface> xInstance = rxMSF->createInstance(
+ "com.sun.star.mozilla.MozillaBootstrap");
+ OSL_ENSURE( xInstance.is(), "failed to create instance" );
+
+ uno::Reference<mozilla::XMozillaBootstrap> xMozillaBootstrap
+ = uno::Reference<mozilla::XMozillaBootstrap>(xInstance,uno::UNO_QUERY);
+ OSL_ENSURE( xMozillaBootstrap.is(), "failed to create instance" );
+
+ if (xMozillaBootstrap.is())
{
- mozilla::MozillaProductType productTypes[4] = {
- mozilla::MozillaProductType_Thunderbird,
- mozilla::MozillaProductType_Mozilla,
- mozilla::MozillaProductType_Firefox,
- mozilla::MozillaProductType_Default };
- int nProduct = 4;
-
- uno::Reference<uno::XInterface> xInstance = rxMSF->createInstance(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.mozilla.MozillaBootstrap")) );
- OSL_ENSURE( xInstance.is(), "failed to create instance" );
-
- uno::Reference<mozilla::XMozillaBootstrap> xMozillaBootstrap
- = uno::Reference<mozilla::XMozillaBootstrap>(xInstance,uno::UNO_QUERY);
- OSL_ENSURE( xMozillaBootstrap.is(), "failed to create instance" );
-
- if (xMozillaBootstrap.is())
+ for (int i=0; i<nProduct; ++i)
{
- for (int i=0; i<nProduct; i++)
- {
- ::rtl::OUString profile = xMozillaBootstrap->getDefaultProfile(productTypes[i]);
+ rtl::OUString profile = xMozillaBootstrap->getDefaultProfile(productTypes[i]);
- if (profile != NULL && !profile.isEmpty())
- {
- ::rtl::OUString sProfilePath = xMozillaBootstrap->getProfilePath( productTypes[i], profile );
- sResult = ::rtl::OUStringToOString( sProfilePath, osl_getThreadTextEncoding() );
- RTL_LOGFILE_PRODUCT_TRACE1( "XMLSEC: Using Mozilla Profile: %s", sResult.getStr() );
- }
+ if (!profile.isEmpty())
+ {
+ rtl::OUString sProfilePath = xMozillaBootstrap->getProfilePath( productTypes[i], profile );
+ return rtl::OUStringToOString(sProfilePath, osl_getThreadTextEncoding());
}
}
-
- RTL_LOGFILE_PRODUCT_TRACE( "XMLSEC: No Mozilla Profile found!" );
}
- return sResult;
+ RTL_LOGFILE_PRODUCT_TRACE( "XMLSEC: No Mozilla Profile found!" );
+
+ return rtl::OString();
}
//Older versions of Firefox (FF), for example FF2, and Thunderbird (TB) 2 write
@@ -251,10 +260,10 @@ bool nsscrypto_initialize( const css::uno::Reference< css::lang::XMultiServiceFa
// this method must be called only once, no need for additional lock
rtl::OString sCertDir;
- (void) xMSF;
#ifdef XMLSEC_CRYPTO_NSS
- if ( xMSF.is() )
- sCertDir = getMozillaCurrentProfile( xMSF );
+ sCertDir = getMozillaCurrentProfile(xMSF);
+#else
+ (void) xMSF;
#endif
xmlsec_trace( "Using profile: %s", sCertDir.getStr() );