summaryrefslogtreecommitdiff
path: root/library/qcopenvelope_qws.cpp
authorzecke <zecke>2003-08-25 14:46:43 (UTC)
committer zecke <zecke>2003-08-25 14:46:43 (UTC)
commit292b097e7db25dd231381c5b09307a1fbe81a492 (patch) (side-by-side diff)
treeb103c6c5e15e784dc07af55539672a72559da821 /library/qcopenvelope_qws.cpp
parent5f292b6e4fc0f4ee8e4bced9a916f6bdce864b6b (diff)
downloadopie-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
Diffstat (limited to 'library/qcopenvelope_qws.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--library/qcopenvelope_qws.cpp66
1 files changed, 20 insertions, 46 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()
QFile qcopfile(qcopfn);
if ( qcopfile.open(IO_WriteOnly | IO_Append) ) {
+#ifndef Q_OS_WIN32
if(flock(qcopfile.handle(), LOCK_EX)) {
- /* some error occured */
+ /* some error occurred */
qWarning(QString("Failed to obtain file lock on %1 (%2)")
.arg(qcopfn).arg( errno ));
}
- /* file locked, but might be stale (e.g. program for whatever
- reason did not start). I modified more than 1 minute ago,
- truncate the file */
- struct stat buf;
- time_t t;
- if (!fstat(qcopfile.handle(), &buf) && (time(&t) != (time_t)-1) ) {
- // success on fstat, lets compare times
- if (buf.st_ctime + 60 < t) {
- qWarning("stale file " + qcopfn + " found. Truncating");
- ftruncate(qcopfile.handle(), 0);
- qcopfile.reset();
- }
+#endif
+ {
+ QDataStream ds(&qcopfile);
+ ds << ch << msg << data;
+ qcopfile.flush();
+#ifndef Q_OS_WIN32
+ flock(qcopfile.handle(), LOCK_UN);
+#endif
+ qcopfile.close();
}
- if ( !QCopChannel::isRegistered(ch) ) {
- int fsize = qcopfile.size();
- {
- QDataStream ds(&qcopfile);
- ds << ch << msg << data;
- flock(qcopfile.handle(), LOCK_UN);
- qcopfile.close();
- }
-
- if (fsize == 0) {
- QString cmd = ch.mid(pref);
- Global::execute(cmd);
- }
-
- char c;
- for (int i=0; (c=msg[i]); i++) {
- if ( c == ' ' ) {
- // Return-value required
- // ###### wait for it
- break;
- } else if ( c == '(' ) {
- // No return value
- break;
- }
- }
- goto end;
- } // endif isRegisterd
- flock(qcopfile.handle(), LOCK_UN);
- qcopfile.close();
- qcopfile.remove();
+ QByteArray b;
+ QDataStream stream(b, IO_WriteOnly);
+ stream << QString(ch.mid(pref));
+ QCopChannel::send("QPE/Server", "processQCop(QString)", b);
+ delete device();
+ return;
} else {
- qWarning(QString("Failed to obtain file lock on %1")
+ qWarning(QString("Failed to open file %1")
.arg(qcopfn));
} // endif open
}
@@ -160,13 +134,13 @@ QCopEnvelope::~QCopEnvelope()
// If this is a message that should go along the SOAP channel, we move the
// endpoint URL to the data section.
QString endpoint = ch.mid(9);
-
+
ch = "QPE/SOAP";
// Since byte arrays are explicitly shared, this is appended to the data variable..
*this << endpoint;
}
+
QCopChannel::send(ch,msg,data);
-end:
delete device();
}