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

Prakash Mohan prak902000 at gmail.com
Wed Jul 29 10:40:34 CEST 2009


SVN commit 1004056 by prakash:

Making the addObservation a bool function, returning true if the Observation was added successfully.
And the slotNext will select the next target if the observation was successfully added.

CCMAIL: kstars-devel at kde.org


 M  +8 -5      execute.cpp  
 M  +1 -1      execute.h  


--- branches/kstars/summer/kstars/kstars/comast/execute.cpp #1004055:1004056
@@ -86,8 +86,10 @@
             break;
         }
         case 2: {
-            addObservation();
-            ui.stackedWidget->setCurrentIndex( 1 );
+            if ( addObservation() )
+                ui.stackedWidget->setCurrentIndex( 1 );
+                loadTargets();
+                selectNextTarget();
             break;
         }
     }
@@ -183,10 +185,10 @@
 }
 
 
-void Execute::addObservation() {
+bool Execute::addObservation() {
     if( ui.Id->text().isEmpty() ) {
         KMessageBox::sorry( 0, i18n("The Id field cannot be empty"), i18n("Invalid Id") );
-        return;
+        return false;
     }
     Comast::Observation *o = logObject->findObservationByName( ui.Id->text() );
     KStarsDateTime dt = currentSession->begin();
@@ -195,11 +197,12 @@
         if( Comast::warningOverwrite( i18n("Another observation already exists with the given Id, Overwrite?") ) == KMessageBox::Yes ) {
             o->setObservation( ui.o_Id->text(), ui.Observer->currentText(), geo->fullName(), currentSession->id(), currentTarget->name(), dt, ui.FaintestStar->value(), ui.Seeing->value(), ui.Scope->currentText(), ui.Eyepiece->currentText(), ui.Lens->currentText(), ui.Filter->currentText(), ui.Description->toPlainText(), ui.Language->text() );
         } else
-            return;
+            return false;
     } else {
         o = new Comast::Observation( ui.o_Id->text(), ui.Observer->currentText(), geo->fullName(), currentSession->id(), currentTarget->name(), dt, ui.FaintestStar->value(), ui.Seeing->value(), ui.Scope->currentText(), ui.Eyepiece->currentText(), ui.Lens->currentText(), ui.Filter->currentText(), ui.Description->toPlainText(), ui.Language->text() );
         logObject->observationList()->append( o );
     }
+    return true;
 }
 void Execute::slotEndSession() {
     currentSession->setSession( ui.Id->text(), geo->fullName(), ui.Begin->dateTime(), KStarsDateTime::currentDateTime(), ui.Weather->toPlainText(), ui.Equipment->toPlainText(), ui.Comment->toPlainText(), ui.Language->text() );
--- branches/kstars/summer/kstars/kstars/comast/execute.h #1004055:1004056
@@ -60,7 +60,7 @@
 
         /**@short Function to add the current observation to the observation list
          */
-        void addObservation();
+        bool addObservation();
 
         /**@short Function to handle the state of current observation,
          * and hiding the execute window


More information about the Kstars-devel mailing list