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