main menu: add entries for list view and item view

This commit is contained in:
rlx 2016-01-18 10:53:09 +05:30
parent 9c1c653582
commit a51f5cef09
1 changed files with 61 additions and 1 deletions

View File

@ -107,6 +107,54 @@ oml.ui.mainMenu = function() {
]
},
{},
{
id: 'listviewSubmenu',
title: Ox._('Books'),
items: [
{
group: 'listview',
min: 1,
max: 1,
items: [
{
id: 'list',
title: Ox._('List'),
checked: ui.listView == 'list'
},
{
id: 'grid',
title: Ox._('Grid'),
checked: ui.listView == 'grid'
}
]
}
]
},
{
id: 'itemviewSubmenu',
title: Ox._('Book'),
items: [
{
group: 'itemview',
min: 1,
max: 1,
items: [
{
id: 'info',
title: Ox._('Info'),
checked: ui.itemView == 'info',
disabled: !ui.item
},
{
id: 'book',
title: Ox._('Reader'),
checked: ui.itemView == 'book',
disabled: !ui.item
}
]
}
]
},
{
id: 'iconsSubmenu',
title: 'Icons',
@ -302,7 +350,11 @@ oml.ui.mainMenu = function() {
var id = data.id,
value = Ox.isBoolean(data.checked)
? data.checked : data.checked[0].id;
if (id == 'icons') {
if (id == 'listview') {
oml.UI.set({listView: value});
} else if (id == 'itemview') {
oml.UI.set({itemView: value});
} else if (id == 'icons') {
oml.UI.set({icons: value});
} else if (id == 'icons') {
oml.UI.set({icons: value});
@ -502,10 +554,15 @@ oml.ui.mainMenu = function() {
},
oml_item: function(data) {
if (!!data.value != !!data.previousValue) {
that[data.value ? 'enableItem' : 'disableItem']('info');
that[data.value ? 'enableItem' : 'disableItem']('book');
that[data.value ? 'disableItem' : 'enableItem']('showfilters');
that[data.value ? 'enableItem' : 'disableItem']('showbrowser');
}
},
oml_itemview: function(data) {
that.checkItem('viewMenu_itemviewSubmenu_' + data.value);
},
oml_listselection: function(data) {
that.replaceMenu('listMenu', getListMenu());
that.replaceMenu('editMenu', getEditMenu());
@ -516,6 +573,9 @@ oml.ui.mainMenu = function() {
data.value[0].operator == '+' ? 'ascending' : 'descending')
);
},
oml_listview: function(data) {
that.checkItem('viewMenu_listviewSubmenu_' + data.value);
},
oml_showbrowser: function(data) {
that.setItemTitle('showbrowser', Ox._((data.value ? 'Hide' : 'Show') + ' Browser'));
},