summaryrefslogtreecommitdiff
path: root/core/applets/obex/obeximpl.cc
Unidiff
Diffstat (limited to 'core/applets/obex/obeximpl.cc') (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/obex/obeximpl.cc12
1 files changed, 10 insertions, 2 deletions
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
@@ -25,30 +25,32 @@ ObexImpl::ObexImpl( )
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
31ObexImpl::~ObexImpl() { 32ObexImpl::~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
36QRESULT ObexImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) { 38QRESULT 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
49void ObexImpl::slotMessage( const QCString& msg, const QByteArray&data ) { 51void 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;
@@ -61,13 +63,13 @@ void ObexImpl::slotMessage( const QCString& msg, const QByteArray&data ) {
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 );
@@ -102,12 +104,13 @@ void ObexImpl::slotError( int errorCode) {
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
111void ObexImpl::slotReceivedFile( const QString &fileName ) { 114void 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 );
@@ -118,12 +121,17 @@ void ObexImpl::slotReceivedFile( const QString &fileName ) {
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