/* mainwidget.cpp
* *
* * Copyright ( C ) 2000 , 2001 by Bernhard Rosenkraenzer
* *
* * Contributions by M . Laurent and W . Bastian .
* *
*/
/*
* * This program is free software ; you can redistribute it and / or modify
* * it under the terms of the GNU General Public License as published by
* * the Free Software Foundation ; either version 2 of the License , or
* * ( at your option ) any later version .
* *
* * This program is distributed in the hope that it will be useful ,
* * but WITHOUT ANY WARRANTY ; without even the implied warranty of
* * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* * GNU General Public License for more details .
* *
* * You should have received a copy of the GNU General Public License
* * along with this program in a file called COPYING ; if not , write to
* * the Free Software Foundation , Inc . , 51 Franklin Street , Fifth Floor , Boston ,
* * MA 02110 - 1301 , USA .
*/
/*
* * Bug reports and questions can be sent to kde - devel @ kde . org
*/
# include "mainwidget.moc"
# include "ui.h"
MainWidget : : MainWidget ( TQWidget * parent , const char * name )
: TQTabWidget ( parent , name )
{
l = new liloconf ( ) ;
general = new General ( l , this ) ;
connect ( general , TQ_SIGNAL ( configChanged ( ) ) , TQ_SIGNAL ( configChanged ( ) ) ) ;
images = new Images ( l , this ) ;
connect ( images , TQ_SIGNAL ( configChanged ( ) ) , TQ_SIGNAL ( configChanged ( ) ) ) ;
expert = new Expert ( l , this ) ;
connect ( expert , TQ_SIGNAL ( configChanged ( ) ) , TQ_SIGNAL ( configChanged ( ) ) ) ;
connect ( expert , TQ_SIGNAL ( configChanged ( ) ) , images , TQ_SLOT ( update ( ) ) ) ;
addTab ( general , _ ( " &General Options " ) ) ;
addTab ( images , _ ( " &Operating Systems " ) ) ;
addTab ( expert , _ ( " &Expert " ) ) ;
connect ( this , TQ_SIGNAL ( selected ( const TQString & ) ) , TQ_SLOT ( tabChanged ( const TQString & ) ) ) ;
load ( ) ;
arrangeWidgets ( ) ;
}
void MainWidget : : makeReadOnly ( )
{
general - > makeReadOnly ( ) ;
images - > makeReadOnly ( ) ;
expert - > makeReadOnly ( ) ;
}
void MainWidget : : load ( )
{
defaults ( ) ;
}
void MainWidget : : save ( )
{
if ( previous = = _ ( " &Expert " ) )
expert - > saveChanges ( ) ;
else {
general - > saveChanges ( ) ;
images - > saveChanges ( ) ;
}
l - > checked = false ;
if ( ! l - > isOk ( ) ) {
if ( WarningYesNo ( this , " About to write a faulty lilo.conf " , " WARNING: the config file is currently NOT ok. \n Do you really want to override /etc/lilo.conf? \n \n If you aren't sure, select \" no \" and click the \" Check configuration \" button to see the details. \n If you don't know what's wrong, try clicking the \" Probe \" button to auto-generate a working lilo.conf. \n If you're getting this message after using the \" Probe \" button, please send a full bug report, \n including the output of \" Check configuration \" and the generated lilo.conf (displayed in the \" Expert \" tab), \n to bero@kde.org. " ) ! = IDYES )
return ;
}
l - > writeFile ( " /etc/lilo.conf " ) ;
l - > install ( ) ;
}
void MainWidget : : defaults ( )
{
}
void MainWidget : : reset ( )
{
load ( ) ;
}
void MainWidget : : arrangeWidgets ( )
{
}
void MainWidget : : tabChanged ( TQString const & lbl ) // SLOT
{
if ( previous = = _ ( " &Expert " ) )
expert - > saveChanges ( ) ;
else if ( previous = = _ ( " &General options " ) )
general - > saveChanges ( ) ;
else if ( previous = = _ ( " &Operating systems " ) )
images - > saveChanges ( ) ;
if ( lbl = = _ ( " &Expert " ) )
expert - > update ( ) ;
else if ( lbl = = _ ( " &Operating systems " ) )
images - > update ( ) ;
else if ( lbl = = _ ( " &General options " ) )
general - > update ( ) ;
previous = lbl ;
}