[Libreoffice-commits] core.git: 2 commits - cui/source
Jan-Marek Glogowski (via logerrit)
logerrit at kemper.freedesktop.org
Wed Oct 23 08:27:13 UTC 2019
cui/source/options/certpath.cxx | 39 ++++++++++++++-------------------------
cui/source/options/certpath.hxx | 11 ++++-------
2 files changed, 18 insertions(+), 32 deletions(-)
New commits:
commit aceab9cbf10486d2179d016b36511d907d402825
Author: Jan-Marek Glogowski <jan-marek.glogowski at extern.cib.de>
AuthorDate: Tue Oct 1 14:06:10 2019 +0000
Commit: Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Wed Oct 23 10:26:20 2019 +0200
tdf#127909 don't always select the first entry
Change-Id: Ic65667c748a62d989a4f38113155ba2715830629
Reviewed-on: https://gerrit.libreoffice.org/79977
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>
diff --git a/cui/source/options/certpath.cxx b/cui/source/options/certpath.cxx
index 95898629c7e8..dae67fb379e6 100644
--- a/cui/source/options/certpath.cxx
+++ b/cui/source/options/certpath.cxx
@@ -67,14 +67,9 @@ CertPathDialog::CertPathDialog(weld::Window* pParent)
if (!profile.isEmpty())
{
- m_xCertPathList->append();
- const int nRow = m_xCertPathList->n_children() - 1;
- m_xCertPathList->set_toggle(nRow, TRISTATE_FALSE, 0);
OUString sEntry = OUString::createFromAscii(productNames[i]) + ":" + profile;
- m_xCertPathList->set_text(nRow, sEntry, 1);
OUString sProfilePath = xMozillaBootstrap->getProfilePath( productTypes[i], profile );
- m_xCertPathList->set_text(nRow, sProfilePath, 2);
- m_xCertPathList->set_id(nRow, sProfilePath);
+ AddCertPath(sEntry, sProfilePath);
}
}
}
@@ -114,12 +109,6 @@ CertPathDialog::CertPathDialog(weld::Window* pParent)
const char* pEnv = getenv("MOZILLA_CERTIFICATE_FOLDER");
if (pEnv)
AddCertPath("$MOZILLA_CERTIFICATE_FOLDER", OUString(pEnv, strlen(pEnv), osl_getThreadTextEncoding()));
-
- if (m_xCertPathList->n_children())
- {
- m_xCertPathList->set_toggle(0, TRISTATE_TRUE, 0);
- HandleEntryChecked(0);
- }
}
IMPL_LINK_NOARG(CertPathDialog, OKHdl_Impl, weld::Button&, void)
commit 162629610dc07f0ed4e15aeed9bd4cad6bea79d1
Author: Jan-Marek Glogowski <jan-marek.glogowski at extern.cib.de>
AuthorDate: Tue Oct 1 16:10:42 2019 +0200
Commit: Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Wed Oct 23 10:26:07 2019 +0200
tdf#127909 refactoring of the cert path dialog
* Drop some unused memeber variables
* Rename some member variables
* Add a few const
Change-Id: Iea3018f03ab855a357d27b93902323197077ea04
Reviewed-on: https://gerrit.libreoffice.org/79976
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>
diff --git a/cui/source/options/certpath.cxx b/cui/source/options/certpath.cxx
index 2fa4d3e0e7b9..95898629c7e8 100644
--- a/cui/source/options/certpath.cxx
+++ b/cui/source/options/certpath.cxx
@@ -23,14 +23,13 @@ using namespace ::com::sun::star;
CertPathDialog::CertPathDialog(weld::Window* pParent)
: GenericDialogController(pParent, "cui/ui/certdialog.ui", "CertDialog")
- , m_xAddBtn(m_xBuilder->weld_button("add"))
- , m_xOKBtn(m_xBuilder->weld_button("ok"))
+ , m_xManualButton(m_xBuilder->weld_button("add"))
+ , m_xOKButton(m_xBuilder->weld_button("ok"))
, m_xCertPathList(m_xBuilder->weld_tree_view("paths"))
- , m_xAddDialogLabel(m_xBuilder->weld_label("certdir"))
- , m_xManualLabel(m_xBuilder->weld_label("manual"))
{
- m_sAddDialogText = m_xAddDialogLabel->get_label();
- m_sManual = m_xManualLabel->get_label();
+ // these are just used to get translated strings
+ m_sAddDialogText = m_xBuilder->weld_label("certdir")->get_label();
+ m_sManualLabel = m_xBuilder->weld_label("manual")->get_label();
m_xCertPathList->set_size_request(m_xCertPathList->get_approximate_digit_width() * 70,
m_xCertPathList->get_height_rows(6));
@@ -45,11 +44,12 @@ CertPathDialog::CertPathDialog(weld::Window* pParent)
m_xCertPathList->set_toggle_columns_as_radio(aRadioColumns);
m_xCertPathList->connect_toggled(LINK(this, CertPathDialog, CheckHdl_Impl));
- m_xAddBtn->connect_clicked( LINK( this, CertPathDialog, AddHdl_Impl ) );
- m_xOKBtn->connect_clicked( LINK( this, CertPathDialog, OKHdl_Impl ) );
+ m_xManualButton->connect_clicked( LINK( this, CertPathDialog, ManualHdl_Impl ) );
+ m_xOKButton->connect_clicked( LINK( this, CertPathDialog, OKHdl_Impl ) );
try
{
+ // In the reverse order of preference for the default selected profile
mozilla::MozillaProductType const productTypes[3] = {
mozilla::MozillaProductType_Thunderbird,
mozilla::MozillaProductType_Firefox,
@@ -101,7 +101,7 @@ CertPathDialog::CertPathDialog(weld::Window* pParent)
if ( result == ::osl::FileBase::E_None )
{
// the cert path exists
- AddCertPath(m_sManual, sUserSetCertPath);
+ AddCertPath(m_sManualLabel, sUserSetCertPath);
}
}
}
@@ -160,11 +160,11 @@ IMPL_LINK(CertPathDialog, CheckHdl_Impl, const row_col&, rRowCol, void)
void CertPathDialog::HandleEntryChecked(int nRow)
{
m_xCertPathList->select(nRow);
- bool bChecked = m_xCertPathList->get_toggle(nRow, 0) == TRISTATE_TRUE;
+ const bool bChecked = m_xCertPathList->get_toggle(nRow, 0) == TRISTATE_TRUE;
if (bChecked)
{
// we have radio button behavior -> so uncheck the other entries
- int nCount = m_xCertPathList->n_children();
+ const int nCount = m_xCertPathList->n_children();
for (int i = 0; i < nCount; ++i)
{
if (i != nRow)
@@ -196,7 +196,7 @@ void CertPathDialog::AddCertPath(const OUString &rProfile, const OUString &rPath
HandleEntryChecked(nRow);
}
-IMPL_LINK_NOARG(CertPathDialog, AddHdl_Impl, weld::Button&, void)
+IMPL_LINK_NOARG(CertPathDialog, ManualHdl_Impl, weld::Button&, void)
{
try
{
@@ -212,7 +212,7 @@ IMPL_LINK_NOARG(CertPathDialog, AddHdl_Impl, weld::Button&, void)
sURL = xFolderPicker->getDirectory();
OUString aPath;
if (osl::FileBase::E_None == osl::FileBase::getSystemPathFromFileURL(sURL, aPath))
- AddCertPath(m_sManual, aPath);
+ AddCertPath(m_sManualLabel, aPath);
}
}
catch (const uno::Exception &)
diff --git a/cui/source/options/certpath.hxx b/cui/source/options/certpath.hxx
index c55f0c9000ab..175e77454566 100644
--- a/cui/source/options/certpath.hxx
+++ b/cui/source/options/certpath.hxx
@@ -14,18 +14,15 @@
class CertPathDialog : public weld::GenericDialogController
{
-private:
- std::unique_ptr<weld::Button> m_xAddBtn;
- std::unique_ptr<weld::Button> m_xOKBtn;
+ std::unique_ptr<weld::Button> m_xManualButton;
+ std::unique_ptr<weld::Button> m_xOKButton;
std::unique_ptr<weld::TreeView> m_xCertPathList;
- std::unique_ptr<weld::Label> m_xAddDialogLabel;
- std::unique_ptr<weld::Label> m_xManualLabel;
OUString m_sAddDialogText;
- OUString m_sManual;
+ OUString m_sManualLabel;
typedef std::pair<int, int> row_col;
DECL_LINK(CheckHdl_Impl, const row_col&, void);
- DECL_LINK(AddHdl_Impl, weld::Button&, void);
+ DECL_LINK(ManualHdl_Impl, weld::Button&, void);
DECL_LINK(OKHdl_Impl, weld::Button&, void);
void HandleEntryChecked(int nRow);
More information about the Libreoffice-commits
mailing list