summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/transferdialog.cpp
authorzecke <zecke>2002-10-12 21:18:46 (UTC)
committer zecke <zecke>2002-10-12 21:18:46 (UTC)
commit9b33ff5f74c30a5a4905093715a6f345edee26ab (patch) (unidiff)
treeeb0155744adb8c0901e27e001c7e09fc8c789369 /noncore/apps/opie-console/transferdialog.cpp
parent3eb9678dfab4d152858b7f72c7f0c057fe393541 (diff)
downloadopie-9b33ff5f74c30a5a4905093715a6f345edee26ab.zip
opie-9b33ff5f74c30a5a4905093715a6f345edee26ab.tar.gz
opie-9b33ff5f74c30a5a4905093715a6f345edee26ab.tar.bz2
Calmed down... 2nd try after merge
Use MetaFactory cuase it's so nice and avoids thousands of if() else if stuff Fix a bug in filetransfer where cancel after exit leaded to a crash cause of bogus adresses in the QSocketNotifiers..
Diffstat (limited to 'noncore/apps/opie-console/transferdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/transferdialog.cpp70
1 files changed, 39 insertions, 31 deletions
diff --git a/noncore/apps/opie-console/transferdialog.cpp b/noncore/apps/opie-console/transferdialog.cpp
index d639de6..ba06199 100644
--- a/noncore/apps/opie-console/transferdialog.cpp
+++ b/noncore/apps/opie-console/transferdialog.cpp
@@ -1,2 +1,10 @@
1#include "transferdialog.h" 1#include <qlayout.h>
2#include <qcombobox.h>
3#include <qlabel.h>
4#include <qlineedit.h>
5#include <qpushbutton.h>
6#include <qmessagebox.h>
7#include <qprogressbar.h>
8
9#include <opie/ofiledialog.h>
2 10
@@ -4,16 +12,17 @@
4#include "io_serial.h" 12#include "io_serial.h"
13#include "metafactory.h"
14#include "mainwindow.h"
15
16#include "transferdialog.h"
17
5 18
6#include "qlayout.h"
7#include "qcombobox.h"
8#include "qlabel.h"
9#include "qlineedit.h"
10#include "qpushbutton.h"
11#include "qmessagebox.h"
12#include "qprogressbar.h"
13 19
14#include "opie/ofiledialog.h"
15 20
16TransferDialog::TransferDialog(QWidget *parent, const char *name) 21
17: QDialog(/*parent, name*/NULL, NULL, true) 22
23
24TransferDialog::TransferDialog(MainWindow *parent, const char *name)
25: QDialog(/*parent, name*/0l, 0l, true), m_win(parent)
18{ 26{
27 m_lay = 0l;
19 QVBoxLayout *vbox; 28 QVBoxLayout *vbox;
@@ -23,3 +32,2 @@ TransferDialog::TransferDialog(QWidget *parent, const char *name)
23 32
24 transfer = NULL;
25 33
@@ -34,5 +42,10 @@ TransferDialog::TransferDialog(QWidget *parent, const char *name)
34 protocol = new QComboBox(this); 42 protocol = new QComboBox(this);
35 protocol->insertItem("XModem"); 43 /* use the fscking MetaFactory
36 protocol->insertItem("YModem"); 44 * because we invented it for that fscking reason
37 protocol->insertItem("ZModem"); 45 * I'm really getting UPSET!!!!
46 */
47 QStringList list = m_win->factory()->fileTransferLayers();
48 for (QStringList::Iterator it =list.begin(); it != list.end(); ++it ) {
49 protocol->insertItem( (*it) );
50 }
38 51
@@ -78,3 +91,3 @@ void TransferDialog::slotFilename()
78 QString f; 91 QString f;
79 92
80 f = OFileDialog::getOpenFileName(0); 93 f = OFileDialog::getOpenFileName(0);
@@ -97,14 +110,9 @@ void TransferDialog::slotTransfer()
97 110
98 FileTransfer::Type transfermode = FileTransfer::SX; 111 m_lay = m_win->factory()->newFileTransfer( protocol->currentText(),
99 if(protocol->currentText() == "YModem") transfermode == FileTransfer::SY; 112 m_win->currentSession()->layer() );
100 if(protocol->currentText() == "ZModem") transfermode == FileTransfer::SZ; 113 m_lay->sendFile(filename->text());
101
102 // dummy profile
103 Profile profile("Dummy", "serial", "vt102", Profile::White, Profile::Black, Profile::VT102);
104 114
105 transfer = new FileTransfer(transfermode, new IOSerial(profile)); 115 connect(m_lay, SIGNAL(progress(const QString&, int, int, int, int, int)), SLOT(slotProgress(const QString&, int, int, int, int, int)));
106 transfer->sendFile(filename->text()); 116 connect(m_lay, SIGNAL(error(int, const QString&)), SLOT(slotError(int, const QString&)));
107 connect(transfer, SIGNAL(progress(const QString&, int, int, int, int, int)), SLOT(slotProgress(const QString&, int, int, int, int, int))); 117 connect(m_lay, SIGNAL(sent()), SLOT(slotSent()));
108 connect(transfer, SIGNAL(error(int, const QString&)), SLOT(slotError(int, const QString&)));
109 connect(transfer, SIGNAL(sent()), SLOT(slotSent()));
110} 118}
@@ -115,7 +123,7 @@ void TransferDialog::slotCancel()
115 123
116 if(transfer) 124 if(m_lay)
117 { 125 {
118 transfer->cancel(); 126 m_lay->cancel();
119 delete transfer; 127 delete m_lay;
120 transfer = NULL; 128 m_lay = 0l;
121 QMessageBox::information(this, 129 QMessageBox::information(this,