author | josef <josef> | 2002-10-12 19:27:15 (UTC) |
---|---|---|
committer | josef <josef> | 2002-10-12 19:27:15 (UTC) |
commit | 63fb25f130c9ec82646165c6d35d502d5929bbe8 (patch) (side-by-side diff) | |
tree | 1f5c1da7d9e183f76f15272704c605b19ad0d6fa | |
parent | 82b04543125d6d856df180c437c8d9f95f41e888 (diff) | |
download | opie-63fb25f130c9ec82646165c6d35d502d5929bbe8.zip opie-63fb25f130c9ec82646165c6d35d502d5929bbe8.tar.gz opie-63fb25f130c9ec82646165c6d35d502d5929bbe8.tar.bz2 |
- my bad: FileTransfer inherits from the layer -> there are the signals :)
- setup sig handlers for sent(), progress(), error()
-rw-r--r-- | noncore/apps/opie-console/transferdialog.cpp | 53 | ||||
-rw-r--r-- | noncore/apps/opie-console/transferdialog.h | 3 |
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 @@ -96,3 +96,2 @@ void TransferDialog::slotTransfer() statusbar->setText(QObject::tr("Sending...")); - progressbar->setProgress(1); @@ -107,2 +106,5 @@ void TransferDialog::slotTransfer() 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())); } @@ -128 +130,50 @@ void TransferDialog::slotCancel() +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 @@ -23,2 +23,5 @@ class TransferDialog : public QDialog void slotCancel(); + void slotProgress(const QString&, int, int, int, int, int); + void slotError(int error, const QString& message); + void slotSent(); |