KDEUI
configdialog.cpp
Go to the documentation of this file.00001
00021 #include "configdialog.h"
00022 #include "configwidget.h"
00023
00024 #include <klocale.h>
00025
00026 #include <kvbox.h>
00027
00028 using namespace Sonnet;
00029
00030 class ConfigDialog::Private
00031 {
00032 public:
00033 Private( ConfigDialog *parent )
00034 : q( parent ) {}
00035 ConfigWidget *ui;
00036 ConfigDialog *q;
00037 void slotConfigChanged();
00038 };
00039
00040 void ConfigDialog::Private::slotConfigChanged()
00041 {
00042 emit q->languageChanged( ui->language() );
00043 }
00044
00045 ConfigDialog::ConfigDialog(KConfig *config, QWidget *parent)
00046 : KDialog(parent),
00047 d(new Private(this))
00048 {
00049 setObjectName( "SonnetConfigDialog" );
00050 setModal( true );
00051 setCaption( i18n( "Sonnet Configuration" ) );
00052 setButtons( Ok | Apply | Cancel );
00053 setDefaultButton( Ok );
00054 showButtonSeparator( true );
00055
00056 init(config);
00057 }
00058
00059 ConfigDialog::~ConfigDialog()
00060 {
00061 delete d;
00062 }
00063
00064 void ConfigDialog::init(KConfig *config)
00065 {
00066 d->ui = new ConfigWidget(config, this);
00067 setMainWidget(d->ui);
00068 connect(this, SIGNAL(okClicked()),
00069 this, SLOT(slotOk()));
00070 connect(this, SIGNAL(applyClicked()),
00071 this, SLOT(slotApply()));
00072 connect(d->ui, SIGNAL(configChanged()),
00073 this, SLOT(slotConfigChanged()));
00074 }
00075
00076 void ConfigDialog::slotOk()
00077 {
00078 d->ui->save();
00079 accept();
00080 }
00081
00082 void ConfigDialog::slotApply()
00083 {
00084 d->ui->save();
00085 }
00086
00087 void ConfigDialog::setLanguage( const QString &language )
00088 {
00089 d->ui->setLanguage( language );
00090 }
00091
00092 #include "configdialog.moc"