add more spacing
[personal-kdebase.git] / workspace / kcontrol / colors / colorscm.cpp
blob8a9dd0c132e41ad3512819becf5cce367b56c5a5
1 /* KDE Display color scheme setup module
2 * Copyright (C) 2007 Matthew Woehlke <mw_triad@users.sourceforge.net>
3 * Copyright (C) 2007 Jeremy Whiting <jeremy@scitools.com>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; see the file COPYING. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
21 #include "colorscm.h"
23 #include "../krdb/krdb.h"
25 #include <QtCore/QFileInfo>
26 #include <QtGui/QHeaderView>
27 #include <QtGui/QStackedWidget>
28 #include <QtGui/QPainter>
29 #include <QtGui/QBitmap>
30 #include <QtDBus/QtDBus>
32 #include <KAboutData>
33 #include <KColorButton>
34 #include <KColorDialog>
35 #include <KFileDialog>
36 #include <KGenericFactory>
37 #include <KGlobal>
38 #include <KGlobalSettings>
39 #include <KInputDialog>
40 #include <KMessageBox>
41 #include <KStandardDirs>
42 #include <kio/netaccess.h>
43 #include <knewstuff2/engine.h>
45 K_PLUGIN_FACTORY( KolorFactory, registerPlugin<KColorCm>(); )
46 K_EXPORT_PLUGIN( KolorFactory("kcmcolors") )
48 //BEGIN WindecoColors
49 KColorCm::WindecoColors::WindecoColors(const KSharedConfigPtr &config)
51 load(config);
54 void KColorCm::WindecoColors::load(const KSharedConfigPtr &config)
56 // NOTE: keep this in sync with kdelibs/kdeui/kernel/kglobalsettings.cpp
57 KConfigGroup group(config, "WM");
58 m_colors[ActiveBackground] = group.readEntry("activeBackground", QColor(96, 148, 207));
59 m_colors[ActiveForeground] = group.readEntry("activeForeground", QColor(255, 255, 255));
60 m_colors[InactiveBackground] = group.readEntry("inactiveBackground", QColor(224, 223, 222));
61 m_colors[InactiveForeground] = group.readEntry("inactiveForeground", QColor(20, 19, 18));
64 QColor KColorCm::WindecoColors::color(WindecoColors::Role role) const
66 return m_colors[role];
68 //END WindecoColors
70 KColorCm::KColorCm(QWidget *parent, const QVariantList &)
71 : KCModule( KolorFactory::componentData(), parent ), m_disableUpdates(false)
73 KAboutData* about = new KAboutData(
74 "kcmcolors", 0, ki18n("Colors"), 0, KLocalizedString(),
75 KAboutData::License_GPL,
76 ki18n("(c) 2007 Matthew Woehlke")
78 about->addAuthor( ki18n("Matthew Woehlke"), KLocalizedString(),
79 "mw_triad@users.sourceforge.net" );
80 about->addAuthor( ki18n("Jeremy Whiting"), KLocalizedString(), "jeremy@scitools.com");
81 setAboutData( about );
83 m_config = KSharedConfig::openConfig("kdeglobals");
85 setupUi(this);
86 //schemeKnsButton->setIcon( KIcon("get-hot-new-stuff") );
87 connect(colorSet, SIGNAL(currentIndexChanged(int)), this, SLOT(updateColorTable()));
88 connect(schemeList, SIGNAL(currentRowChanged(int)), this, SLOT(loadScheme()));
89 connect(applyToAlien, SIGNAL(toggled(bool)), this, SLOT(emitChanged()));
91 // only needs to be called once
92 setupColorTable();
95 KColorCm::~KColorCm()
97 m_config->markAsClean();
100 void KColorCm::populateSchemeList()
102 // clear the list in case this is being called from reset button click
103 schemeList->clear();
104 // add current scheme entry
105 QIcon icon = createSchemePreviewIcon(m_config);
106 QListWidgetItem *currentitem = new QListWidgetItem(icon, i18nc("Current color scheme", "Current"));
107 schemeList->addItem(currentitem);
108 schemeList->blockSignals(true); // don't emit changed signals
109 schemeList->setCurrentItem(currentitem);
110 schemeList->blockSignals(false);
112 // add default entry
113 m_config->setReadDefaults(true);
114 icon = createSchemePreviewIcon(m_config);
115 schemeList->addItem(new QListWidgetItem(icon, i18nc("Default color scheme", "Default")));
116 m_config->setReadDefaults(false);
118 QStringList schemeFiles = KGlobal::dirs()->findAllResources("data", "color-schemes/*.colors", KStandardDirs::NoDuplicates);
119 for (int i = 0; i < schemeFiles.size(); ++i)
121 // get the file name
122 QString filename = schemeFiles[i];
123 QFileInfo info(filename);
125 // add the entry
126 KSharedConfigPtr config = KSharedConfig::openConfig(filename);
127 icon = createSchemePreviewIcon(config);
128 KConfigGroup group(config, "General");
129 QString name = group.readEntry("Name", info.baseName());
130 QListWidgetItem * newItem = new QListWidgetItem(icon, name);
131 // stash the file basename for use later
132 newItem->setData(Qt::UserRole, info.baseName());
133 schemeList->addItem(newItem);
137 void KColorCm::updatePreviews()
139 schemePreview->setPalette(m_config);
140 colorPreview->setPalette(m_config);
141 setPreview->setPalette(m_config, (KColorScheme::ColorSet)(colorSet->currentIndex() - 1));
142 inactivePreview->setPalette(m_config, QPalette::Inactive);
143 disabledPreview->setPalette(m_config, QPalette::Disabled);
146 void KColorCm::updateEffectsPage()
148 m_disableUpdates = true;
150 // NOTE: keep this in sync with kdelibs/kdeui/colors/kcolorscheme.cpp
151 KConfigGroup groupI(m_config, "ColorEffects:Inactive");
152 inactiveIntensityBox->setCurrentIndex(abs(groupI.readEntry("IntensityEffect", 0)));
153 inactiveIntensitySlider->setValue(int(groupI.readEntry("IntensityAmount", 0.0) * 20.0) + 20);
154 inactiveColorBox->setCurrentIndex(abs(groupI.readEntry("ColorEffect", 2)));
155 if (inactiveColorBox->currentIndex() > 1)
157 inactiveColorSlider->setValue(int(groupI.readEntry("ColorAmount", 0.025) * 40.0));
159 else
161 inactiveColorSlider->setValue(int(groupI.readEntry("ColorAmount", 0.05) * 20.0) + 20);
163 inactiveColorButton->setColor(groupI.readEntry("Color", QColor(112, 111, 110)));
164 inactiveContrastBox->setCurrentIndex(abs(groupI.readEntry("ContrastEffect", 2)));
165 inactiveContrastSlider->setValue(int(groupI.readEntry("ContrastAmount", 0.1) * 20.0));
167 // NOTE: keep this in sync with kdelibs/kdeui/colors/kcolorscheme.cpp
168 KConfigGroup groupD(m_config, "ColorEffects:Disabled");
169 disabledIntensityBox->setCurrentIndex(groupD.readEntry("IntensityEffect", 2));
170 disabledIntensitySlider->setValue(int(groupD.readEntry("IntensityAmount", 0.1) * 20.0) + 20);
171 disabledColorBox->setCurrentIndex(groupD.readEntry("ColorEffect", 0));
172 if (disabledColorBox->currentIndex() > 1)
174 disabledColorSlider->setValue(int(groupD.readEntry("ColorAmount", 0.0) * 40.0));
176 else
178 disabledColorSlider->setValue(int(groupD.readEntry("ColorAmount", 0.0) * 20.0) + 20);
180 disabledColorButton->setColor(groupD.readEntry("Color", QColor(112, 111, 110)));
181 disabledContrastBox->setCurrentIndex(groupD.readEntry("ContrastEffect", 1));
182 disabledContrastSlider->setValue(int(groupD.readEntry("ContrastAmount", 0.65) * 20.0));
184 m_disableUpdates = false;
186 // enable/disable controls
187 inactiveIntensitySlider->setDisabled(inactiveIntensityBox->currentIndex() == 0);
188 disabledIntensitySlider->setDisabled(disabledIntensityBox->currentIndex() == 0);
189 inactiveColorSlider->setDisabled(inactiveColorBox->currentIndex() == 0);
190 disabledColorSlider->setDisabled(disabledColorBox->currentIndex() == 0);
191 inactiveColorButton->setDisabled(inactiveColorBox->currentIndex() < 2);
192 disabledColorButton->setDisabled(disabledColorBox->currentIndex() < 2);
193 inactiveContrastSlider->setDisabled(inactiveContrastBox->currentIndex() == 0);
194 disabledContrastSlider->setDisabled(disabledContrastBox->currentIndex() == 0);
197 void KColorCm::loadScheme(KSharedConfigPtr config) // const QString &path)
199 KSharedConfigPtr temp = m_config;
200 m_config = config;
202 updateColorSchemes();
203 updateEffectsPage(); // intentionally before swapping back m_config
205 m_config = temp;
206 updateFromColorSchemes();
207 updateFromEffectsPage();
208 updateFromOptions();
209 updateColorTable();
210 updatePreviews();
212 //m_changed = false;
215 void KColorCm::loadScheme()
217 if (schemeList->currentItem() != NULL)
219 QString name = schemeList->currentItem()->text();
220 QString fileBaseName = schemeList->currentItem()->data(Qt::UserRole).toString();
221 if (name == i18nc("Default color scheme", "Default"))
223 schemeRemoveButton->setEnabled(false);
225 KSharedConfigPtr config = m_config;
226 config->setReadDefaults(true);
227 loadScheme(config);
228 config->setReadDefaults(false);
229 // load the default scheme
230 emit changed(true);
232 else if (name == i18nc("Current color scheme", "Current"))
234 schemeRemoveButton->setEnabled(false);
235 loadInternal(false);
237 else
239 QString path = KGlobal::dirs()->findResource("data",
240 "color-schemes/" + fileBaseName + ".colors");
242 int permissions = QFile(path).permissions();
243 bool canWrite = (permissions & QFile::WriteUser);
244 kDebug() << "checking permissions of " << path;
245 schemeRemoveButton->setEnabled(canWrite);
247 if (0) // TODO if changes made to loaded scheme
249 if (KMessageBox::Continue != KMessageBox::warningContinueCancel(this,
250 i18n("Selecting another scheme will discard any changes you have made"),
251 i18n("Are you sure?"),
252 KStandardGuiItem::cont(),
253 KStandardGuiItem::cancel(),
254 "noDiscardWarning"))
256 return;
260 KSharedConfigPtr config = KSharedConfig::openConfig(path);
261 loadScheme(config);
263 emit changed(true);
268 void KColorCm::on_schemeRemoveButton_clicked()
270 if (schemeList->currentItem() != NULL)
272 QString path = KGlobal::dirs()->findResource("data",
273 "color-schemes/" + schemeList->currentItem()->data(Qt::UserRole).toString() +
274 ".colors");
275 if (KIO::NetAccess::del(path, this))
277 delete schemeList->takeItem(schemeList->currentRow());
279 else
281 // deletion failed, so show an error message
282 KMessageBox::error(this, i18n("You do not have permission to delete that scheme"), i18n("Error"));
287 void KColorCm::on_schemeImportButton_clicked()
289 // get the path to the scheme to import
290 KUrl url = KFileDialog::getOpenUrl(KUrl(), QString(), this, i18n("Import Color Scheme"));
292 if(url.isValid())
294 // TODO: possibly untar or uncompress it
295 // open it
297 // load the scheme
298 KSharedConfigPtr config = KSharedConfig::openConfig(url.path());
299 loadScheme(config);
301 // save it
302 saveScheme(url.fileName());
306 void KColorCm::on_schemeKnsButton_clicked()
308 KNS::Engine engine(this);
309 if (engine.init("colorschemes.knsrc")) {
312 KNS::Entry::List entries = engine.downloadDialogModal(this);
313 if (entries.size() > 0)
315 populateSchemeList();
320 void KColorCm::on_schemeSaveButton_clicked()
322 QString previousName;
323 if (schemeList->currentItem() != NULL)
325 previousName = schemeList->currentItem()->data(Qt::DisplayRole).toString();
327 // prompt for the name to save as
328 bool ok;
329 QString name = KInputDialog::getText(i18n("Save Color Scheme"),
330 i18n("&Enter a name for the color scheme:"), previousName, &ok, this);
331 if (ok)
333 saveScheme(name);
337 void KColorCm::saveScheme(const QString &name)
339 QString filename = name;
340 filename.remove('\''); // So Foo's does not become FooS
341 QRegExp fixer("[\\W,.-]+(.?)");
342 int offset;
343 while ((offset = fixer.indexIn(filename)) >= 0)
344 filename.replace(offset, fixer.matchedLength(), fixer.cap(1).toUpper());
345 filename.replace(0, 1, filename.at(0).toUpper());
347 // check if that name is already in the list
348 QString path = KGlobal::dirs()->saveLocation("data", "color-schemes/") +
349 filename + ".colors";
351 QFile file(path);
352 int permissions = file.permissions();
353 bool canWrite = (permissions & QFile::WriteUser);
354 // or if we can overwrite it if it exists
355 if (path.isEmpty() || !file.exists() ||
356 (canWrite && KMessageBox::questionYesNo(this,
357 i18n("A color scheme with that name already exists.\nDo you want to overwrite it?"),
358 i18n("Save Color Scheme"),
359 KStandardGuiItem::overwrite(),
360 KStandardGuiItem::cancel())
361 == KMessageBox::Yes))
363 // go ahead and save it
364 QString newpath = KGlobal::dirs()->saveLocation("data", "color-schemes/");
365 newpath += filename + ".colors";
366 KSharedConfigPtr temp = m_config;
367 m_config = KSharedConfig::openConfig(newpath);
368 // then copy current colors into new config
369 updateFromColorSchemes();
370 updateFromEffectsPage();
371 KConfigGroup group(m_config, "General");
372 group.writeEntry("Name", name);
373 // sync it
374 m_config->sync();
376 QList<QListWidgetItem*> foundItems = schemeList->findItems(name, Qt::MatchExactly);
377 QIcon icon = createSchemePreviewIcon(m_config);
378 if (foundItems.size() < 1)
380 // add it to the list since it's not in there already
381 QListWidgetItem * newItem = new QListWidgetItem(icon, name);
382 newItem->setData(Qt::UserRole, filename);
383 schemeList->addItem(newItem);
385 // then select the new item
386 schemeList->setCurrentRow(schemeList->count() - 1);
388 else
390 // update the icon of the one that's in the list
391 foundItems[0]->setIcon(icon);
392 schemeList->setCurrentRow(schemeList->row(foundItems[0]));
395 // set m_config back to the system one
396 m_config = temp;
397 emit changed(false);
399 else if (!canWrite && file.exists())
401 // give error message if !canWrite && file.exists()
402 KMessageBox::error(this, i18n("You do not have permission to overwrite that scheme"), i18n("Error"));
406 void KColorCm::createColorEntry(QString text, QString key, QList<KColorButton *> &list, int index)
408 KColorButton *button = new KColorButton(this);
409 button->setObjectName(QString::number(index));
410 connect(button, SIGNAL(changed(const QColor &)), this, SLOT(colorChanged(const QColor &)));
411 list.append(button);
413 m_colorKeys.insert(index, key);
415 QTableWidgetItem *label = new QTableWidgetItem(text);
416 colorTable->setItem(index, 0, label);
417 colorTable->setCellWidget(index, 1, button);
420 void KColorCm::variesClicked()
422 // find which button was changed
423 int row = sender()->objectName().toInt();
425 QColor color;
426 if(KColorDialog::getColor(color, this ) != QDialog::Rejected )
428 changeColor(row, color);
429 m_stackedWidgets[row - 9]->setCurrentIndex(0);
433 QPixmap KColorCm::createSchemePreviewIcon(const KSharedConfigPtr &config)
435 const WindecoColors wm(config);
436 const uchar bits1[] = { 0xff, 0xff, 0xff, 0x2c, 0x16, 0x0b };
437 const uchar bits2[] = { 0x68, 0x34, 0x1a, 0xff, 0xff, 0xff };
438 const QSize bitsSize(24,2);
439 const QBitmap b1 = QBitmap::fromData(bitsSize, bits1);
440 const QBitmap b2 = QBitmap::fromData(bitsSize, bits2);
442 QPixmap pixmap(23, 16);
443 pixmap.fill(Qt::black); // ### use some color other than black for borders?
445 QPainter p(&pixmap);
447 KColorScheme windowScheme(QPalette::Active, KColorScheme::Window, config);
448 p.fillRect( 1, 1, 7, 7, windowScheme.background());
449 p.fillRect( 2, 2, 5, 2, QBrush(windowScheme.foreground().color(), b1));
451 KColorScheme buttonScheme(QPalette::Active, KColorScheme::Button, config);
452 p.fillRect( 8, 1, 7, 7, buttonScheme.background());
453 p.fillRect( 9, 2, 5, 2, QBrush(buttonScheme.foreground().color(), b1));
455 p.fillRect(15, 1, 7, 7, wm.color(WindecoColors::ActiveBackground));
456 p.fillRect(16, 2, 5, 2, QBrush(wm.color(WindecoColors::ActiveForeground), b1));
458 KColorScheme viewScheme(QPalette::Active, KColorScheme::View, config);
459 p.fillRect( 1, 8, 7, 7, viewScheme.background());
460 p.fillRect( 2, 12, 5, 2, QBrush(viewScheme.foreground().color(), b2));
462 KColorScheme selectionScheme(QPalette::Active, KColorScheme::Selection, config);
463 p.fillRect( 8, 8, 7, 7, selectionScheme.background());
464 p.fillRect( 9, 12, 5, 2, QBrush(selectionScheme.foreground().color(), b2));
466 p.fillRect(15, 8, 7, 7, wm.color(WindecoColors::InactiveBackground));
467 p.fillRect(16, 12, 5, 2, QBrush(wm.color(WindecoColors::InactiveForeground), b2));
469 p.end();
471 return pixmap;
474 void KColorCm::updateColorSchemes()
476 m_colorSchemes.clear();
478 m_colorSchemes.append(KColorScheme(QPalette::Active, KColorScheme::View, m_config));
479 m_colorSchemes.append(KColorScheme(QPalette::Active, KColorScheme::Window, m_config));
480 m_colorSchemes.append(KColorScheme(QPalette::Active, KColorScheme::Button, m_config));
481 m_colorSchemes.append(KColorScheme(QPalette::Active, KColorScheme::Selection, m_config));
482 m_colorSchemes.append(KColorScheme(QPalette::Active, KColorScheme::Tooltip, m_config));
484 m_wmColors.load(m_config);
487 void KColorCm::updateFromColorSchemes()
489 for (int i = KColorScheme::View; i <= KColorScheme::Tooltip; ++i)
491 KConfigGroup group(m_config, colorSetGroupKey(i));
492 group.writeEntry("BackgroundNormal", m_colorSchemes[i].background(KColorScheme::NormalBackground).color());
493 group.writeEntry("BackgroundAlternate", m_colorSchemes[i].background(KColorScheme::AlternateBackground).color());
494 group.writeEntry("ForegroundNormal", m_colorSchemes[i].foreground(KColorScheme::NormalText).color());
495 group.writeEntry("ForegroundInactive", m_colorSchemes[i].foreground(KColorScheme::InactiveText).color());
496 group.writeEntry("ForegroundActive", m_colorSchemes[i].foreground(KColorScheme::ActiveText).color());
497 group.writeEntry("ForegroundLink", m_colorSchemes[i].foreground(KColorScheme::LinkText).color());
498 group.writeEntry("ForegroundVisited", m_colorSchemes[i].foreground(KColorScheme::VisitedText).color());
499 group.writeEntry("ForegroundNegative", m_colorSchemes[i].foreground(KColorScheme::NegativeText).color());
500 group.writeEntry("ForegroundNeutral", m_colorSchemes[i].foreground(KColorScheme::NeutralText).color());
501 group.writeEntry("ForegroundPositive", m_colorSchemes[i].foreground(KColorScheme::PositiveText).color());
502 group.writeEntry("DecorationFocus", m_colorSchemes[i].decoration(KColorScheme::FocusColor).color());
503 group.writeEntry("DecorationHover", m_colorSchemes[i].decoration(KColorScheme::HoverColor).color());
506 KConfigGroup WMGroup(m_config, "WM");
507 WMGroup.writeEntry("activeBackground", m_wmColors.color(WindecoColors::ActiveBackground));
508 WMGroup.writeEntry("activeForeground", m_wmColors.color(WindecoColors::ActiveForeground));
509 WMGroup.writeEntry("inactiveBackground", m_wmColors.color(WindecoColors::InactiveBackground));
510 WMGroup.writeEntry("inactiveForeground", m_wmColors.color(WindecoColors::InactiveForeground));
513 void KColorCm::updateFromOptions()
515 KConfigGroup groupK(m_config, "KDE");
516 groupK.writeEntry("contrast", contrastSlider->value());
518 KConfigGroup groupG(m_config, "General");
519 groupG.writeEntry("shadeSortColumn", bool(shadeSortedColumn->checkState() != Qt::Unchecked));
521 KConfigGroup groupI(m_config, "ColorEffects:Inactive");
522 groupI.writeEntry("Enable", bool(useInactiveEffects->checkState() != Qt::Unchecked));
523 // only write this setting if it is not the default; this way we can change the default more easily in later KDE
524 // the setting will still written by explicitly checking/unchecking the box
525 if (inactiveSelectionEffect->checkState() != Qt::Unchecked)
527 groupI.writeEntry("ChangeSelectionColor", true);
529 else
531 groupI.deleteEntry("ChangeSelectionColor");
535 void KColorCm::updateFromEffectsPage()
537 if (m_disableUpdates)
539 // don't write the config as we are reading it!
540 return;
543 KConfigGroup groupI(m_config, "ColorEffects:Inactive");
544 KConfigGroup groupD(m_config, "ColorEffects:Disabled");
546 // intensity
547 groupI.writeEntry("IntensityEffect", inactiveIntensityBox->currentIndex());
548 groupD.writeEntry("IntensityEffect", disabledIntensityBox->currentIndex());
549 groupI.writeEntry("IntensityAmount", qreal(inactiveIntensitySlider->value() - 20) * 0.05);
550 groupD.writeEntry("IntensityAmount", qreal(disabledIntensitySlider->value() - 20) * 0.05);
552 // color
553 groupI.writeEntry("ColorEffect", inactiveColorBox->currentIndex());
554 groupD.writeEntry("ColorEffect", disabledColorBox->currentIndex());
555 if (inactiveColorBox->currentIndex() > 1)
557 groupI.writeEntry("ColorAmount", qreal(inactiveColorSlider->value()) * 0.025);
559 else
561 groupI.writeEntry("ColorAmount", qreal(inactiveColorSlider->value() - 20) * 0.05);
563 if (disabledColorBox->currentIndex() > 1)
565 groupD.writeEntry("ColorAmount", qreal(disabledColorSlider->value()) * 0.025);
567 else
569 groupD.writeEntry("ColorAmount", qreal(disabledColorSlider->value() - 20) * 0.05);
571 groupI.writeEntry("Color", inactiveColorButton->color());
572 groupD.writeEntry("Color", disabledColorButton->color());
574 // contrast
575 groupI.writeEntry("ContrastEffect", inactiveContrastBox->currentIndex());
576 groupD.writeEntry("ContrastEffect", disabledContrastBox->currentIndex());
577 groupI.writeEntry("ContrastAmount", qreal(inactiveContrastSlider->value()) * 0.05);
578 groupD.writeEntry("ContrastAmount", qreal(disabledContrastSlider->value()) * 0.05);
580 // enable/disable controls
581 inactiveIntensitySlider->setDisabled(inactiveIntensityBox->currentIndex() == 0);
582 disabledIntensitySlider->setDisabled(disabledIntensityBox->currentIndex() == 0);
583 inactiveColorSlider->setDisabled(inactiveColorBox->currentIndex() == 0);
584 disabledColorSlider->setDisabled(disabledColorBox->currentIndex() == 0);
585 inactiveColorButton->setDisabled(inactiveColorBox->currentIndex() < 2);
586 disabledColorButton->setDisabled(disabledColorBox->currentIndex() < 2);
587 inactiveContrastSlider->setDisabled(inactiveContrastBox->currentIndex() == 0);
588 disabledContrastSlider->setDisabled(disabledContrastBox->currentIndex() == 0);
591 void KColorCm::setupColorTable()
593 // first setup the common colors table
594 commonColorTable->verticalHeader()->hide();
595 commonColorTable->horizontalHeader()->hide();
596 commonColorTable->setShowGrid(false);
597 commonColorTable->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch);
598 int minWidth = QPushButton(i18n("Varies")).minimumSizeHint().width();
599 commonColorTable->horizontalHeader()->setMinimumSectionSize(minWidth);
600 commonColorTable->horizontalHeader()->setResizeMode(1, QHeaderView::ResizeToContents);
602 for (int i = 0; i < 24; ++i)
604 KColorButton * button = new KColorButton(this);
605 button->setObjectName(QString::number(i));
606 connect(button, SIGNAL(changed(const QColor &)), this, SLOT(colorChanged(const QColor &)));
607 m_commonColorButtons << button;
609 if (i > 8 && i < 18)
611 // Inactive Text row through Positive Text role all need a varies button
612 KPushButton * variesButton = new KPushButton(NULL);
613 variesButton->setText(i18n("Varies"));
614 variesButton->setObjectName(QString::number(i));
615 connect(variesButton, SIGNAL(clicked()), this, SLOT(variesClicked()));
617 QStackedWidget * widget = new QStackedWidget(this);
618 widget->addWidget(button);
619 widget->addWidget(variesButton);
620 m_stackedWidgets.append(widget);
622 commonColorTable->setCellWidget(i, 1, widget);
624 else
626 commonColorTable->setCellWidget(i, 1, button);
630 // then the colorTable that the colorSets will use
631 colorTable->verticalHeader()->hide();
632 colorTable->horizontalHeader()->hide();
633 colorTable->setShowGrid(false);
634 colorTable->setRowCount(12);
635 colorTable->horizontalHeader()->setMinimumSectionSize(minWidth);
636 colorTable->horizontalHeader()->setResizeMode(1, QHeaderView::ResizeToContents);
638 createColorEntry(i18n("Normal Background"), "BackgroundNormal", m_backgroundButtons, 0);
639 createColorEntry(i18n("Alternate Background"), "BackgroundAlternate", m_backgroundButtons, 1);
640 createColorEntry(i18n("Normal Text"), "ForegroundNormal", m_foregroundButtons, 2);
641 createColorEntry(i18n("Inactive Text"), "ForegroundInactive", m_foregroundButtons, 3);
642 createColorEntry(i18n("Active Text"), "ForegroundActive", m_foregroundButtons, 4);
643 createColorEntry(i18n("Link Text"), "ForegroundLink", m_foregroundButtons, 5);
644 createColorEntry(i18n("Visited Text"), "ForegroundVisited", m_foregroundButtons, 6);
645 createColorEntry(i18n("Negative Text"), "ForegroundNegative", m_foregroundButtons, 7);
646 createColorEntry(i18n("Neutral Text"), "ForegroundNeutral", m_foregroundButtons, 8);
647 createColorEntry(i18n("Positive Text"), "ForegroundPositive", m_foregroundButtons, 9);
648 createColorEntry(i18n("Focus Decoration"), "DecorationFocus", m_decorationButtons, 10);
649 createColorEntry(i18n("Hover Decoration"), "DecorationHover", m_decorationButtons, 11);
651 colorTable->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch);
652 colorTable->horizontalHeader()->setResizeMode(1, QHeaderView::ResizeToContents);
654 updateColorSchemes();
655 updateColorTable();
658 void KColorCm::setCommonForeground(KColorScheme::ForegroundRole role, int stackIndex,
659 int buttonIndex)
661 QColor color = m_colorSchemes[KColorScheme::View].foreground(role).color();
662 for (int i = KColorScheme::Window; i < KColorScheme::Tooltip; ++i)
664 if (i == KColorScheme::Selection && role == KColorScheme::InactiveText)
665 break;
667 if (m_colorSchemes[i].foreground(role).color() != color)
669 m_stackedWidgets[stackIndex]->setCurrentIndex(1);
670 return;
674 m_stackedWidgets[stackIndex]->setCurrentIndex(0);
675 m_commonColorButtons[buttonIndex]->setColor(color);
678 void KColorCm::setCommonDecoration(KColorScheme::DecorationRole role, int stackIndex,
679 int buttonIndex)
681 QColor color = m_colorSchemes[KColorScheme::View].decoration(role).color();
682 for (int i = KColorScheme::Window; i < KColorScheme::Tooltip; ++i)
684 if (m_colorSchemes[i].decoration(role).color() != color)
686 m_stackedWidgets[stackIndex]->setCurrentIndex(1);
687 return;
691 m_stackedWidgets[stackIndex]->setCurrentIndex(0);
692 m_commonColorButtons[buttonIndex]->setColor(color);
695 void KColorCm::updateColorTable()
697 // subtract one here since the 0 item is "Common Colors"
698 int currentSet = colorSet->currentIndex() - 1;
700 if (currentSet == -1)
702 // common colors is selected
703 stackColors->setCurrentIndex(0);
704 stackPreview->setCurrentIndex(0);
706 KColorButton * button;
707 foreach (button, m_commonColorButtons)
709 button->blockSignals(true);
712 m_commonColorButtons[0]->setColor(m_colorSchemes[KColorScheme::View].background(KColorScheme::NormalBackground).color());
713 m_commonColorButtons[1]->setColor(m_colorSchemes[KColorScheme::View].foreground(KColorScheme::NormalText).color());
714 m_commonColorButtons[2]->setColor(m_colorSchemes[KColorScheme::Window].background(KColorScheme::NormalBackground).color());
715 m_commonColorButtons[3]->setColor(m_colorSchemes[KColorScheme::Window].foreground(KColorScheme::NormalText).color());
716 m_commonColorButtons[4]->setColor(m_colorSchemes[KColorScheme::Button].background(KColorScheme::NormalBackground).color());
717 m_commonColorButtons[5]->setColor(m_colorSchemes[KColorScheme::Button].foreground(KColorScheme::NormalText).color());
718 m_commonColorButtons[6]->setColor(m_colorSchemes[KColorScheme::Selection].background(KColorScheme::NormalBackground).color());
719 m_commonColorButtons[7]->setColor(m_colorSchemes[KColorScheme::Selection].foreground(KColorScheme::NormalText).color());
720 m_commonColorButtons[8]->setColor(m_colorSchemes[KColorScheme::Selection].foreground(KColorScheme::InactiveText).color());
722 setCommonForeground(KColorScheme::InactiveText, 0, 9);
723 setCommonForeground(KColorScheme::ActiveText, 1, 10);
724 setCommonForeground(KColorScheme::LinkText, 2, 11);
725 setCommonForeground(KColorScheme::VisitedText, 3, 12);
726 setCommonForeground(KColorScheme::NegativeText, 4, 13);
727 setCommonForeground(KColorScheme::NeutralText, 5, 14);
728 setCommonForeground(KColorScheme::PositiveText, 6, 15);
730 setCommonDecoration(KColorScheme::FocusColor, 7, 16);
731 setCommonDecoration(KColorScheme::HoverColor, 8, 17);
733 m_commonColorButtons[18]->setColor(m_colorSchemes[KColorScheme::Tooltip].background(KColorScheme::NormalBackground).color());
734 m_commonColorButtons[19]->setColor(m_colorSchemes[KColorScheme::Tooltip].foreground(KColorScheme::NormalText).color());
736 m_commonColorButtons[20]->setColor(m_wmColors.color(WindecoColors::ActiveBackground));
737 m_commonColorButtons[21]->setColor(m_wmColors.color(WindecoColors::ActiveForeground));
738 m_commonColorButtons[22]->setColor(m_wmColors.color(WindecoColors::InactiveBackground));
739 m_commonColorButtons[23]->setColor(m_wmColors.color(WindecoColors::InactiveForeground));
741 foreach (button, m_commonColorButtons)
743 button->blockSignals(false);
746 else
748 // a real color set is selected
749 setPreview->setPalette(m_config, (KColorScheme::ColorSet)currentSet);
750 stackColors->setCurrentIndex(1);
751 stackPreview->setCurrentIndex(1);
753 for (int i = KColorScheme::NormalBackground; i <= KColorScheme::AlternateBackground; ++i)
755 m_backgroundButtons[i]->blockSignals(true);
756 m_backgroundButtons[i]->setColor(m_colorSchemes[currentSet].background(KColorScheme::BackgroundRole(i)).color());
757 m_backgroundButtons[i]->blockSignals(false);
760 for (int i = KColorScheme::NormalText; i <= KColorScheme::PositiveText; ++i)
762 m_foregroundButtons[i]->blockSignals(true);
763 m_foregroundButtons[i]->setColor(m_colorSchemes[currentSet].foreground(KColorScheme::ForegroundRole(i)).color());
764 m_foregroundButtons[i]->blockSignals(false);
767 for (int i = KColorScheme::FocusColor; i <= KColorScheme::HoverColor; ++i)
769 m_decorationButtons[i]->blockSignals(true);
770 m_decorationButtons[i]->setColor(m_colorSchemes[currentSet].decoration(KColorScheme::DecorationRole(i)).color());
771 m_decorationButtons[i]->blockSignals(false);
776 void KColorCm::colorChanged( const QColor &newColor )
778 // find which button was changed
779 int row = sender()->objectName().toInt();
780 changeColor(row, newColor);
783 void KColorCm::changeColor(int row, const QColor &newColor)
785 // update the m_colorSchemes for the selected colorSet
786 int currentSet = colorSet->currentIndex() - 1;
788 if (currentSet == -1)
790 // common colors is selected
791 switch (row)
793 case 0:
794 // View Background button
795 KConfigGroup(m_config, "Colors:View").writeEntry("BackgroundNormal", newColor);
796 break;
797 case 1:
798 // View Text button
799 KConfigGroup(m_config, "Colors:View").writeEntry("ForegroundNormal", newColor);
800 break;
801 case 2:
802 // Window Background Button
803 KConfigGroup(m_config, "Colors:Window").writeEntry("BackgroundNormal", newColor);
804 break;
805 case 3:
806 // Window Text Button
807 KConfigGroup(m_config, "Colors:Window").writeEntry("ForegroundNormal", newColor);
808 break;
809 case 4:
810 // Button Background button
811 KConfigGroup(m_config, "Colors:Button").writeEntry("BackgroundNormal", newColor);
812 break;
813 case 5:
814 // Button Text button
815 KConfigGroup(m_config, "Colors:Button").writeEntry("ForegroundNormal", newColor);
816 break;
817 case 6:
818 // Selection Background Button
819 KConfigGroup(m_config, "Colors:Selection").writeEntry("BackgroundNormal", newColor);
820 break;
821 case 7:
822 // Selection Text Button
823 KConfigGroup(m_config, "Colors:Selection").writeEntry("ForegroundNormal", newColor);
824 break;
825 case 8:
826 // Selection Inactive Text Button
827 KConfigGroup(m_config, "Colors:Selection").writeEntry("ForegroundInactive", newColor);
828 break;
830 // buttons that could have varies in their place
831 case 9:
832 // Inactive Text Button (set all but Selection Inactive Text color)
833 KConfigGroup(m_config, "Colors:View").writeEntry("ForegroundInactive", newColor);
834 KConfigGroup(m_config, "Colors:Window").writeEntry("ForegroundInactive", newColor);
835 KConfigGroup(m_config, "Colors:Button").writeEntry("ForegroundInactive", newColor);
836 KConfigGroup(m_config, "Colors:Tooltip").writeEntry("ForegroundInactive", newColor);
837 break;
838 case 10:
839 // Active Text Button (set all active text colors)
840 KConfigGroup(m_config, "Colors:View").writeEntry("ForegroundActive", newColor);
841 KConfigGroup(m_config, "Colors:Window").writeEntry("ForegroundActive", newColor);
842 KConfigGroup(m_config, "Colors:Selection").writeEntry("ForegroundActive", newColor);
843 KConfigGroup(m_config, "Colors:Button").writeEntry("ForegroundActive", newColor);
844 KConfigGroup(m_config, "Colors:Tooltip").writeEntry("ForegroundActive", newColor);
845 break;
846 case 11:
847 // Link Text Button (set all link text colors)
848 KConfigGroup(m_config, "Colors:View").writeEntry("ForegroundLink", newColor);
849 KConfigGroup(m_config, "Colors:Window").writeEntry("ForegroundLink", newColor);
850 KConfigGroup(m_config, "Colors:Selection").writeEntry("ForegroundLink", newColor);
851 KConfigGroup(m_config, "Colors:Button").writeEntry("ForegroundLink", newColor);
852 KConfigGroup(m_config, "Colors:Tooltip").writeEntry("ForegroundLink", newColor);
853 break;
854 case 12:
855 // Visited Text Button (set all visited text colors)
856 KConfigGroup(m_config, "Colors:View").writeEntry("ForegroundVisited", newColor);
857 KConfigGroup(m_config, "Colors:Window").writeEntry("ForegroundVisited", newColor);
858 KConfigGroup(m_config, "Colors:Selection").writeEntry("ForegroundVisited", newColor);
859 KConfigGroup(m_config, "Colors:Button").writeEntry("ForegroundVisited", newColor);
860 KConfigGroup(m_config, "Colors:Tooltip").writeEntry("ForegroundVisited", newColor);
861 break;
862 case 13:
863 // Negative Text Button (set all negative text colors)
864 KConfigGroup(m_config, "Colors:View").writeEntry("ForegroundNegative", newColor);
865 KConfigGroup(m_config, "Colors:Window").writeEntry("ForegroundNegative", newColor);
866 KConfigGroup(m_config, "Colors:Selection").writeEntry("ForegroundNegative", newColor);
867 KConfigGroup(m_config, "Colors:Button").writeEntry("ForegroundNegative", newColor);
868 KConfigGroup(m_config, "Colors:Tooltip").writeEntry("ForegroundNegative", newColor);
869 break;
870 case 14:
871 // Neutral Text Button (set all neutral text colors)
872 KConfigGroup(m_config, "Colors:View").writeEntry("ForegroundNeutral", newColor);
873 KConfigGroup(m_config, "Colors:Window").writeEntry("ForegroundNeutral", newColor);
874 KConfigGroup(m_config, "Colors:Selection").writeEntry("ForegroundNeutral", newColor);
875 KConfigGroup(m_config, "Colors:Button").writeEntry("ForegroundNeutral", newColor);
876 KConfigGroup(m_config, "Colors:Tooltip").writeEntry("ForegroundNeutral", newColor);
877 break;
878 case 15:
879 // Positive Text Button (set all positive text colors)
880 KConfigGroup(m_config, "Colors:View").writeEntry("ForegroundPositive", newColor);
881 KConfigGroup(m_config, "Colors:Window").writeEntry("ForegroundPositive", newColor);
882 KConfigGroup(m_config, "Colors:Selection").writeEntry("ForegroundPositive", newColor);
883 KConfigGroup(m_config, "Colors:Button").writeEntry("ForegroundPositive", newColor);
884 KConfigGroup(m_config, "Colors:Tooltip").writeEntry("ForegroundPositive", newColor);
885 break;
887 case 16:
888 // Focus Decoration Button (set all focus decoration colors)
889 KConfigGroup(m_config, "Colors:View").writeEntry("DecorationFocus", newColor);
890 KConfigGroup(m_config, "Colors:Window").writeEntry("DecorationFocus", newColor);
891 KConfigGroup(m_config, "Colors:Selection").writeEntry("DecorationFocus", newColor);
892 KConfigGroup(m_config, "Colors:Button").writeEntry("DecorationFocus", newColor);
893 KConfigGroup(m_config, "Colors:Tooltip").writeEntry("DecorationFocus", newColor);
894 break;
895 case 17:
896 // Hover Decoration Button (set all hover decoration colors)
897 KConfigGroup(m_config, "Colors:View").writeEntry("DecorationHover", newColor);
898 KConfigGroup(m_config, "Colors:Window").writeEntry("DecorationHover", newColor);
899 KConfigGroup(m_config, "Colors:Selection").writeEntry("DecorationHover", newColor);
900 KConfigGroup(m_config, "Colors:Button").writeEntry("DecorationHover", newColor);
901 KConfigGroup(m_config, "Colors:Tooltip").writeEntry("DecorationHover", newColor);
902 break;
904 case 18:
905 // Tooltip Background button
906 KConfigGroup(m_config, "Colors:Tooltip").writeEntry("BackgroundNormal", newColor);
907 break;
908 case 19:
909 // Tooltip Text button
910 KConfigGroup(m_config, "Colors:Tooltip").writeEntry("ForegroundNormal", newColor);
911 break;
912 case 20:
913 // Active Window
914 KConfigGroup(m_config, "WM").writeEntry("activeBackground", newColor);
915 break;
916 case 21:
917 // Active Window Text
918 KConfigGroup(m_config, "WM").writeEntry("activeForeground", newColor);
919 break;
920 case 22:
921 // Inactive Window
922 KConfigGroup(m_config, "WM").writeEntry("inactiveBackground", newColor);
923 break;
924 case 23:
925 // Inactive Window Text
926 KConfigGroup(m_config, "WM").writeEntry("inactiveForeground", newColor);
927 break;
929 m_commonColorButtons[row]->blockSignals(true);
930 m_commonColorButtons[row]->setColor(newColor);
931 m_commonColorButtons[row]->blockSignals(false);
933 else
935 QString group = colorSetGroupKey(currentSet);
936 KConfigGroup(m_config, group).writeEntry(m_colorKeys[row], newColor);
939 updateColorSchemes();
940 updatePreviews();
942 emit changed(true);
945 QString KColorCm::colorSetGroupKey(int colorSet)
947 QString group;
948 switch (colorSet) {
949 case KColorScheme::Window:
950 group = "Colors:Window";
951 break;
952 case KColorScheme::Button:
953 group = "Colors:Button";
954 break;
955 case KColorScheme::Selection:
956 group = "Colors:Selection";
957 break;
958 case KColorScheme::Tooltip:
959 group = "Colors:Tooltip";
960 break;
961 default:
962 group = "Colors:View";
964 return group;
967 void KColorCm::on_contrastSlider_valueChanged(int value)
969 KConfigGroup group(m_config, "KDE");
970 group.writeEntry("contrast", value);
972 updatePreviews();
974 emit changed(true);
977 void KColorCm::on_shadeSortedColumn_stateChanged(int state)
979 KConfigGroup group(m_config, "General");
980 group.writeEntry("shadeSortColumn", bool(state != Qt::Unchecked));
982 emit changed(true);
985 void KColorCm::on_useInactiveEffects_stateChanged(int state)
987 KConfigGroup group(m_config, "ColorEffects:Inactive");
988 group.writeEntry("Enable", bool(state != Qt::Unchecked));
990 m_disableUpdates = true;
991 printf("re-init\n");
992 inactiveSelectionEffect->setCheckState(group.readEntry("ChangeSelectionColor", bool(state != Qt::Unchecked))
993 ? Qt::Checked : Qt::Unchecked);
994 m_disableUpdates = false;
996 emit changed(true);
999 void KColorCm::on_inactiveSelectionEffect_stateChanged(int state)
1001 if (m_disableUpdates)
1003 // don't write the config as we are reading it!
1004 return;
1007 KConfigGroup group(m_config, "ColorEffects:Inactive");
1008 group.writeEntry("ChangeSelectionColor", bool(state != Qt::Unchecked));
1010 emit changed(true);
1013 void KColorCm::load()
1015 loadInternal(true);
1017 KConfig cfg("kcmdisplayrc", KConfig::NoGlobals);
1018 KConfigGroup group(&cfg, "X11");
1020 applyToAlien->blockSignals(true); // don't emit SIGNAL(toggled(bool)) which would call SLOT(emitChanged())
1021 applyToAlien->setChecked(group.readEntry("exportKDEColors", true));
1022 applyToAlien->blockSignals(false);
1025 void KColorCm::loadInternal(bool loadOptions)
1027 // clean the config, in case we have changed the in-memory kconfig
1028 m_config->markAsClean();
1029 m_config->reparseConfiguration();
1031 // update the color table
1032 updateColorSchemes();
1033 updateColorTable();
1035 // fill in the color scheme list
1036 populateSchemeList();
1038 if (loadOptions)
1040 contrastSlider->setValue(KGlobalSettings::contrast());
1041 shadeSortedColumn->setCheckState(KGlobalSettings::shadeSortColumn() ? Qt::Checked : Qt::Unchecked);
1043 KConfigGroup group(m_config, "ColorEffects:Inactive");
1044 useInactiveEffects->setCheckState(group.readEntry("Enable", false) ? Qt::Checked : Qt::Unchecked);
1045 // NOTE: keep this in sync with kdelibs/kdeui/colors/kcolorscheme.cpp
1046 // NOTE: remove extra logic from updateFromOptions and on_useInactiveEffects_stateChanged when this changes!
1047 inactiveSelectionEffect->setCheckState(group.readEntry("ChangeSelectionColor", group.readEntry("Enable", false))
1048 ? Qt::Checked : Qt::Unchecked);
1051 updateEffectsPage();
1053 updatePreviews();
1055 emit changed(false);
1058 void KColorCm::save()
1060 KConfigGroup groupI(m_config, "ColorEffects:Inactive");
1062 // disable (inactive) effects if that is requested
1063 int a = (useInactiveEffects->checkState() == Qt::Unchecked ? -1 : 1);
1064 groupI.writeEntry("IntensityEffect", a*inactiveIntensityBox->currentIndex());
1065 groupI.writeEntry("ColorEffect", a*inactiveColorBox->currentIndex());
1066 groupI.writeEntry("ContrastEffect", a*inactiveContrastBox->currentIndex());
1068 m_config->sync();
1069 KGlobalSettings::self()->emitChange(KGlobalSettings::PaletteChanged);
1070 #ifdef Q_WS_X11
1071 // Send signal to all kwin instances
1072 QDBusMessage message =
1073 QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");
1074 QDBusConnection::sessionBus().send(message);
1075 #endif
1077 KConfig cfg("kcmdisplayrc", KConfig::NoGlobals);
1078 KConfigGroup displayGroup(&cfg, "X11");
1080 displayGroup.writeEntry("exportKDEColors", applyToAlien->isChecked());
1081 cfg.sync();
1083 runRdb(KRdbExportQtColors | ( applyToAlien->isChecked() ? KRdbExportColors : 0 ) );
1085 // now restore the normalized effect values
1086 groupI.writeEntry("IntensityEffect", inactiveIntensityBox->currentIndex());
1087 groupI.writeEntry("ColorEffect", inactiveColorBox->currentIndex());
1088 groupI.writeEntry("ContrastEffect", inactiveContrastBox->currentIndex());
1090 emit changed(false);
1093 void KColorCm::defaults()
1095 for(int i = 0; i < schemeList->count(); ++i) {
1096 if(schemeList->item(i)->text() == i18nc("Default color scheme", "Default")) {
1097 schemeList->setCurrentItem(schemeList->item(i));
1098 break;
1101 KCModule::defaults();
1102 emit changed(true);
1105 void KColorCm::emitChanged()
1107 emit changed(true);
1110 // inactive effects slots
1111 void KColorCm::on_inactiveIntensityBox_currentIndexChanged(int index)
1113 updateFromEffectsPage();
1114 inactivePreview->setPalette(m_config, QPalette::Inactive);
1116 emit changed(true);
1119 void KColorCm::on_inactiveIntensitySlider_valueChanged(int value)
1121 updateFromEffectsPage();
1122 inactivePreview->setPalette(m_config, QPalette::Inactive);
1124 emit changed(true);
1127 void KColorCm::on_inactiveColorBox_currentIndexChanged(int index)
1129 updateFromEffectsPage();
1130 inactivePreview->setPalette(m_config, QPalette::Inactive);
1132 emit changed(true);
1135 void KColorCm::on_inactiveColorSlider_valueChanged(int value)
1137 updateFromEffectsPage();
1138 inactivePreview->setPalette(m_config, QPalette::Inactive);
1140 emit changed(true);
1143 void KColorCm::on_inactiveColorButton_changed(const QColor& color)
1145 updateFromEffectsPage();
1146 inactivePreview->setPalette(m_config, QPalette::Inactive);
1148 emit changed(true);
1151 void KColorCm::on_inactiveContrastBox_currentIndexChanged(int index)
1153 updateFromEffectsPage();
1154 inactivePreview->setPalette(m_config, QPalette::Inactive);
1156 emit changed(true);
1159 void KColorCm::on_inactiveContrastSlider_valueChanged(int value)
1161 updateFromEffectsPage();
1162 inactivePreview->setPalette(m_config, QPalette::Inactive);
1164 emit changed(true);
1167 // disabled effects slots
1168 void KColorCm::on_disabledIntensityBox_currentIndexChanged(int index)
1170 updateFromEffectsPage();
1171 disabledPreview->setPalette(m_config, QPalette::Disabled);
1173 emit changed(true);
1176 void KColorCm::on_disabledIntensitySlider_valueChanged(int value)
1178 updateFromEffectsPage();
1179 disabledPreview->setPalette(m_config, QPalette::Disabled);
1181 emit changed(true);
1184 void KColorCm::on_disabledColorBox_currentIndexChanged(int index)
1186 updateFromEffectsPage();
1187 disabledPreview->setPalette(m_config, QPalette::Disabled);
1189 emit changed(true);
1192 void KColorCm::on_disabledColorSlider_valueChanged(int value)
1194 updateFromEffectsPage();
1195 disabledPreview->setPalette(m_config, QPalette::Disabled);
1197 emit changed(true);
1200 void KColorCm::on_disabledColorButton_changed(const QColor& color)
1202 updateFromEffectsPage();
1203 disabledPreview->setPalette(m_config, QPalette::Disabled);
1205 emit changed(true);
1208 void KColorCm::on_disabledContrastBox_currentIndexChanged(int index)
1210 updateFromEffectsPage();
1211 disabledPreview->setPalette(m_config, QPalette::Disabled);
1213 emit changed(true);
1216 void KColorCm::on_disabledContrastSlider_valueChanged(int value)
1218 updateFromEffectsPage();
1219 disabledPreview->setPalette(m_config, QPalette::Disabled);
1221 emit changed(true);
1224 #include "colorscm.moc"