Diffstat (limited to 'core/applets/obex/obeximpl.cc') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/applets/obex/obeximpl.cc | 12 |
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 | |||
@@ -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 ) |