summaryrefslogtreecommitdiff
path: root/library/ir.cpp
authorzecke <zecke>2002-09-10 12:09:49 (UTC)
committer zecke <zecke>2002-09-10 12:09:49 (UTC)
commit6b77a1cdb9536b1c135eb86d53a6b2c22c19b0a4 (patch) (unidiff)
tree6ebc93c6432f4ed9d00ef1448b6a047ef522a79a /library/ir.cpp
parentd10cddb3c9ce75bc90b14add14bc133737fe35aa (diff)
downloadopie-6b77a1cdb9536b1c135eb86d53a6b2c22c19b0a4.zip
opie-6b77a1cdb9536b1c135eb86d53a6b2c22c19b0a4.tar.gz
opie-6b77a1cdb9536b1c135eb86d53a6b2c22c19b0a4.tar.bz2
Qtopia1-6 merge
still to test bic changes to be resolved more changes to be made?
Diffstat (limited to 'library/ir.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--library/ir.cpp67
1 files changed, 54 insertions, 13 deletions
diff --git a/library/ir.cpp b/library/ir.cpp
index 68345d1..a7cf7b1 100644
--- a/library/ir.cpp
+++ b/library/ir.cpp
@@ -1,16 +1,46 @@
1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3**
4** This file is part of the Qtopia Environment.
5**
6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
1#include "ir.h" 21#include "ir.h"
2 22
3#include <qstring.h> 23#include <qstring.h>
24#ifdef QWS
4#include "qcopenvelope_qws.h" 25#include "qcopenvelope_qws.h"
5#include <qcopchannel_qws.h> 26#include <qcopchannel_qws.h>
27#endif
6#include "applnk.h" 28#include "applnk.h"
7 29
8/*! 30/*!
9 \class Ir ir.h 31 \class Ir ir.h
10 \brief The Ir class implements basic support for sending objects over an 32 \brief The Ir class implements basic support for sending objects over an
11 infrared communication link. 33 infrared communication link.
12 34
13 The Ir class is a small helper class to enable sending of objects over an infrared communication link. 35 Both \link doclnk.html DocLnk\endlink objects and files can be
36 sent to another device via the infrared link using the send()
37 function. When the send has completed the done() signal is
38 emitted.
39
40 The supported() function returns whether the device supports
41 infrared communication or not.
42
43 \ingroup qtopiaemb
14*/ 44*/
15 45
16/*! 46/*!
@@ -20,47 +50,58 @@
20Ir::Ir( QObject *parent, const char *name ) 50Ir::Ir( QObject *parent, const char *name )
21 : QObject( parent, name ) 51 : QObject( parent, name )
22{ 52{
53#ifndef QT_NO_COP
23 ch = new QCopChannel( "QPE/Obex" ); 54 ch = new QCopChannel( "QPE/Obex" );
24 connect( ch, SIGNAL(received(const QCString &, const QByteArray &)), 55 connect( ch, SIGNAL(received(const QCString &, const QByteArray &)),
25 this, SLOT(obexMessage( const QCString &, const QByteArray &)) ); 56 this, SLOT(obexMessage( const QCString &, const QByteArray &)) );
57#endif
26} 58}
27 59
28/*! 60/*!
29 Returns TRUE if the system supports infrared communication. 61 Returns TRUE if the system supports infrared communication;
62 otherwise returns FALSE.
30*/ 63*/
31bool Ir::supported() 64bool Ir::supported()
32{ 65{
66#ifndef QT_NO_COP
33 return QCopChannel::isRegistered( "QPE/Obex" ); 67 return QCopChannel::isRegistered( "QPE/Obex" );
68#endif
34} 69}
35 70
36/*! 71/*!
37 Send the object in the file \a fn over the infrared link. 72 Sends the object in file \a fn over the infrared link. The \a
38 The \a description will be shown to the user while 73 description is used in the text shown to the user while sending
39 sending is in progress. 74 is in progress. The optional \a mimetype parameter specifies the
40 The optional \a mimetype parameter specifies the mimetype of the object. If this parameter is not 75 mimetype of the object. If this parameter is not set, it is
41 set, it will be determined by the extension of the filename. 76 determined by the the filename's suffix.
77
78 \sa done()
42*/ 79*/
43void Ir::send( const QString &fn, const QString &description, const QString &mimetype) 80void Ir::send( const QString &fn, const QString &description, const QString &mimetype)
44{ 81{
45 if ( !filename.isEmpty() ) return; 82 if ( !filename.isEmpty() ) return;
46 filename = fn; 83 filename = fn;
84#ifndef QT_NO_COP
47 QCopEnvelope e("QPE/Obex", "send(QString,QString,QString)"); 85 QCopEnvelope e("QPE/Obex", "send(QString,QString,QString)");
48 e << description << filename << mimetype; 86 e << description << filename << mimetype;
87#endif
49} 88}
50 89
51/*! 90/*!
52 \overload 91 \overload
53 92
54 Uses the DocLnk::file() and DocLnk::type() of \a doc. 93 Uses the DocLnk::file() and DocLnk::type() of \a doc.
94
95 \sa done()
55*/ 96*/
56void Ir::send( const DocLnk &doc, const QString &description ) 97void Ir::send( const DocLnk &doc, const QString &description )
57{ 98{
58 send( doc.file(), description, doc.type() ); 99 send( doc.file(), description, doc.type() );
59} 100}
60 101
61/*! 102/*!
62 \fn Ir::done( Ir *ir ); 103 \fn Ir::done( Ir *ir );
63 104
64 This signal is emitted by \a ir, when the send comand has been processed. 105 This signal is emitted by \a ir, when the send comand has been processed.
65*/ 106*/
66 107
@@ -76,4 +117,4 @@ void Ir::obexMessage( const QCString &msg, const QByteArray &data)
76 emit done( this ); 117 emit done( this );
77 } 118 }
78} 119}
79 120