summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/transferdialog.cpp
Unidiff
Diffstat (limited to 'noncore/apps/opie-console/transferdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/transferdialog.cpp47
1 files changed, 36 insertions, 11 deletions
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
@@ -10,8 +10,8 @@
10 10
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"
17 17
@@ -21,6 +21,7 @@ TransferDialog::TransferDialog(MainWindow *parent, const char *name)
21: QDialog(0l, 0l, true), m_win(parent) 21: QDialog(0l, 0l, true), m_win(parent)
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;
26 QLabel *file, *mode, *progress, *status; 27 QLabel *file, *mode, *progress, *status;
@@ -115,18 +116,26 @@ void TransferDialog::slotTransfer()
115 if(m_transfermode == id_send) statusbar->setText(QObject::tr("Sending...")); 116 if(m_transfermode == id_send) statusbar->setText(QObject::tr("Sending..."));
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
132void TransferDialog::slotCancel() 141void TransferDialog::slotCancel()
@@ -134,11 +143,20 @@ void TransferDialog::slotCancel()
134 ok->setEnabled(true); 143 ok->setEnabled(true);
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"),
144 QObject::tr("The file transfer has been cancelled.")); 162 QObject::tr("The file transfer has been cancelled."));
@@ -201,6 +219,13 @@ void TransferDialog::slotSent()
201 statusbar->setText(QObject::tr("Ready")); 219 statusbar->setText(QObject::tr("Ready"));
202} 220}
203 221
222void 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
204void TransferDialog::slotMode(int id) 229void TransferDialog::slotMode(int id)
205{ 230{
206 if(id == id_send) 231 if(id == id_send)