Diffstat (limited to 'noncore/settings/networksettings/interface.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/interface.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/noncore/settings/networksettings/interface.cpp b/noncore/settings/networksettings/interface.cpp index 5b21364..1f32093 100644 --- a/noncore/settings/networksettings/interface.cpp +++ b/noncore/settings/networksettings/interface.cpp | |||
@@ -1,6 +1,7 @@ | |||
1 | #include "interface.h" | 1 | #include "interface.h" |
2 | #include <qdatetime.h> | 2 | #include <qdatetime.h> |
3 | #include <qfile.h> | 3 | #include <qfile.h> |
4 | #include <qdir.h> | ||
4 | #include <qfileinfo.h> | 5 | #include <qfileinfo.h> |
5 | #include <qtextstream.h> | 6 | #include <qtextstream.h> |
6 | 7 | ||
@@ -128,8 +129,13 @@ bool Interface::refresh(){ | |||
128 | leaseExpires = ""; | 129 | leaseExpires = ""; |
129 | dhcp = false; | 130 | dhcp = false; |
130 | 131 | ||
132 | QString dhcpDirectory(HDCP_INFO_DIR); | ||
133 | QDir d(dhcpDirectory); | ||
134 | if(!d.exists(dhcpDirectory)) | ||
135 | dhcpDirectory = "/var/run"; | ||
136 | |||
131 | // See if we have | 137 | // See if we have |
132 | QString dhcpFile(QString(HDCP_INFO_DIR "/dhcpcd-%1.info").arg(interfaceName)); | 138 | QString dhcpFile(QString(dhcpDirectory+"/dhcpcd-%1.info").arg(interfaceName)); |
133 | // If there is no DHCP information then exit now with no errors. | 139 | // If there is no DHCP information then exit now with no errors. |
134 | if(!QFile::exists(dhcpFile)){ | 140 | if(!QFile::exists(dhcpFile)){ |
135 | return true; | 141 | return true; |
@@ -148,8 +154,8 @@ bool Interface::refresh(){ | |||
148 | stream.setDevice( &file ); | 154 | stream.setDevice( &file ); |
149 | while ( !stream.eof() ) { | 155 | while ( !stream.eof() ) { |
150 | line = stream.readLine(); | 156 | line = stream.readLine(); |
151 | if(line.contains("DHCPSID=")) | 157 | if(line.contains("DHCPSIADDR=")) |
152 | dhcpServerIp = line.mid(8, line.length()); | 158 | dhcpServerIp = line.mid(11, line.length()); |
153 | if(line.contains("LEASETIME=")) | 159 | if(line.contains("LEASETIME=")) |
154 | leaseTime = line.mid(10, line.length()).toInt(); | 160 | leaseTime = line.mid(10, line.length()).toInt(); |
155 | if(line.contains("RENEWALTIME=")) | 161 | if(line.contains("RENEWALTIME=")) |
@@ -160,7 +166,7 @@ bool Interface::refresh(){ | |||
160 | //qDebug(QString("Interface: renewalTime: %1").arg(renewalTime).latin1()); | 166 | //qDebug(QString("Interface: renewalTime: %1").arg(renewalTime).latin1()); |
161 | 167 | ||
162 | // Get the pid of the deamond | 168 | // Get the pid of the deamond |
163 | dhcpFile = (QString(HDCP_INFO_DIR "/dhcpcd-%1.pid").arg(interfaceName)); | 169 | dhcpFile = (QString(dhcpDirectory+"/dhcpcd-%1.pid").arg(interfaceName)); |
164 | file.setName(dhcpFile); | 170 | file.setName(dhcpFile); |
165 | if (!file.open(IO_ReadOnly)){ | 171 | if (!file.open(IO_ReadOnly)){ |
166 | qDebug(QString("Interface: Can't open file: %1").arg(dhcpFile).latin1()); | 172 | qDebug(QString("Interface: Can't open file: %1").arg(dhcpFile).latin1()); |