summaryrefslogtreecommitdiff
authorjosef <josef>2002-10-12 19:27:15 (UTC)
committer josef <josef>2002-10-12 19:27:15 (UTC)
commit63fb25f130c9ec82646165c6d35d502d5929bbe8 (patch) (unidiff)
tree1f5c1da7d9e183f76f15272704c605b19ad0d6fa
parent82b04543125d6d856df180c437c8d9f95f41e888 (diff)
downloadopie-63fb25f130c9ec82646165c6d35d502d5929bbe8.zip
opie-63fb25f130c9ec82646165c6d35d502d5929bbe8.tar.gz
opie-63fb25f130c9ec82646165c6d35d502d5929bbe8.tar.bz2
- my bad: FileTransfer inherits from the layer -> there are the signals :)
- setup sig handlers for sent(), progress(), error()
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
@@ -94,7 +94,6 @@ void TransferDialog::slotTransfer()
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;
@@ -105,6 +104,9 @@ void TransferDialog::slotTransfer()
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()
@@ -126,3 +128,52 @@ void TransferDialog::slotCancel()
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
@@ -21,6 +21,9 @@ class TransferDialog : public QDialog
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;