-rw-r--r-- | noncore/net/opietooth/manager/obexftpdialog.cpp | 50 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/obexftpdialog.h | 1 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/obexftpdialogbase.ui | 63 |
3 files changed, 84 insertions, 30 deletions
diff --git a/noncore/net/opietooth/manager/obexftpdialog.cpp b/noncore/net/opietooth/manager/obexftpdialog.cpp index f479ca2..fd2015e 100644 --- a/noncore/net/opietooth/manager/obexftpdialog.cpp +++ b/noncore/net/opietooth/manager/obexftpdialog.cpp @@ -92,2 +92,5 @@ ObexFtpDialog::ObexFtpDialog(const QString& device, int port, SLOT(putFile())); + connect(delButton, + SIGNAL(clicked()), + SLOT(delFile())); connect(destFile, @@ -244,3 +247,3 @@ void ObexFtpDialog::slotCd(QListViewItem* item) /* - * Get the file + * Copy file from a remote device to the local device */ @@ -277,3 +280,3 @@ void ObexFtpDialog::getFile() if (result < 0) { - log(file2get + QString(" receive ERROR: ") + tr(strerror(errno))); + log(file2get + QString(" receive ERROR:\n") + tr(strerror(errno))); errBox(file2get + QString(" receive ERROR")); @@ -290,3 +293,3 @@ void ObexFtpDialog::getFile() /* - * Put the file + * Copy file from the local device to a remote device */ @@ -327,3 +330,3 @@ void ObexFtpDialog::putFile() if (result < 0) { - log(local + QString(" send ERROR: ") + tr(strerror(errno))); + log(local + QString(" send ERROR:\n") + tr(strerror(errno))); errBox(local + QString(" send ERROR")); @@ -332,2 +335,3 @@ void ObexFtpDialog::putFile() else { + slotBrowse(); log(local + QString(" sent")); @@ -337,2 +341,40 @@ void ObexFtpDialog::putFile() +/* + * Delete file on a remote device + */ +void ObexFtpDialog::delFile() +{ + FileListItem* file = (FileListItem*)fileList->selectedItem(); + int result; + if (file == NULL) + return; + file2get = "/"; + if (file->gettype() == IS_FILE) { + if (client == NULL) { + errBox("No connection established"); + return; + } + file2get += curdir; + if (curdir != "" && curdir.right(1) != "/") + file2get += "/"; + file2get += file->text(0); + } + result = QMessageBox::warning(this, tr("Remove File"), + tr("Do you want to remove\n") + file2get, "Yes", "No"); + if (result != 0) + return; + odebug << "Remove " << file2get << oendl; + result = obexftp_del(client, file2get); + if (result < 0) { + log(file2get + QString(" remove ERROR\n") + tr(strerror(errno))); + errBox(file2get + QString(" remove ERROR")); + status(file2get + QString(" remove ERROR")); + } + else { + slotBrowse(); + log(file2get + QString(" removed")); + status(file2get + QString(" removed")); + } +} + /* connect with given uuid. re-connect every time */ diff --git a/noncore/net/opietooth/manager/obexftpdialog.h b/noncore/net/opietooth/manager/obexftpdialog.h index 81c8921..75ee95b 100644 --- a/noncore/net/opietooth/manager/obexftpdialog.h +++ b/noncore/net/opietooth/manager/obexftpdialog.h @@ -64,2 +64,3 @@ namespace OpieTooth { void putFile(); + void delFile(); void updateDir(const QString& newdir); diff --git a/noncore/net/opietooth/manager/obexftpdialogbase.ui b/noncore/net/opietooth/manager/obexftpdialogbase.ui index 2447007..83078d5 100644 --- a/noncore/net/opietooth/manager/obexftpdialogbase.ui +++ b/noncore/net/opietooth/manager/obexftpdialogbase.ui @@ -13,3 +13,3 @@ <y>0</y> - <width>283</width> + <width>347</width> <height>312</height> @@ -74,3 +74,3 @@ </property> - <widget row="1" column="0" rowspan="1" colspan="3" > + <widget row="1" column="0" rowspan="1" colspan="4" > <class>QProgressBar</class> @@ -81,3 +81,3 @@ </widget> - <widget row="3" column="0" rowspan="1" colspan="3" > + <widget row="3" column="0" rowspan="1" colspan="4" > <class>QLabel</class> @@ -103,25 +103,3 @@ </widget> - <widget row="2" column="1" > - <class>QPushButton</class> - <property stdset="1"> - <name>name</name> - <cstring>getButton</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Get file</string> - </property> - </widget> - <widget row="2" column="2" > - <class>QPushButton</class> - <property stdset="1"> - <name>name</name> - <cstring>putButton</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Put file</string> - </property> - </widget> - <widget row="0" column="0" rowspan="1" colspan="3" > + <widget row="0" column="0" rowspan="1" colspan="4" > <class>QListView</class> @@ -160,2 +138,35 @@ </widget> + <widget row="2" column="2" > + <class>QPushButton</class> + <property stdset="1"> + <name>name</name> + <cstring>putButton</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Put</string> + </property> + </widget> + <widget row="2" column="1" > + <class>QPushButton</class> + <property stdset="1"> + <name>name</name> + <cstring>getButton</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Get</string> + </property> + </widget> + <widget row="2" column="3" > + <class>QPushButton</class> + <property stdset="1"> + <name>name</name> + <cstring>delButton</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Del</string> + </property> + </widget> </grid> |