Diffstat (limited to 'noncore/apps/opie-console/transferdialog.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/transferdialog.cpp | 87 |
1 files changed, 59 insertions, 28 deletions
diff --git a/noncore/apps/opie-console/transferdialog.cpp b/noncore/apps/opie-console/transferdialog.cpp index ba06199..d3b9c0a 100644 --- a/noncore/apps/opie-console/transferdialog.cpp +++ b/noncore/apps/opie-console/transferdialog.cpp @@ -7,2 +7,4 @@ #include <qprogressbar.h> +#include <qradiobutton.h> +#include <qbuttongroup.h> @@ -17,20 +19,27 @@ - - - - - - TransferDialog::TransferDialog(MainWindow *parent, const char *name) -: QDialog(/*parent, name*/0l, 0l, true), m_win(parent) +: QDialog(0l, 0l, true), m_win(parent) { m_lay = 0l; - QVBoxLayout *vbox; - QHBoxLayout *hbox, *hbox2; + QVBoxLayout *vbox, *vbox2; + QHBoxLayout *hbox, *hbox2, *hbox3; QLabel *file, *mode, *progress, *status; - QPushButton *selector; - + QButtonGroup *group; + QRadioButton *mode_send, *mode_receive; + + group = new QButtonGroup(QObject::tr("Transfer mode"), this); + mode_send = new QRadioButton(QObject::tr("Send"), group); + mode_receive = new QRadioButton(QObject::tr("Receive"), group); + group->insert(mode_send, id_send); + group->insert(mode_receive, id_receive); + vbox2 = new QVBoxLayout(group, 2); + vbox2->addSpacing(10); + hbox3 = new QHBoxLayout(vbox2, 2); + hbox3->add(mode_send); + hbox3->add(mode_receive); + mode_send->setChecked(true); + m_transfermode = id_send; file = new QLabel(QObject::tr("Send file"), this); - mode = new QLabel(QObject::tr("Transfer mode"), this); + mode = new QLabel(QObject::tr("Transfer protocol"), this); progress = new QLabel(QObject::tr("Progress"), this); @@ -38,3 +47,3 @@ TransferDialog::TransferDialog(MainWindow *parent, const char *name) - statusbar = new QLabel(QObject::tr("ready"), this); + statusbar = new QLabel(QObject::tr("Ready"), this); statusbar->setFrameStyle(QFrame::Panel | QFrame::Sunken); @@ -42,10 +51,5 @@ TransferDialog::TransferDialog(MainWindow *parent, const char *name) protocol = new QComboBox(this); - /* use the fscking MetaFactory - * because we invented it for that fscking reason - * I'm really getting UPSET!!!! - */ QStringList list = m_win->factory()->fileTransferLayers(); - for (QStringList::Iterator it =list.begin(); it != list.end(); ++it ) { + for (QStringList::Iterator it = list.begin(); it != list.end(); ++it) protocol->insertItem( (*it) ); - } @@ -61,2 +65,3 @@ TransferDialog::TransferDialog(MainWindow *parent, const char *name) vbox = new QVBoxLayout(this, 2); + vbox->add(group); vbox->add(file); @@ -82,2 +87,3 @@ TransferDialog::TransferDialog(MainWindow *parent, const char *name) connect(cancel, SIGNAL(clicked()), SLOT(slotCancel())); + connect(group, SIGNAL(clicked(int)), SLOT(slotMode(int))); } @@ -98,3 +104,3 @@ void TransferDialog::slotTransfer() { - if(filename->text().isEmpty()) + if((m_transfermode == id_send) && (filename->text().isEmpty())) { @@ -108,7 +114,13 @@ void TransferDialog::slotTransfer() - statusbar->setText(QObject::tr("Sending...")); + 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() ); + m_lay = m_win->factory()->newFileTransfer(protocol->currentText(), m_win->currentSession()->layer()); + if(m_transfermode == id_send) + { m_lay->sendFile(filename->text()); + } + else + { + } @@ -122,2 +134,3 @@ void TransferDialog::slotCancel() ok->setEnabled(true); + statusbar->setText(QObject::tr("Ready")); @@ -145,2 +158,4 @@ void TransferDialog::slotError(int error, const QString& message) { + statusbar->setText(QObject::tr("Ready")); + switch(error) @@ -155,3 +170,3 @@ void TransferDialog::slotError(int error, const QString& message) QObject::tr("Error"), - QObject::tr("Operation not supported.")); + QObject::tr("Transfer could not be started.")); break; @@ -160,3 +175,3 @@ void TransferDialog::slotError(int error, const QString& message) QObject::tr("Error"), - QObject::tr("Operation not supported.")); + QObject::tr("No error.")); break; @@ -165,3 +180,3 @@ void TransferDialog::slotError(int error, const QString& message) QObject::tr("Error"), - QObject::tr("Operation not supported.")); + QObject::tr("Undefined error occured.")); break; @@ -170,3 +185,3 @@ void TransferDialog::slotError(int error, const QString& message) QObject::tr("Error"), - QObject::tr("Operation not supported.")); + QObject::tr("Incomplete transfer.")); break; @@ -176,3 +191,3 @@ void TransferDialog::slotError(int error, const QString& message) QObject::tr("Error"), - QObject::tr("Operation not supported.")); + QObject::tr("Unknown error occured.")); break; @@ -185,2 +200,18 @@ void TransferDialog::slotSent() ok->setEnabled(true); + statusbar->setText(QObject::tr("Ready")); +} + +void TransferDialog::slotMode(int id) +{ + if(id == id_send) + { + selector->setEnabled(true); + filename->setEnabled(true); + } + else + { + selector->setEnabled(false); + filename->setEnabled(false); + } + m_transfermode = id; } |