summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/networksettings.cpp
Unidiff
Diffstat (limited to 'noncore/settings/networksettings2/networksettings.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/networksettings2/networksettings.cpp6
1 files changed, 1 insertions, 5 deletions
diff --git a/noncore/settings/networksettings2/networksettings.cpp b/noncore/settings/networksettings2/networksettings.cpp
index 9680a96..78b6cce 100644
--- a/noncore/settings/networksettings2/networksettings.cpp
+++ b/noncore/settings/networksettings2/networksettings.cpp
@@ -88,51 +88,49 @@ NetworkSettings::NetworkSettings( QWidget *parent,
88 connect( &(NSResources->system()), 88 connect( &(NSResources->system()),
89 SIGNAL( stdoutLine(const QString &) ), 89 SIGNAL( stdoutLine(const QString &) ),
90 this, SLOT( SLOT_CmdMessage(const QString &) ) ); 90 this, SLOT( SLOT_CmdMessage(const QString &) ) );
91 91
92 connect( &(NSResources->system()), 92 connect( &(NSResources->system()),
93 SIGNAL( stderrLine(const QString &) ), 93 SIGNAL( stderrLine(const QString &) ),
94 this, SLOT( SLOT_CmdMessage(const QString &) ) ); 94 this, SLOT( SLOT_CmdMessage(const QString &) ) );
95 95
96 connect( &(NSResources->system()), 96 connect( &(NSResources->system()),
97 SIGNAL( processEvent(const QString &) ), 97 SIGNAL( processEvent(const QString &) ),
98 this, SLOT( SLOT_CmdMessage(const QString &) ) ); 98 this, SLOT( SLOT_CmdMessage(const QString &) ) );
99 99
100 UpdateTimer->start( 5000 ); 100 UpdateTimer->start( 5000 );
101 connect( UpdateTimer, SIGNAL( timeout() ), 101 connect( UpdateTimer, SIGNAL( timeout() ),
102 this, SLOT( SLOT_RefreshStates() ) ); 102 this, SLOT( SLOT_RefreshStates() ) );
103 103
104 /* Add QCopChannel */ 104 /* Add QCopChannel */
105 connect( qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)), 105 connect( qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)),
106 this, SLOT(SLOT_QCopMessage(const QCString&,const QByteArray&)) ); 106 this, SLOT(SLOT_QCopMessage(const QCString&,const QByteArray&)) );
107} 107}
108 108
109NetworkSettings::~NetworkSettings() { 109NetworkSettings::~NetworkSettings() {
110 QString S; 110 QString S;
111 111
112 owarn << "Dispose NS" << oendl;
113 if( NSD.isModified() ) { 112 if( NSD.isModified() ) {
114 owarn << "Modified" << oendl;
115 S = NSD.saveSettings(); 113 S = NSD.saveSettings();
116 if( ! S.isEmpty() ) { 114 if( ! S.isEmpty() ) {
117 S.insert( 0, "<p>" ); 115 S.insert( 0, "<p>" );
118 S.append( "</p>" ); 116 S.append( "</p>" );
119 // problem saving 117 // problem saving
120 QMessageBox::warning( 118 QMessageBox::warning(
121 0, 119 0,
122 tr( "Saving setup" ), S ); 120 tr( "Saving setup" ), S );
123 } 121 }
124 122
125 SLOT_GenerateConfig(); 123 SLOT_GenerateConfig();
126 NSD.setModified( 0 ); 124 NSD.setModified( 0 );
127 } 125 }
128 126
129} 127}
130 128
131void NetworkSettings::SLOT_CmdMessage( const QString & S ) { 129void NetworkSettings::SLOT_CmdMessage( const QString & S ) {
132 Messages_LB->insertItem( S ); 130 Messages_LB->insertItem( S );
133 Messages_LB->setCurrentItem( Messages_LB->count()-1 ); 131 Messages_LB->setCurrentItem( Messages_LB->count()-1 );
134 Messages_LB->ensureCurrentVisible(); 132 Messages_LB->ensureCurrentVisible();
135} 133}
136 134
137void NetworkSettings::SLOT_RefreshStates( void ) { 135void NetworkSettings::SLOT_RefreshStates( void ) {
138 QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); // remember 136 QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); // remember
@@ -265,54 +263,52 @@ void NetworkSettings::SLOT_EditNode( QListBoxItem * LBI ) {
265 break; 263 break;
266 } 264 }
267 // reenable 265 // reenable
268 UpdateTimer->start( 5000 ); 266 UpdateTimer->start( 5000 );
269} 267}
270 268
271void NetworkSettings::SLOT_ShowNode( QListBoxItem * LBI ) { 269void NetworkSettings::SLOT_ShowNode( QListBoxItem * LBI ) {
272 if( LBI == 0 ) 270 if( LBI == 0 )
273 return; 271 return;
274 272
275 NodeCollection * NC = NSResources->findConnection( LBI->text() ); 273 NodeCollection * NC = NSResources->findConnection( LBI->text() );
276 274
277 if( NC->description().isEmpty() ) { 275 if( NC->description().isEmpty() ) {
278 Description_LBL->setText( tr( "<<No description>>" ) ); 276 Description_LBL->setText( tr( "<<No description>>" ) );
279 } else { 277 } else {
280 Description_LBL->setText( NC->description() ); 278 Description_LBL->setText( NC->description() );
281 } 279 }
282 280
283 Profile_GB->setTitle( LBI->text() + " : " + NC->stateName() ); 281 Profile_GB->setTitle( LBI->text() + " : " + NC->stateName() );
284 282
285 bool FrmActive = 1; 283 bool FrmActive = 1;
286 bool IsEnabled = 1; 284 bool IsEnabled = 1;
287 int leds = 0; 285 int leds = 0;
288 286
289 owarn << "State " << NC->state() << oendl;
290 switch( NC->state() ) { 287 switch( NC->state() ) {
291 case Disabled : // no further work 288 case Disabled : // no further work
292 IsEnabled = 0; 289 IsEnabled = 0;
293 FrmActive = 0; 290 FrmActive = 0;
294 owarn << "LEds " << leds << oendl;
295 break; 291 break;
296 case Unknown : 292 case Unknown :
297 case Unchecked : 293 case Unchecked :
298 case Unavailable : 294 case Unavailable :
299 FrmActive = 0; 295 FrmActive = 0;
300 break; 296 break;
301 case Off : 297 case Off :
302 leds = 1; 298 leds = 1;
303 break; 299 break;
304 case Available : 300 case Available :
305 leds = 2; 301 leds = 2;
306 break; 302 break;
307 case IsUp : 303 case IsUp :
308 leds = 3; 304 leds = 3;
309 break; 305 break;
310 } 306 }
311 307
312 Disable_TB->setOn( ! IsEnabled ); 308 Disable_TB->setOn( ! IsEnabled );
313 LED_Frm->setEnabled( FrmActive ); 309 LED_Frm->setEnabled( FrmActive );
314 310
315 for( int i = 0 ; i < leds; i ++ ) { 311 for( int i = 0 ; i < leds; i ++ ) {
316 Leds[i]->setColor( red ); 312 Leds[i]->setColor( red );
317 Leds[i]->setOn( true ); 313 Leds[i]->setOn( true );
318 } 314 }
@@ -338,49 +334,49 @@ void NetworkSettings::updateProfileState( QListBoxItem * LBI ) {
338 } 334 }
339} 335}
340 336
341void NetworkSettings::SLOT_GenerateConfig( void ) { 337void NetworkSettings::SLOT_GenerateConfig( void ) {
342 QString S = NSD.generateSettings(); 338 QString S = NSD.generateSettings();
343 if( ! S.isEmpty() ) { 339 if( ! S.isEmpty() ) {
344 S.insert( 0, "<p>" ); 340 S.insert( 0, "<p>" );
345 S.append( "</p>" ); 341 S.append( "</p>" );
346 QMessageBox::warning( 342 QMessageBox::warning(
347 0, 343 0,
348 tr( "Generate config" ), 344 tr( "Generate config" ),
349 S); 345 S);
350 } 346 }
351} 347}
352 348
353void NetworkSettings::SLOT_Disable( bool T ) { 349void NetworkSettings::SLOT_Disable( bool T ) {
354 QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); 350 QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() );
355 QString Msg; 351 QString Msg;
356 352
357 if ( ! LBI ) 353 if ( ! LBI )
358 return; 354 return;
359 355
360 NodeCollection * NC = NSResources->findConnection( LBI->text() ); 356 NodeCollection * NC = NSResources->findConnection( LBI->text() );
361 357
362 owarn << "Prepare to disable" << oendl; 358 Log(( "Prepare to %sable\n", (T) ? "en" : "dis" ));
363 Msg = NC->setState( (T) ? Disable : Enable ); 359 Msg = NC->setState( (T) ? Disable : Enable );
364 if( ! Msg.isEmpty() ) { 360 if( ! Msg.isEmpty() ) {
365 Msg.insert( 0, "<p>" ); 361 Msg.insert( 0, "<p>" );
366 Msg.append( "</p>" ); 362 Msg.append( "</p>" );
367 QMessageBox::warning( 363 QMessageBox::warning(
368 0, 364 0,
369 tr( "Activating profile" ), 365 tr( "Activating profile" ),
370 Msg ); 366 Msg );
371 return; 367 return;
372 } 368 }
373 369
374 // reload new state 370 // reload new state
375 NC->state( true ); 371 NC->state( true );
376 updateProfileState( LBI ); 372 updateProfileState( LBI );
377} 373}
378 374
379void NetworkSettings::SLOT_Up( void ) { 375void NetworkSettings::SLOT_Up( void ) {
380 // bring more up 376 // bring more up
381 377
382 QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() ); 378 QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() );
383 QString Msg; 379 QString Msg;
384 int led = -1; 380 int led = -1;
385 381
386 if ( ! LBI ) 382 if ( ! LBI )