[Libreoffice-commits] online.git: 2 commits - common/Log.hpp loleaflet/src

Samuel Mehrbrodt (via logerrit) logerrit at kemper.freedesktop.org
Tue Jun 4 07:09:45 UTC 2019


 common/Log.hpp                           |    2 +
 loleaflet/src/control/Control.Toolbar.js |   52 +++++++++++++++++++++++++------
 2 files changed, 44 insertions(+), 10 deletions(-)

New commits:
commit b40cf51181ecf6d65f25238b84da0f98176fc249
Author:     Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
AuthorDate: Wed May 22 08:31:59 2019 +0200
Commit:     Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
CommitDate: Tue Jun 4 09:09:37 2019 +0200

    Log fatal errors also to stderr
    
    Change-Id: I5e6429ab007d13a2506c375923049b91c80ffba0
    Reviewed-on: https://gerrit.libreoffice.org/72722
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
    Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>

diff --git a/common/Log.hpp b/common/Log.hpp
index 50881f941..5b7e77f91 100644
--- a/common/Log.hpp
+++ b/common/Log.hpp
@@ -15,6 +15,7 @@
 
 #include <cstddef>
 #include <functional>
+#include <iostream>
 #include <thread>
 #include <sstream>
 #include <string>
@@ -341,6 +342,7 @@ namespace Log
 #define LOG_FTL(X)                                  \
     do                                              \
     {                                               \
+        std::cerr << X << std::endl;                \
         auto &log_ = Log::logger();                 \
         if (log_.fatal())                           \
         {                                           \
commit e4b39f6811fa4f060e200a20ba9a6936b4b1b7e2
Author:     Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
AuthorDate: Tue May 28 10:05:12 2019 +0200
Commit:     Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
CommitDate: Tue Jun 4 09:09:26 2019 +0200

    Add dropdown to switch doc language to statusbar
    
    instead of just having a label displaying the current language.
    
    Change-Id: Ib3068e6001fc86cc129f7817300de4e8a991c8c6
    Reviewed-on: https://gerrit.libreoffice.org/73086
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
    Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>

diff --git a/loleaflet/src/control/Control.Toolbar.js b/loleaflet/src/control/Control.Toolbar.js
index e69761152..956465f24 100644
--- a/loleaflet/src/control/Control.Toolbar.js
+++ b/loleaflet/src/control/Control.Toolbar.js
@@ -1437,9 +1437,8 @@ function onDocLayerInit() {
 					html: '<div id="InsertMode" class="loleaflet-font" title="' + _('Entering text mode') + '" style="padding: 5px 5px;">    &nbsp</div>'
 				},
 				{type: 'break', id: 'break4', tablet: false},
-				{
-					type: 'html', id: 'LanguageStatus', mobile: false, tablet: false,
-					html: '<div id="LanguageStatus" class="loleaflet-font" title="' + _('Text Language') + '" style="padding: 5px 5px;">    &nbsp</div>'
+				{type: 'menu-radio', id: 'LanguageStatus',
+					mobile: false
 				},
 				{type: 'break', id: 'break5', tablet: false},
 				{
@@ -1499,9 +1498,8 @@ function onDocLayerInit() {
 					html: '<div id="StatusSelectionMode" class="loleaflet-font" title="' + _('Selection Mode') + '" style="padding: 5px 5px;">    &nbsp</div>'
 				},
 				{type: 'break', id: 'break7', mobile: false, tablet: false},
-				{
-					type: 'html', id: 'LanguageStatus', mobile: false, tablet: false,
-					html: '<div id="LanguageStatus" class="loleaflet-font" title="' + _('Text Language') + '" style="padding: 5px 5px;">    &nbsp</div>'
+				{type: 'menu-radio', id: 'LanguageStatus',
+					mobile: false
 				},
 				{type: 'break', id: 'break8', mobile: false}
 			]);
@@ -1521,9 +1519,8 @@ function onDocLayerInit() {
 					html: '<div id="PageStatus" class="loleaflet-font" title="' + _('Number of Slides') + '" style="padding: 5px 5px;">    &nbsp</div>'
 				},
 				{type: 'break', id: 'break2', mobile: false, tablet: false},
-				{
-					type: 'html', id: 'LanguageStatus', mobile: false, tablet: false,
-					html: '<div id="LanguageStatus" class="loleaflet-font" title="' + _('Text Language') + '" style="padding: 5px 5px;">    &nbsp</div>'
+				{type: 'menu-radio', id: 'LanguageStatus',
+					mobile: false
 				},
 				{type: 'break', id: 'break8', mobile: false}
 			]);
@@ -1689,7 +1686,7 @@ function onCommandStateChanged(e) {
 		}
 	}
 	else if (commandName === '.uno:LanguageStatus') {
-		updateToolbarItem(statusbar, 'LanguageStatus', $('#LanguageStatus').html(_(state)).parent().html());
+		statusbar.set('LanguageStatus', {text: _(state), selected: state});
 	}
 	else if (commandName === '.uno:ModifiedStatus') {
 		if (e.state === 'true') {
@@ -1782,6 +1779,40 @@ function onCommandStateChanged(e) {
 	}
 }
 
+function onCommandValues(e) {
+	if (e.commandName === '.uno:LanguageStatus' && L.Util.isArray(e.commandValues)) {
+		var translated, neutral;
+		var constLang = '.uno:LanguageStatus?Language:string=';
+		var constDefault = 'Default_RESET_LANGUAGES';
+		var constNone = 'Default_LANGUAGE_NONE';
+		var resetLang = _('Reset to Default Language');
+		var noneLang = _('None (Do not check spelling)');
+		var languages = [];
+		e.commandValues.forEach(function (language) {
+			languages.push({ translated: _(language), neutral: language });
+		});
+		languages.sort(function (a, b) {
+			return a.translated < b.translated ? -1 : a.translated > b.translated ? 1 : 0;
+		});
+
+		var toolbaritems = [];
+		toolbaritems.push({ text: noneLang,
+		 id: 'nonelanguage',
+		 uno: constLang + constNone });
+
+
+		for (var lang in languages) {
+			translated = languages[lang].translated;
+			neutral = languages[lang].neutral;
+			toolbaritems.push({ id: neutral, text: translated, uno: constLang + encodeURIComponent('Default_' + neutral) });
+		}
+
+		toolbaritems.push({ id: 'reset', text: resetLang, uno: constLang + constDefault });
+
+		w2ui['actionbar'].set('LanguageStatus', {items: toolbaritems});
+	}
+}
+
 function updateCommandValues(targetName) {
 	var data = [];
 	// 1) For .uno:StyleApply
@@ -2402,6 +2433,7 @@ function setupToolbar(e) {
 	map.on('commandresult', onCommandResult);
 	map.on('updateparts pagenumberchanged', onUpdateParts);
 	map.on('commandstatechanged', onCommandStateChanged);
+	map.on('commandvalues', onCommandValues, this);
 }
 
 global.setupToolbar = setupToolbar;


More information about the Libreoffice-commits mailing list