summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qwidget_s60.cpp
diff options
context:
space:
mode:
authorMarkku Luukkainen <markku.luukkainen@digia.com>2009-06-10 10:57:54 (GMT)
committerMarkku Luukkainen <markku.luukkainen@digia.com>2009-06-10 10:57:54 (GMT)
commit1c97ec260bd398912d64b0328299d50207962ad4 (patch)
tree138228023b086a943828b0ef6b16a1c1cde8d8fb /src/gui/kernel/qwidget_s60.cpp
parent47746f46920e4d09d4524fc2466b25626b2454bf (diff)
parent9009dce133b015cd2c7060d1f4747f3733dcf546 (diff)
downloadQt-1c97ec260bd398912d64b0328299d50207962ad4.zip
Qt-1c97ec260bd398912d64b0328299d50207962ad4.tar.gz
Qt-1c97ec260bd398912d64b0328299d50207962ad4.tar.bz2
Merge branch 'softkeys_without_stack'
Diffstat (limited to 'src/gui/kernel/qwidget_s60.cpp')
-rw-r--r--src/gui/kernel/qwidget_s60.cpp53
1 files changed, 52 insertions, 1 deletions
diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp
index e32e272..eb3180f 100644
--- a/src/gui/kernel/qwidget_s60.cpp
+++ b/src/gui/kernel/qwidget_s60.cpp
@@ -52,6 +52,8 @@
#include <qinputcontext.h>
+#include <aknappui.h>
+
QT_BEGIN_NAMESPACE
extern bool qt_nograb();
@@ -59,6 +61,56 @@ extern bool qt_nograb();
QWidget *QWidgetPrivate::mouseGrabber = 0;
QWidget *QWidgetPrivate::keyboardGrabber = 0;
+static bool isEqual(const QList<QAction*>& a, const QList<QAction*>& b)
+{
+ if ( a.count() != b.count())
+ return false;
+ int index=0;
+ while (index<a.count()) {
+ if (a.at(index)->softKeyRole() != b.at(index)->softKeyRole())
+ return false;
+ if (a.at(index)->text().compare(b.at(index)->text())!=0)
+ return false;
+ index++;
+ }
+ return true;
+}
+
+
+void QWidgetPrivate::setSoftKeys_sys(const QList<QAction*> &softkeys)
+{
+ Q_Q(QWidget);
+ if (QApplication::focusWidget() && q!=QApplication::focusWidget()) {
+ QList<QAction *> old = QApplication::focusWidget()->softKeys();
+ if (isEqual(old, softkeys ))
+ return;
+ }
+ CCoeAppUi* appui = CEikonEnv::Static()->AppUi();
+ CAknAppUi* aknAppUi = static_cast <CAknAppUi*>(appui);
+ CEikButtonGroupContainer* nativeContainer = aknAppUi->Cba();
+ nativeContainer->SetCommandSetL(R_AVKON_SOFTKEYS_EMPTY_WITH_IDS);
+
+ int placeInScreen=0;
+ for (int index = 0; index < softkeys.count(); index++) {
+ const QAction* softKeyAction = softkeys.at(index);
+ if (softKeyAction->softKeyRole() != QAction::ContextMenuSoftKey) {
+
+ HBufC* text = qt_QString2HBufCNewL(softKeyAction->text());
+ CleanupStack::PushL(text);
+ if (softKeyAction->softKeyRole() == QAction::MenuSoftKey) {
+ nativeContainer->SetCommandL(placeInScreen, EAknSoftkeyOptions, *text);
+ } else {
+ nativeContainer->SetCommandL(placeInScreen, SOFTKEYSTART + index, *text);
+ }
+ CleanupStack::PopAndDestroy();
+ placeInScreen++;
+ }
+ if (placeInScreen==1)
+ placeInScreen=2;
+ }
+ nativeContainer->DrawDeferred(); // 3.1 needs an extra invitation
+}
+
void QWidgetPrivate::setWSGeometry(bool dontShow)
{
@@ -1006,5 +1058,4 @@ void QWidget::activateWindow()
rw->SetOrdinalPosition(0);
}
}
-
QT_END_NAMESPACE