summaryrefslogtreecommitdiff
path: root/noncore/net
authorkorovkin <korovkin>2006-04-24 19:09:42 (UTC)
committer korovkin <korovkin>2006-04-24 19:09:42 (UTC)
commit8856190fa34ad67488adc137dc7c8646d0689795 (patch) (side-by-side diff)
treea9f6f610ec63a35dfec922020d3627026dc81884 /noncore/net
parent71722eacaa44f3b738318d68dc6148c9e2ff643d (diff)
downloadopie-8856190fa34ad67488adc137dc7c8646d0689795.zip
opie-8856190fa34ad67488adc137dc7c8646d0689795.tar.gz
opie-8856190fa34ad67488adc137dc7c8646d0689795.tar.bz2
Improved diagnostic messages.
Added LOG saving functionality.
Diffstat (limited to 'noncore/net') (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/opietooth/manager/obexdialog.cpp0
-rw-r--r--noncore/net/opietooth/manager/obexftpdialog.cpp47
-rw-r--r--noncore/net/opietooth/manager/obexftpdialog.h2
-rw-r--r--noncore/net/opietooth/manager/obexftpdialogbase.ui225
4 files changed, 130 insertions, 144 deletions
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
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 <qpushbutton.h>
#include <qmessagebox.h>
#include <qmultilineedit.h>
+#include <qlineedit.h>
#include <qspinbox.h>
#include <qcombobox.h>
#include <qlistview.h>
@@ -26,6 +27,9 @@
#include <qlabel.h>
#include <qlayout.h>
#include <errno.h>
+#include <qfile.h>
+#include <qtextstream.h>
+#include <qstringlist.h>
#include "obexftpdialog.h"
#include "filelistitem.h"
@@ -34,6 +38,7 @@
#include <qpe/config.h>
#include <opie2/odebug.h>
#include <opie2/ofileselector.h>
+#include <opie2/ofiledialog.h>
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 @@
<rect>
<x>0</x>
<y>0</y>
- <width>267</width>
+ <width>283</width>
<height>312</height>
</rect>
</property>
@@ -32,7 +32,7 @@
<property>
<name>layoutSpacing</name>
</property>
- <vbox>
+ <grid>
<property stdset="1">
<name>margin</name>
<number>0</number>
@@ -41,7 +41,7 @@
<name>spacing</name>
<number>0</number>
</property>
- <widget>
+ <widget row="0" column="0" >
<class>QTabWidget</class>
<property stdset="1">
<name>name</name>
@@ -63,21 +63,6 @@
<name>title</name>
<string>Device</string>
</attribute>
- <vbox>
- <property stdset="1">
- <name>margin</name>
- <number>0</number>
- </property>
- <property stdset="1">
- <name>spacing</name>
- <number>0</number>
- </property>
- <widget>
- <class>QLayoutWidget</class>
- <property stdset="1">
- <name>name</name>
- <cstring>Layout13</cstring>
- </property>
<grid>
<property stdset="1">
<name>margin</name>
@@ -85,66 +70,27 @@
</property>
<property stdset="1">
<name>spacing</name>
- <number>6</number>
- </property>
- <widget row="0" column="0" >
- <class>QListView</class>
- <column>
- <property>
- <name>text</name>
- <string>Name</string>
- </property>
- <property>
- <name>clickable</name>
- <bool>true</bool>
- </property>
- <property>
- <name>resizeable</name>
- <bool>true</bool>
- </property>
- </column>
- <column>
- <property>
- <name>text</name>
- <string>Size</string>
- </property>
- <property>
- <name>clickable</name>
- <bool>true</bool>
- </property>
- <property>
- <name>resizeable</name>
- <bool>true</bool>
- </property>
- </column>
- <property stdset="1">
- <name>name</name>
- <cstring>fileList</cstring>
+ <number>0</number>
</property>
- </widget>
- <widget row="1" column="0" >
+ <widget row="1" column="0" rowspan="1" colspan="3" >
<class>QProgressBar</class>
<property stdset="1">
<name>name</name>
<cstring>fileProgress</cstring>
</property>
</widget>
- <widget row="2" column="0" >
- <class>QLayoutWidget</class>
+ <widget row="3" column="0" rowspan="1" colspan="3" >
+ <class>QLabel</class>
<property stdset="1">
<name>name</name>
- <cstring>Layout11</cstring>
- </property>
- <hbox>
- <property stdset="1">
- <name>margin</name>
- <number>0</number>
+ <cstring>statusBar</cstring>
</property>
<property stdset="1">
- <name>spacing</name>
- <number>6</number>
+ <name>text</name>
+ <string></string>
</property>
- <widget>
+ </widget>
+ <widget row="2" column="0" >
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
@@ -155,7 +101,7 @@
<string>Browse</string>
</property>
</widget>
- <widget>
+ <widget row="2" column="1" >
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
@@ -166,7 +112,7 @@
<string>Get file</string>
</property>
</widget>
- <widget>
+ <widget row="2" column="2" >
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
@@ -177,23 +123,43 @@
<string>Put file</string>
</property>
</widget>
- </hbox>
- </widget>
- <widget row="3" column="0" >
- <class>QLabel</class>
- <property stdset="1">
- <name>name</name>
- <cstring>statusBar</cstring>
+ <widget row="0" column="0" rowspan="1" colspan="3" >
+ <class>QListView</class>
+ <column>
+ <property>
+ <name>text</name>
+ <string>Name</string>
</property>
- <property stdset="1">
+ <property>
+ <name>clickable</name>
+ <bool>true</bool>
+ </property>
+ <property>
+ <name>resizeable</name>
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property>
<name>text</name>
- <string></string>
+ <string>Size</string>
+ </property>
+ <property>
+ <name>clickable</name>
+ <bool>true</bool>
+ </property>
+ <property>
+ <name>resizeable</name>
+ <bool>true</bool>
+ </property>
+ </column>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>fileList</cstring>
</property>
</widget>
</grid>
</widget>
- </vbox>
- </widget>
<widget>
<class>QWidget</class>
<property stdset="1">
@@ -215,46 +181,16 @@
<name>title</name>
<string>Options</string>
</attribute>
- <widget>
- <class>QLayoutWidget</class>
- <property stdset="1">
- <name>name</name>
- <cstring>Layout5</cstring>
- </property>
- <property stdset="1">
- <name>geometry</name>
- <rect>
- <x>45</x>
- <y>5</y>
- <width>162</width>
- <height>63</height>
- </rect>
- </property>
- <vbox>
- <property stdset="1">
- <name>margin</name>
- <number>0</number>
- </property>
- <property stdset="1">
- <name>spacing</name>
- <number>6</number>
- </property>
- <widget>
- <class>QLayoutWidget</class>
- <property stdset="1">
- <name>name</name>
- <cstring>Layout3</cstring>
- </property>
- <hbox>
+ <grid>
<property stdset="1">
<name>margin</name>
- <number>0</number>
+ <number>11</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
- <widget>
+ <widget row="0" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
@@ -265,7 +201,7 @@
<string>uuid type</string>
</property>
</widget>
- <widget>
+ <widget row="0" column="1" rowspan="1" colspan="2" >
<class>QComboBox</class>
<item>
<property>
@@ -284,24 +220,7 @@
<cstring>uuidType</cstring>
</property>
</widget>
- </hbox>
- </widget>
- <widget>
- <class>QLayoutWidget</class>
- <property stdset="1">
- <name>name</name>
- <cstring>Layout4</cstring>
- </property>
- <hbox>
- <property stdset="1">
- <name>margin</name>
- <number>0</number>
- </property>
- <property stdset="1">
- <name>spacing</name>
- <number>6</number>
- </property>
- <widget>
+ <widget row="1" column="0" rowspan="1" colspan="2" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
@@ -312,7 +231,7 @@
<string>Retry to connect</string>
</property>
</widget>
- <widget>
+ <widget row="1" column="2" >
<class>QSpinBox</class>
<property stdset="1">
<name>name</name>
@@ -323,10 +242,7 @@
<enum>PlusMinus</enum>
</property>
</widget>
- </hbox>
- </widget>
- </vbox>
- </widget>
+ </grid>
</widget>
<widget>
<class>QWidget</class>
@@ -338,7 +254,7 @@
<name>title</name>
<string>Log</string>
</attribute>
- <hbox>
+ <grid>
<property stdset="1">
<name>margin</name>
<number>0</number>
@@ -347,17 +263,46 @@
<name>spacing</name>
<number>0</number>
</property>
- <widget>
+ <widget row="1" column="1" >
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>saveLogEdit</cstring>
+ </property>
+ </widget>
+ <widget row="1" column="2" >
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>saveButton</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>save</string>
+ </property>
+ </widget>
+ <widget row="1" column="0" >
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>browseButton</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Save as:</string>
+ </property>
+ </widget>
+ <widget row="0" column="0" rowspan="1" colspan="3" >
<class>QMultiLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>browseLog</cstring>
</property>
</widget>
- </hbox>
+ </grid>
</widget>
</widget>
- </vbox>
+ </grid>
</widget>
<tabstops>
<tabstop>obexFtpTab</tabstop>