Diffstat (limited to 'noncore/settings/networksettings/interface.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/interface.cpp | 16 |
1 files changed, 11 insertions, 5 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 | |||
@@ -2,4 +2,5 @@ | |||
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> |
@@ -128,7 +129,12 @@ 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)){ |
@@ -149,6 +155,6 @@ bool Interface::refresh(){ | |||
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(); |
@@ -161,5 +167,5 @@ bool Interface::refresh(){ | |||
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)){ |