summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/lancard/lancardrun.cpp
Unidiff
Diffstat (limited to 'noncore/settings/networksettings2/lancard/lancardrun.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings2/lancard/lancardrun.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/noncore/settings/networksettings2/lancard/lancardrun.cpp b/noncore/settings/networksettings2/lancard/lancardrun.cpp
index 8157dce..8a71aa9 100644
--- a/noncore/settings/networksettings2/lancard/lancardrun.cpp
+++ b/noncore/settings/networksettings2/lancard/lancardrun.cpp
@@ -1,25 +1,25 @@
1#include <qfile.h> 1#include <qfile.h>
2#include <qtextstream.h> 2#include <qtextstream.h>
3#include <qstringlist.h> 3#include <qstringlist.h>
4#include <resources.h> 4#include <resources.h>
5#include "lancardrun.h" 5#include "lancardrun.h"
6 6
7State_t LanCardRun::detectState( void ) { 7State_t LanCardRun::detectState( void ) {
8 8
9 // unavailable : no card found 9 // unavailable : no card found
10 // available : card found and assigned to us or free 10 // available : card found and assigned to us or free
11 // up : card found and assigned to us and up 11 // up : card found and assigned to us and up
12 12
13 NodeCollection * NC = nodeCollection(); 13 NetworkSetup * NC = networkSetup();
14 QString S = QString( "/tmp/profile-%1.up" ). 14 QString S = QString( "/tmp/profile-%1.up" ).
15 arg( NC->number()); 15 arg( NC->number());
16 System & Sys = NSResources->system(); 16 System & Sys = NSResources->system();
17 InterfaceInfo * Run; 17 InterfaceInfo * Run;
18 18
19 QFile F( S ); 19 QFile F( S );
20 20
21 if( F.open( IO_ReadOnly ) ) { 21 if( F.open( IO_ReadOnly ) ) {
22 // could open file -> read interface and assign 22 // could open file -> read interface and assign
23 QString X; 23 QString X;
24 QTextStream TS(&F); 24 QTextStream TS(&F);
25 X = TS.readLine(); 25 X = TS.readLine();
@@ -61,25 +61,25 @@ State_t LanCardRun::detectState( void ) {
61 ) && 61 ) &&
62 ! Run->IsUp 62 ! Run->IsUp
63 ) { 63 ) {
64 // proper type, and Not UP -> free 64 // proper type, and Not UP -> free
65 return Off; 65 return Off;
66 } 66 }
67 } 67 }
68 // no free found 68 // no free found
69 69
70 return Unavailable; 70 return Unavailable;
71} 71}
72 72
73QString LanCardRun::setMyState( NodeCollection * NC, Action_t A, bool ) { 73QString LanCardRun::setMyState( NetworkSetup * NC, Action_t A, bool ) {
74 74
75 if( A == Activate ) { 75 if( A == Activate ) {
76 InterfaceInfo * N = getInterface(); 76 InterfaceInfo * N = getInterface();
77 77
78 if( ! N ) { 78 if( ! N ) {
79 // no interface available 79 // no interface available
80 NC->setCurrentState( Unavailable ); 80 NC->setCurrentState( Unavailable );
81 return tr("No interface found"); 81 return tr("No interface found");
82 } 82 }
83 83
84 // because we were OFF the interface 84 // because we were OFF the interface
85 // we get back is NOT assigned 85 // we get back is NOT assigned
@@ -105,28 +105,28 @@ InterfaceInfo * LanCardRun::getInterface( void ) {
105 for( QDictIterator<InterfaceInfo> It(S.interfaces()); 105 for( QDictIterator<InterfaceInfo> It(S.interfaces());
106 It.current(); 106 It.current();
107 ++It ) { 107 ++It ) {
108 Run = It.current(); 108 Run = It.current();
109 if( handlesInterface( *Run ) && 109 if( handlesInterface( *Run ) &&
110 ( Run->CardType == ARPHRD_ETHER 110 ( Run->CardType == ARPHRD_ETHER
111#ifdef ARPHRD_IEEE1394 111#ifdef ARPHRD_IEEE1394
112 || Run->CardType == ARPHRD_IEEE1394 112 || Run->CardType == ARPHRD_IEEE1394
113#endif 113#endif
114 ) 114 )
115 ) { 115 ) {
116 // this is a LAN card 116 // this is a LAN card
117 if( Run->assignedConnection() == netNode()->connection() ) { 117 if( Run->assignedToNetworkSetup() == netNode()->networkSetup() ) {
118 // assigned to us 118 // assigned to us
119 return Run; 119 return Run;
120 } else if( Run->assignedConnection() == 0 ) { 120 } else if( Run->assignedToNetworkSetup() == 0 ) {
121 // free 121 // free
122 best = Run; 122 best = Run;
123 } 123 }
124 } 124 }
125 } 125 }
126 return best; // can be 0 126 return best; // can be 0
127} 127}
128 128
129bool LanCardRun::handlesInterface( const QString & S ) { 129bool LanCardRun::handlesInterface( const QString & S ) {
130 InterfaceInfo * II; 130 InterfaceInfo * II;
131 II = NSResources->system().interface( S ); 131 II = NSResources->system().interface( S );
132 if( ( II = NSResources->system().interface( S ) ) ) { 132 if( ( II = NSResources->system().interface( S ) ) ) {