summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qsoftkeymanager_s60.cpp
diff options
context:
space:
mode:
authorJyri Tahtela <jyri.tahtela@nokia.com>2011-05-13 11:30:46 (GMT)
committerJyri Tahtela <jyri.tahtela@nokia.com>2011-05-13 11:30:46 (GMT)
commit50ea2454c0ad9b28be6dd5125c74466f0f96d16a (patch)
tree610e8b4852bca7d23ec5c4b9937a119eed96a124 /src/gui/kernel/qsoftkeymanager_s60.cpp
parent0f750aec4507fffc06acea46a513c6d374564d6a (diff)
parenta80130b07c5b8ee4b06eabbceb65eb23d4d4602e (diff)
downloadQt-50ea2454c0ad9b28be6dd5125c74466f0f96d16a.zip
Qt-50ea2454c0ad9b28be6dd5125c74466f0f96d16a.tar.gz
Qt-50ea2454c0ad9b28be6dd5125c74466f0f96d16a.tar.bz2
Merge remote-tracking branch 'qt/4.8'
Conflicts: src/s60installs/eabi/QtOpenGLu.def
Diffstat (limited to 'src/gui/kernel/qsoftkeymanager_s60.cpp')
-rw-r--r--src/gui/kernel/qsoftkeymanager_s60.cpp40
1 files changed, 30 insertions, 10 deletions
diff --git a/src/gui/kernel/qsoftkeymanager_s60.cpp b/src/gui/kernel/qsoftkeymanager_s60.cpp
index 79ed91a..d80cf8a 100644
--- a/src/gui/kernel/qsoftkeymanager_s60.cpp
+++ b/src/gui/kernel/qsoftkeymanager_s60.cpp
@@ -278,12 +278,6 @@ bool QSoftKeyManagerPrivateS60::setSoftkeyImage(CEikButtonGroupContainer *cba,
EikSoftkeyImage::SetImage(cba, *myimage, left); // Takes myimage ownership
cbaHasImage[position] = true;
ret = true;
- } else {
- // Restore softkey to text based
- if (cbaHasImage[position]) {
- EikSoftkeyImage::SetLabel(cba, left);
- cbaHasImage[position] = false;
- }
}
}
return ret;
@@ -294,7 +288,7 @@ bool QSoftKeyManagerPrivateS60::setSoftkey(CEikButtonGroupContainer &cba,
{
QAction *action = highestPrioritySoftkey(role);
if (action) {
- setSoftkeyImage(&cba, *action, position);
+ bool hasImage = setSoftkeyImage(&cba, *action, position);
QString text = softkeyText(*action);
TPtrC nativeText = qt_QString2TPtrC(text);
int command = S60_COMMAND_START + position;
@@ -303,6 +297,11 @@ bool QSoftKeyManagerPrivateS60::setSoftkey(CEikButtonGroupContainer &cba,
command = softKeyCommandActions.value(action);
#endif
setNativeSoftkey(cba, position, command, nativeText);
+ if (!hasImage && cbaHasImage[position]) {
+ EikSoftkeyImage::SetLabel(&cba, (position == LSK_POSITION));
+ cbaHasImage[position] = false;
+ }
+
const bool dimmed = !action->isEnabled() && !QSoftKeyManager::isForceEnabledInSofkeys(action);
cba.DimCommand(command, dimmed);
realSoftKeyActions.insert(command, action);
@@ -313,7 +312,18 @@ bool QSoftKeyManagerPrivateS60::setSoftkey(CEikButtonGroupContainer &cba,
bool QSoftKeyManagerPrivateS60::setLeftSoftkey(CEikButtonGroupContainer &cba)
{
- return setSoftkey(cba, QAction::PositiveSoftKey, LSK_POSITION);
+ if (!setSoftkey(cba, QAction::PositiveSoftKey, LSK_POSITION)) {
+ if (cbaHasImage[LSK_POSITION]) {
+ // Clear any residual icon if LSK has no action. A real softkey
+ // is needed for SetLabel command to work, so do a temporary dummy
+ setNativeSoftkey(cba, LSK_POSITION, EAknSoftkeyExit, KNullDesC);
+ EikSoftkeyImage::SetLabel(&cba, true);
+ setNativeSoftkey(cba, LSK_POSITION, EAknSoftkeyEmpty, KNullDesC);
+ cbaHasImage[LSK_POSITION] = false;
+ }
+ return false;
+ }
+ return true;
}
bool QSoftKeyManagerPrivateS60::setMiddleSoftkey(CEikButtonGroupContainer &cba)
@@ -332,16 +342,26 @@ bool QSoftKeyManagerPrivateS60::setRightSoftkey(CEikButtonGroupContainer &cba)
if (windowType != Qt::Dialog && windowType != Qt::Popup) {
QString text(QSoftKeyManager::tr("Exit"));
TPtrC nativeText = qt_QString2TPtrC(text);
+ setNativeSoftkey(cba, RSK_POSITION, EAknSoftkeyExit, nativeText);
if (cbaHasImage[RSK_POSITION]) {
EikSoftkeyImage::SetLabel(&cba, false);
cbaHasImage[RSK_POSITION] = false;
}
- setNativeSoftkey(cba, RSK_POSITION, EAknSoftkeyExit, nativeText);
cba.DimCommand(EAknSoftkeyExit, false);
return true;
+ } else {
+ if (cbaHasImage[RSK_POSITION]) {
+ // Clear any residual icon if RSK has no action. A real softkey
+ // is needed for SetLabel command to work, so do a temporary dummy
+ setNativeSoftkey(cba, RSK_POSITION, EAknSoftkeyExit, KNullDesC);
+ EikSoftkeyImage::SetLabel(&cba, false);
+ setNativeSoftkey(cba, RSK_POSITION, EAknSoftkeyEmpty, KNullDesC);
+ cbaHasImage[RSK_POSITION] = false;
+ }
+ return false;
}
}
- return false;
+ return true;
}
void QSoftKeyManagerPrivateS60::setSoftkeys(CEikButtonGroupContainer &cba)