2 Copyright (c) 2009 Montel Laurent <montel@kde.org>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 #include "kjotsconfigdlg.h"
20 KJotsConfigDlg::KJotsConfigDlg( const QString
& title
, QWidget
*parent
)
21 : KCMultiDialog( parent
)
24 setFaceType( KPageDialog::List
);
25 setButtons( Default
| Ok
| Cancel
);
26 setDefaultButton( Ok
);
28 showButtonSeparator( true );
30 addModule( QLatin1String("kjots_config_misc") );
31 connect( this, SIGNAL(okClicked()), SLOT(slotOk()) );
34 KJotsConfigDlg::~KJotsConfigDlg()
38 void KJotsConfigDlg::slotOk()
42 KJotsConfigMisc::KJotsConfigMisc( const KComponentData
&inst
, QWidget
*parent
)
43 :KCModule( inst
, parent
)
45 QHBoxLayout
*lay
= new QHBoxLayout( this );
46 miscPage
= new confPageMisc( 0 );
47 lay
->addWidget( miscPage
);
48 connect( miscPage
->autoSaveInterval
, SIGNAL(valueChanged(int)), this, SLOT(modified()) );
49 connect( miscPage
->autoSave
, SIGNAL(stateChanged(int)), this, SLOT(modified()) );
53 void KJotsConfigMisc::modified()
58 void KJotsConfigMisc::load()
60 KConfig
config( QLatin1String("kjotsrc") );
61 KConfigGroup group
= config
.group( "kjots" );
62 miscPage
->autoSaveInterval
->setValue( group
.readEntry( "AutoSaveInterval", 5 ) );
63 miscPage
->autoSave
->setChecked( group
.readEntry( "AutoSave", true ) );
64 emit
changed( false );
67 void KJotsConfigMisc::save()
69 KConfig
config( QLatin1String("kjotsrc") );
70 KConfigGroup group
= config
.group( "kjots" );
71 group
.writeEntry( "AutoSaveInterval", miscPage
->autoSaveInterval
->value() );
72 group
.writeEntry( "AutoSave", miscPage
->autoSave
->isChecked() );
74 emit
changed( false );
77 #include "moc_kjotsconfigdlg.cpp"