diff options
author | James Turner <james.turner@kdab.com> | 2012-06-08 15:41:12 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-06-11 11:41:08 +0200 |
commit | c23e8f932b5fd6f2d3be1a8d1469975da27b3276 (patch) | |
tree | b2f3c780158dd5d1f63bee3f3ceecf511b8d960e /src/plugins/platforms | |
parent | 2d598e472a24f0e70bac52fafe3325deb33fa5d4 (diff) |
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>
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoamenuitem.mm | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoamenuitem.mm b/src/plugins/platforms/cocoa/qcocoamenuitem.mm index 150e94ab07..abaffd211a 100644 --- a/src/plugins/platforms/cocoa/qcocoamenuitem.mm +++ b/src/plugins/platforms/cocoa/qcocoamenuitem.mm @@ -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; } |