[SSE] Open print with preview from toolbar, remove unused code

This commit is contained in:
JuliaSvinareva 2021-10-21 16:01:30 +03:00
parent 8e9d5dcea0
commit 79bf7d21bb
4 changed files with 8 additions and 16 deletions

View file

@ -107,6 +107,7 @@ define([
if ( !this.leftMenu.panelHistory.isVisible() )
this.clickMenuFileItem(null, 'history');
}, this));
Common.NotificationCenter.on('file:print', _.bind(this.clickToolbarPrint, this));
},
onLaunch: function() {
@ -534,6 +535,10 @@ define([
this.leftMenu.menuFile.hide();
},
clickToolbarPrint: function () {
this.leftMenu.showMenu('file:printpreview');
},
changeToolbarSaveState: function (state) {
var btnSave = this.leftMenu.menuFile.getButton('save');
btnSave && btnSave.setDisabled(state);

View file

@ -2639,7 +2639,7 @@ define([
onPrint: function() {
if (!this.appOptions.canPrint || Common.Utils.ModalWindow.isVisible()) return;
Common.NotificationCenter.trigger('print', this);
Common.NotificationCenter.trigger('file:print', this);
},
onPrintUrl: function(url) {

View file

@ -7,7 +7,6 @@
<li id="fm-btn-download" class="fm-btn"></li>
<li id="fm-btn-save-copy" class="fm-btn"></li>
<li id="fm-btn-save-desktop" class="fm-btn"></li>
<li id="fm-btn-print" class="fm-btn"></li>
<li id="fm-btn-print-with-preview" class="fm-btn"></li>
<li id="fm-btn-rename" class="fm-btn"></li>
<li id="fm-btn-protect" class="fm-btn"></li>

View file

@ -129,19 +129,9 @@ define([
dataHintOffset: [2, 14]
});
this.miPrint = new Common.UI.MenuItem({
el : $markup.elementById('#fm-btn-print'),
action : 'print',
caption : this.btnPrintCaption,
canFocused: false,
dataHint: 1,
dataHintDirection: 'left-top',
dataHintOffset: [2, 14]
});
this.miPrintWithPreview = new Common.UI.MenuItem({
el : $markup.elementById('#fm-btn-print-with-preview'),
action : 'print-with-preview',
action : 'printpreview',
caption : this.btnPrintCaption,
canFocused: false,
dataHint: 1,
@ -253,7 +243,6 @@ define([
this.miDownload,
this.miSaveCopyAs,
this.miSaveAs,
this.miPrint,
this.miPrintWithPreview,
this.miRename,
this.miProtect,
@ -353,7 +342,6 @@ define([
this.miSaveAs[(this.mode.canDownload && this.mode.isDesktopApp && this.mode.isOffline)?'show':'hide']();
this.miSave[this.mode.isEdit?'show':'hide']();
this.miEdit[!this.mode.isEdit && this.mode.canEdit && this.mode.canRequestEditRights ?'show':'hide']();
this.miPrint[this.mode.canPrint?'show':'hide']();
this.miPrintWithPreview[this.mode.canPrint?'show':'hide']();
this.miRename[(this.mode.canRename && !this.mode.isDesktopApp) ?'show':'hide']();
this.miProtect[this.mode.canProtect ?'show':'hide']();
@ -422,7 +410,7 @@ define([
if (this.mode.canPrint) {
var printPanel = SSE.getController('Print').getView('PrintWithPreview');
printPanel.menu = this;
this.panels['print-with-preview'] = printPanel.render(this.$el.find('#panel-print'));
this.panels['printpreview'] = printPanel.render(this.$el.find('#panel-print'));
}
},