add login event and enable the logout button once logged in

This commit is contained in:
Damien Churchill 2009-02-19 19:22:51 +00:00
parent 5153ad6f78
commit 2669ade501
2 changed files with 11 additions and 9 deletions

View File

@ -15,8 +15,8 @@ Deluge.ToolBar = {
}, this); }, this);
}, },
onLogout: function() { onLogin: function() {
this.Bar.items.get('logout').enable();
}, },
onTorrentAction: function(item) { onTorrentAction: function(item) {
@ -27,49 +27,50 @@ Deluge.ToolBar = {
}); });
switch (item.id) { switch (item.id) {
case "remove": case 'remove':
Deluge.Client.core.remove_torrent(ids, null, { Deluge.Client.core.remove_torrent(ids, null, {
onSuccess: function() { onSuccess: function() {
Deluge.Ui.update(); Deluge.Ui.update();
} }
}); });
break; break;
case "pause": case 'pause':
Deluge.Client.core.pause_torrent(ids, { Deluge.Client.core.pause_torrent(ids, {
onSuccess: function() { onSuccess: function() {
Deluge.Ui.update(); Deluge.Ui.update();
} }
}); });
break; break;
case "resume": case 'resume':
Deluge.Client.core.resume_torrent(ids, { Deluge.Client.core.resume_torrent(ids, {
onSuccess: function() { onSuccess: function() {
Deluge.Ui.update(); Deluge.Ui.update();
} }
}); });
break; break;
case "up": case 'up':
Deluge.Client.core.queue_up(ids, { Deluge.Client.core.queue_up(ids, {
onSuccess: function() { onSuccess: function() {
Deluge.Ui.update(); Deluge.Ui.update();
} }
}); });
break; break;
case "down": case 'down':
Deluge.Client.core.queue_down(ids, { Deluge.Client.core.queue_down(ids, {
onSuccess: function() { onSuccess: function() {
Deluge.Ui.update(); Deluge.Ui.update();
} }
}); });
break; break;
case "connectionman": case 'connectionman':
Deluge.Connections.Window.show(); Deluge.Connections.Window.show();
break; break;
} }
}, },
onToolbarRender: function(toolbar) { onToolbarRender: function(toolbar) {
Deluge.Events.on("connect", this.onConnect.bindWithEvent(this)); Deluge.Events.on('connect', this.onConnect.bindWithEvent(this));
Deluge.Events.on('login', this.onLogin.bindWithEvent(this));
} }
} }

View File

@ -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();
Deluge.Events.fire('login')
} else { } else {
Ext.MessageBox.show({ Ext.MessageBox.show({
title: _('Login Failed'), title: _('Login Failed'),