diff --git a/effects/presentwindows/CMakeLists.txt b/effects/presentwindows/CMakeLists.txt
index 964b0fe333..5da922dd52 100644
--- a/effects/presentwindows/CMakeLists.txt
+++ b/effects/presentwindows/CMakeLists.txt
@@ -7,6 +7,8 @@ set( kwin4_effect_builtins_sources ${kwin4_effect_builtins_sources}
presentwindows/presentwindows_proxy.cpp
)
+kde4_add_kcfg_files(kwin4_effect_builtins_sources presentwindows/presentwindowsconfig.kcfgc)
+
# .desktop files
install( FILES
presentwindows/presentwindows.desktop
@@ -21,6 +23,8 @@ set( kwin4_effect_builtins_config_sources ${kwin4_effect_builtins_config_sources
presentwindows/presentwindows_config.ui
)
+kde4_add_kcfg_files(kwin4_effect_builtins_config_sources presentwindows/presentwindowsconfig.kcfgc)
+
# .desktop files
install( FILES
presentwindows/presentwindows_config.desktop
diff --git a/effects/presentwindows/presentwindows.cpp b/effects/presentwindows/presentwindows.cpp
index 83677a6961..96d9a68a27 100755
--- a/effects/presentwindows/presentwindows.cpp
+++ b/effects/presentwindows/presentwindows.cpp
@@ -20,12 +20,11 @@ along with this program. If not, see .
*********************************************************************/
#include "presentwindows.h"
-
+//KConfigSkeleton
+#include "presentwindowsconfig.h"
#include
#include
#include
-#include
-#include
#include
#include
@@ -122,7 +121,7 @@ PresentWindowsEffect::~PresentWindowsEffect()
void PresentWindowsEffect::reconfigure(ReconfigureFlags)
{
- KConfigGroup conf = effects->effectConfig("PresentWindows");
+ PresentWindowsConfig::self()->readConfig();
foreach (ElectricBorder border, m_borderActivate) {
effects->unreserveElectricBorder(border);
}
@@ -131,43 +130,34 @@ void PresentWindowsEffect::reconfigure(ReconfigureFlags)
}
m_borderActivate.clear();
m_borderActivateAll.clear();
- QList borderList = QList();
- borderList.append(int(ElectricNone));
- borderList = conf.readEntry("BorderActivate", borderList);
- foreach (int i, borderList) {
+ foreach (int i, PresentWindowsConfig::borderActivate()) {
m_borderActivate.append(ElectricBorder(i));
effects->reserveElectricBorder(ElectricBorder(i));
}
- borderList.clear();
- borderList.append(int(ElectricTopLeft));
- borderList = conf.readEntry("BorderActivateAll", borderList);
- foreach (int i, borderList) {
+ foreach (int i, PresentWindowsConfig::borderActivateAll()) {
m_borderActivateAll.append(ElectricBorder(i));
effects->reserveElectricBorder(ElectricBorder(i));
}
- borderList.clear();
- borderList.append(int(ElectricNone));
- borderList = conf.readEntry("BorderActivateClass", borderList);
- foreach (int i, borderList) {
+ foreach (int i, PresentWindowsConfig::borderActivateClass()) {
m_borderActivateClass.append(ElectricBorder(i));
effects->reserveElectricBorder(ElectricBorder(i));
}
- m_layoutMode = conf.readEntry("LayoutMode", int(LayoutNatural));
- m_showCaptions = conf.readEntry("DrawWindowCaptions", true);
- m_showIcons = conf.readEntry("DrawWindowIcons", true);
- m_doNotCloseWindows = !conf.readEntry("AllowClosingWindows", true);
- m_ignoreMinimized = conf.readEntry("IgnoreMinimized", false);
- m_accuracy = conf.readEntry("Accuracy", 1) * 20;
- m_fillGaps = conf.readEntry("FillGaps", true);
+ m_layoutMode = PresentWindowsConfig::layoutMode();
+ m_showCaptions = PresentWindowsConfig::drawWindowCaptions();
+ m_showIcons = PresentWindowsConfig::drawWindowIcons();
+ m_doNotCloseWindows = !PresentWindowsConfig::allowClosingWindows();
+ m_ignoreMinimized = PresentWindowsConfig::ignoreMinimized();
+ m_accuracy = PresentWindowsConfig::accuracy() * 20;
+ m_fillGaps = PresentWindowsConfig::fillGaps();
m_fadeDuration = double(animationTime(150));
- m_showPanel = conf.readEntry("ShowPanel", false);
- m_leftButtonWindow = (WindowMouseAction)conf.readEntry("LeftButtonWindow", (int)WindowActivateAction);
- m_middleButtonWindow = (WindowMouseAction)conf.readEntry("MiddleButtonWindow", (int)WindowNoAction);
- m_rightButtonWindow = (WindowMouseAction)conf.readEntry("RightButtonWindow", (int)WindowExitAction);
- m_leftButtonDesktop = (DesktopMouseAction)conf.readEntry("LeftButtonDesktop", (int)DesktopExitAction);
- m_middleButtonDesktop = (DesktopMouseAction)conf.readEntry("MiddleButtonDesktop", (int)DesktopNoAction);
- m_rightButtonDesktop = (DesktopMouseAction)conf.readEntry("RightButtonDesktop", (int)DesktopNoAction);
- m_dragToClose = conf.readEntry("DragToClose", false);
+ m_showPanel = PresentWindowsConfig::showPanel();
+ m_leftButtonWindow = (WindowMouseAction)PresentWindowsConfig::leftButtonWindow();
+ m_middleButtonWindow = (WindowMouseAction)PresentWindowsConfig::middleButtonWindow();
+ m_rightButtonWindow = (WindowMouseAction)PresentWindowsConfig::rightButtonWindow();
+ m_leftButtonDesktop = (DesktopMouseAction)PresentWindowsConfig::leftButtonDesktop();
+ m_middleButtonDesktop = (DesktopMouseAction)PresentWindowsConfig::middleButtonDesktop();
+ m_rightButtonDesktop = (DesktopMouseAction)PresentWindowsConfig::rightButtonDesktop();
+ m_dragToClose = PresentWindowsConfig::dragToClose();
}
void* PresentWindowsEffect::proxy()
diff --git a/effects/presentwindows/presentwindows.kcfg b/effects/presentwindows/presentwindows.kcfg
new file mode 100644
index 0000000000..bf424a4a9d
--- /dev/null
+++ b/effects/presentwindows/presentwindows.kcfg
@@ -0,0 +1,59 @@
+
+
+
+
+
+ 0
+
+
+ true
+
+
+ true
+
+
+ true
+
+
+ false
+
+
+ false
+
+
+ 1
+
+
+ true
+
+
+ 1
+
+
+ 0
+
+
+ 2
+
+
+ 2
+
+
+ 0
+
+
+ 0
+
+
+ false
+
+
+
+ QList<int>() << int(ElectricTopLeft)
+
+
+
+
diff --git a/effects/presentwindows/presentwindows_config.cpp b/effects/presentwindows/presentwindows_config.cpp
index 1d6572cdec..2d8625a58e 100644
--- a/effects/presentwindows/presentwindows_config.cpp
+++ b/effects/presentwindows/presentwindows_config.cpp
@@ -20,6 +20,8 @@ along with this program. If not, see .
*********************************************************************/
#include "presentwindows_config.h"
+// KConfigSkeleton
+#include "presentwindowsconfig.h"
#include
#include
@@ -70,21 +72,9 @@ PresentWindowsEffectConfig::PresentWindowsEffectConfig(QWidget* parent, const QV
m_ui->shortcutEditor->addCollection(m_actionCollection);
- connect(m_ui->layoutCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
- connect(m_ui->displayTitleBox, SIGNAL(stateChanged(int)), this, SLOT(changed()));
- connect(m_ui->displayIconBox, SIGNAL(stateChanged(int)), this, SLOT(changed()));
- connect(m_ui->allowClosing, SIGNAL(stateChanged(int)), this, SLOT(changed()));
- connect(m_ui->ignoreMinimizedBox, SIGNAL(stateChanged(int)), this, SLOT(changed()));
- connect(m_ui->showPanelBox, SIGNAL(stateChanged(int)), this, SLOT(changed()));
- connect(m_ui->accuracySlider, SIGNAL(valueChanged(int)), this, SLOT(changed()));
- connect(m_ui->fillGapsBox, SIGNAL(stateChanged(int)), this, SLOT(changed()));
connect(m_ui->shortcutEditor, SIGNAL(keyChange()), this, SLOT(changed()));
- connect(m_ui->leftButtonWindowCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
- connect(m_ui->middleButtonWindowCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
- connect(m_ui->rightButtonWindowCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
- connect(m_ui->leftButtonDesktopCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
- connect(m_ui->middleButtonDesktopCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
- connect(m_ui->rightButtonDesktopCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
+
+ addConfig(PresentWindowsConfig::self(), m_ui);
load();
}
@@ -95,113 +85,17 @@ PresentWindowsEffectConfig::~PresentWindowsEffectConfig()
m_ui->shortcutEditor->undoChanges();
}
-void PresentWindowsEffectConfig::load()
-{
- KCModule::load();
-
- KConfigGroup conf = EffectsHandler::effectConfig("PresentWindows");
-
- int layoutMode = conf.readEntry("LayoutMode", int(PresentWindowsEffect::LayoutNatural));
- m_ui->layoutCombo->setCurrentIndex(layoutMode);
-
- bool displayTitle = conf.readEntry("DrawWindowCaptions", true);
- m_ui->displayTitleBox->setChecked(displayTitle);
-
- bool displayIcon = conf.readEntry("DrawWindowIcons", true);
- m_ui->displayIconBox->setChecked(displayIcon);
-
- bool allowClosing = conf.readEntry("AllowClosingWindows", true);
- m_ui->allowClosing->setChecked(allowClosing);
-
- bool ignoreMinimized = conf.readEntry("IgnoreMinimized", false);
- m_ui->ignoreMinimizedBox->setChecked(ignoreMinimized);
-
- bool showPanel = conf.readEntry("ShowPanel", false);
- m_ui->showPanelBox->setChecked(showPanel);
-
- int accuracy = conf.readEntry("Accuracy", 1);
- m_ui->accuracySlider->setSliderPosition(accuracy);
-
- bool fillGaps = conf.readEntry("FillGaps", true);
- m_ui->fillGapsBox->setChecked(fillGaps);
-
- int leftButtonWindow = conf.readEntry("LeftButtonWindow", int(PresentWindowsEffect::WindowActivateAction));
- m_ui->leftButtonWindowCombo->setCurrentIndex(leftButtonWindow);
- int middleButtonWindow = conf.readEntry("MiddleButtonWindow", int(PresentWindowsEffect::WindowNoAction));
- m_ui->middleButtonWindowCombo->setCurrentIndex(middleButtonWindow);
- int rightButtonWindow = conf.readEntry("RightButtonWindow", int(PresentWindowsEffect::WindowExitAction));
- m_ui->rightButtonWindowCombo->setCurrentIndex(rightButtonWindow);
-
- int leftButtonDesktop = conf.readEntry("LeftButtonDesktop", int(PresentWindowsEffect::DesktopExitAction));
- m_ui->leftButtonDesktopCombo->setCurrentIndex(leftButtonDesktop);
- int middleButtonDesktop = conf.readEntry("MiddleButtonDesktop", int(PresentWindowsEffect::DesktopNoAction));
- m_ui->middleButtonDesktopCombo->setCurrentIndex(middleButtonDesktop);
- int rightButtonDesktop = conf.readEntry("RightButtonDesktop", int(PresentWindowsEffect::DesktopNoAction));
- m_ui->rightButtonDesktopCombo->setCurrentIndex(rightButtonDesktop);
-
- emit changed(false);
-}
-
void PresentWindowsEffectConfig::save()
{
KCModule::save();
-
- KConfigGroup conf = EffectsHandler::effectConfig("PresentWindows");
-
- int layoutMode = m_ui->layoutCombo->currentIndex();
- conf.writeEntry("LayoutMode", layoutMode);
-
- conf.writeEntry("DrawWindowCaptions", m_ui->displayTitleBox->isChecked());
- conf.writeEntry("DrawWindowIcons", m_ui->displayIconBox->isChecked());
- conf.writeEntry("AllowClosingWindows", m_ui->allowClosing->isChecked());
- conf.writeEntry("IgnoreMinimized", m_ui->ignoreMinimizedBox->isChecked());
- conf.writeEntry("ShowPanel", m_ui->showPanelBox->isChecked());
-
- int accuracy = m_ui->accuracySlider->value();
- conf.writeEntry("Accuracy", accuracy);
-
- conf.writeEntry("FillGaps", m_ui->fillGapsBox->isChecked());
-
- int leftButtonWindow = m_ui->leftButtonWindowCombo->currentIndex();
- conf.writeEntry("LeftButtonWindow", leftButtonWindow);
- int middleButtonWindow = m_ui->middleButtonWindowCombo->currentIndex();
- conf.writeEntry("MiddleButtonWindow", middleButtonWindow);
- int rightButtonWindow = m_ui->rightButtonWindowCombo->currentIndex();
- conf.writeEntry("RightButtonWindow", rightButtonWindow);
-
- int leftButtonDesktop = m_ui->leftButtonDesktopCombo->currentIndex();
- conf.writeEntry("LeftButtonDesktop", leftButtonDesktop);
- int middleButtonDesktop = m_ui->middleButtonDesktopCombo->currentIndex();
- conf.writeEntry("MiddleButtonDesktop", middleButtonDesktop);
- int rightButtonDesktop = m_ui->rightButtonDesktopCombo->currentIndex();
- conf.writeEntry("RightButtonDesktop", rightButtonDesktop);
-
m_ui->shortcutEditor->save();
-
- conf.sync();
-
- emit changed(false);
EffectsHandler::sendReloadMessage("presentwindows");
}
void PresentWindowsEffectConfig::defaults()
{
- m_ui->layoutCombo->setCurrentIndex(int(PresentWindowsEffect::LayoutNatural));
- m_ui->displayTitleBox->setChecked(true);
- m_ui->displayIconBox->setChecked(true);
- m_ui->allowClosing->setChecked(true);
- m_ui->ignoreMinimizedBox->setChecked(false);
- m_ui->showPanelBox->setChecked(false);
- m_ui->accuracySlider->setSliderPosition(1);
- m_ui->fillGapsBox->setChecked(true);
m_ui->shortcutEditor->allDefault();
- m_ui->leftButtonWindowCombo->setCurrentIndex(int(PresentWindowsEffect::WindowActivateAction));
- m_ui->middleButtonWindowCombo->setCurrentIndex(int(PresentWindowsEffect::WindowNoAction));
- m_ui->rightButtonWindowCombo->setCurrentIndex(int(PresentWindowsEffect::WindowExitAction));
- m_ui->leftButtonDesktopCombo->setCurrentIndex(int(PresentWindowsEffect::DesktopExitAction));
- m_ui->middleButtonDesktopCombo->setCurrentIndex(int(PresentWindowsEffect::DesktopNoAction));
- m_ui->rightButtonDesktopCombo->setCurrentIndex(int(PresentWindowsEffect::DesktopNoAction));
- emit changed(true);
+ KCModule::defaults();
}
} // namespace
diff --git a/effects/presentwindows/presentwindows_config.h b/effects/presentwindows/presentwindows_config.h
index 93a76c2f4d..ce6fdc32d8 100644
--- a/effects/presentwindows/presentwindows_config.h
+++ b/effects/presentwindows/presentwindows_config.h
@@ -46,7 +46,6 @@ public:
public slots:
virtual void save();
- virtual void load();
virtual void defaults();
private:
diff --git a/effects/presentwindows/presentwindows_config.ui b/effects/presentwindows/presentwindows_config.ui
index d1e027c48b..336efec0cc 100644
--- a/effects/presentwindows/presentwindows_config.ui
+++ b/effects/presentwindows/presentwindows_config.ui
@@ -37,7 +37,7 @@
-
-
+
Fill &gaps
@@ -64,7 +64,7 @@
-
-
+
130
@@ -125,12 +125,12 @@
Left button:
- leftButtonWindowCombo
+ kcfg_LeftButtonWindow
-
-
+
-
No action
@@ -174,12 +174,12 @@
Middle button:
- middleButtonWindowCombo
+ kcfg_MiddleButtonWindow
-
-
+
-
No action
@@ -223,12 +223,12 @@
Right button:
- rightButtonWindowCombo
+ kcfg_RightButtonWindow
-
-
+
-
No action
@@ -284,12 +284,12 @@
Left button:
- leftButtonDesktopCombo
+ kcfg_LeftButtonDesktop
-
-
+
-
No action
@@ -318,12 +318,12 @@
Middle button:
- middleButtonDesktopCombo
+ kcfg_MiddleButtonDesktop
-
-
+
-
No action
@@ -352,12 +352,12 @@
Right button:
- rightButtonDesktopCombo
+ kcfg_RightButtonDesktop
-
-
+
-
No action
@@ -398,40 +398,40 @@
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
- layoutCombo
+ kcfg_LayoutMode
-
-
+
Display window &titles
-
-
+
Display window &icons
-
-
+
Ignore &minimized windows
-
-
+
Show &panels
-
-
+
0
@@ -456,7 +456,7 @@
-
-
+
Provide buttons to close the windows
@@ -481,13 +481,13 @@
- layoutCombo
- displayTitleBox
- displayIconBox
- allowClosing
- ignoreMinimizedBox
- accuracySlider
- fillGapsBox
+ kcfg_LayoutMode
+ kcfg_DrawWindowCaptions
+ kcfg_DrawWindowIcons
+ kcfg_AllowClosingWindows
+ kcfg_IgnoreMinimized
+ kcfg_Accuracy
+ kcfg_FillGaps
diff --git a/effects/presentwindows/presentwindowsconfig.kcfgc b/effects/presentwindows/presentwindowsconfig.kcfgc
new file mode 100644
index 0000000000..3e92ddf686
--- /dev/null
+++ b/effects/presentwindows/presentwindowsconfig.kcfgc
@@ -0,0 +1,6 @@
+File=presentwindows.kcfg
+ClassName=PresentWindowsConfig
+NameSpace=KWin
+Singleton=true
+Mutators=true
+IncludeFiles=kwinglobals.h