ir.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include "ir.h"
00022
00023 #include <qstring.h>
00024 #include "qcopenvelope_qws.h"
00025 #include <qcopchannel_qws.h>
00026 #include "applnk.h"
00027
00048 Ir::Ir( QObject *parent, const char *name )
00049 : QObject( parent, name )
00050 {
00051 #ifndef QT_NO_COP
00052 ch = new QCopChannel( "QPE/Obex" );
00053 connect( ch, SIGNAL(received(const QCString &, const QByteArray &)),
00054 this, SLOT(obexMessage( const QCString &, const QByteArray &)) );
00055 #endif
00056 }
00057
00062 bool Ir::supported()
00063 {
00064 #ifndef QT_NO_COP
00065 return QCopChannel::isRegistered( "QPE/Obex" );
00066 #endif
00067 }
00068
00078 void Ir::send( const QString &fn, const QString &description, const QString &mimetype)
00079 {
00080 if ( !filename.isEmpty() ) return;
00081 filename = fn;
00082 #ifndef QT_NO_COP
00083 QCopEnvelope e("QPE/Obex", "send(QString,QString,QString)");
00084 e << description << filename << mimetype;
00085 #endif
00086 }
00087
00095 void Ir::send( const DocLnk &doc, const QString &description )
00096 {
00097 send( doc.file(), description, doc.type() );
00098 }
00099
00108 void Ir::obexMessage( const QCString &msg, const QByteArray &data)
00109 {
00110 if ( msg == "done(QString)" ) {
00111 QString fn;
00112 QDataStream stream( data, IO_ReadOnly );
00113 stream >> fn;
00114 if ( fn == filename )
00115 emit done( this );
00116 }
00117 }
00118
This file is part of the documentation for OPIE Version 1.5.5.