]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiCitation.cpp
On Linux show in crash message box the backtrace
[lyx.git] / src / frontends / qt4 / GuiCitation.cpp
index 13b9345c5e1b6574a3bb8ce54e1323a0a80c58e3..500d228b4a4fbcfa5e0dc7fed6276fcc2d9afd14 100644 (file)
@@ -54,6 +54,8 @@ using namespace lyx::support;
 namespace lyx {
 namespace frontend {
 
+// FIXME THREAD
+// I am guessing that it would not hurt to make these private members.
 static vector<string> citeCmds_;
 static vector<CitationStyle> citeStyles_;
 
@@ -250,7 +252,8 @@ void GuiCitation::updateStyles(BiblioInfo const & bi)
        if (!selectedLV->selectionModel()->selectedIndexes().empty())
                curr = selectedLV->selectionModel()->selectedIndexes()[0].row();
 
-       QStringList sty = citationStyles(bi);
+       static const size_t max_length = 80;
+       QStringList sty = citationStyles(bi, max_length);
 
        if (sty.isEmpty()) {
                // some error
@@ -539,6 +542,7 @@ void GuiCitation::findKey(BiblioInfo const & bi,
        docstring field, docstring entry_type,
        bool case_sensitive, bool reg_exp, bool reset)
 {
+       // FIXME THREAD
        // Used for optimisation: store last searched string.
        static QString last_searched_string;
        // Used to disable the above optimisation.
@@ -587,7 +591,7 @@ void GuiCitation::findKey(BiblioInfo const & bi,
 }
 
 
-QStringList GuiCitation::citationStyles(BiblioInfo const & bi)
+QStringList GuiCitation::citationStyles(BiblioInfo const & bi, size_t max_size)
 {
        docstring const before = qstring_to_ucs4(textBeforeED->text());
        docstring const after = qstring_to_ucs4(textAfterED->text());
@@ -595,7 +599,7 @@ QStringList GuiCitation::citationStyles(BiblioInfo const & bi)
        vector<CitationStyle> styles = citeStyles_;
        // FIXME: pass a dictionary instead of individual before, after, dialog, etc.
        vector<docstring> ret = bi.getCiteStrings(keys, styles, documentBuffer(),
-               false, before, after, from_utf8("dialog"));
+               before, after, from_utf8("dialog"), max_size);
        return to_qstring_list(ret);
 }
 
@@ -688,7 +692,7 @@ vector<docstring> GuiCitation::searchKeys(BiblioInfo const & bi,
        try {
                reg_exp.assign(to_utf8(expr), case_sensitive ?
                        lyx::regex_constants::ECMAScript : lyx::regex_constants::icase);
-       } catch (lyx::regex_error & e) {
+       } catch (lyx::regex_error const & e) {
                // lyx::regex throws an exception if the regular expression is not
                // valid.
                LYXERR(Debug::GUI, e.what());
@@ -718,7 +722,7 @@ vector<docstring> GuiCitation::searchKeys(BiblioInfo const & bi,
                        if (lyx::regex_search(data, reg_exp))
                                foundKeys.push_back(*it);
                }
-               catch (lyx::regex_error & e) {
+               catch (lyx::regex_error const & e) {
                        LYXERR(Debug::GUI, e.what());
                        return vector<docstring>();
                }