-rw-r--r-- | noncore/applets/networkapplet/networkapplet.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/applets/networkapplet/networkapplet.cpp b/noncore/applets/networkapplet/networkapplet.cpp index 3019456..4e658da 100644 --- a/noncore/applets/networkapplet/networkapplet.cpp +++ b/noncore/applets/networkapplet/networkapplet.cpp | |||
@@ -110,97 +110,97 @@ NetworkAppletControl::NetworkAppletControl( OTaskbarApplet* parent, const char* | |||
110 | l = new QVBoxLayout( this, 4, 2 ); | 110 | l = new QVBoxLayout( this, 4, 2 ); |
111 | } | 111 | } |
112 | 112 | ||
113 | 113 | ||
114 | void NetworkAppletControl::build() | 114 | void NetworkAppletControl::build() |
115 | { | 115 | { |
116 | ONetwork::InterfaceIterator it = ONetwork::instance()->iterator(); | 116 | ONetwork::InterfaceIterator it = ONetwork::instance()->iterator(); |
117 | while ( it.current() ) | 117 | while ( it.current() ) |
118 | { | 118 | { |
119 | QHBoxLayout* h = new QHBoxLayout( l ); | 119 | QHBoxLayout* h = new QHBoxLayout( l ); |
120 | QLabel* symbol = new QLabel( this ); | 120 | QLabel* symbol = new QLabel( this ); |
121 | symbol->setPixmap( Resource::loadPixmap( guessDevice( it.current() ) ) ); | 121 | symbol->setPixmap( Resource::loadPixmap( guessDevice( it.current() ) ) ); |
122 | h->addWidget( symbol ); | 122 | h->addWidget( symbol ); |
123 | symbol->show(); | 123 | symbol->show(); |
124 | 124 | ||
125 | QLabel* name = new QLabel( it.current()->name(), this ); | 125 | QLabel* name = new QLabel( it.current()->name(), this ); |
126 | name->setFixedWidth( 35 ); | 126 | name->setFixedWidth( 35 ); |
127 | h->addWidget( name ); | 127 | h->addWidget( name ); |
128 | name->show(); | 128 | name->show(); |
129 | 129 | ||
130 | IfaceIPAddress* ip = new IfaceIPAddress( this, it.current()->name() ); | 130 | IfaceIPAddress* ip = new IfaceIPAddress( this, it.current()->name() ); |
131 | h->addWidget( ip ); | 131 | h->addWidget( ip ); |
132 | ip->show(); | 132 | ip->show(); |
133 | 133 | ||
134 | IfaceUpDownButton* tb = new IfaceUpDownButton( this, it.current()->name() ); | 134 | IfaceUpDownButton* tb = new IfaceUpDownButton( this, it.current()->name() ); |
135 | tb->show(); | 135 | tb->show(); |
136 | 136 | ||
137 | h->addWidget( tb ); | 137 | h->addWidget( tb ); |
138 | 138 | ||
139 | ++it; | 139 | ++it; |
140 | } | 140 | } |
141 | } | 141 | } |
142 | 142 | ||
143 | 143 | ||
144 | NetworkAppletControl::~NetworkAppletControl() | 144 | NetworkAppletControl::~NetworkAppletControl() |
145 | { | 145 | { |
146 | } | 146 | } |
147 | 147 | ||
148 | 148 | ||
149 | QString NetworkAppletControl::guessDevice( ONetworkInterface* iface ) | 149 | QString NetworkAppletControl::guessDevice( ONetworkInterface* iface ) |
150 | { | 150 | { |
151 | if ( iface->isWireless() ) | 151 | if ( iface->isWireless() ) |
152 | return "networksettings/wlan"; | 152 | return "networksettings/wlan"; |
153 | if ( iface->isLoopback() ) | 153 | if ( iface->isLoopback() ) |
154 | return "networksettings/lo"; | 154 | return "networksettings/lo"; |
155 | if ( QString( iface->name() ).contains( "usb" ) ) | 155 | if ( QString( iface->name() ).contains( "usb" ) ) |
156 | return "networksettings/usb"; | 156 | return "networksettings/usb"; |
157 | if ( QString( iface->name() ).contains( "ir" ) ) | 157 | if ( QString( iface->name() ).contains( "ir" ) ) |
158 | return "networksettings/ir"; | 158 | return "networksettings/irda"; |
159 | 159 | ||
160 | //TODO: Insert neat symbol and check for tunnel devices | 160 | //TODO: Insert neat symbol and check for tunnel devices |
161 | 161 | ||
162 | return "networksettings/lan"; | 162 | return "networksettings/lan"; |
163 | 163 | ||
164 | } | 164 | } |
165 | 165 | ||
166 | 166 | ||
167 | void NetworkAppletControl::showEvent( QShowEvent* e ) | 167 | void NetworkAppletControl::showEvent( QShowEvent* e ) |
168 | { | 168 | { |
169 | qDebug( "showEvent" ); | 169 | qDebug( "showEvent" ); |
170 | build(); | 170 | build(); |
171 | QWidget::showEvent( e ); | 171 | QWidget::showEvent( e ); |
172 | } | 172 | } |
173 | 173 | ||
174 | 174 | ||
175 | void NetworkAppletControl::hideEvent( QHideEvent* e ) | 175 | void NetworkAppletControl::hideEvent( QHideEvent* e ) |
176 | { | 176 | { |
177 | qDebug( "hideEvent" ); | 177 | qDebug( "hideEvent" ); |
178 | QWidget::hideEvent( e ); | 178 | QWidget::hideEvent( e ); |
179 | 179 | ||
180 | delete l; | 180 | delete l; |
181 | 181 | ||
182 | // delete all child widgets from this frame | 182 | // delete all child widgets from this frame |
183 | QObjectList* list = const_cast<QObjectList*>( children() ); | 183 | QObjectList* list = const_cast<QObjectList*>( children() ); |
184 | QObjectListIt it(*list); | 184 | QObjectListIt it(*list); |
185 | QObject* obj; | 185 | QObject* obj; |
186 | while ( (obj=it.current()) ) | 186 | while ( (obj=it.current()) ) |
187 | { | 187 | { |
188 | ++it; | 188 | ++it; |
189 | delete obj; | 189 | delete obj; |
190 | } | 190 | } |
191 | 191 | ||
192 | list = const_cast<QObjectList*>( children() ); | 192 | list = const_cast<QObjectList*>( children() ); |
193 | if ( list ) | 193 | if ( list ) |
194 | qWarning( "D'oh! We still have %d children...", list->count() ); | 194 | qWarning( "D'oh! We still have %d children...", list->count() ); |
195 | 195 | ||
196 | // renew layout | 196 | // renew layout |
197 | l = new QVBoxLayout( this, 4, 2 ); | 197 | l = new QVBoxLayout( this, 4, 2 ); |
198 | resize( 0, 0 ); | 198 | resize( 0, 0 ); |
199 | } | 199 | } |
200 | 200 | ||
201 | 201 | ||
202 | QSize NetworkAppletControl::sizeHint() const | 202 | QSize NetworkAppletControl::sizeHint() const |
203 | { | 203 | { |
204 | ONetwork::instance()->synchronize(); // rebuild interface database | 204 | ONetwork::instance()->synchronize(); // rebuild interface database |
205 | qDebug( "sizeHint (#ifaces=%d)", ONetwork::instance()->count() ); | 205 | qDebug( "sizeHint (#ifaces=%d)", ONetwork::instance()->count() ); |
206 | return QSize( 14+35+105+14 + 8, ONetwork::instance()->count() * 26 ); | 206 | return QSize( 14+35+105+14 + 8, ONetwork::instance()->count() * 26 ); |