author | zecke <zecke> | 2004-02-05 16:44:20 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-02-05 16:44:20 (UTC) |
commit | 4c4ed7176231558d01aeca2eb705fc6810ec7766 (patch) (unidiff) | |
tree | d923fd4ca70d6db917a0e154a5a642a444cab87e /core/applets/vtapplet | |
parent | ef8ece225a663f0ff1262989085fc214500beebe (diff) | |
download | opie-4c4ed7176231558d01aeca2eb705fc6810ec7766.zip opie-4c4ed7176231558d01aeca2eb705fc6810ec7766.tar.gz opie-4c4ed7176231558d01aeca2eb705fc6810ec7766.tar.bz2 |
Stuff can be broken if you really want it... or because only root can open /dev/console...
Anyway have a mutable QPopupMenu in the class and remove unsigned long ref
as we don't need it
-rw-r--r-- | core/applets/vtapplet/vt.cpp | 18 | ||||
-rw-r--r-- | core/applets/vtapplet/vt.h | 4 |
2 files changed, 10 insertions, 12 deletions
diff --git a/core/applets/vtapplet/vt.cpp b/core/applets/vtapplet/vt.cpp index cdd3c97..881eb41 100644 --- a/core/applets/vtapplet/vt.cpp +++ b/core/applets/vtapplet/vt.cpp | |||
@@ -29,9 +29,9 @@ | |||
29 | 29 | ||
30 | #include "vt.h" | 30 | #include "vt.h" |
31 | 31 | ||
32 | VTApplet::VTApplet ( ) | 32 | VTApplet::VTApplet ( ) |
33 | : QObject ( 0, "VTApplet" ), ref ( 0 ) | 33 | : QObject ( 0, "VTApplet" ) |
34 | { | 34 | { |
35 | } | 35 | } |
36 | 36 | ||
37 | VTApplet::~VTApplet ( ) | 37 | VTApplet::~VTApplet ( ) |
@@ -83,21 +83,21 @@ QPopupMenu *VTApplet::popup ( QWidget* parent ) const | |||
83 | int fd = ::open( "/dev/tty0", O_RDWR ); | 83 | int fd = ::open( "/dev/tty0", O_RDWR ); |
84 | if ( fd == -1 ) return 0; | 84 | if ( fd == -1 ) return 0; |
85 | if ( ioctl( fd, VT_GETSTATE, &vtstat ) == -1 ) return 0; | 85 | if ( ioctl( fd, VT_GETSTATE, &vtstat ) == -1 ) return 0; |
86 | 86 | ||
87 | submenu = new QPopupMenu( parent ); | 87 | m_subMenu = new QPopupMenu( parent ); |
88 | submenu->setCheckable( true ); | 88 | m_subMenu->setCheckable( true ); |
89 | for ( int i = 1; i < 10; ++i ) | 89 | for ( int i = 1; i < 10; ++i ) |
90 | { | 90 | { |
91 | int id = submenu->insertItem( QString::number( i ), 500+i ); | 91 | int id = m_subMenu->insertItem( QString::number( i ), 500+i ); |
92 | submenu->setItemChecked( id, id-500 == vtstat.v_active ); | 92 | m_subMenu->setItemChecked( id, id-500 == vtstat.v_active ); |
93 | } | 93 | } |
94 | ::close( fd ); | 94 | ::close( fd ); |
95 | 95 | ||
96 | connect( submenu, SIGNAL( activated(int) ), this, SLOT( changeVT(int) ) ); | 96 | connect( m_subMenu, SIGNAL( activated(int) ), this, SLOT( changeVT(int) ) ); |
97 | connect( submenu, SIGNAL( aboutToShow() ), this, SLOT( updateMenu() ) ); | 97 | connect( m_subMenu, SIGNAL( aboutToShow() ), this, SLOT( updateMenu() ) ); |
98 | 98 | ||
99 | return submenu; | 99 | return m_subMenu; |
100 | } | 100 | } |
101 | 101 | ||
102 | 102 | ||
103 | void VTApplet::changeVT( int index ) | 103 | void VTApplet::changeVT( int index ) |
@@ -127,9 +127,9 @@ void VTApplet::updateMenu() | |||
127 | else | 127 | else |
128 | qDebug( "VT %d _not_ disallocated == busy", i ); | 128 | qDebug( "VT %d _not_ disallocated == busy", i ); |
129 | */ | 129 | */ |
130 | 130 | ||
131 | submenu->setItemEnabled( 500+i, result == -1 ); | 131 | m_subMenu->setItemEnabled( 500+i, result == -1 ); |
132 | } | 132 | } |
133 | 133 | ||
134 | ::close( fd ); | 134 | ::close( fd ); |
135 | } | 135 | } |
diff --git a/core/applets/vtapplet/vt.h b/core/applets/vtapplet/vt.h index 6bdb9e0..4c92ddd 100644 --- a/core/applets/vtapplet/vt.h +++ b/core/applets/vtapplet/vt.h | |||
@@ -43,12 +43,10 @@ public: | |||
43 | 43 | ||
44 | public slots: | 44 | public slots: |
45 | virtual void changeVT( int index ); | 45 | virtual void changeVT( int index ); |
46 | virtual void updateMenu(); | 46 | virtual void updateMenu(); |
47 | |||
48 | private: | 47 | private: |
49 | ulong ref; | 48 | mutable QPopupMenu* m_subMenu; |
50 | }; | 49 | }; |
51 | 50 | ||
52 | static QPopupMenu* submenu; | ||
53 | 51 | ||
54 | #endif | 52 | #endif |