summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/filetransfer.cpp4
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp2
-rw-r--r--noncore/apps/opie-console/transferdialog.cpp99
-rw-r--r--noncore/apps/opie-console/transferdialog.h14
4 files changed, 79 insertions, 40 deletions
diff --git a/noncore/apps/opie-console/filetransfer.cpp b/noncore/apps/opie-console/filetransfer.cpp
index 8e86ebb..14787f6 100644
--- a/noncore/apps/opie-console/filetransfer.cpp
+++ b/noncore/apps/opie-console/filetransfer.cpp
@@ -15,5 +15,5 @@
FileTransfer::FileTransfer( Type t, IOLayer* lay )
- : FileTransferLayer( lay ), m_type( t ) {
+ : FileTransferLayer( lay ), m_type( t ), m_pid ( 0 ) {
signal(SIGPIPE, SIG_IGN );
@@ -236,5 +236,5 @@ void FileTransfer::slotProgress( const QStringList& list ) {
}
void FileTransfer::cancel() {
- ::kill(m_pid,9 );
+ if(m_pid > 0) ::kill(m_pid,9 );
delete m_not;
}
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp
index 3af0cba..8f5d56b 100644
--- a/noncore/apps/opie-console/mainwindow.cpp
+++ b/noncore/apps/opie-console/mainwindow.cpp
@@ -262,5 +262,5 @@ void MainWindow::slotTransfer()
if ( currentSession() ) {
TransferDialog dlg(this);
- dlg.showMaximized();
+ //dlg.showMaximized();
dlg.exec();
}
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
@@ -6,4 +6,6 @@
#include <qmessagebox.h>
#include <qprogressbar.h>
+#include <qradiobutton.h>
+#include <qbuttongroup.h>
#include <opie/ofiledialog.h>
@@ -16,37 +18,39 @@
#include "transferdialog.h"
-
-
-
-
-
-
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;
+ m_lay = 0l;
+ 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);
status = new QLabel(QObject::tr("Status"), this);
- statusbar = new QLabel(QObject::tr("ready"), this);
+ statusbar = new QLabel(QObject::tr("Ready"), this);
statusbar->setFrameStyle(QFrame::Panel | QFrame::Sunken);
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 ) {
- protocol->insertItem( (*it) );
- }
+ QStringList list = m_win->factory()->fileTransferLayers();
+ for (QStringList::Iterator it = list.begin(); it != list.end(); ++it)
+ protocol->insertItem((*it));
filename = new QLineEdit(this);
@@ -60,4 +64,5 @@ TransferDialog::TransferDialog(MainWindow *parent, const char *name)
vbox = new QVBoxLayout(this, 2);
+ vbox->add(group);
vbox->add(file);
hbox = new QHBoxLayout(vbox, 0);
@@ -81,4 +86,5 @@ TransferDialog::TransferDialog(MainWindow *parent, const char *name)
connect(ok, SIGNAL(clicked()), SLOT(slotTransfer()));
connect(cancel, SIGNAL(clicked()), SLOT(slotCancel()));
+ connect(group, SIGNAL(clicked(int)), SLOT(slotMode(int)));
}
@@ -97,5 +103,5 @@ void TransferDialog::slotFilename()
void TransferDialog::slotTransfer()
{
- if(filename->text().isEmpty())
+ if((m_transfermode == id_send) && (filename->text().isEmpty()))
{
QMessageBox::information(this,
@@ -107,11 +113,17 @@ void TransferDialog::slotTransfer()
ok->setEnabled(false);
- 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->sendFile(filename->text());
+ m_lay = m_win->factory()->newFileTransfer(protocol->currentText(), m_win->currentSession()->layer());
+ if(m_transfermode == id_send)
+ {
+ m_lay->sendFile(filename->text());
+ }
+ else
+ {
+ }
- 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(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()));
@@ -121,9 +133,10 @@ void TransferDialog::slotCancel()
{
ok->setEnabled(true);
+ statusbar->setText(QObject::tr("Ready"));
if(m_lay)
{
m_lay->cancel();
- delete m_lay;
+ delete m_lay;
m_lay = 0l;
QMessageBox::information(this,
@@ -144,4 +157,6 @@ void TransferDialog::slotProgress(const QString& file, int progress, int speed,
void TransferDialog::slotError(int error, const QString& message)
{
+ statusbar->setText(QObject::tr("Ready"));
+
switch(error)
{
@@ -154,20 +169,20 @@ void TransferDialog::slotError(int error, const QString& message)
QMessageBox::critical(this,
QObject::tr("Error"),
- QObject::tr("Operation not supported."));
+ QObject::tr("Transfer could not be started."));
break;
case FileTransferLayer::NoError:
QMessageBox::critical(this,
QObject::tr("Error"),
- QObject::tr("Operation not supported."));
+ QObject::tr("No error."));
break;
case FileTransferLayer::Undefined:
QMessageBox::critical(this,
QObject::tr("Error"),
- QObject::tr("Operation not supported."));
+ QObject::tr("Undefined error occured."));
break;
case FileTransferLayer::Incomplete:
QMessageBox::critical(this,
QObject::tr("Error"),
- QObject::tr("Operation not supported."));
+ QObject::tr("Incomplete transfer."));
break;
case FileTransferLayer::Unknown:
@@ -175,5 +190,5 @@ void TransferDialog::slotError(int error, const QString& message)
QMessageBox::critical(this,
QObject::tr("Error"),
- QObject::tr("Operation not supported."));
+ QObject::tr("Unknown error occured."));
break;
}
@@ -184,4 +199,20 @@ 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::slotMode(int id)
+{
+ if(id == id_send)
+ {
+ selector->setEnabled(true);
+ filename->setEnabled(true);
+ }
+ else
+ {
+ selector->setEnabled(false);
+ filename->setEnabled(false);
+ }
+ m_transfermode = id;
}
diff --git a/noncore/apps/opie-console/transferdialog.h b/noncore/apps/opie-console/transferdialog.h
index b0c1a76..a567161 100644
--- a/noncore/apps/opie-console/transferdialog.h
+++ b/noncore/apps/opie-console/transferdialog.h
@@ -26,13 +26,21 @@ class TransferDialog : public QDialog
void slotError(int error, const QString& message);
void slotSent();
+ void slotMode(int id);
private:
+ enum Modes
+ {
+ id_send,
+ id_receive
+ };
+
QLineEdit *filename;
QComboBox *protocol;
QProgressBar *progressbar;
QLabel *statusbar;
- QPushButton *ok, *cancel;
- MainWindow* m_win;
- FileTransferLayer* m_lay;
+ QPushButton *ok, *cancel, *selector;
+ MainWindow* m_win;
+ FileTransferLayer* m_lay;
+ int m_transfermode;
};