summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/obex/obex.cc8
-rw-r--r--core/obex/receiver.cpp4
2 files changed, 8 insertions, 4 deletions
diff --git a/core/obex/obex.cc b/core/obex/obex.cc
index 92cd317..b8ed6e0 100644
--- a/core/obex/obex.cc
+++ b/core/obex/obex.cc
@@ -8,25 +8,25 @@
8 8
9using namespace OpieObex; 9using namespace OpieObex;
10 10
11Obex::Obex( QObject *parent, const char* name ) 11Obex::Obex( QObject *parent, const char* name )
12 : QObject(parent, name ) 12 : QObject(parent, name )
13{ 13{
14 m_rec = 0; 14 m_rec = 0;
15 m_send=0; 15 m_send=0;
16 m_count = 0; 16 m_count = 0;
17 m_receive = false; 17 m_receive = false;
18 connect( this, SIGNAL(error(int) ), // for recovering to receive 18 connect( this, SIGNAL(error(int) ), // for recovering to receive
19 SLOT(slotError() ) ); 19 SLOT(slotError() ) );
20 connect( this, SIGNAL(sent() ), 20 connect( this, SIGNAL(sent(bool) ),
21 SLOT(slotError() ) ); 21 SLOT(slotError() ) );
22}; 22};
23Obex::~Obex() { 23Obex::~Obex() {
24 delete m_rec; 24 delete m_rec;
25 delete m_send; 25 delete m_send;
26} 26}
27void Obex::receive() { 27void Obex::receive() {
28 m_receive = true; 28 m_receive = true;
29 m_outp = QString::null; 29 m_outp = QString::null;
30 qWarning("Receive" ); 30 qWarning("Receive" );
31 m_rec = new OProcess(); 31 m_rec = new OProcess();
32 *m_rec << "irobex_palm3"; 32 *m_rec << "irobex_palm3";
@@ -97,34 +97,34 @@ void Obex::sendNow(){
97 emit currentTry( m_count ); 97 emit currentTry( m_count );
98} 98}
99 99
100void Obex::slotExited(OProcess* proc ){ 100void Obex::slotExited(OProcess* proc ){
101 if (proc == m_rec ) { // receive process 101 if (proc == m_rec ) { // receive process
102 received(); 102 received();
103 }else if ( proc == m_send ) { 103 }else if ( proc == m_send ) {
104 sendEnd(); 104 sendEnd();
105 } 105 }
106} 106}
107void Obex::slotStdOut(OProcess* proc, char* buf, int len){ 107void Obex::slotStdOut(OProcess* proc, char* buf, int len){
108 if ( proc == m_rec ) { // only receive 108 if ( proc == m_rec ) { // only receive
109 QCString cstring( buf, len ); 109 QString str = QString::fromUtf8( buf, len );
110 m_outp.append( cstring.data() ); 110 m_outp.append( str );
111 } 111 }
112} 112}
113 113
114void Obex::received() { 114void Obex::received() {
115 if (m_rec->normalExit() ) { 115 if (m_rec->normalExit() ) {
116 if ( m_rec->exitStatus() == 0 ) { // we got one 116 if ( m_rec->exitStatus() == 0 ) { // we got one
117 QString filename = parseOut(); 117 QString filename = parseOut();
118 qWarning("ACHTUNG"); 118 qWarning("ACHTUNG %s", filename.latin1() );
119 emit receivedFile( filename ); 119 emit receivedFile( filename );
120 } 120 }
121 }else{ 121 }else{
122 emit done(false); 122 emit done(false);
123 }; 123 };
124 delete m_rec; 124 delete m_rec;
125 m_rec = 0; 125 m_rec = 0;
126 receive(); 126 receive();
127} 127}
128 128
129void Obex::sendEnd() { 129void Obex::sendEnd() {
130 if (m_send->normalExit() ) { 130 if (m_send->normalExit() ) {
diff --git a/core/obex/receiver.cpp b/core/obex/receiver.cpp
index 50ee6cb..d5a7271 100644
--- a/core/obex/receiver.cpp
+++ b/core/obex/receiver.cpp
@@ -51,32 +51,35 @@ void Receiver::handleDateTodo( const QString& str ) {
51 QCopEnvelope e1("QPE/Application/datebook", "setDocument(QString)" ); 51 QCopEnvelope e1("QPE/Application/datebook", "setDocument(QString)" );
52 e1 << str; 52 e1 << str;
53} 53}
54/* 54/*
55 * Handle other asks if it should accept the 55 * Handle other asks if it should accept the
56 * beamed object and creates a DocLnk 56 * beamed object and creates a DocLnk
57 */ 57 */
58void Receiver::handleOther( const QString& other ) { 58void Receiver::handleOther( const QString& other ) {
59 OtherHandler* hand = new OtherHandler(); 59 OtherHandler* hand = new OtherHandler();
60 hand->handle( other ); 60 hand->handle( other );
61} 61}
62int Receiver::checkFile( const QString& file ) { 62int Receiver::checkFile( const QString& file ) {
63 qWarning("check file!! %s", file.latin1() );
63 int ret; 64 int ret;
64 if (file.right(4) == ".vcs" ) { 65 if (file.right(4) == ".vcs" ) {
65 ret = Datebook; 66 ret = Datebook;
66 }else if ( file.right(4) == ".vcf") { 67 }else if ( file.right(4) == ".vcf") {
67 ret = AddressBook; 68 ret = AddressBook;
68 }else 69 }else
69 ret = Other; 70 ret = Other;
70 71
72
73 qWarning("check it now %d", ret );
71 return ret; 74 return ret;
72} 75}
73 76
74OtherHandler::OtherHandler() 77OtherHandler::OtherHandler()
75 : QVBox() 78 : QVBox()
76{ 79{
77 QHBox* box = new QHBox(this); 80 QHBox* box = new QHBox(this);
78 QLabel* lbl = new QLabel(box); 81 QLabel* lbl = new QLabel(box);
79 lbl->setText(tr("<qt><b>Received:</b></qt>")); 82 lbl->setText(tr("<qt><b>Received:</b></qt>"));
80 m_na = new QLabel(box); 83 m_na = new QLabel(box);
81 84
82 QFrame* frame = new QFrame(this); 85 QFrame* frame = new QFrame(this);
@@ -97,24 +100,25 @@ OtherHandler::OtherHandler()
97 this, SLOT(deny() ) ); 100 this, SLOT(deny() ) );
98 101
99 raise(); 102 raise();
100 showMaximized(); 103 showMaximized();
101} 104}
102OtherHandler::~OtherHandler() { 105OtherHandler::~OtherHandler() {
103 106
104} 107}
105void OtherHandler::handle( const QString& file ) { 108void OtherHandler::handle( const QString& file ) {
106 m_file = file; 109 m_file = file;
107 m_na->setText(file); 110 m_na->setText(file);
108 DocLnk lnk(file); 111 DocLnk lnk(file);
112 qWarning(" %s %s", lnk.type().latin1(), lnk.icon().latin1() );
109 113
110 QString str = tr("<p>You received a file of type %1 (<img src=\"%2\"> )What do you want to do?").arg(lnk.type() ).arg(lnk.icon() ); 114 QString str = tr("<p>You received a file of type %1 (<img src=\"%2\"> )What do you want to do?").arg(lnk.type() ).arg(lnk.icon() );
111 m_view->setText( str ); 115 m_view->setText( str );
112} 116}
113 117
114/* 118/*
115 * hehe evil evil mmap ahead :) 119 * hehe evil evil mmap ahead :)
116 * we quickly copy the file and then we'll create a DocLnk for it 120 * we quickly copy the file and then we'll create a DocLnk for it
117 */ 121 */
118void OtherHandler::accept() { 122void OtherHandler::accept() {
119 QString na = targetName( m_file ); 123 QString na = targetName( m_file );
120 copy(m_file, na ); 124 copy(m_file, na );