You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
79 lines
2.1 KiB
79 lines
2.1 KiB
/*
|
|
* Copyright (C) 2006
|
|
* Siraj Razick <siraj@kdemail.net>
|
|
* PhobosK <phobosk@mail.kbfx.net>
|
|
* see Also AUTHORS
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU Library General Public License version 2 as
|
|
* published by the Free Software Foundation
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details
|
|
*
|
|
* You should have received a copy of the GNU Library General Public
|
|
* License along with this program; if not, write to the
|
|
* Free Software Foundation, Inc.,
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
*/
|
|
|
|
#include "kbfxkiodownload.h"
|
|
|
|
KbfxKioDownload::KbfxKioDownload ( TQObject *parent, const char *name )
|
|
: TQObject ( parent, name )
|
|
{
|
|
m_KbfxBrowserError = 0;
|
|
m_KbfxBrowserErrorText = "No error";
|
|
m_KbfxBrowserTmpFile = tmpF.name();
|
|
|
|
kdDebug() << "Created temp file for download transfer: "
|
|
<< m_KbfxBrowserTmpFile
|
|
<< endl;
|
|
}
|
|
|
|
KbfxKioDownload::~KbfxKioDownload()
|
|
{}
|
|
|
|
void KbfxKioDownload::KbfxKioDownloadStart ( TQString &url )
|
|
{
|
|
TDEIO::Job *download_job = TDEIO::file_copy ( KURL ( url ),
|
|
KURL ( m_KbfxBrowserTmpFile ),
|
|
-1,
|
|
TRUE );
|
|
connect ( download_job, TQ_SIGNAL ( result ( TDEIO::Job* ) ),
|
|
this, TQ_SLOT ( KbfxBrowserResult ( TDEIO::Job * ) ) );
|
|
}
|
|
|
|
void KbfxKioDownload::KbfxBrowserResult ( TDEIO::Job *download_job )
|
|
{
|
|
m_KbfxBrowserError = download_job->error();
|
|
|
|
if ( m_KbfxBrowserError )
|
|
{
|
|
KbfxKioDownloadEnd();
|
|
m_KbfxBrowserErrorText = download_job->errorString();
|
|
}
|
|
else m_KbfxBrowserErrorText = "No error";
|
|
|
|
kdDebug() << "Download transfer error: "
|
|
<< m_KbfxBrowserError
|
|
<< " - "
|
|
<< m_KbfxBrowserErrorText
|
|
<< endl;
|
|
|
|
emit KbfxKioDownloadReady();
|
|
}
|
|
|
|
void KbfxKioDownload::KbfxKioDownloadEnd()
|
|
{
|
|
kdDebug() << "Deleting temp file for download transfer: "
|
|
<< tmpF.name()
|
|
<<endl;
|
|
|
|
tmpF.unlink();
|
|
deleteLater();
|
|
}
|
|
#include "kbfxkiodownload.moc"
|