Diffstat (limited to 'noncore/net/opietooth/manager/obexftpdialog.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/opietooth/manager/obexftpdialog.cpp | 47 |
1 files changed, 43 insertions, 4 deletions
diff --git a/noncore/net/opietooth/manager/obexftpdialog.cpp b/noncore/net/opietooth/manager/obexftpdialog.cpp index 80a81b4..f479ca2 100644 --- a/noncore/net/opietooth/manager/obexftpdialog.cpp +++ b/noncore/net/opietooth/manager/obexftpdialog.cpp | |||
@@ -18,23 +18,28 @@ | |||
18 | #include <errno.h> | 18 | #include <errno.h> |
19 | #include <qpushbutton.h> | 19 | #include <qpushbutton.h> |
20 | #include <qmessagebox.h> | 20 | #include <qmessagebox.h> |
21 | #include <qmultilineedit.h> | 21 | #include <qmultilineedit.h> |
22 | #include <qlineedit.h> | ||
22 | #include <qspinbox.h> | 23 | #include <qspinbox.h> |
23 | #include <qcombobox.h> | 24 | #include <qcombobox.h> |
24 | #include <qlistview.h> | 25 | #include <qlistview.h> |
25 | #include <qprogressbar.h> | 26 | #include <qprogressbar.h> |
26 | #include <qlabel.h> | 27 | #include <qlabel.h> |
27 | #include <qlayout.h> | 28 | #include <qlayout.h> |
28 | #include <errno.h> | 29 | #include <errno.h> |
30 | #include <qfile.h> | ||
31 | #include <qtextstream.h> | ||
32 | #include <qstringlist.h> | ||
29 | #include "obexftpdialog.h" | 33 | #include "obexftpdialog.h" |
30 | #include "filelistitem.h" | 34 | #include "filelistitem.h" |
31 | 35 | ||
32 | #include <qpe/qpeapplication.h> | 36 | #include <qpe/qpeapplication.h> |
33 | #include <qpe/resource.h> | 37 | #include <qpe/resource.h> |
34 | #include <qpe/config.h> | 38 | #include <qpe/config.h> |
35 | #include <opie2/odebug.h> | 39 | #include <opie2/odebug.h> |
36 | #include <opie2/ofileselector.h> | 40 | #include <opie2/ofileselector.h> |
41 | #include <opie2/ofiledialog.h> | ||
37 | 42 | ||
38 | using namespace Opie::Core; | 43 | using namespace Opie::Core; |
39 | using namespace Opie::Ui; | 44 | using namespace Opie::Ui; |
40 | 45 | ||
@@ -87,8 +92,14 @@ ObexFtpDialog::ObexFtpDialog(const QString& device, int port, | |||
87 | SLOT(putFile())); | 92 | SLOT(putFile())); |
88 | connect(destFile, | 93 | connect(destFile, |
89 | SIGNAL(dirSelected (const QString&)), | 94 | SIGNAL(dirSelected (const QString&)), |
90 | SLOT(updateDir(const QString&))); | 95 | SLOT(updateDir(const QString&))); |
96 | connect(saveButton, | ||
97 | SIGNAL(clicked()), | ||
98 | SLOT(slotSaveLog())); | ||
99 | connect(browseButton, | ||
100 | SIGNAL(clicked()), | ||
101 | SLOT(slotBrowseLog())); | ||
91 | } | 102 | } |
92 | 103 | ||
93 | ObexFtpDialog::~ObexFtpDialog() | 104 | ObexFtpDialog::~ObexFtpDialog() |
94 | { | 105 | { |
@@ -135,9 +146,9 @@ void ObexFtpDialog::slotBrowse() | |||
135 | len = sizeof(UUID_FBS); | 146 | len = sizeof(UUID_FBS); |
136 | } | 147 | } |
137 | 148 | ||
138 | if (!cli_connect_uuid(use_uuid, len)) { | 149 | if (!cli_connect_uuid(use_uuid, len)) { |
139 | log("Connection failed"); | 150 | log(tr("Connection failed: ") + tr(strerror(errno))); |
140 | errBox("Connection failed"); | 151 | errBox("Connection failed"); |
141 | status("Connection failed"); | 152 | status("Connection failed"); |
142 | return; | 153 | return; |
143 | } | 154 | } |
@@ -224,9 +235,9 @@ void ObexFtpDialog::slotCd(QListViewItem* item) | |||
224 | curdir += file->text(0); | 235 | curdir += file->text(0); |
225 | } | 236 | } |
226 | odebug << "Browse " << curdir << oendl; | 237 | odebug << "Browse " << curdir << oendl; |
227 | if (obexftp_setpath(client, curdir, 0) < 0) | 238 | if (obexftp_setpath(client, curdir, 0) < 0) |
228 | log("CD failed"); | 239 | log(tr("CD failed: ") + tr(strerror(errno))); |
229 | slotBrowse(); | 240 | slotBrowse(); |
230 | } | 241 | } |
231 | } | 242 | } |
232 | 243 | ||
@@ -263,9 +274,9 @@ void ObexFtpDialog::getFile() | |||
263 | fileProgress->reset(); | 274 | fileProgress->reset(); |
264 | status(tr("Receiving file ") + file2get); | 275 | status(tr("Receiving file ") + file2get); |
265 | result = obexftp_get(client, local, file2get); | 276 | result = obexftp_get(client, local, file2get); |
266 | if (result < 0) { | 277 | if (result < 0) { |
267 | log(file2get + QString(" receive ERROR")); | 278 | log(file2get + QString(" receive ERROR: ") + tr(strerror(errno))); |
268 | errBox(file2get + QString(" receive ERROR")); | 279 | errBox(file2get + QString(" receive ERROR")); |
269 | status(file2get + QString(" receive ERROR")); | 280 | status(file2get + QString(" receive ERROR")); |
270 | } | 281 | } |
271 | else { | 282 | else { |
@@ -313,9 +324,9 @@ void ObexFtpDialog::putFile() | |||
313 | fileProgress->reset(); | 324 | fileProgress->reset(); |
314 | status(tr("Sending file ") + local); | 325 | status(tr("Sending file ") + local); |
315 | result = obexftp_put_file(client, local, file2get); | 326 | result = obexftp_put_file(client, local, file2get); |
316 | if (result < 0) { | 327 | if (result < 0) { |
317 | log(local + QString(" send ERROR")); | 328 | log(local + QString(" send ERROR: ") + tr(strerror(errno))); |
318 | errBox(local + QString(" send ERROR")); | 329 | errBox(local + QString(" send ERROR")); |
319 | status(local + QString(" send ERROR")); | 330 | status(local + QString(" send ERROR")); |
320 | } | 331 | } |
321 | else { | 332 | else { |
@@ -402,8 +413,36 @@ void ObexFtpDialog::updateDir(const QString& newdir) | |||
402 | { | 413 | { |
403 | localCurdir = newdir; | 414 | localCurdir = newdir; |
404 | } | 415 | } |
405 | 416 | ||
417 | /** | ||
418 | * Save Log to the specified file | ||
419 | */ | ||
420 | void ObexFtpDialog::slotSaveLog() | ||
421 | { | ||
422 | QFile logFile(saveLogEdit->text()); | ||
423 | if (!logFile.open(IO_WriteOnly)) { | ||
424 | errBox(tr("Unable to open file ") + saveLogEdit->text() + tr(" ") + | ||
425 | tr(strerror(errno))); | ||
426 | return; | ||
427 | } | ||
428 | QTextStream stream(&logFile); | ||
429 | stream << browseLog->text() << endl; | ||
430 | QMessageBox::information(this, tr("Saving"), | ||
431 | tr("Log file saved to ") + saveLogEdit->text()); | ||
432 | } | ||
433 | |||
434 | void ObexFtpDialog::slotBrowseLog() | ||
435 | { | ||
436 | MimeTypes types; | ||
437 | QStringList all; | ||
438 | all << "*/*"; | ||
439 | types.insert("All Files", all ); | ||
440 | |||
441 | QString str = OFileDialog::getOpenFileName( 1,"/","", types, 0 ); | ||
442 | saveLogEdit->setText(str); | ||
443 | } | ||
444 | |||
406 | /* | 445 | /* |
407 | * Event callback function | 446 | * Event callback function |
408 | */ | 447 | */ |
409 | static void info_cb(int event, const char *msg, int len, void* data) | 448 | static void info_cb(int event, const char *msg, int len, void* data) |