• 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
  • appearance
appearanceconfig.cpp
Go to the documentation of this file.
1 /*
2  appearanceconfig.cpp - Kopete Look Feel Config
3 
4  Copyright (c) 2001-2002 by Duncan Mac-Vicar Prett <duncan@kde.org>
5  Copyright (c) 2005-2006 by MichaĆ«l Larouche <larouche@kde.org>
6 
7  Kopete (c) 2002-2006 by the Kopete developers <kopete-devel@kde.org>
8 
9  *************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  *************************************************************************
17 */
18 
19 #include "appearanceconfig.h"
20 #include "ui_appearanceconfig_colors.h"
21 #include "ui_appearanceconfig_contactlist.h"
22 #include "ui_appearanceconfig_advanced.h"
23 
24 #include "tooltipeditdialog.h"
25 
26 #include <QCheckBox>
27 #include <QDir>
28 #include <QLayout>
29 #include <QSpinBox>
30 #include <QSlider>
31 #include <QLabel>
32 #include <QPixmap>
33 #include <QVBoxLayout>
34 
35 #include <kdeversion.h>
36 #include <kinputdialog.h>
37 
38 #include <kcolorcombo.h>
39 #include <kcolorbutton.h>
40 #include <kdebug.h>
41 #include <kfontrequester.h>
42 #include <kpluginfactory.h>
43 #include <kpluginloader.h>
44 #include <kio/netaccess.h>
45 #include <khtmlview.h>
46 #include <klineedit.h>
47 #include <klocale.h>
48 #include <kmessagebox.h>
49 #include <kpushbutton.h>
50 #include <kstandarddirs.h>
51 #include <kurlrequesterdialog.h>
52 #include <krun.h>
53 #include <kfiledialog.h>
54 
55 #include "kopeteglobal.h"
56 
57 #include <qtabwidget.h>
58 
59 #include "kopeteappearancesettings.h"
60 #include "contactlistlayoutwidget.h"
61 
62 //class AppearanceConfig;
63 
64 K_PLUGIN_FACTORY( KopeteAppearanceConfigFactory,
65  registerPlugin<AppearanceConfig>(); )
66 K_EXPORT_PLUGIN( KopeteAppearanceConfigFactory("kcm_kopete_appearanceconfig") )
67 
68 class FakeProtocol;
69 class FakeAccount;
70 class FakeContact;
71 
72 class AppearanceConfig::Private
73 {
74 public:
75  Private()
76  : mAppearanceTabCtl(0L)
77  {}
78 
79  QTabWidget *mAppearanceTabCtl;
80 
81  Ui::AppearanceConfig_Colors mPrfsColors;
82  Ui::AppearanceConfig_ContactList mPrfsContactList;
83  Ui::AppearanceConfig_Advanced mPrfsAdvanced;
84  ContactListLayoutWidget *contactListLayoutWidget;
85 };
86 
87 
88 AppearanceConfig::AppearanceConfig(QWidget *parent, const QVariantList &args )
89 : KCModule( KopeteAppearanceConfigFactory::componentData(), parent, args ), d(new Private())
90 {
91  QVBoxLayout *layout = new QVBoxLayout(this);
92  // since the tab widget is already within a layout with margins in the KSettings::Dialog
93  // it needs no margins of its own.
94  layout->setContentsMargins( 0, 0, 0, 0 );
95  d->mAppearanceTabCtl = new QTabWidget(this);
96  d->mAppearanceTabCtl->setObjectName("mAppearanceTabCtl");
97  layout->addWidget( d->mAppearanceTabCtl );
98 
99  KConfigGroup config(KGlobal::config(), "ChatWindowSettings");
100 
101  // "Contact List" TAB =======================================================
102  QWidget *contactListWidget = new QWidget(d->mAppearanceTabCtl);
103  d->mPrfsContactList.setupUi(contactListWidget);
104  addConfig( Kopete::AppearanceSettings::self(), contactListWidget );
105 
106  connect(d->mPrfsContactList.mEditTooltips, SIGNAL(clicked()),
107  this, SLOT(slotEditTooltips()));
108 
109  d->mAppearanceTabCtl->addTab(contactListWidget, i18n("Contact List"));
110 
111  // "Colors and Fonts" TAB ===================================================
112  QWidget *colorsWidget = new QWidget(d->mAppearanceTabCtl);
113  d->mPrfsColors.setupUi(colorsWidget);
114  addConfig( Kopete::AppearanceSettings::self(), colorsWidget );
115 
116  d->mAppearanceTabCtl->addTab(colorsWidget, i18n("Colors && Fonts"));
117 
118  // "Advanced" TAB ===========================================================
119  QWidget *advancedWidget = new QWidget(d->mAppearanceTabCtl);
120  d->mPrfsAdvanced.setupUi(advancedWidget);
121  addConfig( Kopete::AppearanceSettings::self(), advancedWidget );
122  connect ( d->mPrfsAdvanced.kcfg_contactListResizeAnchor, SIGNAL (toggled(bool)), this, SLOT (emitChanged()));
123 
124  d->mAppearanceTabCtl->addTab(advancedWidget, i18n("Advanced"));
125 
126 
127  d->contactListLayoutWidget = new ContactListLayoutWidget( d->mAppearanceTabCtl );
128  connect( d->contactListLayoutWidget, SIGNAL(changed()), this, SLOT (emitChanged()) );
129  d->mAppearanceTabCtl->addTab( d->contactListLayoutWidget, i18n("Layout") );
130 
131  // ==========================================================================
132 
133  load();
134 }
135 
136 AppearanceConfig::~AppearanceConfig()
137 {
138  delete d;
139 }
140 
141 void AppearanceConfig::save()
142 {
143  KCModule::save();
144 // kDebug(14000) << "called.";
145 
146  Kopete::AppearanceSettings *settings = Kopete::AppearanceSettings::self();
147  settings->setContactListAutoResize (d->mPrfsAdvanced.kcfg_contactListResizeAnchor->isChecked());
148  settings->writeConfig();
149 
150  if ( d->contactListLayoutWidget->save() )
151  load();
152  else
153  QTimer::singleShot( 0, this, SLOT(emitChanged()) );
154 }
155 
156 void AppearanceConfig::load()
157 {
158  KCModule::load();
159  d->mPrfsAdvanced.kcfg_contactListResizeAnchor->setChecked(Kopete::AppearanceSettings::contactListAutoResize ());
160 
161  d->contactListLayoutWidget->load();
162 // kDebug(14000) << "called";
163 }
164 
165 void AppearanceConfig::slotHighlightChanged()
166 {
167 // bool value = mPrfsChatWindow->highlightEnabled->isChecked();
168 // mPrfsChatWindow->foregroundColor->setEnabled ( value );
169 // mPrfsChatWindow->backgroundColor->setEnabled ( value );
170 // slotUpdateChatPreview();
171 }
172 
173 void AppearanceConfig::slotChangeFont()
174 {
175  emitChanged();
176 }
177 
178 void AppearanceConfig::emitChanged()
179 {
180  emit changed( true );
181 }
182 
183 void AppearanceConfig::slotEditTooltips()
184 {
185  QPointer <TooltipEditDialog> dlg = new TooltipEditDialog(this);
186  connect(dlg, SIGNAL(changed(bool)), this, SIGNAL(changed(bool)));
187  dlg->exec();
188  delete dlg;
189 }
190 
191 #include "appearanceconfig.moc"
192 // vim: set noet ts=4 sts=4 sw=4:
QWidget
AppearanceConfig::AppearanceConfig
AppearanceConfig(QWidget *parent, const QVariantList &args)
Definition: appearanceconfig.cpp:88
AppearanceConfig::~AppearanceConfig
~AppearanceConfig()
Definition: appearanceconfig.cpp:136
AppearanceConfig
Definition: appearanceconfig.h:28
appearanceconfig.h
ContactListLayoutWidget
Definition: contactlistlayoutwidget.h:25
TooltipEditDialog
Definition: tooltipeditdialog.h:28
K_PLUGIN_FACTORY
K_PLUGIN_FACTORY(KopeteAppearanceConfigFactory, registerPlugin< AppearanceConfig >();) class FakeProtocol
tooltipeditdialog.h
AppearanceConfig::load
virtual void load()
Definition: appearanceconfig.cpp:156
AppearanceConfig::save
virtual void save()
Definition: appearanceconfig.cpp:141
KCModule
contactlistlayoutwidget.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