diff --git a/effects/windowgeometry/CMakeLists.txt b/effects/windowgeometry/CMakeLists.txt index acf2474186..1f25a99b45 100644 --- a/effects/windowgeometry/CMakeLists.txt +++ b/effects/windowgeometry/CMakeLists.txt @@ -6,6 +6,8 @@ set( kwin4_effect_builtins_sources ${kwin4_effect_builtins_sources} windowgeometry/windowgeometry.cpp ) +kde4_add_kcfg_files(kwin4_effect_builtins_sources windowgeometry/windowgeometryconfig.kcfgc) + # .desktop files install( FILES windowgeometry/windowgeometry.desktop @@ -20,6 +22,8 @@ set( kwin4_effect_builtins_config_sources ${kwin4_effect_builtins_config_sources windowgeometry/windowgeometry_config.ui ) +kde4_add_kcfg_files(kwin4_effect_builtins_config_sources windowgeometry/windowgeometryconfig.kcfgc) + # .desktop files install( FILES windowgeometry/windowgeometry_config.desktop diff --git a/effects/windowgeometry/windowgeometry.cpp b/effects/windowgeometry/windowgeometry.cpp index 5119f7e53b..b33a05d533 100644 --- a/effects/windowgeometry/windowgeometry.cpp +++ b/effects/windowgeometry/windowgeometry.cpp @@ -19,6 +19,9 @@ along with this program. If not, see . *********************************************************************/ #include "windowgeometry.h" +// KConfigSkeleton +#include "windowgeometryconfig.h" + #include #include #include @@ -73,9 +76,9 @@ WindowGeometry::~WindowGeometry() void WindowGeometry::reconfigure(ReconfigureFlags) { - KConfigGroup conf = effects->effectConfig("WindowGeometry"); - iHandleMoves = conf.readEntry("Move", true); - iHandleResizes = conf.readEntry("Resize", true); + WindowGeometryConfiguration::self()->readConfig(); + iHandleMoves = WindowGeometryConfiguration::move(); + iHandleResizes = WindowGeometryConfiguration::resize(); } void WindowGeometry::paintScreen(int mask, QRegion region, ScreenPaintData &data) diff --git a/effects/windowgeometry/windowgeometry.kcfg b/effects/windowgeometry/windowgeometry.kcfg new file mode 100644 index 0000000000..e174aa63c5 --- /dev/null +++ b/effects/windowgeometry/windowgeometry.kcfg @@ -0,0 +1,15 @@ + + + + + + true + + + true + + + diff --git a/effects/windowgeometry/windowgeometry_config.cpp b/effects/windowgeometry/windowgeometry_config.cpp index be48b1c254..1aeb91a79f 100644 --- a/effects/windowgeometry/windowgeometry_config.cpp +++ b/effects/windowgeometry/windowgeometry_config.cpp @@ -19,6 +19,9 @@ along with this program. If not, see . *********************************************************************/ #include "windowgeometry_config.h" +// KConfigSkeleton +#include "windowgeometryconfig.h" + #include #include #include @@ -50,8 +53,9 @@ WindowGeometryConfig::WindowGeometryConfig(QWidget* parent, const QVariantList& myUi->shortcuts->addCollection(myActionCollection); connect(myUi->shortcuts, SIGNAL(keyChange()), this, SLOT(changed())); - connect(myUi->handleMove, SIGNAL(toggled(bool)), this, SLOT(changed())); - connect(myUi->handleResize, SIGNAL(toggled(bool)), this, SLOT(changed())); + addConfig(WindowGeometryConfiguration::self(), myUi); + + load(); } WindowGeometryConfig::~WindowGeometryConfig() @@ -60,32 +64,18 @@ WindowGeometryConfig::~WindowGeometryConfig() myUi->shortcuts->undoChanges(); } -void WindowGeometryConfig::load() -{ - KCModule::load(); - KConfigGroup conf = EffectsHandler::effectConfig("WindowGeometry"); - myUi->handleMove->setChecked(conf.readEntry("Move", true)); - myUi->handleResize->setChecked(conf.readEntry("Resize", true)); - emit changed(false); -} - void WindowGeometryConfig::save() { - KConfigGroup conf = EffectsHandler::effectConfig("WindowGeometry"); - conf.writeEntry("Move", myUi->handleMove->isChecked()); - conf.writeEntry("Resize", myUi->handleResize->isChecked()); + KCModule::save(); myUi->shortcuts->save(); // undo() will restore to this state from now on - conf.sync(); - emit changed(false); EffectsHandler::sendReloadMessage("windowgeometry"); } void WindowGeometryConfig::defaults() { - myUi->handleMove->setChecked(true); - myUi->handleResize->setChecked(true); myUi->shortcuts->allDefault(); emit changed(true); } + } //namespace #include "windowgeometry_config.moc" diff --git a/effects/windowgeometry/windowgeometry_config.h b/effects/windowgeometry/windowgeometry_config.h index 76b1054a3e..67c660842f 100644 --- a/effects/windowgeometry/windowgeometry_config.h +++ b/effects/windowgeometry/windowgeometry_config.h @@ -45,7 +45,6 @@ public: public slots: void save(); - void load(); void defaults(); private: diff --git a/effects/windowgeometry/windowgeometry_config.ui b/effects/windowgeometry/windowgeometry_config.ui index 2b8e8a67c2..d8aba92590 100644 --- a/effects/windowgeometry/windowgeometry_config.ui +++ b/effects/windowgeometry/windowgeometry_config.ui @@ -12,14 +12,14 @@ - + Display for moving windows - + Display for resizing windows diff --git a/effects/windowgeometry/windowgeometryconfig.kcfgc b/effects/windowgeometry/windowgeometryconfig.kcfgc new file mode 100644 index 0000000000..5fd7287979 --- /dev/null +++ b/effects/windowgeometry/windowgeometryconfig.kcfgc @@ -0,0 +1,5 @@ +File=windowgeometry.kcfg +ClassName=WindowGeometryConfiguration +NameSpace=KWin +Singleton=true +Mutators=true