1 /*
2 *
3 * Copyright (c) 2012 Sven Langkamp <sven.langkamp@gmail.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
19
20 #include "kis_dlg_blacklist_cleanup.h"
21 #include <KisResourceServerProvider.h>
22
23 #include <kis_icon.h>
24 #include <KoResourceServerProvider.h>
25
26 #include <brushengine/kis_paintop_preset.h>
27 #include <kis_workspace_resource.h>
28 #include <resources/KoColorSet.h>
29 #include <resources/KoAbstractGradient.h>
30 #include <resources/KoPattern.h>
31
KisDlgBlacklistCleanup()32 KisDlgBlacklistCleanup::KisDlgBlacklistCleanup()
33 {
34 setCaption(i18n("Cleanup resource files"));
35 setButtons(Ok | Cancel);
36 setDefaultButton(Ok);
37
38 QWidget* page = new QWidget(this);
39 setupUi(page);
40 setMainWidget(page);
41 labelWarning->setPixmap(KisIconUtils::loadIcon("warning").pixmap(32, 32));
42 }
43
accept()44 void KisDlgBlacklistCleanup::accept()
45 {
46 QDialog::accept();
47 if (cbRemovePresets->isChecked()) {
48 KisResourceServerProvider::instance()->paintOpPresetServer()->removeBlackListedFiles();
49 }
50 if (cbRemoveBrushes->isChecked()) {
51 KisResourceServerProvider::instance()->brushBlacklistCleanup();
52 }
53 if (cbRemoveWorkspaces->isChecked()) {
54 KisResourceServerProvider::instance()->workspaceServer()->removeBlackListedFiles();
55 }
56 if (cbRemoveColorsets->isChecked()) {
57 KoResourceServerProvider::instance()->paletteServer()->removeBlackListedFiles();
58 }
59 if (cbRemoveGradients->isChecked()) {
60 KoResourceServerProvider::instance()->gradientServer()->removeBlackListedFiles();
61 }
62 if (cbRemovePattern->isChecked()) {
63 KoResourceServerProvider::instance()->patternServer()->removeBlackListedFiles();
64 }
65 if (cbRemoveGamutMasks->isChecked()) {
66 KoResourceServerProvider::instance()->gamutMaskServer()->removeBlackListedFiles();
67 }
68 }
69
70