[#2485] [WebUI] Fix unconnected Options in context menu
This commit is contained in:
parent
42b9f22a81
commit
0e1582702a
|
@ -31,69 +31,54 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
deluge.menus = {
|
deluge.menus = {
|
||||||
onTorrentAction: function(item, e) {
|
onTorrentActionSetOpt: function(item, e) {
|
||||||
var ids = deluge.torrents.getSelectedIds();
|
var ids = deluge.torrents.getSelectedIds();
|
||||||
var action = item.initialConfig.torrentAction;
|
var action = item.initialConfig.torrentAction;
|
||||||
|
var opts = {};
|
||||||
|
opts[action[0]] = action[1];
|
||||||
|
deluge.client.core.set_torrent_options(ids, opts);
|
||||||
|
},
|
||||||
|
|
||||||
|
onTorrentActionMethod: function(item, e) {
|
||||||
|
var ids = deluge.torrents.getSelectedIds();
|
||||||
|
var action = item.initialConfig.torrentAction;
|
||||||
|
deluge.client.core[action](ids, {
|
||||||
|
success: function() {
|
||||||
|
deluge.ui.update();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
onTorrentActionShow: function(item, e) {
|
||||||
|
var ids = deluge.torrents.getSelectedIds();
|
||||||
|
var action = item.initialConfig.torrentAction;
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case 'pause':
|
|
||||||
case 'resume':
|
|
||||||
deluge.client.core[action + '_torrent'](ids, {
|
|
||||||
success: function() {
|
|
||||||
deluge.ui.update();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
case 'top':
|
|
||||||
case 'up':
|
|
||||||
case 'down':
|
|
||||||
case 'bottom':
|
|
||||||
deluge.client.core['queue_' + action](ids, {
|
|
||||||
success: function() {
|
|
||||||
deluge.ui.update();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
case 'edit_trackers':
|
case 'edit_trackers':
|
||||||
deluge.editTrackers.show();
|
deluge.editTrackers.show();
|
||||||
break;
|
break;
|
||||||
case 'update':
|
|
||||||
deluge.client.core.force_reannounce(ids, {
|
|
||||||
success: function() {
|
|
||||||
deluge.ui.update();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
case 'remove':
|
case 'remove':
|
||||||
deluge.removeWindow.show(ids);
|
deluge.removeWindow.show(ids);
|
||||||
break;
|
break;
|
||||||
case 'recheck':
|
|
||||||
deluge.client.core.force_recheck(ids, {
|
|
||||||
success: function() {
|
|
||||||
deluge.ui.update();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
case 'move':
|
case 'move':
|
||||||
deluge.moveStorage.show(ids);
|
deluge.moveStorage.show(ids);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
deluge.menus.torrent = new Ext.menu.Menu({
|
deluge.menus.torrent = new Ext.menu.Menu({
|
||||||
id: 'torrentMenu',
|
id: 'torrentMenu',
|
||||||
items: [{
|
items: [{
|
||||||
torrentAction: 'pause',
|
torrentAction: 'pause_torrent',
|
||||||
text: _('Pause'),
|
text: _('Pause'),
|
||||||
iconCls: 'icon-pause',
|
iconCls: 'icon-pause',
|
||||||
handler: deluge.menus.onTorrentAction,
|
handler: deluge.menus.onTorrentActionMethod,
|
||||||
scope: deluge.menus
|
scope: deluge.menus
|
||||||
}, {
|
}, {
|
||||||
torrentAction: 'resume',
|
torrentAction: 'resume_torrent',
|
||||||
text: _('Resume'),
|
text: _('Resume'),
|
||||||
iconCls: 'icon-resume',
|
iconCls: 'icon-resume',
|
||||||
handler: deluge.menus.onTorrentAction,
|
handler: deluge.menus.onTorrentActionMethod,
|
||||||
scope: deluge.menus
|
scope: deluge.menus
|
||||||
}, '-', {
|
}, '-', {
|
||||||
text: _('Options'),
|
text: _('Options'),
|
||||||
|
@ -106,17 +91,35 @@ deluge.menus.torrent = new Ext.menu.Menu({
|
||||||
hideOnClick: false,
|
hideOnClick: false,
|
||||||
menu: new Ext.menu.Menu({
|
menu: new Ext.menu.Menu({
|
||||||
items: [{
|
items: [{
|
||||||
text: _('5 KiB/s')
|
torrentAction: ['max_download_speed', 5],
|
||||||
|
text: _('5 KiB/s'),
|
||||||
|
handler: deluge.menus.onTorrentActionSetOpt,
|
||||||
|
scope: deluge.menus
|
||||||
}, {
|
}, {
|
||||||
text: _('10 KiB/s')
|
torrentAction: ['max_download_speed', 10],
|
||||||
|
text: _('10 KiB/s'),
|
||||||
|
handler: deluge.menus.onTorrentActionSetOpt,
|
||||||
|
scope: deluge.menus
|
||||||
}, {
|
}, {
|
||||||
text: _('30 KiB/s')
|
torrentAction: ['max_download_speed', 30],
|
||||||
|
text: _('30 KiB/s'),
|
||||||
|
handler: deluge.menus.onTorrentActionSetOpt,
|
||||||
|
scope: deluge.menus
|
||||||
}, {
|
}, {
|
||||||
text: _('80 KiB/s')
|
torrentAction: ['max_download_speed', 80],
|
||||||
|
text: _('80 KiB/s'),
|
||||||
|
handler: deluge.menus.onTorrentActionSetOpt,
|
||||||
|
scope: deluge.menus
|
||||||
}, {
|
}, {
|
||||||
text: _('300 KiB/s')
|
torrentAction: ['max_download_speed', 300],
|
||||||
|
text: _('300 KiB/s'),
|
||||||
|
handler: deluge.menus.onTorrentActionSetOpt,
|
||||||
|
scope: deluge.menus
|
||||||
},{
|
},{
|
||||||
text: _('Unlimited')
|
torrentAction: ['max_download_speed', -1],
|
||||||
|
text: _('Unlimited'),
|
||||||
|
handler: deluge.menus.onTorrentActionSetOpt,
|
||||||
|
scope: deluge.menus
|
||||||
}]
|
}]
|
||||||
})
|
})
|
||||||
}, {
|
}, {
|
||||||
|
@ -125,17 +128,35 @@ deluge.menus.torrent = new Ext.menu.Menu({
|
||||||
hideOnClick: false,
|
hideOnClick: false,
|
||||||
menu: new Ext.menu.Menu({
|
menu: new Ext.menu.Menu({
|
||||||
items: [{
|
items: [{
|
||||||
text: _('5 KiB/s')
|
torrentAction: ['max_upload_speed', 5],
|
||||||
|
text: _('5 KiB/s'),
|
||||||
|
handler: deluge.menus.onTorrentActionSetOpt,
|
||||||
|
scope: deluge.menus
|
||||||
}, {
|
}, {
|
||||||
text: _('10 KiB/s')
|
torrentAction: ['max_upload_speed', 10],
|
||||||
|
text: _('10 KiB/s'),
|
||||||
|
handler: deluge.menus.onTorrentActionSetOpt,
|
||||||
|
scope: deluge.menus
|
||||||
}, {
|
}, {
|
||||||
text: _('30 KiB/s')
|
torrentAction: ['max_upload_speed', 30],
|
||||||
|
text: _('30 KiB/s'),
|
||||||
|
handler: deluge.menus.onTorrentActionSetOpt,
|
||||||
|
scope: deluge.menus
|
||||||
}, {
|
}, {
|
||||||
text: _('80 KiB/s')
|
torrentAction: ['max_upload_speed', 80],
|
||||||
|
text: _('80 KiB/s'),
|
||||||
|
handler: deluge.menus.onTorrentActionSetOpt,
|
||||||
|
scope: deluge.menus
|
||||||
}, {
|
}, {
|
||||||
text: _('300 KiB/s')
|
torrentAction: ['max_upload_speed', 300],
|
||||||
|
text: _('300 KiB/s'),
|
||||||
|
handler: deluge.menus.onTorrentActionSetOpt,
|
||||||
|
scope: deluge.menus
|
||||||
},{
|
},{
|
||||||
text: _('Unlimited')
|
torrentAction: ['max_upload_speed', -1],
|
||||||
|
text: _('Unlimited'),
|
||||||
|
handler: deluge.menus.onTorrentActionSetOpt,
|
||||||
|
scope: deluge.menus
|
||||||
}]
|
}]
|
||||||
})
|
})
|
||||||
}, {
|
}, {
|
||||||
|
@ -144,17 +165,35 @@ deluge.menus.torrent = new Ext.menu.Menu({
|
||||||
hideOnClick: false,
|
hideOnClick: false,
|
||||||
menu: new Ext.menu.Menu({
|
menu: new Ext.menu.Menu({
|
||||||
items: [{
|
items: [{
|
||||||
text: '50'
|
torrentAction: ['max_connections', 50],
|
||||||
|
text: _('50'),
|
||||||
|
handler: deluge.menus.onTorrentActionSetOpt,
|
||||||
|
scope: deluge.menus
|
||||||
}, {
|
}, {
|
||||||
text: '100'
|
torrentAction: ['max_connections', 100],
|
||||||
|
text: _('100'),
|
||||||
|
handler: deluge.menus.onTorrentActionSetOpt,
|
||||||
|
scope: deluge.menus
|
||||||
}, {
|
}, {
|
||||||
text: '200'
|
torrentAction: ['max_connections', 200],
|
||||||
|
text: _('200'),
|
||||||
|
handler: deluge.menus.onTorrentActionSetOpt,
|
||||||
|
scope: deluge.menus
|
||||||
}, {
|
}, {
|
||||||
text: '300'
|
torrentAction: ['max_connections', 300],
|
||||||
|
text: _('300'),
|
||||||
|
handler: deluge.menus.onTorrentActionSetOpt,
|
||||||
|
scope: deluge.menus
|
||||||
}, {
|
}, {
|
||||||
text: '500'
|
torrentAction: ['max_connections', 500],
|
||||||
|
text: _('500'),
|
||||||
|
handler: deluge.menus.onTorrentActionSetOpt,
|
||||||
|
scope: deluge.menus
|
||||||
},{
|
},{
|
||||||
text: _('Unlimited')
|
torrentAction: ['max_connections', -1],
|
||||||
|
text: _('Unlimited'),
|
||||||
|
handler: deluge.menus.onTorrentActionSetOpt,
|
||||||
|
scope: deluge.menus
|
||||||
}]
|
}]
|
||||||
})
|
})
|
||||||
}, {
|
}, {
|
||||||
|
@ -163,23 +202,54 @@ deluge.menus.torrent = new Ext.menu.Menu({
|
||||||
hideOnClick: false,
|
hideOnClick: false,
|
||||||
menu: new Ext.menu.Menu({
|
menu: new Ext.menu.Menu({
|
||||||
items: [{
|
items: [{
|
||||||
text: '0'
|
torrentAction: ['max_upload_slots', 0],
|
||||||
|
text: _('0'),
|
||||||
|
handler: deluge.menus.onTorrentActionSetOpt,
|
||||||
|
scope: deluge.menus
|
||||||
}, {
|
}, {
|
||||||
text: '1'
|
torrentAction: ['max_upload_slots', 1],
|
||||||
|
text: _('1'),
|
||||||
|
handler: deluge.menus.onTorrentActionSetOpt,
|
||||||
|
scope: deluge.menus
|
||||||
}, {
|
}, {
|
||||||
text: '2'
|
torrentAction: ['max_upload_slots', 2],
|
||||||
|
text: _('2'),
|
||||||
|
handler: deluge.menus.onTorrentActionSetOpt,
|
||||||
|
scope: deluge.menus
|
||||||
}, {
|
}, {
|
||||||
text: '3'
|
torrentAction: ['max_upload_slots', 3],
|
||||||
|
text: _('3'),
|
||||||
|
handler: deluge.menus.onTorrentActionSetOpt,
|
||||||
|
scope: deluge.menus
|
||||||
}, {
|
}, {
|
||||||
text: '5'
|
torrentAction: ['max_upload_slots', 5],
|
||||||
|
text: _('5'),
|
||||||
|
handler: deluge.menus.onTorrentActionSetOpt,
|
||||||
|
scope: deluge.menus
|
||||||
},{
|
},{
|
||||||
text: _('Unlimited')
|
torrentAction: ['max_upload_slots', -1],
|
||||||
|
text: _('Unlimited'),
|
||||||
|
handler: deluge.menus.onTorrentActionSetOpt,
|
||||||
|
scope: deluge.menus
|
||||||
}]
|
}]
|
||||||
})
|
})
|
||||||
}, {
|
}, {
|
||||||
id: 'auto_managed',
|
id: 'auto_managed',
|
||||||
text: _('Auto Managed'),
|
text: _('Auto Managed'),
|
||||||
checked: false
|
hideOnClick: false,
|
||||||
|
menu: new Ext.menu.Menu({
|
||||||
|
items: [{
|
||||||
|
torrentAction: ['auto_managed', true],
|
||||||
|
text: _('On'),
|
||||||
|
handler: deluge.menus.onTorrentActionSetOpt,
|
||||||
|
scope: deluge.menus
|
||||||
|
}, {
|
||||||
|
torrentAction: ['auto_managed', false],
|
||||||
|
text: _('Off'),
|
||||||
|
handler: deluge.menus.onTorrentActionSetOpt,
|
||||||
|
scope: deluge.menus
|
||||||
|
}]
|
||||||
|
})
|
||||||
}]
|
}]
|
||||||
})
|
})
|
||||||
}, '-', {
|
}, '-', {
|
||||||
|
@ -188,60 +258,60 @@ deluge.menus.torrent = new Ext.menu.Menu({
|
||||||
hideOnClick: false,
|
hideOnClick: false,
|
||||||
menu: new Ext.menu.Menu({
|
menu: new Ext.menu.Menu({
|
||||||
items: [{
|
items: [{
|
||||||
torrentAction: 'top',
|
torrentAction: 'queue_top',
|
||||||
text: _('Top'),
|
text: _('Top'),
|
||||||
iconCls: 'icon-top',
|
iconCls: 'icon-top',
|
||||||
handler: deluge.menus.onTorrentAction,
|
handler: deluge.menus.onTorrentActionMethod,
|
||||||
scope: deluge.menus
|
scope: deluge.menus
|
||||||
},{
|
},{
|
||||||
torrentAction: 'up',
|
torrentAction: 'queue_up',
|
||||||
text: _('Up'),
|
text: _('Up'),
|
||||||
iconCls: 'icon-up',
|
iconCls: 'icon-up',
|
||||||
handler: deluge.menus.onTorrentAction,
|
handler: deluge.menus.onTorrentActionMethod,
|
||||||
scope: deluge.menus
|
scope: deluge.menus
|
||||||
},{
|
},{
|
||||||
torrentAction: 'down',
|
torrentAction: 'queue_down',
|
||||||
text: _('Down'),
|
text: _('Down'),
|
||||||
iconCls: 'icon-down',
|
iconCls: 'icon-down',
|
||||||
handler: deluge.menus.onTorrentAction,
|
handler: deluge.menus.onTorrentActionMethod,
|
||||||
scope: deluge.menus
|
scope: deluge.menus
|
||||||
},{
|
},{
|
||||||
torrentAction: 'bottom',
|
torrentAction: 'queue_bottom',
|
||||||
text: _('Bottom'),
|
text: _('Bottom'),
|
||||||
iconCls: 'icon-bottom',
|
iconCls: 'icon-bottom',
|
||||||
handler: deluge.menus.onTorrentAction,
|
handler: deluge.menus.onTorrentActionMethod,
|
||||||
scope: deluge.menus
|
scope: deluge.menus
|
||||||
}]
|
}]
|
||||||
})
|
})
|
||||||
}, '-', {
|
}, '-', {
|
||||||
torrentAction: 'update',
|
torrentAction: 'force_reannounce',
|
||||||
text: _('Update Tracker'),
|
text: _('Update Tracker'),
|
||||||
iconCls: 'icon-update-tracker',
|
iconCls: 'icon-update-tracker',
|
||||||
handler: deluge.menus.onTorrentAction,
|
handler: deluge.menus.onTorrentActionMethod,
|
||||||
scope: deluge.menus
|
scope: deluge.menus
|
||||||
}, {
|
}, {
|
||||||
torrentAction: 'edit_trackers',
|
torrentAction: 'edit_trackers',
|
||||||
text: _('Edit Trackers'),
|
text: _('Edit Trackers'),
|
||||||
iconCls: 'icon-edit-trackers',
|
iconCls: 'icon-edit-trackers',
|
||||||
handler: deluge.menus.onTorrentAction,
|
handler: deluge.menus.onTorrentActionShow,
|
||||||
scope: deluge.menus
|
scope: deluge.menus
|
||||||
}, '-', {
|
}, '-', {
|
||||||
torrentAction: 'remove',
|
torrentAction: 'remove',
|
||||||
text: _('Remove Torrent'),
|
text: _('Remove Torrent'),
|
||||||
iconCls: 'icon-remove',
|
iconCls: 'icon-remove',
|
||||||
handler: deluge.menus.onTorrentAction,
|
handler: deluge.menus.onTorrentActionShow,
|
||||||
scope: deluge.menus
|
scope: deluge.menus
|
||||||
}, '-', {
|
}, '-', {
|
||||||
torrentAction: 'recheck',
|
torrentAction: 'force_recheck',
|
||||||
text: _('Force Recheck'),
|
text: _('Force Recheck'),
|
||||||
iconCls: 'icon-recheck',
|
iconCls: 'icon-recheck',
|
||||||
handler: deluge.menus.onTorrentAction,
|
handler: deluge.menus.onTorrentActionMethod,
|
||||||
scope: deluge.menus
|
scope: deluge.menus
|
||||||
}, {
|
}, {
|
||||||
torrentAction: 'move',
|
torrentAction: 'move',
|
||||||
text: _('Move Download Folder'),
|
text: _('Move Download Folder'),
|
||||||
iconCls: 'icon-move',
|
iconCls: 'icon-move',
|
||||||
handler: deluge.menus.onTorrentAction,
|
handler: deluge.menus.onTorrentActionShow,
|
||||||
scope: deluge.menus
|
scope: deluge.menus
|
||||||
}]
|
}]
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue