-rw-r--r-- | library/qpemenubar.cpp | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/library/qpemenubar.cpp b/library/qpemenubar.cpp index 3e5bad5..1d8eff4 100644 --- a/library/qpemenubar.cpp +++ b/library/qpemenubar.cpp | |||
@@ -1,89 +1,88 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the 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. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #define INCLUDE_MENUITEM_DEF | 21 | #define INCLUDE_MENUITEM_DEF |
22 | 22 | ||
23 | #include "qpemenubar.h" | 23 | #include "qpemenubar.h" |
24 | #include <qapplication.h> | 24 | #include <qapplication.h> |
25 | #include <qguardedptr.h> | ||
26 | #include <qtimer.h> | 25 | #include <qtimer.h> |
27 | 26 | ||
28 | 27 | ||
29 | class QMenuBarHack : public QMenuBar | 28 | class QMenuBarHack : public QMenuBar |
30 | { | 29 | { |
31 | public: | 30 | public: |
32 | int activeItem() const { return actItem; } | 31 | int activeItem() const { return actItem; } |
33 | 32 | ||
34 | void goodbye() | 33 | void goodbye() |
35 | { | 34 | { |
36 | activateItemAt(-1); | 35 | activateItemAt(-1); |
37 | for ( unsigned int i = 0; i < count(); i++ ) { | 36 | for ( unsigned int i = 0; i < count(); i++ ) { |
38 | QMenuItem *mi = findItem( idAt(i) ); | 37 | QMenuItem *mi = findItem( idAt(i) ); |
39 | if ( mi->popup() ) { | 38 | if ( mi->popup() ) { |
40 | mi->popup()->hide(); | 39 | mi->popup()->hide(); |
41 | } | 40 | } |
42 | } | 41 | } |
43 | } | 42 | } |
44 | }; | 43 | }; |
45 | 44 | ||
46 | 45 | ||
47 | // Sharp ROM compatibility | 46 | // Sharp ROM compatibility |
48 | void QPEMenuToolFocusManager::setMenukeyEnabled ( bool ) | 47 | void QPEMenuToolFocusManager::setMenukeyEnabled ( bool ) |
49 | { | 48 | { |
50 | } | 49 | } |
51 | int QPEMenuBar::getOldFocus ( ) | 50 | int QPEMenuBar::getOldFocus ( ) |
52 | { | 51 | { |
53 | return 0; | 52 | return 0; |
54 | } | 53 | } |
55 | 54 | ||
56 | QPEMenuToolFocusManager *QPEMenuToolFocusManager::me = 0; | 55 | QPEMenuToolFocusManager *QPEMenuToolFocusManager::me = 0; |
57 | 56 | ||
58 | QPEMenuToolFocusManager::QPEMenuToolFocusManager() : QObject() | 57 | QPEMenuToolFocusManager::QPEMenuToolFocusManager() : QObject() |
59 | { | 58 | { |
60 | qApp->installEventFilter( this ); | 59 | qApp->installEventFilter( this ); |
61 | } | 60 | } |
62 | 61 | ||
63 | void QPEMenuToolFocusManager::addWidget( QWidget *w ) | 62 | void QPEMenuToolFocusManager::addWidget( QWidget *w ) |
64 | { | 63 | { |
65 | list.append( GuardedWidget(w) ); | 64 | list.append( GuardedWidget(w) ); |
66 | } | 65 | } |
67 | 66 | ||
68 | void QPEMenuToolFocusManager::removeWidget( QWidget *w ) | 67 | void QPEMenuToolFocusManager::removeWidget( QWidget *w ) |
69 | { | 68 | { |
70 | list.remove( GuardedWidget(w) ); | 69 | list.remove( GuardedWidget(w) ); |
71 | } | 70 | } |
72 | 71 | ||
73 | void QPEMenuToolFocusManager::setActive( bool a ) | 72 | void QPEMenuToolFocusManager::setActive( bool a ) |
74 | { | 73 | { |
75 | if ( a ) { | 74 | if ( a ) { |
76 | oldFocus = qApp->focusWidget(); | 75 | oldFocus = qApp->focusWidget(); |
77 | QValueList<GuardedWidget>::Iterator it; | 76 | QValueList<GuardedWidget>::Iterator it; |
78 | it = list.begin(); | 77 | it = list.begin(); |
79 | while ( it != list.end() ) { | 78 | while ( it != list.end() ) { |
80 | QWidget *w = (*it); | 79 | QWidget *w = (*it); |
81 | if ( w && w->isEnabled() && w->isVisible() && | 80 | if ( w && w->isEnabled() && w->isVisible() && |
82 | w->topLevelWidget() == qApp->activeWindow() ) { | 81 | w->topLevelWidget() == qApp->activeWindow() ) { |
83 | setFocus( w ); | 82 | setFocus( w ); |
84 | return; | 83 | return; |
85 | } | 84 | } |
86 | ++it; | 85 | ++it; |
87 | } | 86 | } |
88 | } else { | 87 | } else { |
89 | if ( inFocus ) { | 88 | if ( inFocus ) { |