[Kstars-devel] kdeedu/kstars/kstars
Jason Harris
kstars at 30doradus.org
Fri Dec 19 06:22:33 CET 2003
CVS commit by harris:
Fixes to LocationDialog:
+ Adding a new city now records the correct time zone offset in the
mycities.dat file.
+ Pressing the "Clear Fields" button now sets the TZ offset to "0.00"
instead of "-2.00"
(Both of these problems arose because I was assuming that the TZ
listbox had 24 entries (one for each integer-hour TZ). However, this
is no longer true, we have some non-integer timezones as well.)
+ The TZ combobox no longer contains duplicate entries. I had used
setDuplicatesEnabled(false), but this doesn't affect entries added
programmatically, so we have to check for duplicates manually.
CCMAIL: kstars-devel at kde.org
M +8 -6 locationdialog.cpp 1.36
--- kdeedu/kstars/kstars/locationdialog.cpp #1.35:1.36
@@ -218,6 +218,6 @@ void LocationDialog::initCityList( void
GeoID[GeoBox->count() - 1] = p->data()->geoList.at();
- //If TZ is not even integer value, add it to listbox (don't worry about dupes, they are excluded)
- if ( loc->TZ0() - int( loc->TZ0() ) ) { //&& ! TZBox->listBox()->findItem( QString("%1").arg( loc->TZ0(), 0, 'f', 2 ) ) ) {
+ //If TZ is not even integer value, add it to listbox
+ if ( loc->TZ0() - int( loc->TZ0() ) && ! TZBox->listBox()->findItem( QString("%1").arg( loc->TZ0(), 0, 'f', 2 ) ) ) {
for ( unsigned int i=0; i<TZBox->count(); ++i ) {
if ( TZBox->text( i ).toDouble() > loc->TZ0() ) {
@@ -342,7 +342,8 @@ void LocationDialog::addCity( void ) {
}
- bool latOk(false), lngOk(false);
+ bool latOk(false), lngOk(false), tzOk(false);
dms lat = NewLat->createDms( true, &latOk );
dms lng = NewLong->createDms( true, &lngOk );
+ double TZ = TZBox->lineEdit()->text().toDouble( &tzOk );
if ( NewCityName->text().isEmpty() || NewCountryName->text().isEmpty() ) {
@@ -350,5 +351,7 @@ void LocationDialog::addCity( void ) {
KMessageBox::sorry( 0, message, i18n( "Fields are Empty" ) );
return;
- } else if ( ! latOk || ! lngOk ) {
+
+ //FIXME after strings freeze lifts, separate TZ check from lat/long check
+ } else if ( ! latOk || ! lngOk || ! tzOk ) {
QString message = i18n( "Could not parse coordinates." );
KMessageBox::sorry( 0, message, i18n( "Bad Coordinates" ) );
@@ -379,5 +382,4 @@ void LocationDialog::addCity( void ) {
char ltsgn = 'N'; if ( lat.degree()<0 ) ltsgn = 'S';
char lgsgn = 'E'; if ( lng.degree()<0 ) lgsgn = 'W';
- double TZ = double( TZBox->currentItem() - 12 );
QString TZrule = TZRuleBox->currentText();
@@ -473,5 +475,5 @@ void LocationDialog::clearFields( void )
NewLong->clearFields();
NewLat->clearFields();
- TZBox->setCurrentItem( 12 );
+ TZBox->lineEdit()->setText( QString( "%1" ).arg( 0.0, 0, 'f', 2 ) );
TZRuleBox->setCurrentItem( 0 );
nameModified = true;
More information about the Kstars-devel
mailing list