src/gui/kernel/qsoftkeymanager.cpp
branchGCC_SURGE
changeset 31 5daf16870df6
parent 30 5dc02b23752f
child 33 3e2da88830cd
equal deleted inserted replaced
27:93b982ccede2 31:5daf16870df6
    41 
    41 
    42 #include "qapplication.h"
    42 #include "qapplication.h"
    43 #include "qevent.h"
    43 #include "qevent.h"
    44 #include "qbitmap.h"
    44 #include "qbitmap.h"
    45 #include "private/qsoftkeymanager_p.h"
    45 #include "private/qsoftkeymanager_p.h"
    46 #include "private/qobject_p.h"
    46 #include "private/qaction_p.h"
    47 #include "private/qsoftkeymanager_common_p.h"
    47 #include "private/qsoftkeymanager_common_p.h"
    48 
    48 
    49 #ifdef Q_WS_S60
    49 #ifdef Q_WS_S60
    50 #include "private/qsoftkeymanager_s60_p.h"
    50 #include "private/qsoftkeymanager_s60_p.h"
    51 #endif
    51 #endif
   102 {
   102 {
   103     QAction *action = new QAction(standardSoftKeyText(standardKey), actionWidget);
   103     QAction *action = new QAction(standardSoftKeyText(standardKey), actionWidget);
   104     QAction::SoftKeyRole softKeyRole = QAction::NoSoftKey;
   104     QAction::SoftKeyRole softKeyRole = QAction::NoSoftKey;
   105     switch (standardKey) {
   105     switch (standardKey) {
   106     case MenuSoftKey: // FALL-THROUGH
   106     case MenuSoftKey: // FALL-THROUGH
   107         action->setProperty(MENU_ACTION_PROPERTY, QVariant(true)); // TODO: can be refactored away to use _q_action_menubar
   107         QActionPrivate::get(action)->menuActionSoftkeys = true;
   108     case OkSoftKey:
   108     case OkSoftKey:
   109     case SelectSoftKey:
   109     case SelectSoftKey:
   110     case DoneSoftKey:
   110     case DoneSoftKey:
   111         softKeyRole = QAction::PositiveSoftKey;
   111         softKeyRole = QAction::PositiveSoftKey;
   112         break;
   112         break;
   253     return true;
   253     return true;
   254 }
   254 }
   255 
   255 
   256 void QSoftKeyManager::setForceEnabledInSoftkeys(QAction *action)
   256 void QSoftKeyManager::setForceEnabledInSoftkeys(QAction *action)
   257 {
   257 {
   258     action->setProperty(FORCE_ENABLED_PROPERTY, QVariant(true));
   258     QActionPrivate::get(action)->forceEnabledInSoftkeys = true;
   259 }
   259 }
   260 
   260 
   261 bool QSoftKeyManager::isForceEnabledInSofkeys(QAction *action)
   261 bool QSoftKeyManager::isForceEnabledInSofkeys(QAction *action)
   262 {
   262 {
   263     bool ret = false;
   263     return QActionPrivate::get(action)->forceEnabledInSoftkeys;
   264     QVariant property = action->property(FORCE_ENABLED_PROPERTY);
       
   265     if (property.isValid() && property.toBool())
       
   266         ret = true;
       
   267     return ret;
       
   268 }
   264 }
   269 
   265 
   270 bool QSoftKeyManager::event(QEvent *e)
   266 bool QSoftKeyManager::event(QEvent *e)
   271 {
   267 {
   272 #ifndef QT_NO_ACTION
   268 #ifndef QT_NO_ACTION