summaryrefslogtreecommitdiff
path: root/library
Side-by-side diff
Diffstat (limited to 'library') (more/less context) (ignore whitespace changes)
-rw-r--r--library/qpemenubar.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/library/qpemenubar.cpp b/library/qpemenubar.cpp
index f0171ba..c658d10 100644
--- a/library/qpemenubar.cpp
+++ b/library/qpemenubar.cpp
@@ -74,97 +74,97 @@ void QPEMenuToolFocusManager::setActive( bool a )
setFocus( w );
return;
}
++it;
}
} else {
if ( inFocus ) {
if ( inFocus->inherits( "QMenuBar" ) )
((QMenuBarHack *)(QWidget *)inFocus)->goodbye();
if ( inFocus->hasFocus() ) {
if ( oldFocus && oldFocus->isVisible() && oldFocus->isEnabled() ) {
oldFocus->setFocus();
} else {
inFocus->clearFocus();
}
}
}
inFocus = 0;
oldFocus = 0;
}
}
bool QPEMenuToolFocusManager::isActive() const
{
return !inFocus.isNull();
}
void QPEMenuToolFocusManager::moveFocus( bool next )
{
if ( !isActive() )
return;
int n = list.count();
QValueList<GuardedWidget>::Iterator it;
it = list.find( inFocus );
if ( it == list.end() )
it = list.begin();
while ( --n ) {
if ( next ) {
++it;
if ( it == list.end() )
it = list.begin();
} else {
if ( it == list.begin() )
it = list.end();
--it;
}
QWidget *w = (*it);
- if ( w && w->isEnabled() && w->isVisible() &&
+ if ( w && w->isEnabled() && w->isVisible() && !w->inherits("QToolBarSeparator") &&
w->topLevelWidget() == qApp->activeWindow() ) {
setFocus( w, next );
return;
}
}
}
void QPEMenuToolFocusManager::initialize()
{
if ( !me )
me = new QPEMenuToolFocusManager;
}
QPEMenuToolFocusManager *QPEMenuToolFocusManager::manager()
{
if ( !me )
me = new QPEMenuToolFocusManager;
return me;
}
void QPEMenuToolFocusManager::setFocus( QWidget *w, bool next )
{
inFocus = w;
// qDebug( "Set focus on %s", w->className() );
if ( inFocus->inherits( "QMenuBar" ) ) {
QMenuBar *mb = (QMenuBar *)(QWidget *)inFocus;
if ( next )
mb->activateItemAt( 0 );
else
mb->activateItemAt( mb->count()-1 );
}
inFocus->setFocus();
}
bool QPEMenuToolFocusManager::eventFilter( QObject *object, QEvent *event )
{
if ( event->type() == QEvent::KeyPress ) {
QKeyEvent *ke = (QKeyEvent *)event;
if ( isActive() ) {
if ( object->inherits( "QButton" ) ) {
switch ( ke->key() ) {
case Key_Left:
moveFocus( FALSE );
return TRUE;
case Key_Right:
moveFocus( TRUE );