Fix #2035: If auto_add_trackers is empty, it is an array

This commit is contained in:
Bobby R. Ward 2012-02-22 01:52:50 -06:00 committed by Calum Lind
parent eceaa0ae4f
commit 2b01ba43cb

View File

@ -1,6 +1,6 @@
/*! /*!
* label.js * label.js
* *
* Copyright (c) Damien Churchill 2010 <damoxc@gmail.com> * Copyright (c) Damien Churchill 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
@ -36,7 +36,7 @@ Ext.ns('Deluge.ux');
* @extends Ext.Window * @extends Ext.Window
*/ */
Deluge.ux.AddLabelWindow = Ext.extend(Ext.Window, { Deluge.ux.AddLabelWindow = Ext.extend(Ext.Window, {
title: _('Add Label'), title: _('Add Label'),
width: 300, width: 300,
height: 100, height: 100,
@ -107,7 +107,7 @@ Deluge.ux.LabelOptionsWindow = Ext.extend(Ext.Window, {
title: _('Label Options'), title: _('Label Options'),
width: 325, width: 325,
height: 240, height: 240,
initComponent: function() { initComponent: function() {
Deluge.ux.LabelOptionsWindow.superclass.initComponent.call(this); Deluge.ux.LabelOptionsWindow.superclass.initComponent.call(this);
this.addButton(_('Cancel'), this.onCancelClick, this); this.addButton(_('Cancel'), this.onCancelClick, this);
@ -319,7 +319,7 @@ Deluge.ux.LabelOptionsWindow = Ext.extend(Ext.Window, {
show: function(label) { show: function(label) {
Deluge.ux.LabelOptionsWindow.superclass.show.call(this); Deluge.ux.LabelOptionsWindow.superclass.show.call(this);
this.label = label; this.label = label;
this.setTitle(_('Label Options') + ': ' + this.label); this.setTitle(_('Label Options') + ': ' + this.label);
this.tabs.setActiveTab(0); this.tabs.setActiveTab(0);
this.getLabelOptions(); this.getLabelOptions();
}, },
@ -330,7 +330,9 @@ Deluge.ux.LabelOptionsWindow = Ext.extend(Ext.Window, {
onOkClick: function() { onOkClick: function() {
var values = this.form.getForm().getFieldValues(); var values = this.form.getForm().getFieldValues();
values['auto_add_trackers'] = values['auto_add_trackers'].split('\n'); if (values['auto_add_trackers']) {
values['auto_add_trackers'] = values['auto_add_trackers'].split('\n');
}
deluge.client.label.set_options(this.label, values); deluge.client.label.set_options(this.label, values);
this.hide(); this.hide();
}, },
@ -395,7 +397,7 @@ Deluge.plugins.LabelPlugin = Ext.extend(Deluge.Plugin, {
}); });
} }
}, },
onDisable: function() { onDisable: function() {
deluge.sidebar.un('filtercreate', this.onFilterCreate); deluge.sidebar.un('filtercreate', this.onFilterCreate);
deluge.sidebar.un('afterfiltercreate', this.onAfterFilterCreate); deluge.sidebar.un('afterfiltercreate', this.onAfterFilterCreate);
@ -404,7 +406,7 @@ Deluge.plugins.LabelPlugin = Ext.extend(Deluge.Plugin, {
deluge.menus.torrent.remove(this.tmSep); deluge.menus.torrent.remove(this.tmSep);
deluge.menus.torrent.remove(this.tm); deluge.menus.torrent.remove(this.tm);
}, },
onEnable: function() { onEnable: function() {
this.torrentMenu = new Ext.menu.Menu({ this.torrentMenu = new Ext.menu.Menu({
items: [{ items: [{