loleaflet/src/control/Control.AlertDialog.js |    2 -
 loleaflet/src/control/Control.Menubar.js     |    8 ++++---
 loleaflet/src/control/Control.Toolbar.js     |    5 +++-
 loleaflet/src/control/Toolbar.js             |   30 +++++++++++++++++++++++++++
 4 files changed, 40 insertions(+), 5 deletions(-)

New commits:
commit 34251c1d13e0c0f261f7164a0d7cedb399ebde47
Author:     Grzegorz Araminowicz <grzegorz.araminow...@collabora.com>
AuthorDate: Mon Oct 7 15:56:51 2019 +0200
Commit:     Michael Meeks <michael.me...@collabora.com>
CommitDate: Mon Oct 7 16:20:18 2019 +0200

    Add "Insert Hyperlink" vex dialog
    
    Change-Id: I6a136a1e0b7887ef0b5d9e027a5336d962a9af26
    Reviewed-on: https://gerrit.libreoffice.org/80390
    Reviewed-by: Szymon Kłos <szymon.k...@collabora.com>
    Reviewed-by: Michael Meeks <michael.me...@collabora.com>
    Tested-by: Michael Meeks <michael.me...@collabora.com>

diff --git a/loleaflet/src/control/Control.AlertDialog.js 
b/loleaflet/src/control/Control.AlertDialog.js
index 82c050948..d0f72e988 100644
--- a/loleaflet/src/control/Control.AlertDialog.js
+++ b/loleaflet/src/control/Control.AlertDialog.js
@@ -54,8 +54,8 @@ L.Control.AlertDialog = L.Control.extend({
                                type: 'button',
                                className: 'vex-dialog-button-secondary',
                                click: function editClick () {
-                                       
e.map.toggleCommandState('HyperlinkDialog');
                                        vex.closeAll();
+                                       e.map.showHyperlinkDialog();
                                }
                        });
 
diff --git a/loleaflet/src/control/Control.Menubar.js 
b/loleaflet/src/control/Control.Menubar.js
index 9df4099df..9f26fe60b 100644
--- a/loleaflet/src/control/Control.Menubar.js
+++ b/loleaflet/src/control/Control.Menubar.js
@@ -105,7 +105,7 @@ L.Control.Menubar = L.Control.extend({
                                {uno: '.uno:InsertPagebreak'},
                                {uno: '.uno:InsertColumnBreak'},
                                {type: 'separator'},
-                               {uno: '.uno:HyperlinkDialog'},
+                               {name: _UNO('.uno:HyperlinkDialog'), id: 
'hyperlink', type: 'action'},
                                {uno: '.uno:InsertSymbol'},
                                {name: _UNO('.uno:FormattingMarkMenu', 'text'), 
type: 'menu', menu: [
                                        {uno: '.uno:InsertNonBreakingSpace'},
@@ -294,7 +294,7 @@ L.Control.Menubar = L.Control.extend({
                                {name: _UNO('.uno:InsertAnnotation', 
'presentation'), id: 'insertcomment', type: 'action'},
                                {uno: '.uno:InsertObjectChart'},
                                {type: 'separator'},
-                               {uno: '.uno:HyperlinkDialog'},
+                               {name: _UNO('.uno:HyperlinkDialog'), id: 
'hyperlink', type: 'action'},
                                {type: 'separator'},
                                {uno: '.uno:InsertSymbol'},
                                {type: 'separator'},
@@ -388,7 +388,7 @@ L.Control.Menubar = L.Control.extend({
                                {uno: '.uno:InsertObjectChart'},
                                {name: _UNO('.uno:InsertAnnotation', 
'spreadsheet'), id: 'insertcomment', type: 'action'},
                                {type: 'separator'},
-                               {uno: '.uno:HyperlinkDialog'},
+                               {name: _UNO('.uno:HyperlinkDialog'), id: 
'hyperlink', type: 'action'},
                                {uno: '.uno:InsertSymbol'},
                                {uno: '.uno:EditHeaderAndFooter'}
                        ]},
@@ -890,6 +890,8 @@ L.Control.Menubar = L.Control.extend({
                        });
                } else if (id === 'about') {
                        this._map.showLOAboutDialog();
+               } else if (id === 'hyperlink') {
+                       this._map.showHyperlinkDialog();
                } else if (id === 'keyboard-shortcuts') {
                        this._map.showLOKeyboardHelp();
                } else if (revHistoryEnabled && (id === 'rev-history' || id === 
'last-mod')) {
diff --git a/loleaflet/src/control/Control.Toolbar.js 
b/loleaflet/src/control/Control.Toolbar.js
index f0656b0dc..965fc9c56 100644
--- a/loleaflet/src/control/Control.Toolbar.js
+++ b/loleaflet/src/control/Control.Toolbar.js
@@ -342,6 +342,9 @@ function onClick(e, id, item, subItem) {
                        toolbar.check(id);
                }
        }
+       else if (id == 'link') {
+               map.showHyperlinkDialog();
+       }
        else {
                map.handleSigningClickEvent(id, item); // this handles a bunch 
of signing bar click events
        }
@@ -857,7 +860,7 @@ function initNormalToolbar() {
                {type: 'drop',  id: 'insertshapes',  img: 
'basicshapes_ellipse', hint: _('Insert shapes'), overlay: {onShow: 
insertShapes},
                        html: '<div id="insertshape-wrapper"><div 
id="insertshape-popup" class="insertshape-pop ui-widget ui-corner-all"><div 
class="insertshape-grid"></div></div></div>'},
 
-               {type: 'button',  id: 'link',  img: 'link', hint: 
_UNO('.uno:HyperlinkDialog'), uno: 'HyperlinkDialog', disabled: true},
+               {type: 'button',  id: 'link',  img: 'link', hint: 
_UNO('.uno:HyperlinkDialog', '', true), disabled: true},
                {type: 'button',  id: 'insertsymbol', img: 'insertsymbol', 
hint: _UNO('.uno:InsertSymbol', '', true), uno: 'InsertSymbol'},
                {type: 'spacer'},
                {type: 'button',  id: 'edit',  img: 'edit'},
diff --git a/loleaflet/src/control/Toolbar.js b/loleaflet/src/control/Toolbar.js
index cd0728b69..18ad41850 100644
--- a/loleaflet/src/control/Toolbar.js
+++ b/loleaflet/src/control/Toolbar.js
@@ -346,5 +346,35 @@ L.Map.include({
                                map.focus();
                        }
                });
+       },
+
+       showHyperlinkDialog: function() {
+               var map = this;
+               vex.dialog.open({
+                       message: _('Insert hyperlink'),
+                       input: [
+                               _('Text') + '<input name="text" type="text"/>',
+                               _('Link') + '<input name="link" type="text"/>'
+                       ].join(''),
+                       buttons: [
+                               $.extend({}, vex.dialog.buttons.YES, { text: 
_('OK') }),
+                               $.extend({}, vex.dialog.buttons.NO, { text: 
_('Cancel') })
+                       ],
+                       callback: function(data) {
+                               if (data && data.link != '') {
+                                       var command = {
+                                               'Hyperlink.Text': {
+                                                       type: 'string',
+                                                       value: data.text
+                                               },
+                                               'Hyperlink.URL': {
+                                                       type: 'string',
+                                                       value: data.link
+                                               }
+                                       };
+                                       map.sendUnoCommand('.uno:SetHyperlink', 
command);
+                               }
+                       }
+               });
        }
 });
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to