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 ************************************************************************ *
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 *
15 **************************************************************************
20 #include <qcheckbox.h>
21 #include <qgroupbox.h>
25 #include <knuminput.h>
26 #include <kapplication.h>
27 #include <kgenericfactory.h>
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 );
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() {
63 void URLPicPreviewPreferences::load() {
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() {
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 ();
91 #include "urlpicpreviewpreferences.moc"