Browse Source

Add progress and error signals to tdenewstuff

This relates to Bug 2127
tags/r14.0.0
Timothy Pearson 4 years ago
parent
commit
a71fa0953d
3 changed files with 14 additions and 2 deletions
  1. 3
    0
      tdenewstuff/downloaddialog.cpp
  2. 8
    1
      tdenewstuff/provider.cpp
  3. 3
    1
      tdenewstuff/provider.h

+ 3
- 0
tdenewstuff/downloaddialog.cpp View File

@@ -659,6 +659,9 @@ void DownloadDialog::slotJobResult( TDEIO::Job *job )
659 659
     }
660 660
   }
661 661
 
662
+  // Reset for next load
663
+  mJobData = TQString::null;
664
+
662 665
   slotInstallPhase2();
663 666
 }
664 667
 

+ 8
- 1
tdenewstuff/provider.cpp View File

@@ -234,7 +234,7 @@ TQDomElement Provider::createDomElement( TQDomDocument &doc, TQDomElement &paren
234 234
 
235 235
 void Provider::slotJobData( TDEIO::Job *, const TQByteArray &data )
236 236
 {
237
-  kdDebug() << "ProviderLoader::slotJobData()" << endl;
237
+  kdDebug() << "Provider::slotJobData()" << endl;
238 238
 
239 239
   if ( data.size() == 0 ) return;
240 240
 
@@ -369,6 +369,8 @@ void ProviderLoader::load( const TQString &type, const TQString &providersList )
369 369
            TQT_SLOT( slotJobResult( TDEIO::Job * ) ) );
370 370
   connect( job, TQT_SIGNAL( data( TDEIO::Job *, const TQByteArray & ) ),
371 371
            TQT_SLOT( slotJobData( TDEIO::Job *, const TQByteArray & ) ) );
372
+  connect( job, TQT_SIGNAL( percent (TDEIO::Job *, unsigned long) ),
373
+           TQT_SIGNAL( percent (TDEIO::Job *, unsigned long) ) );
372 374
 
373 375
 //  job->dumpObjectInfo();
374 376
 }
@@ -388,6 +390,8 @@ void ProviderLoader::slotJobResult( TDEIO::Job *job )
388 390
 {
389 391
   if ( job->error() ) {
390 392
     job->showErrorDialog( TQT_TQWIDGET(parent()) );
393
+    emit error();
394
+    return;
391 395
   }
392 396
 
393 397
   kdDebug() << "--PROVIDERS-START--" << endl << mJobData << "--PROV_END--"
@@ -396,6 +400,7 @@ void ProviderLoader::slotJobResult( TDEIO::Job *job )
396 400
   TQDomDocument doc;
397 401
   if ( !doc.setContent( mJobData ) ) {
398 402
     KMessageBox::error( TQT_TQWIDGET(parent()), i18n("Error parsing providers list.") );
403
+    emit error();
399 404
     return;
400 405
   }
401 406
 
@@ -403,6 +408,8 @@ void ProviderLoader::slotJobResult( TDEIO::Job *job )
403 408
 
404 409
   if ( providers.isNull() ) {
405 410
     kdDebug() << "No document in Providers.xml." << endl;
411
+    emit error();
412
+    return;
406 413
   }
407 414
 
408 415
   TQDomNode n;

+ 3
- 1
tdenewstuff/provider.h View File

@@ -42,7 +42,7 @@ namespace KNS {
42 42
  *
43 43
  * @author Cornelius Schumacher (schumacher@kde.org)
44 44
  * \par Maintainer:
45
- * Josef Spillner (spillner@kde.org)
45
+ * Timothy Pearson (kb9vqf@pearsoncomputing.net)
46 46
  */
47 47
 class KDE_EXPORT Provider : public TQObject
48 48
 {
@@ -215,6 +215,8 @@ class KDE_EXPORT ProviderLoader : public TQObject
215 215
      * Indicates that the list of providers has been successfully loaded.
216 216
      */
217 217
     void providersLoaded( Provider::List * );
218
+    void percent(TDEIO::Job *job, unsigned long percent);
219
+    void error();
218 220
 
219 221
   protected slots:
220 222
     void slotJobData( TDEIO::Job *, const TQByteArray & );

Loading…
Cancel
Save