]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/Toolbars.cpp
Handle correctly zero table special arguments.
[lyx.git] / src / frontends / qt4 / Toolbars.cpp
index a9f90d4a5a6ea77d79f031d423502c1219e0b28c..b43d61acf28959278accc334ed804f351bc6e97b 100644 (file)
@@ -38,14 +38,16 @@ namespace frontend {
 //
 /////////////////////////////////////////////////////////////////////////
 
-ToolbarItem::ToolbarItem(Type type, FuncRequest const & func, docstring const & label)
-       : type_(type), func_(func), label_(label)
+ToolbarItem::ToolbarItem(Type type, FuncRequest const & func,
+                         docstring const & label)
+       : type_(type), func_(make_shared<FuncRequest>(func)), label_(label)
 {
 }
 
 
-ToolbarItem::ToolbarItem(Type type, string const & name, docstring const & label)
-       : type_(type), label_(label), name_(name)
+ToolbarItem::ToolbarItem(Type type, string const & name,
+                         docstring const & label)
+       : type_(type), func_(make_shared<FuncRequest>()), label_(label), name_(name)
 {
 }
 
@@ -53,7 +55,7 @@ ToolbarItem::ToolbarItem(Type type, string const & name, docstring const & label
 void ToolbarInfo::add(ToolbarItem const & item)
 {
        items.push_back(item);
-       items.back().func_.setOrigin(FuncRequest::TOOLBAR);
+       items.back().func_->setOrigin(FuncRequest::TOOLBAR);
 }
 
 
@@ -192,9 +194,13 @@ ToolbarInfo & ToolbarInfo::read(Lexer & lex)
                case TO_IMPORTFORMATS:
                case TO_UPDATEFORMATS:
                case TO_VIEWFORMATS: {
-                       vector<Format const *> formats = (code == TO_IMPORTFORMATS) ?
-                               theConverters().importableFormats() :
-                               theConverters().exportableFormats(true);
+                       FormatList formats;
+                       if (code == TO_IMPORTFORMATS)
+                               formats = theConverters().importableFormats();
+                       else if (code == TO_EXPORTFORMATS)
+                               formats = theConverters().exportableFormats(false);
+                       else
+                               formats = theConverters().exportableFormats(true);
                        sort(formats.begin(), formats.end());
                        for (Format const * f : formats) {
                                if (f->dummy())
@@ -227,7 +233,7 @@ ToolbarInfo & ToolbarInfo::read(Lexer & lex)
                                FuncRequest func(lfun, f->name(),
                                                FuncRequest::TOOLBAR);
                                add(ToolbarItem(ToolbarItem::COMMAND, func,
-                                               bformat(tooltip, prettyname)));
+                                               bformat(tooltip, translateIfPossible(prettyname))));
                        }
                        break;
                }