CLI undo edit?

Derek Atkins warlord at MIT.EDU
Tue Aug 9 04:10:06 EDT 2005


Neil Williams <linux at codehelp.co.uk> writes:

> On Monday 08 August 2005 9:47 am, Derek Atkins wrote:

>> I presume by "retained" you mean "in core" and not "in storage"...
>
> Yes, the list itself would be part of the QofBook struct and
> accessed via an API exposed via qofbook.h - the undo list itself
> could be stored in a similar manner to the current logs if that was
> useful. Depends on the SQL backend - if we're all using immediate
> commit in SQL then would there be any need for the logs at all?

IMHO, no.

Also keep in mind that the logs are not complete and don't store
enough information.  It would be much better if QOF had an in-core
"log" that it could use instead of depending on the existing file-log
interface.  Personally I'd like to rip out the file logs...  They
cause way too many problems.  :(

>> IMHO the undo/redo list should be size-bounded, not unlimited.
>
> I was wondering about that too. So a hard-coded limit of, say 300 - should 
> that be configurable? or an absolute limit and configurable only downwards?

I suspect if you keep the last 300 _operations_ (where an import is
one operation) then yes, that would probably be sufficient.  :) If,
however, it's only 300 changed entities, that might NOT be sufficient.

>> Also, it should not necessarily depend on the dirty flag.
>
> Maybe it would use the event interface instead - every modify or create event 
> would be added to the undo list?

No, I don't think so.  I think it should still use the begin/commit
edit hooks.  OTOH, I'd also like some way to combine multiple
begin/commit blocks into single events (e.g. "import") so that you can
undo the full import all at once.

> Should the name reflect that?
> void qof_book_undo_event(QofBook *book);
> ?
> or just 
> void qof_undo(QofBook *book);

I think "qof_book_undo()" is probably the best name for the function,
but the name is relatively easy to change later ;)

-derek
-- 
       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       warlord at MIT.EDU                        PGP key available


More information about the gnucash-devel mailing list