Diffstat (limited to 'noncore/net/opietooth/manager/obexftpdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/opietooth/manager/obexftpdialog.cpp | 50 |
1 files changed, 46 insertions, 4 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 | |||
@@ -87,12 +87,15 @@ ObexFtpDialog::ObexFtpDialog(const QString& device, int port, | |||
87 | connect(getButton, | 87 | connect(getButton, |
88 | SIGNAL(clicked()), | 88 | SIGNAL(clicked()), |
89 | SLOT(getFile())); | 89 | SLOT(getFile())); |
90 | connect(putButton, | 90 | connect(putButton, |
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&)), |
95 | SLOT(updateDir(const QString&))); | 98 | SLOT(updateDir(const QString&))); |
96 | connect(saveButton, | 99 | connect(saveButton, |
97 | SIGNAL(clicked()), | 100 | SIGNAL(clicked()), |
98 | SLOT(slotSaveLog())); | 101 | SLOT(slotSaveLog())); |
@@ -239,13 +242,13 @@ void ObexFtpDialog::slotCd(QListViewItem* item) | |||
239 | log(tr("CD failed: ") + tr(strerror(errno))); | 242 | log(tr("CD failed: ") + tr(strerror(errno))); |
240 | slotBrowse(); | 243 | slotBrowse(); |
241 | } | 244 | } |
242 | } | 245 | } |
243 | 246 | ||
244 | /* | 247 | /* |
245 | * Get the file | 248 | * Copy file from a remote device to the local device |
246 | */ | 249 | */ |
247 | void ObexFtpDialog::getFile() | 250 | void ObexFtpDialog::getFile() |
248 | { | 251 | { |
249 | FileListItem* file = (FileListItem*)fileList->selectedItem(); | 252 | FileListItem* file = (FileListItem*)fileList->selectedItem(); |
250 | int result; | 253 | int result; |
251 | if (file == NULL) | 254 | if (file == NULL) |
@@ -272,26 +275,26 @@ void ObexFtpDialog::getFile() | |||
272 | progressStatus = 0; | 275 | progressStatus = 0; |
273 | fileProgress->setTotalSteps(file->getsize() / 1024); | 276 | fileProgress->setTotalSteps(file->getsize() / 1024); |
274 | fileProgress->reset(); | 277 | fileProgress->reset(); |
275 | status(tr("Receiving file ") + file2get); | 278 | status(tr("Receiving file ") + file2get); |
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")); |
281 | } | 284 | } |
282 | else { | 285 | else { |
283 | log(file2get + QString(" received")); | 286 | log(file2get + QString(" received")); |
284 | status(file2get + QString(" received")); | 287 | status(file2get + QString(" received")); |
285 | destFile->reread(); | 288 | destFile->reread(); |
286 | } | 289 | } |
287 | } | 290 | } |
288 | } | 291 | } |
289 | 292 | ||
290 | /* | 293 | /* |
291 | * Put the file | 294 | * Copy file from the local device to a remote device |
292 | */ | 295 | */ |
293 | void ObexFtpDialog::putFile() | 296 | void ObexFtpDialog::putFile() |
294 | { | 297 | { |
295 | int result; //OPeration result | 298 | int result; //OPeration result |
296 | int idx; //Index of a symbol in the string | 299 | int idx; //Index of a symbol in the string |
297 | struct stat localFStat; //Local file information | 300 | struct stat localFStat; //Local file information |
@@ -322,22 +325,61 @@ void ObexFtpDialog::putFile() | |||
322 | progressStatus = 0; | 325 | progressStatus = 0; |
323 | fileProgress->setTotalSteps(localFStat.st_size / 1024); | 326 | fileProgress->setTotalSteps(localFStat.st_size / 1024); |
324 | fileProgress->reset(); | 327 | fileProgress->reset(); |
325 | status(tr("Sending file ") + local); | 328 | status(tr("Sending file ") + local); |
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")); |
335 | } | 339 | } |
336 | } | 340 | } |
337 | 341 | ||
342 | /* | ||
343 | * Delete file on a remote device | ||
344 | */ | ||
345 | void 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 */ |
339 | int ObexFtpDialog::cli_connect_uuid(const uint8_t *uuid, int uuid_len) | 381 | int ObexFtpDialog::cli_connect_uuid(const uint8_t *uuid, int uuid_len) |
340 | { | 382 | { |
341 | int retry; | 383 | int retry; |
342 | if (client != NULL) | 384 | if (client != NULL) |
343 | return TRUE; | 385 | return TRUE; |