author | harlekin <harlekin> | 2002-06-19 00:37:35 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-06-19 00:37:35 (UTC) |
commit | 0f9955585ccaa45db582640c415b97de67bc8555 (patch) (unidiff) | |
tree | b976ce4baad6f407b998e1119c73bfaf0e7fd631 | |
parent | 35ecb27ed64368d30d6360cbd5e30acf3a216a46 (diff) | |
download | opie-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
-rw-r--r-- | core/applets/irdaapplet/irda.cpp | 14 |
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 | |||
@@ -102,18 +102,24 @@ int IrdaApplet::setIrdaStatus(int c) { | |||
102 | return 0; | 102 | return 0; |
103 | } | 103 | } |
104 | 104 | ||
105 | int IrdaApplet::checkIrdaDiscoveryStatus() { | 105 | int IrdaApplet::checkIrdaDiscoveryStatus() { |
106 | |||
106 | QFile discovery("/proc/sys/net/irda/discovery"); | 107 | QFile discovery("/proc/sys/net/irda/discovery"); |
107 | char status; | ||
108 | 108 | ||
109 | discovery.open( IO_ReadOnly|IO_Raw ); | 109 | QString streamIn = "0"; |
110 | discovery.readBlock (&status, 1); | 110 | |
111 | if (discovery.open(IO_ReadOnly) ) { | ||
112 | QTextStream stream ( &discovery ); | ||
113 | streamIn = stream.read(); | ||
114 | } | ||
115 | |||
111 | discovery.close(); | 116 | discovery.close(); |
112 | 117 | ||
113 | return atoi(&status); | 118 | return( streamIn.toInt() ); |
114 | } | 119 | } |
115 | 120 | ||
121 | |||
116 | int IrdaApplet::setIrdaDiscoveryStatus(int d) { | 122 | int IrdaApplet::setIrdaDiscoveryStatus(int d) { |
117 | QFile discovery("/proc/sys/net/irda/discovery"); | 123 | QFile discovery("/proc/sys/net/irda/discovery"); |
118 | 124 | ||
119 | discovery.open( IO_WriteOnly|IO_Raw ); | 125 | discovery.open( IO_WriteOnly|IO_Raw ); |