-rw-r--r-- | library/ir.cpp | 55 |
1 files changed, 48 insertions, 7 deletions
diff --git a/library/ir.cpp b/library/ir.cpp index 68345d1..a7cf7b1 100644 --- a/library/ir.cpp +++ b/library/ir.cpp | |||
@@ -1,7 +1,29 @@ | |||
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 | ||
@@ -11,5 +33,13 @@ | |||
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 | ||
@@ -21,23 +51,30 @@ Ir::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 | */ |
31 | bool Ir::supported() | 64 | bool 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 | */ |
43 | void Ir::send( const QString &fn, const QString &description, const QString &mimetype) | 80 | void Ir::send( const QString &fn, const QString &description, const QString &mimetype) |
@@ -45,6 +82,8 @@ void Ir::send( const QString &fn, const QString &description, const QString &mim | |||
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 | ||
@@ -53,4 +92,6 @@ void Ir::send( const QString &fn, const QString &description, const QString &mim | |||
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 | */ |
56 | void Ir::send( const DocLnk &doc, const QString &description ) | 97 | void Ir::send( const DocLnk &doc, const QString &description ) |