• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdenetwork API Reference
  • KDE Home
  • Contact Us
 

kopete/kopete

  • sources
  • kde-4.12
  • kdenetwork
  • kopete
  • kopete
  • config
  • behavior
behaviorconfig.cpp
Go to the documentation of this file.
1 /*
2  behaviorconfig.cpp - Kopete Look Feel Config
3 
4  Kopete (c) 2002-2005 by the Kopete developers <kopete-devel@kde.org>
5 
6  *************************************************************************
7  * *
8  * This program is free software; you can redistribute it and/or modify *
9  * it under the terms of the GNU General Public License as published by *
10  * the Free Software Foundation; either version 2 of the License, or *
11  * (at your option) any later version. *
12  * *
13  *************************************************************************
14 */
15 
16 #include "behaviorconfig.h"
17 #include "behaviorconfig_general.h"
18 #include "behaviorconfig_events.h"
19 #include "behaviorconfig_chat.h"
20 #include "behaviorconfig_away.h"
21 
22 #include <qcheckbox.h>
23 #include <qradiobutton.h>
24 #include <qlayout.h>
25 #include <qlabel.h>
26 #include <qspinbox.h>
27 #include <qcombobox.h>
28 #include <QVBoxLayout>
29 
30 #include <kdebug.h>
31 #include <kplugininfo.h>
32 #include <klocale.h>
33 #include <kpushbutton.h>
34 #include <kgenericfactory.h>
35 #include <kconfig.h>
36 #include <klineedit.h>
37 
38 #include "kopetebehaviorsettings.h"
39 #include "kopetepluginmanager.h"
40 
41 #include <qtabwidget.h>
42 
43 K_PLUGIN_FACTORY( KopeteBehaviorConfigFactory,
44  registerPlugin<BehaviorConfig>(); )
45 K_EXPORT_PLUGIN( KopeteBehaviorConfigFactory("kcm_kopete_behaviorconfig") )
46 
47 BehaviorConfig::BehaviorConfig(QWidget *parent, const QVariantList &args) :
48  KCModule( KopeteBehaviorConfigFactory::componentData(), parent, args )
49 {
50  QVBoxLayout *layout = new QVBoxLayout(this);
51  // since KSetting::Dialog has margins here, we don't need our own.
52  layout->setContentsMargins( 0, 0, 0, 0);
53 
54  mBehaviorTabCtl = new QTabWidget(this);
55  mBehaviorTabCtl->setObjectName("mBehaviorTabCtl");
56  layout->addWidget( mBehaviorTabCtl );
57 
58  // "General" TAB ============================================================
59  mPrfsGeneral = new BehaviorConfig_General(mBehaviorTabCtl);
60  addConfig( Kopete::BehaviorSettings::self(), mPrfsGeneral );
61  mBehaviorTabCtl->addTab(mPrfsGeneral, i18n("&General"));
62 
63  // "Events" TAB ============================================================
64  mPrfsEvents = new BehaviorConfig_Events(mBehaviorTabCtl);
65  addConfig( Kopete::BehaviorSettings::self(), mPrfsEvents );
66  mBehaviorTabCtl->addTab(mPrfsEvents, i18n("&Events"));
67 
68  // "Away" TAB ===============================================================
69  mPrfsAway = new BehaviorConfig_Away(mBehaviorTabCtl);
70  addConfig( Kopete::BehaviorSettings::self(), mPrfsAway );
71  mBehaviorTabCtl->addTab(mPrfsAway, i18n("A&way Settings"));
72 
73  // "Chat" TAB ===============================================================
74  mPrfsChat = new BehaviorConfig_Chat(mBehaviorTabCtl);
75  addConfig( Kopete::BehaviorSettings::self(), mPrfsChat );
76  mBehaviorTabCtl->addTab(mPrfsChat, i18n("Cha&t"));
77 
78  Kopete::PluginManager *pluginManager = Kopete::PluginManager::self();
79  viewPlugins = pluginManager->availablePlugins("Views");
80 
81  load();
82 
83  // "Chat" TAB ===============================================================
84  connect( mPrfsChat->viewPlugin, SIGNAL(activated(int)),
85  this, SLOT(slotValueChanged(int)));
86 
87  // "Away" TAB ===============================================================
88  connect( mPrfsAway->mAutoAwayTimeout, SIGNAL(valueChanged(int)),
89  this, SLOT(slotValueChanged(int)));;
90  connect( mPrfsAway->mAutoAwayCustomMessage, SIGNAL(textChanged()),
91  this, SLOT(slotTextChanged()) );
92 }
93 
94 void BehaviorConfig::save()
95 {
96 // kDebug(14000);
97 
98  KCModule::save();
99 
100  // "Away" TAB ===============================================================
101  Kopete::BehaviorSettings::self()->setAutoAwayTimeout( mPrfsAway->mAutoAwayTimeout->value() * 60 );
102  Kopete::BehaviorSettings::self()->setAutoAwayCustomMessage( mPrfsAway->mAutoAwayCustomMessage->toPlainText() );
103 
104  // "Chat" TAB ===============================================================
105  if ( viewPlugins.size() > 0 )
106  {
107  Kopete::BehaviorSettings::self()->setViewPlugin(viewPlugins[mPrfsChat->viewPlugin->currentIndex()].pluginName() );
108  }
109 
110  Kopete::BehaviorSettings::self()->writeConfig();
111 
112  load();
113 }
114 
115 void BehaviorConfig::load()
116 {
117  KCModule::load();
118  // "General" TAB ===============================================================
119  if(!mPrfsGeneral->kcfg_useMessageQueue->isChecked()) {
120  mPrfsGeneral->mInstantMessageOpeningChk->setChecked(true);
121  }
122 
123  // "Away" TAB ===============================================================
124  mPrfsAway->mAutoAwayTimeout->setValue( Kopete::BehaviorSettings::self()->autoAwayTimeout() / 60 );
125  mPrfsAway->mAutoAwayCustomMessage->setPlainText( Kopete::BehaviorSettings::self()->autoAwayCustomMessage() );
126 
127  // "Chat" TAB ===============================================================
128  mPrfsChat->viewPlugin->clear();
129  int selectedIdx = 0, i = 0;
130  for( QList<KPluginInfo>::iterator it = viewPlugins.begin(); it != viewPlugins.end(); ++it )
131  {
132  if( it->pluginName() == Kopete::BehaviorSettings::self()->viewPlugin() )
133  selectedIdx = i;
134  mPrfsChat->viewPlugin->insertItem( i++, it->name() );
135  }
136 
137  mPrfsChat->viewPlugin->setCurrentIndex(selectedIdx);
138 }
139 
140 void BehaviorConfig::slotSettingsChanged(bool)
141 {
142  emit changed(true);
143 }
144 
145 void BehaviorConfig::slotValueChanged(int)
146 {
147  emit changed( true );
148 }
149 
150 void BehaviorConfig::slotTextChanged()
151 {
152  emit changed( true );
153 }
154 
155 #include "behaviorconfig.moc"
156 // vim: set noet ts=4 sts=4 sw=4:
BehaviorConfig_Away
Definition: behaviorconfig_away.h:23
BehaviorConfig_Events
Definition: behaviorconfig_events.h:23
BehaviorConfig_General
Definition: behaviorconfig_general.h:23
K_PLUGIN_FACTORY
K_PLUGIN_FACTORY(KopeteBehaviorConfigFactory, registerPlugin< BehaviorConfig >();) BehaviorConfig
Definition: behaviorconfig.cpp:43
behaviorconfig_chat.h
QWidget
behaviorconfig_general.h
BehaviorConfig::save
virtual void save()
Definition: behaviorconfig.cpp:94
BehaviorConfig_Chat
Definition: behaviorconfig_chat.h:25
BehaviorConfig::load
virtual void load()
Definition: behaviorconfig.cpp:115
behaviorconfig_events.h
behaviorconfig_away.h
BehaviorConfig
Definition: behaviorconfig.h:29
KCModule
behaviorconfig.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:53:40 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kopete/kopete

Skip menu "kopete/kopete"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdenetwork API Reference

Skip menu "kdenetwork API Reference"
  • kget
  • kopete
  •   kopete
  •   libkopete
  • krdc
  • krfb

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal