From 3bee4bff667ece6303044246de72c719d2c09473 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Mon, 6 Feb 2006 20:44:10 +0000 Subject: [PATCH] Make it possible add new default window rules that will be added to user's rules. Add default rules that turn off focus stealing prevention for Mozilla family apps and OOo (since they can't handle opening a window from second instance with FSP active). When writing groups to kwinrulesrc delete old unused groups first. svn path=/trunk/KDE/kdebase/workspace/; revision=506472 --- data/Makefile.am | 13 +++++++++---- kcmkwin/kwinrules/main.cpp | 5 +++++ kcmkwin/kwinrules/ruleslist.cpp | 5 +++++ rules.cpp | 5 +++++ 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/data/Makefile.am b/data/Makefile.am index 9ec6183bf1..6486eb8c04 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -1,11 +1,14 @@ -kconf_PROGRAMS = kwin_update_window_settings +kconf_PROGRAMS = kwin_update_window_settings kwin_update_default_rules kconfdir = $(libdir)/kconf_update_bin kwin_update_window_settings_SOURCES = update_window_settings.cpp - kwin_update_window_settings_LDADD = $(LIB_KDECORE) $(KDE_RPATH) kwin_update_window_settings_LDFLAGS = $(all_libraries) +kwin_update_default_rules_SOURCES = update_default_rules.cpp +kwin_update_default_rules_LDADD = $(LIB_KDECORE) $(KDE_RPATH) +kwin_update_default_rules_LDFLAGS = $(all_libraries) + INCLUDES = $(all_includes) METASOURCES = AUTO @@ -14,7 +17,9 @@ sounddir= $(kde_sounddir) sound_DATA = pop.wav update_DATA = kwin.upd kwinsticky.upd kwiniconify.upd kwin3_plugin.upd kwin_focus1.upd \ - kwinupdatewindowsettings.upd kwin_focus2.upd + kwinupdatewindowsettings.upd kwin_focus2.upd kwin_fsp_workarounds_1.upd update_SCRIPTS = pluginlibFix.pl kwin3_plugin.pl kwin_focus1.sh kwin_focus2.sh - updatedir = $(kde_datadir)/kconf_update + +kwin_default_rules_DATA = fsp_workarounds_1 +kwin_default_rulesdir = $(kde_datadir)/kwin/default_rules diff --git a/kcmkwin/kwinrules/main.cpp b/kcmkwin/kwinrules/main.cpp index 82966a953b..0c22635868 100644 --- a/kcmkwin/kwinrules/main.cpp +++ b/kcmkwin/kwinrules/main.cpp @@ -51,6 +51,11 @@ static void loadRules( QList< Rules* >& rules ) static void saveRules( const QList< Rules* >& rules ) { KConfig cfg( "kwinrulesrc" ); + QStringList groups = cfg.groupList(); + for( QStringList::ConstIterator it = groups.begin(); + it != groups.end(); + ++it ) + cfg.deleteGroup( *it ); cfg.setGroup( "General" ); cfg.writeEntry( "count", rules.count()); int i = 1; diff --git a/kcmkwin/kwinrules/ruleslist.cpp b/kcmkwin/kwinrules/ruleslist.cpp index 6aa9804057..94c748d004 100644 --- a/kcmkwin/kwinrules/ruleslist.cpp +++ b/kcmkwin/kwinrules/ruleslist.cpp @@ -172,6 +172,11 @@ void KCMRulesList::load() void KCMRulesList::save() { KConfig cfg( "kwinrulesrc" ); + QStringList groups = cfg.groupList(); + for( QStringList::ConstIterator it = groups.begin(); + it != groups.end(); + ++it ) + cfg.deleteGroup( *it ); cfg.setGroup( "General" ); cfg.writeEntry( "count", rules.count()); int i = 1; diff --git a/rules.cpp b/rules.cpp index 4f440a93af..bb7b71fbf9 100644 --- a/rules.cpp +++ b/rules.cpp @@ -971,6 +971,11 @@ void Workspace::writeWindowRules() { rulesUpdatedTimer.stop(); KConfig cfg( "kwinrulesrc" ); + QStringList groups = cfg.groupList(); + for( QStringList::ConstIterator it = groups.begin(); + it != groups.end(); + ++it ) + cfg.deleteGroup( *it ); cfg.setGroup( "General" ); cfg.writeEntry( "count", rules.count()); int i = 1;