summaryrefslogtreecommitdiff
path: root/settings-backend
diff options
context:
space:
mode:
authoronestone <onestone>2006-12-18 16:10:53 +0000
committeronestone <onestone>2006-12-18 16:10:53 +0000
commit37519d57fb36374e0fe4b3b0dde072283be76e15 (patch)
tree3272c249c0e26dbdc5a95920e55944a5d2adfe0f /settings-backend
parent6b3607d9d78a74bcc1eaf98b033e7127cedb7f54 (diff)
downloadaquamarine-37519d57fb36374e0fe4b3b0dde072283be76e15.tar.gz
aquamarine-37519d57fb36374e0fe4b3b0dde072283be76e15.tar.bz2
aquamarine: fixed some build system issues
settings-backend: included new libberylsettings changes kcm: added a beryl kcontrol module (currently empty)
Diffstat (limited to 'settings-backend')
-rw-r--r--settings-backend/Makefile.am4
-rw-r--r--settings-backend/kconfig_backend.cpp100
2 files changed, 86 insertions, 18 deletions
diff --git a/settings-backend/Makefile.am b/settings-backend/Makefile.am
index b9d02f2..fc4002d 100644
--- a/settings-backend/Makefile.am
+++ b/settings-backend/Makefile.am
@@ -1,7 +1,5 @@
INCLUDES = -I$(srcdir)/lib $(all_includes)
-if with_berylsettings
-
libkconfig_la_LDFLAGS = -module -avoid-version -no-undefined $(all_libraries)
libkconfig_la_LIBADD = $(BERYLSETTINGS_LIBS) $(LIB_KDECORE)
libkconfig_la_SOURCES = kconfig_backend.cpp
@@ -9,5 +7,3 @@ backenddir = $(plugindir)/backends
KDE_CXXFLAGS = $(BERYLSETTINGS_CFLAGS)
backend_LTLIBRARIES = libkconfig.la
-
-endif \ No newline at end of file
diff --git a/settings-backend/kconfig_backend.cpp b/settings-backend/kconfig_backend.cpp
index 0875372..4998df8 100644
--- a/settings-backend/kconfig_backend.cpp
+++ b/settings-backend/kconfig_backend.cpp
@@ -19,9 +19,13 @@
*
*/
+#include <qdir.h>
+
#include <kconfig.h>
#include <ksimpleconfig.h>
#include <kdebug.h>
+#include <kglobal.h>
+#include <kstandarddirs.h>
#include <kinstance.h>
#include <kshortcut.h>
#include <kipc.h>
@@ -270,19 +274,16 @@ static void readIntegratedOption(ConfigFiles *cFiles, BerylSetting * setting)
case OptionSpecial:
if (specialOptions[option].berylName == "command_screenshot")
{
- setting->read_only = TRUE;
setting->value.value.as_string =
g_strdup("ksnapshot");
}
if (specialOptions[option].berylName == "command_window_screenshot")
{
- setting->read_only = TRUE;
setting->value.value.as_string =
g_strdup("ksnapshot -c");
}
if (specialOptions[option].berylName == "command11")
{
- setting->read_only = TRUE;
setting->value.value.as_string =
g_strdup("xkill");
}
@@ -291,7 +292,6 @@ static void readIntegratedOption(ConfigFiles *cFiles, BerylSetting * setting)
|| specialOptions[option].berylName == "maximize_window_horizontally"
|| specialOptions[option].berylName == "maximize_window_vertically")
{
- setting->read_only = TRUE;
int val = 0;
beryl_setting_value_set_keysym(&setting->value,&val);
beryl_setting_value_set_keymods(&setting->value,&val);
@@ -342,6 +342,82 @@ static void readIntegratedOption(ConfigFiles *cFiles, BerylSetting * setting)
}
}
+gboolean get_setting_is_integrated(BerylSetting * setting)
+{
+ return beryl_settings_context_get_de_integration_enabled(setting->parent->context)
+ && isIntegratedOption(setting);
+}
+
+
+gboolean get_setting_is_read_only(BerylSetting * setting)
+{
+ if (!beryl_settings_context_get_de_integration_enabled(setting->parent->context)
+ || !isIntegratedOption(setting))
+ return FALSE;
+
+ int option = 0;
+ for (unsigned int i = 0; i < N_SOPTIONS; i++)
+ {
+ if (setting->name == specialOptions[i].berylName &&
+ QString(setting->parent->name) == specialOptions[i].berylPlugin)
+ {
+ option = i;
+ break;
+ }
+ }
+ switch (specialOptions[option].type)
+ {
+ case OptionSpecial:
+ if (specialOptions[option].berylName == "command_screenshot")
+ {
+ return TRUE;
+ }
+ if (specialOptions[option].berylName == "command_window_screenshot")
+ {
+ return TRUE; }
+ if (specialOptions[option].berylName == "command11")
+ {
+ return TRUE;
+ }
+ if (specialOptions[option].berylName == "unmaximize_window"
+ || specialOptions[option].berylName == "maximize_window"
+ || specialOptions[option].berylName == "maximize_window_horizontally"
+ || specialOptions[option].berylName == "maximize_window_vertically")
+ {
+ return TRUE;
+ }
+ break;
+ default:
+ break;
+ }
+ return FALSE;
+}
+
+
+GSList * get_existing_profiles(void)
+{
+ QDir dir(KGlobal::dirs()->saveLocation("config", QString::null, false),"berylrc.*");
+ QStringList files = dir.entryList();
+
+ GSList * ret = NULL;
+
+ QStringList::iterator it;
+ for (it = files.begin(); it != files.end(); it++)
+ {
+ QString str = (*it);
+ if (str.length() > 8)
+ {
+ QString profile = str.right(str.length() - 8);
+ if (!profile.isEmpty())
+ {
+ gchar * p = g_strdup(profile.ascii());
+ ret=g_slist_append(ret,p);
+ }
+ }
+ }
+ return ret;
+}
+
void read_setting(BerylSettingsContext * c, BerylSetting * setting)
{
ConfigFiles *cFiles = (ConfigFiles *)c->backend_private_ptr;
@@ -353,12 +429,8 @@ void read_setting(BerylSettingsContext * c, BerylSetting * setting)
group += "_screen";
cfg->setGroup(group);
- setting->de_integrated = FALSE;
- setting->read_only = FALSE;
-
- if (c->de_integration && isIntegratedOption(setting))
+ if (beryl_settings_context_get_de_integration_enabled(c) && isIntegratedOption(setting))
{
- setting->de_integrated = TRUE;
readIntegratedOption(cFiles, setting);
return;
}
@@ -845,7 +917,7 @@ void write_setting(BerylSettingsContext * c, BerylSetting * setting)
group += "_screen";
cfg->setGroup(group);
- if (c->de_integration && isIntegratedOption(setting))
+ if (beryl_settings_context_get_de_integration_enabled(c) && isIntegratedOption(setting))
{
writeIntegratedOption(cFiles, setting);
return;
@@ -1018,10 +1090,10 @@ gboolean read_init(BerylSettingsContext * c)
ConfigFiles *cFiles = new ConfigFiles;
QString configName("berylrc");
- if (c->profile)
+ if (beryl_settings_context_get_profile(c))
{
configName += ".";
- configName += c->profile;
+ configName += beryl_settings_context_get_profile(c);
}
cFiles->beryl = new KSimpleConfig(configName);
cFiles->kwin = new KConfig("kwinrc",true);
@@ -1050,10 +1122,10 @@ gboolean write_init(BerylSettingsContext * c)
ConfigFiles *cFiles = new ConfigFiles;
QString configName("berylrc");
- if (c->profile)
+ if (beryl_settings_context_get_profile(c))
{
configName += ".";
- configName += c->profile;
+ configName += beryl_settings_context_get_profile(c);
}
cFiles->beryl = new KSimpleConfig(configName);
cFiles->kwin = new KConfig("kwinrc");