fix(android): delete from the list, and stop reopening what was deleted
Two things, and the second was me misreading the question: the affordance was asked for in the LIST, not in the opened entry. A long press on a row opens the same menu. Not a cross per row - an irreversible action a thumb's width away on a list one scrolls - and not a third button per row, when those were just cleared away. A long press is invisible until used, it is Android's convention for acting on a list item, and it is where multi-select would go if it ever comes. And the deleted entry reopened itself. editDone hands control back after a refusal, but it redrew the LAST detail - after a delete the view has already returned to the list, so the entry one had just erased came back on screen. It now hands back to what is on screen, not to what was. Delphi deletes by rank when the list asks, by the open entry otherwise - exactly like open and copy. The page never sends a uuid: it has one, but letting it name a row Delphi never displayed is a door with no reason to be open.
This commit is contained in:
+28
-7
@@ -276,8 +276,9 @@ type
|
||||
/// comme 'setfield' - meme regle, meme journalisation muette.
|
||||
procedure CreateEntry(const ATitle, ASite, AUser, APwd, AKind,
|
||||
AFolder: string);
|
||||
/// Supprime l'entree ouverte, pierre tombale comprise. Sans retour.
|
||||
procedure DeleteCurrentEntry;
|
||||
/// Supprime une entree, pierre tombale comprise. Sans retour.
|
||||
/// AVaultIndex negatif = l'entree ouverte.
|
||||
procedure DeleteEntryAt(AVaultIndex: Integer);
|
||||
/// Fond le coffre ne ici dans le depot, puis passe l'autorite au depot.
|
||||
procedure ReconcileWithRemote;
|
||||
procedure ReopenEntryByUuid(const AUuid: string);
|
||||
@@ -1173,17 +1174,37 @@ begin
|
||||
end).Start;
|
||||
end;
|
||||
|
||||
procedure TForm8.DeleteCurrentEntry;
|
||||
procedure TForm8.DeleteEntryAt(AVaultIndex: Integer);
|
||||
var
|
||||
LUuid, LTitle: string;
|
||||
E: TVaultEntry;
|
||||
begin
|
||||
if FCurrent.Uuid = '' then
|
||||
// UN RANG, OU L'ENTREE OUVERTE. Depuis la liste il n'y a pas d'entree
|
||||
// ouverte : le rang designe laquelle, exactement comme pour 'open' et
|
||||
// 'copy'. La page n'envoie jamais d'uuid - elle en a un, mais le faire
|
||||
// voyager reviendrait a lui laisser designer une ligne que Delphi n'a pas
|
||||
// affichee.
|
||||
if AVaultIndex >= 0 then
|
||||
begin
|
||||
if AVaultIndex >= FVault.Count then
|
||||
begin
|
||||
RefuseChange('That entry is no longer there');
|
||||
Exit;
|
||||
end;
|
||||
E := FVault.Entry(AVaultIndex);
|
||||
LUuid := E.Uuid;
|
||||
LTitle := E.Display;
|
||||
end
|
||||
else
|
||||
begin
|
||||
LUuid := FCurrent.Uuid;
|
||||
LTitle := FCurrent.Display;
|
||||
end;
|
||||
if LUuid = '' then
|
||||
begin
|
||||
RefuseChange('This entry has no uuid - cannot be deleted');
|
||||
Exit;
|
||||
end;
|
||||
LUuid := FCurrent.Uuid;
|
||||
LTitle := FCurrent.Display;
|
||||
// Pas de rang a rouvrir : l'entree n'existera plus. AdoptVault ramene la
|
||||
// liste, ce qui est exactement ou l'on veut se retrouver.
|
||||
CommitChange('Deleted: ' + LTitle, 'entry deleted from phone', '',
|
||||
@@ -1357,7 +1378,7 @@ begin
|
||||
TNetEncoding.URL.Decode(Param('d')))
|
||||
|
||||
else if LAction = 'delentry' then
|
||||
DeleteCurrentEntry
|
||||
DeleteEntryAt(StrToIntDef(Param('i'), -1))
|
||||
|
||||
else if LAction = 'setfield' then
|
||||
SaveEntryField(TNetEncoding.URL.Decode(Param('f')),
|
||||
|
||||
Reference in New Issue
Block a user