summaryrefslogtreecommitdiff
path: root/core
Side-by-side diff
Diffstat (limited to 'core') (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/obex/.cvsignore1
-rw-r--r--core/applets/obex/obex.cc9
-rw-r--r--core/applets/obex/obex.h2
-rw-r--r--core/applets/obex/obeximpl.cc12
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 @@
Makefile
+Makefile.in
moc*
obexdlg.cpp
obexdlg.h
obexinc.cpp
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
@@ -75,65 +75,66 @@ void Obex::sendNow(){
m_send = new OProcess();
*m_send << "irobex_palm3";
*m_send << m_file;
// connect to slots Exited and and StdOut
connect(m_send, SIGNAL(processExited(OProcess*) ),
this, SLOT(slotExited(OProcess*)) );
connect(m_send, SIGNAL(receivedStdout(OProcess*, char*, int )),
this, SLOT(slotStdOut(OProcess*, char*, int) ) );
// now start it
if (!m_send->start(/*OProcess::NotifyOnExit, OProcess::AllOutput*/ ) ) {
qWarning("could not send" );
m_count = 25;
emit error(-1 );
delete m_send;
m_send=0;
}
// end
m_count++;
emit currentTry( m_count );
}
void Obex::slotExited(OProcess* proc ){
- if (proc == m_rec ) { // recieve process
- recieved();
+ if (proc == m_rec ) { // receive process
+ received();
}else if ( proc == m_send ) {
sendEnd();
}
}
void Obex::slotStdOut(OProcess* proc, char* buf, int len){
- if ( proc == m_rec ) { // only recieve
+ if ( proc == m_rec ) { // only receive
QCString cstring( buf, len );
m_outp.append( cstring.data() );
}
}
-void Obex::recieved() {
+void Obex::received() {
if (m_rec->normalExit() ) {
if ( m_rec->exitStatus() == 0 ) { // we got one
QString filename = parseOut();
+ qWarning("ACHTUNG");
emit receivedFile( filename );
}
}else{
emit done(false);
};
delete m_rec;
m_rec = 0;
receive();
}
void Obex::sendEnd() {
if (m_send->normalExit() ) {
if ( m_send->exitStatus() == 0 ) {
delete m_send;
m_send=0;
qWarning("done" );
emit sent();
}else if (m_send->exitStatus() == 255 ) { // it failed maybe the other side wasn't ready
// let's try it again
delete m_send;
m_send = 0;
qWarning("try sending again" );
sendNow();
}
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
@@ -54,32 +54,32 @@ namespace OpieObex {
uint m_count;
QString m_file;
QString m_outp;
OProcess *m_send;
OProcess *m_rec;
bool m_receive : 1;
void shutDownReceive();
private slots:
/**
* send over palm obex
*/
//void send(const QString&);
// the process exited
void slotExited(OProcess* proc) ;
void slotStdOut(OProcess*, char*, int);
void slotError();
private:
void sendNow();
QString parseOut();
- void recieved();
+ void received();
void sendEnd();
};
};
#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
@@ -7,130 +7,138 @@
#include <qpe/applnk.h>
#include <qlabel.h>
#include "obex.h"
#include "obeximpl.h"
using namespace OpieObex;
ObexImpl::ObexImpl( )
: QObject() {
// register to a channel
qWarning( "c'tor" );
m_obex = new Obex(this, "obex");
m_sendgui = new ObexDlg();
m_recvgui = new ObexInc();
m_chan = new QCopChannel("QPE/Obex" );
connect(m_chan, SIGNAL(received(const QCString&, const QByteArray& ) ),
this, SLOT(slotMessage(const QCString&, const QByteArray&) ) );
connect(m_obex, SIGNAL(receivedFile(const QString& ) ),
this, SLOT(slotReceivedFile(const QString& ) ) );
}
+
ObexImpl::~ObexImpl() {
delete m_obex;
delete m_chan;
delete m_sendgui;
}
+
QRESULT ObexImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) {
*iface = 0;
if( uuid == IID_QUnknown )
*iface = this;
else if( uuid == IID_ObexInterface )
*iface = this;
qWarning("query" );
if(*iface )
(*iface)->addRef();
return QS_OK;
-
}
+
void ObexImpl::slotMessage( const QCString& msg, const QByteArray&data ) {
QDataStream stream( data, IO_ReadOnly );
qWarning("Message %s", msg.data() );
if(msg == "send(QString,QString,QString)" ) {
QString desc;
stream >> desc;
stream >> m_name;
m_sendgui->raise(); // should be on top
m_sendgui->showMaximized();
m_sendgui->lblPath->setText(m_name);
connect( (QObject*)m_sendgui->PushButton2, SIGNAL(clicked()),
this, SLOT(slotCancelSend()));
m_obex->send(m_name );
connect( (QObject*)m_obex, SIGNAL( sent() ), this,
SLOT( slotSent() ) );
connect( (QObject*)m_obex, SIGNAL( error(int) ), this,
SLOT( slotSent() ) );
}else if(msg == "receive(int)" ) { // open a GUI
- m_recvgui->showMaximized();
+ //m_recvgui->showMaximized();
int receiveD = 0;
stream >> receiveD;
if ( receiveD == 1)
m_obex->receive();
else
m_obex->setReceiveEnabled( false );
} else if (msg =="done(QString)") {
QString text;
stream >> text;
m_sendgui->lblPath->setText(tr("Done transfering " + text));
}
}
void ObexImpl::slotCancelSend() {
// cancel sync process too
//m_obex->cancel(); // not ready yet
m_sendgui->hide();
}
void ObexImpl::slotDone(bool) {
QCopEnvelope e ("QPE/Obex", "done(QString)" ); //but this into a slot
e << m_name;
}
void ObexImpl::slotSent() {
m_sendgui->lblPath->setText("Done!");
m_sendgui->hide();
}
void ObexImpl::slotError( int errorCode) {
QString errorString = "";
if (errorCode == -1) {
errorString = "test";
}
qDebug("Error: " + errorString);
m_sendgui->hide();
}
+
// Received a file via beam
// check for mime type and then either
// add to App via setDocument
void ObexImpl::slotReceivedFile( const QString &fileName ) {
qWarning("filename %s", fileName.latin1() );
DocLnk lnk( fileName );
QString exec = lnk.exec();
qWarning("executing %s", exec.latin1() );
if ( exec.isEmpty() || exec == "" ) {
qWarning("empty");
if ( fileName.right(4) == ".vcf" )
exec = "addressbook";
else if ( fileName.right(4) == ".vcs" ) {
exec = "datebook";
}
} // now prompt and then add it
+
+ m_recvgui->PixmapLabel->setPixmap(lnk.pixmap());
+ m_recvgui->TextLabel1_2->setText(lnk.name());
+ m_recvgui->showMaximized();
+
QCString str= "QPE/Application/";
str += exec.latin1();
qWarning("channel %s", str.data() );
QCopEnvelope e(str , "setDocument(QString)" );
e << fileName;
}
Q_EXPORT_INTERFACE()
{
Q_CREATE_INSTANCE( ObexImpl )
}