summaryrefslogtreecommitdiffstats
path: root/part/kxesettings.cpp
blob: 59b71f04c020c26617d3e1a3c9f486dc80d2d6a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/***************************************************************************
                           kxesettings.cpp
                           ---------------
    begin                : Tue Dec 02 2003
    copyright            : (C) 2003 by The KXMLEditor Team
    email                : hartig@users.sourceforge.net
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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.                                   *
 *                                                                         *
 ***************************************************************************/

#include "kxesettings.h"

#include <kconfig.h>

KXESettings::KXESettings( const TQString & strConfigGroup,  TQObject * pParent, const char * pszName )
 : TQObject( pParent, pszName ),
   m_bPageChanged( false ),
   m_strConfigGroup( strConfigGroup )
{
	connect( this, SIGNAL(sigDialogPageChanged()), this, SLOT(slotDialogPageChanged()) );
}

void KXESettings::setConfigGroup( KConfig * pConfig ) const
{
	pConfig->setGroup( m_strConfigGroup );
}

void KXESettings::store( KConfig * pConfig ) const
{
	setConfigGroup( pConfig );
	write( pConfig );
}

void KXESettings::restore( KConfig * pConfig )
{
	setConfigGroup( pConfig );
	read( pConfig );

	// update the corresponding config.dialog page
	blockSignals( true ); // block this object's signals (especially sigDialogPageChanged)
	updatePage();
	blockSignals( false ); // unblock the signals

	emit sigChanged();
}

void KXESettings::slotDialogPageChanged()
{
	m_bPageChanged = true;
}

void KXESettings::apply()
{
	if ( m_bPageChanged )
	{
		setFromPage();
		m_bPageChanged = false;
		emit sigChanged();
	}
}

#include "kxesettings.moc"