summaryrefslogtreecommitdiffstats
path: root/quanta/parts/kafka/kafkasyncoptions.cpp
blob: e7066187548cb0bec98617ab4b97514dca7e72ae (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
77
78
79
80
81
82
83
84
85
/***************************************************************************
                             kafkasyncoptions.cpp
                             -------------------

    copyright            : (C) 2003 - Nicolas Deschildre
    email                : ndeschildre@kdewebdev.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 <tqradiobutton.h>
#include <tqcheckbox.h>
#include <tqspinbox.h>

#include <kconfig.h>
#include <kdebug.h>

#include "kafkasyncoptions.h"
#include "kafkasyncoptions.moc"

KafkaSyncOptions::KafkaSyncOptions( KConfig *a_config, TQWidget* parent,  const char* name )
    : KafkaSyncOptionsUI( parent, name )
{
	config = a_config;

	config->setGroup("HTML Enhancer");
	bool showIcons  = config->readBoolEntry("Show Scripts Icons", true);

	config->setGroup("Kafka Synchronization options");
	TQString sourceRefresh = config->readEntry("Source refresh", "delay");
	int sourceRefreshDelay = config->readNumEntry("Source refresh delay", 500);
	TQString kafkaRefresh = config->readEntry("Kafka refresh", "focus");
	int kafkaRefreshDelay = config->readNumEntry("Kafka refresh delay", 4000);

	if ( !name )
		setName( "kafkaSyncOptions" );

	showScriptsIcon->setChecked(showIcons);

	if(sourceRefresh == "focus")
		sourceFocusRefresh->setChecked(true);
	else if(sourceRefresh == "delay")
		sourceDelayRefresh->setChecked(true);
	sourceDelay->setValue(sourceRefreshDelay);

	if(kafkaRefresh == "focus")
		kafkaFocusRefresh->setChecked(true);
	else if(kafkaRefresh == "delay")
		kafkaDelayRefresh->setChecked(true);
	kafkaDelay->setValue(kafkaRefreshDelay);
}

KafkaSyncOptions::~KafkaSyncOptions()
{

}


void KafkaSyncOptions::updateConfig()
{
	config->setGroup("HTML Enhancer");
	config->writeEntry("Show Scripts Icons", showScriptsIcon->isChecked());

	config->setGroup("Kafka Synchronization options");
	if(sourceFocusRefresh->isChecked())
		config->writeEntry("Source refresh", "focus");
	else if(sourceDelayRefresh->isChecked())
		config->writeEntry("Source refresh", "delay");
	config->writeEntry("Source refresh delay", sourceDelay->value());

	if(kafkaFocusRefresh->isChecked())
		config->writeEntry("Kafka refresh", "focus");
	else if(kafkaDelayRefresh->isChecked())
		config->writeEntry("Kafka refresh", "delay");
	config->writeEntry("Kafka refresh delay", kafkaDelay->value());

}