~osomon/unity-2d/escapeAmpersandsPartII

« back to all changes in this revision

Viewing changes to launcher/UnityApplications/placeentry.cpp

  • Committer: Olivier Tilloy
  • Date: 2011-03-11 10:00:59 UTC
  • Revision ID: olivier.tilloy@canonical.com-20110311100059-9kv6wdvz0iukg27h
[launcher] Escape ampersands in place entry section names so that they are not considered as keyboard accelerators.

Show diffs side-by-side

added added

removed removed

Lines of Context:
797
797
 
798
798
    for (int i = 0; i < m_sections->rowCount(); ++i) {
799
799
        QAction* section = new QAction(m_menu);
800
 
        section->setText(m_sections->data(m_sections->index(i)).toString());
 
800
        QString sectionName = m_sections->data(m_sections->index(i)).toString();
 
801
        /* Escape ampersands so that they are not considered as keyboard accelerators. */
 
802
        sectionName.replace("&", "&&");
 
803
        section->setText(sectionName);
801
804
        section->setProperty(SECTION_PROPERTY, QVariant(i));
802
805
        m_menu->addAction(section);
803
806
        QObject::connect(section, SIGNAL(triggered()), this, SLOT(onSectionTriggered()));