summaryrefslogtreecommitdiff
Unidiff
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 @@
14#include "mainwindow.h" 14#include "mainwindow.h"
15#include "tabwidget.h" 15#include "tabwidget.h"
16#include "transferdialog.h"
16 17
17MainWindow::MainWindow() { 18MainWindow::MainWindow() {
@@ -64,4 +65,10 @@ void MainWindow::initUI() {
64 this, SLOT(slotDisconnect() ) ); 65 this, SLOT(slotDisconnect() ) );
65 66
67 m_transfer = new QAction();
68 m_transfer->setText( tr("Transfer file...") );
69 m_transfer->addTo( m_console );
70 connect(m_transfer, SIGNAL(activated() ),
71 this, SLOT(slotTransfer() ) );
72
66 /* 73 /*
67 * terminate action 74 * terminate action
@@ -215,3 +222,12 @@ void MainWindow::create( const Profile& prof ) {
215 tabWidget()->add( ses ); 222 tabWidget()->add( ses );
216 m_curSession = ses; 223 m_curSession = ses;
224
217} 225}
226
227void MainWindow::slotTransfer()
228{
229 TransferDialog dlg(this);
230 dlg.showMaximized();
231 dlg.exec();
232}
233
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:
56 void slotClose(); 56 void slotClose();
57 void slotProfile(int); 57 void slotProfile(int);
58 void slotTransfer();
58 59
59private: 60private:
@@ -86,4 +87,5 @@ private:
86 QAction* m_disconnect; 87 QAction* m_disconnect;
87 QAction* m_terminate; 88 QAction* m_terminate;
89 QAction* m_transfer;
88 QAction* m_setProfiles; 90 QAction* m_setProfiles;
89 91
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 @@
1#include "transferdialog.h" 1#include "transferdialog.h"
2 2
3#include "filetransfer.h"
4#include "io_serial.h"
5
3#include "qlayout.h" 6#include "qlayout.h"
4#include "qcombobox.h" 7#include "qcombobox.h"
@@ -12,10 +15,12 @@
12 15
13TransferDialog::TransferDialog(QWidget *parent, const char *name) 16TransferDialog::TransferDialog(QWidget *parent, const char *name)
14: QWidget(parent, name) 17: QDialog(/*parent, name*/NULL, NULL, true)
15{ 18{
16 QVBoxLayout *vbox; 19 QVBoxLayout *vbox;
17 QHBoxLayout *hbox, *hbox2; 20 QHBoxLayout *hbox, *hbox2;
18 QLabel *file, *mode, *progress, *status; 21 QLabel *file, *mode, *progress, *status;
19 QPushButton *selector, *ok, *cancel; 22 QPushButton *selector;
23
24 transfer = NULL;
20 25
21 file = new QLabel(QObject::tr("Send file"), this); 26 file = new QLabel(QObject::tr("Send file"), this);
@@ -38,5 +43,5 @@ TransferDialog::TransferDialog(QWidget *parent, const char *name)
38 43
39 selector = new QPushButton("...", this); 44 selector = new QPushButton("...", this);
40 ok = new QPushButton(QObject::tr("OK"), this); 45 ok = new QPushButton(QObject::tr("Start transfer"), this);
41 cancel = new QPushButton(QObject::tr("Cancel"), this); 46 cancel = new QPushButton(QObject::tr("Cancel"), this);
42 47
@@ -62,5 +67,5 @@ TransferDialog::TransferDialog(QWidget *parent, const char *name)
62 connect(selector, SIGNAL(clicked()), SLOT(slotFilename())); 67 connect(selector, SIGNAL(clicked()), SLOT(slotFilename()));
63 connect(ok, SIGNAL(clicked()), SLOT(slotTransfer())); 68 connect(ok, SIGNAL(clicked()), SLOT(slotTransfer()));
64 connect(cancel, SIGNAL(clicked()), SLOT(close())); 69 connect(cancel, SIGNAL(clicked()), SLOT(slotCancel()));
65} 70}
66 71
@@ -87,6 +92,37 @@ void TransferDialog::slotTransfer()
87 } 92 }
88 93
94 ok->setEnabled(false);
95
89 statusbar->setText(QObject::tr("Sending...")); 96 statusbar->setText(QObject::tr("Sending..."));
90 progressbar->setProgress(1); 97 progressbar->setProgress(1);
98
99 FileTransfer::Type transfermode = FileTransfer::SX;
100 if(protocol->currentText() == "YModem") transfermode == FileTransfer::SY;
101 if(protocol->currentText() == "ZModem") transfermode == FileTransfer::SZ;
102
103 // dummy profile
104 Profile profile("Dummy", "serial", "vt102", Profile::White, Profile::Black, Profile::VT102);
105
106 transfer = new FileTransfer(transfermode, new IOSerial(profile));
107 transfer->sendFile(filename->text());
108}
109
110void TransferDialog::slotCancel()
111{
112 ok->setEnabled(true);
113
114 if(transfer)
115 {
116 transfer->cancel();
117 delete transfer;
118 transfer = NULL;
119 QMessageBox::information(this,
120 QObject::tr("Cancelled"),
121 QObject::tr("The file transfer has been cancelled."));
122 }
123 else
124 {
125 close();
126 }
91} 127}
92 128
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 @@
2#define TRANSFER_DIALOG_H 2#define TRANSFER_DIALOG_H
3 3
4#include "qwidget.h" 4#include "qdialog.h"
5 5
6class QLineEdit; 6class QLineEdit;
@@ -8,6 +8,8 @@ class QComboBox;
8class QProgressBar; 8class QProgressBar;
9class QLabel; 9class QLabel;
10class QPushButton;
11class FileTransfer;
10 12
11class TransferDialog : public QWidget 13class TransferDialog : public QDialog
12{ 14{
13 Q_OBJECT 15 Q_OBJECT
@@ -19,4 +21,5 @@ class TransferDialog : public QWidget
19 void slotFilename(); 21 void slotFilename();
20 void slotTransfer(); 22 void slotTransfer();
23 void slotCancel();
21 24
22 private: 25 private:
@@ -25,4 +28,6 @@ class TransferDialog : public QWidget
25 QProgressBar *progressbar; 28 QProgressBar *progressbar;
26 QLabel *statusbar; 29 QLabel *statusbar;
30 QPushButton *ok, *cancel;
31 FileTransfer *transfer;
27}; 32};
28 33