Fix bug #8069: View/Update other formats button disabled with non-TeX fonts

This commit is contained in:
Juergen Spitzmueller 2012-03-16 15:53:45 +01:00
parent b1bb04d244
commit f50edc8673
3 changed files with 28 additions and 0 deletions

View File

@ -204,6 +204,7 @@ void MenuButton::mousePressEvent(QMouseEvent * e)
m->setWindowTitle(label); m->setWindowTitle(label);
m->setTearOffEnabled(true); m->setTearOffEnabled(true);
connect(bar_, SIGNAL(updated()), m, SLOT(updateParent())); connect(bar_, SIGNAL(updated()), m, SLOT(updateParent()));
connect(bar_, SIGNAL(updated()), this, SLOT(updateTriggered()));
ToolbarInfo const * tbinfo = guiApp->toolbars().info(tbitem_.name_); ToolbarInfo const * tbinfo = guiApp->toolbars().info(tbitem_.name_);
if (!tbinfo) { if (!tbinfo) {
LYXERR0("Unknown toolbar " << tbitem_.name_); LYXERR0("Unknown toolbar " << tbitem_.name_);
@ -227,6 +228,28 @@ void MenuButton::actionTriggered(QAction * action)
} }
void MenuButton::updateTriggered()
{
if (!menu())
return;
bool enabled = false;
QList<QAction *> acts = menu()->actions();
for (int i = 0; i < acts.size(); ++i)
if (acts[i]->isEnabled()) {
enabled = true;
break;
}
// Enable the MenuButton if at least one menu item is enabled
setEnabled(enabled);
// If a disabled item is default, switch to InstantPopup
// (this can happen if a user selects e.g. DVI and then
// turns non-TeX fonts on)
if (defaultAction() && !defaultAction()->isEnabled())
setPopupMode(QToolButton::InstantPopup);
}
void GuiToolbar::add(ToolbarItem const & item) void GuiToolbar::add(ToolbarItem const & item)
{ {
switch (item.type_) { switch (item.type_) {

View File

@ -59,6 +59,8 @@ private:
private Q_SLOTS: private Q_SLOTS:
/// ///
void actionTriggered(QAction * action); void actionTriggered(QAction * action);
///
void updateTriggered();
}; };

View File

@ -76,6 +76,9 @@ What's new
* USER INTERFACE * USER INTERFACE
- Do not disable View/Update Other Formats button when "Use non-TeX fonts"
is active (bug 8069).
- Do not allow to add a citation in the citation dialog using the - Do not allow to add a citation in the citation dialog using the
<Enter> key if the Add button is disabled. <Enter> key if the Add button is disabled.