[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/kstars/summer/kstars/kstars/comast
From:       Prakash Mohan <prak902000 () gmail ! com>
Date:       2009-07-28 22:14:16
Message-ID: 1248819256.398292.14102.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1003852 by prakash:

Pop up an error message if the Id field of the Observation is empty, and ask for \
permission to overwrite if an other observation exists with the current id.

CCMAIL: kstars-devel@kde.org


 M  +14 -2     execute.cpp  


--- branches/kstars/summer/kstars/kstars/comast/execute.cpp #1003851:1003852
@@ -184,10 +184,22 @@
 
 
 void Execute::addObservation() {
+    if( ui.Id->text().isEmpty() ) {
+        KMessageBox::sorry( 0, i18n("The Id field cannot be empty"), i18n("Invalid \
Id") ); +        return;
+    }
+    Comast::Observation *o = logObject->findObservationByName( ui.Id->text() );
     KStarsDateTime dt = currentSession->begin();
     dt.setTime( ui.Time->time() );
-    Comast::Observation *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 );
+    if( o ){
+        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;
+    } 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 ); +    }
 }
 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() );


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic