summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/transferdialog.cpp
Side-by-side diff
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
@@ -7,23 +7,24 @@
#include <qprogressbar.h>
#include <qradiobutton.h>
#include <qbuttongroup.h>
#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"
#include "transferdialog.h"
TransferDialog::TransferDialog(MainWindow *parent, const char *name)
: QDialog(0l, 0l, true), m_win(parent)
{
m_lay = 0l;
+ m_recvlay = 0l;
QVBoxLayout *vbox, *vbox2;
QHBoxLayout *hbox, *hbox2, *hbox3;
QLabel *file, *mode, *progress, *status;
QButtonGroup *group;
QRadioButton *mode_send, *mode_receive;
@@ -112,36 +113,53 @@ void TransferDialog::slotTransfer()
ok->setEnabled(false);
if(m_transfermode == id_send) statusbar->setText(QObject::tr("Sending..."));
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&)));
+ }
}
void TransferDialog::slotCancel()
{
ok->setEnabled(true);
statusbar->setText(QObject::tr("Ready"));
- 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,
QObject::tr("Cancelled"),
QObject::tr("The file transfer has been cancelled."));
}
else
{
@@ -198,12 +216,19 @@ void TransferDialog::slotSent()
{
QMessageBox::information(this, QObject::tr("Sent"), QObject::tr("File has been sent."));
ok->setEnabled(true);
statusbar->setText(QObject::tr("Ready"));
}
+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)
{
if(id == id_send)
{
selector->setEnabled(true);
filename->setEnabled(true);