Bug 392137

Summary: Make entry type (and more fields) available in entry id suggestion setup
Product: [Applications] KBibTeX Reporter: Erik Quaeghebeur <bugs.kde.org>
Component: GeneralAssignee: Thomas Fischer <fischer>
Status: RESOLVED FIXED    
Severity: wishlist    
Priority: NOR    
Version: git (master)   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In: 0.9
Sentry Crash Report:
Attachments: patch that adds entry type as an option in the id suggestion interface

Description Erik Quaeghebeur 2018-03-21 14:03:35 UTC
I am using current git master and I like the shape KBibTeX for Qt5 is in. With the move to Qt5 I had to move to Jabref and now want to move back. There is one thing I miss from Jabref: per-entry type definition of entry id suggestion.

For my current purposes, having a block that can insert (the first letter of) the entry type would be sufficient.

A further improvement would be to have (all the) blocks conditional on entry type (or sets thereof).

Another improvement would be to have all fields available through a generic blocks (per field type, perhaps, so lists differently from scalars etc.) within which is a field selection drop-down box. The current blocks for volume/page and title/journal seem like good candidates. This would allow cutting down on the number of block types as well.
Comment 1 Erik Quaeghebeur 2018-04-20 15:05:56 UTC
Created attachment 112141 [details]
patch that adds entry type as an option in the id suggestion interface

This patch adds some of the functionality requested in this bugreport.

However, I found that the other ideas mentioned would be harder to implement and require more extensive redesign.
Comment 2 Thomas Fischer 2018-04-21 18:57:40 UTC
I have committed your patch with only minimal changes. It is not yet in the main repository, but you can inspect the commit here:
https://commits.kde.org/clones/kbibtex/thomasfischer/kbibtex/7bdc05e07ba3e92713ac57a0da54ea8c2a5bf4e1

I had your commit followed up by a change of myself to support CamelCase-formatted entry types:
https://commits.kde.org/clones/kbibtex/thomasfischer/kbibtex/3511f0fb0576692596d874c0f58801d932ba19c4

I plan to make one more change before pushing it to the main repository:
In IdSuggestionsEditWidget::IdSuggestionsEditWidgetPrivate::add(TokenType tokenType, bool atTop) you most likely copy'n'pasted from "case ttJournal", where len=1 is set. This means only the first letter of the journal or entry type is used, respectively. This may make sense for journals, where "JAAM" is a good abbreviation for a journal. For entry types which are without spaces, both "inbook" and "inproceedings" become just "i" and both "misc" and "mastersthesis" becomes "m". So, len should be -1. Do you agree?
Comment 3 Erik Quaeghebeur 2018-04-22 21:37:29 UTC
(In reply to Thomas Fischer from comment #2)
> I plan to make one more change before pushing it to the main repository:
> In IdSuggestionsEditWidget::IdSuggestionsEditWidgetPrivate::add(TokenType
> tokenType, bool atTop) you most likely copy'n'pasted from "case ttJournal",
> where len=1 is set. This means only the first letter of the journal or entry
> type is used, respectively. This may make sense for journals, where "JAAM"
> is a good abbreviation for a journal. For entry types which are without
> spaces, both "inbook" and "inproceedings" become just "i" and both "misc"
> and "mastersthesis" becomes "m". So, len should be -1. Do you agree?

I indeed ‘coded’ by copy-paste from the Journal Title ‘example’. However, I intentionally kept "info.len = 1" because that is how I personally use it. I don't mind inbook and inproceedings entries to both get an id with ‘i’ in the same location. The ‘i’ of ‘in’ provides sufficient extra info. But I don't mind at all if the default is changed to -1, as long as I can still manually set 1.
Comment 4 Thomas Fischer 2018-04-23 19:46:03 UTC
Git commit 5356c3a2b35429de96d1d78c9d19d70fd60a2d1e by Thomas Fischer, on behalf of Erik Quaeghebeur.
Committed on 23/04/2018 at 05:53.
Pushed by thomasfischer into branch 'master'.

Adding 'Type' as a new component in Id Suggestions

Adding 'Type' (article, journal, ...) as a component of a
suggested entry id just like being able to have authors or
title as a component.

M  +77   -1    src/gui/preferences/settingsidsuggestionseditor.cpp
M  +34   -1    src/processing/idsuggestions.cpp

https://commits.kde.org/kbibtex/5356c3a2b35429de96d1d78c9d19d70fd60a2d1e
Comment 5 Thomas Fischer 2018-04-23 19:46:03 UTC
Git commit 3b0c2d42645a0647c6f9370a099964aa64621cc2 by Thomas Fischer.
Committed on 23/04/2018 at 05:53.
Pushed by thomasfischer into branch 'master'.

Id suggestion's 'type' supports CamelCase

The 'type' component introduced in a recent commit (5356c3a2b35)
now supports CamelCase formatting.
FIXED-IN: 0.9

M  +3    -0    src/gui/preferences/settingsidsuggestionseditor.cpp
M  +18   -4    src/processing/idsuggestions.cpp

https://commits.kde.org/kbibtex/3b0c2d42645a0647c6f9370a099964aa64621cc2