handle the logout button being pressed
This commit is contained in:
parent
2669ade501
commit
815d8aa39f
|
@ -17,6 +17,13 @@ Deluge.ToolBar = {
|
|||
|
||||
onLogin: function() {
|
||||
this.Bar.items.get('logout').enable();
|
||||
|
||||
},
|
||||
|
||||
onLogout: function() {
|
||||
this.Bar.items.get('logout').disable();
|
||||
Deluge.Events.fire('logout');
|
||||
Deluge.Login.Window.show();
|
||||
},
|
||||
|
||||
onTorrentAction: function(item) {
|
||||
|
@ -149,7 +156,8 @@ Deluge.ToolBar.Bar = new Ext.Toolbar({
|
|||
icon: '/icons/16/logout.png',
|
||||
disabled: true,
|
||||
text: _('Logout'),
|
||||
handler: Deluge.ToolBar.onLogout
|
||||
handler: Deluge.ToolBar.onLogout,
|
||||
scope: Deluge.ToolBar
|
||||
}
|
||||
],
|
||||
listeners: {'render': Deluge.ToolBar.onToolbarRender, scope: Deluge.ToolBar}
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
Deluge.Connections = {
|
||||
disconnect: function() {
|
||||
Deluge.Events.fire('disconnect');
|
||||
},
|
||||
|
||||
onClose: function(e) {
|
||||
$clear(Deluge.Connections.running);
|
||||
|
@ -15,7 +18,7 @@ Deluge.Connections = {
|
|||
Deluge.Client = new JSON.RPC('/json', {
|
||||
methods: methods
|
||||
});
|
||||
Deluge.Events.fire("connect");
|
||||
Deluge.Events.fire('connect');
|
||||
}
|
||||
});
|
||||
},
|
||||
|
@ -33,6 +36,10 @@ Deluge.Connections = {
|
|||
onShow: function(window) {
|
||||
Deluge.Connections.running = Deluge.Connections.runCheck.periodical(2000);
|
||||
Deluge.Connections.runCheck();
|
||||
Deluge.Events.on('logout', function(e) {
|
||||
Deluge.Connections.disconnect();
|
||||
Deluge.Connections.Window.hide();
|
||||
});
|
||||
},
|
||||
|
||||
runCheck: function() {
|
||||
|
@ -60,9 +67,9 @@ Deluge.Connections.Grid = new Ext.grid.GridPanel({
|
|||
store: Deluge.Connections.Store,
|
||||
cls: 'deluge-torrents',
|
||||
columns: [
|
||||
{header: "Status", width: 55, sortable: true, renderer: Deluge.Formatters.plain, dataIndex: 'status'},
|
||||
{id:'host', header: "Host", width: 150, sortable: true, renderer: renderHost, dataIndex: 'host'},
|
||||
{header: "Version", width: 75, sortable: true, renderer: Deluge.Formatters.plain, dataIndex: 'version'}
|
||||
{header: 'Status', width: 55, sortable: true, renderer: Deluge.Formatters.plain, dataIndex: 'status'},
|
||||
{id:'host', header: 'Host', width: 150, sortable: true, renderer: renderHost, dataIndex: 'host'},
|
||||
{header: 'Version', width: 75, sortable: true, renderer: Deluge.Formatters.plain, dataIndex: 'version'}
|
||||
],
|
||||
stripeRows: true,
|
||||
selModel: new Ext.grid.RowSelectionModel({
|
||||
|
|
|
@ -6,6 +6,7 @@ Deluge.Login = {
|
|||
if (result == true) {
|
||||
Deluge.Login.Window.hide();
|
||||
Deluge.Connections.Window.show();
|
||||
passwordField.setRawValue('');
|
||||
Deluge.Events.fire('login')
|
||||
} else {
|
||||
Ext.MessageBox.show({
|
||||
|
@ -20,8 +21,16 @@ Deluge.Login = {
|
|||
});
|
||||
},
|
||||
|
||||
onLogout: function() {
|
||||
Deluge.Login.Window.show();
|
||||
},
|
||||
|
||||
onKey: function(field, e) {
|
||||
if (e.getKey() == 13) Deluge.Login.onLogin();
|
||||
},
|
||||
|
||||
onRender: function() {
|
||||
Deluge.Events.on('logout', this.onLogout);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -60,5 +69,6 @@ Deluge.Login.Window = new Ext.Window({
|
|||
buttons: [{
|
||||
text: _('Login'),
|
||||
handler: Deluge.Login.onLogin
|
||||
}]
|
||||
}],
|
||||
listeners: {'render': {fn: Deluge.Login.onRender, scope: Deluge.Login}}
|
||||
});
|
|
@ -18,6 +18,7 @@ Deluge.Ui = {
|
|||
|
||||
Deluge.Login.Window.show();
|
||||
Deluge.Events.on("connect", this.onConnect.bindWithEvent(this));
|
||||
Deluge.Events.on("disconnect", this.onDisconnect.bindWithEvent(this));
|
||||
Deluge.Client = new JSON.RPC('/json');
|
||||
|
||||
Deluge.SideBar = this.MainPanel.items.get('sidebar');
|
||||
|
@ -155,6 +156,10 @@ Deluge.Ui = {
|
|||
}
|
||||
},
|
||||
|
||||
onDisconnect: function() {
|
||||
this.stop();
|
||||
},
|
||||
|
||||
/*
|
||||
Property: stop
|
||||
Stop the Deluge UI polling the server to get the updated torrent
|
||||
|
|
Loading…
Reference in New Issue