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

Akarsh Simha akarshsimha at gmail.com
Tue Jul 7 14:49:03 CEST 2009


SVN commit 992622 by asimha:

+ Minor code refactoring. Looks much more readable and cleaner.

+ Changed some error messages to keep with the naming convention used
  in the observing list

+ Adding a TODO to implement

CCMAIL: kstars-devel at kde.org



 M  +9 -14     observinglist.cpp  


--- branches/kstars/summer/kstars/kstars/tools/observinglist.cpp #992621:992622
@@ -216,23 +216,18 @@
     if ( ! obj ) obj = ks->map()->clickedObject();
 
     //First, make sure object is not already in the list
-    foreach ( SkyObject *o, obsList() ) {
-        if ( obj == o ) {
-            addToWishList = false;
-            if( ! session ) {
-                ks->statusBar()->changeItem( i18n( "%1 is already in the observing list.", obj->name() ), 0 );
-                return;
-            }
+    if ( obsList().contains( obj ) ) {
+        addToWishList = false;
+        if( ! session ) {
+            ks->statusBar()->changeItem( i18n( "%1 is already in your wishlist.", obj->name() ), 0 );
+            return;
         }
     }
 
-    if( session ) 
-        foreach ( SkyObject *o, SessionList() ) {
-            if ( obj == o ) {
-                ks->statusBar()->changeItem( i18n( "%1 is already in the session list.", obj->name() ), 0 );
-                return;
-            }
-        }
+    if ( session && SessionList().contains( obj ) ) { // TODO: Change method name from SessionList() to sessionList() to keep up with C++ conventions
+        ks->statusBar()->changeItem( i18n( "%1 is already in the session plan.", obj->name() ), 0 );
+        return;
+    }
     
     QString smag = "--";
     if (  - 30.0 < obj->mag() && obj->mag() < 90.0 ) smag = QString::number( obj->mag(), 'g', 2 ); // The lower limit to avoid display of unrealistic comet magnitudes


More information about the Kstars-devel mailing list