From kde-commits Fri Dec 20 07:15:16 2002 From: =?utf-8?q?Jos=C3=A9=20Pablo=20Ezequiel=20Fern=C3=A1ndez?= Date: Fri, 20 Dec 2002 07:15:16 +0000 To: kde-commits Subject: kdebase/kcontrol/accessibility X-MARC-Message: https://marc.info/?l=kde-commits&m=104037442331564 CVS commit by pupeno: Load/save bell configuration and other things. M +46 -18 accessibility.cpp 1.16 --- kdebase/kcontrol/accessibility/accessibility.cpp #1.15:1.16 @@ -93,4 +93,25 @@ AccessibilityConfig::~AccessibilityConfi void AccessibilityConfig::load(){ kdDebug() << "Running: AccessibilityConfig::load()" << endl; + + KConfig *bell = new KConfig("bellrc", true); + + bell->setGroup("General"); + systemBell->setChecked(bell->readBoolEntry("SystemBell", false)); + customBell->setChecked(bell->readBoolEntry("CustomBell", false)); + visibleBell->setChecked(bell->readBoolEntry("VisibleBell", false)); + + bell->setGroup("CustomBell"); + soundToPlay->setURL(bell->readPathEntry("Sound", "")); + + bell->setGroup("Visible"); + invertScreen->setChecked(bell->readBoolEntry("Invert", true)); + flashScreen->setChecked(bell->readBoolEntry("Flash", false)); + // TODO: There has to be a cleaner way. + QColor *redColor = new QColor(Qt::red); + flashScreenColor->setColor(bell->readColorEntry("FlashColor", redColor)); + delete redColor; + visibleBellDuration->setValue(bell->readNumEntry("Duration", 500)); + + delete bell; // KConfig *config = new KConfig("kaccessrc", true); // @@ -130,17 +151,23 @@ void AccessibilityConfig::load(){ void AccessibilityConfig::save(){ kdDebug() << "Running: AccessibilityConfig::save()" << endl; - KConfig *config= new KConfig("accessibilityrc", false); -// config->setGroup("Bell"); -// -// config->writeEntry("SystemBell", systemBell->isChecked()); -// config->writeEntry("ArtsBell", customBell->isChecked()); -// config->writeEntry("ArtsBellFile", soundEdit->text()); -// -// config->writeEntry("VisibleBell", visibleBell->isChecked()); -// config->writeEntry("VisibleBellInvert", invertScreen->isChecked()); -// config->writeEntry("VisibleBellColor", colorButton->color()); -// -// config->writeEntry("VisibleBellPause", durationSlider->value()); + KConfig *bell = new KConfig("bellrc"); + + bell->setGroup("General"); + bell->writeEntry("SystemBell", systemBell->isChecked()); + bell->writeEntry("CustomBell", customBell->isChecked()); + bell->writeEntry("VisibleBell", visibleBell->isChecked()); + + bell->setGroup("CustomBell"); + bell->writePathEntry("Sound", soundToPlay->url()); + + bell->setGroup("Visible"); + bell->writeEntry("Invert", invertScreen->isChecked()); + bell->writeEntry("Flash", flashScreen->isChecked()); + bell->writeEntry("FlashColor", flashScreenColor->color()); + bell->writeEntry("Duration", visibleBellDuration->value()); + + bell->sync(); + delete bell; // // @@ -186,5 +213,5 @@ void AccessibilityConfig::defaults(){ // Bell // Audibe Bell -// systemBell->setChecked(true); + systemBell->setChecked(false); customBell->setChecked(false); soundToPlay->clear(); @@ -232,6 +259,7 @@ QString AccessibilityConfig::quickHelp() return i18n("

Mouse

"); // ### fixme break; + default: + return QString::null; // This should never happen } - return QString::null; }