https://bugs.kde.org/show_bug.cgi?id=460315
Thomas Fischer <fisc...@unix-ag.uni-kl.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Status|REPORTED |ASSIGNED --- Comment #2 from Thomas Fischer <fisc...@unix-ag.uni-kl.de> --- I agree that this is a useful feature. I was able to make a basic implementation, but I want to check it first with a fresh pair of eyes before pushing it to the Git repo. Regarding the source code, you were on the right track. To have a sorted output, one has to look into FileExporterBibTeX::saveAsString(.., const File *). There, I introduced const File *_bibtexfile = sortedByIdentifier ? File::sortByIdentifier(bibtexfile) : bibtexfile; ... and use a search&replace to make use of _bibtexfile instead of the original bibtexfile in the remainder of this function. File::sortByIdentifier(..) is a new function that basically employs std::sort(..) with a custom comparison function to get the desired result. To make it more useful, the code expands on FileImporterBibTeX::Private::Statistics to track if two subsequent entries' ids are in lexicographic order. When opening a BibTeX file, based on this counter it is guessed if this file is "sorted" or not. This information is tracked as a file property and then used when saving a file as described above. The property can also toggled in the per-file properties widget. Activating it will only have an effect when writing. Deactivation has no practical effect, there is no shuffling in this case ;-) -- You are receiving this mail because: You are watching all bug changes.