summaryrefslogtreecommitdiffstats
path: root/kopete/plugins/history/historypreferences.cpp
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commitbcb704366cb5e333a626c18c308c7e0448a8e69f (patch)
treef0d6ab7d78ecdd9207cf46536376b44b91a1ca71 /kopete/plugins/history/historypreferences.cpp
downloadtdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.tar.gz
tdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kopete/plugins/history/historypreferences.cpp')
-rw-r--r--kopete/plugins/history/historypreferences.cpp88
1 files changed, 88 insertions, 0 deletions
diff --git a/kopete/plugins/history/historypreferences.cpp b/kopete/plugins/history/historypreferences.cpp
new file mode 100644
index 00000000..61fce469
--- /dev/null
+++ b/kopete/plugins/history/historypreferences.cpp
@@ -0,0 +1,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 <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 "historypreferences.h"
+#include "historyconfig.h"
+#include "historyprefsui.h"
+
+#include <kgenericfactory.h>
+#include <qlayout.h>
+#include <qgroupbox.h>
+#include <kcolorbutton.h>
+#include <knuminput.h>
+#include <qcheckbox.h>
+
+typedef KGenericFactory<HistoryPreferences> HistoryConfigFactory;
+K_EXPORT_COMPONENT_FACTORY( kcm_kopete_history, HistoryConfigFactory( "kcm_kopete_history" ) )
+
+HistoryPreferences::HistoryPreferences(QWidget *parent, const char*/*name*/, const QStringList &args)
+ : KCModule(HistoryConfigFactory::instance(), parent, args)
+{
+ kdDebug(14310) << k_funcinfo << "called." << endl;
+ (new QVBoxLayout(this))->setAutoAdd(true);
+ p = new HistoryPrefsUI(this);
+
+ connect(p->chkShowPrevious, SIGNAL(toggled(bool)), this, SLOT(slotShowPreviousChanged(bool)));
+ connect(p->Number_Auto_chatwindow, SIGNAL(valueChanged(int)),
+ this, SLOT(slotModified()));
+ connect(p->Number_ChatWindow, SIGNAL(valueChanged(int)),
+ this, SLOT(slotModified()));
+ connect(p->History_color, SIGNAL(changed(const QColor&)),
+ this, 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"