GuiRef.cpp: sort categories.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33273 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2010-01-30 12:13:00 +00:00
parent 3f379915a6
commit 971d1fb7a4

View File

@ -354,7 +354,6 @@ void GuiRef::redoRefs()
QStringList refsStrings; QStringList refsStrings;
QStringList refsCategories; QStringList refsCategories;
refsCategories.append(qt_("No prefix"));
vector<docstring>::const_iterator iter; vector<docstring>::const_iterator iter;
for (iter = refs_.begin(); iter != refs_.end(); ++iter) { for (iter = refs_.begin(); iter != refs_.end(); ++iter) {
QString const lab = toqstr(*iter); QString const lab = toqstr(*iter);
@ -365,6 +364,10 @@ void GuiRef::redoRefs()
refsCategories.append(pref); refsCategories.append(pref);
} }
} }
// sort categories case-intensively
qSort(refsCategories.begin(), refsCategories.end(),
caseInsensitiveLessThan /*defined above*/);
refsCategories.insert(0, qt_("<No prefix>"));
if (sortCB->isEnabled() && sortCB->isChecked()) { if (sortCB->isEnabled() && sortCB->isChecked()) {
if(caseSensitiveCB->isEnabled() && caseSensitiveCB->isChecked()) if(caseSensitiveCB->isEnabled() && caseSensitiveCB->isChecked())
@ -383,7 +386,7 @@ void GuiRef::redoRefs()
for (int i = 0; i < refsStrings.size(); ++i) { for (int i = 0; i < refsStrings.size(); ++i) {
QString const ref = refsStrings.at(i); QString const ref = refsStrings.at(i);
if ((ref.startsWith(cat + QString(":"))) if ((ref.startsWith(cat + QString(":")))
|| (cat == qt_("No prefix") || (cat == qt_("<No prefix>")
&& !ref.contains(":"))) { && !ref.contains(":"))) {
QTreeWidgetItem * child = QTreeWidgetItem * child =
new QTreeWidgetItem(item); new QTreeWidgetItem(item);