author | zecke <zecke> | 2003-08-25 14:46:43 (UTC) |
---|---|---|
committer | zecke <zecke> | 2003-08-25 14:46:43 (UTC) |
commit | 292b097e7db25dd231381c5b09307a1fbe81a492 (patch) (unidiff) | |
tree | b103c6c5e15e784dc07af55539672a72559da821 /library/qcopenvelope_qws.cpp | |
parent | 5f292b6e4fc0f4ee8e4bced9a916f6bdce864b6b (diff) | |
download | opie-292b097e7db25dd231381c5b09307a1fbe81a492.zip opie-292b097e7db25dd231381c5b09307a1fbe81a492.tar.gz opie-292b097e7db25dd231381c5b09307a1fbe81a492.tar.bz2 |
-instead of defining for an board we define now what this
boards need
QPE_NEED_CALIBRATE
-launcher is the only one executin application
-allow processing of QCOPfiles after start ( qpeapplication )
-qcopenvelope no longer calls Global::execute
-rw-r--r-- | library/qcopenvelope_qws.cpp | 54 |
1 files changed, 14 insertions, 40 deletions
diff --git a/library/qcopenvelope_qws.cpp b/library/qcopenvelope_qws.cpp index 81bb0f5..0aac32b 100644 --- a/library/qcopenvelope_qws.cpp +++ b/library/qcopenvelope_qws.cpp | |||
@@ -102,57 +102,31 @@ QCopEnvelope::~QCopEnvelope() | |||
102 | QFile qcopfile(qcopfn); | 102 | QFile qcopfile(qcopfn); |
103 | 103 | ||
104 | if ( qcopfile.open(IO_WriteOnly | IO_Append) ) { | 104 | if ( qcopfile.open(IO_WriteOnly | IO_Append) ) { |
105 | #ifndef Q_OS_WIN32 | ||
105 | if(flock(qcopfile.handle(), LOCK_EX)) { | 106 | if(flock(qcopfile.handle(), LOCK_EX)) { |
106 | /* some error occured */ | 107 | /* some error occurred */ |
107 | qWarning(QString("Failed to obtain file lock on %1 (%2)") | 108 | qWarning(QString("Failed to obtain file lock on %1 (%2)") |
108 | .arg(qcopfn).arg( errno )); | 109 | .arg(qcopfn).arg( errno )); |
109 | } | 110 | } |
110 | /* file locked, but might be stale (e.g. program for whatever | 111 | #endif |
111 | reason did not start). I modified more than 1 minute ago, | ||
112 | truncate the file */ | ||
113 | struct stat buf; | ||
114 | time_t t; | ||
115 | if (!fstat(qcopfile.handle(), &buf) && (time(&t) != (time_t)-1) ) { | ||
116 | // success on fstat, lets compare times | ||
117 | if (buf.st_ctime + 60 < t) { | ||
118 | qWarning("stale file " + qcopfn + " found. Truncating"); | ||
119 | ftruncate(qcopfile.handle(), 0); | ||
120 | qcopfile.reset(); | ||
121 | } | ||
122 | } | ||
123 | |||
124 | if ( !QCopChannel::isRegistered(ch) ) { | ||
125 | int fsize = qcopfile.size(); | ||
126 | { | 112 | { |
127 | QDataStream ds(&qcopfile); | 113 | QDataStream ds(&qcopfile); |
128 | ds << ch << msg << data; | 114 | ds << ch << msg << data; |
115 | qcopfile.flush(); | ||
116 | #ifndef Q_OS_WIN32 | ||
129 | flock(qcopfile.handle(), LOCK_UN); | 117 | flock(qcopfile.handle(), LOCK_UN); |
118 | #endif | ||
130 | qcopfile.close(); | 119 | qcopfile.close(); |
131 | } | 120 | } |
132 | 121 | ||
133 | if (fsize == 0) { | 122 | QByteArray b; |
134 | QString cmd = ch.mid(pref); | 123 | QDataStream stream(b, IO_WriteOnly); |
135 | Global::execute(cmd); | 124 | stream << QString(ch.mid(pref)); |
136 | } | 125 | QCopChannel::send("QPE/Server", "processQCop(QString)", b); |
137 | 126 | delete device(); | |
138 | char c; | 127 | return; |
139 | for (int i=0; (c=msg[i]); i++) { | ||
140 | if ( c == ' ' ) { | ||
141 | // Return-value required | ||
142 | // ###### wait for it | ||
143 | break; | ||
144 | } else if ( c == '(' ) { | ||
145 | // No return value | ||
146 | break; | ||
147 | } | ||
148 | } | ||
149 | goto end; | ||
150 | } // endif isRegisterd | ||
151 | flock(qcopfile.handle(), LOCK_UN); | ||
152 | qcopfile.close(); | ||
153 | qcopfile.remove(); | ||
154 | } else { | 128 | } else { |
155 | qWarning(QString("Failed to obtain file lock on %1") | 129 | qWarning(QString("Failed to open file %1") |
156 | .arg(qcopfn)); | 130 | .arg(qcopfn)); |
157 | } // endif open | 131 | } // endif open |
158 | } | 132 | } |
@@ -165,8 +139,8 @@ QCopEnvelope::~QCopEnvelope() | |||
165 | // Since byte arrays are explicitly shared, this is appended to the data variable.. | 139 | // Since byte arrays are explicitly shared, this is appended to the data variable.. |
166 | *this << endpoint; | 140 | *this << endpoint; |
167 | } | 141 | } |
142 | |||
168 | QCopChannel::send(ch,msg,data); | 143 | QCopChannel::send(ch,msg,data); |
169 | end: | ||
170 | delete device(); | 144 | delete device(); |
171 | } | 145 | } |
172 | 146 | ||