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
parent d362a6ceba
commit 06f025f4bd

View File

@ -1,6 +1,6 @@
/*! /*!
* Deluge.add.UrlWindow.js * Deluge.add.UrlWindow.js
* *
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com> * Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -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() {
Deluge.add.UrlWindow.superclass.initComponent.call(this);
this.addButton(_('Add'), this.onAddClick, this);
var form = this.add({
xtype: 'form',
defaultType: 'textfield',
baseCls: 'x-plain',
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);
},
onAddClick: function(field, e) {
if ((field.id == 'url' || field.id == 'cookies') && e.getKey() != e.ENTER) return;
var field = this.urlField; initComponent: function() {
var url = field.getValue(); Deluge.add.UrlWindow.superclass.initComponent.call(this);
var cookies = this.cookieField.getValue(); this.addButton(_('Add'), this.onAddClick, this);
var torrentId = this.createTorrentId();
var form = this.add({
deluge.client.web.download_torrent_from_url(url, cookies, { xtype: 'form',
success: this.onDownload, defaultType: 'textfield',
scope: this, baseCls: 'x-plain',
torrentId: torrentId labelWidth: 55
}); });
this.hide();
this.fireEvent('beforeadd', torrentId, url); this.urlField = form.add({
}, fieldLabel: _('Url'),
id: 'url',
onDownload: function(filename, obj, resp, req) { name: 'url',
this.urlField.setValue(''); width: '97%'
deluge.client.web.get_torrent_info(filename, { });
success: this.onGotInfo, this.urlField.on('specialkey', this.onAdd, this);
scope: this,
filename: filename, this.cookieField = form.add({
torrentId: req.options.torrentId fieldLabel: _('Cookies'),
}); id: 'cookies',
}, name: 'cookies',
width: '97%'
onGotInfo: function(info, obj, response, request) { });
info['filename'] = request.options.filename; this.cookieField.on('specialkey', this.onAdd, this);
this.fireEvent('add', request.options.torrentId, info); },
}
onAddClick: function(field, e) {
if ((field.id == 'url' || field.id == 'cookies') && e.getKey() != e.ENTER) return;
var field = this.urlField;
var url = field.getValue();
var cookies = this.cookieField.getValue();
var torrentId = this.createTorrentId();
deluge.client.web.download_torrent_from_url(url, cookies, {
success: this.onDownload,
scope: this,
torrentId: torrentId
});
this.hide();
this.fireEvent('beforeadd', torrentId, url);
},
onDownload: function(filename, obj, resp, req) {
this.urlField.setValue('');
deluge.client.web.get_torrent_info(filename, {
success: this.onGotInfo,
scope: this,
filename: filename,
torrentId: req.options.torrentId
});
},
onGotInfo: function(info, obj, response, request) {
info['filename'] = request.options.filename;
this.fireEvent('add', request.options.torrentId, info);
}
}); });