js: Add caps-lock Warning to the dialogs

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/619
This commit is contained in:
Umang Jain
2019-12-13 17:06:14 +05:30
parent 10da0e9d8f
commit b4f1fc2305
6 changed files with 37 additions and 2 deletions

View File

@@ -126,6 +126,13 @@ class KeyringDialog extends ModalDialog.ModalDialog {
this.prompt.set_password_actor(this._passwordEntry ? this._passwordEntry.clutter_text : null);
this.prompt.set_confirm_actor(this._confirmEntry ? this._confirmEntry.clutter_text : null);
if (this._passwordEntry || this._confirmEntry) {
let entry = this._passwordEntry ? this._passwordEntry : this._confirmEntry;
this._capsLockWarningLabel = new ShellEntry.CapsLockWarning(entry);
layout.attach(this._capsLockWarningLabel, 1, row, 1, 1);
row++;
}
if (this.prompt.choice_visible) {
let choice = new CheckBox.CheckBox();
this.prompt.bind_property('choice-label', choice.getLabelActor(), 'text', GObject.BindingFlags.SYNC_CREATE);

View File

@@ -44,6 +44,7 @@ class NetworkSecretDialog extends ModalDialog.ModalDialog {
let rtl = secretTable.get_text_direction() == Clutter.TextDirection.RTL;
let initialFocusSet = false;
let pos = 0;
let lastPasswordEntry = 0;
for (let i = 0; i < this._content.secrets.length; i++) {
let secret = this._content.secrets[i];
let label = new St.Label({ style_class: 'prompt-dialog-password-label',
@@ -61,10 +62,12 @@ class NetworkSecretDialog extends ModalDialog.ModalDialog {
reactive,
x_expand: true,
};
if (secret.password)
if (secret.password) {
secret.entry = new St.PasswordEntry(entryParams);
else
lastPasswordEntry = i;
} else {
secret.entry = new St.Entry(entryParams);
}
ShellEntry.addContextMenu(secret.entry);
if (secret.validate)
@@ -100,6 +103,14 @@ class NetworkSecretDialog extends ModalDialog.ModalDialog {
}
pos++;
}
// Bind the caps-lock warning to the last password-entry and pack below it.
if (this._content.secrets[lastPasswordEntry].password) {
this._capsLockWarningLabel = new ShellEntry.CapsLockWarning(this._content.secrets[lastPasswordEntry].entry);
if (rtl)
layout.attach(this._capsLockWarningLabel, 0, ++pos, 1, 1);
else
layout.attach(this._capsLockWarningLabel, 1, ++pos, 1, 1);
}
contentBox.messageBox.add(secretTable);

View File

@@ -109,6 +109,10 @@ var AuthenticationDialog = GObject.registerClass({
this._passwordBox.add(this._workSpinner);
this._passwordBox.hide();
this._capsLockWarningLabel = new ShellEntry.CapsLockWarning(this._passwordEntry, {
style_class: 'prompt-dialog-caps-lock-warning',
});
content.messageBox.add(this._capsLockWarningLabel);
this._errorMessageLabel = new St.Label({ style_class: 'prompt-dialog-error-label' });
this._errorMessageLabel.clutter_text.ellipsize = Pango.EllipsizeMode.NONE;