[Kst] kdeextragear-2/kst/kst

Andrew Walker arwalker at sumusltd.com
Wed Oct 27 00:50:26 CEST 2004


CVS commit by arwalker: 

Use the status bar progress indicator instead of creating your own.


  M +12 -14    kstdoc.cpp   1.133


--- kdeextragear-2/kst/kst/kstdoc.cpp  #1.132:1.133
@@ -722,6 +722,8 @@ RemoveStatus KstDoc::removeDataObject(co
 
 void KstDoc::purge() {
+  QString purging = i18n("Purging unused objects");
   bool modified = false;
   KstRVectorList rvl = kstObjectSubList<KstVector,KstRVector>(KST::vectorList);
+  KstApp *app = KstApp::inst();
 
   KST::dataObjectList.lock().writeLock();
@@ -729,13 +731,9 @@ void KstDoc::purge() {
   int prg = 0;
 
-  KProgressDialog *dlg = new KProgressDialog((QWidget*)static_cast<KstApp*>(parent()), "Progress Dialog");
-
-  dlg->setAllowCancel(false);
-  dlg->progressBar()->setTotalSteps(cnt);
-  dlg->progressBar()->setProgress(0);
-  dlg->setLabel(i18n("Purging unused objects..."));
-  dlg->show();
+  app->slotUpdateProgress(cnt, prg, purging);
 
+  //
   // ASSUMPTION: this only gets called from the data manager!
+  //
   for (KstDataObjectList::Iterator it = KST::dataObjectList.begin(); it != KST::dataObjectList.end(); ++it) {
     //kdDebug() << "OBJECT: " << (*it)->tagName() << " USAGE: " << (*it)->getUsage() << endl;
@@ -747,6 +745,6 @@ void KstDoc::purge() {
       modified = true;
     }
-    dlg->progressBar()->setProgress(++prg);
-    kapp->processEvents();
+    prg++;
+    app->slotUpdateProgress(cnt, prg, purging);
   }
   KST::dataObjectList.lock().writeUnlock();
@@ -761,13 +759,13 @@ void KstDoc::purge() {
       modified = true;
     }
-    dlg->progressBar()->setProgress(++prg);
-    kapp->processEvents();
+    prg++;
+    app->slotUpdateProgress(cnt, prg, purging);
   }
 
+  app->slotUpdateProgress(0, 0, QString::null);
+
   rvl.clear();
   setModified(modified);
   emit updateDialogs();
-
-  delete dlg;
 }
 





More information about the Kst mailing list