loleaflet/css/loleaflet.css                 |    4 +++
 loleaflet/src/layer/AnnotationManager.js    |   30 ++++++++++++++++++++++++++++
 loleaflet/src/layer/marker/Annotation.js    |   18 ++++++++++++++++
 loleaflet/src/layer/tile/TileLayer.js       |    6 +++++
 loleaflet/src/layer/tile/WriterTileLayer.js |    4 +++
 loleaflet/src/unocommands.js                |    1 
 6 files changed, 63 insertions(+)

New commits:
commit 1e82c46bd3ddf0d0fa123f623e6f95802da8327c
Author:     Scott Clarke <scott.cla...@codethink.co.uk>
AuthorDate: Tue May 14 15:25:43 2019 +0100
Commit:     Henry Castro <hcas...@collabora.com>
CommitDate: Mon Aug 19 16:42:06 2019 +0200

    Add ability to resolve comments
    
    Add 'Resolve' button to annotation context menu
    Add 'Resolved' indicator to comments
    
    Change-Id: Ie43e247635a14d3407535e02ec2012f0809d425c
    Co-authored-by: Jim MacArthur <jim.macart...@codethink.co.uk>
    Reviewed-on: https://gerrit.libreoffice.org/76757
    Reviewed-by: Henry Castro <hcas...@collabora.com>
    Tested-by: Henry Castro <hcas...@collabora.com>

diff --git a/loleaflet/css/loleaflet.css b/loleaflet/css/loleaflet.css
index 08d172546..28675fd2f 100644
--- a/loleaflet/css/loleaflet.css
+++ b/loleaflet/css/loleaflet.css
@@ -319,6 +319,10 @@ body {
        height: 18px;
 }
 
+.loleaflet-annotation-content-resolved {
+       color: green;
+}
+
 .loleaflet-annotation-edit {
        margin: 3px 3px;
        line-height: 1.4;
diff --git a/loleaflet/src/layer/AnnotationManager.js 
b/loleaflet/src/layer/AnnotationManager.js
index 2217f1db1..fcd0abbd1 100644
--- a/loleaflet/src/layer/AnnotationManager.js
+++ b/loleaflet/src/layer/AnnotationManager.js
@@ -23,6 +23,7 @@ L.AnnotationManager = L.Class.extend({
                this._map.on('AnnotationCancel', this._onAnnotationCancel, 
this);
                this._map.on('AnnotationClick', this._onAnnotationClick, this);
                this._map.on('AnnotationReply', this._onAnnotationReply, this);
+               this._map.on('AnnotationResolve', this._onAnnotationResolve, 
this);
                this._map.on('AnnotationSave', this._onAnnotationSave, this);
                this._map.on('RedlineAccept', this._onRedlineAccept, this);
                this._map.on('RedlineReject', this._onRedlineReject, this);
@@ -573,6 +574,19 @@ L.AnnotationManager = L.Class.extend({
                annotation.focus();
        },
 
+       resolve: function (annotation) {
+               // This is called by WriteTileLayer
+               var comment = {
+                       Id: {
+                               type: 'string',
+                               value: annotation._data.id
+                       }
+               };
+               this._map.sendUnoCommand('.uno:ResolveComment', comment);
+               annotation.update();
+               this.update();
+       },
+
        remove: function (id) {
                var comment = {
                        Id: {
@@ -733,6 +747,22 @@ L.AnnotationManager = L.Class.extend({
                this._map.focus();
        },
 
+       _onAnnotationResolve: function (e) {
+               var comment = {
+                       Id: {
+                               type: 'string',
+                               value: e.annotation._data.id
+                       },
+                       Text: {
+                               type: 'string',
+                               value: e.annotation._data.reply
+                       }
+               };
+               this._map.sendUnoCommand('.uno:ResolveComment', comment);
+               this.unselect();
+               this._map.focus();
+       },
+
        _onAnnotationSave: function (e) {
                var comment;
                if (e.annotation._data.id === 'new') {
diff --git a/loleaflet/src/layer/marker/Annotation.js 
b/loleaflet/src/layer/marker/Annotation.js
index 0eedb26a3..a934a5e81 100644
--- a/loleaflet/src/layer/marker/Annotation.js
+++ b/loleaflet/src/layer/marker/Annotation.js
@@ -190,6 +190,13 @@ L.Annotation = L.Layer.extend({
                }
                this._author = L.DomUtil.create('table', 
'loleaflet-annotation-table', wrapper);
                var tbody = L.DomUtil.create('tbody', empty, this._author);
+               var rowResolved = L.DomUtil.create('tr', empty, tbody);
+               var tdResolved = L.DomUtil.create(tagTd, 
'loleaflet-annotation-resolved', rowResolved);
+               var pResolved = L.DomUtil.create(tagDiv, 
'loleaflet-annotation-content-resolved', tdResolved);
+               this._resolved = pResolved;
+
+               this._updateResolvedField(this._data.resolved);
+
                var tr = L.DomUtil.create('tr', empty, tbody);
                var tdImg = L.DomUtil.create(tagTd, 'loleaflet-annotation-img', 
tr);
                var tdAuthor = L.DomUtil.create(tagTd, 
'loleaflet-annotation-author', tr);
@@ -336,6 +343,11 @@ L.Annotation = L.Layer.extend({
                this._map.fire('AnnotationReply', {annotation: this});
        },
 
+       _onResolveClick: function (e) {
+               L.DomEvent.stopPropagation(e);
+               this._map.fire('AnnotationResolve', {annotation: this});
+       },
+
        _updateLayout: function () {
                var style = this._wrapper.style;
                style.width = '';
@@ -344,6 +356,10 @@ L.Annotation = L.Layer.extend({
                style.whiteSpace = '';
        },
 
+       _updateResolvedField: function(state) {
+               $(this._resolved).text(state=='true' ? 'Resolved' : '');
+       },
+
        _updateContent: function () {
                // .text() method will escape the string, does not interpret 
the string as HTML
                $(this._contentText).text(this._data.text);
@@ -357,6 +373,8 @@ L.Annotation = L.Layer.extend({
                this._contentText.origText = this._data.text;
                $(this._nodeModifyText).text(this._data.text);
                $(this._contentAuthor).text(this._data.author);
+
+               this._updateResolvedField(this._data.resolved);
                $(this._authorAvatarImg).attr('src', this._data.avatar);
                var user = this._map.getViewId(this._data.author);
                if (user >= 0) {
diff --git a/loleaflet/src/layer/tile/TileLayer.js 
b/loleaflet/src/layer/tile/TileLayer.js
index 63a47d4bc..ea0c58c7c 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -225,6 +225,12 @@ L.TileLayer = L.GridLayer.extend({
                                        callback: function (key, options) {
                                                
that.onAnnotationRemove.call(that, options.$trigger.get(0).annotation._data.id);
                                        }
+                               },
+                               resolve: this._docType !== 'text' ? undefined : 
{
+                                       name: _('Resolve'),
+                                       callback: function (key, options) {
+                                               
that.onAnnotationResolve.call(that, options.$trigger.get(0).annotation);
+                                       }
                                }
                        },
                        events: {
diff --git a/loleaflet/src/layer/tile/WriterTileLayer.js 
b/loleaflet/src/layer/tile/WriterTileLayer.js
index 8b714b362..e5ffbca4c 100644
--- a/loleaflet/src/layer/tile/WriterTileLayer.js
+++ b/loleaflet/src/layer/tile/WriterTileLayer.js
@@ -179,6 +179,10 @@ L.WriterTileLayer = L.TileLayer.extend({
                this._annotations.reply(annotation);
        },
 
+       onAnnotationResolve: function (annotation) {
+               this._annotations.resolve(annotation);
+       },
+
        onChangeAccept: function(id) {
                this._annotations.acceptChange(id);
        },
diff --git a/loleaflet/src/unocommands.js b/loleaflet/src/unocommands.js
index 5d5ef423c..bfef61bec 100644
--- a/loleaflet/src/unocommands.js
+++ b/loleaflet/src/unocommands.js
@@ -189,6 +189,7 @@ var unoCommandsArray = {
        RemoveTableOf:{text:{menu:_('Delete index'),},},
        RenameTable:{spreadsheet:{menu:_('~Rename Sheet...'),},},
        ReplyComment:{global:{menu:_('Reply Comment'),},},
+       ResolveComment:{global:{menu:_('Resolve Comment'),},},
        ResetAttributes:{global:{menu:_('~Clear Direct 
Formatting'),},spreadsheet:{context:_('Clear Direct Formatting'),menu:_('Clear 
~Direct Formatting'),},text:{context:_('Clear Direct Formatting'),menu:_('Clear 
~Direct Formatting'),},},
        RightPara:{global:{context:_('Align Right'),menu:_('Right'),},},
        RotateLeft:{text:{menu:_('Rotate 90° ~Left'),},},
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to