fix the widths on the input boxes, whitespace changes too

This commit is contained in:
Damien Churchill 2011-05-06 19:02:54 +01:00
commit 06f025f4bd

View file

@ -33,75 +33,75 @@
Ext.namespace('Deluge.add'); Ext.namespace('Deluge.add');
Deluge.add.UrlWindow = Ext.extend(Deluge.add.Window, { Deluge.add.UrlWindow = Ext.extend(Deluge.add.Window, {
title: _('Add from Url'), title: _('Add from Url'),
modal: true, modal: true,
plain: true, plain: true,
layout: 'fit', layout: 'fit',
width: 350, width: 350,
height: 155, height: 155,
buttonAlign: 'center', buttonAlign: 'center',
closeAction: 'hide', closeAction: 'hide',
bodyStyle: 'padding: 10px 5px;', bodyStyle: 'padding: 10px 5px;',
iconCls: 'x-deluge-add-url-window-icon', iconCls: 'x-deluge-add-url-window-icon',
initComponent: function() { initComponent: function() {
Deluge.add.UrlWindow.superclass.initComponent.call(this); Deluge.add.UrlWindow.superclass.initComponent.call(this);
this.addButton(_('Add'), this.onAddClick, this); this.addButton(_('Add'), this.onAddClick, this);
var form = this.add({ var form = this.add({
xtype: 'form', xtype: 'form',
defaultType: 'textfield', defaultType: 'textfield',
baseCls: 'x-plain', baseCls: 'x-plain',
labelWidth: 55 labelWidth: 55
}); });
this.urlField = form.add({ this.urlField = form.add({
fieldLabel: _('Url'), fieldLabel: _('Url'),
id: 'url', id: 'url',
name: 'url', name: 'url',
anchor: '100%' width: '97%'
}); });
this.urlField.on('specialkey', this.onAdd, this); this.urlField.on('specialkey', this.onAdd, this);
this.cookieField = form.add({ this.cookieField = form.add({
fieldLabel: _('Cookies'), fieldLabel: _('Cookies'),
id: 'cookies', id: 'cookies',
name: 'cookies', name: 'cookies',
anchor: '100%' width: '97%'
}); });
this.cookieField.on('specialkey', this.onAdd, this); this.cookieField.on('specialkey', this.onAdd, this);
}, },
onAddClick: function(field, e) { onAddClick: function(field, e) {
if ((field.id == 'url' || field.id == 'cookies') && e.getKey() != e.ENTER) return; if ((field.id == 'url' || field.id == 'cookies') && e.getKey() != e.ENTER) return;
var field = this.urlField; var field = this.urlField;
var url = field.getValue(); var url = field.getValue();
var cookies = this.cookieField.getValue(); var cookies = this.cookieField.getValue();
var torrentId = this.createTorrentId(); var torrentId = this.createTorrentId();
deluge.client.web.download_torrent_from_url(url, cookies, { deluge.client.web.download_torrent_from_url(url, cookies, {
success: this.onDownload, success: this.onDownload,
scope: this, scope: this,
torrentId: torrentId torrentId: torrentId
}); });
this.hide(); this.hide();
this.fireEvent('beforeadd', torrentId, url); this.fireEvent('beforeadd', torrentId, url);
}, },
onDownload: function(filename, obj, resp, req) { onDownload: function(filename, obj, resp, req) {
this.urlField.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,
filename: filename, filename: filename,
torrentId: req.options.torrentId torrentId: req.options.torrentId
}); });
}, },
onGotInfo: function(info, obj, response, request) { onGotInfo: function(info, obj, response, request) {
info['filename'] = request.options.filename; info['filename'] = request.options.filename;
this.fireEvent('add', request.options.torrentId, info); this.fireEvent('add', request.options.torrentId, info);
} }
}); });