summaryrefslogtreecommitdiff
path: root/noncore
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 /noncore
parent9c983d273b055d847cf2d1fa4f5b6e082ce850c9 (diff)
downloadopie-82b04543125d6d856df180c437c8d9f95f41e888.zip
opie-82b04543125d6d856df180c437c8d9f95f41e888.tar.gz
opie-82b04543125d6d856df180c437c8d9f95f41e888.tar.bz2
- embed transferdialog into menu
Diffstat (limited to 'noncore') (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
@@ -13,6 +13,7 @@
#include "profilemanager.h"
#include "mainwindow.h"
#include "tabwidget.h"
+#include "transferdialog.h"
MainWindow::MainWindow() {
m_factory = new MetaFactory();
@@ -63,6 +64,12 @@ void MainWindow::initUI() {
connect(m_disconnect, SIGNAL(activated() ),
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
*/
@@ -214,4 +221,13 @@ void MainWindow::create( const Profile& prof ) {
m_sessions.append( ses );
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
@@ -55,6 +55,7 @@ private slots:
void slotConfigure();
void slotClose();
void slotProfile(int);
+ void slotTransfer();
private:
void initUI();
@@ -85,6 +86,7 @@ private:
QAction* m_connect;
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,5 +1,8 @@
#include "transferdialog.h"
+#include "filetransfer.h"
+#include "io_serial.h"
+
#include "qlayout.h"
#include "qcombobox.h"
#include "qlabel.h"
@@ -11,12 +14,14 @@
#include "opie/ofiledialog.h"
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);
mode = new QLabel(QObject::tr("Transfer mode"), this);
@@ -37,7 +42,7 @@ TransferDialog::TransferDialog(QWidget *parent, const char *name)
progressbar->setProgress(0);
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);
vbox = new QVBoxLayout(this, 2);
@@ -61,7 +66,7 @@ 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()));
}
TransferDialog::~TransferDialog()
@@ -86,7 +91,38 @@ void TransferDialog::slotTransfer()
return;
}
+ 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
@@ -1,14 +1,16 @@
#ifndef TRANSFER_DIALOG_H
#define TRANSFER_DIALOG_H
-#include "qwidget.h"
+#include "qdialog.h"
class QLineEdit;
class QComboBox;
class QProgressBar;
class QLabel;
+class QPushButton;
+class FileTransfer;
-class TransferDialog : public QWidget
+class TransferDialog : public QDialog
{
Q_OBJECT
public:
@@ -18,12 +20,15 @@ class TransferDialog : public QWidget
public slots:
void slotFilename();
void slotTransfer();
+ void slotCancel();
private:
QLineEdit *filename;
QComboBox *protocol;
QProgressBar *progressbar;
QLabel *statusbar;
+ QPushButton *ok, *cancel;
+ FileTransfer *transfer;
};
#endif