From a71fa0953d227ac2b418a4acd1602db4ecf55825 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Wed, 8 Oct 2014 15:37:56 -0500 Subject: Add progress and error signals to tdenewstuff This relates to Bug 2127 --- tdenewstuff/downloaddialog.cpp | 3 +++ tdenewstuff/provider.cpp | 9 ++++++++- tdenewstuff/provider.h | 4 +++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/tdenewstuff/downloaddialog.cpp b/tdenewstuff/downloaddialog.cpp index 0eaa0e685..81450fd68 100644 --- a/tdenewstuff/downloaddialog.cpp +++ b/tdenewstuff/downloaddialog.cpp @@ -659,6 +659,9 @@ void DownloadDialog::slotJobResult( TDEIO::Job *job ) } } + // Reset for next load + mJobData = TQString::null; + slotInstallPhase2(); } diff --git a/tdenewstuff/provider.cpp b/tdenewstuff/provider.cpp index ee76d887b..022570b01 100644 --- a/tdenewstuff/provider.cpp +++ b/tdenewstuff/provider.cpp @@ -234,7 +234,7 @@ TQDomElement Provider::createDomElement( TQDomDocument &doc, TQDomElement &paren void Provider::slotJobData( TDEIO::Job *, const TQByteArray &data ) { - kdDebug() << "ProviderLoader::slotJobData()" << endl; + kdDebug() << "Provider::slotJobData()" << endl; if ( data.size() == 0 ) return; @@ -369,6 +369,8 @@ void ProviderLoader::load( const TQString &type, const TQString &providersList ) TQT_SLOT( slotJobResult( TDEIO::Job * ) ) ); connect( job, TQT_SIGNAL( data( TDEIO::Job *, const TQByteArray & ) ), TQT_SLOT( slotJobData( TDEIO::Job *, const TQByteArray & ) ) ); + connect( job, TQT_SIGNAL( percent (TDEIO::Job *, unsigned long) ), + TQT_SIGNAL( percent (TDEIO::Job *, unsigned long) ) ); // job->dumpObjectInfo(); } @@ -388,6 +390,8 @@ void ProviderLoader::slotJobResult( TDEIO::Job *job ) { if ( job->error() ) { job->showErrorDialog( TQT_TQWIDGET(parent()) ); + emit error(); + return; } kdDebug() << "--PROVIDERS-START--" << endl << mJobData << "--PROV_END--" @@ -396,6 +400,7 @@ void ProviderLoader::slotJobResult( TDEIO::Job *job ) TQDomDocument doc; if ( !doc.setContent( mJobData ) ) { KMessageBox::error( TQT_TQWIDGET(parent()), i18n("Error parsing providers list.") ); + emit error(); return; } @@ -403,6 +408,8 @@ void ProviderLoader::slotJobResult( TDEIO::Job *job ) if ( providers.isNull() ) { kdDebug() << "No document in Providers.xml." << endl; + emit error(); + return; } TQDomNode n; diff --git a/tdenewstuff/provider.h b/tdenewstuff/provider.h index 130864158..0a65d64fc 100644 --- a/tdenewstuff/provider.h +++ b/tdenewstuff/provider.h @@ -42,7 +42,7 @@ namespace KNS { * * @author Cornelius Schumacher (schumacher@kde.org) * \par Maintainer: - * Josef Spillner (spillner@kde.org) + * Timothy Pearson (kb9vqf@pearsoncomputing.net) */ class KDE_EXPORT Provider : public TQObject { @@ -215,6 +215,8 @@ class KDE_EXPORT ProviderLoader : public TQObject * Indicates that the list of providers has been successfully loaded. */ void providersLoaded( Provider::List * ); + void percent(TDEIO::Job *job, unsigned long percent); + void error(); protected slots: void slotJobData( TDEIO::Job *, const TQByteArray & ); -- cgit v1.2.1