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