author | harlekin <harlekin> | 2002-06-14 10:30:25 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-06-14 10:30:25 (UTC) |
commit | a014866573fc86bf63544d1f692ccdd94c0d104f (patch) (unidiff) | |
tree | 26c91e69d84aed959b8163bb853966f67041063b | |
parent | cf54bc85d0e9846d64ca2a2af55fffc3d4e2f4ad (diff) | |
download | opie-a014866573fc86bf63544d1f692ccdd94c0d104f.zip opie-a014866573fc86bf63544d1f692ccdd94c0d104f.tar.gz opie-a014866573fc86bf63544d1f692ccdd94c0d104f.tar.bz2 |
fixed type and getting closer to finish
-rw-r--r-- | core/applets/obex/.cvsignore | 1 | ||||
-rw-r--r-- | core/applets/obex/obex.cc | 9 | ||||
-rw-r--r-- | core/applets/obex/obex.h | 2 | ||||
-rw-r--r-- | core/applets/obex/obeximpl.cc | 12 |
4 files changed, 17 insertions, 7 deletions
diff --git a/core/applets/obex/.cvsignore b/core/applets/obex/.cvsignore index c7899af..8fde018 100644 --- a/core/applets/obex/.cvsignore +++ b/core/applets/obex/.cvsignore | |||
@@ -1,6 +1,7 @@ | |||
1 | Makefile | 1 | Makefile |
2 | Makefile.in | ||
2 | moc* | 3 | moc* |
3 | obexdlg.cpp | 4 | obexdlg.cpp |
4 | obexdlg.h | 5 | obexdlg.h |
5 | obexinc.cpp | 6 | obexinc.cpp |
6 | obexinc.h | 7 | obexinc.h |
diff --git a/core/applets/obex/obex.cc b/core/applets/obex/obex.cc index fc0be3b..43041f5 100644 --- a/core/applets/obex/obex.cc +++ b/core/applets/obex/obex.cc | |||
@@ -87,41 +87,42 @@ void Obex::sendNow(){ | |||
87 | qWarning("could not send" ); | 87 | qWarning("could not send" ); |
88 | m_count = 25; | 88 | m_count = 25; |
89 | emit error(-1 ); | 89 | emit error(-1 ); |
90 | delete m_send; | 90 | delete m_send; |
91 | m_send=0; | 91 | m_send=0; |
92 | } | 92 | } |
93 | // end | 93 | // end |
94 | m_count++; | 94 | m_count++; |
95 | emit currentTry( m_count ); | 95 | emit currentTry( m_count ); |
96 | } | 96 | } |
97 | 97 | ||
98 | void Obex::slotExited(OProcess* proc ){ | 98 | void Obex::slotExited(OProcess* proc ){ |
99 | if (proc == m_rec ) { // recieve process | 99 | if (proc == m_rec ) { // receive process |
100 | recieved(); | 100 | received(); |
101 | }else if ( proc == m_send ) { | 101 | }else if ( proc == m_send ) { |
102 | sendEnd(); | 102 | sendEnd(); |
103 | } | 103 | } |
104 | } | 104 | } |
105 | void Obex::slotStdOut(OProcess* proc, char* buf, int len){ | 105 | void Obex::slotStdOut(OProcess* proc, char* buf, int len){ |
106 | if ( proc == m_rec ) { // only recieve | 106 | if ( proc == m_rec ) { // only receive |
107 | QCString cstring( buf, len ); | 107 | QCString cstring( buf, len ); |
108 | m_outp.append( cstring.data() ); | 108 | m_outp.append( cstring.data() ); |
109 | } | 109 | } |
110 | } | 110 | } |
111 | 111 | ||
112 | void Obex::recieved() { | 112 | void Obex::received() { |
113 | if (m_rec->normalExit() ) { | 113 | if (m_rec->normalExit() ) { |
114 | if ( m_rec->exitStatus() == 0 ) { // we got one | 114 | if ( m_rec->exitStatus() == 0 ) { // we got one |
115 | QString filename = parseOut(); | 115 | QString filename = parseOut(); |
116 | qWarning("ACHTUNG"); | ||
116 | emit receivedFile( filename ); | 117 | emit receivedFile( filename ); |
117 | } | 118 | } |
118 | }else{ | 119 | }else{ |
119 | emit done(false); | 120 | emit done(false); |
120 | }; | 121 | }; |
121 | delete m_rec; | 122 | delete m_rec; |
122 | m_rec = 0; | 123 | m_rec = 0; |
123 | receive(); | 124 | receive(); |
124 | } | 125 | } |
125 | 126 | ||
126 | void Obex::sendEnd() { | 127 | void Obex::sendEnd() { |
127 | if (m_send->normalExit() ) { | 128 | if (m_send->normalExit() ) { |
diff --git a/core/applets/obex/obex.h b/core/applets/obex/obex.h index 2ce44f2..781fca2 100644 --- a/core/applets/obex/obex.h +++ b/core/applets/obex/obex.h | |||
@@ -66,20 +66,20 @@ private slots: | |||
66 | */ | 66 | */ |
67 | 67 | ||
68 | //void send(const QString&); | 68 | //void send(const QString&); |
69 | 69 | ||
70 | // the process exited | 70 | // the process exited |
71 | void slotExited(OProcess* proc) ; | 71 | void slotExited(OProcess* proc) ; |
72 | void slotStdOut(OProcess*, char*, int); | 72 | void slotStdOut(OProcess*, char*, int); |
73 | void slotError(); | 73 | void slotError(); |
74 | 74 | ||
75 | private: | 75 | private: |
76 | void sendNow(); | 76 | void sendNow(); |
77 | QString parseOut(); | 77 | QString parseOut(); |
78 | void recieved(); | 78 | void received(); |
79 | void sendEnd(); | 79 | void sendEnd(); |
80 | 80 | ||
81 | }; | 81 | }; |
82 | }; | 82 | }; |
83 | 83 | ||
84 | 84 | ||
85 | #endif | 85 | #endif |
diff --git a/core/applets/obex/obeximpl.cc b/core/applets/obex/obeximpl.cc index 1a1c922..7df933a 100644 --- a/core/applets/obex/obeximpl.cc +++ b/core/applets/obex/obeximpl.cc | |||
@@ -19,61 +19,63 @@ ObexImpl::ObexImpl( ) | |||
19 | : QObject() { | 19 | : QObject() { |
20 | // register to a channel | 20 | // register to a channel |
21 | qWarning( "c'tor" ); | 21 | qWarning( "c'tor" ); |
22 | m_obex = new Obex(this, "obex"); | 22 | m_obex = new Obex(this, "obex"); |
23 | m_sendgui = new ObexDlg(); | 23 | m_sendgui = new ObexDlg(); |
24 | m_recvgui = new ObexInc(); | 24 | m_recvgui = new ObexInc(); |
25 | m_chan = new QCopChannel("QPE/Obex" ); | 25 | m_chan = new QCopChannel("QPE/Obex" ); |
26 | connect(m_chan, SIGNAL(received(const QCString&, const QByteArray& ) ), | 26 | connect(m_chan, SIGNAL(received(const QCString&, const QByteArray& ) ), |
27 | this, SLOT(slotMessage(const QCString&, const QByteArray&) ) ); | 27 | this, SLOT(slotMessage(const QCString&, const QByteArray&) ) ); |
28 | connect(m_obex, SIGNAL(receivedFile(const QString& ) ), | 28 | connect(m_obex, SIGNAL(receivedFile(const QString& ) ), |
29 | this, SLOT(slotReceivedFile(const QString& ) ) ); | 29 | this, SLOT(slotReceivedFile(const QString& ) ) ); |
30 | } | 30 | } |
31 | |||
31 | ObexImpl::~ObexImpl() { | 32 | ObexImpl::~ObexImpl() { |
32 | delete m_obex; | 33 | delete m_obex; |
33 | delete m_chan; | 34 | delete m_chan; |
34 | delete m_sendgui; | 35 | delete m_sendgui; |
35 | } | 36 | } |
37 | |||
36 | QRESULT ObexImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) { | 38 | QRESULT ObexImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) { |
37 | *iface = 0; | 39 | *iface = 0; |
38 | if( uuid == IID_QUnknown ) | 40 | if( uuid == IID_QUnknown ) |
39 | *iface = this; | 41 | *iface = this; |
40 | else if( uuid == IID_ObexInterface ) | 42 | else if( uuid == IID_ObexInterface ) |
41 | *iface = this; | 43 | *iface = this; |
42 | 44 | ||
43 | qWarning("query" ); | 45 | qWarning("query" ); |
44 | if(*iface ) | 46 | if(*iface ) |
45 | (*iface)->addRef(); | 47 | (*iface)->addRef(); |
46 | return QS_OK; | 48 | return QS_OK; |
47 | |||
48 | } | 49 | } |
50 | |||
49 | void ObexImpl::slotMessage( const QCString& msg, const QByteArray&data ) { | 51 | void ObexImpl::slotMessage( const QCString& msg, const QByteArray&data ) { |
50 | QDataStream stream( data, IO_ReadOnly ); | 52 | QDataStream stream( data, IO_ReadOnly ); |
51 | qWarning("Message %s", msg.data() ); | 53 | qWarning("Message %s", msg.data() ); |
52 | if(msg == "send(QString,QString,QString)" ) { | 54 | if(msg == "send(QString,QString,QString)" ) { |
53 | QString desc; | 55 | QString desc; |
54 | stream >> desc; | 56 | stream >> desc; |
55 | stream >> m_name; | 57 | stream >> m_name; |
56 | m_sendgui->raise(); // should be on top | 58 | m_sendgui->raise(); // should be on top |
57 | m_sendgui->showMaximized(); | 59 | m_sendgui->showMaximized(); |
58 | m_sendgui->lblPath->setText(m_name); | 60 | m_sendgui->lblPath->setText(m_name); |
59 | connect( (QObject*)m_sendgui->PushButton2, SIGNAL(clicked()), | 61 | connect( (QObject*)m_sendgui->PushButton2, SIGNAL(clicked()), |
60 | this, SLOT(slotCancelSend())); | 62 | this, SLOT(slotCancelSend())); |
61 | m_obex->send(m_name ); | 63 | m_obex->send(m_name ); |
62 | connect( (QObject*)m_obex, SIGNAL( sent() ), this, | 64 | connect( (QObject*)m_obex, SIGNAL( sent() ), this, |
63 | SLOT( slotSent() ) ); | 65 | SLOT( slotSent() ) ); |
64 | connect( (QObject*)m_obex, SIGNAL( error(int) ), this, | 66 | connect( (QObject*)m_obex, SIGNAL( error(int) ), this, |
65 | SLOT( slotSent() ) ); | 67 | SLOT( slotSent() ) ); |
66 | }else if(msg == "receive(int)" ) { // open a GUI | 68 | }else if(msg == "receive(int)" ) { // open a GUI |
67 | m_recvgui->showMaximized(); | 69 | //m_recvgui->showMaximized(); |
68 | int receiveD = 0; | 70 | int receiveD = 0; |
69 | stream >> receiveD; | 71 | stream >> receiveD; |
70 | if ( receiveD == 1) | 72 | if ( receiveD == 1) |
71 | m_obex->receive(); | 73 | m_obex->receive(); |
72 | else | 74 | else |
73 | m_obex->setReceiveEnabled( false ); | 75 | m_obex->setReceiveEnabled( false ); |
74 | 76 | ||
75 | } else if (msg =="done(QString)") { | 77 | } else if (msg =="done(QString)") { |
76 | QString text; | 78 | QString text; |
77 | stream >> text; | 79 | stream >> text; |
78 | m_sendgui->lblPath->setText(tr("Done transfering " + text)); | 80 | m_sendgui->lblPath->setText(tr("Done transfering " + text)); |
79 | 81 | ||
@@ -96,40 +98,46 @@ void ObexImpl::slotSent() { | |||
96 | m_sendgui->hide(); | 98 | m_sendgui->hide(); |
97 | } | 99 | } |
98 | 100 | ||
99 | void ObexImpl::slotError( int errorCode) { | 101 | void ObexImpl::slotError( int errorCode) { |
100 | 102 | ||
101 | QString errorString = ""; | 103 | QString errorString = ""; |
102 | if (errorCode == -1) { | 104 | if (errorCode == -1) { |
103 | errorString = "test"; | 105 | errorString = "test"; |
104 | } | 106 | } |
105 | qDebug("Error: " + errorString); | 107 | qDebug("Error: " + errorString); |
106 | m_sendgui->hide(); | 108 | m_sendgui->hide(); |
107 | } | 109 | } |
110 | |||
108 | // Received a file via beam | 111 | // Received a file via beam |
109 | // check for mime type and then either | 112 | // check for mime type and then either |
110 | // add to App via setDocument | 113 | // add to App via setDocument |
111 | void ObexImpl::slotReceivedFile( const QString &fileName ) { | 114 | void ObexImpl::slotReceivedFile( const QString &fileName ) { |
112 | qWarning("filename %s", fileName.latin1() ); | 115 | qWarning("filename %s", fileName.latin1() ); |
113 | DocLnk lnk( fileName ); | 116 | DocLnk lnk( fileName ); |
114 | QString exec = lnk.exec(); | 117 | QString exec = lnk.exec(); |
115 | qWarning("executing %s", exec.latin1() ); | 118 | qWarning("executing %s", exec.latin1() ); |
116 | if ( exec.isEmpty() || exec == "" ) { | 119 | if ( exec.isEmpty() || exec == "" ) { |
117 | qWarning("empty"); | 120 | qWarning("empty"); |
118 | if ( fileName.right(4) == ".vcf" ) | 121 | if ( fileName.right(4) == ".vcf" ) |
119 | exec = "addressbook"; | 122 | exec = "addressbook"; |
120 | else if ( fileName.right(4) == ".vcs" ) { | 123 | else if ( fileName.right(4) == ".vcs" ) { |
121 | exec = "datebook"; | 124 | exec = "datebook"; |
122 | } | 125 | } |
123 | } // now prompt and then add it | 126 | } // now prompt and then add it |
127 | |||
128 | m_recvgui->PixmapLabel->setPixmap(lnk.pixmap()); | ||
129 | m_recvgui->TextLabel1_2->setText(lnk.name()); | ||
130 | m_recvgui->showMaximized(); | ||
131 | |||
124 | QCString str= "QPE/Application/"; | 132 | QCString str= "QPE/Application/"; |
125 | str += exec.latin1(); | 133 | str += exec.latin1(); |
126 | qWarning("channel %s", str.data() ); | 134 | qWarning("channel %s", str.data() ); |
127 | QCopEnvelope e(str , "setDocument(QString)" ); | 135 | QCopEnvelope e(str , "setDocument(QString)" ); |
128 | e << fileName; | 136 | e << fileName; |
129 | 137 | ||
130 | } | 138 | } |
131 | 139 | ||
132 | 140 | ||
133 | Q_EXPORT_INTERFACE() | 141 | Q_EXPORT_INTERFACE() |
134 | { | 142 | { |
135 | Q_CREATE_INSTANCE( ObexImpl ) | 143 | Q_CREATE_INSTANCE( ObexImpl ) |