summaryrefslogtreecommitdiffstats
path: root/kopete/plugins/latex/latexpreferences.cpp
blob: 86143114577e9238f07f8a51e7746ba65a0374d6 (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
70
71
72
73
74
75
76
/*
    Kopete Latex Plugin

    Copyright (c) 2004 by Duncan Mac-Vicar Prett   <duncan@kde.org>

    Kopete    (c) 2001-2004 by the Kopete developers  <kopete-devel@kde.org>

    *************************************************************************
    *                                                                       *
    * 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 <layout.h>
#include <kparts/componentfactory.h>
#include <klocale.h>
#include <kgenericfactory.h>
#include <kdebug.h>
#include <knuminput.h>

#include "latexplugin.h"
#include "latexconfig.h"
#include "latexprefsbase.h"
#include "latexpreferences.h"

typedef KGenericFactory<LatexPreferences> LatexPreferencesFactory;
K_EXPORT_COMPONENT_FACTORY( kcm_kopete_latex, LatexPreferencesFactory( "kcm_kopete_latex" )  )

LatexPreferences::LatexPreferences(TQWidget *parent, const char* /*name*/, const TQStringList &args)
							: KCModule(LatexPreferencesFactory::instance(), parent, args)
{
	( new TQVBoxLayout( this ) )->setAutoAdd( true );
	m_preferencesDialog = new LatexPrefsUI(this);
	// connect widget signals here
	m_preferencesDialog->horizontalDPI->setMinValue(1);
	m_preferencesDialog->verticalDPI->setMinValue(1);
	
	connect(m_preferencesDialog->horizontalDPI, TQT_SIGNAL(valueChanged(int)), this, TQT_SLOT(slotModified()));
	connect(m_preferencesDialog->verticalDPI, TQT_SIGNAL(valueChanged(int)), this, TQT_SLOT(slotModified()));
	
	load();
}

LatexPreferences::~LatexPreferences()
{
}

void LatexPreferences::load()
{
	LatexConfig::self()->readConfig();
	// load widgets here
	m_preferencesDialog->horizontalDPI->setValue(LatexConfig::self()->horizontalDPI());
	m_preferencesDialog->verticalDPI->setValue(LatexConfig::self()->verticalDPI());
	emit KCModule::changed(false);
}

void LatexPreferences::slotModified()
{
	emit KCModule::changed(true);
}

void LatexPreferences::save()
{
	LatexConfig::self()->setHorizontalDPI(m_preferencesDialog->horizontalDPI->value());
	LatexConfig::self()->setVerticalDPI(m_preferencesDialog->verticalDPI->value());
	LatexConfig::self()->writeConfig();
	emit KCModule::changed(false);
}

#include "latexpreferences.moc"

// vim: set noet ts=4 sts=4 sw=4: