no need to have this wrapped in an inline function

add a solitary doc string
This commit is contained in:
Damien Churchill 2010-01-26 17:35:18 +00:00
parent 4afcae325a
commit 57a9e925a7

View File

@ -32,172 +32,175 @@ Copyright:
*/ */
(function() { /**
Ext.deluge.Toolbar = Ext.extend(Ext.Toolbar, { * An extension of the <tt>Ext.Toolbar</tt> class that provides an extensible toolbar for Deluge.
constructor: function(config) { * @class Ext.deluge.Toolbar
config = Ext.apply({ * @extends Ext.Toolbar
items: [ */
{ Ext.deluge.Toolbar = Ext.extend(Ext.Toolbar, {
id: 'create', constructor: function(config) {
cls: 'x-btn-text-icon', config = Ext.apply({
disabled: true, items: [
text: _('Create'), {
icon: '/icons/create.png', id: 'create',
handler: this.onTorrentAction cls: 'x-btn-text-icon',
},{ disabled: true,
id: 'add', text: _('Create'),
cls: 'x-btn-text-icon', icon: '/icons/create.png',
disabled: true, handler: this.onTorrentAction
text: _('Add'), },{
icon: '/icons/add.png', id: 'add',
handler: this.onTorrentAdd cls: 'x-btn-text-icon',
},{ disabled: true,
id: 'remove', text: _('Add'),
cls: 'x-btn-text-icon', icon: '/icons/add.png',
disabled: true, handler: this.onTorrentAdd
text: _('Remove'), },{
icon: '/icons/remove.png', id: 'remove',
handler: this.onTorrentAction cls: 'x-btn-text-icon',
},'|',{ disabled: true,
id: 'pause', text: _('Remove'),
cls: 'x-btn-text-icon', icon: '/icons/remove.png',
disabled: true, handler: this.onTorrentAction
text: _('Pause'), },'|',{
icon: '/icons/pause.png', id: 'pause',
handler: this.onTorrentAction cls: 'x-btn-text-icon',
},{ disabled: true,
id: 'resume', text: _('Pause'),
cls: 'x-btn-text-icon', icon: '/icons/pause.png',
disabled: true, handler: this.onTorrentAction
text: _('Resume'), },{
icon: '/icons/start.png', id: 'resume',
handler: this.onTorrentAction cls: 'x-btn-text-icon',
},'|',{ disabled: true,
id: 'up', text: _('Resume'),
cls: 'x-btn-text-icon', icon: '/icons/start.png',
disabled: true, handler: this.onTorrentAction
text: _('Up'), },'|',{
icon: '/icons/up.png', id: 'up',
handler: this.onTorrentAction cls: 'x-btn-text-icon',
},{ disabled: true,
id: 'down', text: _('Up'),
cls: 'x-btn-text-icon', icon: '/icons/up.png',
disabled: true, handler: this.onTorrentAction
text: _('Down'), },{
icon: '/icons/down.png', id: 'down',
handler: this.onTorrentAction cls: 'x-btn-text-icon',
},'|',{ disabled: true,
id: 'preferences', text: _('Down'),
cls: 'x-btn-text-icon', icon: '/icons/down.png',
text: _('Preferences'), handler: this.onTorrentAction
iconCls: 'x-deluge-preferences', },'|',{
handler: this.onPreferencesClick, id: 'preferences',
scope: this cls: 'x-btn-text-icon',
},{ text: _('Preferences'),
id: 'connectionman', iconCls: 'x-deluge-preferences',
cls: 'x-btn-text-icon', handler: this.onPreferencesClick,
text: _('Connection Manager'), scope: this
iconCls: 'x-deluge-connection-manager', },{
handler: this.onConnectionManagerClick, id: 'connectionman',
scope: this cls: 'x-btn-text-icon',
},'->',{ text: _('Connection Manager'),
id: 'help', iconCls: 'x-deluge-connection-manager',
cls: 'x-btn-text-icon', handler: this.onConnectionManagerClick,
icon: '/icons/help.png', scope: this
text: _('Help'), },'->',{
handler: this.onHelpClick, id: 'help',
scope: this cls: 'x-btn-text-icon',
},{ icon: '/icons/help.png',
id: 'logout', text: _('Help'),
cls: 'x-btn-text-icon', handler: this.onHelpClick,
icon: '/icons/logout.png', scope: this
disabled: true, },{
text: _('Logout'), id: 'logout',
handler: this.onLogout, cls: 'x-btn-text-icon',
scope: this icon: '/icons/logout.png',
} disabled: true,
] text: _('Logout'),
}, config); handler: this.onLogout,
Ext.deluge.Toolbar.superclass.constructor.call(this, config); scope: this
}, }
]
}, config);
Ext.deluge.Toolbar.superclass.constructor.call(this, config);
},
connectedButtons: [ connectedButtons: [
'add', 'remove', 'pause', 'resume', 'up', 'down' 'add', 'remove', 'pause', 'resume', 'up', 'down'
], ],
initComponent: function() {
Ext.deluge.Toolbar.superclass.initComponent.call(this);
Deluge.Events.on('connect', this.onConnect, this);
Deluge.Events.on('login', this.onLogin, this);
},
onConnect: function() {
Ext.each(this.connectedButtons, function(buttonId) {
this.items.get(buttonId).enable();
}, this);
},
onDisconnect: function() {
Ext.each(this.connectedButtons, function(buttonId) {
this.items.get(buttonId).disable();
}, this);
},
onLogin: function() {
this.items.get('logout').enable();
},
onLogout: function() {
this.items.get('logout').disable();
Deluge.Login.logout();
},
onConnectionManagerClick: function() {
Deluge.ConnectionManager.show();
},
onHelpClick: function() {
window.open('http://dev.deluge-torrent.org/wiki/UserGuide');
},
onPreferencesClick: function() {
Deluge.Preferences.show();
},
onTorrentAction: function(item) {
var selection = Deluge.Torrents.getSelections();
var ids = [];
Ext.each(selection, function(record) {
ids.push(record.id);
});
switch (item.id) {
case 'remove':
Deluge.RemoveWindow.show(ids);
break;
case 'pause':
case 'resume':
Deluge.Client.core[item.id + '_torrent'](ids, {
success: function() {
Deluge.UI.update();
}
});
break;
case 'up':
case 'down':
Deluge.Client.core['queue_' + item.id](ids, {
success: function() {
Deluge.UI.update();
}
});
break;
}
},
onTorrentAdd: function() {
Deluge.Add.show();
}
});
Deluge.Toolbar = new Ext.deluge.Toolbar(); initComponent: function() {
})(); Ext.deluge.Toolbar.superclass.initComponent.call(this);
Deluge.Events.on('connect', this.onConnect, this);
Deluge.Events.on('login', this.onLogin, this);
},
onConnect: function() {
Ext.each(this.connectedButtons, function(buttonId) {
this.items.get(buttonId).enable();
}, this);
},
onDisconnect: function() {
Ext.each(this.connectedButtons, function(buttonId) {
this.items.get(buttonId).disable();
}, this);
},
onLogin: function() {
this.items.get('logout').enable();
},
onLogout: function() {
this.items.get('logout').disable();
Deluge.Login.logout();
},
onConnectionManagerClick: function() {
Deluge.ConnectionManager.show();
},
onHelpClick: function() {
window.open('http://dev.deluge-torrent.org/wiki/UserGuide');
},
onPreferencesClick: function() {
Deluge.Preferences.show();
},
onTorrentAction: function(item) {
var selection = Deluge.Torrents.getSelections();
var ids = [];
Ext.each(selection, function(record) {
ids.push(record.id);
});
switch (item.id) {
case 'remove':
Deluge.RemoveWindow.show(ids);
break;
case 'pause':
case 'resume':
Deluge.Client.core[item.id + '_torrent'](ids, {
success: function() {
Deluge.UI.update();
}
});
break;
case 'up':
case 'down':
Deluge.Client.core['queue_' + item.id](ids, {
success: function() {
Deluge.UI.update();
}
});
break;
}
},
onTorrentAdd: function() {
Deluge.Add.show();
}
});
Deluge.Toolbar = new Ext.deluge.Toolbar();