summaryrefslogtreecommitdiffstats
path: root/kopete/plugins/motionautoaway/motionawaypreferences.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/motionautoaway/motionawaypreferences.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/motionautoaway/motionawaypreferences.cpp')
-rw-r--r--kopete/plugins/motionautoaway/motionawaypreferences.cpp70
1 files changed, 70 insertions, 0 deletions
diff --git a/kopete/plugins/motionautoaway/motionawaypreferences.cpp b/kopete/plugins/motionautoaway/motionawaypreferences.cpp
new file mode 100644
index 00000000..a4962c5c
--- /dev/null
+++ b/kopete/plugins/motionautoaway/motionawaypreferences.cpp
@@ -0,0 +1,70 @@
+/*
+ Kopete Motion Detector Auto-Away plugin
+
+ Copyright (c) 2002-2004 by Duncan Mac-Vicar Prett <[email protected]>
+
+ Kopete (c) 2002 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 <qlayout.h>
+#include <qobject.h>
+#include <qcheckbox.h>
+
+#include <kgenericfactory.h>
+#include <klineedit.h>
+#include <knuminput.h>
+
+#include "motionawayprefs.h"
+#include "motionawaypreferences.h"
+#include "motionawayconfig.h"
+
+typedef KGenericFactory<MotionAwayPreferences> MotionAwayPreferencesFactory;
+K_EXPORT_COMPONENT_FACTORY( kcm_kopete_motionaway, MotionAwayPreferencesFactory("kcm_kopete_motionaway"))
+
+MotionAwayPreferences::MotionAwayPreferences(QWidget *parent, const char* /*name*/, const QStringList &args)
+ : KCModule(MotionAwayPreferencesFactory::instance(), parent, args)
+{
+ // Add actuall widget generated from ui file.
+ ( new QVBoxLayout( this ) )->setAutoAdd( true );
+ preferencesDialog = new motionawayPrefsUI(this);
+ connect(preferencesDialog->BecomeAvailableWithActivity, SIGNAL(toggled(bool)), this, SLOT(slotWidgetModified()));
+ connect(preferencesDialog->AwayTimeout, SIGNAL(valueChanged(int)), this, SLOT(slotWidgetModified()));
+ connect(preferencesDialog->VideoDevice, SIGNAL(textChanged(const QString &)), this, SLOT(slotWidgetModified()));
+ load();
+}
+
+void MotionAwayPreferences::load()
+{
+ MotionAwayConfig::self()->readConfig();
+ preferencesDialog->AwayTimeout->setValue(MotionAwayConfig::self()->awayTimeout());
+ preferencesDialog->BecomeAvailableWithActivity->setChecked(MotionAwayConfig::self()->becomeAvailableWithActivity());
+ preferencesDialog->VideoDevice->setText(MotionAwayConfig::self()->videoDevice());
+ emit KCModule::changed(false);
+}
+
+void MotionAwayPreferences::slotWidgetModified()
+{
+ emit KCModule::changed(true);
+}
+
+void MotionAwayPreferences::save()
+{
+ MotionAwayConfig::self()->setAwayTimeout(preferencesDialog->AwayTimeout->value());
+ MotionAwayConfig::self()->setBecomeAvailableWithActivity(preferencesDialog->BecomeAvailableWithActivity->isChecked());
+ MotionAwayConfig::self()->setVideoDevice(preferencesDialog->VideoDevice->text());
+ MotionAwayConfig::self()->writeConfig();
+ emit KCModule::changed(false);
+}
+
+#include "motionawaypreferences.moc"
+
+// vim: set noet ts=4 sts=4 sw=4: