added clipboard + help

This commit is contained in:
Lurkars 2021-03-20 12:38:14 +01:00
parent 396b7786eb
commit 2ff430f58f
2 changed files with 11 additions and 2 deletions

View File

@ -166,4 +166,11 @@ export class RegisterDialog {
this.downloaded = true; this.downloaded = true;
} }
copyKey(inputElement) {
inputElement.select();
document.execCommand('copy');
inputElement.setSelectionRange(0, 0);
this.downloaded = true;
}
} }

View File

@ -8,21 +8,23 @@
<mat-form-field> <mat-form-field>
<qrcode [qrdata]="data.privateKey" [width]="400" [errorCorrectionLevel]="'M'"></qrcode> <qrcode [qrdata]="data.privateKey" [width]="400" [errorCorrectionLevel]="'M'"></qrcode>
<mat-label>{{'pgp.privateKey' | i18n}}</mat-label> <mat-label>{{'pgp.privateKey' | i18n}}</mat-label>
<textarea matInput readonly [(ngModel)]="data.privateKey"></textarea> <textarea matInput readonly [(ngModel)]="data.privateKey" #privkey></textarea>
</mat-form-field> </mat-form-field>
</mat-dialog-content> </mat-dialog-content>
<mat-dialog-actions> <mat-dialog-actions>
<a mat-raised-button color="primary" #downloadKey (click)="setDownloaded()">{{'pgp.privateKey.downloadKey' | <a mat-raised-button color="primary" #downloadKey (click)="setDownloaded()">{{'pgp.privateKey.downloadKey' |
i18n}}</a> i18n}}</a>
<a mat-raised-button (click)="copyKey(privkey)">{{'pgp.privateKey.copyKey' |
i18n}}</a>
<button mat-icon-button [matTooltip]="'pgp.privateKey.help' | i18n" matTooltipPosition="after"> <button mat-icon-button [matTooltip]="'pgp.privateKey.help' | i18n" matTooltipPosition="after">
<mat-icon>help</mat-icon> <mat-icon>help</mat-icon>
</button> </button>
</mat-dialog-actions> </mat-dialog-actions>
<br /> <br />
<mat-dialog-actions> <mat-dialog-actions>
<a mat-icon-button (click)="downloaded=true" [matTooltip]="'pgp.privateKey.downloaded' | i18n"><mat-icon>announcement</mat-icon></a>
<mat-slide-toggle [(ngModel)]="data.confirmClose" [disabled]="!downloaded"> <mat-slide-toggle [(ngModel)]="data.confirmClose" [disabled]="!downloaded">
{{'pgp.privateKey.confirmStore' | i18n}} {{'pgp.privateKey.confirmStore' | i18n}}
</mat-slide-toggle> </mat-slide-toggle>
<button mat-button [disabled]="!data.confirmClose" [mat-dialog-close]="true">{{'ok' | i18n}}</button> <button mat-button [disabled]="!data.confirmClose" [mat-dialog-close]="true">{{'ok' | i18n}}</button>
</mat-dialog-actions> </mat-dialog-actions>