[Kstars-devel] branches/kstars/summer/kstars/kstars/comast
Prakash Mohan
prak902000 at gmail.com
Wed Jul 29 00:14:16 CEST 2009
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 at 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() );
More information about the Kstars-devel
mailing list