-rw-r--r-- | library/qpemenubar.cpp | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/library/qpemenubar.cpp b/library/qpemenubar.cpp index bb3ad8d..f0171ba 100644 --- a/library/qpemenubar.cpp +++ b/library/qpemenubar.cpp | |||
@@ -1,12 +1,12 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2001 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
@@ -242,29 +242,33 @@ bool QPEMenuToolFocusManager::eventFilter( QObject *object, QEvent *event ) | |||
242 | // Deaticvate if a menu/tool has been hidden | 242 | // Deaticvate if a menu/tool has been hidden |
243 | QWidget *w = (QWidget *)object; | 243 | QWidget *w = (QWidget *)object; |
244 | if ( !w->isPopup() && !list.contains( GuardedWidget( w ) ) ) { | 244 | if ( !w->isPopup() && !list.contains( GuardedWidget( w ) ) ) { |
245 | setActive( FALSE ); | 245 | setActive( FALSE ); |
246 | } | 246 | } |
247 | } | 247 | } |
248 | } else if ( event->type() == QEvent::ChildInserted ) { | 248 | } else if ( event->type() == QEvent::ChildInserted ) { |
249 | QChildEvent *ce = (QChildEvent *)event; | 249 | QChildEvent *ce = (QChildEvent *)event; |
250 | if ( ce->child()->inherits( "QMenuBar" ) ) { | 250 | if ( ce->child()->isWidgetType() ) { |
251 | addWidget( (QWidget *)ce->child() ); | 251 | if ( ce->child()->inherits( "QMenuBar" ) ) { |
252 | ce->child()->installEventFilter( this ); | 252 | addWidget( (QWidget *)ce->child() ); |
253 | } else if ( object->inherits( "QToolBar" ) && ce->child()->isWidgetType() ) { | 253 | ce->child()->installEventFilter( this ); |
254 | addWidget( (QWidget *)ce->child() ); | 254 | } else if ( object->inherits( "QToolBar" ) ) { |
255 | addWidget( (QWidget *)ce->child() ); | ||
256 | } | ||
255 | } | 257 | } |
256 | } else if ( event->type() == QEvent::ChildRemoved ) { | 258 | } else if ( event->type() == QEvent::ChildRemoved ) { |
257 | QChildEvent *ce = (QChildEvent *)event; | 259 | QChildEvent *ce = (QChildEvent *)event; |
258 | if ( ce->child()->inherits( "QMenuBar" ) ) { | 260 | if ( ce->child()->isWidgetType() ) { |
259 | removeWidget( (QWidget *)ce->child() ); | 261 | if ( ce->child()->inherits( "QMenuBar" ) ) { |
260 | ce->child()->removeEventFilter( this ); | 262 | removeWidget( (QWidget *)ce->child() ); |
261 | } else if ( object->inherits( "QToolBar" ) && ce->child()->isWidgetType() ) { | 263 | ce->child()->removeEventFilter( this ); |
262 | removeWidget( (QWidget *)ce->child() ); | 264 | } else if ( object->inherits( "QToolBar" ) ) { |
265 | removeWidget( (QWidget *)ce->child() ); | ||
266 | } | ||
263 | } | 267 | } |
264 | } | 268 | } |
265 | 269 | ||
266 | return FALSE; | 270 | return FALSE; |
267 | } | 271 | } |
268 | 272 | ||
269 | void QPEMenuToolFocusManager::deactivate() | 273 | void QPEMenuToolFocusManager::deactivate() |
270 | { | 274 | { |
@@ -274,17 +278,16 @@ void QPEMenuToolFocusManager::deactivate() | |||
274 | /*! | 278 | /*! |
275 | \class QPEMenuBar qpemenubar.h | 279 | \class QPEMenuBar qpemenubar.h |
276 | \brief The QPEMenuBar class is obsolete. Use QMenuBar instead. | 280 | \brief The QPEMenuBar class is obsolete. Use QMenuBar instead. |
277 | 281 | ||
278 | \obsolete | 282 | \obsolete |
279 | 283 | ||
280 | This class is obsolete. Use QMenuBar instead. | 284 | This class is obsolete. Use QMenuBar instead. |
281 | 285 | ||
282 | \sa QMenuBar | ||
283 | */ | 286 | */ |
284 | 287 | ||
285 | /*! | 288 | /*! |
286 | Constructs a QPEMenuBar just as you would construct | 289 | Constructs a QPEMenuBar just as you would construct |
287 | a QMenuBar, passing \a parent and \a name. | 290 | a QMenuBar, passing \a parent and \a name. |
288 | */ | 291 | */ |
289 | QPEMenuBar::QPEMenuBar( QWidget *parent, const char *name ) | 292 | QPEMenuBar::QPEMenuBar( QWidget *parent, const char *name ) |
290 | : QMenuBar( parent, name ) | 293 | : QMenuBar( parent, name ) |
@@ -301,24 +304,22 @@ QPEMenuBar::~QPEMenuBar() | |||
301 | /*! | 304 | /*! |
302 | \internal | 305 | \internal |
303 | */ | 306 | */ |
304 | void QPEMenuBar::keyPressEvent( QKeyEvent *e ) | 307 | void QPEMenuBar::keyPressEvent( QKeyEvent *e ) |
305 | { | 308 | { |
306 | QMenuBar::keyPressEvent( e ); | 309 | QMenuBar::keyPressEvent( e ); |
307 | } | 310 | } |
308 | 311 | ||
309 | 312 | /*! | |
310 | void QPEMenuBar::activateItem( int index ) | 313 | \internal |
311 | { | 314 | */ |
315 | void QPEMenuBar::activateItem( int index ) { | ||
312 | activateItemAt( index ); | 316 | activateItemAt( index ); |
313 | } | 317 | } |
314 | 318 | void QPEMenuBar::goodbye() { | |
315 | void QPEMenuBar::goodbye() | ||
316 | { | ||
317 | activateItemAt(-1); | 319 | activateItemAt(-1); |
318 | for ( unsigned int i = 0; i < count(); i++ ) { | 320 | for ( uint i = 0; i < count(); i++ ) { |
319 | QMenuItem *mi = findItem( idAt(i) ); | 321 | QMenuItem* mi = findItem( idAt(i) ); |
320 | if ( mi->popup() ) { | 322 | if (mi->popup() ) |
321 | mi->popup()->hide(); | 323 | mi->popup()->hide(); |
322 | } | ||
323 | } | 324 | } |
324 | } | 325 | } |