diff --git a/effects/mousemark/CMakeLists.txt b/effects/mousemark/CMakeLists.txt
index 37b3ff263e..5e6f3683d9 100644
--- a/effects/mousemark/CMakeLists.txt
+++ b/effects/mousemark/CMakeLists.txt
@@ -6,6 +6,8 @@ set( kwin4_effect_builtins_sources ${kwin4_effect_builtins_sources}
mousemark/mousemark.cpp
)
+kde4_add_kcfg_files(kwin4_effect_builtins_sources mousemark/mousemarkconfig.kcfgc)
+
# .desktop files
install( FILES
mousemark/mousemark.desktop
@@ -20,6 +22,8 @@ set( kwin4_effect_builtins_config_sources ${kwin4_effect_builtins_config_sources
mousemark/mousemark_config.ui
)
+kde4_add_kcfg_files(kwin4_effect_builtins_config_sources mousemark/mousemarkconfig.kcfgc)
+
# .desktop files
install( FILES
mousemark/mousemark_config.desktop
diff --git a/effects/mousemark/mousemark.cpp b/effects/mousemark/mousemark.cpp
index 1400bd1253..0a3229b3ec 100644
--- a/effects/mousemark/mousemark.cpp
+++ b/effects/mousemark/mousemark.cpp
@@ -21,15 +21,15 @@ along with this program. If not, see .
#include "mousemark.h"
+// KConfigSkeleton
+#include "mousemarkconfig.h"
+
#include
#include
#include
#include
-#include
#include
-#include
-#include
#include
@@ -68,10 +68,10 @@ MouseMarkEffect::~MouseMarkEffect()
static int width_2 = 1;
void MouseMarkEffect::reconfigure(ReconfigureFlags)
{
- KConfigGroup conf = EffectsHandler::effectConfig("MouseMark");
- width = conf.readEntry("LineWidth", 3);
+ MouseMarkConfig::self()->readConfig();
+ width = MouseMarkConfig::lineWidth();
width_2 = width / 2;
- color = conf.readEntry("Color", QColor(Qt::red));
+ color = MouseMarkConfig::color();
color.setAlphaF(1.0);
}
diff --git a/effects/mousemark/mousemark.kcfg b/effects/mousemark/mousemark.kcfg
new file mode 100644
index 0000000000..c1a9d0c730
--- /dev/null
+++ b/effects/mousemark/mousemark.kcfg
@@ -0,0 +1,15 @@
+
+
+
+
+
+ 3
+
+
+ 255,0,0
+
+
+
diff --git a/effects/mousemark/mousemark_config.cpp b/effects/mousemark/mousemark_config.cpp
index 373bfe9510..03beaa4e1b 100644
--- a/effects/mousemark/mousemark_config.cpp
+++ b/effects/mousemark/mousemark_config.cpp
@@ -20,11 +20,13 @@ along with this program. If not, see .
#include "mousemark_config.h"
+// KConfigSkeleton
+#include "mousemarkconfig.h"
+
#include
#include
#include
-#include
#include
#include
#include
@@ -46,13 +48,13 @@ MouseMarkEffectConfig::MouseMarkEffectConfig(QWidget* parent, const QVariantList
{
m_ui = new MouseMarkEffectConfigForm(this);
+ m_ui->kcfg_LineWidth->setSuffix(ki18np(" pixel", " pixels"));
+
QVBoxLayout* layout = new QVBoxLayout(this);
layout->addWidget(m_ui);
- connect(m_ui->editor, SIGNAL(keyChange()), this, SLOT(changed()));
- connect(m_ui->spinWidth, SIGNAL(valueChanged(int)), this, SLOT(changed()));
- connect(m_ui->comboColors, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
+ addConfig(MouseMarkConfig::self(), m_ui);
// Shortcut config. The shortcut belongs to the component "kwin"!
m_actionCollection = new KActionCollection(this, KComponentData("kwin"));
@@ -78,48 +80,17 @@ MouseMarkEffectConfig::~MouseMarkEffectConfig()
m_ui->editor->undoChanges();
}
-void MouseMarkEffectConfig::load()
-{
- KCModule::load();
-
- KConfigGroup conf = EffectsHandler::effectConfig("MouseMark");
-
- int width = conf.readEntry("LineWidth", 3);
- QColor color = conf.readEntry("Color", QColor(Qt::red));
- m_ui->spinWidth->setValue(width);
- m_ui->spinWidth->setSuffix(ki18np(" pixel", " pixels"));
- m_ui->comboColors->setColor(color);
-
- emit changed(false);
-}
-
void MouseMarkEffectConfig::save()
{
kDebug(1212) << "Saving config of MouseMark" ;
- //KCModule::save();
-
- KConfigGroup conf = EffectsHandler::effectConfig("MouseMark");
-
- conf.writeEntry("LineWidth", m_ui->spinWidth->value());
- conf.writeEntry("Color", m_ui->comboColors->color());
+ KCModule::save();
m_actionCollection->writeSettings();
m_ui->editor->save(); // undo() will restore to this state from now on
- conf.sync();
-
- emit changed(false);
EffectsHandler::sendReloadMessage("mousemark");
}
-void MouseMarkEffectConfig::defaults()
-{
- m_ui->spinWidth->setValue(3);
- m_ui->comboColors->setColor(Qt::red);
- emit changed(true);
-}
-
-
} // namespace
#include "mousemark_config.moc"
diff --git a/effects/mousemark/mousemark_config.h b/effects/mousemark/mousemark_config.h
index 6af811231d..290c9add75 100644
--- a/effects/mousemark/mousemark_config.h
+++ b/effects/mousemark/mousemark_config.h
@@ -45,8 +45,6 @@ public:
virtual ~MouseMarkEffectConfig();
virtual void save();
- virtual void load();
- virtual void defaults();
private:
MouseMarkEffectConfigForm* m_ui;
diff --git a/effects/mousemark/mousemark_config.ui b/effects/mousemark/mousemark_config.ui
index f32fa4ed2d..ce34b73134 100644
--- a/effects/mousemark/mousemark_config.ui
+++ b/effects/mousemark/mousemark_config.ui
@@ -1,62 +1,71 @@
-
+
+
KWin::MouseMarkEffectConfigForm
-
-
+
+
+
+ 0
+ 0
+ 279
+ 178
+
+
+
-
-
-
+
+
Appearance
-
-
-
-
-
+
+
-
+
+
&Width:
-
+
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
- spinWidth
+
+ kcfg_LineWidth
- -
-
-
-
+
-
+
+
+
0
0
-
+
1
-
+
10
-
+
3
- -
-
-
+
-
+
+
&Color:
-
+
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
- comboColors
+
+ kcfg_Color
- -
-
-
-
+
-
+
+
+
0
0
@@ -67,17 +76,17 @@
-
-
+
-
-
-
+
+
Draw with the mouse by holding Shift+Meta keys and moving the mouse.
-
+
Qt::AlignCenter
-
+
true
@@ -98,7 +107,7 @@
KWin::GlobalShortcutsEditor
QWidget
-
+
1
diff --git a/effects/mousemark/mousemarkconfig.kcfgc b/effects/mousemark/mousemarkconfig.kcfgc
new file mode 100644
index 0000000000..299221dd2a
--- /dev/null
+++ b/effects/mousemark/mousemarkconfig.kcfgc
@@ -0,0 +1,5 @@
+File=mousemark.kcfg
+ClassName=MouseMarkConfig
+NameSpace=KWin
+Singleton=true
+Mutators=true