author | zecke <zecke> | 2004-03-14 17:37:48 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-03-14 17:37:48 (UTC) |
commit | d69b11f67e3118f86d068c38c422984d754e13cc (patch) (unidiff) | |
tree | 9733e26ab49003bead06d820d70a14babd0c09f0 /core/obex | |
parent | 64820b76cc9d1c06a6967cd34114f3b95896aaeb (diff) | |
download | opie-d69b11f67e3118f86d068c38c422984d754e13cc.zip opie-d69b11f67e3118f86d068c38c422984d754e13cc.tar.gz opie-d69b11f67e3118f86d068c38c422984d754e13cc.tar.bz2 |
Updatet the applets
-rw-r--r-- | core/obex/config.in | 2 | ||||
-rw-r--r-- | core/obex/obex.cc | 19 | ||||
-rw-r--r-- | core/obex/obex.h | 10 | ||||
-rw-r--r-- | core/obex/obex.pro | 4 | ||||
-rw-r--r-- | core/obex/obeximpl.cpp | 2 |
5 files changed, 20 insertions, 17 deletions
diff --git a/core/obex/config.in b/core/obex/config.in index ef09f7a..c0208d1 100644 --- a/core/obex/config.in +++ b/core/obex/config.in | |||
@@ -1,4 +1,4 @@ | |||
1 | config OBEX | 1 | config OBEX |
2 | boolean "libopieobex0 (library needed for beaming in Opie)" | 2 | boolean "libopieobex0 (library needed for beaming in Opie)" |
3 | default "y" | 3 | default "y" |
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE | 4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIECORE2 |
diff --git a/core/obex/obex.cc b/core/obex/obex.cc index 50e5201..3c99af6 100644 --- a/core/obex/obex.cc +++ b/core/obex/obex.cc | |||
@@ -1,110 +1,111 @@ | |||
1 | 1 | ||
2 | #include <qfileinfo.h> | 2 | #include <qfileinfo.h> |
3 | 3 | ||
4 | 4 | ||
5 | #include <opie/oprocess.h> | 5 | #include <opie2/oprocess.h> |
6 | #include "obex.h" | 6 | #include "obex.h" |
7 | 7 | ||
8 | using namespace OpieObex; | 8 | using namespace OpieObex; |
9 | 9 | ||
10 | using namespace Opie::Core; | ||
10 | /* TRANSLATOR OpieObex::Obex */ | 11 | /* TRANSLATOR OpieObex::Obex */ |
11 | 12 | ||
12 | Obex::Obex( QObject *parent, const char* name ) | 13 | Obex::Obex( QObject *parent, const char* name ) |
13 | : QObject(parent, name ) | 14 | : QObject(parent, name ) |
14 | { | 15 | { |
15 | m_rec = 0; | 16 | m_rec = 0; |
16 | m_send=0; | 17 | m_send=0; |
17 | m_count = 0; | 18 | m_count = 0; |
18 | m_receive = false; | 19 | m_receive = false; |
19 | connect( this, SIGNAL(error(int) ), // for recovering to receive | 20 | connect( this, SIGNAL(error(int) ), // for recovering to receive |
20 | SLOT(slotError() ) ); | 21 | SLOT(slotError() ) ); |
21 | connect( this, SIGNAL(sent(bool) ), | 22 | connect( this, SIGNAL(sent(bool) ), |
22 | SLOT(slotError() ) ); | 23 | SLOT(slotError() ) ); |
23 | }; | 24 | }; |
24 | Obex::~Obex() { | 25 | Obex::~Obex() { |
25 | delete m_rec; | 26 | delete m_rec; |
26 | delete m_send; | 27 | delete m_send; |
27 | } | 28 | } |
28 | void Obex::receive() { | 29 | void Obex::receive() { |
29 | m_receive = true; | 30 | m_receive = true; |
30 | m_outp = QString::null; | 31 | m_outp = QString::null; |
31 | qWarning("Receive" ); | 32 | qWarning("Receive" ); |
32 | m_rec = new OProcess(); | 33 | m_rec = new OProcess(); |
33 | *m_rec << "irobex_palm3"; | 34 | *m_rec << "irobex_palm3"; |
34 | // connect to the necessary slots | 35 | // connect to the necessary slots |
35 | connect(m_rec, SIGNAL(processExited(OProcess*) ), | 36 | connect(m_rec, SIGNAL(processExited(Opie::Core::OProcess*) ), |
36 | this, SLOT(slotExited(OProcess*) ) ); | 37 | this, SLOT(slotExited(Opie::Core::OProcess*) ) ); |
37 | 38 | ||
38 | connect(m_rec, SIGNAL(receivedStdout(OProcess*, char*, int ) ), | 39 | connect(m_rec, SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int ) ), |
39 | this, SLOT(slotStdOut(OProcess*, char*, int) ) ); | 40 | this, SLOT(slotStdOut(Opie::Core::OProcess*, char*, int) ) ); |
40 | 41 | ||
41 | if(!m_rec->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { | 42 | if(!m_rec->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { |
42 | qWarning("could not start :("); | 43 | qWarning("could not start :("); |
43 | emit done( false ); | 44 | emit done( false ); |
44 | delete m_rec; | 45 | delete m_rec; |
45 | m_rec = 0; | 46 | m_rec = 0; |
46 | } | 47 | } |
47 | // emit currentTry(m_count ); | 48 | // emit currentTry(m_count ); |
48 | 49 | ||
49 | } | 50 | } |
50 | void Obex::send( const QString& fileName) { // if currently receiving stop it send receive | 51 | void Obex::send( const QString& fileName) { // if currently receiving stop it send receive |
51 | m_count = 0; | 52 | m_count = 0; |
52 | m_file = fileName; | 53 | m_file = fileName; |
53 | qWarning("send %s", fileName.latin1() ); | 54 | qWarning("send %s", fileName.latin1() ); |
54 | if (m_rec != 0 ) { | 55 | if (m_rec != 0 ) { |
55 | qWarning("running"); | 56 | qWarning("running"); |
56 | if (m_rec->isRunning() ) { | 57 | if (m_rec->isRunning() ) { |
57 | emit error(-1 ); | 58 | emit error(-1 ); |
58 | qWarning("is running"); | 59 | qWarning("is running"); |
59 | delete m_rec; | 60 | delete m_rec; |
60 | m_rec = 0; | 61 | m_rec = 0; |
61 | 62 | ||
62 | }else{ | 63 | }else{ |
63 | qWarning("is not running"); | 64 | qWarning("is not running"); |
64 | emit error( -1 ); // we did not delete yet but it's not running slotExited is pending | 65 | emit error( -1 ); // we did not delete yet but it's not running slotExited is pending |
65 | return; | 66 | return; |
66 | } | 67 | } |
67 | } | 68 | } |
68 | sendNow(); | 69 | sendNow(); |
69 | } | 70 | } |
70 | void Obex::sendNow(){ | 71 | void Obex::sendNow(){ |
71 | qWarning("sendNow"); | 72 | qWarning("sendNow"); |
72 | if ( m_count >= 25 ) { // could not send | 73 | if ( m_count >= 25 ) { // could not send |
73 | emit error(-1 ); | 74 | emit error(-1 ); |
74 | emit sent(false); | 75 | emit sent(false); |
75 | return; | 76 | return; |
76 | } | 77 | } |
77 | // OProcess inititialisation | 78 | // OProcess inititialisation |
78 | m_send = new OProcess(); | 79 | m_send = new OProcess(); |
79 | *m_send << "irobex_palm3"; | 80 | *m_send << "irobex_palm3"; |
80 | *m_send << QFile::encodeName(m_file); | 81 | *m_send << QFile::encodeName(m_file); |
81 | 82 | ||
82 | // connect to slots Exited and and StdOut | 83 | // connect to slots Exited and and StdOut |
83 | connect(m_send, SIGNAL(processExited(OProcess*) ), | 84 | connect(m_send, SIGNAL(processExited(Opie::Core::OProcess*) ), |
84 | this, SLOT(slotExited(OProcess*)) ); | 85 | this, SLOT(slotExited(Opie::Core::OProcess*)) ); |
85 | connect(m_send, SIGNAL(receivedStdout(OProcess*, char*, int )), | 86 | connect(m_send, SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int )), |
86 | this, SLOT(slotStdOut(OProcess*, char*, int) ) ); | 87 | this, SLOT(slotStdOut(Opie::Core::OProcess*, char*, int) ) ); |
87 | 88 | ||
88 | // now start it | 89 | // now start it |
89 | if (!m_send->start(/*OProcess::NotifyOnExit, OProcess::AllOutput*/ ) ) { | 90 | if (!m_send->start(/*OProcess::NotifyOnExit, OProcess::AllOutput*/ ) ) { |
90 | qWarning("could not send" ); | 91 | qWarning("could not send" ); |
91 | m_count = 25; | 92 | m_count = 25; |
92 | emit error(-1 ); | 93 | emit error(-1 ); |
93 | delete m_send; | 94 | delete m_send; |
94 | m_send=0; | 95 | m_send=0; |
95 | } | 96 | } |
96 | // end | 97 | // end |
97 | m_count++; | 98 | m_count++; |
98 | emit currentTry( m_count ); | 99 | emit currentTry( m_count ); |
99 | } | 100 | } |
100 | 101 | ||
101 | void Obex::slotExited(OProcess* proc ){ | 102 | void Obex::slotExited(OProcess* proc ){ |
102 | if (proc == m_rec ) { // receive process | 103 | if (proc == m_rec ) { // receive process |
103 | received(); | 104 | received(); |
104 | }else if ( proc == m_send ) { | 105 | }else if ( proc == m_send ) { |
105 | sendEnd(); | 106 | sendEnd(); |
106 | } | 107 | } |
107 | } | 108 | } |
108 | void Obex::slotStdOut(OProcess* proc, char* buf, int len){ | 109 | void Obex::slotStdOut(OProcess* proc, char* buf, int len){ |
109 | if ( proc == m_rec ) { // only receive | 110 | if ( proc == m_rec ) { // only receive |
110 | QByteArray ar( len ); | 111 | QByteArray ar( len ); |
diff --git a/core/obex/obex.h b/core/obex/obex.h index 60f5d28..284cb12 100644 --- a/core/obex/obex.h +++ b/core/obex/obex.h | |||
@@ -1,84 +1,84 @@ | |||
1 | 1 | ||
2 | 2 | ||
3 | #ifndef OpieObex_H | 3 | #ifndef OpieObex_H |
4 | #define OpieObex_H | 4 | #define OpieObex_H |
5 | 5 | ||
6 | #include <qobject.h> | 6 | #include <qobject.h> |
7 | 7 | ||
8 | class OProcess; | 8 | namespace Opie {namespace Core {class OProcess;}} |
9 | class QCopChannel; | 9 | class QCopChannel; |
10 | namespace OpieObex { | 10 | namespace OpieObex { |
11 | class Obex : public QObject { | 11 | class Obex : public QObject { |
12 | Q_OBJECT | 12 | Q_OBJECT |
13 | public: | 13 | public: |
14 | /** | 14 | /** |
15 | * Obex c'tor look | 15 | * Obex c'tor look |
16 | */ | 16 | */ |
17 | Obex( QObject *parent, const char* name); | 17 | Obex( QObject *parent, const char* name); |
18 | /** | 18 | /** |
19 | * d'tor | 19 | * d'tor |
20 | */ | 20 | */ |
21 | ~Obex(); | 21 | ~Obex(); |
22 | 22 | ||
23 | /** | 23 | /** |
24 | * Starting listening to irda after enabled by the applet | 24 | * Starting listening to irda after enabled by the applet |
25 | * a signal gets emitted when recieved a file | 25 | * a signal gets emitted when recieved a file |
26 | */ | 26 | */ |
27 | void receive(); | 27 | void receive(); |
28 | void send( const QString& ); | 28 | void send( const QString& ); |
29 | void setReceiveEnabled( bool = false ); | 29 | void setReceiveEnabled( bool = false ); |
30 | signals: | 30 | signals: |
31 | 31 | ||
32 | /** | 32 | /** |
33 | * a signal | 33 | * a signal |
34 | * @param path The path to the recieved file | 34 | * @param path The path to the recieved file |
35 | */ | 35 | */ |
36 | void receivedFile( const QString& path); | 36 | void receivedFile( const QString& path); |
37 | /** | 37 | /** |
38 | * error signal if the program couldn't be started or the | 38 | * error signal if the program couldn't be started or the |
39 | * the connection timed out | 39 | * the connection timed out |
40 | */ | 40 | */ |
41 | void error( int ); | 41 | void error( int ); |
42 | /** | 42 | /** |
43 | * The current try to receive data | 43 | * The current try to receive data |
44 | */ | 44 | */ |
45 | void currentTry(unsigned int); | 45 | void currentTry(unsigned int); |
46 | /** | 46 | /** |
47 | * signal sent The file got beamed to the remote location | 47 | * signal sent The file got beamed to the remote location |
48 | */ | 48 | */ |
49 | void sent(bool); | 49 | void sent(bool); |
50 | void done(bool); | 50 | void done(bool); |
51 | 51 | ||
52 | private: | 52 | private: |
53 | uint m_count; | 53 | uint m_count; |
54 | QString m_file; | 54 | QString m_file; |
55 | QString m_outp; | 55 | QString m_outp; |
56 | OProcess *m_send; | 56 | Opie::Core::OProcess *m_send; |
57 | OProcess *m_rec; | 57 | Opie::Core::OProcess *m_rec; |
58 | bool m_receive : 1; | 58 | bool m_receive : 1; |
59 | void shutDownReceive(); | 59 | void shutDownReceive(); |
60 | 60 | ||
61 | private slots: | 61 | private slots: |
62 | 62 | ||
63 | /** | 63 | /** |
64 | * send over palm obex | 64 | * send over palm obex |
65 | */ | 65 | */ |
66 | 66 | ||
67 | //void send(const QString&); | 67 | //void send(const QString&); |
68 | 68 | ||
69 | // the process exited | 69 | // the process exited |
70 | void slotExited(OProcess* proc) ; | 70 | void slotExited(Opie::Core::OProcess* proc) ; |
71 | void slotStdOut(OProcess*, char*, int); | 71 | void slotStdOut(Opie::Core::OProcess*, char*, int); |
72 | void slotError(); | 72 | void slotError(); |
73 | 73 | ||
74 | private: | 74 | private: |
75 | void sendNow(); | 75 | void sendNow(); |
76 | QString parseOut(); | 76 | QString parseOut(); |
77 | void received(); | 77 | void received(); |
78 | void sendEnd(); | 78 | void sendEnd(); |
79 | 79 | ||
80 | }; | 80 | }; |
81 | }; | 81 | }; |
82 | 82 | ||
83 | 83 | ||
84 | #endif | 84 | #endif |
diff --git a/core/obex/obex.pro b/core/obex/obex.pro index a296b2c..51fa300 100644 --- a/core/obex/obex.pro +++ b/core/obex/obex.pro | |||
@@ -1,13 +1,13 @@ | |||
1 | TEMPLATE= lib | 1 | TEMPLATE= lib |
2 | CONFIG += qt warn_on release | 2 | CONFIG += qt warn_on release |
3 | HEADERS= obex.h obexhandler.h obexsend.h receiver.h | 3 | HEADERS= obex.h obexhandler.h obexsend.h receiver.h obeximpl.h |
4 | SOURCES= obex.cc obexsend.cpp obexhandler.cpp receiver.cpp | 4 | SOURCES= obex.cc obexsend.cpp obexhandler.cpp receiver.cpp obeximpl.cpp |
5 | TARGET = opieobex | 5 | TARGET = opieobex |
6 | DESTDIR = $(OPIEDIR)/plugins/obex | 6 | DESTDIR = $(OPIEDIR)/plugins/obex |
7 | INCLUDEPATH += $(OPIEDIR)/include $(OPIEDIR)/core/launcher | 7 | INCLUDEPATH += $(OPIEDIR)/include $(OPIEDIR)/core/launcher |
8 | DEPENDPATH += ../$(OPIEDIR)/include | 8 | DEPENDPATH += ../$(OPIEDIR)/include |
9 | LIBS += -lqpe -lopiecore2 | 9 | LIBS += -lqpe -lopiecore2 |
10 | VERSION = 0.0.2 | 10 | VERSION = 0.0.2 |
11 | 11 | ||
12 | include ( $(OPIEDIR)/include.pro ) | 12 | include ( $(OPIEDIR)/include.pro ) |
13 | target.path = $$prefix/plugins/applets | 13 | target.path = $$prefix/plugins/applets |
diff --git a/core/obex/obeximpl.cpp b/core/obex/obeximpl.cpp index 5b53644..ca6ce7b 100644 --- a/core/obex/obeximpl.cpp +++ b/core/obex/obeximpl.cpp | |||
@@ -1,27 +1,29 @@ | |||
1 | #include "obexhandler.h" | 1 | #include "obexhandler.h" |
2 | #include "obeximpl.h" | 2 | #include "obeximpl.h" |
3 | 3 | ||
4 | |||
5 | |||
4 | using namespace OpieObex; | 6 | using namespace OpieObex; |
5 | 7 | ||
6 | /* TRANSLATOR OpieObex::ObexImpl */ | 8 | /* TRANSLATOR OpieObex::ObexImpl */ |
7 | 9 | ||
8 | ObexImpl::ObexImpl() { | 10 | ObexImpl::ObexImpl() { |
9 | m_handler = new ObexHandler; | 11 | m_handler = new ObexHandler; |
10 | } | 12 | } |
11 | ObexImpl::~ObexImpl() { | 13 | ObexImpl::~ObexImpl() { |
12 | delete m_handler; | 14 | delete m_handler; |
13 | } | 15 | } |
14 | QRESULT ObexImpl::queryInterface( const QUuid& uuid, QUnknownInterface **iface ) { | 16 | QRESULT ObexImpl::queryInterface( const QUuid& uuid, QUnknownInterface **iface ) { |
15 | *iface = 0; | 17 | *iface = 0; |
16 | if ( uuid == IID_QUnknown ) { | 18 | if ( uuid == IID_QUnknown ) { |
17 | *iface = this; | 19 | *iface = this; |
18 | }else if ( uuid == IID_ObexInterface ) | 20 | }else if ( uuid == IID_ObexInterface ) |
19 | *iface = this; | 21 | *iface = this; |
20 | else | 22 | else |
21 | return QS_FALSE; | 23 | return QS_FALSE; |
22 | 24 | ||
23 | if (*iface) | 25 | if (*iface) |
24 | (*iface)->addRef(); | 26 | (*iface)->addRef(); |
25 | 27 | ||
26 | return QS_OK; | 28 | return QS_OK; |
27 | } | 29 | } |