summaryrefslogtreecommitdiff
path: root/noncore/net/opietooth
Unidiff
Diffstat (limited to 'noncore/net/opietooth') (more/less context) (ignore 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
@@ -91,4 +91,7 @@ ObexFtpDialog::ObexFtpDialog(const QString& device, int port,
91 SIGNAL(clicked()), 91 SIGNAL(clicked()),
92 SLOT(putFile())); 92 SLOT(putFile()));
93 connect(delButton,
94 SIGNAL(clicked()),
95 SLOT(delFile()));
93 connect(destFile, 96 connect(destFile,
94 SIGNAL(dirSelected (const QString&)), 97 SIGNAL(dirSelected (const QString&)),
@@ -243,5 +246,5 @@ void ObexFtpDialog::slotCd(QListViewItem* item)
243 246
244/* 247/*
245 * Get the file 248 * Copy file from a remote device to the local device
246 */ 249 */
247void ObexFtpDialog::getFile() 250void ObexFtpDialog::getFile()
@@ -276,5 +279,5 @@ void ObexFtpDialog::getFile()
276 result = obexftp_get(client, local, file2get); 279 result = obexftp_get(client, local, file2get);
277 if (result < 0) { 280 if (result < 0) {
278 log(file2get + QString(" receive ERROR: ") + tr(strerror(errno))); 281 log(file2get + QString(" receive ERROR:\n") + tr(strerror(errno)));
279 errBox(file2get + QString(" receive ERROR")); 282 errBox(file2get + QString(" receive ERROR"));
280 status(file2get + QString(" receive ERROR")); 283 status(file2get + QString(" receive ERROR"));
@@ -289,5 +292,5 @@ void ObexFtpDialog::getFile()
289 292
290/* 293/*
291 * Put the file 294 * Copy file from the local device to a remote device
292 */ 295 */
293void ObexFtpDialog::putFile() 296void ObexFtpDialog::putFile()
@@ -326,9 +329,10 @@ void ObexFtpDialog::putFile()
326 result = obexftp_put_file(client, local, file2get); 329 result = obexftp_put_file(client, local, file2get);
327 if (result < 0) { 330 if (result < 0) {
328 log(local + QString(" send ERROR: ") + tr(strerror(errno))); 331 log(local + QString(" send ERROR:\n") + tr(strerror(errno)));
329 errBox(local + QString(" send ERROR")); 332 errBox(local + QString(" send ERROR"));
330 status(local + QString(" send ERROR")); 333 status(local + QString(" send ERROR"));
331 } 334 }
332 else { 335 else {
336 slotBrowse();
333 log(local + QString(" sent")); 337 log(local + QString(" sent"));
334 status(local + QString(" sent")); 338 status(local + QString(" sent"));
@@ -336,4 +340,42 @@ void ObexFtpDialog::putFile()
336} 340}
337 341
342/*
343 * Delete file on a remote device
344 */
345void ObexFtpDialog::delFile()
346{
347 FileListItem* file = (FileListItem*)fileList->selectedItem();
348 int result;
349 if (file == NULL)
350 return;
351 file2get = "/";
352 if (file->gettype() == IS_FILE) {
353 if (client == NULL) {
354 errBox("No connection established");
355 return;
356 }
357 file2get += curdir;
358 if (curdir != "" && curdir.right(1) != "/")
359 file2get += "/";
360 file2get += file->text(0);
361 }
362 result = QMessageBox::warning(this, tr("Remove File"),
363 tr("Do you want to remove\n") + file2get, "Yes", "No");
364 if (result != 0)
365 return;
366 odebug << "Remove " << file2get << oendl;
367 result = obexftp_del(client, file2get);
368 if (result < 0) {
369 log(file2get + QString(" remove ERROR\n") + tr(strerror(errno)));
370 errBox(file2get + QString(" remove ERROR"));
371 status(file2get + QString(" remove ERROR"));
372 }
373 else {
374 slotBrowse();
375 log(file2get + QString(" removed"));
376 status(file2get + QString(" removed"));
377 }
378}
379
338/* connect with given uuid. re-connect every time */ 380/* connect with given uuid. re-connect every time */
339int ObexFtpDialog::cli_connect_uuid(const uint8_t *uuid, int uuid_len) 381int 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
@@ -63,4 +63,5 @@ namespace OpieTooth {
63 void getFile(); 63 void getFile();
64 void putFile(); 64 void putFile();
65 void delFile();
65 void updateDir(const QString& newdir); 66 void updateDir(const QString& newdir);
66 void slotSaveLog(); 67 void slotSaveLog();
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
@@ -12,5 +12,5 @@
12 <x>0</x> 12 <x>0</x>
13 <y>0</y> 13 <y>0</y>
14 <width>283</width> 14 <width>347</width>
15 <height>312</height> 15 <height>312</height>
16 </rect> 16 </rect>
@@ -73,5 +73,5 @@
73 <number>0</number> 73 <number>0</number>
74 </property> 74 </property>
75 <widget row="1" column="0" rowspan="1" colspan="3" > 75 <widget row="1" column="0" rowspan="1" colspan="4" >
76 <class>QProgressBar</class> 76 <class>QProgressBar</class>
77 <property stdset="1"> 77 <property stdset="1">
@@ -80,5 +80,5 @@
80 </property> 80 </property>
81 </widget> 81 </widget>
82 <widget row="3" column="0" rowspan="1" colspan="3" > 82 <widget row="3" column="0" rowspan="1" colspan="4" >
83 <class>QLabel</class> 83 <class>QLabel</class>
84 <property stdset="1"> 84 <property stdset="1">
@@ -102,27 +102,5 @@
102 </property> 102 </property>
103 </widget> 103 </widget>
104 <widget row="2" column="1" > 104 <widget row="0" column="0" rowspan="1" colspan="4" >
105 <class>QPushButton</class>
106 <property stdset="1">
107 <name>name</name>
108 <cstring>getButton</cstring>
109 </property>
110 <property stdset="1">
111 <name>text</name>
112 <string>Get file</string>
113 </property>
114 </widget>
115 <widget row="2" column="2" >
116 <class>QPushButton</class>
117 <property stdset="1">
118 <name>name</name>
119 <cstring>putButton</cstring>
120 </property>
121 <property stdset="1">
122 <name>text</name>
123 <string>Put file</string>
124 </property>
125 </widget>
126 <widget row="0" column="0" rowspan="1" colspan="3" >
127 <class>QListView</class> 105 <class>QListView</class>
128 <column> 106 <column>
@@ -159,4 +137,37 @@
159 </property> 137 </property>
160 </widget> 138 </widget>
139 <widget row="2" column="2" >
140 <class>QPushButton</class>
141 <property stdset="1">
142 <name>name</name>
143 <cstring>putButton</cstring>
144 </property>
145 <property stdset="1">
146 <name>text</name>
147 <string>Put</string>
148 </property>
149 </widget>
150 <widget row="2" column="1" >
151 <class>QPushButton</class>
152 <property stdset="1">
153 <name>name</name>
154 <cstring>getButton</cstring>
155 </property>
156 <property stdset="1">
157 <name>text</name>
158 <string>Get</string>
159 </property>
160 </widget>
161 <widget row="2" column="3" >
162 <class>QPushButton</class>
163 <property stdset="1">
164 <name>name</name>
165 <cstring>delButton</cstring>
166 </property>
167 <property stdset="1">
168 <name>text</name>
169 <string>Del</string>
170 </property>
171 </widget>
161 </grid> 172 </grid>
162 </widget> 173 </widget>