feat(apk): Settings -> Copy and search, deux cases pour le retour apres copie et le clavier sur la recherche
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -162,6 +162,9 @@
|
||||
.btn.wide { padding: 13px 18px; font-size: 15px; }
|
||||
.btn.main { background: var(--accent); }
|
||||
.btn:disabled { opacity: .45; }
|
||||
.opt { display: flex; gap: 12px; align-items: center; margin: 10px 4px;
|
||||
font-size: 15px; }
|
||||
.opt input { width: 22px; height: 22px; accent-color: #22d3ee; flex: none; }
|
||||
.field-in:disabled { opacity: .5; }
|
||||
/* Rouge sourd : assez pour qu'on ne le confonde pas avec Copy, pas assez
|
||||
pour attirer l'oeil sur la seule action irreversible de l'ecran. */
|
||||
@@ -626,6 +629,14 @@
|
||||
|
||||
<!-- LE TITRE SUIT SON BOUTON : sans lui, une release affichait
|
||||
"Diagnostics" au-dessus de rien. -->
|
||||
<h2>Copy and search</h2>
|
||||
<label class="opt"><input type="checkbox" id="sBack">
|
||||
Go back to the previous app after copying</label>
|
||||
<label class="opt"><input type="checkbox" id="sKbd">
|
||||
Open the keyboard on the search when the vault opens</label>
|
||||
<div class="note">Copy, and you are back in the browser or app you came
|
||||
from, ready to paste. Come back and the search is ready to type.</div>
|
||||
|
||||
<h2 id="sDiagH">Diagnostics</h2>
|
||||
<button class="btn wide" id="sLog">Show the log</button>
|
||||
<!-- LE JOURNAL EST ICI, PAS SUR L'ACCUEIL. Il y vivait, et depuis que les
|
||||
@@ -1752,6 +1763,13 @@ function normalizeRepoUrl(u) {
|
||||
if (!m) return u;
|
||||
return m[1] + '/api/v1/repos/' + m[2] + '/' + m[3] + '/contents/' + (m[4] || 'vault-sync.json');
|
||||
}
|
||||
// Pas de Save pour ces deux-la : une case se voit cochee, elle s'applique.
|
||||
['sBack', 'sKbd'].forEach(function (id) {
|
||||
document.getElementById(id).addEventListener('change', function () {
|
||||
send('uipref?back=' + (document.getElementById('sBack').checked ? '1' : '0')
|
||||
+ '&kbd=' + (document.getElementById('sKbd').checked ? '1' : '0'));
|
||||
});
|
||||
});
|
||||
document.getElementById('sScan').addEventListener('click', function () {
|
||||
send('scanqr');
|
||||
});
|
||||
@@ -1877,6 +1895,12 @@ document.getElementById('back').addEventListener('click', goList);
|
||||
|
||||
// --- appele par Delphi -----------------------------------------------------
|
||||
var PM = {
|
||||
/// Reglages d'usage, relus au demarrage (Delphi en garde le fichier).
|
||||
setUiPrefs: function (back, kbd) {
|
||||
document.getElementById('sBack').checked = back;
|
||||
document.getElementById('sKbd').checked = kbd;
|
||||
},
|
||||
|
||||
/// Recherche prete a taper : focus, texte precedent selectionne (la frappe le
|
||||
/// remplace), puis Delphi deplie le clavier - un focus() seul ne le fait pas.
|
||||
focusSearch: function () {
|
||||
|
||||
+58
-3
@@ -154,6 +154,12 @@ type
|
||||
FPwdUserSet: Boolean;
|
||||
// Synchro a reprendre une fois le nouveau mot de passe verifie.
|
||||
FSyncAfterVerify: Boolean;
|
||||
// Reglages d'usage (Settings -> Copy and search), vrais par defaut. Rien de
|
||||
// secret : un petit fichier en clair dans le dossier prive de l'app.
|
||||
FUiBackAfterCopy, FUiKbdOnSearch: Boolean;
|
||||
procedure LoadUiPrefs;
|
||||
procedure SaveUiPrefs;
|
||||
procedure PushUiPrefs;
|
||||
// La cle du verrouillage d'ecran est morte (schema retire ou reinitialise) :
|
||||
// on ouvre la copie de secours, scellee sous le mot de passe.
|
||||
FRecover: Boolean;
|
||||
@@ -1681,6 +1687,45 @@ begin
|
||||
end);
|
||||
end;
|
||||
|
||||
function UiPrefsPath: string;
|
||||
begin
|
||||
Result := TPath.Combine(TPath.GetHomePath, 'ui-prefs.txt');
|
||||
end;
|
||||
|
||||
procedure TForm8.LoadUiPrefs;
|
||||
var
|
||||
LText: string;
|
||||
begin
|
||||
FUiBackAfterCopy := True;
|
||||
FUiKbdOnSearch := True;
|
||||
try
|
||||
if not TFile.Exists(UiPrefsPath) then Exit;
|
||||
LText := TFile.ReadAllText(UiPrefsPath);
|
||||
FUiBackAfterCopy := not LText.Contains('back=0');
|
||||
FUiKbdOnSearch := not LText.Contains('kbd=0');
|
||||
except
|
||||
// Illisible : on garde les valeurs par defaut.
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm8.SaveUiPrefs;
|
||||
begin
|
||||
try
|
||||
TFile.WriteAllText(UiPrefsPath,
|
||||
'back=' + IfThen(FUiBackAfterCopy, '1', '0') + sLineBreak +
|
||||
'kbd=' + IfThen(FUiKbdOnSearch, '1', '0'));
|
||||
except
|
||||
on E: Exception do Log('ui prefs not saved: ' + E.Message);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm8.PushUiPrefs;
|
||||
begin
|
||||
WebCall(Format('PM.setUiPrefs(%s, %s)',
|
||||
[LowerCase(BoolToStr(FUiBackAfterCopy, True)),
|
||||
LowerCase(BoolToStr(FUiKbdOnSearch, True))]));
|
||||
end;
|
||||
|
||||
procedure TForm8.PushConfig;
|
||||
var
|
||||
LUrl, LToken: string;
|
||||
@@ -1689,6 +1734,8 @@ begin
|
||||
FToken := FIRSTRUN_TOKEN;
|
||||
FPwd := TEST_PWD;
|
||||
FPwdShown := FPwd;
|
||||
LoadUiPrefs;
|
||||
PushUiPrefs;
|
||||
// Ce que l'appareil a retenu l'emporte sur les valeurs de premier lancement.
|
||||
if LoadDeviceSettings(LUrl, LToken) then
|
||||
begin
|
||||
@@ -1943,6 +1990,13 @@ begin
|
||||
else if LAction = 'kbd' then
|
||||
ShowSoftKeyboard
|
||||
|
||||
else if LAction = 'uipref' then
|
||||
begin
|
||||
FUiBackAfterCopy := Param('back') = '1';
|
||||
FUiKbdOnSearch := Param('kbd') = '1';
|
||||
SaveUiPrefs;
|
||||
end
|
||||
|
||||
else if LAction = 'copy' then
|
||||
begin
|
||||
// LES SECRETS NE TRANSITENT PAS PAR LE PONT. La page envoie un rang,
|
||||
@@ -2398,7 +2452,8 @@ begin
|
||||
try
|
||||
LSw := TStopwatch.StartNew;
|
||||
AdoptVault(LPlain);
|
||||
WebCall('PM.focusSearch()'); // on ouvre pour chercher : clavier pret
|
||||
if FUiKbdOnSearch then
|
||||
WebCall('PM.focusSearch()'); // on ouvre pour chercher : clavier pret
|
||||
Log(' displayed in ' + LSw.ElapsedMilliseconds.ToString + ' ms');
|
||||
// Afficher d'abord, synchroniser ensuite : le coffre est a l'ecran, le
|
||||
// reseau se debrouille derriere. Sans mot de passe range, on ne peut
|
||||
@@ -3023,7 +3078,7 @@ begin
|
||||
// COPIER POUR COLLER AILLEURS : on rend la main a l'app d'ou l'on venait,
|
||||
// il ne reste qu'a coller. Le retour dans Vault retrouve la liste telle
|
||||
// quelle (delai de grace avant verrouillage).
|
||||
MoveAppToBack;
|
||||
if FUiBackAfterCopy then MoveAppToBack;
|
||||
end;
|
||||
|
||||
procedure TForm8.OnClipTimer(Sender: TObject);
|
||||
@@ -3100,7 +3155,7 @@ begin
|
||||
FBackgroundAt := 0;
|
||||
// RETOUR DANS VAULT = on vient chercher un mot de passe : la recherche
|
||||
// est prete, texte precedent selectionne pour etre remplace.
|
||||
if (FWebView = 'list') and (FPlain <> '') then
|
||||
if FUiKbdOnSearch and (FWebView = 'list') and (FPlain <> '') then
|
||||
WebCall('PM.focusSearch()');
|
||||
end;
|
||||
end;
|
||||
|
||||
Reference in New Issue
Block a user