-rw-r--r-- | noncore/apps/opie-console/default.cpp | 16 | ||||
-rw-r--r-- | noncore/apps/opie-console/default.h | 4 | ||||
-rw-r--r-- | noncore/apps/opie-console/metafactory.cpp | 23 | ||||
-rw-r--r-- | noncore/apps/opie-console/metafactory.h | 8 | ||||
-rw-r--r-- | noncore/apps/opie-console/transferdialog.cpp | 47 | ||||
-rw-r--r-- | noncore/apps/opie-console/transferdialog.h | 3 |
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 | |||
@@ -3,4 +3,5 @@ | |||
3 | #include "io_bt.h" | 3 | #include "io_bt.h" |
4 | #include "filetransfer.h" | 4 | #include "filetransfer.h" |
5 | #include "filereceive.h" | ||
5 | #include "serialconfigwidget.h" | 6 | #include "serialconfigwidget.h" |
6 | #include "irdaconfigwidget.h" | 7 | #include "irdaconfigwidget.h" |
@@ -24,4 +25,15 @@ extern "C" { | |||
24 | } | 25 | } |
25 | 26 | ||
27 | // FILE Transfer Receive Stuff | ||
28 | ReceiveLayer* newSZReceive(IOLayer* lay) { | ||
29 | return new FileReceive( FileReceive::SZ, lay ); | ||
30 | } | ||
31 | ReceiveLayer* newSYReceive(IOLayer* lay) { | ||
32 | return new FileReceive( FileReceive::SY, lay ); | ||
33 | } | ||
34 | ReceiveLayer* newSXReceive(IOLayer* lay) { | ||
35 | return new FileReceive(FileReceive::SX, lay ); | ||
36 | } | ||
37 | |||
26 | // Layer stuff | 38 | // Layer stuff |
27 | IOLayer* newSerialLayer( const Profile& prof) { | 39 | IOLayer* newSerialLayer( const Profile& prof) { |
@@ -67,4 +79,8 @@ Default::Default( MetaFactory* fact ) { | |||
67 | fact->addFileTransferLayer( "SX", QObject::tr("X-Modem"), newSXTransfer ); | 79 | fact->addFileTransferLayer( "SX", QObject::tr("X-Modem"), newSXTransfer ); |
68 | 80 | ||
81 | fact->addReceiveLayer( "SZ", QObject::tr("Z-Modem"), newSZReceive ); | ||
82 | fact->addReceiveLayer( "SY", QObject::tr("Y-Modem"), newSYReceive ); | ||
83 | fact->addReceiveLayer( "SX", QObject::tr("X-Modem"), newSXReceive ); | ||
84 | |||
69 | fact->addIOLayerFactory( "serial", QObject::tr("Serial"), newSerialLayer ); | 85 | fact->addIOLayerFactory( "serial", QObject::tr("Serial"), newSerialLayer ); |
70 | fact->addIOLayerFactory( "irda", QObject::tr("Infrared"), newIrDaLayer ); | 86 | 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" { | |||
11 | FileTransferLayer* newSXTransfer(IOLayer*); | 11 | FileTransferLayer* newSXTransfer(IOLayer*); |
12 | 12 | ||
13 | ReceiveLayer* newSZReceive(IOLayer*); | ||
14 | ReceiveLayer* newSYReceive(IOLayer*); | ||
15 | ReceiveLayer* newSXReceive(IOLayer*); | ||
16 | |||
13 | IOLayer* newSerialLayer(const Profile&); | 17 | IOLayer* newSerialLayer(const Profile&); |
14 | IOLayer* newBTLayer(const Profile& ); | 18 | 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, | |||
31 | m_fileFact.insert( str, lay ); | 31 | m_fileFact.insert( str, lay ); |
32 | } | 32 | } |
33 | void MetaFactory::addReceiveLayer( const QCString& name, | ||
34 | const QString& str, | ||
35 | receivelayer lay) { | ||
36 | m_strings.insert(str, name ); | ||
37 | m_receiveFact.insert( str, lay ); | ||
38 | } | ||
33 | void MetaFactory::addEmulationLayer( const QCString& name, | 39 | void MetaFactory::addEmulationLayer( const QCString& name, |
34 | const QString& str, | 40 | const QString& str, |
@@ -69,4 +75,12 @@ QStringList MetaFactory::fileTransferLayers()const { | |||
69 | return list; | 75 | return list; |
70 | } | 76 | } |
77 | QStringList MetaFactory::receiveLayers()const { | ||
78 | QStringList list; | ||
79 | QMap<QString, receivelayer>::ConstIterator it; | ||
80 | for ( it = m_receiveFact.begin(); it != m_receiveFact.end(); ++it ) { | ||
81 | list << it.key(); | ||
82 | } | ||
83 | return list; | ||
84 | } | ||
71 | QStringList MetaFactory::emulationLayers()const { | 85 | QStringList MetaFactory::emulationLayers()const { |
72 | QStringList list; | 86 | QStringList list; |
@@ -136,4 +150,13 @@ FileTransferLayer* MetaFactory::newFileTransfer(const QString& str, IOLayer* lay | |||
136 | return file; | 150 | return file; |
137 | } | 151 | } |
152 | ReceiveLayer* MetaFactory::newReceive(const QString& str, IOLayer* lay ) { | ||
153 | ReceiveLayer* file = 0l; | ||
154 | QMap<QString, receivelayer>::Iterator it; | ||
155 | it = m_receiveFact.find( str ); | ||
156 | if ( it != m_receiveFact.end() ) { | ||
157 | file = (*(it.data() ) )(lay); | ||
158 | } | ||
159 | return file; | ||
160 | } | ||
138 | QCString MetaFactory::internal( const QString& str )const { | 161 | QCString MetaFactory::internal( const QString& str )const { |
139 | return m_strings[str]; | 162 | 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 @@ | |||
14 | #include "io_layer.h" | 14 | #include "io_layer.h" |
15 | #include "file_layer.h" | 15 | #include "file_layer.h" |
16 | #include "receive_layer.h" | ||
16 | #include "profile.h" | 17 | #include "profile.h" |
17 | #include "profiledialogwidget.h" | 18 | #include "profiledialogwidget.h" |
@@ -24,4 +25,5 @@ public: | |||
24 | typedef IOLayer* (*iolayer)(const Profile& ); | 25 | typedef IOLayer* (*iolayer)(const Profile& ); |
25 | typedef FileTransferLayer* (*filelayer)(IOLayer*); | 26 | typedef FileTransferLayer* (*filelayer)(IOLayer*); |
27 | typedef ReceiveLayer* (*receivelayer)(IOLayer*); | ||
26 | typedef EmulationLayer* (*emulationLayer)(WidgetLayer* ); | 28 | typedef EmulationLayer* (*emulationLayer)(WidgetLayer* ); |
27 | 29 | ||
@@ -53,4 +55,7 @@ public: | |||
53 | const QString&, | 55 | const QString&, |
54 | filelayer ); | 56 | filelayer ); |
57 | void addReceiveLayer( const QCString& name, | ||
58 | const QString&, | ||
59 | receivelayer); | ||
55 | 60 | ||
56 | /** | 61 | /** |
@@ -70,4 +75,5 @@ public: | |||
70 | QStringList terminalWidgets()const; | 75 | QStringList terminalWidgets()const; |
71 | QStringList fileTransferLayers()const; | 76 | QStringList fileTransferLayers()const; |
77 | QStringList receiveLayers()const; | ||
72 | QStringList emulationLayers()const; | 78 | QStringList emulationLayers()const; |
73 | 79 | ||
@@ -80,4 +86,5 @@ public: | |||
80 | EmulationLayer* newEmulationLayer(const QString&, WidgetLayer* ); | 86 | EmulationLayer* newEmulationLayer(const QString&, WidgetLayer* ); |
81 | FileTransferLayer* newFileTransfer(const QString&, IOLayer* ); | 87 | FileTransferLayer* newFileTransfer(const QString&, IOLayer* ); |
88 | ReceiveLayer* newReceive(const QString&, IOLayer* ); | ||
82 | 89 | ||
83 | /* | 90 | /* |
@@ -101,4 +108,5 @@ private: | |||
101 | QMap<QString, iolayer> m_layerFact; | 108 | QMap<QString, iolayer> m_layerFact; |
102 | QMap<QString, filelayer> m_fileFact; | 109 | QMap<QString, filelayer> m_fileFact; |
110 | QMap<QString, receivelayer> m_receiveFact; | ||
103 | QMap<QString, emulationLayer> m_emu; | 111 | QMap<QString, emulationLayer> m_emu; |
104 | }; | 112 | }; |
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 @@ | |||
11 | #include <opie/ofiledialog.h> | 11 | #include <opie/ofiledialog.h> |
12 | 12 | ||
13 | #include "filetransfer.h" | 13 | #include "file_layer.h" |
14 | #include "io_serial.h" | 14 | #include "receive_layer.h" |
15 | #include "metafactory.h" | 15 | #include "metafactory.h" |
16 | #include "mainwindow.h" | 16 | #include "mainwindow.h" |
@@ -22,4 +22,5 @@ TransferDialog::TransferDialog(MainWindow *parent, const char *name) | |||
22 | { | 22 | { |
23 | m_lay = 0l; | 23 | m_lay = 0l; |
24 | m_recvlay = 0l; | ||
24 | QVBoxLayout *vbox, *vbox2; | 25 | QVBoxLayout *vbox, *vbox2; |
25 | QHBoxLayout *hbox, *hbox2, *hbox3; | 26 | QHBoxLayout *hbox, *hbox2, *hbox3; |
@@ -116,16 +117,24 @@ void TransferDialog::slotTransfer() | |||
116 | else statusbar->setText(QObject::tr("Receiving...")); | 117 | else statusbar->setText(QObject::tr("Receiving...")); |
117 | 118 | ||
118 | m_lay = m_win->factory()->newFileTransfer(protocol->currentText(), m_win->currentSession()->layer()); | ||
119 | if(m_transfermode == id_send) | 119 | if(m_transfermode == id_send) |
120 | { | 120 | { |
121 | m_lay = m_win->factory()->newFileTransfer(protocol->currentText(), m_win->currentSession()->layer()); | ||
121 | m_lay->sendFile(filename->text()); | 122 | m_lay->sendFile(filename->text()); |
123 | |||
124 | connect(m_lay, SIGNAL(progress(const QString&, int, int, int, int, int)), | ||
125 | SLOT(slotProgress(const QString&, int, int, int, int, int))); | ||
126 | connect(m_lay, SIGNAL(error(int, const QString&)), SLOT(slotError(int, const QString&))); | ||
127 | connect(m_lay, SIGNAL(sent()), SLOT(slotSent())); | ||
122 | } | 128 | } |
123 | else | 129 | else |
124 | { | 130 | { |
125 | } | 131 | m_recvlay = m_win->factory()->newReceive(protocol->currentText(), m_win->currentSession()->layer()); |
132 | m_recvlay->receive(); | ||
126 | 133 | ||
127 | connect(m_lay, SIGNAL(progress(const QString&, int, int, int, int, int)), SLOT(slotProgress(const QString&, int, int, int, int, int))); | 134 | connect(m_recvlay, SIGNAL(progress(const QString&, int, int, int, int, int)), |
128 | connect(m_lay, SIGNAL(error(int, const QString&)), SLOT(slotError(int, const QString&))); | 135 | SLOT(slotProgress(const QString&, int, int, int, int, int))); |
129 | connect(m_lay, SIGNAL(sent()), SLOT(slotSent())); | 136 | connect(m_recvlay, SIGNAL(error(int, const QString&)), SLOT(slotError(int, const QString&))); |
137 | connect(m_recvlay, SIGNAL(received(const QString&)), SLOT(slotReceived(const QString&))); | ||
138 | } | ||
130 | } | 139 | } |
131 | 140 | ||
@@ -135,9 +144,18 @@ void TransferDialog::slotCancel() | |||
135 | statusbar->setText(QObject::tr("Ready")); | 144 | statusbar->setText(QObject::tr("Ready")); |
136 | 145 | ||
137 | if(m_lay) | 146 | if((m_lay) || (m_recvlay)) |
138 | { | 147 | { |
139 | m_lay->cancel(); | 148 | if(m_lay) |
140 | delete m_lay; | 149 | { |
141 | m_lay = 0l; | 150 | m_lay->cancel(); |
151 | delete m_lay; | ||
152 | m_lay = 0l; | ||
153 | } | ||
154 | if(m_recvlay) | ||
155 | { | ||
156 | m_recvlay->cancel(); | ||
157 | delete m_recvlay; | ||
158 | m_recvlay = 0l; | ||
159 | } | ||
142 | QMessageBox::information(this, | 160 | QMessageBox::information(this, |
143 | QObject::tr("Cancelled"), | 161 | QObject::tr("Cancelled"), |
@@ -202,4 +220,11 @@ void TransferDialog::slotSent() | |||
202 | } | 220 | } |
203 | 221 | ||
222 | void TransferDialog::slotReceived(const QString& file) | ||
223 | { | ||
224 | QMessageBox::information(this, QObject::tr("Sent"), QObject::tr("File has been received as %1.").arg(file)); | ||
225 | ok->setEnabled(true); | ||
226 | statusbar->setText(QObject::tr("Ready")); | ||
227 | } | ||
228 | |||
204 | void TransferDialog::slotMode(int id) | 229 | void TransferDialog::slotMode(int id) |
205 | { | 230 | { |
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; | |||
11 | class MainWindow; | 11 | class MainWindow; |
12 | class FileTransferLayer; | 12 | class FileTransferLayer; |
13 | class ReceiveLayer; | ||
13 | 14 | ||
14 | class TransferDialog : public QDialog | 15 | class TransferDialog : public QDialog |
@@ -26,4 +27,5 @@ class TransferDialog : public QDialog | |||
26 | void slotError(int error, const QString& message); | 27 | void slotError(int error, const QString& message); |
27 | void slotSent(); | 28 | void slotSent(); |
29 | void slotReceived(const QString& file); | ||
28 | void slotMode(int id); | 30 | void slotMode(int id); |
29 | 31 | ||
@@ -42,4 +44,5 @@ class TransferDialog : public QDialog | |||
42 | MainWindow* m_win; | 44 | MainWindow* m_win; |
43 | FileTransferLayer* m_lay; | 45 | FileTransferLayer* m_lay; |
46 | ReceiveLayer *m_recvlay; | ||
44 | int m_transfermode; | 47 | int m_transfermode; |
45 | }; | 48 | }; |