-rw-r--r-- | core/applets/obex/obeximpl.cc | 19 | ||||
-rw-r--r-- | core/applets/obex/obexinc.ui | 204 |
2 files changed, 115 insertions, 108 deletions
diff --git a/core/applets/obex/obeximpl.cc b/core/applets/obex/obeximpl.cc index da47e5b..eb0e67b 100644 --- a/core/applets/obex/obeximpl.cc +++ b/core/applets/obex/obeximpl.cc @@ -6,54 +6,59 @@ #include <qpe/qcom.h> #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& ) ) ); + connect((QObject*) m_recvgui->InsertButton, SIGNAL(clicked()), + m_recvgui, SLOT( accept() )); + connect((QObject*) m_recvgui->RejectButton, SIGNAL(clicked()), + m_recvgui, SLOT( reject() )); } ObexImpl::~ObexImpl() { delete m_obex; delete m_chan; delete m_sendgui; + delete m_recvgui; } 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(); @@ -108,38 +113,40 @@ void ObexImpl::slotError( int errorCode) { 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->AppLabel->setText(lnk.name()); m_recvgui->FileLabel->setText(fileName); m_recvgui->showMaximized(); - - QCString str= "QPE/Application/"; - str += exec.latin1(); - qWarning("channel %s", str.data() ); - QCopEnvelope e(str , "setDocument(QString)" ); - e << fileName; + if( m_recvgui->exec() != -1 ) { + 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 ) } diff --git a/core/applets/obex/obexinc.ui b/core/applets/obex/obexinc.ui index 13d2767..4cc8056 100644 --- a/core/applets/obex/obexinc.ui +++ b/core/applets/obex/obexinc.ui @@ -1,56 +1,152 @@ <!DOCTYPE UI><UI> <class>ObexInc</class> <widget> - <class>QWidget</class> + <class>QDialog</class> <property stdset="1"> <name>name</name> <cstring>ObexInc</cstring> </property> <property stdset="1"> <name>geometry</name> <rect> <x>0</x> <y>0</y> - <width>204</width> - <height>254</height> + <width>208</width> + <height>248</height> </rect> </property> <property stdset="1"> <name>caption</name> <string>OBEX Receiving</string> </property> <widget> <class>QLayoutWidget</class> <property stdset="1"> <name>name</name> + <cstring>Layout5</cstring> + </property> + <property stdset="1"> + <name>geometry</name> + <rect> + <x>90</x> + <y>100</y> + <width>79</width> + <height>68</height> + </rect> + </property> + <vbox> + <property stdset="1"> + <name>margin</name> + <number>0</number> + </property> + <property stdset="1"> + <name>spacing</name> + <number>6</number> + </property> + <widget> + <class>QLabel</class> + <property stdset="1"> + <name>name</name> + <cstring>AppLabel</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>TextLabel1</string> + </property> + </widget> + <widget> + <class>QLabel</class> + <property stdset="1"> + <name>name</name> + <cstring>FileLabel</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Filename</string> + </property> + <property stdset="1"> + <name>alignment</name> + <set>AlignTop|AlignLeft</set> + </property> + <property> + <name>vAlign</name> + </property> + </widget> + </vbox> + </widget> + <widget> + <class>QLabel</class> + <property stdset="1"> + <name>name</name> + <cstring>TextLabel1</cstring> + </property> + <property stdset="1"> + <name>geometry</name> + <rect> + <x>30</x> + <y>30</y> + <width>161</width> + <height>41</height> + </rect> + </property> + <property stdset="1"> + <name>text</name> + <string>A file was beamed +to you.</string> + </property> + </widget> + <widget> + <class>QLabel</class> + <property stdset="1"> + <name>name</name> + <cstring>PixmapLabel</cstring> + </property> + <property stdset="1"> + <name>geometry</name> + <rect> + <x>30</x> + <y>100</y> + <width>40</width> + <height>40</height> + </rect> + </property> + <property stdset="1"> + <name>scaledContents</name> + <bool>true</bool> + </property> + </widget> + <widget> + <class>QLayoutWidget</class> + <property stdset="1"> + <name>name</name> <cstring>Layout4</cstring> </property> <property stdset="1"> <name>geometry</name> <rect> - <x>1</x> - <y>206</y> + <x>0</x> + <y>210</y> <width>246</width> <height>33</height> </rect> </property> <hbox> <property stdset="1"> <name>margin</name> <number>0</number> </property> <property stdset="1"> <name>spacing</name> <number>6</number> </property> <spacer> <property> <name>name</name> <cstring>Spacer9</cstring> </property> <property stdset="1"> <name>orientation</name> <enum>Horizontal</enum> </property> <property stdset="1"> <name>sizeType</name> @@ -79,152 +175,56 @@ <property> <name>name</name> <cstring>Spacer11</cstring> </property> <property stdset="1"> <name>orientation</name> <enum>Horizontal</enum> </property> <property stdset="1"> <name>sizeType</name> <enum>Expanding</enum> </property> <property> <name>sizeHint</name> <size> <width>20</width> <height>20</height> </size> </property> </spacer> <widget> <class>QPushButton</class> <property stdset="1"> <name>name</name> - <cstring>RecjectButton</cstring> + <cstring>RejectButton</cstring> </property> <property stdset="1"> <name>text</name> <string>Reject</string> </property> </widget> <spacer> <property> <name>name</name> <cstring>Spacer10</cstring> </property> <property stdset="1"> <name>orientation</name> <enum>Horizontal</enum> </property> <property stdset="1"> <name>sizeType</name> <enum>Expanding</enum> </property> <property> <name>sizeHint</name> <size> <width>20</width> <height>20</height> </size> </property> </spacer> </hbox> </widget> - <widget> - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>PixmapLabel</cstring> - </property> - <property stdset="1"> - <name>geometry</name> - <rect> - <x>20</x> - <y>90</y> - <width>40</width> - <height>40</height> - </rect> - </property> - <property stdset="1"> - <name>scaledContents</name> - <bool>true</bool> - </property> - </widget> - <widget> - <class>QLayoutWidget</class> - <property stdset="1"> - <name>name</name> - <cstring>Layout5</cstring> - </property> - <property stdset="1"> - <name>geometry</name> - <rect> - <x>80</x> - <y>90</y> - <width>79</width> - <height>68</height> - </rect> - </property> - <vbox> - <property stdset="1"> - <name>margin</name> - <number>0</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>6</number> - </property> - <widget> - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>AppLabel</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>TextLabel1</string> - </property> - </widget> - <widget> - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>FileLabel</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Filename</string> - </property> - <property stdset="1"> - <name>alignment</name> - <set>AlignTop|AlignLeft</set> - </property> - <property> - <name>vAlign</name> - </property> - </widget> - </vbox> - </widget> - <widget> - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel1</cstring> - </property> - <property stdset="1"> - <name>geometry</name> - <rect> - <x>20</x> - <y>20</y> - <width>161</width> - <height>41</height> - </rect> - </property> - <property stdset="1"> - <name>text</name> - <string>A file was beamed -to you.</string> - </property> - </widget> </widget> </UI> |