]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetBibtex.cpp
Fix bug http://bugzilla.lyx.org/show_bug.cgi?id=4910 by creating InsetText::addToToc().
[lyx.git] / src / insets / InsetBibtex.cpp
index 11814867ce4e210fa771515a1db09782b60c4030..38845a4a1674cab40f90b0a3923cc50b8bde0b2d 100644 (file)
@@ -108,7 +108,7 @@ bool InsetBibtex::getStatus(Cursor & cur, FuncRequest const & cmd,
 {
        switch (cmd.action) {
        case LFUN_INSET_EDIT:
-               flag.enabled(true);
+               flag.setEnabled(true);
                return true;
 
        default:
@@ -155,7 +155,7 @@ docstring InsetBibtex::screenLabel() const
 docstring InsetBibtex::toolTip(BufferView const & /*bv*/, int /*x*/, int /*y*/) const
 {
        docstring item = from_ascii("* ");
-       docstring tip = _("Databases:\n");
+       docstring tip = _("Databases:") + "\n";
        vector<docstring> bibfilelist = getVectorFromString(getParam("bibfiles"));
 
        if (bibfilelist.empty()) {
@@ -180,14 +180,14 @@ docstring InsetBibtex::toolTip(BufferView const & /*bv*/, int /*x*/, int /*y*/)
                        style = split(style, bibtotoc, char_type(','));
        }
 
-       tip += _("Style File:\n");
+       tip += _("Style File:") +"\n";
        tip += item;
        if (!style.empty())
                tip += style;
        else
                tip += _("none");
 
-       tip += _("\nLists: ");
+       tip += "\n" + _("Lists:") + " ";
        docstring btprint = getParam("btprint");
                if (btprint == "btPrintAll")
                        tip += _("all references");
@@ -686,23 +686,21 @@ void InsetBibtex::fillWithBibKeys(BiblioInfo & keylist,
                while (ifs) {
 
                        ifs.get(ch);
-                       if (!ifs) {
-                               lyxerr << "InsetBibtex::fillWithBibKeys: Unexpected end of file." << std::endl;
+                       if (!ifs)
                                break;
-                       }
 
                        if (ch != '@')
                                continue;
 
                        docstring entryType;
 
-                       if (!ifs) {
-                               lyxerr << "InsetBibtex::fillWithBibKeys: Unexpected end of file." << std::endl;
+                       if (!readTypeOrKey(entryType, ifs, from_ascii("{("), docstring(), makeLowerCase)) {
+                               lyxerr << "InsetBibtex::fillWithBibKeys: Error reading entry type." << std::endl;
                                continue;
                        }
 
-                       if (!readTypeOrKey(entryType, ifs, from_ascii("{("), docstring(), makeLowerCase)) {
-                               lyxerr << "InsetBibtex::fillWithBibKeys: Error reading entry type." << std::endl;
+                       if (!ifs) {
+                               lyxerr << "InsetBibtex::fillWithBibKeys: Unexpected end of file." << std::endl;
                                continue;
                        }
 
@@ -731,13 +729,13 @@ void InsetBibtex::fillWithBibKeys(BiblioInfo & keylist,
                                docstring name;
                                docstring value;
 
-                               if (!ifs) {
-                                       lyxerr << "InsetBibtex::fillWithBibKeys: Unexpected end of file." << std::endl;
+                               if (!readTypeOrKey(name, ifs, from_ascii("="), from_ascii("#{}(),"), makeLowerCase)) {
+                                       lyxerr << "InsetBibtex::fillWithBibKeys: Error reading string name." << std::endl;
                                        continue;
                                }
 
-                               if (!readTypeOrKey(name, ifs, from_ascii("="), from_ascii("#{}(),"), makeLowerCase)) {
-                                       lyxerr << "InsetBibtex::fillWithBibKeys: Error reading string name." << std::endl;
+                               if (!ifs) {
+                                       lyxerr << "InsetBibtex::fillWithBibKeys: Unexpected end of file." << std::endl;
                                        continue;
                                }
 
@@ -773,17 +771,17 @@ void InsetBibtex::fillWithBibKeys(BiblioInfo & keylist,
                                // Citation entry. Try to read the key.
                                docstring key;
 
-                               if (!ifs) {
-                                       lyxerr << "InsetBibtex::fillWithBibKeys: Unexpected end of file." << std::endl;
-                                       continue;
-                               }
-
                                if (!readTypeOrKey(key, ifs, from_ascii(","), from_ascii("}"), keepCase)) {
                                        lyxerr << "InsetBibtex::fillWithBibKeys: Unable to read key for entry type:" << 
                                                        entryType << "." << std::endl;
                                        continue;
                                }
 
+                               if (!ifs) {
+                                       lyxerr << "InsetBibtex::fillWithBibKeys: Unexpected end of file." << std::endl;
+                                       continue;
+                               }
+
                                /////////////////////////////////////////////
                                // now we have a key, so we will add an entry 
                                // (even if it's empty, as bibtex does)