ich habe ein kleines ftp programm geschrieben. Läuft alles auch einigermaßen gut. Wenn ich allerdings etwas downloade und dann den download abbreche hängt das Programm und ich kann nicht mal die Verbindung trennen. Hier die code stellen auf die sich mein problem bezieht:
Code: Alles auswählen
void MainWindow::ftp_download()
{
filename = QFileDialog::getSaveFileName(this,"Download","~/"+ui->listWidget->currentItem()->text());
file = new QFile(filename);
if (file->open(QIODevice::WriteOnly))
{
progress = new QProgressDialog("Download","Cancel",0,100,this);
connect(ftp,SIGNAL(dataTransferProgress(qint64,qint64)),
this,SLOT(ftp_setprogress(qint64,qint64)));
connect(progress,SIGNAL(canceled()),
ftp,SLOT(abort()));
ftp->get(currentdir+ui->listWidget->currentItem()->text(),file);
progress->exec();
}
else
{
QMessageBox(QMessageBox::Warning,"Error",file->errorString());
}
}Code: Alles auswählen
void MainWindow::ftp_setprogress(qint64 read, qint64 total)
{
progress->setRange(0,total);
progress->setValue(read);
}