[Libreoffice-commits] online.git: loleaflet/dist

Henry Castro hcastro at collabora.com
Thu Jul 14 17:49:15 UTC 2016


 loleaflet/dist/images/sc_sortascending.png  |binary
 loleaflet/dist/images/sc_sortdescending.png |binary
 loleaflet/dist/toolbar.css                  |    2 ++
 loleaflet/dist/toolbar/toolbar.js           |   24 ++++++++++++++++++++++++
 4 files changed, 26 insertions(+)

New commits:
commit ddfd0a3341dbc6c369a58922ed49dd63fd505909
Author: Henry Castro <hcastro at collabora.com>
Date:   Thu Jul 14 13:48:06 2016 -0400

    loleaflet: add more toolbar items
    
    .uno:SortAscending
    .uno:SortDescending

diff --git a/loleaflet/dist/images/sc_sortascending.png b/loleaflet/dist/images/sc_sortascending.png
new file mode 100644
index 0000000..9039006
Binary files /dev/null and b/loleaflet/dist/images/sc_sortascending.png differ
diff --git a/loleaflet/dist/images/sc_sortdescending.png b/loleaflet/dist/images/sc_sortdescending.png
new file mode 100644
index 0000000..a928731
Binary files /dev/null and b/loleaflet/dist/images/sc_sortdescending.png differ
diff --git a/loleaflet/dist/toolbar.css b/loleaflet/dist/toolbar.css
index 41bb6c6..200a47b 100644
--- a/loleaflet/dist/toolbar.css
+++ b/loleaflet/dist/toolbar.css
@@ -264,6 +264,8 @@ button.leaflet-control-search-next
 .w2ui-icon.numberformatdate{ background: url('/loleaflet/dist/images/lc_datefield.png') no-repeat center !important; }
 .w2ui-icon.numberformatincdecimals{ background: url('/loleaflet/dist/images/lc_numberformatincdecimals.png') no-repeat center !important; }
 .w2ui-icon.numberformatdecdecimals{ background: url('/loleaflet/dist/images/lc_numberformatdecdecimals.png') no-repeat center !important; }
+.w2ui-icon.sortascending{ background: url('/loleaflet/dist/images/sc_sortascending.png') no-repeat center !important; }
+.w2ui-icon.sortdescending{ background: url('/loleaflet/dist/images/sc_sortdescending.png') no-repeat center !important; }
 
 .inserttable-pop {
     z-index: 100000;
diff --git a/loleaflet/dist/toolbar/toolbar.js b/loleaflet/dist/toolbar/toolbar.js
index ea39584..2cc31ac 100644
--- a/loleaflet/dist/toolbar/toolbar.js
+++ b/loleaflet/dist/toolbar/toolbar.js
@@ -491,6 +491,23 @@ function toggleButton(toolbar, state, command)
 	}
 }
 
+function disableButton(toolbar, state, command)
+{
+	var disabled;
+	command = command.replace('.uno:', '');
+	var item = toolbar.get(command);
+	if (!item) {
+		return;
+	}
+
+	if (state) {
+		disabled = item.disabled ? toolbar.enable(command) : undefined;
+	}
+	else {
+		disabled = !item.disabled ? toolbar.disable(command) : undefined;
+	}
+}
+
 function toLocalePattern (pattern, regex, text, sub1, sub2) {
 	var matches = new RegExp(regex, 'g').exec(text);
 	if (matches) {
@@ -712,6 +729,9 @@ map.on('doclayerinit', function () {
 			{type: 'button',  id: 'NumberFormatDate',  img: 'numberformatdate', hint: _('Format as Date'), uno: 'NumberFormatDate'},
 			{type: 'button',  id: 'NumberFormatIncDecimals',  img: 'numberformatincdecimals', hint: _('Add Decimal Place'), uno: 'NumberFormatIncDecimals'},
 			{type: 'button',  id: 'NumberFormatDecDecimals',  img: 'numberformatdecdecimals', hint: _('Delete Decimal Place'), uno: 'NumberFormatDecDecimals'},
+			{type: 'break',   id: 'break-number'},
+			{type: 'button',  id: 'SortAscending',  img: 'sortascending', hint: _('Sort Ascending'), uno: 'SortAscending'},
+			{type: 'button',  id: 'SortDescending',  img: 'sortdescending', hint: _('Sort Descending'), uno: 'SortDescending'},
 		]);
 		statusbar.refresh();
 		toolbar.refresh();
@@ -893,6 +913,10 @@ map.on('commandstatechanged', function (e) {
 		 commandName === '.uno:NumberFormatDate') {
 		toggleButton(toolbar, state, commandName);
 	}
+	else if (commandName === '.uno:SortAscending' ||
+		 commandName === '.uno:SortDescending') {
+		disableButton(toolbar, state, commandName);
+	}
 
 	var toolbarUpMore = w2ui['toolbar-up-more'];
 	var id = commandName.toLowerCase().substr(5);


More information about the Libreoffice-commits mailing list