-rw-r--r-- | noncore/net/opietooth/manager/obexdialog.cpp | 4 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/obexftpdialog.cpp | 47 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/obexftpdialog.h | 2 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/obexftpdialogbase.ui | 395 |
4 files changed, 217 insertions, 231 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 @@ -104,18 +104,18 @@ void ObexDialog::sendData() { *obexSend << execName << "--timeo 30" << m_device << fileURL << modifiedName; } else { *obexSend << execName << "--timeo 30" << m_device << fileURL << file; } obexSend->setUseShell(true); 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) { QCString str(buf, len); status->append(str); } void ObexDialog::slotPushErr(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 @@ -14,31 +14,36 @@ #include <sys/stat.h> #include <sys/types.h> #include <unistd.h> #include <string.h> #include <errno.h> #include <qpushbutton.h> #include <qmessagebox.h> #include <qmultilineedit.h> +#include <qlineedit.h> #include <qspinbox.h> #include <qcombobox.h> #include <qlistview.h> #include <qprogressbar.h> #include <qlabel.h> #include <qlayout.h> #include <errno.h> +#include <qfile.h> +#include <qtextstream.h> +#include <qstringlist.h> #include "obexftpdialog.h" #include "filelistitem.h" #include <qpe/qpeapplication.h> #include <qpe/resource.h> #include <qpe/config.h> #include <opie2/odebug.h> #include <opie2/ofileselector.h> +#include <opie2/ofiledialog.h> using namespace Opie::Core; using namespace Opie::Ui; using namespace OpieTooth; #define MAX_PROGRESS 14 //Maximal progress bar @@ -83,16 +88,22 @@ ObexFtpDialog::ObexFtpDialog(const QString& device, int port, SIGNAL(clicked()), SLOT(getFile())); connect(putButton, SIGNAL(clicked()), SLOT(putFile())); connect(destFile, SIGNAL(dirSelected (const QString&)), SLOT(updateDir(const QString&))); + connect(saveButton, + SIGNAL(clicked()), + SLOT(slotSaveLog())); + connect(browseButton, + SIGNAL(clicked()), + SLOT(slotBrowseLog())); } ObexFtpDialog::~ObexFtpDialog() { if (client != NULL) { obexftp_disconnect(client); obexftp_close(client); } @@ -131,17 +142,17 @@ void ObexFtpDialog::slotBrowse() use_uuid = UUID_S45; len = sizeof(UUID_S45); } else { use_uuid = UUID_FBS; len = sizeof(UUID_FBS); } if (!cli_connect_uuid(use_uuid, len)) { - log("Connection failed"); + log(tr("Connection failed: ") + tr(strerror(errno))); errBox("Connection failed"); status("Connection failed"); return; } else { log(QString("Connected to ") + m_device); status(QString("Connected to ") + m_device); } @@ -220,17 +231,17 @@ void ObexFtpDialog::slotCd(QListViewItem* item) } else { if (curdir != "" && curdir.right(1) != "/") curdir += "/"; curdir += file->text(0); } odebug << "Browse " << curdir << oendl; if (obexftp_setpath(client, curdir, 0) < 0) - log("CD failed"); + log(tr("CD failed: ") + tr(strerror(errno))); slotBrowse(); } } /* * Get the file */ void ObexFtpDialog::getFile() @@ -259,17 +270,17 @@ void ObexFtpDialog::getFile() local += file->text(0); odebug << "Copy " << file2get << " to " << local << oendl; progressStatus = 0; fileProgress->setTotalSteps(file->getsize() / 1024); fileProgress->reset(); 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")); } else { log(file2get + QString(" received")); status(file2get + QString(" received")); destFile->reread(); } @@ -309,17 +320,17 @@ void ObexFtpDialog::putFile() odebug << "Copy " << local << " to " << file2get << oendl; progressStatus = 0; fileProgress->setTotalSteps(localFStat.st_size / 1024); fileProgress->reset(); 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")); } else { log(local + QString(" sent")); status(local + QString(" sent")); } } @@ -398,16 +409,44 @@ void ObexFtpDialog::doneProgress() fileProgress->reset(); } 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 */ static void info_cb(int event, const char *msg, int len, void* data) { ObexFtpDialog* dlg = (ObexFtpDialog*)data; QCString cmsg(msg, len); //Message to display 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 @@ -58,11 +58,13 @@ namespace OpieTooth { QVBoxLayout* localLayout; //Window layout int nRetries; //Number of retries (on connection) private slots: void slotBrowse(); void slotCd(QListViewItem* item); 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 @@ -6,17 +6,17 @@ <name>name</name> <cstring>ObexFtpDialogBase</cstring> </property> <property stdset="1"> <name>geometry</name> <rect> <x>0</x> <y>0</y> - <width>267</width> + <width>283</width> <height>312</height> </rect> </property> <property stdset="1"> <name>sizePolicy</name> <sizepolicy> <hsizetype>7</hsizetype> <vsizetype>7</vsizetype> @@ -27,26 +27,26 @@ <string>Browse device</string> </property> <property> <name>layoutMargin</name> </property> <property> <name>layoutSpacing</name> </property> - <vbox> + <grid> <property stdset="1"> <name>margin</name> <number>0</number> </property> <property stdset="1"> <name>spacing</name> <number>0</number> </property> - <widget> + <widget row="0" column="0" > <class>QTabWidget</class> <property stdset="1"> <name>name</name> <cstring>obexFtpTab</cstring> </property> <property> <name>layoutMargin</name> </property> @@ -58,146 +58,112 @@ <property stdset="1"> <name>name</name> <cstring>files</cstring> </property> <attribute> <name>title</name> <string>Device</string> </attribute> - <vbox> + <grid> <property stdset="1"> <name>margin</name> <number>0</number> </property> <property stdset="1"> <name>spacing</name> <number>0</number> </property> - <widget> - <class>QLayoutWidget</class> + <widget row="1" column="0" rowspan="1" colspan="3" > + <class>QProgressBar</class> <property stdset="1"> <name>name</name> - <cstring>Layout13</cstring> + <cstring>fileProgress</cstring> </property> - <grid> - <property stdset="1"> - <name>margin</name> - <number>0</number> + </widget> + <widget row="3" column="0" rowspan="1" colspan="3" > + <class>QLabel</class> + <property stdset="1"> + <name>name</name> + <cstring>statusBar</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string></string> + </property> + </widget> + <widget row="2" column="0" > + <class>QPushButton</class> + <property stdset="1"> + <name>name</name> + <cstring>browseOK</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Browse</string> + </property> + </widget> + <widget row="2" column="1" > + <class>QPushButton</class> + <property stdset="1"> + <name>name</name> + <cstring>getButton</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Get file</string> + </property> + </widget> + <widget row="2" column="2" > + <class>QPushButton</class> + <property stdset="1"> + <name>name</name> + <cstring>putButton</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Put file</string> + </property> + </widget> + <widget row="0" column="0" rowspan="1" colspan="3" > + <class>QListView</class> + <column> + <property> + <name>text</name> + <string>Name</string> + </property> + <property> + <name>clickable</name> + <bool>true</bool> </property> - <property stdset="1"> - <name>spacing</name> - <number>6</number> + <property> + <name>resizeable</name> + <bool>true</bool> </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> - </property> - </widget> - <widget row="1" column="0" > - <class>QProgressBar</class> - <property stdset="1"> - <name>name</name> - <cstring>fileProgress</cstring> - </property> - </widget> - <widget row="2" column="0" > - <class>QLayoutWidget</class> - <property stdset="1"> - <name>name</name> - <cstring>Layout11</cstring> - </property> - <hbox> - <property stdset="1"> - <name>margin</name> - <number>0</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>6</number> - </property> - <widget> - <class>QPushButton</class> - <property stdset="1"> - <name>name</name> - <cstring>browseOK</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Browse</string> - </property> - </widget> - <widget> - <class>QPushButton</class> - <property stdset="1"> - <name>name</name> - <cstring>getButton</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Get file</string> - </property> - </widget> - <widget> - <class>QPushButton</class> - <property stdset="1"> - <name>name</name> - <cstring>putButton</cstring> - </property> - <property stdset="1"> - <name>text</name> - <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> - </property> - <property stdset="1"> - <name>text</name> - <string></string> - </property> - </widget> - </grid> + </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> + </property> </widget> - </vbox> + </grid> </widget> <widget> <class>QWidget</class> <property stdset="1"> <name>name</name> <cstring>localFs</cstring> </property> <attribute> @@ -210,159 +176,138 @@ <property stdset="1"> <name>name</name> <cstring>options</cstring> </property> <attribute> <name>title</name> <string>Options</string> </attribute> - <widget> - <class>QLayoutWidget</class> + <grid> <property stdset="1"> - <name>name</name> - <cstring>Layout5</cstring> + <name>margin</name> + <number>11</number> </property> <property stdset="1"> - <name>geometry</name> - <rect> - <x>45</x> - <y>5</y> - <width>162</width> - <height>63</height> - </rect> + <name>spacing</name> + <number>6</number> </property> - <vbox> + <widget row="0" column="0" > + <class>QLabel</class> <property stdset="1"> - <name>margin</name> - <number>0</number> + <name>name</name> + <cstring>uuidLabel</cstring> </property> <property stdset="1"> - <name>spacing</name> - <number>6</number> + <name>text</name> + <string>uuid type</string> </property> - <widget> - <class>QLayoutWidget</class> - <property stdset="1"> - <name>name</name> - <cstring>Layout3</cstring> + </widget> + <widget row="0" column="1" rowspan="1" colspan="2" > + <class>QComboBox</class> + <item> + <property> + <name>text</name> + <string>FBS</string> </property> - <hbox> - <property stdset="1"> - <name>margin</name> - <number>0</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>6</number> - </property> - <widget> - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>uuidLabel</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>uuid type</string> - </property> - </widget> - <widget> - <class>QComboBox</class> - <item> - <property> - <name>text</name> - <string>FBS</string> - </property> - </item> - <item> - <property> - <name>text</name> - <string>S45</string> - </property> - </item> - <property stdset="1"> - <name>name</name> - <cstring>uuidType</cstring> - </property> - </widget> - </hbox> - </widget> - <widget> - <class>QLayoutWidget</class> - <property stdset="1"> - <name>name</name> - <cstring>Layout4</cstring> + </item> + <item> + <property> + <name>text</name> + <string>S45</string> </property> - <hbox> - <property stdset="1"> - <name>margin</name> - <number>0</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>6</number> - </property> - <widget> - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>connRetries</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Retry to connect</string> - </property> - </widget> - <widget> - <class>QSpinBox</class> - <property stdset="1"> - <name>name</name> - <cstring>nReries</cstring> - </property> - <property stdset="1"> - <name>buttonSymbols</name> - <enum>PlusMinus</enum> - </property> - </widget> - </hbox> - </widget> - </vbox> - </widget> + </item> + <property stdset="1"> + <name>name</name> + <cstring>uuidType</cstring> + </property> + </widget> + <widget row="1" column="0" rowspan="1" colspan="2" > + <class>QLabel</class> + <property stdset="1"> + <name>name</name> + <cstring>connRetries</cstring> + </property> + <property stdset="1"> + <name>text</name> + <string>Retry to connect</string> + </property> + </widget> + <widget row="1" column="2" > + <class>QSpinBox</class> + <property stdset="1"> + <name>name</name> + <cstring>nReries</cstring> + </property> + <property stdset="1"> + <name>buttonSymbols</name> + <enum>PlusMinus</enum> + </property> + </widget> + </grid> </widget> <widget> <class>QWidget</class> <property stdset="1"> <name>name</name> <cstring>browse</cstring> </property> <attribute> <name>title</name> <string>Log</string> </attribute> - <hbox> + <grid> <property stdset="1"> <name>margin</name> <number>0</number> </property> <property stdset="1"> <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> <tabstop>fileList</tabstop> <tabstop>browseOK</tabstop> <tabstop>getButton</tabstop> <tabstop>putButton</tabstop> <tabstop>uuidType</tabstop> |