Skip to content

Commit

Permalink
Writer: add show comments info into status bar.
Browse files Browse the repository at this point in the history
Note for cypress test change: After this patch, status bar elements
increased. To reach next and previous page buttons, user have to
scroll the status bar right then click the buttons. So we can force
the click here.

Signed-off-by: Gülşah Köse <gulsah.kose@collabora.com>
Change-Id: I2d3a2b4eb17a839a2ed51e60a0e6c2c66d89b7e6
  • Loading branch information
GulsahKose authored and eszkadev committed Dec 20, 2024
1 parent ae1f3d8 commit c64bb24
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 1 deletion.
16 changes: 16 additions & 0 deletions browser/src/control/Control.StatusBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,16 @@ class StatusBar extends JSDialog.Toolbar {
this.updateHtmlItem('StatePageNumber', state ? state : ' ');
}

onShowCommentsChange(e) {
var state = e.state;
var statemsg;
if (state === 'true')
statemsg = _UNO('.uno:ShowAnnotations') +': ' + _('On');
else if (state === 'false')
statemsg = _UNO('.uno:ShowAnnotations') +': ' + _('Off');
this.updateHtmlItem('ShowComments', state ? statemsg : ' ');
}

_generateHtmlItem(id) {
var isReadOnlyMode = app.map ? app.map.isReadOnlyMode() : true;
var canUserWrite = !app.isReadOnly();
Expand Down Expand Up @@ -237,6 +247,7 @@ class StatusBar extends JSDialog.Toolbar {
this._generateHtmlItem('statepagenumber'), // text
this._generateHtmlItem('statewordcount'), // text
this._generateHtmlItem('insertmode'), // spreadsheet, text
this._generateHtmlItem('showcomments'), // text
this._generateHtmlItem('statusselectionmode'), // text
this._generateHtmlItem('slidestatus'), // presentation
this._generateHtmlItem('pagestatus'), // drawing
Expand Down Expand Up @@ -312,6 +323,7 @@ class StatusBar extends JSDialog.Toolbar {
this.showItem('languagestatus', !app.map.isReadOnlyMode());
this.showItem('languagestatusbreak', !app.map.isReadOnlyMode());
this.showItem('permissionmode-container', true);
this.showItem('showcomments-container', true);
this.showItem('documentstatus-container', true);
}
break;
Expand Down Expand Up @@ -477,6 +489,10 @@ class StatusBar extends JSDialog.Toolbar {
this.onPageChange(e);
return;
}
else if (commandName === 'showannotations') {
this.onShowCommentsChange(e);
return;
}
else if (commandName === '.uno:StateWordCount') {
state = this.toLocalePattern('%1 words, %2 characters', '([\\d,]+) words, ([\\d,]+) characters', state, '%1', '%2');
this.updateHtmlItem('StateWordCount', state ? state : ' ');
Expand Down
4 changes: 3 additions & 1 deletion browser/src/control/Control.UIManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,9 @@ L.Control.UIManager = L.Control.extend({
var showResolved = this.getBooleanDocTypePref('ShowResolved', true);
if (showResolved === false || showResolved === 'false')
this.map.sendUnoCommand('.uno:ShowResolvedAnnotations');

// Notify the inital status of comments
var initialCommentState = this.map['stateChangeHandler'].getItemValue('showannotations');
this._map.fire('commandstatechanged', {commandName : 'showannotations', state : initialCommentState});
this.map.mention = L.control.mention(this.map);
}

Expand Down
6 changes: 6 additions & 0 deletions browser/src/control/jsdialog/Widget.HTMLContent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ function getDocumentStatusElements(text: string) {
return docstat;
}

function getShowCommentsStatusElements(text: string) {
return getStatusbarItemElements('ShowComments', _('Show Comments'), text);
}

var getElementsFromId = function (
id: string,
closeCallback: EventListenerOrEventListenerObject,
Expand Down Expand Up @@ -170,6 +174,8 @@ var getElementsFromId = function (
return getPermissionModeElements(data.isReadOnlyMode, data.canUserWrite);
else if (id === 'statepagenumber') return getPageNumberElements(data.text);
else if (id === 'statewordcount') return getWordCountElements(data.text);
else if (id === 'showcomments')
return getShowCommentsStatusElements(data.text);
else if (id === 'statusdocpos') return getStatusDocPosElements(data.text);
else if (id === 'insertmode') return getInsertModeElements(data.text);
else if (id === 'statusselectionmode')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ describe(['tagdesktop', 'tagnextcloud', 'tagproxy'], 'Statubar tests.', function
cy.cGet('#menu-insert').click();
cy.cGet('body').contains('#menu-insert li a', 'Page Break').click();
desktopHelper.assertVisiblePage(1, 2, 2);
desktopHelper.makeZoomItemsVisible(); // make visible next and prev page buttons
cy.cGet('#toolbar-down #prev').click();
desktopHelper.assertVisiblePage(1, 1, 2);
cy.cGet('#toolbar-down #next').click();
Expand Down

0 comments on commit c64bb24

Please sign in to comment.