loleaflet/src/control/Control.JSDialogBuilder.js | 36 +++++++++++++++++++++++ 1 file changed, 36 insertions(+)
New commits: commit 075142ece04262c7e110828937bca64fb02bdbcb Author: Dennis Francis <dennis.fran...@collabora.com> AuthorDate: Wed Feb 19 10:49:16 2020 +0530 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Fri Feb 21 14:49:17 2020 +0100 Add Label for the line-style listbox in jsdialog The Line-style listbox selector(shape properties) in mobile online is missing a label, so to make it clear lets add a label for it. Adding an invisible label for line-style listbox in core.git does not work as invisible widgets are not dumped by core to generate jsdialog messages. So the next option is to splice in a label entry to the parsed jsdialog message at the appropriate place. This also makes it easier for adding any missing labels, by just needing to add the id of the control and the label text. Change-Id: I45913ec25278e8566092a738c08cfdd8bc46e39f Reviewed-on: https://gerrit.libreoffice.org/c/online/+/88994 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Andras Timar <andras.ti...@collabora.com> diff --git a/loleaflet/src/control/Control.JSDialogBuilder.js b/loleaflet/src/control/Control.JSDialogBuilder.js index 809de4333..0bd17ce36 100644 --- a/loleaflet/src/control/Control.JSDialogBuilder.js +++ b/loleaflet/src/control/Control.JSDialogBuilder.js @@ -1574,7 +1574,43 @@ L.Control.JSDialogBuilder = L.Control.extend({ data.parent = parent; }, + _addMissingLabels: function(data) { + if (!this._missingLabelData) { + this._missingLabelData = {}; + var labelData = { + // This adds a label widget just before the + // control with id 'linestyle' + 'linestyle' : _('Line style') + }; + + var mLD = this._missingLabelData; + Object.keys(labelData).forEach(function(controlId) { + mLD[controlId] = { + id: controlId + 'label', + type: 'fixedtext', + text: labelData[controlId], + enabled: 'true' + }; + }); + } + + for (var idx = 0; idx < data.length; ++idx) { + var controlId = data[idx].id; + if (controlId && this._missingLabelData.hasOwnProperty(controlId)) { + data.splice(idx, 0, this._missingLabelData[controlId]); + ++idx; + } + } + }, + + _amendJSDialogData: function(data) { + // Called from build() which is already recursive, + // so no need to recurse here over 'data'. + this._addMissingLabels(data); + }, + build: function(parent, data) { + this._amendJSDialogData(data); for (var childIndex in data) { var childData = data[childIndex]; this._parentize(childData); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits