Show invite menu in wlm chat window immediately
[kdenetwork.git] / kopete / plugins / urlpicpreview / urlpicpreviewpreferences.cpp
blob2d2059610a2698d5e2e2d9204d587b964df31da5
1 /*
2 urlpicpreviewpreferences.cpp
4 Copyright (c) 2005 by Heiko Schaefer <heiko@rangun.de>
6 Kopete (c) 2002-2007 by the Kopete developers <kopete-devel@kde.org>
8 ************************************************************************ *
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; version 2, or (at your option) version 3 *
13 * of the License. *
14 * *
15 **************************************************************************
18 // Qt
19 #include <qlayout.h>
20 #include <qcheckbox.h>
21 #include <qgroupbox.h>
23 // KDE
24 #include <kdebug.h>
25 #include <knuminput.h>
26 #include <kapplication.h>
27 #include <kgenericfactory.h>
28 // Kopete
29 #include "urlpicpreviewconfig.h"
30 #include "ui_urlpicpreviewprefsbase.h"
31 #include "urlpicpreviewpreferences.h"
34 K_PLUGIN_FACTORY(URLPicPreviewPreferencesFactory,
35 registerPlugin<URLPicPreviewPreferences>();
37 K_EXPORT_PLUGIN(URLPicPreviewPreferencesFactory ( "kcm_kopete_urlpicpreview" ))
40 URLPicPreviewPreferences::URLPicPreviewPreferences ( QWidget *parent, const QVariantList &args )
41 : KCModule ( URLPicPreviewPreferencesFactory::componentData(), parent, args )
43 m_ui = new Ui::URLPicPreviewPrefsUI;
44 QWidget * w = new QWidget ( this );
45 m_ui->setupUi ( w );
46 m_layout = new QHBoxLayout ( this );
47 m_layout->addWidget ( w );
49 // don't display link preview features yet
50 m_ui->linkPreviewGroup->hide();
52 connect ( m_ui->enableScaling, SIGNAL ( toggled ( bool ) ), this, SLOT ( changed() ) );
53 connect ( m_ui->previewScaleWidth, SIGNAL ( valueChanged ( int ) ), this, SLOT ( changed() ) );
54 connect ( m_ui->restrictPreviews, SIGNAL ( toggled ( bool ) ), this, SLOT ( changed() ) );
55 connect ( m_ui->previewAmount, SIGNAL ( valueChanged ( int ) ), this, SLOT ( changed() ) );
58 URLPicPreviewPreferences::~URLPicPreviewPreferences() {
59 delete m_ui;
60 delete m_layout;
63 void URLPicPreviewPreferences::load() {
65 kDebug ( 14314 );
67 m_ui->enableScaling->setChecked ( URLPicPreviewConfig::self()->scaling() );
68 m_ui->restrictPreviews->setChecked ( URLPicPreviewConfig::self()->previewRestriction() );
69 m_ui->previewScaleWidth->setValue ( URLPicPreviewConfig::self()->previewScaleWidth() );
70 m_ui->previewAmount->setValue ( URLPicPreviewConfig::self()->previewAmount() );
73 void URLPicPreviewPreferences::save() {
75 kDebug ( 14314 );
77 URLPicPreviewConfig::self()->setScaling ( m_ui->enableScaling->isChecked() );
78 URLPicPreviewConfig::self()->setPreviewRestriction ( m_ui->restrictPreviews->isChecked() );
79 URLPicPreviewConfig::self()->setPreviewScaleWidth ( m_ui->previewScaleWidth->value() );
80 URLPicPreviewConfig::self()->setPreviewAmount ( m_ui->previewAmount->value() );
82 URLPicPreviewConfig::self()->writeConfig();
85 void URLPicPreviewPreferences::defaults() {
86 URLPicPreviewConfig::self()->setDefaults ();
87 load();
88 changed();
91 #include "urlpicpreviewpreferences.moc"