summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show 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.cpp39
-rw-r--r--noncore/apps/opie-console/transferdialog.h3
6 files changed, 86 insertions, 7 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
@@ -3,4 +3,5 @@
#include "io_bt.h"
#include "filetransfer.h"
+#include "filereceive.h"
#include "serialconfigwidget.h"
#include "irdaconfigwidget.h"
@@ -24,4 +25,15 @@ 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
IOLayer* newSerialLayer( const Profile& prof) {
@@ -67,4 +79,8 @@ Default::Default( MetaFactory* fact ) {
fact->addFileTransferLayer( "SX", QObject::tr("X-Modem"), newSXTransfer );
+ 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 );
fact->addIOLayerFactory( "irda", QObject::tr("Infrared"), newIrDaLayer );
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
@@ -11,4 +11,8 @@ extern "C" {
FileTransferLayer* newSXTransfer(IOLayer*);
+ ReceiveLayer* newSZReceive(IOLayer*);
+ ReceiveLayer* newSYReceive(IOLayer*);
+ ReceiveLayer* newSXReceive(IOLayer*);
+
IOLayer* newSerialLayer(const Profile&);
IOLayer* newBTLayer(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
@@ -31,4 +31,10 @@ void MetaFactory::addFileTransferLayer( const QCString& name,
m_fileFact.insert( str, lay );
}
+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,
const QString& str,
@@ -69,4 +75,12 @@ QStringList MetaFactory::fileTransferLayers()const {
return list;
}
+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 {
QStringList list;
@@ -136,4 +150,13 @@ FileTransferLayer* MetaFactory::newFileTransfer(const QString& str, IOLayer* lay
return file;
}
+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 {
return m_strings[str];
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
@@ -14,4 +14,5 @@
#include "io_layer.h"
#include "file_layer.h"
+#include "receive_layer.h"
#include "profile.h"
#include "profiledialogwidget.h"
@@ -24,4 +25,5 @@ public:
typedef IOLayer* (*iolayer)(const Profile& );
typedef FileTransferLayer* (*filelayer)(IOLayer*);
+ typedef ReceiveLayer* (*receivelayer)(IOLayer*);
typedef EmulationLayer* (*emulationLayer)(WidgetLayer* );
@@ -53,4 +55,7 @@ public:
const QString&,
filelayer );
+ void addReceiveLayer( const QCString& name,
+ const QString&,
+ receivelayer);
/**
@@ -70,4 +75,5 @@ public:
QStringList terminalWidgets()const;
QStringList fileTransferLayers()const;
+ QStringList receiveLayers()const;
QStringList emulationLayers()const;
@@ -80,4 +86,5 @@ public:
EmulationLayer* newEmulationLayer(const QString&, WidgetLayer* );
FileTransferLayer* newFileTransfer(const QString&, IOLayer* );
+ ReceiveLayer* newReceive(const QString&, IOLayer* );
/*
@@ -101,4 +108,5 @@ private:
QMap<QString, iolayer> m_layerFact;
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
@@ -11,6 +11,6 @@
#include <opie/ofiledialog.h>
-#include "filetransfer.h"
-#include "io_serial.h"
+#include "file_layer.h"
+#include "receive_layer.h"
#include "metafactory.h"
#include "mainwindow.h"
@@ -22,4 +22,5 @@ TransferDialog::TransferDialog(MainWindow *parent, const char *name)
{
m_lay = 0l;
+ m_recvlay = 0l;
QVBoxLayout *vbox, *vbox2;
QHBoxLayout *hbox, *hbox2, *hbox3;
@@ -116,16 +117,24 @@ void TransferDialog::slotTransfer()
else statusbar->setText(QObject::tr("Receiving..."));
- 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()));
}
else
{
- }
+ 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&)));
+ }
}
@@ -135,4 +144,6 @@ void TransferDialog::slotCancel()
statusbar->setText(QObject::tr("Ready"));
+ if((m_lay) || (m_recvlay))
+ {
if(m_lay)
{
@@ -140,4 +151,11 @@ void TransferDialog::slotCancel()
delete m_lay;
m_lay = 0l;
+ }
+ if(m_recvlay)
+ {
+ m_recvlay->cancel();
+ delete m_recvlay;
+ m_recvlay = 0l;
+ }
QMessageBox::information(this,
QObject::tr("Cancelled"),
@@ -202,4 +220,11 @@ 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
@@ -11,4 +11,5 @@ class QPushButton;
class MainWindow;
class FileTransferLayer;
+class ReceiveLayer;
class TransferDialog : public QDialog
@@ -26,4 +27,5 @@ class TransferDialog : public QDialog
void slotError(int error, const QString& message);
void slotSent();
+ void slotReceived(const QString& file);
void slotMode(int id);
@@ -42,4 +44,5 @@ class TransferDialog : public QDialog
MainWindow* m_win;
FileTransferLayer* m_lay;
+ ReceiveLayer *m_recvlay;
int m_transfermode;
};