2007-09-26 09:44:06 +02:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2007 Ivan Cukic <ivan.cukic+kde@gmail.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
2007-10-12 10:44:02 +02:00
|
|
|
* it under the terms of the GNU Library/Lesser General Public License
|
|
|
|
* version 2, or (at your option) any later version, as published by the
|
|
|
|
* Free Software Foundation
|
2007-09-26 09:44:06 +02:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details
|
|
|
|
*
|
2007-10-12 10:44:02 +02:00
|
|
|
* You should have received a copy of the GNU Library/Lesser General Public
|
2007-09-26 09:44:06 +02:00
|
|
|
* License along with this program; if not, write to the
|
|
|
|
* Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
|
2008-10-12 12:48:53 +02:00
|
|
|
#ifndef PLASMA_APPLETBROWSER_H
|
|
|
|
#define PLASMA_APPLETBROWSER_H
|
2007-09-26 09:44:06 +02:00
|
|
|
|
2007-09-30 00:58:52 +02:00
|
|
|
#include <KDE/KDialog>
|
2007-09-27 20:51:31 +02:00
|
|
|
|
2007-10-03 17:44:28 +02:00
|
|
|
#include <plasma/plasma_export.h>
|
|
|
|
|
2007-09-27 21:39:28 +02:00
|
|
|
namespace Plasma
|
|
|
|
{
|
2007-09-26 09:44:06 +02:00
|
|
|
|
2007-09-27 21:39:28 +02:00
|
|
|
class Corona;
|
|
|
|
class Containment;
|
2007-12-10 02:18:57 +01:00
|
|
|
class Applet;
|
2008-07-01 20:56:43 +02:00
|
|
|
class AppletBrowserPrivate;
|
|
|
|
class AppletBrowserWidgetPrivate;
|
2007-09-26 09:44:06 +02:00
|
|
|
|
2007-11-16 13:23:42 +01:00
|
|
|
class PLASMA_EXPORT AppletBrowserWidget : public QWidget
|
2007-09-26 09:44:06 +02:00
|
|
|
{
|
2007-09-27 19:50:31 +02:00
|
|
|
Q_OBJECT
|
2007-09-26 09:44:06 +02:00
|
|
|
public:
|
2008-05-09 07:32:15 +02:00
|
|
|
explicit AppletBrowserWidget(QWidget *parent = 0, Qt::WindowFlags f = 0);
|
2007-11-16 13:23:42 +01:00
|
|
|
virtual ~AppletBrowserWidget();
|
2007-09-26 09:44:06 +02:00
|
|
|
|
2008-10-11 18:19:04 +02:00
|
|
|
void setApplication(const QString &application = QString());
|
2007-11-16 13:23:42 +01:00
|
|
|
QString application();
|
2007-11-06 08:50:00 +01:00
|
|
|
|
2008-02-13 03:30:07 +01:00
|
|
|
/**
|
|
|
|
* Changes the current default containment to add applets to
|
|
|
|
*
|
|
|
|
* @arg containment the new default
|
|
|
|
*/
|
|
|
|
void setContainment(Plasma::Containment *containment);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return the current default containment to add applets to
|
|
|
|
*/
|
2008-10-11 18:19:04 +02:00
|
|
|
Containment *containment() const;
|
2008-02-13 03:30:07 +01:00
|
|
|
|
2008-04-29 22:01:23 +02:00
|
|
|
public Q_SLOTS:
|
2007-09-27 21:55:18 +02:00
|
|
|
/**
|
|
|
|
* Adds currently selected applets
|
|
|
|
*/
|
2007-09-27 21:39:28 +02:00
|
|
|
void addApplet();
|
2007-09-27 21:55:18 +02:00
|
|
|
|
2007-12-10 02:18:57 +01:00
|
|
|
/**
|
|
|
|
* Destroy all applets with this name
|
|
|
|
*/
|
2008-02-19 10:19:02 +01:00
|
|
|
void destroyApplets(const QString &name);
|
2007-12-10 02:18:57 +01:00
|
|
|
|
2007-09-27 21:55:18 +02:00
|
|
|
/**
|
|
|
|
* Launches a download dialog to retrieve new applets from the Internet
|
2008-10-14 00:40:00 +02:00
|
|
|
*
|
|
|
|
* @arg type the type of widget to download; an empty string means the default
|
|
|
|
* Plasma widgets will be accessed, any other value should map to a
|
|
|
|
* PackageStructure PluginInfo-Name entry that provides a widget browser.
|
2007-09-27 21:55:18 +02:00
|
|
|
*/
|
2008-10-14 00:40:00 +02:00
|
|
|
void downloadWidgets(const QString &type = QString());
|
2008-02-26 22:22:13 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Opens a file dialog to open a widget from a local file
|
|
|
|
*/
|
|
|
|
void openWidgetFile();
|
2007-09-27 19:50:31 +02:00
|
|
|
|
2007-09-26 09:44:06 +02:00
|
|
|
private:
|
2008-04-29 23:59:51 +02:00
|
|
|
Q_PRIVATE_SLOT(d, void appletAdded(Plasma::Applet*))
|
2008-06-17 23:55:35 +02:00
|
|
|
Q_PRIVATE_SLOT(d, void appletRemoved(Plasma::Applet*))
|
2008-07-17 21:44:29 +02:00
|
|
|
Q_PRIVATE_SLOT(d, void containmentDestroyed())
|
2008-04-29 22:01:23 +02:00
|
|
|
|
2008-07-01 20:56:43 +02:00
|
|
|
AppletBrowserWidgetPrivate * const d;
|
2007-11-16 13:23:42 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
class PLASMA_EXPORT AppletBrowser: public KDialog
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2008-04-29 22:01:23 +02:00
|
|
|
explicit AppletBrowser(QWidget *parent = 0, Qt::WindowFlags f = 0);
|
2007-11-16 13:23:42 +01:00
|
|
|
virtual ~AppletBrowser();
|
|
|
|
|
2008-10-11 18:19:04 +02:00
|
|
|
void setApplication(const QString &application = QString());
|
2007-11-16 13:23:42 +01:00
|
|
|
QString application();
|
|
|
|
|
2008-02-13 03:30:07 +01:00
|
|
|
/**
|
|
|
|
* Changes the current default containment to add applets to
|
|
|
|
*
|
|
|
|
* @arg containment the new default
|
|
|
|
*/
|
|
|
|
void setContainment(Plasma::Containment *containment);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return the current default containment to add applets to
|
|
|
|
*/
|
2008-10-11 18:19:04 +02:00
|
|
|
Containment *containment() const;
|
2008-02-13 03:30:07 +01:00
|
|
|
|
2007-11-16 13:23:42 +01:00
|
|
|
private:
|
2008-10-14 08:17:07 +02:00
|
|
|
Q_PRIVATE_SLOT(d, void populateWidgetsMenu())
|
2008-07-01 20:56:43 +02:00
|
|
|
AppletBrowserPrivate * const d;
|
2007-09-26 09:44:06 +02:00
|
|
|
};
|
|
|
|
|
2007-09-27 21:39:28 +02:00
|
|
|
} // namespace Plasma
|
|
|
|
|
2007-09-26 09:44:06 +02:00
|
|
|
#endif /*APPLETBROWSERWINDOW_H_*/
|