Below I present very preliminary support for warning the user when their LyX file is externally modified. Does the following approach sound worthwhile?
When the buffer is marked dirty it checks if the file is modified externally. This may avoid the need to merge at all. I suggest that we also: 1) Checks every 1 minute if the file has been modified (Even if a merge is required, the sooner the easier) 2) Checks if the file is modified when the Buffer gains (like kwrite) Finally, I was thinking that when the file is under version control LyX could poll the version control about every half hour to see if there is a remote update. This should be subject to various limitations 1) It should be off by default, so no unexpected network access shows up in log files. 2) It should never poll anonymous svn servers, (we don't want e.g. thousands of LyX users polling svn.lyx.org) 3) It should never poll read-only files, unless explicitly told to poll these files, as these will never have merge conflicts. The final dialog should look a lot like: http://www.ucc.asn.au/~mccabedj/KWrite.png although it might be even nicer if we could redesign it as a pane as in: www.ucc.asn.au/~mccabedj/gedit.png The following code is given as an example only. It needs much more work. ---------------------------------- void Buffer::markDirty() { if (d->lyx_clean) { + // We may want to offer to revert to saved. + // We may want to present a similar warning when buffer is dirty, possibly as a pane rather than a dialog. + if (d->checksum_ != 0 && fileName().exists() && isExternallyModified(checksum_method)){ + docstring msg = _("You are modifying a document that is modified externally.\nYou may want to \"Revert to Saved\".\n"); + Alert::warning(_("Document has been externally modified."), msg); + } d->lyx_clean = false; updateTitles(); } -- John C. McCabe-Dansted
