1/*
2 * Copyright (C) 1999 Espen Sand, espen@kde.org
3 * 2009 Dario Andres Rodriguez <andresbajotierra@gmail.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 *
19 */
20
21#include "optiondialog.h"
22
23#include <klocale.h>
24
25#include "kdfconfig.h"
26#include "mntconfig.h"
27
28COptionDialog::COptionDialog( QWidget *parent )
29 :KPageDialog( parent )
30{
31 setCaption( i18n("Configure") );
32 setButtons( Help|Apply|Ok|Cancel );
33 setDefaultButton( Ok );
34 setFaceType( KPageDialog::Tabbed );
35 setHelp( QLatin1String( "kcontrol/kdf/index.html" ), QString() );
36
37 mConf = new KDFConfigWidget( this );
38 connect( mConf, SIGNAL(configChanged()), this, SLOT(slotChanged()) );
39 addPage( mConf, i18n("General Settings") );
40
41 mMnt = new MntConfigWidget( this );
42 connect( mMnt, SIGNAL(configChanged()), this, SLOT(slotChanged()) );
43 addPage( mMnt, i18n("Mount Commands") );
44
45 enableButton( Apply, false );
46 dataChanged = false;
47 connect(this,SIGNAL(okClicked()),this,SLOT(slotOk()));
48 connect(this,SIGNAL(applyClicked()),this,SLOT(slotApply()));
49}
50
51
52COptionDialog::~COptionDialog( void )
53{
54}
55
56
57void COptionDialog::slotOk( void )
58{
59 if( dataChanged )
60 slotApply();
61 accept();
62}
63
64
65void COptionDialog::slotApply( void )
66{
67 mConf->applySettings();
68 mMnt->applySettings();
69 emit valueChanged();
70 enableButton( Apply, false );
71 dataChanged = false;
72}
73
74void COptionDialog::slotChanged()
75{
76 enableButton( Apply, true );
77 dataChanged = true;
78}
79
80#include "optiondialog.moc"
81
82