From 8856190fa34ad67488adc137dc7c8646d0689795 Mon Sep 17 00:00:00 2001 From: korovkin Date: Mon, 24 Apr 2006 19:09:42 +0000 Subject: Improved diagnostic messages. Added LOG saving functionality. --- diff --git a/noncore/net/opietooth/manager/obexdialog.cpp b/noncore/net/opietooth/manager/obexdialog.cpp index d3fdd14..8d7b593 100644 --- a/noncore/net/opietooth/manager/obexdialog.cpp +++ b/noncore/net/opietooth/manager/obexdialog.cpp @@ -109,8 +109,8 @@ void ObexDialog::sendData() { if (!obexSend->start(OProcess::NotifyOnExit, OProcess::All) ) { statLine->setText( tr("Error: couln't start process") ); } - else - statLine->setText( tr("Sending") ); + else + statLine->setText( tr("Sending") ); } void ObexDialog::slotPushOut(OProcess*, char* buf, int len) { 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 @@ #include #include #include +#include #include #include #include @@ -26,6 +27,9 @@ #include #include #include +#include +#include +#include #include "obexftpdialog.h" #include "filelistitem.h" @@ -34,6 +38,7 @@ #include #include #include +#include using namespace Opie::Core; using namespace Opie::Ui; @@ -88,6 +93,12 @@ ObexFtpDialog::ObexFtpDialog(const QString& device, int port, connect(destFile, SIGNAL(dirSelected (const QString&)), SLOT(updateDir(const QString&))); + connect(saveButton, + SIGNAL(clicked()), + SLOT(slotSaveLog())); + connect(browseButton, + SIGNAL(clicked()), + SLOT(slotBrowseLog())); } ObexFtpDialog::~ObexFtpDialog() @@ -136,7 +147,7 @@ void ObexFtpDialog::slotBrowse() } if (!cli_connect_uuid(use_uuid, len)) { - log("Connection failed"); + log(tr("Connection failed: ") + tr(strerror(errno))); errBox("Connection failed"); status("Connection failed"); return; @@ -225,7 +236,7 @@ void ObexFtpDialog::slotCd(QListViewItem* item) } odebug << "Browse " << curdir << oendl; if (obexftp_setpath(client, curdir, 0) < 0) - log("CD failed"); + log(tr("CD failed: ") + tr(strerror(errno))); slotBrowse(); } } @@ -264,7 +275,7 @@ void ObexFtpDialog::getFile() status(tr("Receiving file ") + file2get); result = obexftp_get(client, local, file2get); if (result < 0) { - log(file2get + QString(" receive ERROR")); + log(file2get + QString(" receive ERROR: ") + tr(strerror(errno))); errBox(file2get + QString(" receive ERROR")); status(file2get + QString(" receive ERROR")); } @@ -314,7 +325,7 @@ void ObexFtpDialog::putFile() status(tr("Sending file ") + local); result = obexftp_put_file(client, local, file2get); if (result < 0) { - log(local + QString(" send ERROR")); + log(local + QString(" send ERROR: ") + tr(strerror(errno))); errBox(local + QString(" send ERROR")); status(local + QString(" send ERROR")); } @@ -403,6 +414,34 @@ void ObexFtpDialog::updateDir(const QString& newdir) localCurdir = newdir; } +/** + * Save Log to the specified file + */ +void ObexFtpDialog::slotSaveLog() +{ + QFile logFile(saveLogEdit->text()); + if (!logFile.open(IO_WriteOnly)) { + errBox(tr("Unable to open file ") + saveLogEdit->text() + tr(" ") + + tr(strerror(errno))); + return; + } + QTextStream stream(&logFile); + stream << browseLog->text() << endl; + QMessageBox::information(this, tr("Saving"), + tr("Log file saved to ") + saveLogEdit->text()); +} + +void ObexFtpDialog::slotBrowseLog() +{ + MimeTypes types; + QStringList all; + all << "*/*"; + types.insert("All Files", all ); + + QString str = OFileDialog::getOpenFileName( 1,"/","", types, 0 ); + saveLogEdit->setText(str); +} + /* * Event callback function */ diff --git a/noncore/net/opietooth/manager/obexftpdialog.h b/noncore/net/opietooth/manager/obexftpdialog.h index 7000f61..81c8921 100644 --- a/noncore/net/opietooth/manager/obexftpdialog.h +++ b/noncore/net/opietooth/manager/obexftpdialog.h @@ -63,6 +63,8 @@ namespace OpieTooth { void getFile(); void putFile(); void updateDir(const QString& newdir); + void slotSaveLog(); + void slotBrowseLog(); }; }; #endif diff --git a/noncore/net/opietooth/manager/obexftpdialogbase.ui b/noncore/net/opietooth/manager/obexftpdialogbase.ui index b372b9d..2447007 100644 --- a/noncore/net/opietooth/manager/obexftpdialogbase.ui +++ b/noncore/net/opietooth/manager/obexftpdialogbase.ui @@ -11,7 +11,7 @@ 0 0 - 267 + 283 312 @@ -32,7 +32,7 @@ layoutSpacing - + margin 0 @@ -41,7 +41,7 @@ spacing 0 - + QTabWidget name @@ -63,7 +63,7 @@ title Device - + margin 0 @@ -72,127 +72,93 @@ spacing 0 - - QLayoutWidget + + QProgressBar name - Layout13 + fileProgress - - - margin - 0 + + + QLabel + + name + statusBar + + + text + + + + + QPushButton + + name + browseOK + + + text + Browse + + + + QPushButton + + name + getButton + + + text + Get file + + + + QPushButton + + name + putButton + + + text + Put file + + + + QListView + + + text + Name + + + clickable + true - - spacing - 6 + + resizeable + true - - QListView - - - text - Name - - - clickable - true - - - resizeable - true - - - - - text - Size - - - clickable - true - - - resizeable - true - - - - name - fileList - - - - QProgressBar - - name - fileProgress - - - - QLayoutWidget - - name - Layout11 - - - - margin - 0 - - - spacing - 6 - - - QPushButton - - name - browseOK - - - text - Browse - - - - QPushButton - - name - getButton - - - text - Get file - - - - QPushButton - - name - putButton - - - text - Put file - - - - - - QLabel - - name - statusBar - - - text - - - - + + + + text + Size + + + clickable + true + + + resizeable + true + + + + name + fileList + - + QWidget @@ -215,118 +181,68 @@ title Options - - QLayoutWidget + - name - Layout5 + margin + 11 - geometry - - 45 - 5 - 162 - 63 - + spacing + 6 - + + QLabel - margin - 0 + name + uuidLabel - spacing - 6 + text + uuid type - - QLayoutWidget - - name - Layout3 + + + QComboBox + + + text + FBS - - - margin - 0 - - - spacing - 6 - - - QLabel - - name - uuidLabel - - - text - uuid type - - - - QComboBox - - - text - FBS - - - - - text - S45 - - - - name - uuidType - - - - - - QLayoutWidget - - name - Layout4 + + + + text + S45 - - - margin - 0 - - - spacing - 6 - - - QLabel - - name - connRetries - - - text - Retry to connect - - - - QSpinBox - - name - nReries - - - buttonSymbols - PlusMinus - - - - - - + + + name + uuidType + + + + QLabel + + name + connRetries + + + text + Retry to connect + + + + QSpinBox + + name + nReries + + + buttonSymbols + PlusMinus + + + QWidget @@ -338,7 +254,7 @@ title Log - + margin 0 @@ -347,17 +263,46 @@ spacing 0 - + + QLineEdit + + name + saveLogEdit + + + + QPushButton + + name + saveButton + + + text + save + + + + QPushButton + + name + browseButton + + + text + Save as: + + + QMultiLineEdit name browseLog - + - + obexFtpTab -- cgit v0.9.0.2