summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/transferdialog.cpp53
-rw-r--r--noncore/apps/opie-console/transferdialog.h3
2 files changed, 55 insertions, 1 deletions
diff --git a/noncore/apps/opie-console/transferdialog.cpp b/noncore/apps/opie-console/transferdialog.cpp
index 45522a8..d639de6 100644
--- a/noncore/apps/opie-console/transferdialog.cpp
+++ b/noncore/apps/opie-console/transferdialog.cpp
@@ -91,23 +91,25 @@ void TransferDialog::slotTransfer()
return;
}
ok->setEnabled(false);
statusbar->setText(QObject::tr("Sending..."));
- progressbar->setProgress(1);
FileTransfer::Type transfermode = FileTransfer::SX;
if(protocol->currentText() == "YModem") transfermode == FileTransfer::SY;
if(protocol->currentText() == "ZModem") transfermode == FileTransfer::SZ;
// dummy profile
Profile profile("Dummy", "serial", "vt102", Profile::White, Profile::Black, Profile::VT102);
transfer = new FileTransfer(transfermode, new IOSerial(profile));
transfer->sendFile(filename->text());
+ connect(transfer, SIGNAL(progress(const QString&, int, int, int, int, int)), SLOT(slotProgress(const QString&, int, int, int, int, int)));
+ connect(transfer, SIGNAL(error(int, const QString&)), SLOT(slotError(int, const QString&)));
+ connect(transfer, SIGNAL(sent()), SLOT(slotSent()));
}
void TransferDialog::slotCancel()
{
ok->setEnabled(true);
@@ -123,6 +125,55 @@ void TransferDialog::slotCancel()
else
{
close();
}
}
+void TransferDialog::slotProgress(const QString& file, int progress, int speed, int hours, int minutes, int seconds)
+{
+ progressbar->setProgress(progress);
+}
+
+void TransferDialog::slotError(int error, const QString& message)
+{
+ switch(error)
+ {
+ case FileTransferLayer::NotSupported:
+ QMessageBox::critical(this,
+ QObject::tr("Error"),
+ QObject::tr("Operation not supported."));
+ break;
+ case FileTransferLayer::StartError:
+ QMessageBox::critical(this,
+ QObject::tr("Error"),
+ QObject::tr("Operation not supported."));
+ break;
+ case FileTransferLayer::NoError:
+ QMessageBox::critical(this,
+ QObject::tr("Error"),
+ QObject::tr("Operation not supported."));
+ break;
+ case FileTransferLayer::Undefined:
+ QMessageBox::critical(this,
+ QObject::tr("Error"),
+ QObject::tr("Operation not supported."));
+ break;
+ case FileTransferLayer::Incomplete:
+ QMessageBox::critical(this,
+ QObject::tr("Error"),
+ QObject::tr("Operation not supported."));
+ break;
+ case FileTransferLayer::Unknown:
+ default:
+ QMessageBox::critical(this,
+ QObject::tr("Error"),
+ QObject::tr("Operation not supported."));
+ break;
+ }
+}
+
+void TransferDialog::slotSent()
+{
+ QMessageBox::information(this, QObject::tr("Sent"), QObject::tr("File has been sent."));
+ ok->setEnabled(true);
+}
+
diff --git a/noncore/apps/opie-console/transferdialog.h b/noncore/apps/opie-console/transferdialog.h
index 62ae14d..61f425c 100644
--- a/noncore/apps/opie-console/transferdialog.h
+++ b/noncore/apps/opie-console/transferdialog.h
@@ -18,12 +18,15 @@ class TransferDialog : public QDialog
~TransferDialog();
public slots:
void slotFilename();
void slotTransfer();
void slotCancel();
+ void slotProgress(const QString&, int, int, int, int, int);
+ void slotError(int error, const QString& message);
+ void slotSent();
private:
QLineEdit *filename;
QComboBox *protocol;
QProgressBar *progressbar;
QLabel *statusbar;