Commit 83cd443a authored by segfault3's avatar segfault3

automountManager: Show error message if PIM not supported

parent b907db9b
......@@ -201,6 +201,15 @@ var AutomountManager = new Lang.Class({
if (e.message.indexOf('No key available with this passphrase') != -1 ||
e.message.indexOf('Failed to load device\'s parameters: Operation not permitted') != -1) {
this._reaskPassword(volume);
} else if (e.message.indexOf('Compiled against a version of libcryptsetup that does not support the VeraCrypt PIM setting') != -1) {
let existingDialog = volume._operation ? volume._operation.borrowDialog() : null;
if (existingDialog) {
existingDialog._pimEntry.text = "";
existingDialog._pimEntry.can_focus = false;
existingDialog._pimEntry.reactive = false;
existingDialog._pimEntry.clutter_text.editable = false;
}
this._reaskPassword(volume, { errorMessage: _("The installed udisks version does not support the PIM setting") });
} else {
if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.FAILED_HANDLED))
log('Unable to mount volume ' + volume.get_name() + ': ' + e.toString());
......@@ -215,11 +224,13 @@ var AutomountManager = new Lang.Class({
this._volumeQueue.filter(element => (element != volume));
},
_reaskPassword(volume) {
_reaskPassword(volume, params) {
params = Params.parse(params, { errorMessage: null });
let existingDialog = volume._operation ? volume._operation.borrowDialog() : null;
let operation =
new ShellMountOperation.ShellMountOperation(volume,
{ existingDialog: existingDialog });
{ existingDialog: existingDialog,
errorMessage: errorMessage });
this._mountVolume(volume, operation);
},
......
......@@ -108,12 +108,14 @@ var ShellMountOperation = new Lang.Class({
Name: 'ShellMountOperation',
_init(source, params) {
params = Params.parse(params, { existingDialog: null });
params = Params.parse(params, { existingDialog: null,
errorMessage: null });
this._dialog = null;
this._dialogId = 0;
this._existingDialog = params.existingDialog;
this._processesDialog = null;
this._errorMessage = params.errorMessage;
this.mountOp = new Shell.MountOperation();
......@@ -158,7 +160,7 @@ var ShellMountOperation = new Lang.Class({
_onAskPassword(op, message, defaultUser, defaultDomain, flags) {
if (this._existingDialog) {
this._dialog = this._existingDialog;
this._dialog.reaskPassword();
this._dialog.reaskPassword({ errorMessage: this._errorMessage });
} else {
this._dialog = new ShellMountPasswordDialog(message, this._gicon, flags);
}
......@@ -339,8 +341,7 @@ var ShellMountPasswordDialog = new Lang.Class({
this._setWorking(false);
this._passwordBox.add(this._workSpinner.actor);
this._errorMessageLabel = new St.Label({ style_class: 'prompt-dialog-error-label',
text: _("Sorry, that didn’t work. Please try again.") });
this._errorMessageLabel = new St.Label({ style_class: 'prompt-dialog-error-label' });
this._errorMessageLabel.clutter_text.ellipsize = Pango.EllipsizeMode.NONE;
this._errorMessageLabel.clutter_text.line_wrap = true;
this._errorMessageLabel.hide();
......@@ -445,8 +446,10 @@ var ShellMountPasswordDialog = new Lang.Class({
}
},
reaskPassword() {
reaskPassword(params) {
params = Params.parse(params, { errorMessage: _("Sorry, that didn’t work. Please try again.") });
this._passwordEntry.set_text('');
this._errorMessageLabel.text = errorMessage;
this._errorMessageLabel.show();
this._setWorking(false);
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment