mirror of
https://github.com/codex-storage/deluge.git
synced 2025-02-20 15:18:20 +00:00
finish converting the AddWindow over to a ListView
This commit is contained in:
parent
09de50ec18
commit
c970a80030
@ -59,9 +59,7 @@ Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.list = this.add({
|
this.list = new Ext.list.ListView({
|
||||||
xtype: 'listview',
|
|
||||||
region: 'center',
|
|
||||||
store: new Ext.data.SimpleStore({
|
store: new Ext.data.SimpleStore({
|
||||||
fields: [
|
fields: [
|
||||||
{name: 'info_hash', mapping: 1},
|
{name: 'info_hash', mapping: 1},
|
||||||
@ -79,15 +77,19 @@ Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, {
|
|||||||
stripeRows: true,
|
stripeRows: true,
|
||||||
singleSelect: true,
|
singleSelect: true,
|
||||||
listeners: {
|
listeners: {
|
||||||
'selectionchanged': {
|
'selectionchange': {
|
||||||
fn: this.onSelect,
|
fn: this.onSelect,
|
||||||
scope: this
|
scope: this
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
hideHeaders: true,
|
hideHeaders: true,
|
||||||
autoExpandColumn: 'torrent',
|
autoExpandColumn: 'torrent',
|
||||||
deferredRender: false,
|
autoScroll: true
|
||||||
autoScroll: true,
|
});
|
||||||
|
|
||||||
|
this.add({
|
||||||
|
region: 'center',
|
||||||
|
items: [this.list],
|
||||||
margins: '5 5 5 5',
|
margins: '5 5 5 5',
|
||||||
bbar: new Ext.Toolbar({
|
bbar: new Ext.Toolbar({
|
||||||
items: [{
|
items: [{
|
||||||
@ -125,7 +127,7 @@ Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, {
|
|||||||
|
|
||||||
onAddClick: function() {
|
onAddClick: function() {
|
||||||
var torrents = [];
|
var torrents = [];
|
||||||
if (!this.grid) return;
|
if (!this.list) return;
|
||||||
this.list.getStore().each(function(r) {
|
this.list.getStore().each(function(r) {
|
||||||
var id = r.get('info_hash');
|
var id = r.get('info_hash');
|
||||||
torrents.push({
|
torrents.push({
|
||||||
@ -159,9 +161,8 @@ Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, {
|
|||||||
},
|
},
|
||||||
|
|
||||||
onRemove: function() {
|
onRemove: function() {
|
||||||
var selection = this.grid.getSelectionModel();
|
if (!this.list.getSelectionCount()) return;
|
||||||
if (!selection.hasSelection()) return;
|
var torrent = this.list.getSelectedRecords()[0];
|
||||||
var torrent = selection.getSelected();
|
|
||||||
this.list.getStore().remove(torrent);
|
this.list.getStore().remove(torrent);
|
||||||
this.optionsPanel.clear();
|
this.optionsPanel.clear();
|
||||||
|
|
||||||
@ -169,10 +170,15 @@ Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, {
|
|||||||
},
|
},
|
||||||
|
|
||||||
onSelect: function(list, selections) {
|
onSelect: function(list, selections) {
|
||||||
|
if (selections.length) {
|
||||||
this.optionsPanel.setTorrent(record.get('info_hash'));
|
var record = this.list.getRecord(selections[0]);
|
||||||
this.optionsPanel.files.setDisabled(false);
|
this.optionsPanel.setTorrent(record.get('info_hash'));
|
||||||
this.optionsPanel.form.setDisabled(false);
|
this.optionsPanel.files.setDisabled(false);
|
||||||
|
this.optionsPanel.form.setDisabled(false);
|
||||||
|
} else {
|
||||||
|
this.optionsPanel.files.setDisabled(true);
|
||||||
|
this.optionsPanel.form.setDisabled(true);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onShow: function() {
|
onShow: function() {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*!
|
/*!
|
||||||
* Deluge.add.Url.js
|
* Deluge.add.UrlWindow.js
|
||||||
*
|
*
|
||||||
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com>
|
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com>
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user