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