-rw-r--r-- | noncore/apps/opie-console/filetransfer.cpp | 3 | ||||
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/opie-console/metafactory.cpp | 9 | ||||
-rw-r--r-- | noncore/apps/opie-console/metafactory.h | 1 | ||||
-rw-r--r-- | noncore/apps/opie-console/test/senderui.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/opie-console/transferdialog.cpp | 70 | ||||
-rw-r--r-- | noncore/apps/opie-console/transferdialog.h | 8 |
7 files changed, 60 insertions, 35 deletions
diff --git a/noncore/apps/opie-console/filetransfer.cpp b/noncore/apps/opie-console/filetransfer.cpp index b39dc95..8e86ebb 100644 --- a/noncore/apps/opie-console/filetransfer.cpp +++ b/noncore/apps/opie-console/filetransfer.cpp @@ -193,2 +193,4 @@ void FileTransfer::slotRead() { void FileTransfer::slotProgress( const QStringList& list ) { + if ( m_type != SZ ) + return; bool complete = true; @@ -244,2 +246,3 @@ void FileTransfer::slotExec() { delete m_not; + m_proc = m_not = 0l; close( m_term[0] ); diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index fbeaa74..88727e4 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp @@ -228,2 +228,3 @@ void MainWindow::slotTransfer() { + if ( currentSession() ) { TransferDialog dlg(this); @@ -231,2 +232,3 @@ void MainWindow::slotTransfer() dlg.exec(); + } } diff --git a/noncore/apps/opie-console/metafactory.cpp b/noncore/apps/opie-console/metafactory.cpp index 2b672cf..901f29f 100644 --- a/noncore/apps/opie-console/metafactory.cpp +++ b/noncore/apps/opie-console/metafactory.cpp @@ -128,2 +128,11 @@ EmulationLayer* MetaFactory::newEmulationLayer( const QString& str, WidgetLayer* } +FileTransferLayer* MetaFactory::newFileTransfer(const QString& str, IOLayer* lay ) { + FileTransferLayer* file = 0l; + QMap<QString, filelayer>::Iterator it; + it = m_fileFact.find( str ); + if ( it != m_fileFact.end() ) { + file = (*(it.data() ) )(lay); + } + return file; +} QCString MetaFactory::internal( const QString& str )const { diff --git a/noncore/apps/opie-console/metafactory.h b/noncore/apps/opie-console/metafactory.h index d05ece4..7f0699b 100644 --- a/noncore/apps/opie-console/metafactory.h +++ b/noncore/apps/opie-console/metafactory.h @@ -80,2 +80,3 @@ public: EmulationLayer* newEmulationLayer(const QString&, WidgetLayer* ); + FileTransferLayer* newFileTransfer(const QString&, IOLayer* ); diff --git a/noncore/apps/opie-console/test/senderui.cpp b/noncore/apps/opie-console/test/senderui.cpp index 3e0bd65..8bc1676 100644 --- a/noncore/apps/opie-console/test/senderui.cpp +++ b/noncore/apps/opie-console/test/senderui.cpp @@ -42,3 +42,3 @@ void SenderUI::slotSendFile() { - sz = new FileTransfer(FileTransfer::SZ, ser); + sz = new FileTransfer(FileTransfer::SY, ser); sz->sendFile("/home/ich/bootopie-v06-13.jffs2"); diff --git a/noncore/apps/opie-console/transferdialog.cpp b/noncore/apps/opie-console/transferdialog.cpp index d639de6..ba06199 100644 --- a/noncore/apps/opie-console/transferdialog.cpp +++ b/noncore/apps/opie-console/transferdialog.cpp @@ -1,2 +1,10 @@ -#include "transferdialog.h" +#include <qlayout.h> +#include <qcombobox.h> +#include <qlabel.h> +#include <qlineedit.h> +#include <qpushbutton.h> +#include <qmessagebox.h> +#include <qprogressbar.h> + +#include <opie/ofiledialog.h> @@ -4,16 +12,17 @@ #include "io_serial.h" +#include "metafactory.h" +#include "mainwindow.h" + +#include "transferdialog.h" + -#include "qlayout.h" -#include "qcombobox.h" -#include "qlabel.h" -#include "qlineedit.h" -#include "qpushbutton.h" -#include "qmessagebox.h" -#include "qprogressbar.h" -#include "opie/ofiledialog.h" -TransferDialog::TransferDialog(QWidget *parent, const char *name) -: QDialog(/*parent, name*/NULL, NULL, true) + + + +TransferDialog::TransferDialog(MainWindow *parent, const char *name) +: QDialog(/*parent, name*/0l, 0l, true), m_win(parent) { + m_lay = 0l; QVBoxLayout *vbox; @@ -23,3 +32,2 @@ TransferDialog::TransferDialog(QWidget *parent, const char *name) - transfer = NULL; @@ -34,5 +42,10 @@ TransferDialog::TransferDialog(QWidget *parent, const char *name) protocol = new QComboBox(this); - protocol->insertItem("XModem"); - protocol->insertItem("YModem"); - protocol->insertItem("ZModem"); + /* use the fscking MetaFactory + * because we invented it for that fscking reason + * I'm really getting UPSET!!!! + */ + QStringList list = m_win->factory()->fileTransferLayers(); + for (QStringList::Iterator it =list.begin(); it != list.end(); ++it ) { + protocol->insertItem( (*it) ); + } @@ -78,3 +91,3 @@ void TransferDialog::slotFilename() QString f; - + f = OFileDialog::getOpenFileName(0); @@ -97,14 +110,9 @@ void TransferDialog::slotTransfer() - FileTransfer::Type transfermode = FileTransfer::SX; - if(protocol->currentText() == "YModem") transfermode == FileTransfer::SY; - if(protocol->currentText() == "ZModem") transfermode == FileTransfer::SZ; - - // dummy profile - Profile profile("Dummy", "serial", "vt102", Profile::White, Profile::Black, Profile::VT102); + m_lay = m_win->factory()->newFileTransfer( protocol->currentText(), + m_win->currentSession()->layer() ); + m_lay->sendFile(filename->text()); - transfer = new FileTransfer(transfermode, new IOSerial(profile)); - transfer->sendFile(filename->text()); - connect(transfer, SIGNAL(progress(const QString&, int, int, int, int, int)), SLOT(slotProgress(const QString&, int, int, int, int, int))); - connect(transfer, SIGNAL(error(int, const QString&)), SLOT(slotError(int, const QString&))); - connect(transfer, SIGNAL(sent()), SLOT(slotSent())); + connect(m_lay, SIGNAL(progress(const QString&, int, int, int, int, int)), SLOT(slotProgress(const QString&, int, int, int, int, int))); + connect(m_lay, SIGNAL(error(int, const QString&)), SLOT(slotError(int, const QString&))); + connect(m_lay, SIGNAL(sent()), SLOT(slotSent())); } @@ -115,7 +123,7 @@ void TransferDialog::slotCancel() - if(transfer) + if(m_lay) { - transfer->cancel(); - delete transfer; - transfer = NULL; + m_lay->cancel(); + delete m_lay; + m_lay = 0l; QMessageBox::information(this, diff --git a/noncore/apps/opie-console/transferdialog.h b/noncore/apps/opie-console/transferdialog.h index 61f425c..b0c1a76 100644 --- a/noncore/apps/opie-console/transferdialog.h +++ b/noncore/apps/opie-console/transferdialog.h @@ -10,3 +10,4 @@ class QLabel; class QPushButton; -class FileTransfer; +class MainWindow; +class FileTransferLayer; @@ -16,3 +17,3 @@ class TransferDialog : public QDialog public: - TransferDialog(QWidget *parent = NULL, const char *name = NULL); + TransferDialog(MainWindow *parent = 0l, const char *name = 0l); ~TransferDialog(); @@ -33,3 +34,4 @@ class TransferDialog : public QDialog QPushButton *ok, *cancel; - FileTransfer *transfer; + MainWindow* m_win; + FileTransferLayer* m_lay; }; |