From 4aed2c8219774f5d797760606b8489a92ddc5163 Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kcontrol/kicker/advancedDialog.cpp | 163 +++++++++++++++++++++++++++++++++++++ 1 file changed, 163 insertions(+) create mode 100644 kcontrol/kicker/advancedDialog.cpp (limited to 'kcontrol/kicker/advancedDialog.cpp') diff --git a/kcontrol/kicker/advancedDialog.cpp b/kcontrol/kicker/advancedDialog.cpp new file mode 100644 index 000000000..4605cbb09 --- /dev/null +++ b/kcontrol/kicker/advancedDialog.cpp @@ -0,0 +1,163 @@ +/* + * advancedDialog.cpp + * + * Copyright (c) 2002 Aaron J. Seigo + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + */ + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "advancedDialog.h" +#include "advancedOptions.h" +#include "main.h" + +advancedDialog::advancedDialog(QWidget* parent, const char* name) + : KDialogBase(KDialogBase::Plain, + i18n("Advanced Options"), + Ok|Apply|Cancel, + Cancel, + parent, + name, + false, false) +{ + connect(this, SIGNAL(applyClicked()), + this, SLOT(save())); + connect(this, SIGNAL(okClicked()), + this, SLOT(save())); + + QFrame* page = plainPage(); + QVBoxLayout* layout = new QVBoxLayout(page); + m_advancedWidget = new advancedKickerOptions(page); + layout->addWidget(m_advancedWidget); + layout->addStretch(); + + setMinimumSize( sizeHint() ); + + connect(m_advancedWidget->handles, SIGNAL(clicked(int)), + this, SLOT(changed())); + connect(m_advancedWidget->hideButtonSize, SIGNAL(valueChanged(int)), + this, SLOT(changed())); + connect(m_advancedWidget->tintColorB, SIGNAL(clicked()), + this, SLOT(changed())); + connect(m_advancedWidget->tintSlider, SIGNAL(valueChanged(int)), + this, SLOT(changed())); + connect(m_advancedWidget->menubarPanelTransparent, SIGNAL(clicked()), + this, SLOT(changed())); + load(); +} + +advancedDialog::~advancedDialog() +{ +} + +void advancedDialog::load() +{ + KConfig c(KickerConfig::the()->configName(), false, false); + c.setGroup("General"); + + bool fadedOut = c.readBoolEntry("FadeOutAppletHandles", true); + bool hideHandles = c.readBoolEntry("HideAppletHandles", false); + if (hideHandles) + m_advancedWidget->hideHandles->setChecked(true); + else if (fadedOut) + m_advancedWidget->fadeOutHandles->setChecked(true); + else + m_advancedWidget->visibleHandles->setChecked(true); + + int defaultHideButtonSize = c.readNumEntry("HideButtonSize", 14); + m_advancedWidget->hideButtonSize->setValue(defaultHideButtonSize); + QColor color = c.readColorEntry( "TintColor", &colorGroup().mid() ); + m_advancedWidget->tintColorB->setColor( color ); + int tintValue = c.readNumEntry( "TintValue", 33 ); + m_advancedWidget->tintSlider->setValue( tintValue ); + + bool transparentMenubarPanel = c.readBoolEntry("MenubarPanelTransparent", false); + m_advancedWidget->menubarPanelTransparent->setChecked( transparentMenubarPanel ); + + enableButtonApply(false); +} + +void advancedDialog::save() +{ + KConfig c(KickerConfig::the()->configName(), false, false); + + c.setGroup("General"); + c.writeEntry("FadeOutAppletHandles", + m_advancedWidget->fadeOutHandles->isChecked()); + c.writeEntry("HideAppletHandles", + m_advancedWidget->hideHandles->isChecked()); + c.writeEntry("HideButtonSize", + m_advancedWidget->hideButtonSize->value()); + c.writeEntry("TintColor", + m_advancedWidget->tintColorB->color()); + c.writeEntry("TintValue", + m_advancedWidget->tintSlider->value()); + c.writeEntry("MenubarPanelTransparent", + m_advancedWidget->menubarPanelTransparent->isChecked()); + + QStringList elist = c.readListEntry("Extensions2"); + for (QStringList::Iterator it = elist.begin(); it != elist.end(); ++it) + { + // extension id + QString group(*it); + + // is there a config group for this extension? + if(!c.hasGroup(group) || + group.contains("Extension") < 1) + { + continue; + } + + // set config group + c.setGroup(group); + KConfig extConfig(c.readEntry("ConfigFile")); + extConfig.setGroup("General"); + extConfig.writeEntry("FadeOutAppletHandles", + m_advancedWidget->fadeOutHandles->isChecked()); + extConfig.writeEntry("HideAppletHandles", + m_advancedWidget->hideHandles->isChecked()); + extConfig.writeEntry("HideButtonSize", + m_advancedWidget->hideButtonSize->value()); + extConfig.writeEntry("TintColor", + m_advancedWidget->tintColorB->color()); + extConfig.writeEntry("TintValue", + m_advancedWidget->tintSlider->value()); + extConfig.writeEntry("MenubarPanelTransparent", + m_advancedWidget->menubarPanelTransparent->isChecked()); + + extConfig.sync(); + } + + c.sync(); + + KickerConfig::the()->notifyKicker(); + enableButtonApply(false); +} + +void advancedDialog::changed() +{ + enableButtonApply(true); +} + +#include "advancedDialog.moc" + -- cgit v1.2.1