summaryrefslogtreecommitdiff
path: root/noncore/net/opietooth
Side-by-side diff
Diffstat (limited to 'noncore/net/opietooth') (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/opietooth/manager/obexftpdialog.cpp27
-rw-r--r--noncore/net/opietooth/manager/obexftpdialog.h4
2 files changed, 23 insertions, 8 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()
}
+void ObexFtpDialog::slotBrowse()
+{
+ doBrowse(TRUE);
+}
+
/*
* Do device browsing
*/
-void ObexFtpDialog::slotBrowse()
+void ObexFtpDialog::doBrowse(bool reconnect)
{
stat_entry_t* ent; //Directory entry
@@ -150,5 +155,5 @@ 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)));
errBox("Connection failed");
@@ -241,5 +246,5 @@ void ObexFtpDialog::slotCd(QListViewItem* item)
if (obexftp_setpath(client, curdir, 0) < 0)
log(tr("CD failed: ") + tr(strerror(errno)));
- slotBrowse();
+ doBrowse();
}
}
@@ -334,5 +339,5 @@ void ObexFtpDialog::putFile()
}
else {
- slotBrowse();
+ doBrowse();
log(local + QString(" sent"));
status(local + QString(" sent"));
@@ -372,5 +377,5 @@ void ObexFtpDialog::delFile()
}
else {
- slotBrowse();
+ doBrowse();
log(file2get + QString(" removed"));
status(file2get + QString(" removed"));
@@ -379,9 +384,17 @@ 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)
+ if (client != NULL) {
+ if (reconnect) {
+ obexftp_disconnect(client);
+ obexftp_close(client);
+ sleep(3);
+ }
+ else
return TRUE;
+ }
/* Open */
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 {
void doneProgress();
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
int errBox(QString msg); //Error message box
@@ -43,4 +44,5 @@ namespace OpieTooth {
void status(QString msg); //Text in the status bar
void status(const char* msg); //Text in the status bar
+ void doBrowse(bool reconnect = FALSE); //Browse device
protected:
QString m_device; //device MAC address