]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiApplication.cpp
* GuiApplication.cpp: prevent null pointer.
[lyx.git] / src / frontends / qt4 / GuiApplication.cpp
index 981d345aa154fe0353f91e8657cfb6a374fae56b..7006a7844aeb659dfb2f824f5f05090db50438cc 100644 (file)
@@ -50,6 +50,7 @@
 #include "Server.h"
 #include "Session.h"
 #include "SpellChecker.h"
+#include "Thesaurus.h"
 #include "version.h"
 
 #include "support/convert.h"
@@ -1302,7 +1303,9 @@ void GuiApplication::dispatch(FuncRequest const & cmd, DispatchResult & dr)
                Buffer * buf = current_view_->loadDocument(fname, false);
                if (buf) {
                        current_view_->setBuffer(buf);
+#ifndef DEVEL_VERSION
                        buf->setReadonly(true);
+#endif
                        buf->updateLabels();
                        buf->errors("Parse");
                }
@@ -1971,16 +1974,28 @@ QAbstractItemModel * GuiApplication::languageModel()
                return d->language_model_;
 
        QStandardItemModel * lang_model = new QStandardItemModel(this);
-       lang_model->insertColumns(0, 1);
+       lang_model->insertColumns(0, 3);
        int current_row;
+       QIcon speller(getPixmap("images/", "dialog-show_spellchecker", "png"));
+       QIcon saurus(getPixmap("images/", "thesaurus-entry", "png"));
        Languages::const_iterator it = lyx::languages.begin();
        Languages::const_iterator end = lyx::languages.end();
        for (; it != end; ++it) {
                current_row = lang_model->rowCount();
                lang_model->insertRows(current_row, 1);
-               QModelIndex item = lang_model->index(current_row, 0);
-               lang_model->setData(item, qt_(it->second.display()), Qt::DisplayRole);
-               lang_model->setData(item, toqstr(it->second.lang()), Qt::UserRole);
+               QModelIndex pl_item = lang_model->index(current_row, 0);
+               QModelIndex sp_item = lang_model->index(current_row, 1);
+               QModelIndex th_item = lang_model->index(current_row, 2);
+               lang_model->setData(pl_item, qt_(it->second.display()), Qt::DisplayRole);
+               lang_model->setData(pl_item, toqstr(it->second.lang()), Qt::UserRole);
+               lang_model->setData(sp_item, qt_(it->second.display()), Qt::DisplayRole);
+               lang_model->setData(sp_item, toqstr(it->second.lang()), Qt::UserRole);
+               if (theSpellChecker() && theSpellChecker()->hasDictionary(&it->second))
+                       lang_model->setData(sp_item, speller, Qt::DecorationRole);
+               lang_model->setData(th_item, qt_(it->second.display()), Qt::DisplayRole);
+               lang_model->setData(th_item, toqstr(it->second.lang()), Qt::UserRole);
+               if (thesaurus.thesaurusInstalled(from_ascii(it->second.code())))
+                       lang_model->setData(th_item, saurus, Qt::DecorationRole);
        }
        d->language_model_ = new QSortFilterProxyModel(this);
        d->language_model_->setSourceModel(lang_model);