Changeset View
Changeset View
Standalone View
Standalone View
gtkconfig/kded/configeditor.cpp
Show First 20 Lines • Show All 42 Lines • ▼ Show 20 Line(s) | 42 | { | |||
---|---|---|---|---|---|
43 | gtk_init(nullptr, nullptr); | 43 | gtk_init(nullptr, nullptr); | ||
44 | g_autoptr(GSettings) gsettings = g_settings_new("org.gnome.desktop.interface"); | 44 | g_autoptr(GSettings) gsettings = g_settings_new("org.gnome.desktop.interface"); | ||
45 | g_settings_set_string(gsettings, paramName.toUtf8().constData(), paramValue.toUtf8().constData()); | 45 | g_settings_set_string(gsettings, paramName.toUtf8().constData(), paramValue.toUtf8().constData()); | ||
46 | } | 46 | } | ||
47 | 47 | | |||
48 | void ConfigEditor::setGtk3ConfigValueX11SettingsIni(const QString ¶mName, const QString ¶mValue) | 48 | void ConfigEditor::setGtk3ConfigValueX11SettingsIni(const QString ¶mName, const QString ¶mValue) | ||
49 | { | 49 | { | ||
50 | using qsp = QStandardPaths; | 50 | using qsp = QStandardPaths; | ||
51 | | ||||
meven: Could you reset this file changes since it is only empty lines. | |||||
51 | QString configLocation(qsp::writableLocation(qsp::GenericConfigLocation)); | 52 | QString configLocation(qsp::writableLocation(qsp::GenericConfigLocation)); | ||
52 | QString gtk3ConfigPath(configLocation + "/gtk-3.0/settings.ini"); | 53 | QString gtk3ConfigPath(configLocation + "/gtk-3.0/settings.ini"); | ||
53 | 54 | | |||
54 | KSharedConfig::Ptr gtk3Config = KSharedConfig::openConfig(gtk3ConfigPath, KConfig::NoGlobals); | 55 | KSharedConfig::Ptr gtk3Config = KSharedConfig::openConfig(gtk3ConfigPath, KConfig::NoGlobals); | ||
55 | KConfigGroup group(gtk3Config, "Settings"); | 56 | KConfigGroup group(gtk3Config, "Settings"); | ||
56 | | ||||
57 | group.writeEntry(paramName, paramValue); | 57 | group.writeEntry(paramName, paramValue); | ||
58 | group.sync(); | 58 | group.sync(); | ||
59 | } | 59 | } | ||
60 | 60 | | |||
61 | void ConfigEditor::setGtk3ConfigValueX11XSettingsd(const QString ¶mName, const QString ¶mValue) | 61 | void ConfigEditor::setGtk3ConfigValueX11XSettingsd(const QString ¶mName, const QString ¶mValue) | ||
62 | { | 62 | { | ||
63 | using qsp = QStandardPaths; | 63 | using qsp = QStandardPaths; | ||
64 | | ||||
64 | QString configLocation(qsp::writableLocation(qsp::GenericConfigLocation)); | 65 | QString configLocation(qsp::writableLocation(qsp::GenericConfigLocation)); | ||
65 | 66 | | |||
66 | QDir xsettingsdPath(configLocation + "/xsettingsd"); | 67 | QDir xsettingsdPath(configLocation + "/xsettingsd"); | ||
67 | if (!xsettingsdPath.exists()) { | 68 | if (!xsettingsdPath.exists()) { | ||
68 | xsettingsdPath.mkpath("."); | 69 | xsettingsdPath.mkpath("."); | ||
69 | } | 70 | } | ||
70 | 71 | | |||
71 | QString xSettingsdConfigPath(xsettingsdPath.path() + "/xsettingsd.conf"); | 72 | QString xSettingsdConfigPath(xsettingsdPath.path() + "/xsettingsd.conf"); | ||
72 | 73 | | |||
73 | QFile xSettingsdConfig(xSettingsdConfigPath); | 74 | QFile xSettingsdConfig(xSettingsdConfigPath); | ||
74 | QString xSettingsdConfigContents(readFileContents(xSettingsdConfig)); | 75 | QString xSettingsdConfigContents(readFileContents(xSettingsdConfig)); | ||
76 | | ||||
75 | replaceValueInXSettingsdContents(xSettingsdConfigContents, paramName, paramValue); | 77 | replaceValueInXSettingsdContents(xSettingsdConfigContents, paramName, paramValue); | ||
76 | xSettingsdConfig.remove(); | 78 | xSettingsdConfig.remove(); | ||
77 | xSettingsdConfig.open(QIODevice::WriteOnly | QIODevice::Text); | 79 | xSettingsdConfig.open(QIODevice::WriteOnly | QIODevice::Text); | ||
78 | xSettingsdConfig.write(xSettingsdConfigContents.toUtf8()); | 80 | xSettingsdConfig.write(xSettingsdConfigContents.toUtf8()); | ||
79 | reloadXSettingsd(); | 81 | reloadXSettingsd(); | ||
80 | } | 82 | } | ||
81 | 83 | | |||
82 | void ConfigEditor::setGtk2ConfigValue(const QString ¶mName, const QString ¶mValue) | 84 | void ConfigEditor::setGtk2ConfigValue(const QString ¶mName, const QString ¶mValue) | ||
83 | { | 85 | { | ||
84 | QString gtkrcPath(QDir::homePath() + "/.gtkrc-2.0"); | 86 | QString gtkrcPath(QDir::homePath() + "/.gtkrc-2.0"); | ||
85 | QFile gtkrc(gtkrcPath); | 87 | QFile gtkrc(gtkrcPath); | ||
86 | QString gtkrcContents(readFileContents(gtkrc)); | 88 | QString gtkrcContents(readFileContents(gtkrc)); | ||
89 | | ||||
87 | replaceValueInGtkrcContents(gtkrcContents, paramName, paramValue); | 90 | replaceValueInGtkrcContents(gtkrcContents, paramName, paramValue); | ||
88 | gtkrc.remove(); | 91 | gtkrc.remove(); | ||
89 | gtkrc.open(QIODevice::WriteOnly | QIODevice::Text); | 92 | gtkrc.open(QIODevice::WriteOnly | QIODevice::Text); | ||
90 | gtkrc.write(gtkrcContents.toUtf8()); | 93 | gtkrc.write(gtkrcContents.toUtf8()); | ||
91 | reloadGtk2Apps(); | 94 | reloadGtk2Apps(); | ||
92 | } | 95 | } | ||
93 | 96 | | |||
94 | QString ConfigEditor::readFileContents(QFile &file) | 97 | QString ConfigEditor::readFileContents(QFile &file) | ||
▲ Show 20 Lines • Show All 73 Lines • Show Last 20 Lines |
Could you reset this file changes since it is only empty lines.