Commit 571110b5 authored by Jason Harris's avatar Jason Harris
Browse files

Fixed bug #51708. This was an exit condition on Gentoo systems if the program was started at

a position that is below the horizon. When this occurs, the program launches a KMessageBox
that asks if the user would like to adjust the starting position. On Gentoo systems, the program
exited (without error!) an instant after the user made a selection (Yes or No, did not matter!).
Tests showed that when the message box was removed, the exit did not occur. Also, if the
messagebox is shown after the main window has been displayed, the exit does not occur.
So, as a workaround, we delayed showing the messagebox until after the main window has been
show()-ed. We still don't understand this exit condition, but at least it no longer occurs.

svn path=/branches/KDE_3_1_BRANCH/kdeedu/kstars/; revision=204328
parent ba2df2d8
......@@ -91,7 +91,6 @@ KStars::KStars( KStarsData* kd )
kdDebug() << "in kstars destructor..." << endl;
......@@ -366,10 +366,33 @@ void KStars::datainitFinished(bool worked) {
//Check whether initial position is below the horizon.
//We sued to just call slotCenter() in buildGUI() which performs this check.
//However, on a Gentoo system, if the messagebox is shown before show() is called,
//the program exits. It does not crash (at least there are no error messages),
//it simply exits. Very strange.
if ( options()->useAltAz && options()->drawGround &&
map()->focus()->alt().Degrees() < -1.0 ) {
QString caption = i18n( "Initial Position is Below Horizon" );
QString message = i18n( "The initial position is below the horizon.\nWould you like to reset to the default position?" );
if ( KMessageBox::warningYesNo( this, message, caption,
KStdGuiItem::yes(), KStdGuiItem::no(), "dag_start_below_horiz" ) == KMessageBox::Yes ) {
map()->setClickedObject( NULL );
map()->setFoundObject( NULL );
options()->isTracking = false;
SkyPoint DefaultFocus;
DefaultFocus.setAz( 180.0 );
DefaultFocus.setAlt( 45.0 );
DefaultFocus.HorizontalToEquatorial( LSTh(), geo()->lat() );
map()->setDestination( &DefaultFocus );
// just show dialog if option is set (don't force it)
KTipDialog::showTip( "kstars/tips" );
......@@ -493,21 +516,22 @@ void KStars::privatedata::buildGUI() {
// ks->map()->slotCenter();
} else {
ks->map()->setClickedPoint( &newPoint );
// ks->map()->slotCenter();
ks->map()->setDestination( ks->map()->clickedPoint() );
ks->map()->destination()->EquatorialToHorizontal( ks->LSTh(), ks->geo()->lat() );
ks->map()->setFocus( ks->map()->destination() );
ks->map()->focus()->EquatorialToHorizontal( ks->LSTh(), ks->geo()->lat() );
ks->map()->destination()->EquatorialToHorizontal( ks->LSTh(), ks->geo()->lat() );
ks->map()->setOldFocus( ks->map()->focus() );
ks->map()->oldfocus()->setAz( ks->map()->focus()->az() );
ks->map()->oldfocus()->setAlt( ks->map()->focus()->alt() );
ks->map()->oldfocus()->setAz( ks->map()->focus()->az().Degrees() );
ks->map()->oldfocus()->setAlt( ks->map()->focus()->alt().Degrees() );
......@@ -295,7 +295,8 @@ void SkyMap::slotCenter( void ) {
QString caption = i18n( "Requested Position Below Horizon" );
QString message = i18n( "The requested position is below the horizon.\nWould you like to go there anyway?" );
if ( KMessageBox::warningYesNo( 0, message, caption )==KMessageBox::No ) {
if ( KMessageBox::warningYesNo( ksw, message, caption,
KStdGuiItem::yes(), KStdGuiItem::no(), "dag_focus_below_horiz" )==KMessageBox::No ) {
setClickedObject( NULL );
setFoundObject( NULL );
ksw->options()->isTracking = false;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment