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
86
87
88
|
/*
historypreferences.cpp
Copyright (c) 2003 by Olivier Goffart <ogoffart @ kde.org>
(c) 2003 by Stefan Gehn <metz AT gehn.net>
Kopete (c) 2003-2004 by the Kopete developers <[email protected]>
*************************************************************************
* *
* 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 "historypreferences.h"
#include "historyconfig.h"
#include "historyprefsui.h"
#include <kgenericfactory.h>
#include <layout.h>
#include <tqgroupbox.h>
#include <kcolorbutton.h>
#include <knuminput.h>
#include <tqcheckbox.h>
typedef KGenericFactory<HistoryPreferences> HistoryConfigFactory;
K_EXPORT_COMPONENT_FACTORY( kcm_kopete_history, HistoryConfigFactory( "kcm_kopete_history" ) )
HistoryPreferences::HistoryPreferences(TQWidget *parent, const char*/*name*/, const TQStringList &args)
: KCModule(HistoryConfigFactory::instance(), parent, args)
{
kdDebug(14310) << k_funcinfo << "called." << endl;
(new TQVBoxLayout(this))->setAutoAdd(true);
p = new HistoryPrefsUI(this);
connect(p->chkShowPrevious, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotShowPreviousChanged(bool)));
connect(p->Number_Auto_chatwindow, TQT_SIGNAL(valueChanged(int)),
this, TQT_SLOT(slotModified()));
connect(p->Number_ChatWindow, TQT_SIGNAL(valueChanged(int)),
this, TQT_SLOT(slotModified()));
connect(p->History_color, TQT_SIGNAL(changed(const TQColor&)),
this, TQT_SLOT(slotModified()));
load();
}
HistoryPreferences::~HistoryPreferences()
{
kdDebug(14310) << k_funcinfo << "called." << endl;
}
void HistoryPreferences::load()
{
kdDebug(14310) << k_funcinfo << "called." << endl;
HistoryConfig::self()->readConfig();
p->chkShowPrevious->setChecked(HistoryConfig::auto_chatwindow());
slotShowPreviousChanged(p->chkShowPrevious->isChecked());
p->Number_Auto_chatwindow->setValue(HistoryConfig::number_Auto_chatwindow());
p->Number_ChatWindow->setValue(HistoryConfig::number_ChatWindow());
p->History_color->setColor(HistoryConfig::history_color());
//p-> HistoryConfig::browserStyle();
emit KCModule::changed(false);
}
void HistoryPreferences::save()
{
kdDebug(14310) << k_funcinfo << "called." << endl;
HistoryConfig::setAuto_chatwindow(p->chkShowPrevious->isChecked());
HistoryConfig::setNumber_Auto_chatwindow(p->Number_Auto_chatwindow->value());
HistoryConfig::setNumber_ChatWindow(p->Number_ChatWindow->value());
HistoryConfig::setHistory_color(p->History_color->color());
HistoryConfig::self()->writeConfig();
emit KCModule::changed(false);
}
void HistoryPreferences::slotModified()
{
emit KCModule::changed(true);
}
void HistoryPreferences::slotShowPreviousChanged(bool on)
{
emit KCModule::changed(true);
}
#include "historypreferences.moc"
|