Fix Mac menu-merging case-sensitivity.
Use case-insensitive string comparisons to deal with any combination of case in the target or menu text correctly. Fixes issues reported by BHughes in TextEdit and Creator. Change-Id: Ic3b577bf9034659b2de4aa206757b3a5a303a7b8 Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
This commit is contained in:
parent
2d598e472a
commit
c23e8f932b
@ -211,24 +211,26 @@ NSMenuItem *QCocoaMenuItem::sync()
|
||||
break;
|
||||
case TextHeuristicRole: {
|
||||
QString aboutString = tr("About").toLower();
|
||||
|
||||
if (m_text.startsWith(aboutString) || m_text.endsWith(aboutString)) {
|
||||
if (m_text.startsWith(aboutString, Qt::CaseInsensitive)
|
||||
|| m_text.endsWith(aboutString, Qt::CaseInsensitive))
|
||||
{
|
||||
if (m_text.indexOf(QRegExp(QString::fromLatin1("qt$"), Qt::CaseInsensitive)) == -1)
|
||||
mergeItem = [loader aboutMenuItem];
|
||||
else
|
||||
mergeItem = [loader aboutQtMenuItem];
|
||||
|
||||
m_merged = true;
|
||||
} else if (m_text.startsWith(tr("Config").toLower())
|
||||
|| m_text.startsWith(tr("Preference").toLower())
|
||||
|| m_text.startsWith(tr("Options").toLower())
|
||||
|| m_text.startsWith(tr("Setting").toLower())
|
||||
|| m_text.startsWith(tr("Setup").toLower())) {
|
||||
} else if (m_text.startsWith(tr("Config"), Qt::CaseInsensitive)
|
||||
|| m_text.startsWith(tr("Preference"), Qt::CaseInsensitive)
|
||||
|| m_text.startsWith(tr("Options"), Qt::CaseInsensitive)
|
||||
|| m_text.startsWith(tr("Setting"), Qt::CaseInsensitive)
|
||||
|| m_text.startsWith(tr("Setup"), Qt::CaseInsensitive)) {
|
||||
mergeItem = [loader preferencesMenuItem];
|
||||
} else if (m_text.startsWith(tr("Quit").toLower())
|
||||
|| m_text.startsWith(tr("Exit").toLower())) {
|
||||
} else if (m_text.startsWith(tr("Quit"), Qt::CaseInsensitive)
|
||||
|| m_text.startsWith(tr("Exit"), Qt::CaseInsensitive)) {
|
||||
mergeItem = [loader quitMenuItem];
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user