1 /**************************************************************************** |
1 /**************************************************************************** |
2 ** |
2 ** |
3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
4 ** All rights reserved. |
4 ** All rights reserved. |
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
6 ** |
6 ** |
7 ** This file is part of the QtGui module of the Qt Toolkit. |
7 ** This file is part of the QtGui module of the Qt Toolkit. |
8 ** |
8 ** |
61 #ifndef QT_NO_SOFTKEYMANAGER |
61 #ifndef QT_NO_SOFTKEYMANAGER |
62 QT_BEGIN_NAMESPACE |
62 QT_BEGIN_NAMESPACE |
63 |
63 |
64 class QSoftKeyManagerPrivate; |
64 class QSoftKeyManagerPrivate; |
65 |
65 |
|
66 const char MENU_ACTION_PROPERTY[] = "_q_menuAction"; |
|
67 const char FORCE_ENABLED_PROPERTY[] = "_q_forceEnabledInSoftkeys"; |
|
68 |
66 class Q_AUTOTEST_EXPORT QSoftKeyManager : public QObject |
69 class Q_AUTOTEST_EXPORT QSoftKeyManager : public QObject |
67 { |
70 { |
68 Q_OBJECT |
71 Q_OBJECT |
69 Q_DECLARE_PRIVATE(QSoftKeyManager) |
72 Q_DECLARE_PRIVATE(QSoftKeyManager) |
70 |
73 |
77 MenuSoftKey, |
80 MenuSoftKey, |
78 CancelSoftKey |
81 CancelSoftKey |
79 }; |
82 }; |
80 |
83 |
81 static void updateSoftKeys(); |
84 static void updateSoftKeys(); |
82 static QAction *createAction(StandardSoftKey standardKey, QWidget *actionWidget); |
|
83 static QAction *createKeyedAction(StandardSoftKey standardKey, Qt::Key key, QWidget *actionWidget); |
|
84 |
|
85 #ifdef Q_WS_S60 |
85 #ifdef Q_WS_S60 |
86 static bool handleCommand(int); |
86 static bool handleCommand(int); |
87 #endif |
87 #endif |
88 |
88 |
89 private: |
89 static QAction *createAction(StandardSoftKey standardKey, QWidget *actionWidget); |
90 QSoftKeyManager(); |
90 static QAction *createKeyedAction(StandardSoftKey standardKey, Qt::Key key, QWidget *actionWidget); |
91 static QSoftKeyManager *instance(); |
91 static QString standardSoftKeyText(StandardSoftKey standardKey); |
92 static const char *standardSoftKeyText(StandardSoftKey standardKey); |
92 static void setForceEnabledInSoftkeys(QAction *action); |
|
93 static bool isForceEnabledInSofkeys(QAction *action); |
93 |
94 |
94 protected: |
95 protected: |
95 bool event(QEvent *e); |
96 bool event(QEvent *e); |
96 |
97 |
97 Q_DISABLE_COPY(QSoftKeyManager) |
98 private: |
|
99 QSoftKeyManager(); |
|
100 static QSoftKeyManager *instance(); |
|
101 bool appendSoftkeys(const QWidget &source, int level); |
|
102 QWidget *softkeySource(QWidget *previousSource, bool& recursiveMerging); |
|
103 bool handleUpdateSoftKeys(); |
98 |
104 |
99 private Q_SLOTS: |
105 private Q_SLOTS: |
100 void cleanupHash(QObject* obj); |
106 void cleanupHash(QObject* obj); |
101 void sendKeyEvent(); |
107 void sendKeyEvent(); |
|
108 |
|
109 private: |
|
110 Q_DISABLE_COPY(QSoftKeyManager) |
102 }; |
111 }; |
103 |
112 |
104 QT_END_NAMESPACE |
113 QT_END_NAMESPACE |
105 #endif //QT_NO_SOFTKEYMANAGER |
114 #endif //QT_NO_SOFTKEYMANAGER |
106 |
115 |