Bug #1531 ยป 1531.patch
client/gui-qt/menu.cpp | ||
---|---|---|
return QString();
|
||
}
|
||
/**********************************************************************//**
|
||
Inner foreach() loop of mr_menu::mr_menu::block_actions()
|
||
Implemented as separate function to avoid shadow warnings about
|
||
internal variables of foreach() inside foreach()
|
||
**************************************************************************/
|
||
void mr_menu::block_actions_inner(const QMenu *m, bool block)
|
||
{
|
||
foreach (QAction *a, m->actions()) {
|
||
a->blockSignals(block);
|
||
}
|
||
}
|
||
/**********************************************************************//**
|
||
block/unblock all menu actions
|
||
Called from the shortcuts dialog line_edit so that user entered potential
|
||
new shortcuts don't get executed. See HR Bug #1531
|
||
**************************************************************************/
|
||
void mr_menu::block_actions(bool block)
|
||
{
|
||
QList<QMenu*> menus;
|
||
menus = findChildren<QMenu *>();
|
||
foreach (const QMenu *m, menus) {
|
||
block_actions_inner(m, block);
|
||
}
|
||
}
|
||
/**********************************************************************//**
|
||
Updates airlift menu
|
||
**************************************************************************/
|
client/gui-qt/menu.h | ||
---|---|---|
void execute_shortcut(int sid);
|
||
QString shortcut_exist(fc_shortcut *fcs);
|
||
QString shortcut_2_menustring(int sid);
|
||
void block_actions(bool block);
|
||
QAction *minimap_status;
|
||
QAction *scale_fonts_status;
|
||
QAction *lock_status;
|
||
... | ... | |
fc_shortcut *fcs, QString *ret);
|
||
bool shortcut_2_menustring_inner(const QMenu *m, QKeySequence seq,
|
||
QString *ret);
|
||
void block_actions_inner(const QMenu *m, bool block);
|
||
};
|
||
#endif // FC__MENU_H
|
client/gui-qt/shortcuts.cpp | ||
---|---|---|
{
|
||
setContextMenuPolicy(Qt::NoContextMenu);
|
||
setWindowModality(Qt::WindowModal);
|
||
// block menu actions so that user entered potential
|
||
// new shortcuts don't get executed. See HR Bug #1531
|
||
gui()->menu_bar->block_actions(TRUE);
|
||
}
|
||
/**********************************************************************//**
|
||
... | ... | |
fcp->sc->mouse = shc.mouse;
|
||
fcp->sc->mod = shc.mod;
|
||
fcp->sc->key = 0;
|
||
// unblock menu actions
|
||
gui()->menu_bar->block_actions(FALSE);
|
||
parentWidget()->close();
|
||
}
|
||
... | ... | |
fcp->sc->mouse = Qt::AllButtons;
|
||
fcp->sc->key = shc.key;
|
||
fcp->sc->mod = shc.mod;
|
||
// unblock menu actions
|
||
gui()->menu_bar->block_actions(FALSE);
|
||
parentWidget()->close();
|
||
}
|
||