src/gui/widgets/qmenu.cpp
branchRCL_3
changeset 7 3f74d0d4af4c
parent 5 d3bac044e0f0
child 13 c0432d11811c
--- a/src/gui/widgets/qmenu.cpp	Mon Mar 15 12:43:09 2010 +0200
+++ b/src/gui/widgets/qmenu.cpp	Thu Apr 08 14:19:33 2010 +0300
@@ -117,7 +117,7 @@
         if (parentWidget->parentWidget())
             parentWidget = parentWidget->parentWidget();
         setParent(parentWidget, Qt::Window | Qt::Tool);
-	setAttribute(Qt::WA_DeleteOnClose, true);
+        setAttribute(Qt::WA_DeleteOnClose, true);
         setAttribute(Qt::WA_X11NetWmWindowTypeMenu, true);
         setWindowTitle(p->windowTitle());
         setEnabled(p->isEnabled());
@@ -168,8 +168,8 @@
 #ifdef QT_SOFTKEYS_ENABLED
     selectAction = QSoftKeyManager::createKeyedAction(QSoftKeyManager::SelectSoftKey, Qt::Key_Select, q);
     cancelAction = QSoftKeyManager::createKeyedAction(QSoftKeyManager::CancelSoftKey, Qt::Key_Back, q);
-    selectAction->setVisible(false); // Don't show these in the menu
-    cancelAction->setVisible(false);
+    selectAction->setPriority(QAction::HighPriority);
+    cancelAction->setPriority(QAction::HighPriority);
     q->addAction(selectAction);
     q->addAction(cancelAction);
 #endif
@@ -1226,7 +1226,7 @@
     else if (action->isSeparator())
         option->menuItemType = QStyleOptionMenuItem::Separator;
     else if (d->defaultAction == action)
-	    option->menuItemType = QStyleOptionMenuItem::DefaultItem;
+        option->menuItemType = QStyleOptionMenuItem::DefaultItem;
     else
         option->menuItemType = QStyleOptionMenuItem::Normal;
     if (action->isIconVisibleInMenu())
@@ -1719,7 +1719,14 @@
 void QMenu::clear()
 {
     QList<QAction*> acts = actions();
+
     for(int i = 0; i < acts.size(); i++) {
+#ifdef QT_SOFTKEYS_ENABLED
+        Q_D(QMenu);
+        // Lets not touch to our internal softkey actions
+        if(acts[i] == d->selectAction || acts[i] == d->cancelAction)
+            continue;
+#endif
         removeAction(acts[i]);
         if (acts[i]->parent() == this && acts[i]->d_func()->widgets.isEmpty())
             delete acts[i];
@@ -2408,6 +2415,13 @@
         }
         return true;
 #endif
+#ifdef QT_SOFTKEYS_ENABLED
+    case QEvent::LanguageChange: {
+        d->selectAction->setText(QSoftKeyManager::standardSoftKeyText(QSoftKeyManager::SelectSoftKey));
+        d->cancelAction->setText(QSoftKeyManager::standardSoftKeyText(QSoftKeyManager::CancelSoftKey));
+        }
+        break;
+#endif
     default:
         break;
     }
@@ -2919,7 +2933,7 @@
 #endif
     if (isVisible()) {
         d->updateActionRects();
-	resize(sizeHint());
+        resize(sizeHint());
         update();
     }
 }