-rw-r--r-- | noncore/net/opietooth/manager/obexftpdialog.cpp | 29 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/obexftpdialog.h | 4 |
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 @@ -114,2 +114,7 @@ ObexFtpDialog::~ObexFtpDialog() +void ObexFtpDialog::slotBrowse() +{ + doBrowse(TRUE); +} + /* @@ -117,3 +122,3 @@ ObexFtpDialog::~ObexFtpDialog() */ -void ObexFtpDialog::slotBrowse() +void ObexFtpDialog::doBrowse(bool reconnect) { @@ -151,3 +156,3 @@ void ObexFtpDialog::slotBrowse() - if (!cli_connect_uuid(use_uuid, len)) { + if (!cli_connect_uuid(use_uuid, len, reconnect)) { log(tr("Connection failed: ") + tr(strerror(errno))); @@ -242,3 +247,3 @@ void ObexFtpDialog::slotCd(QListViewItem* item) log(tr("CD failed: ") + tr(strerror(errno))); - slotBrowse(); + doBrowse(); } @@ -335,3 +340,3 @@ void ObexFtpDialog::putFile() else { - slotBrowse(); + doBrowse(); log(local + QString(" sent")); @@ -373,3 +378,3 @@ void ObexFtpDialog::delFile() else { - slotBrowse(); + doBrowse(); log(file2get + QString(" removed")); @@ -380,7 +385,15 @@ void ObexFtpDialog::delFile() /* connect with given uuid. re-connect every time */ -int ObexFtpDialog::cli_connect_uuid(const uint8_t *uuid, int uuid_len) +int ObexFtpDialog::cli_connect_uuid(const uint8_t *uuid, int uuid_len, + bool reconnect) { int retry; - if (client != NULL) - return TRUE; + if (client != NULL) { + if (reconnect) { + obexftp_disconnect(client); + obexftp_close(client); + sleep(3); + } + else + return TRUE; + } /* Open */ 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 @@ -37,3 +37,4 @@ namespace OpieTooth { protected: - int cli_connect_uuid(const uint8_t *uuid, int uuid_len); + int cli_connect_uuid(const uint8_t *uuid, int uuid_len, + bool reconnect = FALSE); int errBox(QCString msg); //Error message box @@ -44,2 +45,3 @@ namespace OpieTooth { void status(const char* msg); //Text in the status bar + void doBrowse(bool reconnect = FALSE); //Browse device protected: |