mirror of
https://github.com/codex-storage/deluge.git
synced 2025-01-12 04:24:27 +00:00
add a cookies field to the url window
This commit is contained in:
parent
97a7890a28
commit
ee16bffbbd
@ -44,19 +44,17 @@ Ext.deluge.add.FileWindow = Ext.extend(Ext.deluge.add.Window, {
|
||||
modal: true,
|
||||
plain: true,
|
||||
title: _('Add from File'),
|
||||
iconCls: 'x-deluge-add-file',
|
||||
buttons: [{
|
||||
text: _('Add'),
|
||||
handler: this.onAdd,
|
||||
scope: this
|
||||
}]
|
||||
iconCls: 'x-deluge-add-file'
|
||||
}, config);
|
||||
Ext.deluge.add.UrlWindow.superclass.constructor.call(this, config);
|
||||
},
|
||||
|
||||
initComponent: function() {
|
||||
Ext.deluge.add.UrlWindow.superclass.initComponent.call(this);
|
||||
this.form = this.add(new Ext.form.FormPanel({
|
||||
Ext.deluge.add.FileWindow.superclass.initComponent.call(this);
|
||||
this.addButton(_('Add'), this.onAdd, this);
|
||||
|
||||
this.form = this.add({
|
||||
xtype: 'form',
|
||||
baseCls: 'x-plain',
|
||||
labelWidth: 55,
|
||||
autoHeight: true,
|
||||
@ -71,7 +69,7 @@ Ext.deluge.add.FileWindow = Ext.extend(Ext.deluge.add.Window, {
|
||||
text: _('Browse') + '...'
|
||||
}
|
||||
}]
|
||||
}));
|
||||
});
|
||||
},
|
||||
|
||||
onAdd: function(field, e) {
|
||||
|
@ -37,49 +37,50 @@ Ext.deluge.add.UrlWindow = Ext.extend(Ext.deluge.add.Window, {
|
||||
config = Ext.apply({
|
||||
layout: 'fit',
|
||||
width: 350,
|
||||
height: 115,
|
||||
height: 155,
|
||||
bodyStyle: 'padding: 10px 5px;',
|
||||
buttonAlign: 'center',
|
||||
closeAction: 'hide',
|
||||
modal: true,
|
||||
plain: true,
|
||||
title: _('Add from Url'),
|
||||
iconCls: 'x-deluge-add-url-window-icon',
|
||||
buttons: [{
|
||||
text: _('Add'),
|
||||
handler: this.onAdd,
|
||||
scope: this
|
||||
}]
|
||||
iconCls: 'x-deluge-add-url-window-icon'
|
||||
}, config);
|
||||
Ext.deluge.add.UrlWindow.superclass.constructor.call(this, config);
|
||||
},
|
||||
|
||||
initComponent: function() {
|
||||
Ext.deluge.add.UrlWindow.superclass.initComponent.call(this);
|
||||
this.form = this.add(new Ext.form.FormPanel({
|
||||
this.addButton(_('Add'), this.onAdd, this);
|
||||
|
||||
var form = this.add({
|
||||
xtype: 'form',
|
||||
defaultType: 'textfield',
|
||||
baseCls: 'x-plain',
|
||||
labelWidth: 55,
|
||||
items: [{
|
||||
fieldLabel: _('Url'),
|
||||
id: 'url',
|
||||
name: 'url',
|
||||
inputType: 'url',
|
||||
anchor: '100%',
|
||||
listeners: {
|
||||
'specialkey': {
|
||||
fn: this.onAdd,
|
||||
scope: this
|
||||
}
|
||||
}
|
||||
}]
|
||||
}));
|
||||
labelWidth: 55
|
||||
});
|
||||
|
||||
this.urlField = form.add({
|
||||
fieldLabel: _('Url'),
|
||||
id: 'url',
|
||||
name: 'url',
|
||||
anchor: '100%'
|
||||
});
|
||||
this.urlField.on('specialkey', this.onAdd, this);
|
||||
|
||||
this.cookieField = form.add({
|
||||
fieldLabel: _('Cookies'),
|
||||
id: 'cookies',
|
||||
name: 'cookies',
|
||||
anchor: '100%'
|
||||
});
|
||||
this.cookieField.on('specialkey', this.onAdd, this);
|
||||
},
|
||||
|
||||
onAdd: function(field, e) {
|
||||
if (field.id == 'url' && e.getKey() != e.ENTER) return;
|
||||
|
||||
var field = this.form.items.get('url');
|
||||
var field = this.urlField;
|
||||
var url = field.getValue();
|
||||
var torrentId = this.createTorrentId();
|
||||
|
||||
@ -93,7 +94,7 @@ Ext.deluge.add.UrlWindow = Ext.extend(Ext.deluge.add.Window, {
|
||||
},
|
||||
|
||||
onDownload: function(filename, obj, resp, req) {
|
||||
this.form.items.get('url').setValue('');
|
||||
this.urlField.setValue('');
|
||||
Deluge.Client.web.get_torrent_info(filename, {
|
||||
success: this.onGotInfo,
|
||||
scope: this,
|
||||
|
Loading…
x
Reference in New Issue
Block a user