summaryrefslogtreecommitdiff
path: root/noncore
authorkorovkin <korovkin>2006-04-25 20:17:22 (UTC)
committer korovkin <korovkin>2006-04-25 20:17:22 (UTC)
commitc5e86199c46839e6952b8ec3dec1447e5f60a279 (patch) (side-by-side diff)
tree9cf9c5b247022ab1135c673456871f4604f9f369 /noncore
parent8856190fa34ad67488adc137dc7c8646d0689795 (diff)
downloadopie-c5e86199c46839e6952b8ec3dec1447e5f60a279.zip
opie-c5e86199c46839e6952b8ec3dec1447e5f60a279.tar.gz
opie-c5e86199c46839e6952b8ec3dec1447e5f60a279.tar.bz2
Dedicated to Natalia Korovkina, my best friend and wife.
Added remove file functionality to OBEX FT dialog.
Diffstat (limited to 'noncore') (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/opietooth/manager/obexftpdialog.cpp50
-rw-r--r--noncore/net/opietooth/manager/obexftpdialog.h1
-rw-r--r--noncore/net/opietooth/manager/obexftpdialogbase.ui63
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
@@ -90,6 +90,9 @@ ObexFtpDialog::ObexFtpDialog(const QString& device, int port,
connect(putButton,
SIGNAL(clicked()),
SLOT(putFile()));
+ connect(delButton,
+ SIGNAL(clicked()),
+ SLOT(delFile()));
connect(destFile,
SIGNAL(dirSelected (const QString&)),
SLOT(updateDir(const QString&)));
@@ -242,7 +245,7 @@ void ObexFtpDialog::slotCd(QListViewItem* item)
}
/*
- * Get the file
+ * Copy file from a remote device to the local device
*/
void ObexFtpDialog::getFile()
{
@@ -275,7 +278,7 @@ void ObexFtpDialog::getFile()
status(tr("Receiving file ") + file2get);
result = obexftp_get(client, local, file2get);
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"));
status(file2get + QString(" receive ERROR"));
}
@@ -288,7 +291,7 @@ void ObexFtpDialog::getFile()
}
/*
- * Put the file
+ * Copy file from the local device to a remote device
*/
void ObexFtpDialog::putFile()
{
@@ -325,16 +328,55 @@ void ObexFtpDialog::putFile()
status(tr("Sending file ") + local);
result = obexftp_put_file(client, local, file2get);
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"));
status(local + QString(" send ERROR"));
}
else {
+ slotBrowse();
log(local + QString(" sent"));
status(local + QString(" sent"));
}
}
+/*
+ * 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 */
int ObexFtpDialog::cli_connect_uuid(const uint8_t *uuid, int uuid_len)
{
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
@@ -62,6 +62,7 @@ namespace OpieTooth {
void slotCd(QListViewItem* item);
void getFile();
void putFile();
+ void delFile();
void updateDir(const QString& newdir);
void slotSaveLog();
void slotBrowseLog();
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
@@ -11,7 +11,7 @@
<rect>
<x>0</x>
<y>0</y>
- <width>283</width>
+ <width>347</width>
<height>312</height>
</rect>
</property>
@@ -72,14 +72,14 @@
<name>spacing</name>
<number>0</number>
</property>
- <widget row="1" column="0" rowspan="1" colspan="3" >
+ <widget row="1" column="0" rowspan="1" colspan="4" >
<class>QProgressBar</class>
<property stdset="1">
<name>name</name>
<cstring>fileProgress</cstring>
</property>
</widget>
- <widget row="3" column="0" rowspan="1" colspan="3" >
+ <widget row="3" column="0" rowspan="1" colspan="4" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
@@ -101,29 +101,7 @@
<string>Browse</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 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>
<column>
<property>
@@ -158,6 +136,39 @@
<cstring>fileList</cstring>
</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</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>
</widget>
<widget>