author | josef <josef> | 2002-10-12 18:16:45 (UTC) |
---|---|---|
committer | josef <josef> | 2002-10-12 18:16:45 (UTC) |
commit | 82b04543125d6d856df180c437c8d9f95f41e888 (patch) (side-by-side diff) | |
tree | b09807b9736d07d02dfa8a9dc79d385771be8c1a /noncore/apps/opie-console/transferdialog.cpp | |
parent | 9c983d273b055d847cf2d1fa4f5b6e082ce850c9 (diff) | |
download | opie-82b04543125d6d856df180c437c8d9f95f41e888.zip opie-82b04543125d6d856df180c437c8d9f95f41e888.tar.gz opie-82b04543125d6d856df180c437c8d9f95f41e888.tar.bz2 |
- embed transferdialog into menu
Diffstat (limited to 'noncore/apps/opie-console/transferdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/transferdialog.cpp | 44 |
1 files changed, 40 insertions, 4 deletions
diff --git a/noncore/apps/opie-console/transferdialog.cpp b/noncore/apps/opie-console/transferdialog.cpp index 08fb32b..45522a8 100644 --- a/noncore/apps/opie-console/transferdialog.cpp +++ b/noncore/apps/opie-console/transferdialog.cpp @@ -1,4 +1,7 @@ #include "transferdialog.h" +#include "filetransfer.h" +#include "io_serial.h" + #include "qlayout.h" #include "qcombobox.h" @@ -12,10 +15,12 @@ TransferDialog::TransferDialog(QWidget *parent, const char *name) -: QWidget(parent, name) +: QDialog(/*parent, name*/NULL, NULL, true) { QVBoxLayout *vbox; QHBoxLayout *hbox, *hbox2; QLabel *file, *mode, *progress, *status; - QPushButton *selector, *ok, *cancel; + QPushButton *selector; + + transfer = NULL; file = new QLabel(QObject::tr("Send file"), this); @@ -38,5 +43,5 @@ TransferDialog::TransferDialog(QWidget *parent, const char *name) selector = new QPushButton("...", this); - ok = new QPushButton(QObject::tr("OK"), this); + ok = new QPushButton(QObject::tr("Start transfer"), this); cancel = new QPushButton(QObject::tr("Cancel"), this); @@ -62,5 +67,5 @@ TransferDialog::TransferDialog(QWidget *parent, const char *name) connect(selector, SIGNAL(clicked()), SLOT(slotFilename())); connect(ok, SIGNAL(clicked()), SLOT(slotTransfer())); - connect(cancel, SIGNAL(clicked()), SLOT(close())); + connect(cancel, SIGNAL(clicked()), SLOT(slotCancel())); } @@ -87,6 +92,37 @@ void TransferDialog::slotTransfer() } + 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()); +} + +void TransferDialog::slotCancel() +{ + ok->setEnabled(true); + + if(transfer) + { + transfer->cancel(); + delete transfer; + transfer = NULL; + QMessageBox::information(this, + QObject::tr("Cancelled"), + QObject::tr("The file transfer has been cancelled.")); + } + else + { + close(); + } } |