[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdebase/kcontrol/accessibility
From:       José Pablo Ezequiel Fernández <pupeno () kde ! org>
Date:       2002-12-20 7:15:16
[Download RAW message or body]

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("<h1>Mouse</h1>"); // ### fixme
          break;
+      default:
+         return QString::null;   // This should never happen
    }
-   return QString::null;
 }
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic