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 | |||
@@ -19,6 +19,7 @@ | |||
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> |
@@ -26,6 +27,9 @@ | |||
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 | ||
@@ -34,6 +38,7 @@ | |||
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; |
@@ -88,6 +93,12 @@ ObexFtpDialog::ObexFtpDialog(const QString& device, int port, | |||
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() |
@@ -136,7 +147,7 @@ void ObexFtpDialog::slotBrowse() | |||
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; |
@@ -225,7 +236,7 @@ void ObexFtpDialog::slotCd(QListViewItem* item) | |||
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 | } |
@@ -264,7 +275,7 @@ void ObexFtpDialog::getFile() | |||
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 | } |
@@ -314,7 +325,7 @@ void ObexFtpDialog::putFile() | |||
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 | } |
@@ -403,6 +414,34 @@ void ObexFtpDialog::updateDir(const QString& newdir) | |||
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 | */ |