Merge lp:~smartboyhw/ubuntu/raring/kde-gtk-config/2.1.1-1ubuntu1-1st-push into lp:ubuntu/raring/kde-gtk-config
- Raring (13.04)
- 2.1.1-1ubuntu1-1st-push
- Merge into raring
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 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu branches | Pending | ||
Review via email: mp+151434@code.launchpad.net |
Commit message
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
1 | === removed directory '.pc' |
2 | === removed file '.pc/.quilt_patches' |
3 | --- .pc/.quilt_patches 2012-09-07 22:01:43 +0000 |
4 | +++ .pc/.quilt_patches 1970-01-01 00:00:00 +0000 |
5 | @@ -1,1 +0,0 @@ |
6 | -debian/patches |
7 | |
8 | === removed file '.pc/.quilt_series' |
9 | --- .pc/.quilt_series 2012-09-07 22:01:43 +0000 |
10 | +++ .pc/.quilt_series 1970-01-01 00:00:00 +0000 |
11 | @@ -1,1 +0,0 @@ |
12 | -series |
13 | |
14 | === removed file '.pc/.version' |
15 | --- .pc/.version 2012-03-13 06:57:17 +0000 |
16 | +++ .pc/.version 1970-01-01 00:00:00 +0000 |
17 | @@ -1,1 +0,0 @@ |
18 | -2 |
19 | |
20 | === removed file '.pc/applied-patches' |
21 | --- .pc/applied-patches 2012-11-13 12:03:49 +0000 |
22 | +++ .pc/applied-patches 1970-01-01 00:00:00 +0000 |
23 | @@ -1,2 +0,0 @@ |
24 | -mirgation-from-package-src:kcm-gtk |
25 | -check-gtk-preview-files-in-runtime |
26 | |
27 | === removed directory '.pc/check-gtk-preview-files-in-runtime' |
28 | === removed directory '.pc/check-gtk-preview-files-in-runtime/src' |
29 | === removed file '.pc/check-gtk-preview-files-in-runtime/src/gtkconfigkcmodule.cpp' |
30 | --- .pc/check-gtk-preview-files-in-runtime/src/gtkconfigkcmodule.cpp 2012-11-07 00:35:58 +0000 |
31 | +++ .pc/check-gtk-preview-files-in-runtime/src/gtkconfigkcmodule.cpp 1970-01-01 00:00:00 +0000 |
32 | @@ -1,462 +0,0 @@ |
33 | -/* KDE GTK Configuration Module |
34 | - * |
35 | - * Copyright 2011 José Antonio Sanchez Reynaga <joanzare@gmail.com> |
36 | - * Copyright 2011 Aleix Pol Gonzalez <aleixpol@blue-systems.com> |
37 | - * |
38 | - * This library is free software; you can redistribute it and/or |
39 | - * modify it under the terms of the GNU Lesser General Public |
40 | - * License as published by the Free Software Foundation; either |
41 | - * version 2.1 of the License, or (at your option) version 3, or any |
42 | - * later version accepted by the membership of KDE e.V. (or its |
43 | - * successor approved by the membership of KDE e.V.), which shall |
44 | - * act as a proxy defined in Section 6 of version 3 of the license. |
45 | - * |
46 | - * This library is distributed in the hope that it will be useful, |
47 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
48 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
49 | - * Lesser General Public License for more details. |
50 | - * |
51 | - * You should have received a copy of the GNU Lesser General Public |
52 | - * License along with this library. If not, see <http://www.gnu.org/licenses/>. |
53 | - */ |
54 | - |
55 | -#include "gtkconfigkcmodule.h" |
56 | -#include <kaboutdata.h> |
57 | -#include <KGenericFactory> |
58 | -#include <KPluginFactory> |
59 | -#include <KProcess> |
60 | -#include <KStandardDirs> |
61 | -#include <QtGui> |
62 | -#include <QX11EmbedContainer> |
63 | -#include "ui_gui.h" |
64 | -#include "abstractappearance.h" |
65 | -#include "iconthemesmodel.h" |
66 | -#include <kicontheme.h> |
67 | - |
68 | -K_PLUGIN_FACTORY(GTKConfigKCModuleFactory, registerPlugin<GTKConfigKCModule>();) |
69 | -K_EXPORT_PLUGIN(GTKConfigKCModuleFactory("cgc","kde-gtk-config")) |
70 | - |
71 | -QMap<QString, int> gtkToolbarInit() |
72 | -{ |
73 | - QMap<QString, int> gtkToolbar; |
74 | - gtkToolbar["GTK_TOOLBAR_ICONS"] = 0; |
75 | - gtkToolbar["GTK_TOOLBAR_TEXT"] = 1; |
76 | - gtkToolbar["GTK_TOOLBAR_BOTH"] = 2; |
77 | - gtkToolbar["GTK_TOOLBAR_BOTH_HORIZ"] = 3; |
78 | - return gtkToolbar; |
79 | -} |
80 | - |
81 | -static QMap<QString, int> gtkToolbar = gtkToolbarInit(); |
82 | - |
83 | -GTKConfigKCModule::GTKConfigKCModule(QWidget* parent, const QVariantList& args ) |
84 | - : KCModule(GTKConfigKCModuleFactory::componentData(), parent) |
85 | - , ui(new Ui::GUI) |
86 | - , installer(0) |
87 | - , uninstaller(0) |
88 | - , m_saveEnabled(true) |
89 | -{ |
90 | - Q_UNUSED(args); |
91 | - KAboutData *acercade = new KAboutData("cgc","kcm_cgc",ki18n("KDE GTK Config"), "2.0", |
92 | - ki18n("Configure your GTK Applications"), |
93 | - KAboutData::License_LGPL_V3, |
94 | - ki18n("Copyright 2011 José Antonio Sánchez Reynaga")); |
95 | - acercade->addAuthor(ki18n("José Antonio Sánchez Reynaga (antonioJASR)"),ki18n("Main Developer"), "joanzare@gmail.com"); |
96 | - acercade->addAuthor(ki18n("Aleix Pol i Gonzalez"), ki18n("Feature development. Previews, code refactoring."), "aleixpol@blue-systems.com"); |
97 | - acercade->addCredit(ki18n("Manuel Tortosa (manutortosa)"), ki18n("Ideas, tester, internationalization")); |
98 | - acercade->addCredit(ki18n("Adrián Chaves Fernández (Gallaecio)"), ki18n("Internationalization")); |
99 | - setAboutData(acercade); |
100 | - |
101 | - ui->setupUi(this); |
102 | - appareance = new AppearenceGTK; |
103 | - m_iconsModel = new IconThemesModel(false, this); |
104 | - ui->cb_icon->setModel(m_iconsModel); |
105 | - ui->cb_icon_fallback->setModel(m_iconsModel); |
106 | - |
107 | - QFile oldConfigFile(QDir::homePath()+"/.gtkrc-2.0-kde"); |
108 | - QFile newConfigFile(QDir::homePath()+"/.gtkrc-2.0"); |
109 | - if(oldConfigFile.exists()) { |
110 | - newConfigFile.remove(); |
111 | - if( !oldConfigFile.rename(newConfigFile.fileName()) ) |
112 | - kDebug() << "Could not rename old config: " + oldConfigFile.fileName(); |
113 | - else |
114 | - kDebug() << "Old config " + oldConfigFile.fileName() + |
115 | - "was successfully renamed to " + newConfigFile.fileName(); |
116 | - } |
117 | - |
118 | - m_tempGtk2Preview = KGlobal::dirs()->saveLocation("tmp", "gtkrc-2.0", false); |
119 | - m_tempGtk3Preview = KGlobal::dirs()->saveLocation("tmp", ".config/gtk-3.0/settings.ini", false); |
120 | - |
121 | - ui->gtk2Preview->setIcon(KIcon("document-preview")); //!! for some reason it doesn't work with QIcon::fromTheme |
122 | - ui->gtk3Preview->setIcon(KIcon("document-preview")); |
123 | - |
124 | - m_p2 = new KProcess(this); |
125 | - m_p2->setEnv("GTK2_RC_FILES", m_tempGtk2Preview, true); |
126 | - *m_p2 << KStandardDirs::findExe("gtk_preview"); |
127 | - |
128 | - m_p3 = new KProcess(this); |
129 | - m_p3->setEnv("XDG_CONFIG_HOME", KGlobal::dirs()->saveLocation("tmp", ".config")); |
130 | - *m_p3 << KStandardDirs::findExe("gtk3_preview"); |
131 | - |
132 | - //UI changes |
133 | - connect(ui->cb_theme, SIGNAL(currentIndexChanged(int)), this, SLOT(appChanged())); |
134 | - connect(ui->cb_theme_gtk3, SIGNAL(currentIndexChanged(int)), this, SLOT(appChanged())); |
135 | - connect(ui->cb_icon, SIGNAL(currentIndexChanged(int)), this, SLOT(appChanged())); |
136 | - connect(ui->cb_icon_fallback ,SIGNAL(currentIndexChanged(int)), this, SLOT(appChanged())); |
137 | - connect(ui->font, SIGNAL(fontSelected(QFont)), this, SLOT(appChanged())); |
138 | - connect(ui->cb_toolbar_icons, SIGNAL(currentIndexChanged(int)), this, SLOT(appChanged())); |
139 | - connect(ui->checkBox_icon_gtk_menus, SIGNAL(clicked(bool)), this, SLOT(appChanged())); |
140 | - connect(ui->checkBox_icon_gtk_buttons, SIGNAL(clicked(bool)), this, SLOT(appChanged())); |
141 | - |
142 | - //preview updates |
143 | - connect(ui->cb_icon_fallback, SIGNAL(activated(QString)), this, SLOT(makePreviewIconTheme())); |
144 | - connect(ui->cb_icon, SIGNAL(activated(QString)), this, SLOT(makePreviewIconTheme())); |
145 | - connect(ui->gtk2Preview, SIGNAL(clicked(bool)), this, SLOT(runGtk2IfNecessary(bool))); |
146 | - connect(ui->gtk3Preview, SIGNAL(clicked(bool)), this, SLOT(runGtk3IfNecessary(bool))); |
147 | - |
148 | - connect(m_p2, SIGNAL(finished(int)), this, SLOT(untogglePreview())); |
149 | - connect(m_p3, SIGNAL(finished(int)), this, SLOT(untogglePreview())); |
150 | - |
151 | - QMenu* m = new QMenu(this); |
152 | - m->addAction(KIcon("get-hot-new-stuff"), i18n("Download GTK2 themes..."), this, SLOT(showThemeGHNS())); |
153 | - m->addAction(KIcon("get-hot-new-stuff"), i18n("Download GTK3 themes..."), this, SLOT(installThemeGTK3GHNS())); |
154 | - m->addAction(KIcon("archive-insert"), i18n("Install a local theme..."), this, SLOT(showDialogForInstall())); |
155 | - m->addAction(KIcon("archive-remove"), i18n("Uninstall a local theme..."), this, SLOT(showDialogForUninstall())); |
156 | - ui->newThemes->setMenu(m); |
157 | - ui->newThemes->setIcon(KIcon("download")); |
158 | -} |
159 | - |
160 | -GTKConfigKCModule::~GTKConfigKCModule() |
161 | -{ |
162 | - m_p2->kill(); |
163 | - m_p3->kill(); |
164 | - |
165 | - QFile::remove(m_tempGtk2Preview); |
166 | - QFile::remove(m_tempGtk3Preview); |
167 | - delete appareance; |
168 | - |
169 | - m_p2->waitForFinished(); |
170 | - m_p3->waitForFinished(); |
171 | - delete ui; |
172 | -} |
173 | - |
174 | -QString fontToString(const QFont& f) |
175 | -{ |
176 | - QString style; |
177 | - |
178 | - if(f.bold()) |
179 | - style += " bold"; |
180 | - if(f.italic()) |
181 | - style += " italic"; |
182 | - |
183 | - return f.family() + style + ' ' + QString::number(f.pointSize()); |
184 | -} |
185 | - |
186 | -void GTKConfigKCModule::syncUI() |
187 | -{ |
188 | - appareance->setThemeGtk3(ui->cb_theme_gtk3->currentText()); |
189 | - appareance->setTheme(ui->cb_theme->currentText()); |
190 | - appareance->setIcon(ui->cb_icon->itemData(ui->cb_icon->currentIndex(), IconThemesModel::DirNameRole).toString()); |
191 | - appareance->setIconFallback(ui->cb_icon_fallback->itemData(ui->cb_icon_fallback->currentIndex(), IconThemesModel::DirNameRole).toString()); |
192 | - appareance->setFont(fontToString(ui->font->font())); |
193 | - |
194 | - appareance->setToolbarStyle(gtkToolbar.key(ui->cb_toolbar_icons->currentIndex())); |
195 | - appareance->setShowIconsInButtons(ui->checkBox_icon_gtk_buttons->isChecked()); |
196 | - appareance->setShowIconsInMenus(ui->checkBox_icon_gtk_menus->isChecked()); |
197 | -} |
198 | - |
199 | -void GTKConfigKCModule::showThemeGHNS() |
200 | -{ |
201 | - KNS3::DownloadDialog d("cgctheme.knsrc", this); |
202 | - if(d.exec()) { |
203 | - refreshLists(); |
204 | - } |
205 | -} |
206 | - |
207 | -void GTKConfigKCModule::installThemeGTK3GHNS() |
208 | -{ |
209 | - KNS3::DownloadDialog d("cgcgtk3.knsrc", this); |
210 | - if(d.exec()) { |
211 | - refreshLists(); |
212 | - } |
213 | -} |
214 | - |
215 | -QFont stringToFont(const QString& font) |
216 | -{ |
217 | - QRegExp fontRx(QString(" (italic)? *(bold)? *([0-9]+)$")); |
218 | - int pos = fontRx.indexIn(font); |
219 | - QString fontFamily = font.left(pos); |
220 | - |
221 | - bool italic = !fontRx.cap(1).isEmpty(); |
222 | - QFont::Weight bold = fontRx.cap(2).isEmpty() ? QFont::Normal : QFont::Bold; |
223 | - int fontSize = fontRx.cap(3).toInt(); |
224 | - |
225 | - return QFont(fontFamily, fontSize, bold, italic); |
226 | -} |
227 | - |
228 | -void GTKConfigKCModule::refreshLists() |
229 | -{ |
230 | - refreshThemesUi(true); |
231 | - |
232 | - QString font = appareance->getFont(); |
233 | -// Q_ASSERT(!font.isEmpty()); |
234 | - ui->font->setFont(stringToFont(font)); |
235 | - |
236 | - ui->cb_toolbar_icons->setCurrentIndex(gtkToolbar[appareance->getToolbarStyle()]); |
237 | - |
238 | - ui->checkBox_icon_gtk_buttons->setChecked(appareance->getShowIconsInButtons()); |
239 | - ui->checkBox_icon_gtk_menus->setChecked(appareance->getShowIconsInMenus()); |
240 | -} |
241 | - |
242 | -void tryIcon(QLabel* label, const QString& fallback, const QString& theme, const QString& iconName) |
243 | -{ |
244 | - label->setToolTip(iconName); |
245 | - |
246 | - QString ret; |
247 | - if(!theme.isEmpty()) |
248 | - ret = IconThemesModel::findIconRecursivelyByName(iconName, theme); |
249 | - |
250 | - if(!ret.isEmpty()) { |
251 | - QPixmap p(ret); |
252 | - Q_ASSERT(!p.isNull()); |
253 | - label->setPixmap(p); |
254 | - return; |
255 | - } |
256 | - |
257 | - if(!fallback.isEmpty()) |
258 | - ret = IconThemesModel::findIconRecursivelyByName(iconName, fallback); |
259 | - |
260 | - if(!ret.isEmpty()) { |
261 | - QPixmap p(ret); |
262 | - Q_ASSERT(!p.isNull()); |
263 | - label->setPixmap(p); |
264 | - return; |
265 | - } |
266 | - |
267 | - KIcon notFoundIcon("application-x-zerosize"); |
268 | - QPixmap noIcon(notFoundIcon.pixmap(48,48)); |
269 | - label->setPixmap(noIcon); |
270 | - |
271 | - kDebug() << "could not find icon" << iconName; |
272 | -} |
273 | - |
274 | -void GTKConfigKCModule::makePreviewIconTheme() |
275 | -{ |
276 | - int icon_fallback = ui->cb_icon_fallback->currentIndex(); |
277 | - QString path_fallback = ui->cb_icon->itemData(icon_fallback, IconThemesModel::PathRole).toString(); |
278 | - |
279 | - int icon = ui->cb_icon->currentIndex(); |
280 | - QString path_icon = ui->cb_icon->itemData(icon, IconThemesModel::PathRole).toString(); |
281 | - |
282 | - tryIcon(ui->lb_prev_1, path_fallback, path_icon, "user-home"); |
283 | - tryIcon(ui->lb_prev_2, path_fallback, path_icon, "folder"); |
284 | - tryIcon(ui->lb_prev_3, path_fallback, path_icon, "user-trash"); |
285 | - tryIcon(ui->lb_prev_4, path_fallback, path_icon, "document-print"); |
286 | - tryIcon(ui->lb_prev_5, path_fallback, path_icon, "user-desktop"); |
287 | - tryIcon(ui->lb_prev_6, path_fallback, path_icon, "network-server"); |
288 | - tryIcon(ui->lb_prev_7, path_fallback, path_icon, "system-help"); |
289 | - tryIcon(ui->lb_prev_8, path_fallback, path_icon, "start-here"); |
290 | - tryIcon(ui->lb_prev_9, path_fallback, path_icon, "go-up"); |
291 | -} |
292 | - |
293 | -void GTKConfigKCModule::appChanged() |
294 | -{ |
295 | - savePreviewConfig(); |
296 | - emit changed(true); |
297 | -} |
298 | - |
299 | - |
300 | -void GTKConfigKCModule::savePreviewConfig() |
301 | -{ |
302 | - if(!m_saveEnabled || !(ui->gtk2Preview->isChecked() || ui->gtk3Preview->isChecked())) |
303 | - return; |
304 | - kDebug() << "saving UI..."; |
305 | - |
306 | - syncUI(); |
307 | - |
308 | - if(ui->gtk3Preview->isChecked()) { |
309 | - //we don't want to recursively loop between savePreviewConfig and runIfNecessary |
310 | - m_saveEnabled = false; |
311 | - m_p3->kill(); |
312 | - appareance->gtk3Appearance()->saveSettings(m_tempGtk3Preview); |
313 | - |
314 | - //need to make sure runIfNecessary() to know that it's not running |
315 | - m_p3->waitForFinished(); |
316 | - |
317 | - m_p3->start(); |
318 | - ui->gtk3Preview->setChecked(true); |
319 | - m_saveEnabled = true; |
320 | - } else if(ui->gtk2Preview->isChecked()) |
321 | - appareance->gtk2Appearance()->saveSettings(m_tempGtk2Preview); |
322 | -} |
323 | - |
324 | -void GTKConfigKCModule::runGtk2IfNecessary(bool checked) |
325 | -{ |
326 | - KProcess* p = m_p2; |
327 | - KProcess* np = m_p3; |
328 | - |
329 | - if(checked) { |
330 | - np->kill(); |
331 | - np->waitForFinished(); |
332 | - savePreviewConfig(); |
333 | - if(p->state()!=KProcess::Running) |
334 | - p->start(); |
335 | - } else { |
336 | - p->kill(); |
337 | - p->waitForFinished(); |
338 | - } |
339 | -} |
340 | - |
341 | -void GTKConfigKCModule::runGtk3IfNecessary(bool checked) |
342 | -{ |
343 | - KProcess* p = m_p3; |
344 | - KProcess* np = m_p2; |
345 | - |
346 | - if(checked) { |
347 | - np->kill(); |
348 | - np->waitForFinished(); |
349 | - savePreviewConfig(); |
350 | - if(p->state()!=KProcess::Running) |
351 | - p->start(); |
352 | - } else { |
353 | - p->kill(); |
354 | - p->waitForFinished(); |
355 | - } |
356 | -} |
357 | - |
358 | -void GTKConfigKCModule::save() |
359 | -{ |
360 | - kDebug() << "******************************************* INSTALLATION :\n" |
361 | - << "theme : " << appareance->getTheme() << "\n" |
362 | - << "themeGTK3 : " << appareance->getThemeGtk3() << "\n" |
363 | - << "icons : " << appareance->getIcon() << "\n" |
364 | - << "fallback icons : " << appareance->getIconFallback() << "\n" |
365 | - << "font family : " << appareance->getFont() << "\n" |
366 | - << "toolbar style : " << appareance->getToolbarStyle() << "\n" |
367 | - << "icons in buttons : " << appareance->getShowIconsInButtons() << "\n" |
368 | - << "icons in menus : " << appareance->getShowIconsInMenus() << "\n" |
369 | - << "********************************************************"; |
370 | - syncUI(); |
371 | - if(!appareance->saveFileConfig()) |
372 | - QMessageBox::warning(this, "ERROR", i18n("It was not possible to save the config")); |
373 | -} |
374 | - |
375 | -void setComboItem(QComboBox* combo, const QStringList& texts) |
376 | -{ |
377 | - foreach(const QString& text, texts) { |
378 | - int pos = combo->findText(text); |
379 | - if(pos>=0) { |
380 | - combo->setCurrentIndex(pos); |
381 | - return; |
382 | - } |
383 | - } |
384 | -} |
385 | - |
386 | -void GTKConfigKCModule::defaults() |
387 | -{ |
388 | - kDebug() << "loading defaults..."; |
389 | - m_saveEnabled = false; |
390 | - ui->font->setFont(font()); |
391 | - bool showIcons = !QCoreApplication::testAttribute(Qt::AA_DontShowIconsInMenus); |
392 | - ui->checkBox_icon_gtk_buttons->setChecked(showIcons); |
393 | - ui->checkBox_icon_gtk_menus->setChecked(showIcons); |
394 | - |
395 | - setComboItem(ui->cb_theme, QStringList("oxygen-gtk") << "Clearlooks"); |
396 | - setComboItem(ui->cb_theme_gtk3, QStringList("oxygen-gtk") << "Adwaita"); |
397 | - |
398 | - QStringList icons; |
399 | - icons << KIconTheme(KIconTheme::current()).name() << "GNOME"; |
400 | - setComboItem(ui->cb_icon, icons); |
401 | - |
402 | - int idx = ui->cb_icon->currentIndex(); |
403 | - if(idx>=0) { |
404 | - setComboItem(ui->cb_icon_fallback, icons.mid(icons.indexOf(ui->cb_icon->currentText())+1)); |
405 | - } |
406 | - m_saveEnabled = true; |
407 | - |
408 | - makePreviewIconTheme(); |
409 | - appChanged(); |
410 | -} |
411 | - |
412 | -void GTKConfigKCModule::load() |
413 | -{ |
414 | - m_saveEnabled = false; |
415 | - refreshThemesUi(); |
416 | - |
417 | - bool someCorrect = appareance->loadFileConfig(); |
418 | - if(someCorrect) { |
419 | - refreshLists(); |
420 | - makePreviewIconTheme(); |
421 | - } else |
422 | - defaults(); |
423 | - |
424 | - m_saveEnabled = true; |
425 | -} |
426 | - |
427 | -void refreshComboSameCurrentValue(QComboBox* combo, const QString& temp, const QStringList& texts) |
428 | -{ |
429 | - combo->clear(); |
430 | - combo->addItems(texts); |
431 | - int idx = combo->findText(temp); |
432 | - if(idx>=0) |
433 | - combo->setCurrentIndex(idx); |
434 | -} |
435 | - |
436 | -void GTKConfigKCModule::refreshThemesUi(bool useConfig) |
437 | -{ |
438 | - //theme gtk2 |
439 | - bool wasenabled = m_saveEnabled; |
440 | - m_saveEnabled = false; |
441 | - |
442 | - refreshComboSameCurrentValue(ui->cb_theme, |
443 | - useConfig ? appareance->getTheme() : ui->cb_theme->currentText(), |
444 | - appareance->gtk2Appearance()->installedThemesNames()); |
445 | - |
446 | - //theme gtk3 |
447 | - refreshComboSameCurrentValue(ui->cb_theme_gtk3, |
448 | - useConfig ? appareance->getThemeGtk3() : ui->cb_theme_gtk3->currentText(), |
449 | - appareance->gtk3Appearance()->installedThemesNames()); |
450 | - |
451 | - //icons |
452 | - QString currentIcon = useConfig ? appareance->getIcon() : ui->cb_icon->currentText(), |
453 | - currentFallback = useConfig ? appareance->getIconFallback() : ui->cb_icon_fallback->currentText(); |
454 | - int currentIconIdx = ui->cb_icon->findData(currentIcon, IconThemesModel::DirNameRole); |
455 | - int currentFallbackIdx = ui->cb_icon_fallback->findData(currentFallback, IconThemesModel::DirNameRole); |
456 | - ui->cb_icon->setCurrentIndex(qMax(currentIconIdx, 0)); |
457 | - ui->cb_icon_fallback->setCurrentIndex(qMax(currentFallbackIdx, 0)); |
458 | - |
459 | - m_saveEnabled = wasenabled; |
460 | - if(currentIconIdx<0 || currentFallbackIdx<0) |
461 | - emit changed(true); |
462 | -} |
463 | - |
464 | -void GTKConfigKCModule::showDialogForInstall() |
465 | -{ |
466 | - if(!installer) { |
467 | - installer = new DialogInstaller(this); |
468 | - connect(installer, SIGNAL(themeInstalled()), SLOT(refreshLists())); |
469 | - } |
470 | - |
471 | - installer->exec(); |
472 | - refreshThemesUi(); |
473 | -} |
474 | - |
475 | -void GTKConfigKCModule::showDialogForUninstall() |
476 | -{ |
477 | - if(!uninstaller) { |
478 | - uninstaller = new DialogUninstaller(this, appareance); |
479 | - connect(uninstaller, SIGNAL(themeUninstalled()), SLOT(refreshLists())); |
480 | - } |
481 | - |
482 | - uninstaller->refresthListsForUninstall(); |
483 | - uninstaller->exec(); |
484 | - |
485 | - refreshThemesUi(); |
486 | -} |
487 | - |
488 | -void GTKConfigKCModule::untogglePreview() |
489 | -{ |
490 | - if(sender()==m_p2) |
491 | - ui->gtk2Preview->setChecked(false); |
492 | - else |
493 | - ui->gtk3Preview->setChecked(false); |
494 | -} |
495 | |
496 | === removed directory '.pc/mirgation-from-package-src:kcm-gtk' |
497 | === removed directory '.pc/mirgation-from-package-src:kcm-gtk/src' |
498 | === removed file '.pc/mirgation-from-package-src:kcm-gtk/src/gtkconfigkcmodule.cpp' |
499 | --- .pc/mirgation-from-package-src:kcm-gtk/src/gtkconfigkcmodule.cpp 2012-11-07 00:35:58 +0000 |
500 | +++ .pc/mirgation-from-package-src:kcm-gtk/src/gtkconfigkcmodule.cpp 1970-01-01 00:00:00 +0000 |
501 | @@ -1,451 +0,0 @@ |
502 | -/* KDE GTK Configuration Module |
503 | - * |
504 | - * Copyright 2011 José Antonio Sanchez Reynaga <joanzare@gmail.com> |
505 | - * Copyright 2011 Aleix Pol Gonzalez <aleixpol@blue-systems.com> |
506 | - * |
507 | - * This library is free software; you can redistribute it and/or |
508 | - * modify it under the terms of the GNU Lesser General Public |
509 | - * License as published by the Free Software Foundation; either |
510 | - * version 2.1 of the License, or (at your option) version 3, or any |
511 | - * later version accepted by the membership of KDE e.V. (or its |
512 | - * successor approved by the membership of KDE e.V.), which shall |
513 | - * act as a proxy defined in Section 6 of version 3 of the license. |
514 | - * |
515 | - * This library is distributed in the hope that it will be useful, |
516 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
517 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
518 | - * Lesser General Public License for more details. |
519 | - * |
520 | - * You should have received a copy of the GNU Lesser General Public |
521 | - * License along with this library. If not, see <http://www.gnu.org/licenses/>. |
522 | - */ |
523 | - |
524 | -#include "gtkconfigkcmodule.h" |
525 | -#include <kaboutdata.h> |
526 | -#include <KGenericFactory> |
527 | -#include <KPluginFactory> |
528 | -#include <KProcess> |
529 | -#include <KStandardDirs> |
530 | -#include <QtGui> |
531 | -#include <QX11EmbedContainer> |
532 | -#include "ui_gui.h" |
533 | -#include "abstractappearance.h" |
534 | -#include "iconthemesmodel.h" |
535 | -#include <kicontheme.h> |
536 | - |
537 | -K_PLUGIN_FACTORY(GTKConfigKCModuleFactory, registerPlugin<GTKConfigKCModule>();) |
538 | -K_EXPORT_PLUGIN(GTKConfigKCModuleFactory("cgc","kde-gtk-config")) |
539 | - |
540 | -QMap<QString, int> gtkToolbarInit() |
541 | -{ |
542 | - QMap<QString, int> gtkToolbar; |
543 | - gtkToolbar["GTK_TOOLBAR_ICONS"] = 0; |
544 | - gtkToolbar["GTK_TOOLBAR_TEXT"] = 1; |
545 | - gtkToolbar["GTK_TOOLBAR_BOTH"] = 2; |
546 | - gtkToolbar["GTK_TOOLBAR_BOTH_HORIZ"] = 3; |
547 | - return gtkToolbar; |
548 | -} |
549 | - |
550 | -static QMap<QString, int> gtkToolbar = gtkToolbarInit(); |
551 | - |
552 | -GTKConfigKCModule::GTKConfigKCModule(QWidget* parent, const QVariantList& args ) |
553 | - : KCModule(GTKConfigKCModuleFactory::componentData(), parent) |
554 | - , ui(new Ui::GUI) |
555 | - , installer(0) |
556 | - , uninstaller(0) |
557 | - , m_saveEnabled(true) |
558 | -{ |
559 | - Q_UNUSED(args); |
560 | - KAboutData *acercade = new KAboutData("cgc","kcm_cgc",ki18n("KDE GTK Config"), "2.0", |
561 | - ki18n("Configure your GTK Applications"), |
562 | - KAboutData::License_LGPL_V3, |
563 | - ki18n("Copyright 2011 José Antonio Sánchez Reynaga")); |
564 | - acercade->addAuthor(ki18n("José Antonio Sánchez Reynaga (antonioJASR)"),ki18n("Main Developer"), "joanzare@gmail.com"); |
565 | - acercade->addAuthor(ki18n("Aleix Pol i Gonzalez"), ki18n("Feature development. Previews, code refactoring."), "aleixpol@blue-systems.com"); |
566 | - acercade->addCredit(ki18n("Manuel Tortosa (manutortosa)"), ki18n("Ideas, tester, internationalization")); |
567 | - acercade->addCredit(ki18n("Adrián Chaves Fernández (Gallaecio)"), ki18n("Internationalization")); |
568 | - setAboutData(acercade); |
569 | - |
570 | - ui->setupUi(this); |
571 | - appareance = new AppearenceGTK; |
572 | - m_iconsModel = new IconThemesModel(false, this); |
573 | - ui->cb_icon->setModel(m_iconsModel); |
574 | - ui->cb_icon_fallback->setModel(m_iconsModel); |
575 | - |
576 | - m_tempGtk2Preview = KGlobal::dirs()->saveLocation("tmp", "gtkrc-2.0", false); |
577 | - m_tempGtk3Preview = KGlobal::dirs()->saveLocation("tmp", ".config/gtk-3.0/settings.ini", false); |
578 | - |
579 | - ui->gtk2Preview->setIcon(KIcon("document-preview")); //!! for some reason it doesn't work with QIcon::fromTheme |
580 | - ui->gtk3Preview->setIcon(KIcon("document-preview")); |
581 | - |
582 | - m_p2 = new KProcess(this); |
583 | - m_p2->setEnv("GTK2_RC_FILES", m_tempGtk2Preview, true); |
584 | - *m_p2 << KStandardDirs::findExe("gtk_preview"); |
585 | - |
586 | - m_p3 = new KProcess(this); |
587 | - m_p3->setEnv("XDG_CONFIG_HOME", KGlobal::dirs()->saveLocation("tmp", ".config")); |
588 | - *m_p3 << KStandardDirs::findExe("gtk3_preview"); |
589 | - |
590 | - //UI changes |
591 | - connect(ui->cb_theme, SIGNAL(currentIndexChanged(int)), this, SLOT(appChanged())); |
592 | - connect(ui->cb_theme_gtk3, SIGNAL(currentIndexChanged(int)), this, SLOT(appChanged())); |
593 | - connect(ui->cb_icon, SIGNAL(currentIndexChanged(int)), this, SLOT(appChanged())); |
594 | - connect(ui->cb_icon_fallback ,SIGNAL(currentIndexChanged(int)), this, SLOT(appChanged())); |
595 | - connect(ui->font, SIGNAL(fontSelected(QFont)), this, SLOT(appChanged())); |
596 | - connect(ui->cb_toolbar_icons, SIGNAL(currentIndexChanged(int)), this, SLOT(appChanged())); |
597 | - connect(ui->checkBox_icon_gtk_menus, SIGNAL(clicked(bool)), this, SLOT(appChanged())); |
598 | - connect(ui->checkBox_icon_gtk_buttons, SIGNAL(clicked(bool)), this, SLOT(appChanged())); |
599 | - |
600 | - //preview updates |
601 | - connect(ui->cb_icon_fallback, SIGNAL(activated(QString)), this, SLOT(makePreviewIconTheme())); |
602 | - connect(ui->cb_icon, SIGNAL(activated(QString)), this, SLOT(makePreviewIconTheme())); |
603 | - connect(ui->gtk2Preview, SIGNAL(clicked(bool)), this, SLOT(runGtk2IfNecessary(bool))); |
604 | - connect(ui->gtk3Preview, SIGNAL(clicked(bool)), this, SLOT(runGtk3IfNecessary(bool))); |
605 | - |
606 | - connect(m_p2, SIGNAL(finished(int)), this, SLOT(untogglePreview())); |
607 | - connect(m_p3, SIGNAL(finished(int)), this, SLOT(untogglePreview())); |
608 | - |
609 | - QMenu* m = new QMenu(this); |
610 | - m->addAction(KIcon("get-hot-new-stuff"), i18n("Download GTK2 themes..."), this, SLOT(showThemeGHNS())); |
611 | - m->addAction(KIcon("get-hot-new-stuff"), i18n("Download GTK3 themes..."), this, SLOT(installThemeGTK3GHNS())); |
612 | - m->addAction(KIcon("archive-insert"), i18n("Install a local theme..."), this, SLOT(showDialogForInstall())); |
613 | - m->addAction(KIcon("archive-remove"), i18n("Uninstall a local theme..."), this, SLOT(showDialogForUninstall())); |
614 | - ui->newThemes->setMenu(m); |
615 | - ui->newThemes->setIcon(KIcon("download")); |
616 | -} |
617 | - |
618 | -GTKConfigKCModule::~GTKConfigKCModule() |
619 | -{ |
620 | - m_p2->kill(); |
621 | - m_p3->kill(); |
622 | - |
623 | - QFile::remove(m_tempGtk2Preview); |
624 | - QFile::remove(m_tempGtk3Preview); |
625 | - delete appareance; |
626 | - |
627 | - m_p2->waitForFinished(); |
628 | - m_p3->waitForFinished(); |
629 | - delete ui; |
630 | -} |
631 | - |
632 | -QString fontToString(const QFont& f) |
633 | -{ |
634 | - QString style; |
635 | - |
636 | - if(f.bold()) |
637 | - style += " bold"; |
638 | - if(f.italic()) |
639 | - style += " italic"; |
640 | - |
641 | - return f.family() + style + ' ' + QString::number(f.pointSize()); |
642 | -} |
643 | - |
644 | -void GTKConfigKCModule::syncUI() |
645 | -{ |
646 | - appareance->setThemeGtk3(ui->cb_theme_gtk3->currentText()); |
647 | - appareance->setTheme(ui->cb_theme->currentText()); |
648 | - appareance->setIcon(ui->cb_icon->itemData(ui->cb_icon->currentIndex(), IconThemesModel::DirNameRole).toString()); |
649 | - appareance->setIconFallback(ui->cb_icon_fallback->itemData(ui->cb_icon_fallback->currentIndex(), IconThemesModel::DirNameRole).toString()); |
650 | - appareance->setFont(fontToString(ui->font->font())); |
651 | - |
652 | - appareance->setToolbarStyle(gtkToolbar.key(ui->cb_toolbar_icons->currentIndex())); |
653 | - appareance->setShowIconsInButtons(ui->checkBox_icon_gtk_buttons->isChecked()); |
654 | - appareance->setShowIconsInMenus(ui->checkBox_icon_gtk_menus->isChecked()); |
655 | -} |
656 | - |
657 | -void GTKConfigKCModule::showThemeGHNS() |
658 | -{ |
659 | - KNS3::DownloadDialog d("cgctheme.knsrc", this); |
660 | - if(d.exec()) { |
661 | - refreshLists(); |
662 | - } |
663 | -} |
664 | - |
665 | -void GTKConfigKCModule::installThemeGTK3GHNS() |
666 | -{ |
667 | - KNS3::DownloadDialog d("cgcgtk3.knsrc", this); |
668 | - if(d.exec()) { |
669 | - refreshLists(); |
670 | - } |
671 | -} |
672 | - |
673 | -QFont stringToFont(const QString& font) |
674 | -{ |
675 | - QRegExp fontRx(QString(" (italic)? *(bold)? *([0-9]+)$")); |
676 | - int pos = fontRx.indexIn(font); |
677 | - QString fontFamily = font.left(pos); |
678 | - |
679 | - bool italic = !fontRx.cap(1).isEmpty(); |
680 | - QFont::Weight bold = fontRx.cap(2).isEmpty() ? QFont::Normal : QFont::Bold; |
681 | - int fontSize = fontRx.cap(3).toInt(); |
682 | - |
683 | - return QFont(fontFamily, fontSize, bold, italic); |
684 | -} |
685 | - |
686 | -void GTKConfigKCModule::refreshLists() |
687 | -{ |
688 | - refreshThemesUi(true); |
689 | - |
690 | - QString font = appareance->getFont(); |
691 | -// Q_ASSERT(!font.isEmpty()); |
692 | - ui->font->setFont(stringToFont(font)); |
693 | - |
694 | - ui->cb_toolbar_icons->setCurrentIndex(gtkToolbar[appareance->getToolbarStyle()]); |
695 | - |
696 | - ui->checkBox_icon_gtk_buttons->setChecked(appareance->getShowIconsInButtons()); |
697 | - ui->checkBox_icon_gtk_menus->setChecked(appareance->getShowIconsInMenus()); |
698 | -} |
699 | - |
700 | -void tryIcon(QLabel* label, const QString& fallback, const QString& theme, const QString& iconName) |
701 | -{ |
702 | - label->setToolTip(iconName); |
703 | - |
704 | - QString ret; |
705 | - if(!theme.isEmpty()) |
706 | - ret = IconThemesModel::findIconRecursivelyByName(iconName, theme); |
707 | - |
708 | - if(!ret.isEmpty()) { |
709 | - QPixmap p(ret); |
710 | - Q_ASSERT(!p.isNull()); |
711 | - label->setPixmap(p); |
712 | - return; |
713 | - } |
714 | - |
715 | - if(!fallback.isEmpty()) |
716 | - ret = IconThemesModel::findIconRecursivelyByName(iconName, fallback); |
717 | - |
718 | - if(!ret.isEmpty()) { |
719 | - QPixmap p(ret); |
720 | - Q_ASSERT(!p.isNull()); |
721 | - label->setPixmap(p); |
722 | - return; |
723 | - } |
724 | - |
725 | - KIcon notFoundIcon("application-x-zerosize"); |
726 | - QPixmap noIcon(notFoundIcon.pixmap(48,48)); |
727 | - label->setPixmap(noIcon); |
728 | - |
729 | - kDebug() << "could not find icon" << iconName; |
730 | -} |
731 | - |
732 | -void GTKConfigKCModule::makePreviewIconTheme() |
733 | -{ |
734 | - int icon_fallback = ui->cb_icon_fallback->currentIndex(); |
735 | - QString path_fallback = ui->cb_icon->itemData(icon_fallback, IconThemesModel::PathRole).toString(); |
736 | - |
737 | - int icon = ui->cb_icon->currentIndex(); |
738 | - QString path_icon = ui->cb_icon->itemData(icon, IconThemesModel::PathRole).toString(); |
739 | - |
740 | - tryIcon(ui->lb_prev_1, path_fallback, path_icon, "user-home"); |
741 | - tryIcon(ui->lb_prev_2, path_fallback, path_icon, "folder"); |
742 | - tryIcon(ui->lb_prev_3, path_fallback, path_icon, "user-trash"); |
743 | - tryIcon(ui->lb_prev_4, path_fallback, path_icon, "document-print"); |
744 | - tryIcon(ui->lb_prev_5, path_fallback, path_icon, "user-desktop"); |
745 | - tryIcon(ui->lb_prev_6, path_fallback, path_icon, "network-server"); |
746 | - tryIcon(ui->lb_prev_7, path_fallback, path_icon, "system-help"); |
747 | - tryIcon(ui->lb_prev_8, path_fallback, path_icon, "start-here"); |
748 | - tryIcon(ui->lb_prev_9, path_fallback, path_icon, "go-up"); |
749 | -} |
750 | - |
751 | -void GTKConfigKCModule::appChanged() |
752 | -{ |
753 | - savePreviewConfig(); |
754 | - emit changed(true); |
755 | -} |
756 | - |
757 | - |
758 | -void GTKConfigKCModule::savePreviewConfig() |
759 | -{ |
760 | - if(!m_saveEnabled || !(ui->gtk2Preview->isChecked() || ui->gtk3Preview->isChecked())) |
761 | - return; |
762 | - kDebug() << "saving UI..."; |
763 | - |
764 | - syncUI(); |
765 | - |
766 | - if(ui->gtk3Preview->isChecked()) { |
767 | - //we don't want to recursively loop between savePreviewConfig and runIfNecessary |
768 | - m_saveEnabled = false; |
769 | - m_p3->kill(); |
770 | - appareance->gtk3Appearance()->saveSettings(m_tempGtk3Preview); |
771 | - |
772 | - //need to make sure runIfNecessary() to know that it's not running |
773 | - m_p3->waitForFinished(); |
774 | - |
775 | - m_p3->start(); |
776 | - ui->gtk3Preview->setChecked(true); |
777 | - m_saveEnabled = true; |
778 | - } else if(ui->gtk2Preview->isChecked()) |
779 | - appareance->gtk2Appearance()->saveSettings(m_tempGtk2Preview); |
780 | -} |
781 | - |
782 | -void GTKConfigKCModule::runGtk2IfNecessary(bool checked) |
783 | -{ |
784 | - KProcess* p = m_p2; |
785 | - KProcess* np = m_p3; |
786 | - |
787 | - if(checked) { |
788 | - np->kill(); |
789 | - np->waitForFinished(); |
790 | - savePreviewConfig(); |
791 | - if(p->state()!=KProcess::Running) |
792 | - p->start(); |
793 | - } else { |
794 | - p->kill(); |
795 | - p->waitForFinished(); |
796 | - } |
797 | -} |
798 | - |
799 | -void GTKConfigKCModule::runGtk3IfNecessary(bool checked) |
800 | -{ |
801 | - KProcess* p = m_p3; |
802 | - KProcess* np = m_p2; |
803 | - |
804 | - if(checked) { |
805 | - np->kill(); |
806 | - np->waitForFinished(); |
807 | - savePreviewConfig(); |
808 | - if(p->state()!=KProcess::Running) |
809 | - p->start(); |
810 | - } else { |
811 | - p->kill(); |
812 | - p->waitForFinished(); |
813 | - } |
814 | -} |
815 | - |
816 | -void GTKConfigKCModule::save() |
817 | -{ |
818 | - kDebug() << "******************************************* INSTALLATION :\n" |
819 | - << "theme : " << appareance->getTheme() << "\n" |
820 | - << "themeGTK3 : " << appareance->getThemeGtk3() << "\n" |
821 | - << "icons : " << appareance->getIcon() << "\n" |
822 | - << "fallback icons : " << appareance->getIconFallback() << "\n" |
823 | - << "font family : " << appareance->getFont() << "\n" |
824 | - << "toolbar style : " << appareance->getToolbarStyle() << "\n" |
825 | - << "icons in buttons : " << appareance->getShowIconsInButtons() << "\n" |
826 | - << "icons in menus : " << appareance->getShowIconsInMenus() << "\n" |
827 | - << "********************************************************"; |
828 | - syncUI(); |
829 | - if(!appareance->saveFileConfig()) |
830 | - QMessageBox::warning(this, "ERROR", i18n("It was not possible to save the config")); |
831 | -} |
832 | - |
833 | -void setComboItem(QComboBox* combo, const QStringList& texts) |
834 | -{ |
835 | - foreach(const QString& text, texts) { |
836 | - int pos = combo->findText(text); |
837 | - if(pos>=0) { |
838 | - combo->setCurrentIndex(pos); |
839 | - return; |
840 | - } |
841 | - } |
842 | -} |
843 | - |
844 | -void GTKConfigKCModule::defaults() |
845 | -{ |
846 | - kDebug() << "loading defaults..."; |
847 | - m_saveEnabled = false; |
848 | - ui->font->setFont(font()); |
849 | - bool showIcons = !QCoreApplication::testAttribute(Qt::AA_DontShowIconsInMenus); |
850 | - ui->checkBox_icon_gtk_buttons->setChecked(showIcons); |
851 | - ui->checkBox_icon_gtk_menus->setChecked(showIcons); |
852 | - |
853 | - setComboItem(ui->cb_theme, QStringList("oxygen-gtk") << "Clearlooks"); |
854 | - setComboItem(ui->cb_theme_gtk3, QStringList("oxygen-gtk") << "Adwaita"); |
855 | - |
856 | - QStringList icons; |
857 | - icons << KIconTheme(KIconTheme::current()).name() << "GNOME"; |
858 | - setComboItem(ui->cb_icon, icons); |
859 | - |
860 | - int idx = ui->cb_icon->currentIndex(); |
861 | - if(idx>=0) { |
862 | - setComboItem(ui->cb_icon_fallback, icons.mid(icons.indexOf(ui->cb_icon->currentText())+1)); |
863 | - } |
864 | - m_saveEnabled = true; |
865 | - |
866 | - makePreviewIconTheme(); |
867 | - appChanged(); |
868 | -} |
869 | - |
870 | -void GTKConfigKCModule::load() |
871 | -{ |
872 | - m_saveEnabled = false; |
873 | - refreshThemesUi(); |
874 | - |
875 | - bool someCorrect = appareance->loadFileConfig(); |
876 | - if(someCorrect) { |
877 | - refreshLists(); |
878 | - makePreviewIconTheme(); |
879 | - } else |
880 | - defaults(); |
881 | - |
882 | - m_saveEnabled = true; |
883 | -} |
884 | - |
885 | -void refreshComboSameCurrentValue(QComboBox* combo, const QString& temp, const QStringList& texts) |
886 | -{ |
887 | - combo->clear(); |
888 | - combo->addItems(texts); |
889 | - int idx = combo->findText(temp); |
890 | - if(idx>=0) |
891 | - combo->setCurrentIndex(idx); |
892 | -} |
893 | - |
894 | -void GTKConfigKCModule::refreshThemesUi(bool useConfig) |
895 | -{ |
896 | - //theme gtk2 |
897 | - bool wasenabled = m_saveEnabled; |
898 | - m_saveEnabled = false; |
899 | - |
900 | - refreshComboSameCurrentValue(ui->cb_theme, |
901 | - useConfig ? appareance->getTheme() : ui->cb_theme->currentText(), |
902 | - appareance->gtk2Appearance()->installedThemesNames()); |
903 | - |
904 | - //theme gtk3 |
905 | - refreshComboSameCurrentValue(ui->cb_theme_gtk3, |
906 | - useConfig ? appareance->getThemeGtk3() : ui->cb_theme_gtk3->currentText(), |
907 | - appareance->gtk3Appearance()->installedThemesNames()); |
908 | - |
909 | - //icons |
910 | - QString currentIcon = useConfig ? appareance->getIcon() : ui->cb_icon->currentText(), |
911 | - currentFallback = useConfig ? appareance->getIconFallback() : ui->cb_icon_fallback->currentText(); |
912 | - int currentIconIdx = ui->cb_icon->findData(currentIcon, IconThemesModel::DirNameRole); |
913 | - int currentFallbackIdx = ui->cb_icon_fallback->findData(currentFallback, IconThemesModel::DirNameRole); |
914 | - ui->cb_icon->setCurrentIndex(qMax(currentIconIdx, 0)); |
915 | - ui->cb_icon_fallback->setCurrentIndex(qMax(currentFallbackIdx, 0)); |
916 | - |
917 | - m_saveEnabled = wasenabled; |
918 | - if(currentIconIdx<0 || currentFallbackIdx<0) |
919 | - emit changed(true); |
920 | -} |
921 | - |
922 | -void GTKConfigKCModule::showDialogForInstall() |
923 | -{ |
924 | - if(!installer) { |
925 | - installer = new DialogInstaller(this); |
926 | - connect(installer, SIGNAL(themeInstalled()), SLOT(refreshLists())); |
927 | - } |
928 | - |
929 | - installer->exec(); |
930 | - refreshThemesUi(); |
931 | -} |
932 | - |
933 | -void GTKConfigKCModule::showDialogForUninstall() |
934 | -{ |
935 | - if(!uninstaller) { |
936 | - uninstaller = new DialogUninstaller(this, appareance); |
937 | - connect(uninstaller, SIGNAL(themeUninstalled()), SLOT(refreshLists())); |
938 | - } |
939 | - |
940 | - uninstaller->refresthListsForUninstall(); |
941 | - uninstaller->exec(); |
942 | - |
943 | - refreshThemesUi(); |
944 | -} |
945 | - |
946 | -void GTKConfigKCModule::untogglePreview() |
947 | -{ |
948 | - if(sender()==m_p2) |
949 | - ui->gtk2Preview->setChecked(false); |
950 | - else |
951 | - ui->gtk3Preview->setChecked(false); |
952 | -} |
953 | |
954 | === modified file 'debian/changelog' |
955 | --- debian/changelog 2012-11-13 12:03:49 +0000 |
956 | +++ debian/changelog 2013-03-04 09:07:24 +0000 |
957 | @@ -1,3 +1,19 @@ |
958 | +kde-gtk-config (3:2.1.1-1ubuntu1) raring; urgency=low |
959 | + |
960 | + * Merge from Debian experimental (LP: #1103013) |
961 | + |
962 | + -- Howard Chan <smartboyhw@gmail.com> Mon, 04 Mar 2013 16:52:47 +0800 |
963 | + |
964 | +kde-gtk-config (3:2.1.1-1) experimental; urgency=low |
965 | + |
966 | + * Update project Homepage. |
967 | + * Update debian/control for kde-config-gtk-style-preview: |
968 | + - add Breaks against old kde-config-gtk-style (Closes: #698285) |
969 | + - add Recommends against kde-config-gtk-style |
970 | + * Bump Standards-Version to 3.9.4 (was 3.9.3): no changes required. |
971 | + |
972 | + -- Boris Pek <tehnick-8@mail.ru> Sun, 20 Jan 2013 15:21:10 +0200 |
973 | + |
974 | kde-gtk-config (3:2.1.1-1~exp1ubuntu1) raring; urgency=low |
975 | |
976 | * Merge with Debian experimental (LP: #1077846) |
977 | |
978 | === modified file 'debian/control' |
979 | --- debian/control 2012-11-13 12:03:49 +0000 |
980 | +++ debian/control 2013-03-04 09:07:24 +0000 |
981 | @@ -6,10 +6,10 @@ |
982 | Uploaders: Boris Pek <tehnick-8@mail.ru> |
983 | Build-Depends: debhelper (>= 8), cmake, |
984 | kdelibs5-dev, pkg-kde-tools, libgtk2.0-dev, libgtk-3-dev |
985 | -Homepage: https://projects.kde.org/projects/playground/base/kde-gtk-config |
986 | +Homepage: https://projects.kde.org/projects/extragear/base/kde-gtk-config |
987 | Vcs-Git: git://github.com/tehnick/kde-gtk-config-debian.git |
988 | Vcs-Browser: https://github.com/tehnick/kde-gtk-config-debian |
989 | -Standards-Version: 3.9.3 |
990 | +Standards-Version: 3.9.4 |
991 | |
992 | Package: kde-config-gtk-style |
993 | Architecture: any |
994 | @@ -30,6 +30,8 @@ |
995 | Package: kde-config-gtk-style-preview |
996 | Architecture: any |
997 | Depends: ${shlibs:Depends}, ${misc:Depends} |
998 | +Recommends: kde-config-gtk-style |
999 | +Breaks: kde-config-gtk-style (<< 3:2.1.1-1~exp1~) |
1000 | Description: KDE configuration module for GTK+ 2.x and GTK+ 3.x styles selection (extras) |
1001 | Configuration dialog to adapt GTK+ applications appearance to your taste |
1002 | under KDE. Among its many features, it lets you: |
1003 | |
1004 | === modified file 'debian/copyright' |
1005 | --- debian/copyright 2012-03-13 06:57:17 +0000 |
1006 | +++ debian/copyright 2013-03-04 09:07:24 +0000 |
1007 | @@ -4,7 +4,7 @@ |
1008 | Upstream-Name: KDE GTK Configurator |
1009 | Upstream-Contact: Jose Antonio Sánchez Reynaga <joanzare@gmail.com> |
1010 | Aleix Pol Gonzalez <aleixpol@blue-systems.com> |
1011 | -Source: https://projects.kde.org/projects/playground/base/kde-gtk-config |
1012 | +Source: https://projects.kde.org/projects/extragear/base/kde-gtk-config |
1013 | The orig.tar.bz2 is just renamed upstream tarball (without changes). |
1014 | See section get-orig-source in debian/rules file for details. |
1015 | |
1016 | |
1017 | === modified file 'debian/gtk3_preview.1' |
1018 | --- debian/gtk3_preview.1 2012-03-13 06:57:17 +0000 |
1019 | +++ debian/gtk3_preview.1 2013-03-04 09:07:24 +0000 |
1020 | @@ -24,7 +24,7 @@ |
1021 | .SH AUTHOR |
1022 | This program was written by Aleix Pol Gonzalez <aleixpol@kde.org>. |
1023 | .br |
1024 | -Homepage: \fBhttps://projects.kde.org/projects/playground/base/kde-gtk-config\fR |
1025 | +Homepage: \fBhttps://projects.kde.org/projects/extragear/base/kde-gtk-config\fR |
1026 | .SH "BUG REPORTS" |
1027 | If you find a bug in this program please report it to original author. |
1028 | .PP |
1029 | |
1030 | === modified file 'debian/gtk_preview.1' |
1031 | --- debian/gtk_preview.1 2012-03-13 06:57:17 +0000 |
1032 | +++ debian/gtk_preview.1 2013-03-04 09:07:24 +0000 |
1033 | @@ -24,7 +24,7 @@ |
1034 | .SH AUTHOR |
1035 | This program was written by Aleix Pol Gonzalez <aleixpol@kde.org>. |
1036 | .br |
1037 | -Homepage: \fBhttps://projects.kde.org/projects/playground/base/kde-gtk-config\fR |
1038 | +Homepage: \fBhttps://projects.kde.org/projects/extragear/base/kde-gtk-config\fR |
1039 | .SH "BUG REPORTS" |
1040 | If you find a bug in this program please report it to original author. |
1041 | .PP |
1042 | |
1043 | === modified file 'debian/reload_gtk_apps.1' |
1044 | --- debian/reload_gtk_apps.1 2012-03-13 06:57:17 +0000 |
1045 | +++ debian/reload_gtk_apps.1 2013-03-04 09:07:24 +0000 |
1046 | @@ -21,7 +21,7 @@ |
1047 | .SH AUTHOR |
1048 | This program was written by Aleix Pol Gonzalez <aleixpol@kde.org>. |
1049 | .br |
1050 | -Homepage: \fBhttps://projects.kde.org/projects/playground/base/kde-gtk-config\fR |
1051 | +Homepage: \fBhttps://projects.kde.org/projects/extragear/base/kde-gtk-config\fR |
1052 | .SH "BUG REPORTS" |
1053 | If you find a bug in this program please report it to original author. |
1054 | .PP |
1055 | |
1056 | === modified file 'src/gtkconfigkcmodule.cpp' |
1057 | --- src/gtkconfigkcmodule.cpp 2012-11-13 12:03:49 +0000 |
1058 | +++ src/gtkconfigkcmodule.cpp 2013-03-04 09:07:24 +0000 |
1059 | @@ -72,39 +72,19 @@ |
1060 | ui->cb_icon->setModel(m_iconsModel); |
1061 | ui->cb_icon_fallback->setModel(m_iconsModel); |
1062 | |
1063 | - QFile oldConfigFile(QDir::homePath()+"/.gtkrc-2.0-kde"); |
1064 | - QFile newConfigFile(QDir::homePath()+"/.gtkrc-2.0"); |
1065 | - if(oldConfigFile.exists()) { |
1066 | - newConfigFile.remove(); |
1067 | - if( !oldConfigFile.rename(newConfigFile.fileName()) ) |
1068 | - kDebug() << "Could not rename old config: " + oldConfigFile.fileName(); |
1069 | - else |
1070 | - kDebug() << "Old config " + oldConfigFile.fileName() + |
1071 | - "was successfully renamed to " + newConfigFile.fileName(); |
1072 | - } |
1073 | - |
1074 | m_tempGtk2Preview = KGlobal::dirs()->saveLocation("tmp", "gtkrc-2.0", false); |
1075 | m_tempGtk3Preview = KGlobal::dirs()->saveLocation("tmp", ".config/gtk-3.0/settings.ini", false); |
1076 | |
1077 | ui->gtk2Preview->setIcon(KIcon("document-preview")); //!! for some reason it doesn't work with QIcon::fromTheme |
1078 | ui->gtk3Preview->setIcon(KIcon("document-preview")); |
1079 | |
1080 | - ui->gtk2Preview->hide(); |
1081 | - ui->gtk3Preview->hide(); |
1082 | - |
1083 | m_p2 = new KProcess(this); |
1084 | m_p2->setEnv("GTK2_RC_FILES", m_tempGtk2Preview, true); |
1085 | - if (KStandardDirs::findExe("gtk_preview") != QString::null) { |
1086 | - *m_p2 << KStandardDirs::findExe("gtk_preview"); |
1087 | - ui->gtk2Preview->show(); |
1088 | - } |
1089 | + *m_p2 << KStandardDirs::findExe("gtk_preview"); |
1090 | |
1091 | m_p3 = new KProcess(this); |
1092 | m_p3->setEnv("XDG_CONFIG_HOME", KGlobal::dirs()->saveLocation("tmp", ".config")); |
1093 | - if (KStandardDirs::findExe("gtk3_preview") != QString::null) { |
1094 | - *m_p3 << KStandardDirs::findExe("gtk3_preview"); |
1095 | - ui->gtk3Preview->show(); |
1096 | - } |
1097 | + *m_p3 << KStandardDirs::findExe("gtk3_preview"); |
1098 | |
1099 | //UI changes |
1100 | connect(ui->cb_theme, SIGNAL(currentIndexChanged(int)), this, SLOT(appChanged())); |