summaryrefslogtreecommitdiff
path: root/noncore/net/opietooth
authorkorovkin <korovkin>2006-05-06 18:37:33 (UTC)
committer korovkin <korovkin>2006-05-06 18:37:33 (UTC)
commit2d9247d6c2917fd967d0d01d4d9aa6de4fb820f1 (patch) (unidiff)
treed42ffb6e48f3d0f3b6b53b6c1b628e28e0783ceb /noncore/net/opietooth
parent0430a18e64df0cdfc1e468a7f7bbe77efc63d0ca (diff)
downloadopie-2d9247d6c2917fd967d0d01d4d9aa6de4fb820f1.zip
opie-2d9247d6c2917fd967d0d01d4d9aa6de4fb820f1.tar.gz
opie-2d9247d6c2917fd967d0d01d4d9aa6de4fb820f1.tar.bz2
Browse button forces reconnection.
Diffstat (limited to 'noncore/net/opietooth') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/manager/obexftpdialog.cpp29
-rw-r--r--noncore/net/opietooth/manager/obexftpdialog.h4
2 files changed, 24 insertions, 9 deletions
diff --git a/noncore/net/opietooth/manager/obexftpdialog.cpp b/noncore/net/opietooth/manager/obexftpdialog.cpp
index 2f04ecf..efb3ff2 100644
--- a/noncore/net/opietooth/manager/obexftpdialog.cpp
+++ b/noncore/net/opietooth/manager/obexftpdialog.cpp
@@ -113,8 +113,13 @@ ObexFtpDialog::~ObexFtpDialog()
113} 113}
114 114
115void ObexFtpDialog::slotBrowse()
116{
117 doBrowse(TRUE);
118}
119
115/* 120/*
116 * Do device browsing 121 * Do device browsing
117 */ 122 */
118void ObexFtpDialog::slotBrowse() 123void ObexFtpDialog::doBrowse(bool reconnect)
119{ 124{
120 stat_entry_t* ent; //Directory entry 125 stat_entry_t* ent; //Directory entry
@@ -150,5 +155,5 @@ void ObexFtpDialog::slotBrowse()
150 } 155 }
151 156
152 if (!cli_connect_uuid(use_uuid, len)) { 157 if (!cli_connect_uuid(use_uuid, len, reconnect)) {
153 log(tr("Connection failed: ") + tr(strerror(errno))); 158 log(tr("Connection failed: ") + tr(strerror(errno)));
154 errBox("Connection failed"); 159 errBox("Connection failed");
@@ -241,5 +246,5 @@ void ObexFtpDialog::slotCd(QListViewItem* item)
241 if (obexftp_setpath(client, curdir, 0) < 0) 246 if (obexftp_setpath(client, curdir, 0) < 0)
242 log(tr("CD failed: ") + tr(strerror(errno))); 247 log(tr("CD failed: ") + tr(strerror(errno)));
243 slotBrowse(); 248 doBrowse();
244 } 249 }
245} 250}
@@ -334,5 +339,5 @@ void ObexFtpDialog::putFile()
334 } 339 }
335 else { 340 else {
336 slotBrowse(); 341 doBrowse();
337 log(local + QString(" sent")); 342 log(local + QString(" sent"));
338 status(local + QString(" sent")); 343 status(local + QString(" sent"));
@@ -372,5 +377,5 @@ void ObexFtpDialog::delFile()
372 } 377 }
373 else { 378 else {
374 slotBrowse(); 379 doBrowse();
375 log(file2get + QString(" removed")); 380 log(file2get + QString(" removed"));
376 status(file2get + QString(" removed")); 381 status(file2get + QString(" removed"));
@@ -379,9 +384,17 @@ void ObexFtpDialog::delFile()
379 384
380/* connect with given uuid. re-connect every time */ 385/* connect with given uuid. re-connect every time */
381int ObexFtpDialog::cli_connect_uuid(const uint8_t *uuid, int uuid_len) 386int ObexFtpDialog::cli_connect_uuid(const uint8_t *uuid, int uuid_len,
387 bool reconnect)
382{ 388{
383 int retry; 389 int retry;
384 if (client != NULL) 390 if (client != NULL) {
385 return TRUE; 391 if (reconnect) {
392 obexftp_disconnect(client);
393 obexftp_close(client);
394 sleep(3);
395 }
396 else
397 return TRUE;
398 }
386 /* Open */ 399 /* Open */
387 client = obexftp_open (transport, NULL, info_cb, this); 400 client = obexftp_open (transport, NULL, info_cb, this);
diff --git a/noncore/net/opietooth/manager/obexftpdialog.h b/noncore/net/opietooth/manager/obexftpdialog.h
index 75ee95b..45699d2 100644
--- a/noncore/net/opietooth/manager/obexftpdialog.h
+++ b/noncore/net/opietooth/manager/obexftpdialog.h
@@ -36,5 +36,6 @@ namespace OpieTooth {
36 void doneProgress(); 36 void doneProgress();
37 protected: 37 protected:
38 int cli_connect_uuid(const uint8_t *uuid, int uuid_len); 38 int cli_connect_uuid(const uint8_t *uuid, int uuid_len,
39 bool reconnect = FALSE);
39 int errBox(QCString msg); //Error message box 40 int errBox(QCString msg); //Error message box
40 int errBox(QString msg); //Error message box 41 int errBox(QString msg); //Error message box
@@ -43,4 +44,5 @@ namespace OpieTooth {
43 void status(QString msg); //Text in the status bar 44 void status(QString msg); //Text in the status bar
44 void status(const char* msg); //Text in the status bar 45 void status(const char* msg); //Text in the status bar
46 void doBrowse(bool reconnect = FALSE); //Browse device
45 protected: 47 protected:
46 QString m_device; //device MAC address 48 QString m_device; //device MAC address