diff options
-rw-r--r-- | src/gui/kernel/qsoftkeymanager.cpp | 6 | ||||
-rw-r--r-- | src/gui/widgets/qmenu_symbian.cpp | 24 |
2 files changed, 7 insertions, 23 deletions
diff --git a/src/gui/kernel/qsoftkeymanager.cpp b/src/gui/kernel/qsoftkeymanager.cpp index afb7698..45ecb5a 100644 --- a/src/gui/kernel/qsoftkeymanager.cpp +++ b/src/gui/kernel/qsoftkeymanager.cpp @@ -42,6 +42,7 @@ #include "qapplication.h" #include "qevent.h" #ifdef Q_WS_S60 +#include "qstyle.h" #include "private/qt_s60_p.h" #endif #include "private/qsoftkeymanager_p.h" @@ -197,7 +198,6 @@ bool QSoftKeyManager::event(QEvent *e) #ifdef Q_WS_S60 void QSoftKeyManagerPrivate::updateSoftKeys_sys(const QList<QAction*> &softkeys) { - CEikButtonGroupContainer* nativeContainer = S60->buttonGroupContainer(); QT_TRAP_THROWING(nativeContainer->SetCommandSetL(R_AVKON_SOFTKEYS_EMPTY_WITH_IDS)); @@ -229,7 +229,9 @@ void QSoftKeyManagerPrivate::updateSoftKeys_sys(const QList<QAction*> &softkeys) : s60CommandStart + index; if (position != -1) { - TPtrC text = qt_QString2TPtrC(softKeyAction->text()); + const int underlineShortCut = QApplication::style()->styleHint(QStyle::SH_UnderlineShortcut); + QString iconText = softKeyAction->iconText(); + TPtrC text = qt_QString2TPtrC( underlineShortCut ? softKeyAction->text() : iconText); QT_TRAP_THROWING(nativeContainer->SetCommandL(position, command, text)); } } diff --git a/src/gui/widgets/qmenu_symbian.cpp b/src/gui/widgets/qmenu_symbian.cpp index 00ceb98..13830ba 100644 --- a/src/gui/widgets/qmenu_symbian.cpp +++ b/src/gui/widgets/qmenu_symbian.cpp @@ -103,22 +103,6 @@ static bool hasContextMenu(QWidget* widget) } return false; } -// ### FIX THIS, copy/paste of original (faulty) stripped text implementation. -// Implementation should be removed from QAction implementation to some generic place -static QString qt_strippedText_copy_from_qaction(QString s) -{ - s.remove(QString::fromLatin1("...")); - int i = 0; - while (i < s.size()) { - ++i; - if (s.at(i-1) != QLatin1Char('&')) - continue; - if (i < s.size() && s.at(i) == QLatin1Char('&')) - ++i; - s.remove(i-1,1); - } - return s.trimmed(); -}; static SymbianMenuItem* qt_symbian_find_menu(int id, const QList<SymbianMenuItem*> &parent) { @@ -161,11 +145,9 @@ static void qt_symbian_insert_action(QSymbianMenuAction* action, QList<SymbianMe if (action->action->isSeparator()) return; -// ### FIX THIS, the qt_strippedText2 doesn't work perfectly for stripping & marks. Same bug is in QAction -// New really working method is needed in a place where the implementation isn't copy/pasted - QString text = qt_strippedText_copy_from_qaction(action->action->text()); - TPtrC menuItemText(qt_QString2TPtrC(text)); - + const int underlineShortCut = QApplication::style()->styleHint(QStyle::SH_UnderlineShortcut); + QString iconText = action->action->iconText(); + TPtrC menuItemText = qt_QString2TPtrC( underlineShortCut ? action->action->text() : iconText); if (action->action->menu()) { SymbianMenuItem* menuItem = new SymbianMenuItem(); menuItem->menuItemData.iCascadeId = action->command; |