Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

ir.cpp

Go to the documentation of this file.
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 "qcopenvelope_qws.h"
00024 #include "applnk.h"
00025 
00046 Ir::Ir( QObject *parent, const char *name )
00047     : QObject( parent, name )
00048 {
00049 #ifndef QT_NO_COP
00050     ch = new QCopChannel( "QPE/Obex" );
00051     connect( ch, SIGNAL(received(const QCString&,const QByteArray&)),
00052              this, SLOT(obexMessage(const QCString&,const QByteArray&)) );
00053 #endif
00054 }
00055 
00060 bool Ir::supported()
00061 {
00062 #ifndef QT_NO_COP
00063     return QCopChannel::isRegistered( "QPE/Obex" );
00064 #endif
00065 }
00066 
00076 void Ir::send( const QString &fn, const QString &description, const QString &mimetype)
00077 {
00078     if ( !filename.isEmpty() ) return;
00079     filename = fn;
00080 #ifndef QT_NO_COP
00081     QCopEnvelope e("QPE/Obex", "send(QString,QString,QString)");
00082     e << description << filename << mimetype;
00083 #endif
00084 }
00085 
00093 void Ir::send( const DocLnk &doc, const QString &description )
00094 {
00095     send( doc.file(), description, doc.type() );
00096 }
00097 
00106 void Ir::obexMessage( const QCString &msg, const QByteArray &data)
00107 {
00108     if ( msg == "done(QString)" ) {
00109         QString fn;
00110         QDataStream stream( data, IO_ReadOnly );
00111         stream >> fn;
00112         if ( fn == filename )
00113             emit done( this );
00114     }
00115 }
00116 

Generated on Sat Nov 5 16:16:36 2005 for OPIE by  doxygen 1.4.2