summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/transferdialog.cpp
Unidiff
Diffstat (limited to 'noncore/apps/opie-console/transferdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/transferdialog.cpp53
1 files changed, 52 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
@@ -85,44 +85,95 @@ void TransferDialog::slotTransfer()
85{ 85{
86 if(filename->text().isEmpty()) 86 if(filename->text().isEmpty())
87 { 87 {
88 QMessageBox::information(this, 88 QMessageBox::information(this,
89 QObject::tr("Attention"), 89 QObject::tr("Attention"),
90 QObject::tr("No file has been specified.")); 90 QObject::tr("No file has been specified."));
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
114 if(transfer) 116 if(transfer)
115 { 117 {
116 transfer->cancel(); 118 transfer->cancel();
117 delete transfer; 119 delete transfer;
118 transfer = NULL; 120 transfer = NULL;
119 QMessageBox::information(this, 121 QMessageBox::information(this,
120 QObject::tr("Cancelled"), 122 QObject::tr("Cancelled"),
121 QObject::tr("The file transfer has been cancelled.")); 123 QObject::tr("The file transfer has been cancelled."));
122 } 124 }
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