author | korovkin <korovkin> | 2006-04-24 19:09:42 (UTC) |
---|---|---|
committer | korovkin <korovkin> | 2006-04-24 19:09:42 (UTC) |
commit | 8856190fa34ad67488adc137dc7c8646d0689795 (patch) (unidiff) | |
tree | a9f6f610ec63a35dfec922020d3627026dc81884 /noncore/net/opietooth/manager/obexftpdialog.cpp | |
parent | 71722eacaa44f3b738318d68dc6148c9e2ff643d (diff) | |
download | opie-8856190fa34ad67488adc137dc7c8646d0689795.zip opie-8856190fa34ad67488adc137dc7c8646d0689795.tar.gz opie-8856190fa34ad67488adc137dc7c8646d0689795.tar.bz2 |
Improved diagnostic messages.
Added LOG saving functionality.
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 | |||
@@ -20,4 +20,5 @@ | |||
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> |
@@ -27,4 +28,7 @@ | |||
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" |
@@ -35,4 +39,5 @@ | |||
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; |
@@ -89,4 +94,10 @@ ObexFtpDialog::ObexFtpDialog(const QString& device, int port, | |||
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 | ||
@@ -137,5 +148,5 @@ void ObexFtpDialog::slotBrowse() | |||
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"); |
@@ -226,5 +237,5 @@ void ObexFtpDialog::slotCd(QListViewItem* item) | |||
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 | } |
@@ -265,5 +276,5 @@ void ObexFtpDialog::getFile() | |||
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")); |
@@ -315,5 +326,5 @@ void ObexFtpDialog::putFile() | |||
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")); |
@@ -404,4 +415,32 @@ void ObexFtpDialog::updateDir(const QString& 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 |