[Kstars-devel] KDE/kdeedu/kstars/kstars

Frederik Gladhorn gladhorn at kde.org
Fri Mar 5 13:41:57 CET 2010


SVN commit 1099295 by gladhorn:

port to KNewStuff3
patch by ComaWhite (forum.kde.org klassroom)

CCMAIL: kstars-devel at kde.org



 M  +1 -1      CMakeLists.txt  
 M  +1 -1      kstars.knsrc  
 M  +13 -12    kstarsactions.cpp  
 M  +2 -2      kstarsinit.cpp  
 M  +3 -4      kswizard.cpp  


--- trunk/KDE/kdeedu/kstars/kstars/CMakeLists.txt #1099294:1099295
@@ -341,7 +341,7 @@
 target_link_libraries(kstars
     ${KDE4_KDECORE_LIBS}
     kdeeduui
-	${KDE4_KNEWSTUFF2_LIBS}
+	${KDE4_KNEWSTUFF3_LIBS}
 	${KDE4_KDE3SUPPORT_LIBS}
 	SatLib
 	htmesh
--- trunk/KDE/kdeedu/kstars/kstars/kstars.knsrc #1099294:1099295
@@ -1,4 +1,4 @@
-[KNewStuff2]
+[KNewStuff3]
 ProvidersUrl=http://edu.kde.org/kstars/downloads/providers.xml
 TargetDir=kstars
 Uncompress=true
--- trunk/KDE/kdeedu/kstars/kstars/kstarsactions.cpp #1099294:1099295
@@ -41,7 +41,7 @@
 #include <kprocess.h>
 #include <ktoolbar.h>
 #include <kicon.h>
-#include <knewstuff2/engine.h>
+#include <knewstuff3/downloaddialog.h>
 
 #include "options/opscatalog.h"
 #include "options/opsguides.h"
@@ -220,21 +220,22 @@
 }
 
 void KStars::slotDownload() {
-    KNS::Entry::List entries = KNS::Engine::download();
+    KNS3::DownloadDialog dlg(this);
+    dlg.exec();
 
-    foreach ( KNS::Entry *e, entries ) {
-        foreach ( const QString& fname, e->installedFiles() ) {
-            if ( fname.endsWith( QLatin1String( ".cat" ) ) ) {
-                //To start displaying the custom catalog, add it to SkyMapComposite
-                Options::setCatalogFile( Options::catalogFile() << fname );
-                Options::setShowCatalog( Options::showCatalog() << 1 );
-                data()->skyComposite()->addCustomCatalog( fname, Options::catalogFile().size()-1 );
+    // Get the list of all the installed entries.
+    KNS3::Entry::List entries = dlg.installedEntries();
+
+    foreach (const KNS3::Entry &entry, entries) {
+        foreach (const QString &name, entry.installedFiles()) {
+            if ( name.endsWith( QLatin1String( ".cat" ) ) ) {
+                // To start displaying the custom catalog, add it to SkyMapComposite
+                Options::setCatalogFile(Options::catalogFile() << name);
+                Options::setShowCatalog(Options::showCatalog() << 1);
+                data()->skyComposite()->addCustomCatalog(name, Options::catalogFile().size() - 1);
             }
         }
     }
-
-    // we need to delete the entry* items in the returned list
-    qDeleteAll(entries);
 }
 
 void KStars::slotLCGenerator() {
--- trunk/KDE/kdeedu/kstars/kstars/kstarsinit.cpp #1099294:1099295
@@ -31,7 +31,7 @@
 #include <ktoggleaction.h>
 #include <ktoolbar.h>
 #include <kicon.h>
-#include <knewstuff2/ui/knewstuffaction.h>
+#include <knewstuff3/knewstuffaction.h>
 
 #include "Options.h"
 #include "fov.h"
@@ -129,7 +129,7 @@
     KAction *ka;
 
     // ==== File menu ================
-    ka = KNS::standardAction(i18n("Download New Data..."), this, SLOT(slotDownload()), actionCollection(), "get_data")
+    ka = KNS3::standardAction(i18n("Download New Data..."), this, SLOT(slotDownload()), actionCollection(), "get_data")
         << KShortcut( Qt::CTRL+Qt::Key_D );
     ka->setWhatsThis(i18n("Downloads new data"));
     ka->setToolTip(ka->whatsThis());
--- trunk/KDE/kdeedu/kstars/kstars/kswizard.cpp #1099294:1099295
@@ -23,7 +23,7 @@
 
 #include <klineedit.h>
 #include <kpushbutton.h>
-#include <knewstuff2/engine.h>
+#include <knewstuff3/downloaddialog.h>
 #include <kstandarddirs.h>
 
 #include "kstarsdata.h"
@@ -171,9 +171,8 @@
 }
 
 void KSWizard::slotDownload() {
-    KNS::Engine engine( this );
-    engine.init( "kstars.knsrc" );
-    KNS::Entry::List entries = engine.downloadDialogModal( this );
+    KNS3::DownloadDialog dlg;
+    dlg.exec();
 }
 
 #include "kswizard.moc"


More information about the Kstars-devel mailing list