[Kstars-devel] branches/kstars/summer/kstars/kstars/tools

Prakash Mohan prak902000 at gmail.com
Tue Jun 16 15:46:07 CEST 2009


SVN commit 982631 by prakash:

Fixing a bug in slotAVT(), it wasn't working in the session view as it was using TableView and not the SessionView in the session tab.

CCMAIL: kstars-devel at kde.org


 M  +21 -13    observinglist.cpp  


--- branches/kstars/summer/kstars/kstars/tools/observinglist.cpp #982630:982631
@@ -746,25 +746,33 @@
 }
 
 void ObservingList::slotAVT() {
-    QModelIndexList selectedItems = m_SortModel->mapSelectionToSource( ui->TableView->selectionModel()->selection() ).indexes();
+    QModelIndexList selectedItems;
     // TODO: Think and see if there's a more effecient way to do this. I can't seem to think of any, but this code looks like it could be improved. - Akarsh
-    if ( selectedItems.size() ) {
-        QPointer<AltVsTime> avt = new AltVsTime( ks );//FIXME KStars class is singleton, so why pass it?
-        foreach ( const QModelIndex &i, selectedItems ) {
-            if( sessionView )
-                foreach ( SkyObject *o, SessionList() ) {//we can't use the obsList directly as it not always a superset of the SessionList
+    if( sessionView ) {
+        selectedItems =  m_SortModel->mapSelectionToSource( ui->SessionView->selectionModel()->selection() ).indexes();
+        if ( selectedItems.size() ) {
+            QPointer<AltVsTime> avt = new AltVsTime( ks );//FIXME KStars class is singleton, so why pass it?
+            foreach ( const QModelIndex &i, selectedItems ) {
+                foreach ( SkyObject *o, SessionList() ) //we can't use the obsList directly as it not always a superset of the SessionList
                     if ( o->translatedName() == i.data().toString() )
                         avt->processObject( o );
-                }
-            else 
-                foreach ( SkyObject *o, obsList() ) {
+            }
+            avt->exec();
+	        delete avt;
+        }
+    } else {
+        selectedItems = m_SortModel->mapSelectionToSource( ui->TableView->selectionModel()->selection() ).indexes();
+        if ( selectedItems.size() ) {
+            QPointer<AltVsTime> avt = new AltVsTime( ks );//FIXME KStars class is singleton, so why pass it?
+            foreach ( const QModelIndex &i, selectedItems ) {
+                foreach ( SkyObject *o, obsList() )
                     if ( o->translatedName() == i.data().toString() )
                         avt->processObject( o );
-                }
+            }
+            avt->exec();
+	        delete avt;
         }
-        avt->exec();
-	    delete avt;
-    }
+    }       
 }
 
 //FIXME: On close, we will need to close any open Details/AVT windows


More information about the Kstars-devel mailing list