summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/transferdialog.cpp53
-rw-r--r--noncore/apps/opie-console/transferdialog.h3
2 files changed, 55 insertions, 1 deletions
diff --git a/noncore/apps/opie-console/transferdialog.cpp b/noncore/apps/opie-console/transferdialog.cpp
index 45522a8..d639de6 100644
--- a/noncore/apps/opie-console/transferdialog.cpp
+++ b/noncore/apps/opie-console/transferdialog.cpp
@@ -91,23 +91,25 @@ void TransferDialog::slotTransfer()
91 return; 91 return;
92 } 92 }
93 93
94 ok->setEnabled(false); 94 ok->setEnabled(false);
95 95
96 statusbar->setText(QObject::tr("Sending...")); 96 statusbar->setText(QObject::tr("Sending..."));
97 progressbar->setProgress(1);
98 97
99 FileTransfer::Type transfermode = FileTransfer::SX; 98 FileTransfer::Type transfermode = FileTransfer::SX;
100 if(protocol->currentText() == "YModem") transfermode == FileTransfer::SY; 99 if(protocol->currentText() == "YModem") transfermode == FileTransfer::SY;
101 if(protocol->currentText() == "ZModem") transfermode == FileTransfer::SZ; 100 if(protocol->currentText() == "ZModem") transfermode == FileTransfer::SZ;
102 101
103 // dummy profile 102 // dummy profile
104 Profile profile("Dummy", "serial", "vt102", Profile::White, Profile::Black, Profile::VT102); 103 Profile profile("Dummy", "serial", "vt102", Profile::White, Profile::Black, Profile::VT102);
105 104
106 transfer = new FileTransfer(transfermode, new IOSerial(profile)); 105 transfer = new FileTransfer(transfermode, new IOSerial(profile));
107 transfer->sendFile(filename->text()); 106 transfer->sendFile(filename->text());
107 connect(transfer, SIGNAL(progress(const QString&, int, int, int, int, int)), SLOT(slotProgress(const QString&, int, int, int, int, int)));
108 connect(transfer, SIGNAL(error(int, const QString&)), SLOT(slotError(int, const QString&)));
109 connect(transfer, SIGNAL(sent()), SLOT(slotSent()));
108} 110}
109 111
110void TransferDialog::slotCancel() 112void TransferDialog::slotCancel()
111{ 113{
112 ok->setEnabled(true); 114 ok->setEnabled(true);
113 115
@@ -123,6 +125,55 @@ void TransferDialog::slotCancel()
123 else 125 else
124 { 126 {
125 close(); 127 close();
126 } 128 }
127} 129}
128 130
131void TransferDialog::slotProgress(const QString& file, int progress, int speed, int hours, int minutes, int seconds)
132{
133 progressbar->setProgress(progress);
134}
135
136void TransferDialog::slotError(int error, const QString& message)
137{
138 switch(error)
139 {
140 case FileTransferLayer::NotSupported:
141 QMessageBox::critical(this,
142 QObject::tr("Error"),
143 QObject::tr("Operation not supported."));
144 break;
145 case FileTransferLayer::StartError:
146 QMessageBox::critical(this,
147 QObject::tr("Error"),
148 QObject::tr("Operation not supported."));
149 break;
150 case FileTransferLayer::NoError:
151 QMessageBox::critical(this,
152 QObject::tr("Error"),
153 QObject::tr("Operation not supported."));
154 break;
155 case FileTransferLayer::Undefined:
156 QMessageBox::critical(this,
157 QObject::tr("Error"),
158 QObject::tr("Operation not supported."));
159 break;
160 case FileTransferLayer::Incomplete:
161 QMessageBox::critical(this,
162 QObject::tr("Error"),
163 QObject::tr("Operation not supported."));
164 break;
165 case FileTransferLayer::Unknown:
166 default:
167 QMessageBox::critical(this,
168 QObject::tr("Error"),
169 QObject::tr("Operation not supported."));
170 break;
171 }
172}
173
174void TransferDialog::slotSent()
175{
176 QMessageBox::information(this, QObject::tr("Sent"), QObject::tr("File has been sent."));
177 ok->setEnabled(true);
178}
179
diff --git a/noncore/apps/opie-console/transferdialog.h b/noncore/apps/opie-console/transferdialog.h
index 62ae14d..61f425c 100644
--- a/noncore/apps/opie-console/transferdialog.h
+++ b/noncore/apps/opie-console/transferdialog.h
@@ -18,12 +18,15 @@ class TransferDialog : public QDialog
18 ~TransferDialog(); 18 ~TransferDialog();
19 19
20 public slots: 20 public slots:
21 void slotFilename(); 21 void slotFilename();
22 void slotTransfer(); 22 void slotTransfer();
23 void slotCancel(); 23 void slotCancel();
24 void slotProgress(const QString&, int, int, int, int, int);
25 void slotError(int error, const QString& message);
26 void slotSent();
24 27
25 private: 28 private:
26 QLineEdit *filename; 29 QLineEdit *filename;
27 QComboBox *protocol; 30 QComboBox *protocol;
28 QProgressBar *progressbar; 31 QProgressBar *progressbar;
29 QLabel *statusbar; 32 QLabel *statusbar;