Make a branch to make krunner Good Enough For Aaron™.
[kdebase/uwolfer.git] / workspace / kcontrol / style / keramik / keramikconf.cpp
blob3aff733447705feb37e98dcd1c4a0e5afe8762b9
1 /*
2 Copyright (c) 2003 Maksim Orlovich <maksim.orlovich@kdemail.net>
4 Permission is hereby granted, free of charge, to any person obtaining a
5 copy of this software and associated documentation files (the "Software"),
6 to deal in the Software without restriction, including without limitation
7 the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 and/or sell copies of the Software, and to permit persons to whom the
9 Software is furnished to do so, subject to the following conditions:
11 The above copyright notice and this permission notice shall be included in
12 all copies or substantial portions of the Software.
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 DEALINGS IN THE SOFTWARE.
24 #include <QCheckBox>
25 #include <QLayout>
26 #include <QtCore/QSettings>
27 #include <kdialog.h>
28 #include <kglobal.h>
29 #include <klocale.h>
31 #include "keramikconf.h"
33 extern "C"
35 KDE_EXPORT QWidget* allocate_kstyle_config(QWidget* parent)
37 return new KeramikStyleConfig(parent);
41 KeramikStyleConfig::KeramikStyleConfig(QWidget* parent): QWidget(parent)
43 //Should have no margins here, the dialog provides them
44 QVBoxLayout* layout = new QVBoxLayout(this);
45 layout->setMargin(0);
46 layout->setSpacing(0);
47 KGlobal::locale()->insertCatalog("kstyle_keramik_config");
49 //highlightLineEdits = new QCheckBox(i18n("Highlight active lineedits"), this);
50 highlightScrollBar = new QCheckBox(i18n("Highlight scroll bar handles"), this);
51 animateProgressBar = new QCheckBox(i18n("Animate progress bars"), this);
53 //layout->addWidget(highlightLineEdits);
54 layout->addWidget(highlightScrollBar);
55 layout->addWidget(animateProgressBar);
56 layout->addStretch(1);
58 QSettings s;
59 //origHlLineEdit = s.value("/keramik/Settings/highlightLineEdits", false).toBool();
60 //highlightLineEdits->setChecked(origHlLineEdit);
62 origHlScrollbar = s.value("/keramik/Settings/highlightScrollBar", true).toBool();
63 highlightScrollBar->setChecked(origHlScrollbar);
65 origAnimProgressBar = s.value("/keramik/Settings/animateProgressBar", false).toBool();
66 animateProgressBar->setChecked(origAnimProgressBar);
68 //connect(highlightLineEdits, SIGNAL( toggled(bool) ), SLOT( updateChanged() ) );
69 connect(highlightScrollBar, SIGNAL( toggled(bool) ), SLOT( updateChanged() ) );
70 connect(animateProgressBar, SIGNAL( toggled(bool) ), SLOT( updateChanged() ) );
73 KeramikStyleConfig::~KeramikStyleConfig()
75 KGlobal::locale()->removeCatalog("kstyle_keramik_config");
79 void KeramikStyleConfig::save()
81 QSettings s;
82 //s.setValue("/keramik/Settings/highlightLineEdits", highlightLineEdits->isChecked());
83 s.setValue("/keramik/Settings/highlightScrollBar", highlightScrollBar->isChecked());
84 s.setValue("/keramik/Settings/animateProgressBar", animateProgressBar->isChecked());
87 void KeramikStyleConfig::defaults()
89 //highlightLineEdits->setChecked(false);
90 highlightScrollBar->setChecked(true);
91 animateProgressBar->setChecked(false);
92 //updateChanged would be done by setChecked already
95 void KeramikStyleConfig::updateChanged()
97 if ( /*(highlightLineEdits->isChecked() == origHlLineEdit) &&*/
98 (highlightScrollBar->isChecked() == origHlScrollbar) &&
99 (animateProgressBar->isChecked() == origAnimProgressBar) )
100 emit changed(false);
101 else
102 emit changed(true);
105 #include "keramikconf.moc"