|
|
|
@ -54,6 +54,9 @@ COperationDialog::COperationDialog(QWidget *parent):QDialog(parent), m_aborting(
|
|
|
|
|
// downloader
|
|
|
|
|
m_downloader = new CDownloader(this, this);
|
|
|
|
|
|
|
|
|
|
connect(m_downloader, SIGNAL(downloadPrepared()), SLOT(onDownloadPrepared()));
|
|
|
|
|
connect(m_downloader, SIGNAL(downloadDone()), SLOT(onDownloadDone()));
|
|
|
|
|
|
|
|
|
|
connect(operationButtonBox, SIGNAL(clicked(QAbstractButton*)), SLOT(onAbortClicked()));
|
|
|
|
|
|
|
|
|
|
// operations
|
|
|
|
@ -343,6 +346,19 @@ void COperationDialog::onAbortClicked()
|
|
|
|
|
m_aborting = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void COperationDialog::onDownloadPrepared()
|
|
|
|
|
{
|
|
|
|
|
// actually download the file
|
|
|
|
|
m_downloader->getFile();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void COperationDialog::onDownloadDone()
|
|
|
|
|
{
|
|
|
|
|
renamePartFile();
|
|
|
|
|
|
|
|
|
|
emit done();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void COperationDialog::onProgressPrepare()
|
|
|
|
|
{
|
|
|
|
|
operationProgressBar->setFormat(tr("%p% (%v/%m KiB)"));
|
|
|
|
@ -948,3 +964,16 @@ bool COperationDialog::operationShouldStop()
|
|
|
|
|
|
|
|
|
|
return m_aborting;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void COperationDialog::renamePartFile()
|
|
|
|
|
{
|
|
|
|
|
QString partFile = m_downloader->getFileFullPath();
|
|
|
|
|
|
|
|
|
|
QString finalFile = partFile;
|
|
|
|
|
finalFile.remove(".part");
|
|
|
|
|
|
|
|
|
|
if (partFile != finalFile)
|
|
|
|
|
{
|
|
|
|
|
QFile::rename(partFile, finalFile);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|