summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-06-19 00:37:35 (UTC)
committer harlekin <harlekin>2002-06-19 00:37:35 (UTC)
commit0f9955585ccaa45db582640c415b97de67bc8555 (patch) (side-by-side diff)
treeb976ce4baad6f407b998e1119c73bfaf0e7fd631
parent35ecb27ed64368d30d6360cbd5e30acf3a216a46 (diff)
downloadopie-0f9955585ccaa45db582640c415b97de67bc8555.zip
opie-0f9955585ccaa45db582640c415b97de67bc8555.tar.gz
opie-0f9955585ccaa45db582640c415b97de67bc8555.tar.bz2
no more permanent QFile::writeBlock: Write operation not permitted, and also its now more c++ rather than c style , the discovery part
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/irdaapplet/irda.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/core/applets/irdaapplet/irda.cpp b/core/applets/irdaapplet/irda.cpp
index e21f191..5b23330 100644
--- a/core/applets/irdaapplet/irda.cpp
+++ b/core/applets/irdaapplet/irda.cpp
@@ -98,26 +98,32 @@ int IrdaApplet::setIrdaStatus(int c) {
if (ioctl(sockfd, SIOCSIFFLAGS, &ifr))
return -1;
return 0;
}
int IrdaApplet::checkIrdaDiscoveryStatus() {
+
QFile discovery("/proc/sys/net/irda/discovery");
- char status;
- discovery.open( IO_ReadOnly|IO_Raw );
- discovery.readBlock (&status, 1);
+ QString streamIn = "0";
+
+ if (discovery.open(IO_ReadOnly) ) {
+ QTextStream stream ( &discovery );
+ streamIn = stream.read();
+ }
+
discovery.close();
- return atoi(&status);
+ return( streamIn.toInt() );
}
+
int IrdaApplet::setIrdaDiscoveryStatus(int d) {
QFile discovery("/proc/sys/net/irda/discovery");
discovery.open( IO_WriteOnly|IO_Raw );
if (d)
discovery.putch('1');
else