added menu "Open file location"

This commit is contained in:
Maxim Kadushkin
2016-11-15 19:05:29 +03:00
parent 1f165d2a02
commit 53ce828fc0
9 changed files with 55 additions and 2 deletions

View File

@ -115,6 +115,15 @@ Menu.prototype.disableItem = function(action, disable) {
}
};
Menu.prototype.hideItem = function(action, hide) {
for (let item of this.items) {
if (item.action == action) {
$('#' + item.id).parent()
[hide?'hide':'show']();
}
}
};
Menu.opened = false;
Menu.closeAll = function() {

View File

@ -160,6 +160,7 @@ function FileModel(attributes) {
this.name = attributes.name || '';
this.descr = attributes.descr || '';
this.path = attributes.path;
this.date = attributes.date;
this.type = attributes.type;
this.fileid = attributes.id;

View File

@ -197,6 +197,7 @@
collectionRecents.events.contextmenu.attach(function(collection, model, e){
ppmenu.actionlist = 'recent';
ppmenu.hideItem('files:explore', false);
ppmenu.show({left: e.clientX, top: e.clientY}, model);
});
@ -221,6 +222,7 @@
});
collectionRecovers.events.contextmenu.attach((collection, model, e)=>{
ppmenu.actionlist = 'recovery';
ppmenu.hideItem('files:explore', true);
ppmenu.show({left: e.clientX, top: e.clientY}, model);
});
};
@ -231,6 +233,9 @@
items: [{
caption: utils.Lang.menuFileOpen,
action: 'files:open'
},{
caption: 'Show in folder',
action: 'files:explore'
},{
caption: utils.Lang.menuRemoveModel,
action: 'files:forget'
@ -259,6 +264,11 @@
menu.actionlist == 'recent' ?
window.sdk.LocalFileRemoveRecent(parseInt(data.fileid)) :
window.sdk.LocalFileRemoveRecover(parseInt(data.fileid));
} else
if (/\:explore/.test(action)) {
if (menu.actionlist == 'recent') {
sdk.execCommand('files:explore', data.path);
}
}
};