-rw-r--r-- | core/launcher/stabmon.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/core/launcher/stabmon.cpp b/core/launcher/stabmon.cpp index 3d0d534..4e5f290 100644 --- a/core/launcher/stabmon.cpp +++ b/core/launcher/stabmon.cpp | |||
@@ -1,8 +1,8 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
@@ -20,15 +20,19 @@ | |||
20 | 20 | ||
21 | 21 | ||
22 | #include "stabmon.h" | 22 | #include "stabmon.h" |
23 | 23 | ||
24 | #include <qpe/qcopenvelope_qws.h> | 24 | #ifdef QWS |
25 | #include <qtopia/qcopenvelope_qws.h> | ||
26 | #endif | ||
25 | 27 | ||
26 | #include <qfile.h> | 28 | #include <qfile.h> |
27 | #include <qcstring.h> | 29 | #include <qcstring.h> |
28 | 30 | ||
29 | #include <sys/stat.h> | 31 | #include <sys/stat.h> |
32 | #if defined(Q_OS_LINUX) || defined(_OS_LINUX_) | ||
30 | #include <unistd.h> | 33 | #include <unistd.h> |
34 | #endif | ||
31 | #include <stdlib.h> | 35 | #include <stdlib.h> |
32 | 36 | ||
33 | SysFileMonitor::SysFileMonitor(QObject* parent) : | 37 | SysFileMonitor::SysFileMonitor(QObject* parent) : |
34 | QObject(parent) | 38 | QObject(parent) |
@@ -58,13 +62,15 @@ void SysFileMonitor::timerEvent(QTimerEvent*) | |||
58 | last[i] = (long)s.st_mtime; | 62 | last[i] = (long)s.st_mtime; |
59 | ch=TRUE; | 63 | ch=TRUE; |
60 | } | 64 | } |
61 | if ( ch ) { | 65 | if ( ch ) { |
66 | #ifndef QT_NO_COP | ||
62 | QCopEnvelope("QPE/Card", "stabChanged()" ); | 67 | QCopEnvelope("QPE/Card", "stabChanged()" ); |
68 | #endif | ||
63 | break; | 69 | break; |
64 | } | 70 | } |
65 | } | 71 | } |
66 | 72 | ||
67 | // st_size is no use, it's 0 for /proc/mounts too. Read it all. | 73 | // st_size is no use, it's 0 for /proc/mounts too. Read it all. |
68 | static int mtabSize = 0; | 74 | static int mtabSize = 0; |
69 | QFile f( "/proc/mounts" ); | 75 | QFile f( "/proc/mounts" ); |
70 | if ( f.open(IO_ReadOnly) ) { | 76 | if ( f.open(IO_ReadOnly) ) { |
@@ -72,9 +78,11 @@ void SysFileMonitor::timerEvent(QTimerEvent*) | |||
72 | // readAll does not work correctly on sequential devices (as eg. /proc files) | 78 | // readAll does not work correctly on sequential devices (as eg. /proc files) |
73 | QByteArray ba = f.readAll(); | 79 | QByteArray ba = f.readAll(); |
74 | if ( (int)ba.size() != mtabSize ) { | 80 | if ( (int)ba.size() != mtabSize ) { |
75 | mtabSize = (int)ba.size(); | 81 | mtabSize = (int)ba.size(); |
82 | #ifndef QT_NO_COP | ||
76 | QCopEnvelope("QPE/Card", "mtabChanged()" ); | 83 | QCopEnvelope("QPE/Card", "mtabChanged()" ); |
84 | #endif | ||
77 | } | 85 | } |
78 | #else | 86 | #else |
79 | QString s; | 87 | QString s; |
80 | while( !f.atEnd() ) { | 88 | while( !f.atEnd() ) { |
@@ -83,10 +91,12 @@ void SysFileMonitor::timerEvent(QTimerEvent*) | |||
83 | s += tmp; | 91 | s += tmp; |
84 | } | 92 | } |
85 | if ( (int)s.length() != mtabSize ) { | 93 | if ( (int)s.length() != mtabSize ) { |
86 | mtabSize = (int)s.length(); | 94 | mtabSize = (int)s.length(); |
95 | #ifndef QT_NO_COP | ||
87 | QCopEnvelope("QPE/Card", "mtabChanged()" ); | 96 | QCopEnvelope("QPE/Card", "mtabChanged()" ); |
97 | #endif | ||
88 | } | 98 | } |
89 | #endif | 99 | #endif |
90 | } | 100 | } |
91 | } | 101 | } |
92 | 102 | ||