From 61b111228d0abf66130b229fcb6c5e2a54faecbf Mon Sep 17 00:00:00 2001 From: Markku Luukkainen Date: Tue, 12 May 2009 15:24:43 +0200 Subject: Removed setting native softkeys from menu implementation as from now on the menu softkey will be set by the brand new softkey stack. --- src/gui/widgets/qmenu_symbian.cpp | 13 ------------- 1 file changed, 13 deletions(-) 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 *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) -- cgit v0.12 From 9ef6e374126ba212bccbf3cf61f86f8412099c49 Mon Sep 17 00:00:00 2001 From: Markku Luukkainen Date: Tue, 12 May 2009 15:31:18 +0200 Subject: Initial naive implementation for menu softkey --- src/gui/softkeys/main.cpp | 29 ++++++++++++++++++++--------- src/gui/softkeys/qsoftkeyaction.h | 1 + 2 files changed, 21 insertions(+), 9 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 #include -#include -#include +#include + #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 myActionList; myActionList.append(&action1); @@ -50,6 +54,13 @@ MainWindow::MainWindow(QWidget *parent) stack->push(myActionList); stack->pop(); stack->push(&action1); + stack->pop(); + + QList 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 }; -- cgit v0.12 From 21d8da6365281426c50d6d5b8393d833e16d4096 Mon Sep 17 00:00:00 2001 From: Markku Luukkainen Date: Tue, 12 May 2009 16:17:35 +0200 Subject: Added handling of softkey with the role of menu --- src/gui/softkeys/qsoftkeystack.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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;indextext()); 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(); } } -- cgit v0.12