not quite so much needs to be delayed to the init() function
[personal-kdebase.git] / workspace / plasma / shells / common / appletbrowser.h
blob4460338d3c699a7039c11eea502aea33792fdd2b
1 /*
2 * Copyright (C) 2007 Ivan Cukic <ivan.cukic+kde@gmail.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Library/Lesser General Public License
6 * version 2, or (at your option) any later version, as published by the
7 * Free Software Foundation
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 Library/Lesser General Public
15 * License along with this program; if not, write to the
16 * Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 #ifndef PLASMA_APPLETBROWSER_H
21 #define PLASMA_APPLETBROWSER_H
23 #include <KDE/KDialog>
25 namespace Plasma
28 class Corona;
29 class Containment;
30 class Applet;
31 class AppletBrowserPrivate;
32 class AppletBrowserWidgetPrivate;
34 class AppletBrowserWidget : public QWidget
36 Q_OBJECT
37 public:
38 explicit AppletBrowserWidget(QWidget *parent = 0, Qt::WindowFlags f = 0);
39 virtual ~AppletBrowserWidget();
41 void setApplication(const QString &application = QString());
42 QString application();
44 /**
45 * Changes the current default containment to add applets to
47 * @arg containment the new default
49 void setContainment(Plasma::Containment *containment);
51 /**
52 * @return the current default containment to add applets to
54 Containment *containment() const;
56 public Q_SLOTS:
57 /**
58 * Adds currently selected applets
60 void addApplet();
62 /**
63 * Destroy all applets with this name
65 void destroyApplets(const QString &name);
67 /**
68 * Launches a download dialog to retrieve new applets from the Internet
70 * @arg type the type of widget to download; an empty string means the default
71 * Plasma widgets will be accessed, any other value should map to a
72 * PackageStructure PluginInfo-Name entry that provides a widget browser.
74 void downloadWidgets(const QString &type = QString());
76 /**
77 * Opens a file dialog to open a widget from a local file
79 void openWidgetFile();
81 /**
82 * Shows infos about applets.
84 void infoAboutApplet(const QString &name);
86 private:
87 Q_PRIVATE_SLOT(d, void appletAdded(Plasma::Applet*))
88 Q_PRIVATE_SLOT(d, void appletRemoved(Plasma::Applet*))
89 Q_PRIVATE_SLOT(d, void containmentDestroyed())
91 AppletBrowserWidgetPrivate * const d;
94 class AppletBrowser: public KDialog
96 Q_OBJECT
97 public:
98 explicit AppletBrowser(QWidget *parent = 0, Qt::WindowFlags f = 0);
99 virtual ~AppletBrowser();
101 void setApplication(const QString &application = QString());
102 QString application();
105 * Changes the current default containment to add applets to
107 * @arg containment the new default
109 void setContainment(Plasma::Containment *containment);
112 * @return the current default containment to add applets to
114 Containment *containment() const;
116 private:
117 Q_PRIVATE_SLOT(d, void populateWidgetsMenu())
118 AppletBrowserPrivate * const d;
121 } // namespace Plasma
123 #endif /*APPLETBROWSERWINDOW_H_*/