diff options
author | Alessandro Portale <aportale@trolltech.com> | 2009-05-12 15:23:49 (GMT) |
---|---|---|
committer | Alessandro Portale <aportale@trolltech.com> | 2009-05-12 15:23:49 (GMT) |
commit | 9ce13366b713d7d75ec4722161850e3d9f5298b8 (patch) | |
tree | c08c915f2866899e77b4cc25c07fbc6c56b3d1b2 | |
parent | e1b3f9396b94cd6d65c1a9890e5a20eef0062fad (diff) | |
parent | 21d8da6365281426c50d6d5b8393d833e16d4096 (diff) | |
download | Qt-9ce13366b713d7d75ec4722161850e3d9f5298b8.zip Qt-9ce13366b713d7d75ec4722161850e3d9f5298b8.tar.gz Qt-9ce13366b713d7d75ec4722161850e3d9f5298b8.tar.bz2 |
Merge branch 'softkeys' of git@scm.dev.nokia.troll.no:qt/qt-s60-public into softkeys
-rw-r--r-- | src/gui/softkeys/main.cpp | 29 | ||||
-rw-r--r-- | src/gui/softkeys/qsoftkeyaction.h | 1 | ||||
-rw-r--r-- | src/gui/softkeys/qsoftkeystack.cpp | 8 | ||||
-rw-r--r-- | src/gui/widgets/qmenu_symbian.cpp | 13 |
4 files changed, 28 insertions, 23 deletions
diff --git a/src/gui/softkeys/main.cpp b/src/gui/softkeys/main.cpp index e5a7065..a61e512 100644 --- a/src/gui/softkeys/main.cpp +++ b/src/gui/softkeys/main.cpp @@ -11,8 +11,8 @@ #include <QApplication> #include <QMainWindow> -#include <QPushButton> -#include <QVBoxLayout> +#include <QMenuBar> + #include "qsoftkeystack.h" class MainWindow : public QMainWindow @@ -26,22 +26,26 @@ public: MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { - QWidget *central = new QWidget(this); - QVBoxLayout *layout = new QVBoxLayout(central); - QPushButton *button = new QPushButton("Hello"); - layout->addWidget(button); + QWidget *central = new QWidget(this); + + QMenuBar* menuBar = new QMenuBar(this); + menuBar->addAction("MyMenuItem1"); + this->setMenuBar(menuBar); QSoftKeyStack *stack = new QSoftKeyStack(central); QSoftKeyAction action1(central); - action1.setText(QString("text1")); + action1.setText(QString("Ok")); action1.setRole(QSoftKeyAction::Ok); QSoftKeyAction action2(central); - action2.setText(QString("text2")); + action2.setText(QString("Back")); action2.setRole(QSoftKeyAction::Back); QSoftKeyAction action3(central); - action3.setText(QString("text3")); + action3.setText(QString("Cancel")); action3.setRole(QSoftKeyAction::Cancel); + QSoftKeyAction action4(central); + action4.setText(QString("Menu")); + action4.setRole(QSoftKeyAction::Menu); QList<QSoftKeyAction*> myActionList; myActionList.append(&action1); @@ -50,6 +54,13 @@ MainWindow::MainWindow(QWidget *parent) stack->push(myActionList); stack->pop(); stack->push(&action1); + stack->pop(); + + QList<QSoftKeyAction*> myActionList2; + myActionList2.append(&action4); + myActionList2.append(&action1); + stack->push(myActionList2); + setCentralWidget(central); } diff --git a/src/gui/softkeys/qsoftkeyaction.h b/src/gui/softkeys/qsoftkeyaction.h index 85f5bc7..76be8ee 100644 --- a/src/gui/softkeys/qsoftkeyaction.h +++ b/src/gui/softkeys/qsoftkeyaction.h @@ -36,6 +36,7 @@ public: RevertEdit, Deselect, Finish, + Menu, Custom }; diff --git a/src/gui/softkeys/qsoftkeystack.cpp b/src/gui/softkeys/qsoftkeystack.cpp index bd9a636..c1d6e98 100644 --- a/src/gui/softkeys/qsoftkeystack.cpp +++ b/src/gui/softkeys/qsoftkeystack.cpp @@ -64,12 +64,18 @@ void QSoftKeyStackPrivate::setNativeSoftKeys() QSoftkeySet top = softKeyStack.top(); mapSoftKeys(top); + for (int index=0;index<top.count();index++) { QSoftKeyAction* softKeyAction = top.at(index); HBufC* text = qt_QString2HBufCNewL(softKeyAction->text()); CleanupStack::PushL(text); - nativeContainer->SetCommandL(softKeyAction->nativePosition(), SOFTKEYSTART+softKeyAction->qtContextKey(), *text); + if (softKeyAction->role() == QSoftKeyAction::Menu) { + nativeContainer->SetCommandL(softKeyAction->nativePosition(), EAknSoftkeyOptions, *text); + } + else { + nativeContainer->SetCommandL(softKeyAction->nativePosition(), SOFTKEYSTART+softKeyAction->qtContextKey(), *text); + } CleanupStack::PopAndDestroy(); } } diff --git a/src/gui/widgets/qmenu_symbian.cpp b/src/gui/widgets/qmenu_symbian.cpp index aee55b9..1dc727c 100644 --- a/src/gui/widgets/qmenu_symbian.cpp +++ b/src/gui/widgets/qmenu_symbian.cpp @@ -173,21 +173,9 @@ void deleteAll(QList<SymbianMenuItem*> *items) } } -static void setSoftkeys() -{ - CEikButtonGroupContainer* cba = CEikonEnv::Static()->AppUiFactory()->Cba(); - if (cba){ - if (menuExists()) - cba->SetCommandSetL(R_AVKON_SOFTKEYS_OPTIONS_EXIT); - else - cba->SetCommandSetL(R_AVKON_SOFTKEYS_EXIT); - } -} - static void rebuildMenu() { QMenuBarPrivate *mb = 0; - setSoftkeys(); QWidget *w = qApp->activeWindow(); if (w) { @@ -372,7 +360,6 @@ void QMenuBarPrivate::QSymbianMenuBarPrivate::removeAction(QSymbianMenuAction *a void QMenuBarPrivate::QSymbianMenuBarPrivate::rebuild() { - setSoftkeys(); qt_symbian_menu_static_cmd_id = QT_FIRST_MENU_ITEM; deleteAll( &symbianMenus ); if (!d) |