[Libreoffice-commits] core.git: cui/inc cui/source
Rtch90 (via logerrit)
logerrit at kemper.freedesktop.org
Wed Aug 7 06:06:52 UTC 2019
cui/inc/strings.hrc | 1 +
cui/source/options/optdict.cxx | 11 +++++++++++
2 files changed, 12 insertions(+)
New commits:
commit c78306fb47011a3c050368b9696cb2d5ecf3d57d
Author: Rtch90 <ritchie.cunningham at protonmail.com>
AuthorDate: Mon Apr 22 01:53:09 2019 +0100
Commit: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
CommitDate: Wed Aug 7 08:06:20 2019 +0200
tdf#61076 string validation on creation of new dictionary.
Prevent having '/' or '\' within the dictionary name to prevent data
loss.
Change-Id: I392832c748effcdbbe58983a788ba6b38764628c
Reviewed-on: https://gerrit.libreoffice.org/71059
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Tested-by: Jenkins
diff --git a/cui/inc/strings.hrc b/cui/inc/strings.hrc
index d7e581fccb26..3833d157adff 100644
--- a/cui/inc/strings.hrc
+++ b/cui/inc/strings.hrc
@@ -258,6 +258,7 @@
#define RID_SVXSTR_CHG_SMARTART NC_("RID_SVXSTR_CHG_SMARTART", "SmartArt to %PRODUCTNAME shapes or reverse")
#define RID_SVXSTR_OPT_DOUBLE_DICTS NC_("RID_SVXSTR_OPT_DOUBLE_DICTS", "The specified name already exists.\nPlease enter a new name.")
+#define RID_SVXSTR_OPT_INVALID_DICT_NAME NC_("RID_SVXSTR_OPT_INVALID_DICT_NAME", "The specified name is invalid.\nPlease enter a new name.")
/* To translators:
Please, try to find a similar *short* translation to avoid
to get narrow "New" field in the "Edit custom dictionary" window,
diff --git a/cui/source/options/optdict.cxx b/cui/source/options/optdict.cxx
index adbb6489f551..40240d6fa550 100644
--- a/cui/source/options/optdict.cxx
+++ b/cui/source/options/optdict.cxx
@@ -132,6 +132,17 @@ IMPL_LINK_NOARG(SvxNewDictionaryDialog, OKHdl_Impl, weld::Button&, void)
if ( sDict.equalsIgnoreAsciiCase( pDic[i]->getName()) )
bFound = true;
+ if ( sDict.indexOf("/") != -1 || sDict.indexOf("\\") != -1 )
+ {
+ // Detected an invalid character.
+ std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(m_xDialog.get(),
+ VclMessageType::Info, VclButtonsType::Ok,
+ CuiResId(RID_SVXSTR_OPT_INVALID_DICT_NAME)));
+ xInfoBox->run();
+ m_xNameEdit->grab_focus();
+ return;
+ }
+
if ( bFound )
{
// duplicate names?
More information about the Libreoffice-commits
mailing list