summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/default.cpp16
-rw-r--r--noncore/apps/opie-console/default.h4
-rw-r--r--noncore/apps/opie-console/metafactory.cpp23
-rw-r--r--noncore/apps/opie-console/metafactory.h8
-rw-r--r--noncore/apps/opie-console/transferdialog.cpp47
-rw-r--r--noncore/apps/opie-console/transferdialog.h3
6 files changed, 90 insertions, 11 deletions
diff --git a/noncore/apps/opie-console/default.cpp b/noncore/apps/opie-console/default.cpp
index 4853785..dd9681d 100644
--- a/noncore/apps/opie-console/default.cpp
+++ b/noncore/apps/opie-console/default.cpp
@@ -4,2 +4,3 @@
#include "filetransfer.h"
+#include "filereceive.h"
#include "serialconfigwidget.h"
@@ -25,2 +26,13 @@ extern "C" {
+ // FILE Transfer Receive Stuff
+ ReceiveLayer* newSZReceive(IOLayer* lay) {
+ return new FileReceive( FileReceive::SZ, lay );
+ }
+ ReceiveLayer* newSYReceive(IOLayer* lay) {
+ return new FileReceive( FileReceive::SY, lay );
+ }
+ ReceiveLayer* newSXReceive(IOLayer* lay) {
+ return new FileReceive(FileReceive::SX, lay );
+ }
+
// Layer stuff
@@ -68,2 +80,6 @@ Default::Default( MetaFactory* fact ) {
+ fact->addReceiveLayer( "SZ", QObject::tr("Z-Modem"), newSZReceive );
+ fact->addReceiveLayer( "SY", QObject::tr("Y-Modem"), newSYReceive );
+ fact->addReceiveLayer( "SX", QObject::tr("X-Modem"), newSXReceive );
+
fact->addIOLayerFactory( "serial", QObject::tr("Serial"), newSerialLayer );
diff --git a/noncore/apps/opie-console/default.h b/noncore/apps/opie-console/default.h
index 4d51db8..03616f3 100644
--- a/noncore/apps/opie-console/default.h
+++ b/noncore/apps/opie-console/default.h
@@ -12,2 +12,6 @@ extern "C" {
+ ReceiveLayer* newSZReceive(IOLayer*);
+ ReceiveLayer* newSYReceive(IOLayer*);
+ ReceiveLayer* newSXReceive(IOLayer*);
+
IOLayer* newSerialLayer(const Profile&);
diff --git a/noncore/apps/opie-console/metafactory.cpp b/noncore/apps/opie-console/metafactory.cpp
index 901f29f..09ba586 100644
--- a/noncore/apps/opie-console/metafactory.cpp
+++ b/noncore/apps/opie-console/metafactory.cpp
@@ -32,2 +32,8 @@ void MetaFactory::addFileTransferLayer( const QCString& name,
}
+void MetaFactory::addReceiveLayer( const QCString& name,
+ const QString& str,
+ receivelayer lay) {
+ m_strings.insert(str, name );
+ m_receiveFact.insert( str, lay );
+}
void MetaFactory::addEmulationLayer( const QCString& name,
@@ -70,2 +76,10 @@ QStringList MetaFactory::fileTransferLayers()const {
}
+QStringList MetaFactory::receiveLayers()const {
+ QStringList list;
+ QMap<QString, receivelayer>::ConstIterator it;
+ for ( it = m_receiveFact.begin(); it != m_receiveFact.end(); ++it ) {
+ list << it.key();
+ }
+ return list;
+}
QStringList MetaFactory::emulationLayers()const {
@@ -137,2 +151,11 @@ FileTransferLayer* MetaFactory::newFileTransfer(const QString& str, IOLayer* lay
}
+ReceiveLayer* MetaFactory::newReceive(const QString& str, IOLayer* lay ) {
+ ReceiveLayer* file = 0l;
+ QMap<QString, receivelayer>::Iterator it;
+ it = m_receiveFact.find( str );
+ if ( it != m_receiveFact.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 7f0699b..d6aa5e2 100644
--- a/noncore/apps/opie-console/metafactory.h
+++ b/noncore/apps/opie-console/metafactory.h
@@ -15,2 +15,3 @@
#include "file_layer.h"
+#include "receive_layer.h"
#include "profile.h"
@@ -25,2 +26,3 @@ public:
typedef FileTransferLayer* (*filelayer)(IOLayer*);
+ typedef ReceiveLayer* (*receivelayer)(IOLayer*);
typedef EmulationLayer* (*emulationLayer)(WidgetLayer* );
@@ -54,2 +56,5 @@ public:
filelayer );
+ void addReceiveLayer( const QCString& name,
+ const QString&,
+ receivelayer);
@@ -71,2 +76,3 @@ public:
QStringList fileTransferLayers()const;
+ QStringList receiveLayers()const;
QStringList emulationLayers()const;
@@ -81,2 +87,3 @@ public:
FileTransferLayer* newFileTransfer(const QString&, IOLayer* );
+ ReceiveLayer* newReceive(const QString&, IOLayer* );
@@ -102,2 +109,3 @@ private:
QMap<QString, filelayer> m_fileFact;
+ QMap<QString, receivelayer> m_receiveFact;
QMap<QString, emulationLayer> m_emu;
diff --git a/noncore/apps/opie-console/transferdialog.cpp b/noncore/apps/opie-console/transferdialog.cpp
index d3b9c0a..0083cc1 100644
--- a/noncore/apps/opie-console/transferdialog.cpp
+++ b/noncore/apps/opie-console/transferdialog.cpp
@@ -12,4 +12,4 @@
-#include "filetransfer.h"
-#include "io_serial.h"
+#include "file_layer.h"
+#include "receive_layer.h"
#include "metafactory.h"
@@ -23,2 +23,3 @@ TransferDialog::TransferDialog(MainWindow *parent, const char *name)
m_lay = 0l;
+ m_recvlay = 0l;
QVBoxLayout *vbox, *vbox2;
@@ -117,6 +118,11 @@ void TransferDialog::slotTransfer()
- m_lay = m_win->factory()->newFileTransfer(protocol->currentText(), m_win->currentSession()->layer());
if(m_transfermode == id_send)
{
+ m_lay = m_win->factory()->newFileTransfer(protocol->currentText(), m_win->currentSession()->layer());
m_lay->sendFile(filename->text());
+
+ 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()));
}
@@ -124,7 +130,10 @@ void TransferDialog::slotTransfer()
{
- }
+ m_recvlay = m_win->factory()->newReceive(protocol->currentText(), m_win->currentSession()->layer());
+ m_recvlay->receive();
- 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()));
+ connect(m_recvlay, SIGNAL(progress(const QString&, int, int, int, int, int)),
+ SLOT(slotProgress(const QString&, int, int, int, int, int)));
+ connect(m_recvlay, SIGNAL(error(int, const QString&)), SLOT(slotError(int, const QString&)));
+ connect(m_recvlay, SIGNAL(received(const QString&)), SLOT(slotReceived(const QString&)));
+ }
}
@@ -136,7 +145,16 @@ void TransferDialog::slotCancel()
- if(m_lay)
+ if((m_lay) || (m_recvlay))
{
- m_lay->cancel();
- delete m_lay;
- m_lay = 0l;
+ if(m_lay)
+ {
+ m_lay->cancel();
+ delete m_lay;
+ m_lay = 0l;
+ }
+ if(m_recvlay)
+ {
+ m_recvlay->cancel();
+ delete m_recvlay;
+ m_recvlay = 0l;
+ }
QMessageBox::information(this,
@@ -203,2 +221,9 @@ void TransferDialog::slotSent()
+void TransferDialog::slotReceived(const QString& file)
+{
+ QMessageBox::information(this, QObject::tr("Sent"), QObject::tr("File has been received as %1.").arg(file));
+ ok->setEnabled(true);
+ statusbar->setText(QObject::tr("Ready"));
+}
+
void TransferDialog::slotMode(int id)
diff --git a/noncore/apps/opie-console/transferdialog.h b/noncore/apps/opie-console/transferdialog.h
index a567161..de3a5cf 100644
--- a/noncore/apps/opie-console/transferdialog.h
+++ b/noncore/apps/opie-console/transferdialog.h
@@ -12,2 +12,3 @@ class MainWindow;
class FileTransferLayer;
+class ReceiveLayer;
@@ -27,2 +28,3 @@ class TransferDialog : public QDialog
void slotSent();
+ void slotReceived(const QString& file);
void slotMode(int id);
@@ -43,2 +45,3 @@ class TransferDialog : public QDialog
FileTransferLayer* m_lay;
+ ReceiveLayer *m_recvlay;
int m_transfermode;