summaryrefslogtreecommitdiffstats
path: root/deluge/ui/web/js/deluge-all/LoginWindow.js
diff options
context:
space:
mode:
Diffstat (limited to 'deluge/ui/web/js/deluge-all/LoginWindow.js')
-rw-r--r--deluge/ui/web/js/deluge-all/LoginWindow.js46
1 files changed, 24 insertions, 22 deletions
diff --git a/deluge/ui/web/js/deluge-all/LoginWindow.js b/deluge/ui/web/js/deluge-all/LoginWindow.js
index 37b18a184..0a08a6d39 100644
--- a/deluge/ui/web/js/deluge-all/LoginWindow.js
+++ b/deluge/ui/web/js/deluge-all/LoginWindow.js
@@ -1,7 +1,7 @@
/*!
* Deluge.LoginWindow.js
- *
- * Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com>
+ *
+ * Copyright (c) Damien Churchill 2009-2011 <damoxc@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -30,8 +30,10 @@
* statement from all source files in the program, then also delete it here.
*/
-Deluge.LoginWindow = Ext.extend(Ext.Window, {
-
+Ext.define('Deluge.LoginWindow', {
+
+ extend: 'Ext.Window',
+
firstShow: true,
bodyStyle: 'padding: 10px 5px;',
buttonAlign: 'center',
@@ -45,17 +47,17 @@ Deluge.LoginWindow = Ext.extend(Ext.Window, {
title: _('Login'),
width: 300,
height: 120,
-
+
initComponent: function() {
- Deluge.LoginWindow.superclass.initComponent.call(this);
+ this.callParent(arguments);
this.on('show', this.onShow, this);
-
- this.addButton({
- text: _('Login'),
- handler: this.onLogin,
- scope: this
- });
-
+
+// this.addButton({
+// text: _('Login'),
+// handler: this.onLogin,
+// scope: this
+// });
+
this.form = this.add({
xtype: 'form',
baseCls: 'x-plain',
@@ -74,7 +76,7 @@ Deluge.LoginWindow = Ext.extend(Ext.Window, {
});
this.passwordField.on('specialkey', this.onSpecialKey, this);
},
-
+
logout: function() {
deluge.events.fire('logout');
deluge.client.auth.delete_session({
@@ -84,17 +86,17 @@ Deluge.LoginWindow = Ext.extend(Ext.Window, {
scope: this
});
},
-
+
show: function(skipCheck) {
if (this.firstShow) {
deluge.client.on('error', this.onClientError, this);
this.firstShow = false;
}
-
+
if (skipCheck) {
- return Deluge.LoginWindow.superclass.show.call(this);
+ return this.callParent(arguments);
}
-
+
deluge.client.auth.check_session({
success: function(result) {
if (result) {
@@ -109,11 +111,11 @@ Deluge.LoginWindow = Ext.extend(Ext.Window, {
scope: this
});
},
-
+
onSpecialKey: function(field, e) {
if (e.getKey() == 13) this.onLogin();
},
-
+
onLogin: function() {
var passwordField = this.passwordField;
deluge.client.auth.login(passwordField.getValue(), {
@@ -139,14 +141,14 @@ Deluge.LoginWindow = Ext.extend(Ext.Window, {
scope: this
});
},
-
+
onClientError: function(errorObj, response, requestOptions) {
if (errorObj.error.code == 1) {
deluge.events.fire('logout');
this.show(true);
}
},
-
+
onShow: function() {
this.passwordField.focus(true, true);
}