[gnome-maps/wip/osm-edit: 16/16] osmEdit: Let the password and verification code entries handle enter
- From: Marcus Lundblad <mlundblad src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps/wip/osm-edit: 16/16] osmEdit: Let the password and verification code entries handle enter
- Date: Mon, 7 Dec 2015 21:47:39 +0000 (UTC)
commit c1f93d219a6495050d12f3512672ee09f26668b9
Author: Marcus Lundblad <ml update uu se>
Date: Mon Dec 7 21:39:51 2015 +0100
osmEdit: Let the password and verification code entries handle enter
If the user presses enter in the password entry and the verification code
entry when setting up an accound, automatically proceed with the actions
if needed data has been supplied.
https://bugzilla.gnome.org/show_bug.cgi?id=726628
src/osmAccountDialog.js | 29 +++++++++++++++++++++++++++++
1 files changed, 29 insertions(+), 0 deletions(-)
---
diff --git a/src/osmAccountDialog.js b/src/osmAccountDialog.js
index b1a323d..5c93452 100644
--- a/src/osmAccountDialog.js
+++ b/src/osmAccountDialog.js
@@ -63,12 +63,16 @@ const OSMAccountDialog = new Lang.Class({
this._onCredentialsChanged.bind(this));
this._passwordEntry.connect('changed',
this._onCredentialsChanged.bind(this));
+ this._passwordEntry.connect('activate',
+ this._onPasswordActivated.bind(this));
this._signInButton.connect('clicked',
this._onSignInButtonClicked.bind(this));
this._verifyButton.connect('clicked',
this._onVerifyButtonClicked.bind(this));
this._verificationEntry.connect('changed',
this._onVerificationEntryChanged.bind(this));
+ this._verificationEntry.connect('activate',
+ this._onVerificationEntryActivated.bind(this));
this._signOutButton.connect('clicked',
this._onSignOutButtonClicked.bind(this));
@@ -90,6 +94,19 @@ const OSMAccountDialog = new Lang.Class({
},
_onSignInButtonClicked: function() {
+ this._performSignIn();
+ },
+
+ _onPasswordActivated: function() {
+ /* if username and password was entered, proceed with sign-in */
+ let email = this._emailEntry.text;
+ let password = this._passwordEntry.text;
+
+ if (email && email.length > 0 && password && password.length > 0)
+ this._performSignIn();
+ },
+
+ _performSignIn: function() {
/* turn on signing in spinner and desensisize credential entries */
this._signInSpinner.visible = true;
this._signInButton.sensitive = false;
@@ -123,6 +140,10 @@ const OSMAccountDialog = new Lang.Class({
},
_onVerifyButtonClicked: function() {
+ this._performVerification();
+ },
+
+ _performVerification: function() {
/* allow copying the leading space between the "The verification is"
label and the code */
let verificationCode = this._verificationEntry.text.trim();
@@ -145,6 +166,14 @@ const OSMAccountDialog = new Lang.Class({
this._verificationEntry.text.length > 0;
},
+ _onVerificationEntryActivated: function() {
+ /* proceed with verfication if a code has been entered */
+ let verificationCode = this._verificationEntry.text;
+
+ if (verificationCode && verificationCode.length > 0)
+ this._performVerification();
+ },
+
_onOAuthAccessTokenRequested: function(success) {
if (success) {
/* update the username label */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]