summaryrefslogtreecommitdiff
authorjosef <josef>2002-10-12 18:16:45 (UTC)
committer josef <josef>2002-10-12 18:16:45 (UTC)
commit82b04543125d6d856df180c437c8d9f95f41e888 (patch) (side-by-side diff)
treeb09807b9736d07d02dfa8a9dc79d385771be8c1a
parent9c983d273b055d847cf2d1fa4f5b6e082ce850c9 (diff)
downloadopie-82b04543125d6d856df180c437c8d9f95f41e888.zip
opie-82b04543125d6d856df180c437c8d9f95f41e888.tar.gz
opie-82b04543125d6d856df180c437c8d9f95f41e888.tar.bz2
- embed transferdialog into menu
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp16
-rw-r--r--noncore/apps/opie-console/mainwindow.h2
-rw-r--r--noncore/apps/opie-console/transferdialog.cpp44
-rw-r--r--noncore/apps/opie-console/transferdialog.h9
4 files changed, 65 insertions, 6 deletions
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp
index 0bd6a13..fbeaa74 100644
--- a/noncore/apps/opie-console/mainwindow.cpp
+++ b/noncore/apps/opie-console/mainwindow.cpp
@@ -14,4 +14,5 @@
#include "mainwindow.h"
#include "tabwidget.h"
+#include "transferdialog.h"
MainWindow::MainWindow() {
@@ -64,4 +65,10 @@ void MainWindow::initUI() {
this, SLOT(slotDisconnect() ) );
+ m_transfer = new QAction();
+ m_transfer->setText( tr("Transfer file...") );
+ m_transfer->addTo( m_console );
+ connect(m_transfer, SIGNAL(activated() ),
+ this, SLOT(slotTransfer() ) );
+
/*
* terminate action
@@ -215,3 +222,12 @@ void MainWindow::create( const Profile& prof ) {
tabWidget()->add( ses );
m_curSession = ses;
+
}
+
+void MainWindow::slotTransfer()
+{
+ TransferDialog dlg(this);
+ dlg.showMaximized();
+ dlg.exec();
+}
+
diff --git a/noncore/apps/opie-console/mainwindow.h b/noncore/apps/opie-console/mainwindow.h
index 7ef9c26..c8b0b65 100644
--- a/noncore/apps/opie-console/mainwindow.h
+++ b/noncore/apps/opie-console/mainwindow.h
@@ -56,4 +56,5 @@ private slots:
void slotClose();
void slotProfile(int);
+ void slotTransfer();
private:
@@ -86,4 +87,5 @@ private:
QAction* m_disconnect;
QAction* m_terminate;
+ QAction* m_transfer;
QAction* m_setProfiles;
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();
+ }
}
diff --git a/noncore/apps/opie-console/transferdialog.h b/noncore/apps/opie-console/transferdialog.h
index 4fe17dd..62ae14d 100644
--- a/noncore/apps/opie-console/transferdialog.h
+++ b/noncore/apps/opie-console/transferdialog.h
@@ -2,5 +2,5 @@
#define TRANSFER_DIALOG_H
-#include "qwidget.h"
+#include "qdialog.h"
class QLineEdit;
@@ -8,6 +8,8 @@ class QComboBox;
class QProgressBar;
class QLabel;
+class QPushButton;
+class FileTransfer;
-class TransferDialog : public QWidget
+class TransferDialog : public QDialog
{
Q_OBJECT
@@ -19,4 +21,5 @@ class TransferDialog : public QWidget
void slotFilename();
void slotTransfer();
+ void slotCancel();
private:
@@ -25,4 +28,6 @@ class TransferDialog : public QWidget
QProgressBar *progressbar;
QLabel *statusbar;
+ QPushButton *ok, *cancel;
+ FileTransfer *transfer;
};