From 30525b802f17c2c815f02d81a1c771b8cee71458 Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Wed, 17 Jun 2009 16:38:41 +0200 Subject: Improve softkey implementation and add a default 'Exit' button to RSK. The previous implementation had some problems where the actual position of the softkey was determined by it's position in the list. This is suboptimal since the position should be tied to the role. Actions that have "negative" conotation should be located on the right soft key (RSK) while "positive" actions go on the left soft key (LSK). This is according to the S60 User Interface Guide. It is also standard practice in S60 to have an 'Exit' button on the RSK so we add one of those if there is not already a key present there. Task-number: 256365 Reviewed-by: Markku Luukkainen --- src/gui/kernel/qaction.h | 9 +++--- src/gui/kernel/qwidget_s60.cpp | 65 +++++++++++++++++++++++++++++++----------- 2 files changed, 53 insertions(+), 21 deletions(-) diff --git a/src/gui/kernel/qaction.h b/src/gui/kernel/qaction.h index dfa4933..3449acf 100644 --- a/src/gui/kernel/qaction.h +++ b/src/gui/kernel/qaction.h @@ -91,11 +91,10 @@ class Q_GUI_EXPORT QAction : public QObject public: enum MenuRole { NoRole, TextHeuristicRole, ApplicationSpecificRole, AboutQtRole, AboutRole, PreferencesRole, QuitRole }; - enum SoftKeyRole { OptionsSoftKey, SelectSoftKey, BackSoftKey, NextSoftKey, PreviousSoftKey, - OkSoftKey, CancelSoftKey, EditSoftKey, ViewSoftKey, BackSpaceSoftKey, - EndEditSoftKey, RevertEditSoftKey, DeselectSoftKey, FinishSoftKey, - MenuSoftKey, ContextMenuSoftKey, ExitSoftKey, Key1SoftKey, Key2SoftKey, - Key3SoftKey, Key4SoftKey, CustomSoftKey }; + enum SoftKeyRole { OptionsSoftKey, SelectSoftKey, BackSoftKey, NextSoftKey, PreviousSoftKey, + OkSoftKey, CancelSoftKey, EditSoftKey, ViewSoftKey, BackSpaceSoftKey, + EndEditSoftKey, RevertEditSoftKey, DeselectSoftKey, FinishSoftKey, + MenuSoftKey, ContextMenuSoftKey, ExitSoftKey }; explicit QAction(QObject* parent); QAction(const QString &text, QObject* parent); QAction(const QIcon &icon, const QString &text, QObject* parent); diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index bc69d6d..6109f17 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -85,29 +85,62 @@ void QWidgetPrivate::setSoftKeys_sys(const QList &softkeys) if (isEqual(old, softkeys )) return; } - CCoeAppUi* appui = CEikonEnv::Static()->AppUi(); - CAknAppUi* aknAppUi = static_cast (appui); - CEikButtonGroupContainer* nativeContainer = aknAppUi->Cba(); + CEikButtonGroupContainer* nativeContainer = S60->buttonGroupContainer(); nativeContainer->SetCommandSetL(R_AVKON_SOFTKEYS_EMPTY_WITH_IDS); - int placeInScreen=0; + int position = -1; + int command; + bool needsExitButton = true; + for (int index = 0; index < softkeys.count(); index++) { const QAction* softKeyAction = softkeys.at(index); - if (softKeyAction->softKeyRole() != QAction::ContextMenuSoftKey) { + switch (softKeyAction->softKeyRole()) { + // Positive Actions go on LSK + case QAction::OptionsSoftKey: + case QAction::MenuSoftKey: + case QAction::ContextMenuSoftKey: + command = EAknSoftkeyOptions; //Calls DynInitMenuPane in AppUI + position = 0; + break; + case QAction::SelectSoftKey: + case QAction::PreviousSoftKey: + case QAction::OkSoftKey: + case QAction::EditSoftKey: + case QAction::ViewSoftKey: + case QAction::EndEditSoftKey: + case QAction::FinishSoftKey: + command = SOFTKEYSTART + index; + position = 0; + break; + // Negative Actions on the RSK + case QAction::BackSoftKey: + case QAction::NextSoftKey: + case QAction::CancelSoftKey: + case QAction::BackSpaceSoftKey: + case QAction::RevertEditSoftKey: + case QAction::DeselectSoftKey: + needsExitButton = false; + command = SOFTKEYSTART + index; + position = 2; + break; + case QAction::ExitSoftKey: + needsExitButton = false; + command = EAknSoftkeyExit; //Calls HandleCommand in AppUI + position = 2; + break; + default: + break; + } - HBufC* text = qt_QString2HBufC(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 (position != -1) { + TPtrC text = qt_QString2TPtrC(softKeyAction->text()); + nativeContainer->SetCommandL(position, command, text); } - if (placeInScreen==1) - placeInScreen=2; } + + if (needsExitButton) + nativeContainer->SetCommandL(2, EAknSoftkeyExit, qt_QString2TPtrC(QObject::tr("Exit"))); + nativeContainer->DrawDeferred(); // 3.1 needs an extra invitation } -- cgit v0.12 From 4a5a9b23f41afb062fae4aaab429fcef35b3d42c Mon Sep 17 00:00:00 2001 From: Markku Luukkainen Date: Wed, 17 Jun 2009 16:40:46 +0200 Subject: added changes done to tower --- dist/changes-4.5.2-tower | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/dist/changes-4.5.2-tower b/dist/changes-4.5.2-tower index 41dc8c8..9d28465 100644 --- a/dist/changes-4.5.2-tower +++ b/dist/changes-4.5.2-tower @@ -198,6 +198,13 @@ Optimizations * Fixed active scheduler removal when calling QThread::terminate * Fix to Open C bug: select sometimes returns -1 and errno is ECONNREFUSED +- QWidget + * Added API for setting softkeys +- QMenuBar + * Native menus are handled properly even when application has multiple QMainWindows + * Fixed a bug causing both native and qt menu to be created + * Fix for disappearing options menu after coming back from dialog + **************************************************************************** * Examples and demos * @@ -224,12 +231,15 @@ Optimizations since the issue has been fixed in qmake. * Included drilldown to demonstrate QtSql usage * Updated screenshots to S60 style + * Added softkeys example + +- Softkeys + * New example showing how to use softkeys API in QWidget **************************************************************************** * Tools * **************************************************************************** - - qmake * Support for generating Symbian "test" targets: CONFIG += symbian_test. * Support for Symbian Build System, version 2 (aka Raptor) via @@ -259,7 +269,7 @@ Optimizations * Will now patch also vendor id. **************************************************************************** -* Documnetation * +* Documentation * **************************************************************************** - qmake-manual * 250370: Added documentation for ICON keyword -- cgit v0.12 From bb0be7961f66b8d351c39d61fc0ab3f38d032223 Mon Sep 17 00:00:00 2001 From: Markku Luukkainen Date: Wed, 17 Jun 2009 16:55:11 +0200 Subject: Renamed "menu" to "options" for S60. This follows the native style --- src/gui/widgets/qmainwindow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/widgets/qmainwindow.cpp b/src/gui/widgets/qmainwindow.cpp index 5f8371c..394523a 100644 --- a/src/gui/widgets/qmainwindow.cpp +++ b/src/gui/widgets/qmainwindow.cpp @@ -482,7 +482,7 @@ void QMainWindow::setMenuBar(QMenuBar *menuBar) } d->layout->setMenuBar(menuBar); if (menuBar) { - QAction* menu = new QAction(QString::fromLatin1("Menu"), this); + QAction* menu = new QAction(QString::fromLatin1("Options"), this); menu->setSoftKeyRole(QAction::MenuSoftKey); setSoftKey(menu); } @@ -1400,7 +1400,7 @@ bool QMainWindow::event(QEvent *event) case QEvent::WindowActivate: if (d->layout->menuBar()) { // ### TODO: This is evil, there is no need to create a new action every time - QAction* menu = new QAction(QString::fromLatin1("Menu"), this); + QAction* menu = new QAction(QString::fromLatin1("Options"), this); menu->setSoftKeyRole(QAction::MenuSoftKey); setSoftKey(menu); } -- cgit v0.12 From 1ec7f4029a47d22f7585c554d32ae975946ab3ce Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Wed, 17 Jun 2009 17:24:37 +0200 Subject: aportales changes for Qt for S60 "Tower" --- dist/changes-4.5.2-tower | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/dist/changes-4.5.2-tower b/dist/changes-4.5.2-tower index 9d28465..1ed5aaa 100644 --- a/dist/changes-4.5.2-tower +++ b/dist/changes-4.5.2-tower @@ -61,6 +61,11 @@ Features - QSslSocket * Added support for -openssl option i.e. runtime resolving of OpenSSL symbols + +- QWidget + * Basic widgets are now navigatable and usable via keypad on SDK 3 + FP 1 and FP 2. + - todo * todo @@ -169,6 +174,8 @@ Optimizations * Fix for frame masks with color depth other than EGrey2. * Fix for squeezed QTabBars. * Fix memory leak when color skinning graphics. + * Show focus/Editfocus visualization for KeyPad navigation on + SDK 3 FP 1 and FP 2 - QDesktopServices * Switched QDesktopServices mail-to URL handling to RSendAs in Symbian, @@ -198,13 +205,21 @@ Optimizations * Fixed active scheduler removal when calling QThread::terminate * Fix to Open C bug: select sometimes returns -1 and errno is ECONNREFUSED + - QWidget * Added API for setting softkeys + - QMenuBar * Native menus are handled properly even when application has multiple QMainWindows * Fixed a bug causing both native and qt menu to be created * Fix for disappearing options menu after coming back from dialog +- QFontDataBase + * Now, also fonts from the user's /resources/fonts direactories are + available. + +- QFontMetrics + * Fixed the boundingRect calculation for text. **************************************************************************** * Examples and demos * -- cgit v0.12