Merge lp:~smartboyhw/ubuntu/raring/kde-gtk-config/2.1.1-1ubuntu1-1st-push into lp:ubuntu/raring/kde-gtk-config

Proposed by Howard Chan
Status: Merged
Merged at revision: 8
Proposed branch: lp:~smartboyhw/ubuntu/raring/kde-gtk-config/2.1.1-1ubuntu1-1st-push
Merge into: lp:ubuntu/raring/kde-gtk-config
Diff against target: 1100 lines (+26/-946)
13 files modified
.pc/.quilt_patches (+0/-1)
.pc/.quilt_series (+0/-1)
.pc/.version (+0/-1)
.pc/applied-patches (+0/-2)
.pc/check-gtk-preview-files-in-runtime/src/gtkconfigkcmodule.cpp (+0/-462)
.pc/mirgation-from-package-src:kcm-gtk/src/gtkconfigkcmodule.cpp (+0/-451)
debian/changelog (+16/-0)
debian/control (+4/-2)
debian/copyright (+1/-1)
debian/gtk3_preview.1 (+1/-1)
debian/gtk_preview.1 (+1/-1)
debian/reload_gtk_apps.1 (+1/-1)
src/gtkconfigkcmodule.cpp (+2/-22)
To merge this branch: bzr merge lp:~smartboyhw/ubuntu/raring/kde-gtk-config/2.1.1-1ubuntu1-1st-push
Reviewer Review Type Date Requested Status
Ubuntu branches Pending
Review via email: mp+151434@code.launchpad.net

Description of the change

New version 2.1.1-1 and fixing LP: #1103013.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== removed directory '.pc'
=== removed file '.pc/.quilt_patches'
--- .pc/.quilt_patches 2012-09-07 22:01:43 +0000
+++ .pc/.quilt_patches 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
1debian/patches
20
=== removed file '.pc/.quilt_series'
--- .pc/.quilt_series 2012-09-07 22:01:43 +0000
+++ .pc/.quilt_series 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
1series
20
=== removed file '.pc/.version'
--- .pc/.version 2012-03-13 06:57:17 +0000
+++ .pc/.version 1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
12
20
=== removed file '.pc/applied-patches'
--- .pc/applied-patches 2012-11-13 12:03:49 +0000
+++ .pc/applied-patches 1970-01-01 00:00:00 +0000
@@ -1,2 +0,0 @@
1mirgation-from-package-src:kcm-gtk
2check-gtk-preview-files-in-runtime
30
=== removed directory '.pc/check-gtk-preview-files-in-runtime'
=== removed directory '.pc/check-gtk-preview-files-in-runtime/src'
=== removed file '.pc/check-gtk-preview-files-in-runtime/src/gtkconfigkcmodule.cpp'
--- .pc/check-gtk-preview-files-in-runtime/src/gtkconfigkcmodule.cpp 2012-11-07 00:35:58 +0000
+++ .pc/check-gtk-preview-files-in-runtime/src/gtkconfigkcmodule.cpp 1970-01-01 00:00:00 +0000
@@ -1,462 +0,0 @@
1/* KDE GTK Configuration Module
2 *
3 * Copyright 2011 José Antonio Sanchez Reynaga <joanzare@gmail.com>
4 * Copyright 2011 Aleix Pol Gonzalez <aleixpol@blue-systems.com>
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) version 3, or any
10 * later version accepted by the membership of KDE e.V. (or its
11 * successor approved by the membership of KDE e.V.), which shall
12 * act as a proxy defined in Section 6 of version 3 of the license.
13 *
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
21 */
22
23#include "gtkconfigkcmodule.h"
24#include <kaboutdata.h>
25#include <KGenericFactory>
26#include <KPluginFactory>
27#include <KProcess>
28#include <KStandardDirs>
29#include <QtGui>
30#include <QX11EmbedContainer>
31#include "ui_gui.h"
32#include "abstractappearance.h"
33#include "iconthemesmodel.h"
34#include <kicontheme.h>
35
36K_PLUGIN_FACTORY(GTKConfigKCModuleFactory, registerPlugin<GTKConfigKCModule>();)
37K_EXPORT_PLUGIN(GTKConfigKCModuleFactory("cgc","kde-gtk-config"))
38
39QMap<QString, int> gtkToolbarInit()
40{
41 QMap<QString, int> gtkToolbar;
42 gtkToolbar["GTK_TOOLBAR_ICONS"] = 0;
43 gtkToolbar["GTK_TOOLBAR_TEXT"] = 1;
44 gtkToolbar["GTK_TOOLBAR_BOTH"] = 2;
45 gtkToolbar["GTK_TOOLBAR_BOTH_HORIZ"] = 3;
46 return gtkToolbar;
47}
48
49static QMap<QString, int> gtkToolbar = gtkToolbarInit();
50
51GTKConfigKCModule::GTKConfigKCModule(QWidget* parent, const QVariantList& args )
52 : KCModule(GTKConfigKCModuleFactory::componentData(), parent)
53 , ui(new Ui::GUI)
54 , installer(0)
55 , uninstaller(0)
56 , m_saveEnabled(true)
57{
58 Q_UNUSED(args);
59 KAboutData *acercade = new KAboutData("cgc","kcm_cgc",ki18n("KDE GTK Config"), "2.0",
60 ki18n("Configure your GTK Applications"),
61 KAboutData::License_LGPL_V3,
62 ki18n("Copyright 2011 José Antonio Sánchez Reynaga"));
63 acercade->addAuthor(ki18n("José Antonio Sánchez Reynaga (antonioJASR)"),ki18n("Main Developer"), "joanzare@gmail.com");
64 acercade->addAuthor(ki18n("Aleix Pol i Gonzalez"), ki18n("Feature development. Previews, code refactoring."), "aleixpol@blue-systems.com");
65 acercade->addCredit(ki18n("Manuel Tortosa (manutortosa)"), ki18n("Ideas, tester, internationalization"));
66 acercade->addCredit(ki18n("Adrián Chaves Fernández (Gallaecio)"), ki18n("Internationalization"));
67 setAboutData(acercade);
68
69 ui->setupUi(this);
70 appareance = new AppearenceGTK;
71 m_iconsModel = new IconThemesModel(false, this);
72 ui->cb_icon->setModel(m_iconsModel);
73 ui->cb_icon_fallback->setModel(m_iconsModel);
74
75 QFile oldConfigFile(QDir::homePath()+"/.gtkrc-2.0-kde");
76 QFile newConfigFile(QDir::homePath()+"/.gtkrc-2.0");
77 if(oldConfigFile.exists()) {
78 newConfigFile.remove();
79 if( !oldConfigFile.rename(newConfigFile.fileName()) )
80 kDebug() << "Could not rename old config: " + oldConfigFile.fileName();
81 else
82 kDebug() << "Old config " + oldConfigFile.fileName() +
83 "was successfully renamed to " + newConfigFile.fileName();
84 }
85
86 m_tempGtk2Preview = KGlobal::dirs()->saveLocation("tmp", "gtkrc-2.0", false);
87 m_tempGtk3Preview = KGlobal::dirs()->saveLocation("tmp", ".config/gtk-3.0/settings.ini", false);
88
89 ui->gtk2Preview->setIcon(KIcon("document-preview")); //!! for some reason it doesn't work with QIcon::fromTheme
90 ui->gtk3Preview->setIcon(KIcon("document-preview"));
91
92 m_p2 = new KProcess(this);
93 m_p2->setEnv("GTK2_RC_FILES", m_tempGtk2Preview, true);
94 *m_p2 << KStandardDirs::findExe("gtk_preview");
95
96 m_p3 = new KProcess(this);
97 m_p3->setEnv("XDG_CONFIG_HOME", KGlobal::dirs()->saveLocation("tmp", ".config"));
98 *m_p3 << KStandardDirs::findExe("gtk3_preview");
99
100 //UI changes
101 connect(ui->cb_theme, SIGNAL(currentIndexChanged(int)), this, SLOT(appChanged()));
102 connect(ui->cb_theme_gtk3, SIGNAL(currentIndexChanged(int)), this, SLOT(appChanged()));
103 connect(ui->cb_icon, SIGNAL(currentIndexChanged(int)), this, SLOT(appChanged()));
104 connect(ui->cb_icon_fallback ,SIGNAL(currentIndexChanged(int)), this, SLOT(appChanged()));
105 connect(ui->font, SIGNAL(fontSelected(QFont)), this, SLOT(appChanged()));
106 connect(ui->cb_toolbar_icons, SIGNAL(currentIndexChanged(int)), this, SLOT(appChanged()));
107 connect(ui->checkBox_icon_gtk_menus, SIGNAL(clicked(bool)), this, SLOT(appChanged()));
108 connect(ui->checkBox_icon_gtk_buttons, SIGNAL(clicked(bool)), this, SLOT(appChanged()));
109
110 //preview updates
111 connect(ui->cb_icon_fallback, SIGNAL(activated(QString)), this, SLOT(makePreviewIconTheme()));
112 connect(ui->cb_icon, SIGNAL(activated(QString)), this, SLOT(makePreviewIconTheme()));
113 connect(ui->gtk2Preview, SIGNAL(clicked(bool)), this, SLOT(runGtk2IfNecessary(bool)));
114 connect(ui->gtk3Preview, SIGNAL(clicked(bool)), this, SLOT(runGtk3IfNecessary(bool)));
115
116 connect(m_p2, SIGNAL(finished(int)), this, SLOT(untogglePreview()));
117 connect(m_p3, SIGNAL(finished(int)), this, SLOT(untogglePreview()));
118
119 QMenu* m = new QMenu(this);
120 m->addAction(KIcon("get-hot-new-stuff"), i18n("Download GTK2 themes..."), this, SLOT(showThemeGHNS()));
121 m->addAction(KIcon("get-hot-new-stuff"), i18n("Download GTK3 themes..."), this, SLOT(installThemeGTK3GHNS()));
122 m->addAction(KIcon("archive-insert"), i18n("Install a local theme..."), this, SLOT(showDialogForInstall()));
123 m->addAction(KIcon("archive-remove"), i18n("Uninstall a local theme..."), this, SLOT(showDialogForUninstall()));
124 ui->newThemes->setMenu(m);
125 ui->newThemes->setIcon(KIcon("download"));
126}
127
128GTKConfigKCModule::~GTKConfigKCModule()
129{
130 m_p2->kill();
131 m_p3->kill();
132
133 QFile::remove(m_tempGtk2Preview);
134 QFile::remove(m_tempGtk3Preview);
135 delete appareance;
136
137 m_p2->waitForFinished();
138 m_p3->waitForFinished();
139 delete ui;
140}
141
142QString fontToString(const QFont& f)
143{
144 QString style;
145
146 if(f.bold())
147 style += " bold";
148 if(f.italic())
149 style += " italic";
150
151 return f.family() + style + ' ' + QString::number(f.pointSize());
152}
153
154void GTKConfigKCModule::syncUI()
155{
156 appareance->setThemeGtk3(ui->cb_theme_gtk3->currentText());
157 appareance->setTheme(ui->cb_theme->currentText());
158 appareance->setIcon(ui->cb_icon->itemData(ui->cb_icon->currentIndex(), IconThemesModel::DirNameRole).toString());
159 appareance->setIconFallback(ui->cb_icon_fallback->itemData(ui->cb_icon_fallback->currentIndex(), IconThemesModel::DirNameRole).toString());
160 appareance->setFont(fontToString(ui->font->font()));
161
162 appareance->setToolbarStyle(gtkToolbar.key(ui->cb_toolbar_icons->currentIndex()));
163 appareance->setShowIconsInButtons(ui->checkBox_icon_gtk_buttons->isChecked());
164 appareance->setShowIconsInMenus(ui->checkBox_icon_gtk_menus->isChecked());
165}
166
167void GTKConfigKCModule::showThemeGHNS()
168{
169 KNS3::DownloadDialog d("cgctheme.knsrc", this);
170 if(d.exec()) {
171 refreshLists();
172 }
173}
174
175void GTKConfigKCModule::installThemeGTK3GHNS()
176{
177 KNS3::DownloadDialog d("cgcgtk3.knsrc", this);
178 if(d.exec()) {
179 refreshLists();
180 }
181}
182
183QFont stringToFont(const QString& font)
184{
185 QRegExp fontRx(QString(" (italic)? *(bold)? *([0-9]+)$"));
186 int pos = fontRx.indexIn(font);
187 QString fontFamily = font.left(pos);
188
189 bool italic = !fontRx.cap(1).isEmpty();
190 QFont::Weight bold = fontRx.cap(2).isEmpty() ? QFont::Normal : QFont::Bold;
191 int fontSize = fontRx.cap(3).toInt();
192
193 return QFont(fontFamily, fontSize, bold, italic);
194}
195
196void GTKConfigKCModule::refreshLists()
197{
198 refreshThemesUi(true);
199
200 QString font = appareance->getFont();
201// Q_ASSERT(!font.isEmpty());
202 ui->font->setFont(stringToFont(font));
203
204 ui->cb_toolbar_icons->setCurrentIndex(gtkToolbar[appareance->getToolbarStyle()]);
205
206 ui->checkBox_icon_gtk_buttons->setChecked(appareance->getShowIconsInButtons());
207 ui->checkBox_icon_gtk_menus->setChecked(appareance->getShowIconsInMenus());
208}
209
210void tryIcon(QLabel* label, const QString& fallback, const QString& theme, const QString& iconName)
211{
212 label->setToolTip(iconName);
213
214 QString ret;
215 if(!theme.isEmpty())
216 ret = IconThemesModel::findIconRecursivelyByName(iconName, theme);
217
218 if(!ret.isEmpty()) {
219 QPixmap p(ret);
220 Q_ASSERT(!p.isNull());
221 label->setPixmap(p);
222 return;
223 }
224
225 if(!fallback.isEmpty())
226 ret = IconThemesModel::findIconRecursivelyByName(iconName, fallback);
227
228 if(!ret.isEmpty()) {
229 QPixmap p(ret);
230 Q_ASSERT(!p.isNull());
231 label->setPixmap(p);
232 return;
233 }
234
235 KIcon notFoundIcon("application-x-zerosize");
236 QPixmap noIcon(notFoundIcon.pixmap(48,48));
237 label->setPixmap(noIcon);
238
239 kDebug() << "could not find icon" << iconName;
240}
241
242void GTKConfigKCModule::makePreviewIconTheme()
243{
244 int icon_fallback = ui->cb_icon_fallback->currentIndex();
245 QString path_fallback = ui->cb_icon->itemData(icon_fallback, IconThemesModel::PathRole).toString();
246
247 int icon = ui->cb_icon->currentIndex();
248 QString path_icon = ui->cb_icon->itemData(icon, IconThemesModel::PathRole).toString();
249
250 tryIcon(ui->lb_prev_1, path_fallback, path_icon, "user-home");
251 tryIcon(ui->lb_prev_2, path_fallback, path_icon, "folder");
252 tryIcon(ui->lb_prev_3, path_fallback, path_icon, "user-trash");
253 tryIcon(ui->lb_prev_4, path_fallback, path_icon, "document-print");
254 tryIcon(ui->lb_prev_5, path_fallback, path_icon, "user-desktop");
255 tryIcon(ui->lb_prev_6, path_fallback, path_icon, "network-server");
256 tryIcon(ui->lb_prev_7, path_fallback, path_icon, "system-help");
257 tryIcon(ui->lb_prev_8, path_fallback, path_icon, "start-here");
258 tryIcon(ui->lb_prev_9, path_fallback, path_icon, "go-up");
259}
260
261void GTKConfigKCModule::appChanged()
262{
263 savePreviewConfig();
264 emit changed(true);
265}
266
267
268void GTKConfigKCModule::savePreviewConfig()
269{
270 if(!m_saveEnabled || !(ui->gtk2Preview->isChecked() || ui->gtk3Preview->isChecked()))
271 return;
272 kDebug() << "saving UI...";
273
274 syncUI();
275
276 if(ui->gtk3Preview->isChecked()) {
277 //we don't want to recursively loop between savePreviewConfig and runIfNecessary
278 m_saveEnabled = false;
279 m_p3->kill();
280 appareance->gtk3Appearance()->saveSettings(m_tempGtk3Preview);
281
282 //need to make sure runIfNecessary() to know that it's not running
283 m_p3->waitForFinished();
284
285 m_p3->start();
286 ui->gtk3Preview->setChecked(true);
287 m_saveEnabled = true;
288 } else if(ui->gtk2Preview->isChecked())
289 appareance->gtk2Appearance()->saveSettings(m_tempGtk2Preview);
290}
291
292void GTKConfigKCModule::runGtk2IfNecessary(bool checked)
293{
294 KProcess* p = m_p2;
295 KProcess* np = m_p3;
296
297 if(checked) {
298 np->kill();
299 np->waitForFinished();
300 savePreviewConfig();
301 if(p->state()!=KProcess::Running)
302 p->start();
303 } else {
304 p->kill();
305 p->waitForFinished();
306 }
307}
308
309void GTKConfigKCModule::runGtk3IfNecessary(bool checked)
310{
311 KProcess* p = m_p3;
312 KProcess* np = m_p2;
313
314 if(checked) {
315 np->kill();
316 np->waitForFinished();
317 savePreviewConfig();
318 if(p->state()!=KProcess::Running)
319 p->start();
320 } else {
321 p->kill();
322 p->waitForFinished();
323 }
324}
325
326void GTKConfigKCModule::save()
327{
328 kDebug() << "******************************************* INSTALLATION :\n"
329 << "theme : " << appareance->getTheme() << "\n"
330 << "themeGTK3 : " << appareance->getThemeGtk3() << "\n"
331 << "icons : " << appareance->getIcon() << "\n"
332 << "fallback icons : " << appareance->getIconFallback() << "\n"
333 << "font family : " << appareance->getFont() << "\n"
334 << "toolbar style : " << appareance->getToolbarStyle() << "\n"
335 << "icons in buttons : " << appareance->getShowIconsInButtons() << "\n"
336 << "icons in menus : " << appareance->getShowIconsInMenus() << "\n"
337 << "********************************************************";
338 syncUI();
339 if(!appareance->saveFileConfig())
340 QMessageBox::warning(this, "ERROR", i18n("It was not possible to save the config"));
341}
342
343void setComboItem(QComboBox* combo, const QStringList& texts)
344{
345 foreach(const QString& text, texts) {
346 int pos = combo->findText(text);
347 if(pos>=0) {
348 combo->setCurrentIndex(pos);
349 return;
350 }
351 }
352}
353
354void GTKConfigKCModule::defaults()
355{
356 kDebug() << "loading defaults...";
357 m_saveEnabled = false;
358 ui->font->setFont(font());
359 bool showIcons = !QCoreApplication::testAttribute(Qt::AA_DontShowIconsInMenus);
360 ui->checkBox_icon_gtk_buttons->setChecked(showIcons);
361 ui->checkBox_icon_gtk_menus->setChecked(showIcons);
362
363 setComboItem(ui->cb_theme, QStringList("oxygen-gtk") << "Clearlooks");
364 setComboItem(ui->cb_theme_gtk3, QStringList("oxygen-gtk") << "Adwaita");
365
366 QStringList icons;
367 icons << KIconTheme(KIconTheme::current()).name() << "GNOME";
368 setComboItem(ui->cb_icon, icons);
369
370 int idx = ui->cb_icon->currentIndex();
371 if(idx>=0) {
372 setComboItem(ui->cb_icon_fallback, icons.mid(icons.indexOf(ui->cb_icon->currentText())+1));
373 }
374 m_saveEnabled = true;
375
376 makePreviewIconTheme();
377 appChanged();
378}
379
380void GTKConfigKCModule::load()
381{
382 m_saveEnabled = false;
383 refreshThemesUi();
384
385 bool someCorrect = appareance->loadFileConfig();
386 if(someCorrect) {
387 refreshLists();
388 makePreviewIconTheme();
389 } else
390 defaults();
391
392 m_saveEnabled = true;
393}
394
395void refreshComboSameCurrentValue(QComboBox* combo, const QString& temp, const QStringList& texts)
396{
397 combo->clear();
398 combo->addItems(texts);
399 int idx = combo->findText(temp);
400 if(idx>=0)
401 combo->setCurrentIndex(idx);
402}
403
404void GTKConfigKCModule::refreshThemesUi(bool useConfig)
405{
406 //theme gtk2
407 bool wasenabled = m_saveEnabled;
408 m_saveEnabled = false;
409
410 refreshComboSameCurrentValue(ui->cb_theme,
411 useConfig ? appareance->getTheme() : ui->cb_theme->currentText(),
412 appareance->gtk2Appearance()->installedThemesNames());
413
414 //theme gtk3
415 refreshComboSameCurrentValue(ui->cb_theme_gtk3,
416 useConfig ? appareance->getThemeGtk3() : ui->cb_theme_gtk3->currentText(),
417 appareance->gtk3Appearance()->installedThemesNames());
418
419 //icons
420 QString currentIcon = useConfig ? appareance->getIcon() : ui->cb_icon->currentText(),
421 currentFallback = useConfig ? appareance->getIconFallback() : ui->cb_icon_fallback->currentText();
422 int currentIconIdx = ui->cb_icon->findData(currentIcon, IconThemesModel::DirNameRole);
423 int currentFallbackIdx = ui->cb_icon_fallback->findData(currentFallback, IconThemesModel::DirNameRole);
424 ui->cb_icon->setCurrentIndex(qMax(currentIconIdx, 0));
425 ui->cb_icon_fallback->setCurrentIndex(qMax(currentFallbackIdx, 0));
426
427 m_saveEnabled = wasenabled;
428 if(currentIconIdx<0 || currentFallbackIdx<0)
429 emit changed(true);
430}
431
432void GTKConfigKCModule::showDialogForInstall()
433{
434 if(!installer) {
435 installer = new DialogInstaller(this);
436 connect(installer, SIGNAL(themeInstalled()), SLOT(refreshLists()));
437 }
438
439 installer->exec();
440 refreshThemesUi();
441}
442
443void GTKConfigKCModule::showDialogForUninstall()
444{
445 if(!uninstaller) {
446 uninstaller = new DialogUninstaller(this, appareance);
447 connect(uninstaller, SIGNAL(themeUninstalled()), SLOT(refreshLists()));
448 }
449
450 uninstaller->refresthListsForUninstall();
451 uninstaller->exec();
452
453 refreshThemesUi();
454}
455
456void GTKConfigKCModule::untogglePreview()
457{
458 if(sender()==m_p2)
459 ui->gtk2Preview->setChecked(false);
460 else
461 ui->gtk3Preview->setChecked(false);
462}
4630
=== removed directory '.pc/mirgation-from-package-src:kcm-gtk'
=== removed directory '.pc/mirgation-from-package-src:kcm-gtk/src'
=== removed file '.pc/mirgation-from-package-src:kcm-gtk/src/gtkconfigkcmodule.cpp'
--- .pc/mirgation-from-package-src:kcm-gtk/src/gtkconfigkcmodule.cpp 2012-11-07 00:35:58 +0000
+++ .pc/mirgation-from-package-src:kcm-gtk/src/gtkconfigkcmodule.cpp 1970-01-01 00:00:00 +0000
@@ -1,451 +0,0 @@
1/* KDE GTK Configuration Module
2 *
3 * Copyright 2011 José Antonio Sanchez Reynaga <joanzare@gmail.com>
4 * Copyright 2011 Aleix Pol Gonzalez <aleixpol@blue-systems.com>
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) version 3, or any
10 * later version accepted by the membership of KDE e.V. (or its
11 * successor approved by the membership of KDE e.V.), which shall
12 * act as a proxy defined in Section 6 of version 3 of the license.
13 *
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
21 */
22
23#include "gtkconfigkcmodule.h"
24#include <kaboutdata.h>
25#include <KGenericFactory>
26#include <KPluginFactory>
27#include <KProcess>
28#include <KStandardDirs>
29#include <QtGui>
30#include <QX11EmbedContainer>
31#include "ui_gui.h"
32#include "abstractappearance.h"
33#include "iconthemesmodel.h"
34#include <kicontheme.h>
35
36K_PLUGIN_FACTORY(GTKConfigKCModuleFactory, registerPlugin<GTKConfigKCModule>();)
37K_EXPORT_PLUGIN(GTKConfigKCModuleFactory("cgc","kde-gtk-config"))
38
39QMap<QString, int> gtkToolbarInit()
40{
41 QMap<QString, int> gtkToolbar;
42 gtkToolbar["GTK_TOOLBAR_ICONS"] = 0;
43 gtkToolbar["GTK_TOOLBAR_TEXT"] = 1;
44 gtkToolbar["GTK_TOOLBAR_BOTH"] = 2;
45 gtkToolbar["GTK_TOOLBAR_BOTH_HORIZ"] = 3;
46 return gtkToolbar;
47}
48
49static QMap<QString, int> gtkToolbar = gtkToolbarInit();
50
51GTKConfigKCModule::GTKConfigKCModule(QWidget* parent, const QVariantList& args )
52 : KCModule(GTKConfigKCModuleFactory::componentData(), parent)
53 , ui(new Ui::GUI)
54 , installer(0)
55 , uninstaller(0)
56 , m_saveEnabled(true)
57{
58 Q_UNUSED(args);
59 KAboutData *acercade = new KAboutData("cgc","kcm_cgc",ki18n("KDE GTK Config"), "2.0",
60 ki18n("Configure your GTK Applications"),
61 KAboutData::License_LGPL_V3,
62 ki18n("Copyright 2011 José Antonio Sánchez Reynaga"));
63 acercade->addAuthor(ki18n("José Antonio Sánchez Reynaga (antonioJASR)"),ki18n("Main Developer"), "joanzare@gmail.com");
64 acercade->addAuthor(ki18n("Aleix Pol i Gonzalez"), ki18n("Feature development. Previews, code refactoring."), "aleixpol@blue-systems.com");
65 acercade->addCredit(ki18n("Manuel Tortosa (manutortosa)"), ki18n("Ideas, tester, internationalization"));
66 acercade->addCredit(ki18n("Adrián Chaves Fernández (Gallaecio)"), ki18n("Internationalization"));
67 setAboutData(acercade);
68
69 ui->setupUi(this);
70 appareance = new AppearenceGTK;
71 m_iconsModel = new IconThemesModel(false, this);
72 ui->cb_icon->setModel(m_iconsModel);
73 ui->cb_icon_fallback->setModel(m_iconsModel);
74
75 m_tempGtk2Preview = KGlobal::dirs()->saveLocation("tmp", "gtkrc-2.0", false);
76 m_tempGtk3Preview = KGlobal::dirs()->saveLocation("tmp", ".config/gtk-3.0/settings.ini", false);
77
78 ui->gtk2Preview->setIcon(KIcon("document-preview")); //!! for some reason it doesn't work with QIcon::fromTheme
79 ui->gtk3Preview->setIcon(KIcon("document-preview"));
80
81 m_p2 = new KProcess(this);
82 m_p2->setEnv("GTK2_RC_FILES", m_tempGtk2Preview, true);
83 *m_p2 << KStandardDirs::findExe("gtk_preview");
84
85 m_p3 = new KProcess(this);
86 m_p3->setEnv("XDG_CONFIG_HOME", KGlobal::dirs()->saveLocation("tmp", ".config"));
87 *m_p3 << KStandardDirs::findExe("gtk3_preview");
88
89 //UI changes
90 connect(ui->cb_theme, SIGNAL(currentIndexChanged(int)), this, SLOT(appChanged()));
91 connect(ui->cb_theme_gtk3, SIGNAL(currentIndexChanged(int)), this, SLOT(appChanged()));
92 connect(ui->cb_icon, SIGNAL(currentIndexChanged(int)), this, SLOT(appChanged()));
93 connect(ui->cb_icon_fallback ,SIGNAL(currentIndexChanged(int)), this, SLOT(appChanged()));
94 connect(ui->font, SIGNAL(fontSelected(QFont)), this, SLOT(appChanged()));
95 connect(ui->cb_toolbar_icons, SIGNAL(currentIndexChanged(int)), this, SLOT(appChanged()));
96 connect(ui->checkBox_icon_gtk_menus, SIGNAL(clicked(bool)), this, SLOT(appChanged()));
97 connect(ui->checkBox_icon_gtk_buttons, SIGNAL(clicked(bool)), this, SLOT(appChanged()));
98
99 //preview updates
100 connect(ui->cb_icon_fallback, SIGNAL(activated(QString)), this, SLOT(makePreviewIconTheme()));
101 connect(ui->cb_icon, SIGNAL(activated(QString)), this, SLOT(makePreviewIconTheme()));
102 connect(ui->gtk2Preview, SIGNAL(clicked(bool)), this, SLOT(runGtk2IfNecessary(bool)));
103 connect(ui->gtk3Preview, SIGNAL(clicked(bool)), this, SLOT(runGtk3IfNecessary(bool)));
104
105 connect(m_p2, SIGNAL(finished(int)), this, SLOT(untogglePreview()));
106 connect(m_p3, SIGNAL(finished(int)), this, SLOT(untogglePreview()));
107
108 QMenu* m = new QMenu(this);
109 m->addAction(KIcon("get-hot-new-stuff"), i18n("Download GTK2 themes..."), this, SLOT(showThemeGHNS()));
110 m->addAction(KIcon("get-hot-new-stuff"), i18n("Download GTK3 themes..."), this, SLOT(installThemeGTK3GHNS()));
111 m->addAction(KIcon("archive-insert"), i18n("Install a local theme..."), this, SLOT(showDialogForInstall()));
112 m->addAction(KIcon("archive-remove"), i18n("Uninstall a local theme..."), this, SLOT(showDialogForUninstall()));
113 ui->newThemes->setMenu(m);
114 ui->newThemes->setIcon(KIcon("download"));
115}
116
117GTKConfigKCModule::~GTKConfigKCModule()
118{
119 m_p2->kill();
120 m_p3->kill();
121
122 QFile::remove(m_tempGtk2Preview);
123 QFile::remove(m_tempGtk3Preview);
124 delete appareance;
125
126 m_p2->waitForFinished();
127 m_p3->waitForFinished();
128 delete ui;
129}
130
131QString fontToString(const QFont& f)
132{
133 QString style;
134
135 if(f.bold())
136 style += " bold";
137 if(f.italic())
138 style += " italic";
139
140 return f.family() + style + ' ' + QString::number(f.pointSize());
141}
142
143void GTKConfigKCModule::syncUI()
144{
145 appareance->setThemeGtk3(ui->cb_theme_gtk3->currentText());
146 appareance->setTheme(ui->cb_theme->currentText());
147 appareance->setIcon(ui->cb_icon->itemData(ui->cb_icon->currentIndex(), IconThemesModel::DirNameRole).toString());
148 appareance->setIconFallback(ui->cb_icon_fallback->itemData(ui->cb_icon_fallback->currentIndex(), IconThemesModel::DirNameRole).toString());
149 appareance->setFont(fontToString(ui->font->font()));
150
151 appareance->setToolbarStyle(gtkToolbar.key(ui->cb_toolbar_icons->currentIndex()));
152 appareance->setShowIconsInButtons(ui->checkBox_icon_gtk_buttons->isChecked());
153 appareance->setShowIconsInMenus(ui->checkBox_icon_gtk_menus->isChecked());
154}
155
156void GTKConfigKCModule::showThemeGHNS()
157{
158 KNS3::DownloadDialog d("cgctheme.knsrc", this);
159 if(d.exec()) {
160 refreshLists();
161 }
162}
163
164void GTKConfigKCModule::installThemeGTK3GHNS()
165{
166 KNS3::DownloadDialog d("cgcgtk3.knsrc", this);
167 if(d.exec()) {
168 refreshLists();
169 }
170}
171
172QFont stringToFont(const QString& font)
173{
174 QRegExp fontRx(QString(" (italic)? *(bold)? *([0-9]+)$"));
175 int pos = fontRx.indexIn(font);
176 QString fontFamily = font.left(pos);
177
178 bool italic = !fontRx.cap(1).isEmpty();
179 QFont::Weight bold = fontRx.cap(2).isEmpty() ? QFont::Normal : QFont::Bold;
180 int fontSize = fontRx.cap(3).toInt();
181
182 return QFont(fontFamily, fontSize, bold, italic);
183}
184
185void GTKConfigKCModule::refreshLists()
186{
187 refreshThemesUi(true);
188
189 QString font = appareance->getFont();
190// Q_ASSERT(!font.isEmpty());
191 ui->font->setFont(stringToFont(font));
192
193 ui->cb_toolbar_icons->setCurrentIndex(gtkToolbar[appareance->getToolbarStyle()]);
194
195 ui->checkBox_icon_gtk_buttons->setChecked(appareance->getShowIconsInButtons());
196 ui->checkBox_icon_gtk_menus->setChecked(appareance->getShowIconsInMenus());
197}
198
199void tryIcon(QLabel* label, const QString& fallback, const QString& theme, const QString& iconName)
200{
201 label->setToolTip(iconName);
202
203 QString ret;
204 if(!theme.isEmpty())
205 ret = IconThemesModel::findIconRecursivelyByName(iconName, theme);
206
207 if(!ret.isEmpty()) {
208 QPixmap p(ret);
209 Q_ASSERT(!p.isNull());
210 label->setPixmap(p);
211 return;
212 }
213
214 if(!fallback.isEmpty())
215 ret = IconThemesModel::findIconRecursivelyByName(iconName, fallback);
216
217 if(!ret.isEmpty()) {
218 QPixmap p(ret);
219 Q_ASSERT(!p.isNull());
220 label->setPixmap(p);
221 return;
222 }
223
224 KIcon notFoundIcon("application-x-zerosize");
225 QPixmap noIcon(notFoundIcon.pixmap(48,48));
226 label->setPixmap(noIcon);
227
228 kDebug() << "could not find icon" << iconName;
229}
230
231void GTKConfigKCModule::makePreviewIconTheme()
232{
233 int icon_fallback = ui->cb_icon_fallback->currentIndex();
234 QString path_fallback = ui->cb_icon->itemData(icon_fallback, IconThemesModel::PathRole).toString();
235
236 int icon = ui->cb_icon->currentIndex();
237 QString path_icon = ui->cb_icon->itemData(icon, IconThemesModel::PathRole).toString();
238
239 tryIcon(ui->lb_prev_1, path_fallback, path_icon, "user-home");
240 tryIcon(ui->lb_prev_2, path_fallback, path_icon, "folder");
241 tryIcon(ui->lb_prev_3, path_fallback, path_icon, "user-trash");
242 tryIcon(ui->lb_prev_4, path_fallback, path_icon, "document-print");
243 tryIcon(ui->lb_prev_5, path_fallback, path_icon, "user-desktop");
244 tryIcon(ui->lb_prev_6, path_fallback, path_icon, "network-server");
245 tryIcon(ui->lb_prev_7, path_fallback, path_icon, "system-help");
246 tryIcon(ui->lb_prev_8, path_fallback, path_icon, "start-here");
247 tryIcon(ui->lb_prev_9, path_fallback, path_icon, "go-up");
248}
249
250void GTKConfigKCModule::appChanged()
251{
252 savePreviewConfig();
253 emit changed(true);
254}
255
256
257void GTKConfigKCModule::savePreviewConfig()
258{
259 if(!m_saveEnabled || !(ui->gtk2Preview->isChecked() || ui->gtk3Preview->isChecked()))
260 return;
261 kDebug() << "saving UI...";
262
263 syncUI();
264
265 if(ui->gtk3Preview->isChecked()) {
266 //we don't want to recursively loop between savePreviewConfig and runIfNecessary
267 m_saveEnabled = false;
268 m_p3->kill();
269 appareance->gtk3Appearance()->saveSettings(m_tempGtk3Preview);
270
271 //need to make sure runIfNecessary() to know that it's not running
272 m_p3->waitForFinished();
273
274 m_p3->start();
275 ui->gtk3Preview->setChecked(true);
276 m_saveEnabled = true;
277 } else if(ui->gtk2Preview->isChecked())
278 appareance->gtk2Appearance()->saveSettings(m_tempGtk2Preview);
279}
280
281void GTKConfigKCModule::runGtk2IfNecessary(bool checked)
282{
283 KProcess* p = m_p2;
284 KProcess* np = m_p3;
285
286 if(checked) {
287 np->kill();
288 np->waitForFinished();
289 savePreviewConfig();
290 if(p->state()!=KProcess::Running)
291 p->start();
292 } else {
293 p->kill();
294 p->waitForFinished();
295 }
296}
297
298void GTKConfigKCModule::runGtk3IfNecessary(bool checked)
299{
300 KProcess* p = m_p3;
301 KProcess* np = m_p2;
302
303 if(checked) {
304 np->kill();
305 np->waitForFinished();
306 savePreviewConfig();
307 if(p->state()!=KProcess::Running)
308 p->start();
309 } else {
310 p->kill();
311 p->waitForFinished();
312 }
313}
314
315void GTKConfigKCModule::save()
316{
317 kDebug() << "******************************************* INSTALLATION :\n"
318 << "theme : " << appareance->getTheme() << "\n"
319 << "themeGTK3 : " << appareance->getThemeGtk3() << "\n"
320 << "icons : " << appareance->getIcon() << "\n"
321 << "fallback icons : " << appareance->getIconFallback() << "\n"
322 << "font family : " << appareance->getFont() << "\n"
323 << "toolbar style : " << appareance->getToolbarStyle() << "\n"
324 << "icons in buttons : " << appareance->getShowIconsInButtons() << "\n"
325 << "icons in menus : " << appareance->getShowIconsInMenus() << "\n"
326 << "********************************************************";
327 syncUI();
328 if(!appareance->saveFileConfig())
329 QMessageBox::warning(this, "ERROR", i18n("It was not possible to save the config"));
330}
331
332void setComboItem(QComboBox* combo, const QStringList& texts)
333{
334 foreach(const QString& text, texts) {
335 int pos = combo->findText(text);
336 if(pos>=0) {
337 combo->setCurrentIndex(pos);
338 return;
339 }
340 }
341}
342
343void GTKConfigKCModule::defaults()
344{
345 kDebug() << "loading defaults...";
346 m_saveEnabled = false;
347 ui->font->setFont(font());
348 bool showIcons = !QCoreApplication::testAttribute(Qt::AA_DontShowIconsInMenus);
349 ui->checkBox_icon_gtk_buttons->setChecked(showIcons);
350 ui->checkBox_icon_gtk_menus->setChecked(showIcons);
351
352 setComboItem(ui->cb_theme, QStringList("oxygen-gtk") << "Clearlooks");
353 setComboItem(ui->cb_theme_gtk3, QStringList("oxygen-gtk") << "Adwaita");
354
355 QStringList icons;
356 icons << KIconTheme(KIconTheme::current()).name() << "GNOME";
357 setComboItem(ui->cb_icon, icons);
358
359 int idx = ui->cb_icon->currentIndex();
360 if(idx>=0) {
361 setComboItem(ui->cb_icon_fallback, icons.mid(icons.indexOf(ui->cb_icon->currentText())+1));
362 }
363 m_saveEnabled = true;
364
365 makePreviewIconTheme();
366 appChanged();
367}
368
369void GTKConfigKCModule::load()
370{
371 m_saveEnabled = false;
372 refreshThemesUi();
373
374 bool someCorrect = appareance->loadFileConfig();
375 if(someCorrect) {
376 refreshLists();
377 makePreviewIconTheme();
378 } else
379 defaults();
380
381 m_saveEnabled = true;
382}
383
384void refreshComboSameCurrentValue(QComboBox* combo, const QString& temp, const QStringList& texts)
385{
386 combo->clear();
387 combo->addItems(texts);
388 int idx = combo->findText(temp);
389 if(idx>=0)
390 combo->setCurrentIndex(idx);
391}
392
393void GTKConfigKCModule::refreshThemesUi(bool useConfig)
394{
395 //theme gtk2
396 bool wasenabled = m_saveEnabled;
397 m_saveEnabled = false;
398
399 refreshComboSameCurrentValue(ui->cb_theme,
400 useConfig ? appareance->getTheme() : ui->cb_theme->currentText(),
401 appareance->gtk2Appearance()->installedThemesNames());
402
403 //theme gtk3
404 refreshComboSameCurrentValue(ui->cb_theme_gtk3,
405 useConfig ? appareance->getThemeGtk3() : ui->cb_theme_gtk3->currentText(),
406 appareance->gtk3Appearance()->installedThemesNames());
407
408 //icons
409 QString currentIcon = useConfig ? appareance->getIcon() : ui->cb_icon->currentText(),
410 currentFallback = useConfig ? appareance->getIconFallback() : ui->cb_icon_fallback->currentText();
411 int currentIconIdx = ui->cb_icon->findData(currentIcon, IconThemesModel::DirNameRole);
412 int currentFallbackIdx = ui->cb_icon_fallback->findData(currentFallback, IconThemesModel::DirNameRole);
413 ui->cb_icon->setCurrentIndex(qMax(currentIconIdx, 0));
414 ui->cb_icon_fallback->setCurrentIndex(qMax(currentFallbackIdx, 0));
415
416 m_saveEnabled = wasenabled;
417 if(currentIconIdx<0 || currentFallbackIdx<0)
418 emit changed(true);
419}
420
421void GTKConfigKCModule::showDialogForInstall()
422{
423 if(!installer) {
424 installer = new DialogInstaller(this);
425 connect(installer, SIGNAL(themeInstalled()), SLOT(refreshLists()));
426 }
427
428 installer->exec();
429 refreshThemesUi();
430}
431
432void GTKConfigKCModule::showDialogForUninstall()
433{
434 if(!uninstaller) {
435 uninstaller = new DialogUninstaller(this, appareance);
436 connect(uninstaller, SIGNAL(themeUninstalled()), SLOT(refreshLists()));
437 }
438
439 uninstaller->refresthListsForUninstall();
440 uninstaller->exec();
441
442 refreshThemesUi();
443}
444
445void GTKConfigKCModule::untogglePreview()
446{
447 if(sender()==m_p2)
448 ui->gtk2Preview->setChecked(false);
449 else
450 ui->gtk3Preview->setChecked(false);
451}
4520
=== modified file 'debian/changelog'
--- debian/changelog 2012-11-13 12:03:49 +0000
+++ debian/changelog 2013-03-04 09:07:24 +0000
@@ -1,3 +1,19 @@
1kde-gtk-config (3:2.1.1-1ubuntu1) raring; urgency=low
2
3 * Merge from Debian experimental (LP: #1103013)
4
5 -- Howard Chan <smartboyhw@gmail.com> Mon, 04 Mar 2013 16:52:47 +0800
6
7kde-gtk-config (3:2.1.1-1) experimental; urgency=low
8
9 * Update project Homepage.
10 * Update debian/control for kde-config-gtk-style-preview:
11 - add Breaks against old kde-config-gtk-style (Closes: #698285)
12 - add Recommends against kde-config-gtk-style
13 * Bump Standards-Version to 3.9.4 (was 3.9.3): no changes required.
14
15 -- Boris Pek <tehnick-8@mail.ru> Sun, 20 Jan 2013 15:21:10 +0200
16
1kde-gtk-config (3:2.1.1-1~exp1ubuntu1) raring; urgency=low17kde-gtk-config (3:2.1.1-1~exp1ubuntu1) raring; urgency=low
218
3 * Merge with Debian experimental (LP: #1077846)19 * Merge with Debian experimental (LP: #1077846)
420
=== modified file 'debian/control'
--- debian/control 2012-11-13 12:03:49 +0000
+++ debian/control 2013-03-04 09:07:24 +0000
@@ -6,10 +6,10 @@
6Uploaders: Boris Pek <tehnick-8@mail.ru>6Uploaders: Boris Pek <tehnick-8@mail.ru>
7Build-Depends: debhelper (>= 8), cmake,7Build-Depends: debhelper (>= 8), cmake,
8 kdelibs5-dev, pkg-kde-tools, libgtk2.0-dev, libgtk-3-dev8 kdelibs5-dev, pkg-kde-tools, libgtk2.0-dev, libgtk-3-dev
9Homepage: https://projects.kde.org/projects/playground/base/kde-gtk-config9Homepage: https://projects.kde.org/projects/extragear/base/kde-gtk-config
10Vcs-Git: git://github.com/tehnick/kde-gtk-config-debian.git10Vcs-Git: git://github.com/tehnick/kde-gtk-config-debian.git
11Vcs-Browser: https://github.com/tehnick/kde-gtk-config-debian11Vcs-Browser: https://github.com/tehnick/kde-gtk-config-debian
12Standards-Version: 3.9.312Standards-Version: 3.9.4
1313
14Package: kde-config-gtk-style14Package: kde-config-gtk-style
15Architecture: any15Architecture: any
@@ -30,6 +30,8 @@
30Package: kde-config-gtk-style-preview30Package: kde-config-gtk-style-preview
31Architecture: any31Architecture: any
32Depends: ${shlibs:Depends}, ${misc:Depends}32Depends: ${shlibs:Depends}, ${misc:Depends}
33Recommends: kde-config-gtk-style
34Breaks: kde-config-gtk-style (<< 3:2.1.1-1~exp1~)
33Description: KDE configuration module for GTK+ 2.x and GTK+ 3.x styles selection (extras)35Description: KDE configuration module for GTK+ 2.x and GTK+ 3.x styles selection (extras)
34 Configuration dialog to adapt GTK+ applications appearance to your taste36 Configuration dialog to adapt GTK+ applications appearance to your taste
35 under KDE. Among its many features, it lets you:37 under KDE. Among its many features, it lets you:
3638
=== modified file 'debian/copyright'
--- debian/copyright 2012-03-13 06:57:17 +0000
+++ debian/copyright 2013-03-04 09:07:24 +0000
@@ -4,7 +4,7 @@
4Upstream-Name: KDE GTK Configurator4Upstream-Name: KDE GTK Configurator
5Upstream-Contact: Jose Antonio Sánchez Reynaga <joanzare@gmail.com>5Upstream-Contact: Jose Antonio Sánchez Reynaga <joanzare@gmail.com>
6 Aleix Pol Gonzalez <aleixpol@blue-systems.com>6 Aleix Pol Gonzalez <aleixpol@blue-systems.com>
7Source: https://projects.kde.org/projects/playground/base/kde-gtk-config7Source: https://projects.kde.org/projects/extragear/base/kde-gtk-config
8 The orig.tar.bz2 is just renamed upstream tarball (without changes).8 The orig.tar.bz2 is just renamed upstream tarball (without changes).
9 See section get-orig-source in debian/rules file for details.9 See section get-orig-source in debian/rules file for details.
1010
1111
=== modified file 'debian/gtk3_preview.1'
--- debian/gtk3_preview.1 2012-03-13 06:57:17 +0000
+++ debian/gtk3_preview.1 2013-03-04 09:07:24 +0000
@@ -24,7 +24,7 @@
24.SH AUTHOR24.SH AUTHOR
25This program was written by Aleix Pol Gonzalez <aleixpol@kde.org>.25This program was written by Aleix Pol Gonzalez <aleixpol@kde.org>.
26.br26.br
27Homepage: \fBhttps://projects.kde.org/projects/playground/base/kde-gtk-config\fR27Homepage: \fBhttps://projects.kde.org/projects/extragear/base/kde-gtk-config\fR
28.SH "BUG REPORTS"28.SH "BUG REPORTS"
29If you find a bug in this program please report it to original author.29If you find a bug in this program please report it to original author.
30.PP30.PP
3131
=== modified file 'debian/gtk_preview.1'
--- debian/gtk_preview.1 2012-03-13 06:57:17 +0000
+++ debian/gtk_preview.1 2013-03-04 09:07:24 +0000
@@ -24,7 +24,7 @@
24.SH AUTHOR24.SH AUTHOR
25This program was written by Aleix Pol Gonzalez <aleixpol@kde.org>.25This program was written by Aleix Pol Gonzalez <aleixpol@kde.org>.
26.br26.br
27Homepage: \fBhttps://projects.kde.org/projects/playground/base/kde-gtk-config\fR27Homepage: \fBhttps://projects.kde.org/projects/extragear/base/kde-gtk-config\fR
28.SH "BUG REPORTS"28.SH "BUG REPORTS"
29If you find a bug in this program please report it to original author.29If you find a bug in this program please report it to original author.
30.PP30.PP
3131
=== modified file 'debian/reload_gtk_apps.1'
--- debian/reload_gtk_apps.1 2012-03-13 06:57:17 +0000
+++ debian/reload_gtk_apps.1 2013-03-04 09:07:24 +0000
@@ -21,7 +21,7 @@
21.SH AUTHOR21.SH AUTHOR
22This program was written by Aleix Pol Gonzalez <aleixpol@kde.org>.22This program was written by Aleix Pol Gonzalez <aleixpol@kde.org>.
23.br23.br
24Homepage: \fBhttps://projects.kde.org/projects/playground/base/kde-gtk-config\fR24Homepage: \fBhttps://projects.kde.org/projects/extragear/base/kde-gtk-config\fR
25.SH "BUG REPORTS"25.SH "BUG REPORTS"
26If you find a bug in this program please report it to original author.26If you find a bug in this program please report it to original author.
27.PP27.PP
2828
=== modified file 'src/gtkconfigkcmodule.cpp'
--- src/gtkconfigkcmodule.cpp 2012-11-13 12:03:49 +0000
+++ src/gtkconfigkcmodule.cpp 2013-03-04 09:07:24 +0000
@@ -72,39 +72,19 @@
72 ui->cb_icon->setModel(m_iconsModel);72 ui->cb_icon->setModel(m_iconsModel);
73 ui->cb_icon_fallback->setModel(m_iconsModel);73 ui->cb_icon_fallback->setModel(m_iconsModel);
74 74
75 QFile oldConfigFile(QDir::homePath()+"/.gtkrc-2.0-kde");
76 QFile newConfigFile(QDir::homePath()+"/.gtkrc-2.0");
77 if(oldConfigFile.exists()) {
78 newConfigFile.remove();
79 if( !oldConfigFile.rename(newConfigFile.fileName()) )
80 kDebug() << "Could not rename old config: " + oldConfigFile.fileName();
81 else
82 kDebug() << "Old config " + oldConfigFile.fileName() +
83 "was successfully renamed to " + newConfigFile.fileName();
84 }
85
86 m_tempGtk2Preview = KGlobal::dirs()->saveLocation("tmp", "gtkrc-2.0", false);75 m_tempGtk2Preview = KGlobal::dirs()->saveLocation("tmp", "gtkrc-2.0", false);
87 m_tempGtk3Preview = KGlobal::dirs()->saveLocation("tmp", ".config/gtk-3.0/settings.ini", false);76 m_tempGtk3Preview = KGlobal::dirs()->saveLocation("tmp", ".config/gtk-3.0/settings.ini", false);
88 77
89 ui->gtk2Preview->setIcon(KIcon("document-preview")); //!! for some reason it doesn't work with QIcon::fromTheme78 ui->gtk2Preview->setIcon(KIcon("document-preview")); //!! for some reason it doesn't work with QIcon::fromTheme
90 ui->gtk3Preview->setIcon(KIcon("document-preview"));79 ui->gtk3Preview->setIcon(KIcon("document-preview"));
91 80
92 ui->gtk2Preview->hide();
93 ui->gtk3Preview->hide();
94
95 m_p2 = new KProcess(this);81 m_p2 = new KProcess(this);
96 m_p2->setEnv("GTK2_RC_FILES", m_tempGtk2Preview, true);82 m_p2->setEnv("GTK2_RC_FILES", m_tempGtk2Preview, true);
97 if (KStandardDirs::findExe("gtk_preview") != QString::null) {83 *m_p2 << KStandardDirs::findExe("gtk_preview");
98 *m_p2 << KStandardDirs::findExe("gtk_preview");
99 ui->gtk2Preview->show();
100 }
101 84
102 m_p3 = new KProcess(this);85 m_p3 = new KProcess(this);
103 m_p3->setEnv("XDG_CONFIG_HOME", KGlobal::dirs()->saveLocation("tmp", ".config"));86 m_p3->setEnv("XDG_CONFIG_HOME", KGlobal::dirs()->saveLocation("tmp", ".config"));
104 if (KStandardDirs::findExe("gtk3_preview") != QString::null) {87 *m_p3 << KStandardDirs::findExe("gtk3_preview");
105 *m_p3 << KStandardDirs::findExe("gtk3_preview");
106 ui->gtk3Preview->show();
107 }
108 88
109 //UI changes89 //UI changes
110 connect(ui->cb_theme, SIGNAL(currentIndexChanged(int)), this, SLOT(appChanged()));90 connect(ui->cb_theme, SIGNAL(currentIndexChanged(int)), this, SLOT(appChanged()));

Subscribers

People subscribed via source and target branches

to all changes: