#include <kdialog.h>
#include <klocale.h>
/****************************************************************************
** Form implementation generated from reading ui file '/usr/src/ports/kdebase3/kdebase3-3.5.10-11.x86_64/src/kdebase-3.5.10/kcontrol/smserver/smserverconfigdlg.ui'
**
** Created by User Interface Compiler
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/

#include "smserverconfigdlg.h"

#include <qvariant.h>
#include <kdialog.h>
#include <qpushbutton.h>
#include <qgroupbox.h>
#include <qcheckbox.h>
#include <qbuttongroup.h>
#include <qradiobutton.h>
#include <qlabel.h>
#include <klineedit.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qwhatsthis.h>

/*
 *  Constructs a SMServerConfigDlg as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 */
SMServerConfigDlg::SMServerConfigDlg( QWidget* parent, const char* name, WFlags fl )
    : QWidget( parent, name, fl )
{
    if ( !name )
	setName( "SMServerConfigDlg" );
    SMServerConfigDlgLayout = new QVBoxLayout( this, 0, KDialog::spacingHint(), "SMServerConfigDlgLayout"); 

    topBox = new QGroupBox( this, "topBox" );
    topBox->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 0, 0, topBox->sizePolicy().hasHeightForWidth() ) );
    topBox->setColumnLayout(0, Qt::Vertical );
    topBox->layout()->setSpacing( KDialog::spacingHint() );
    topBox->layout()->setMargin( KDialog::marginHint() );
    topBoxLayout = new QVBoxLayout( topBox->layout() );
    topBoxLayout->setAlignment( Qt::AlignTop );

    confirmLogoutCheck = new QCheckBox( topBox, "confirmLogoutCheck" );
    topBoxLayout->addWidget( confirmLogoutCheck );

    offerShutdownCheck = new QCheckBox( topBox, "offerShutdownCheck" );
    topBoxLayout->addWidget( offerShutdownCheck );
    SMServerConfigDlgLayout->addWidget( topBox );

    loginGroup = new QButtonGroup( this, "loginGroup" );
    loginGroup->setColumnLayout(0, Qt::Vertical );
    loginGroup->layout()->setSpacing( KDialog::spacingHint() );
    loginGroup->layout()->setMargin( KDialog::marginHint() );
    loginGroupLayout = new QVBoxLayout( loginGroup->layout() );
    loginGroupLayout->setAlignment( Qt::AlignTop );

    previousSessionRadio = new QRadioButton( loginGroup, "previousSessionRadio" );
    loginGroupLayout->addWidget( previousSessionRadio );

    savedSessionRadio = new QRadioButton( loginGroup, "savedSessionRadio" );
    loginGroupLayout->addWidget( savedSessionRadio );

    emptySessionRadio = new QRadioButton( loginGroup, "emptySessionRadio" );
    loginGroupLayout->addWidget( emptySessionRadio );
    SMServerConfigDlgLayout->addWidget( loginGroup );

    sdGroup = new QButtonGroup( this, "sdGroup" );
    sdGroup->setColumnLayout(0, Qt::Vertical );
    sdGroup->layout()->setSpacing( KDialog::spacingHint() );
    sdGroup->layout()->setMargin( KDialog::marginHint() );
    sdGroupLayout = new QVBoxLayout( sdGroup->layout() );
    sdGroupLayout->setAlignment( Qt::AlignTop );

    logoutRadio = new QRadioButton( sdGroup, "logoutRadio" );
    sdGroupLayout->addWidget( logoutRadio );

    haltRadio = new QRadioButton( sdGroup, "haltRadio" );
    sdGroupLayout->addWidget( haltRadio );

    rebootRadio = new QRadioButton( sdGroup, "rebootRadio" );
    sdGroupLayout->addWidget( rebootRadio );
    SMServerConfigDlgLayout->addWidget( sdGroup );

    advancedGroup = new QButtonGroup( this, "advancedGroup" );
    advancedGroup->setColumnLayout(0, Qt::Vertical );
    advancedGroup->layout()->setSpacing( KDialog::spacingHint() );
    advancedGroup->layout()->setMargin( KDialog::marginHint() );
    advancedGroupLayout = new QVBoxLayout( advancedGroup->layout() );
    advancedGroupLayout->setAlignment( Qt::AlignTop );

    textLabel1 = new QLabel( advancedGroup, "textLabel1" );
    advancedGroupLayout->addWidget( textLabel1 );

    excludeLineedit = new KLineEdit( advancedGroup, "excludeLineedit" );
    advancedGroupLayout->addWidget( excludeLineedit );
    SMServerConfigDlgLayout->addWidget( advancedGroup );
    bottomSpacer = new QSpacerItem( 20, 130, QSizePolicy::Minimum, QSizePolicy::Expanding );
    SMServerConfigDlgLayout->addItem( bottomSpacer );
    languageChange();
    resize( QSize(325, 366).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( confirmLogoutCheck, SIGNAL( toggled(bool) ), this, SLOT( configChanged() ) );
    connect( loginGroup, SIGNAL( clicked(int) ), this, SLOT( configChanged() ) );
    connect( sdGroup, SIGNAL( clicked(int) ), this, SLOT( configChanged() ) );
    connect( excludeLineedit, SIGNAL( textChanged(const QString&) ), this, SLOT( configChanged() ) );
    connect( offerShutdownCheck, SIGNAL( toggled(bool) ), sdGroup, SLOT( setEnabled(bool) ) );
    connect( offerShutdownCheck, SIGNAL( toggled(bool) ), this, SLOT( configChanged() ) );

    // buddies
    textLabel1->setBuddy( excludeLineedit );
}

/*
 *  Destroys the object and frees any allocated resources
 */
SMServerConfigDlg::~SMServerConfigDlg()
{
    // no need to delete child widgets, Qt does it all for us
}

/*
 *  Sets the strings of the subwidgets using the current
 *  language.
 */
void SMServerConfigDlg::languageChange()
{
    setCaption( tr2i18n( "Session Manager" ) );
    topBox->setTitle( tr2i18n( "General" ) );
    confirmLogoutCheck->setText( tr2i18n( "Conf&irm logout" ) );
    QWhatsThis::add( confirmLogoutCheck, tr2i18n( "Check this option if you want the session manager to display a logout confirmation dialog box." ) );
    offerShutdownCheck->setText( tr2i18n( "O&ffer shutdown options" ) );
    loginGroup->setTitle( tr2i18n( "On Login" ) );
    QWhatsThis::add( loginGroup, tr2i18n( "<ul>\n"
"<li><b>Restore previous session:</b> Will save all applications running on exit and restore them when they next start up</li>\n"
"<li><b>Restore manually saved session: </b> Allows the session to be saved at any time via \"Save Session\" in the K-Menu. This means the currently started applications will reappear when they next start up.</li>\n"
"<li><b>Start with an empty session:</b> Do not save anything. Will come up with an empty desktop on next start.</li>\n"
"</ul>" ) );
    previousSessionRadio->setText( tr2i18n( "Restore &previous session" ) );
    savedSessionRadio->setText( tr2i18n( "Restore &manually saved session" ) );
    emptySessionRadio->setText( tr2i18n( "Start with an empty &session" ) );
    sdGroup->setTitle( tr2i18n( "Default Shutdown Option" ) );
    QWhatsThis::add( sdGroup, tr2i18n( "Here you can choose what should happen by default when you log out. This only has meaning, if you logged in through KDM." ) );
    logoutRadio->setText( tr2i18n( "&End current session" ) );
    haltRadio->setText( tr2i18n( "&Turn off computer" ) );
    rebootRadio->setText( tr2i18n( "&Restart computer" ) );
    advancedGroup->setTitle( tr2i18n( "Advanced" ) );
    textLabel1->setText( tr2i18n( "Applications to be e&xcluded from sessions:" ) );
    QWhatsThis::add( excludeLineedit, tr2i18n( "Here you can enter a comma-separated list of applications that should not be saved in sessions, and therefore will not be started when restoring a session. For example 'xterm,xconsole'." ) );
}

void SMServerConfigDlg::configChanged()
{
    qWarning( "SMServerConfigDlg::configChanged(): Not implemented yet" );
}

#include "smserverconfigdlg.moc"
