summaryrefslogtreecommitdiff
path: root/library/ir.cpp
authorzecke <zecke>2002-10-16 01:09:22 (UTC)
committer zecke <zecke>2002-10-16 01:09:22 (UTC)
commit543e54de7170c606b6883ac4152567e7faf13182 (patch) (unidiff)
tree8a7d623e96cab0135a2f7cb11aa9f7491bfda9a2 /library/ir.cpp
parent3e973543b77631d053a9616b5540966dbe51ab47 (diff)
downloadopie-543e54de7170c606b6883ac4152567e7faf13182.zip
opie-543e54de7170c606b6883ac4152567e7faf13182.tar.gz
opie-543e54de7170c606b6883ac4152567e7faf13182.tar.bz2
Remove #ifdef QWS HELL
a Platform which is not supporting IPC compatible to QCopChannel/Envelope is not of much use nowadays.. so be sure your platform is supporting it
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 a7cf7b1..b5b726d 100644
--- a/library/ir.cpp
+++ b/library/ir.cpp
@@ -1,120 +1,118 @@
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> 23#include <qstring.h>
24#ifdef QWS
25#include "qcopenvelope_qws.h" 24#include "qcopenvelope_qws.h"
26#include <qcopchannel_qws.h> 25#include <qcopchannel_qws.h>
27#endif
28#include "applnk.h" 26#include "applnk.h"
29 27
30/*! 28/*!
31 \class Ir ir.h 29 \class Ir ir.h
32 \brief The Ir class implements basic support for sending objects over an 30 \brief The Ir class implements basic support for sending objects over an
33 infrared communication link. 31 infrared communication link.
34 32
35 Both \link doclnk.html DocLnk\endlink objects and files can be 33 Both \link doclnk.html DocLnk\endlink objects and files can be
36 sent to another device via the infrared link using the send() 34 sent to another device via the infrared link using the send()
37 function. When the send has completed the done() signal is 35 function. When the send has completed the done() signal is
38 emitted. 36 emitted.
39 37
40 The supported() function returns whether the device supports 38 The supported() function returns whether the device supports
41 infrared communication or not. 39 infrared communication or not.
42 40
43 \ingroup qtopiaemb 41 \ingroup qtopiaemb
44*/ 42*/
45 43
46/*! 44/*!
47 Constructs an Ir object. The \a parent and \a name classes are the 45 Constructs an Ir object. The \a parent and \a name classes are the
48 standard QObject parameters. 46 standard QObject parameters.
49*/ 47*/
50Ir::Ir( QObject *parent, const char *name ) 48Ir::Ir( QObject *parent, const char *name )
51 : QObject( parent, name ) 49 : QObject( parent, name )
52{ 50{
53#ifndef QT_NO_COP 51#ifndef QT_NO_COP
54 ch = new QCopChannel( "QPE/Obex" ); 52 ch = new QCopChannel( "QPE/Obex" );
55 connect( ch, SIGNAL(received(const QCString &, const QByteArray &)), 53 connect( ch, SIGNAL(received(const QCString &, const QByteArray &)),
56 this, SLOT(obexMessage( const QCString &, const QByteArray &)) ); 54 this, SLOT(obexMessage( const QCString &, const QByteArray &)) );
57#endif 55#endif
58} 56}
59 57
60/*! 58/*!
61 Returns TRUE if the system supports infrared communication; 59 Returns TRUE if the system supports infrared communication;
62 otherwise returns FALSE. 60 otherwise returns FALSE.
63*/ 61*/
64bool Ir::supported() 62bool Ir::supported()
65{ 63{
66#ifndef QT_NO_COP 64#ifndef QT_NO_COP
67 return QCopChannel::isRegistered( "QPE/Obex" ); 65 return QCopChannel::isRegistered( "QPE/Obex" );
68#endif 66#endif
69} 67}
70 68
71/*! 69/*!
72 Sends the object in file \a fn over the infrared link. The \a 70 Sends the object in file \a fn over the infrared link. The \a
73 description is used in the text shown to the user while sending 71 description is used in the text shown to the user while sending
74 is in progress. The optional \a mimetype parameter specifies the 72 is in progress. The optional \a mimetype parameter specifies the
75 mimetype of the object. If this parameter is not set, it is 73 mimetype of the object. If this parameter is not set, it is
76 determined by the the filename's suffix. 74 determined by the the filename's suffix.
77 75
78 \sa done() 76 \sa done()
79*/ 77*/
80void Ir::send( const QString &fn, const QString &description, const QString &mimetype) 78void Ir::send( const QString &fn, const QString &description, const QString &mimetype)
81{ 79{
82 if ( !filename.isEmpty() ) return; 80 if ( !filename.isEmpty() ) return;
83 filename = fn; 81 filename = fn;
84#ifndef QT_NO_COP 82#ifndef QT_NO_COP
85 QCopEnvelope e("QPE/Obex", "send(QString,QString,QString)"); 83 QCopEnvelope e("QPE/Obex", "send(QString,QString,QString)");
86 e << description << filename << mimetype; 84 e << description << filename << mimetype;
87#endif 85#endif
88} 86}
89 87
90/*! 88/*!
91 \overload 89 \overload
92 90
93 Uses the DocLnk::file() and DocLnk::type() of \a doc. 91 Uses the DocLnk::file() and DocLnk::type() of \a doc.
94 92
95 \sa done() 93 \sa done()
96*/ 94*/
97void Ir::send( const DocLnk &doc, const QString &description ) 95void Ir::send( const DocLnk &doc, const QString &description )
98{ 96{
99 send( doc.file(), description, doc.type() ); 97 send( doc.file(), description, doc.type() );
100} 98}
101 99
102/*! 100/*!
103 \fn Ir::done( Ir *ir ); 101 \fn Ir::done( Ir *ir );
104 102
105 This signal is emitted by \a ir, when the send comand has been processed. 103 This signal is emitted by \a ir, when the send comand has been processed.
106*/ 104*/
107 105
108/*!\internal 106/*!\internal
109 */ 107 */
110void Ir::obexMessage( const QCString &msg, const QByteArray &data) 108void Ir::obexMessage( const QCString &msg, const QByteArray &data)
111{ 109{
112 if ( msg == "done(QString)" ) { 110 if ( msg == "done(QString)" ) {
113 QString fn; 111 QString fn;
114 QDataStream stream( data, IO_ReadOnly ); 112 QDataStream stream( data, IO_ReadOnly );
115 stream >> fn; 113 stream >> fn;
116 if ( fn == filename ) 114 if ( fn == filename )
117 emit done( this ); 115 emit done( this );
118 } 116 }
119} 117}
120 118