Make a branch to make krunner Good Enough For Aaron™.
[kdebase/uwolfer.git] / workspace / kcontrol / kthememanager / kthememanager.h
blob70984d9d853d0928f7d29a9cff3718c443b2f418
1 // -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 4; -*-
2 /* Copyright (C) 2003 Lukas Tinkl <lukas@kde.org>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 #ifndef KTHEMEMANAGER_H
20 #define KTHEMEMANAGER_H
22 #include <kcmodule.h>
23 #include <krun.h>
24 #include <kservice.h>
25 #include <kurl.h>
27 #include "ui_kthemedlg.h"
28 #include "ktheme.h"
30 class QString;
32 class QStringList;
34 #define ORIGINAL_THEME "original" // no i18n() here!!!
37 class K3IconViewItem;
39 class KThemeDetailsItem: public K3IconViewItem
41 public:
42 KThemeDetailsItem( K3IconView * parent, const QString & text, const QPixmap & icon, const QString & execString )
43 : K3IconViewItem( parent, text, icon ) { m_exec = execString; }
44 virtual ~KThemeDetailsItem() { };
46 void exec() {
47 ( void ) new KRun( m_exec );
49 private:
50 QString m_exec;
55 class KThemeDlg : public QWidget, public Ui::KThemeDlg
57 public:
58 KThemeDlg( QWidget *parent ) : QWidget( parent ) {
59 setupUi( this );
63 /**
65 * This is the for KControl config module for installing,
66 * creating and removing visual themes.
68 * @brief The Theme Manager config module.
69 * @author Lukas Tinkl <lukas@kde.org>
71 class kthememanager: public KCModule
73 Q_OBJECT
74 public:
75 kthememanager( QWidget *parent, const QVariantList &args );
76 virtual ~kthememanager();
78 /**
79 * Called on module startup
81 virtual void load();
82 /**
83 * Called when applying the changes
85 virtual void save();
86 /**
87 * Called when the user requests the default values
89 virtual void defaults();
91 protected:
92 void dragEnterEvent ( QDragEnterEvent * ev );
93 void dropEvent ( QDropEvent * ev );
95 Q_SIGNALS:
96 /**
97 * Emitted when some @p urls are dropped onto the kcm
99 void filesDropped(const KUrl::List &urls);
101 private Q_SLOTS:
103 * Install a theme from a tarball (*.kth)
105 void slotInstallTheme();
108 * Remove an installed theme
110 void slotRemoveTheme();
113 * Create a new theme
115 void slotCreateTheme();
118 * Update the theme's info and preview
120 void slotThemeChanged( Q3ListViewItem * item );
123 * Invoked when one drag and drops @p urls onto the kcm
124 * @see signal filesDropped
126 void slotFilesDropped( const KUrl::List & urls );
127 void updateButton();
130 void startKonqui( const QString & url );
131 void startBackground();
132 void startColors();
133 void startStyle();
134 void startIcons();
135 void startFonts();
136 void startSaver();
139 private:
141 * List themes available in the system and insert them into the listview.
143 void listThemes();
146 * Performs the actual theme installation.
148 void addNewTheme( const KUrl & url );
151 * Perform internal initialization of paths.
153 void init();
156 * Try to find out whether a theme is installed and get its version number
157 * @param themeName The theme name
158 * @return The theme's version number or -1 if not installed
160 static float getThemeVersion( const QString & themeName );
162 void queryLNFModules();
165 * Updates the preview widget
167 void updatePreview( const QString & pixFile );
168 bool themeExist(const QString &_themeName);
169 KThemeDlg * dlg;
171 KTheme * m_theme;
172 KTheme * m_origTheme;
175 #endif