mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-12 19:28:42 +00:00
tidy up the file window and fix using Deluge.Client still
This commit is contained in:
parent
ae54d3fa18
commit
48876fa45c
1 changed files with 22 additions and 18 deletions
|
@ -29,25 +29,25 @@
|
||||||
* this exception statement from your version. If you delete this exception
|
* this exception statement from your version. If you delete this exception
|
||||||
* statement from all source files in the program, then also delete it here.
|
* statement from all source files in the program, then also delete it here.
|
||||||
*/
|
*/
|
||||||
|
Ext.ns('Deluge.add');
|
||||||
|
|
||||||
Ext.namespace('Ext.deluge.add');
|
/**
|
||||||
|
* @class Deluge.add.FileWindow
|
||||||
|
* @extends Deluge.add.Window
|
||||||
|
*/
|
||||||
Deluge.add.FileWindow = Ext.extend(Deluge.add.Window, {
|
Deluge.add.FileWindow = Ext.extend(Deluge.add.Window, {
|
||||||
constructor: function(config) {
|
|
||||||
config = Ext.apply({
|
title: _('Add from File'),
|
||||||
layout: 'fit',
|
layout: 'fit',
|
||||||
width: 350,
|
width: 350,
|
||||||
height: 115,
|
height: 115,
|
||||||
bodyStyle: 'padding: 10px 5px;',
|
modal: true,
|
||||||
buttonAlign: 'center',
|
plain: true,
|
||||||
closeAction: 'hide',
|
buttonAlign: 'center',
|
||||||
modal: true,
|
closeAction: 'hide',
|
||||||
plain: true,
|
bodyStyle: 'padding: 10px 5px;',
|
||||||
title: _('Add from File'),
|
iconCls: 'x-deluge-add-file'
|
||||||
iconCls: 'x-deluge-add-file'
|
|
||||||
}, config);
|
|
||||||
Deluge.add.FileWindow.superclass.constructor.call(this, config);
|
|
||||||
},
|
|
||||||
|
|
||||||
initComponent: function() {
|
initComponent: function() {
|
||||||
Deluge.add.FileWindow.superclass.initComponent.call(this);
|
Deluge.add.FileWindow.superclass.initComponent.call(this);
|
||||||
this.addButton(_('Add'), this.onAddClick, this);
|
this.addButton(_('Add'), this.onAddClick, this);
|
||||||
|
@ -72,6 +72,7 @@ Deluge.add.FileWindow = Ext.extend(Deluge.add.Window, {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// private
|
||||||
onAddClick: function(field, e) {
|
onAddClick: function(field, e) {
|
||||||
if (this.form.getForm().isValid()) {
|
if (this.form.getForm().isValid()) {
|
||||||
this.torrentId = this.createTorrentId();
|
this.torrentId = this.createTorrentId();
|
||||||
|
@ -88,21 +89,24 @@ Deluge.add.FileWindow = Ext.extend(Deluge.add.Window, {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// private
|
||||||
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', this.torrentId, info);
|
this.fireEvent('add', this.torrentId, info);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// private
|
||||||
onUploadFailure: function(form, action) {
|
onUploadFailure: function(form, action) {
|
||||||
this.hide();
|
this.hide();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// private
|
||||||
onUploadSuccess: function(fp, upload) {
|
onUploadSuccess: function(fp, upload) {
|
||||||
this.hide();
|
this.hide();
|
||||||
if (upload.result.success) {
|
if (upload.result.success) {
|
||||||
var filename = upload.result.files[0];
|
var filename = upload.result.files[0];
|
||||||
this.form.getForm().findField('torrentFile').setValue('');
|
this.form.getForm().findField('torrentFile').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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue