Qtopia library API Documentation

ir.cpp

00001 /**********************************************************************
00002 ** Copyright (C) 2000-2002 Trolltech AS.  All rights reserved.
00003 **
00004 ** This file is part of the Qtopia Environment.
00005 **
00006 ** This file may be distributed and/or modified under the terms of the
00007 ** GNU General Public License version 2 as published by the Free Software
00008 ** Foundation and appearing in the file LICENSE.GPL included in the
00009 ** packaging of this file.
00010 **
00011 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00012 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00013 **
00014 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
00015 **
00016 ** Contact info@trolltech.com if any conditions of this licensing are
00017 ** not clear to you.
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 
KDE Logo
This file is part of the documentation for OPIE Version 1.5.5.
Documentation copyright © 1997-2003 the KDE developers. 2003 OPIE developers
Generated on Tue Feb 10 20:24:05 2004 by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2001