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

kopete/kopete

appearanceconfig.cpp

Go to the documentation of this file.
00001 /*
00002     appearanceconfig.cpp  -  Kopete Look Feel Config
00003 
00004     Copyright (c) 2001-2002 by Duncan Mac-Vicar Prett <duncan@kde.org>
00005     Copyright (c) 2005-2006 by Michaƫl Larouche       <larouche@kde.org>
00006 
00007     Kopete    (c) 2002-2006 by the Kopete developers  <kopete-devel@kde.org>
00008 
00009     *************************************************************************
00010     *                                                                       *
00011     * This program is free software; you can redistribute it and/or modify  *
00012     * it under the terms of the GNU General Public License as published by  *
00013     * the Free Software Foundation; either version 2 of the License, or     *
00014     * (at your option) any later version.                                   *
00015     *                                                                       *
00016     *************************************************************************
00017 */
00018 
00019 #include "appearanceconfig.h"
00020 #include "ui_appearanceconfig_colors.h"
00021 #include "ui_appearanceconfig_contactlist.h"
00022 #include "ui_appearanceconfig_advanced.h"
00023 
00024 #include "tooltipeditdialog.h"
00025 
00026 #include <QCheckBox>
00027 #include <QDir>
00028 #include <QLayout>
00029 #include <QSpinBox>
00030 #include <QSlider>
00031 #include <QLabel>
00032 #include <QPixmap>
00033 #include <QVBoxLayout>
00034 
00035 #include <kdeversion.h>
00036 #include <kinputdialog.h>
00037 
00038 #include <kcolorcombo.h>
00039 #include <kcolorbutton.h>
00040 #include <kdebug.h>
00041 #include <kfontrequester.h>
00042 #include <kpluginfactory.h>
00043 #include <kpluginloader.h>
00044 #include <kio/netaccess.h>
00045 #include <khtmlview.h>
00046 #include <klineedit.h>
00047 #include <klocale.h>
00048 #include <kmessagebox.h>
00049 #include <kpushbutton.h>
00050 #include <kstandarddirs.h>
00051 #include <kurlrequesterdialog.h>
00052 #include <krun.h>
00053 #include <kfiledialog.h>
00054 
00055 #include "kopeteglobal.h"
00056 
00057 #include <qtabwidget.h>
00058 
00059 #include "kopeteappearancesettings.h"
00060 
00061 //class AppearanceConfig;
00062 
00063 K_PLUGIN_FACTORY( KopeteAppearanceConfigFactory,
00064         registerPlugin<AppearanceConfig>(); )
00065 K_EXPORT_PLUGIN( KopeteAppearanceConfigFactory("kcm_kopete_appearanceconfig") )
00066 
00067 class FakeProtocol;
00068 class FakeAccount;
00069 class FakeContact;
00070 
00071 class AppearanceConfig::Private
00072 {
00073 public:
00074     Private()
00075      : mAppearanceTabCtl(0L)
00076     {}
00077 
00078     QTabWidget *mAppearanceTabCtl;
00079 
00080     Ui::AppearanceConfig_Colors mPrfsColors;
00081     Ui::AppearanceConfig_ContactList mPrfsContactList;
00082     Ui::AppearanceConfig_Advanced mPrfsAdvanced;
00083 };
00084 
00085 
00086 AppearanceConfig::AppearanceConfig(QWidget *parent, const QVariantList &args )
00087 : KCModule( KopeteAppearanceConfigFactory::componentData(), parent, args )
00088 {
00089     d = new Private;
00090 
00091     QVBoxLayout *layout = new QVBoxLayout(this);
00092     // since the tab widget is already within a layout with margins in the KSettings::Dialog
00093     // it needs no margins of its own.
00094     layout->setContentsMargins( 0, 0, 0, 0 );
00095     d->mAppearanceTabCtl = new QTabWidget(this);
00096     d->mAppearanceTabCtl->setObjectName("mAppearanceTabCtl");
00097     layout->addWidget( d->mAppearanceTabCtl );
00098 
00099     KConfigGroup config(KGlobal::config(), "ChatWindowSettings");
00100 
00101     // "Contact List" TAB =======================================================
00102     QWidget *contactListWidget = new QWidget(d->mAppearanceTabCtl);
00103     d->mPrfsContactList.setupUi(contactListWidget);
00104     addConfig( Kopete::AppearanceSettings::self(), contactListWidget );
00105 
00106     connect(d->mPrfsContactList.mEditTooltips, SIGNAL(clicked()),
00107         this, SLOT(slotEditTooltips()));
00108 
00109     d->mAppearanceTabCtl->addTab(contactListWidget, i18n("Contact List"));
00110 
00111     // "Colors and Fonts" TAB ===================================================
00112     QWidget *colorsWidget = new QWidget(d->mAppearanceTabCtl);
00113     d->mPrfsColors.setupUi(colorsWidget);
00114     addConfig( Kopete::AppearanceSettings::self(), colorsWidget );
00115 
00116     d->mAppearanceTabCtl->addTab(colorsWidget, i18n("Colors && Fonts"));
00117 
00118     // "Advanced" TAB ===========================================================
00119     QWidget *advancedWidget = new QWidget(d->mAppearanceTabCtl);
00120     d->mPrfsAdvanced.setupUi(advancedWidget);
00121     addConfig( Kopete::AppearanceSettings::self(), advancedWidget );
00122     connect ( d->mPrfsAdvanced.kcfg_contactListResizeAnchor, SIGNAL (toggled(bool)), this, SLOT (emitChanged()));
00123 
00124     d->mAppearanceTabCtl->addTab(advancedWidget, i18n("Advanced"));
00125 
00126     // ==========================================================================
00127 
00128     load();
00129 }
00130 
00131 AppearanceConfig::~AppearanceConfig()
00132 {
00133     delete d;
00134 }
00135 
00136 void AppearanceConfig::save()
00137 {
00138     KCModule::save();
00139 //  kDebug(14000) << "called.";
00140 
00141     Kopete::AppearanceSettings *settings = Kopete::AppearanceSettings::self();
00142     settings->setContactListAutoResize (d->mPrfsAdvanced.kcfg_contactListResizeAnchor->isChecked());
00143 
00144     settings->writeConfig();
00145 
00146     load();
00147 }
00148 
00149 void AppearanceConfig::load()
00150 {
00151     KCModule::load();
00152     d->mPrfsAdvanced.kcfg_contactListResizeAnchor->setChecked(Kopete::AppearanceSettings::contactListAutoResize ());
00153 
00154 //  kDebug(14000) << "called";
00155 }
00156 
00157 void AppearanceConfig::slotHighlightChanged()
00158 {
00159 //  bool value = mPrfsChatWindow->highlightEnabled->isChecked();
00160 //  mPrfsChatWindow->foregroundColor->setEnabled ( value );
00161 //  mPrfsChatWindow->backgroundColor->setEnabled ( value );
00162 //  slotUpdateChatPreview();
00163 }
00164 
00165 void AppearanceConfig::slotChangeFont()
00166 {
00167     emitChanged();
00168 }
00169 
00170 void AppearanceConfig::emitChanged()
00171 {
00172     emit changed( true );
00173 }
00174 
00175 void AppearanceConfig::slotEditTooltips()
00176 {
00177     TooltipEditDialog *dlg = new TooltipEditDialog(this);
00178     connect(dlg, SIGNAL(changed(bool)), this, SIGNAL(changed(bool)));
00179     dlg->exec();
00180     delete dlg;
00181 }
00182 
00183 #include "appearanceconfig.moc"
00184 // vim: set noet ts=4 sts=4 sw=4:

kopete/kopete

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

kdenetwork

Skip menu "kdenetwork"
  • kget
  • kopete
  •   kopete
  •   libkopete
  •       libpapillon
  • krfb
Generated for kdenetwork by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal