On 28/02/2010 11:06, sp...@lyx.org wrote:
Author: spitz
Date: Sun Feb 28 11:06:05 2010
New Revision: 33590
URL: http://www.lyx.org/trac/changeset/33590

Log:
" Menus.cpp: sort languages. Based on a patch by John McCabe-Dansted.

Modified:
    lyx-devel/trunk/src/frontends/qt4/Menus.cpp

Modified: lyx-devel/trunk/src/frontends/qt4/Menus.cpp
==============================================================================
--- lyx-devel/trunk/src/frontends/qt4/Menus.cpp Sun Feb 28 01:15:21 2010        
(r33589)
+++ lyx-devel/trunk/src/frontends/qt4/Menus.cpp Sun Feb 28 11:06:05 2010        
(r33590)
@@ -760,23 +760,37 @@
        
  }

+struct sortLanguageByName {
+       bool operator()(const Language * a, const Language * b) const {
+               return qt_(a->display()).localeAwareCompare(qt_(b->display()))< 
 0;
+       }
+};

Hum, I'd prefer that you create a new Language model for the Buffer; accessible through GuiWorkArea::languageModel() or even better through GuiApplication::languageModel(Buffer * buf). Then sorting would be a matter of using QAbstractItemModel::sort() and this model would be available for other dialogs.

Abdel.

Reply via email to