add a cookies field to the url window

This commit is contained in:
Damien Churchill 2009-07-29 16:05:27 +00:00
parent 97a7890a28
commit ee16bffbbd
2 changed files with 33 additions and 34 deletions

View File

@ -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) {

View File

@ -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,