mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 18:08:10 +00:00
Menus.cpp: priorize capitals as language accelerators.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33566 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
ea6b96dfc5
commit
9f67cede58
@ -780,16 +780,32 @@ void MenuDefinition::expandLanguageSelector(Buffer const * buf)
|
||||
cit != languages.end(); ++cit) {
|
||||
QString label = qt_((*cit)->display());
|
||||
// try to add an accelerator
|
||||
bool success = false;
|
||||
// try capitals first
|
||||
for (int i = 0; i < label.size(); ++i) {
|
||||
if (label[i].isSpace())
|
||||
if (!label[i].isUpper())
|
||||
continue;
|
||||
QString const ch = QString(label[i]);
|
||||
if (!accelerators.contains(ch, Qt::CaseInsensitive)) {
|
||||
label = label + toqstr("|") + ch;
|
||||
accelerators.append(ch);
|
||||
success = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// if all capitals are taken, try the rest
|
||||
if (!success) {
|
||||
for (int i = 0; i < label.size(); ++i) {
|
||||
if (label[i].isSpace())
|
||||
continue;
|
||||
QString const ch = QString(label[i]);
|
||||
if (!accelerators.contains(ch, Qt::CaseInsensitive)) {
|
||||
label = label + toqstr("|") + ch;
|
||||
accelerators.append(ch);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
MenuItem w(MenuItem::Command, label,
|
||||
FuncRequest(LFUN_LANGUAGE, (*cit)->lang()));
|
||||
item.submenu().addWithStatusCheck(w);
|
||||
|
Loading…
Reference in New Issue
Block a user