2008-11-04 00:08:39 +01:00
|
|
|
/*
|
|
|
|
* Copyright 2005 by Aaron Seigo <aseigo@kde.org>
|
|
|
|
* Copyright 2007 by Riccardo Iaconelli <riccardo@kde.org>
|
|
|
|
* Copyright 2008 by Ménard Alexis <darktears31@gmail.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Library General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 2, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this program; if not, write to the
|
|
|
|
* Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef PLASMA_APPLET_P_H
|
|
|
|
#define PLASMA_APPLET_P_H
|
|
|
|
|
2009-11-18 03:21:43 +01:00
|
|
|
#include <QBasicTimer>
|
2009-02-28 23:52:17 +01:00
|
|
|
#include <QGraphicsProxyWidget>
|
|
|
|
|
2008-11-04 03:39:56 +01:00
|
|
|
#include <kactioncollection.h>
|
2008-11-04 00:08:39 +01:00
|
|
|
|
2009-04-09 07:57:57 +02:00
|
|
|
#include "plasma/animator.h"
|
2009-04-01 01:51:52 +02:00
|
|
|
#include "plasma/private/dataengineconsumer_p.h"
|
2009-09-02 04:27:16 +02:00
|
|
|
#include "plasma/ui_publish.h"
|
2009-04-01 01:51:52 +02:00
|
|
|
|
2008-11-15 22:23:56 +01:00
|
|
|
class KKeySequenceWidget;
|
|
|
|
|
2009-09-16 19:08:45 +02:00
|
|
|
namespace KIO
|
|
|
|
{
|
|
|
|
class Job;
|
|
|
|
}
|
|
|
|
|
2008-11-04 00:08:39 +01:00
|
|
|
namespace Plasma
|
|
|
|
{
|
|
|
|
|
2009-09-12 02:19:42 +02:00
|
|
|
class Dialog;
|
2008-11-04 00:08:39 +01:00
|
|
|
class FrameSvg;
|
|
|
|
class AppletScript;
|
|
|
|
class Wallpaper;
|
2008-11-04 19:22:55 +01:00
|
|
|
class BusyWidget;
|
2008-11-04 00:08:39 +01:00
|
|
|
|
|
|
|
class AppletOverlayWidget : public QGraphicsWidget
|
|
|
|
{
|
2009-04-09 08:07:33 +02:00
|
|
|
Q_OBJECT
|
|
|
|
|
2008-11-04 00:08:39 +01:00
|
|
|
public:
|
|
|
|
AppletOverlayWidget(QGraphicsWidget *parent);
|
2009-02-04 12:39:22 +01:00
|
|
|
void destroy();
|
2008-11-04 00:08:39 +01:00
|
|
|
|
2009-03-05 14:05:12 +01:00
|
|
|
qreal opacity;
|
|
|
|
|
2008-11-04 00:08:39 +01:00
|
|
|
protected:
|
|
|
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
|
2009-02-04 12:39:22 +01:00
|
|
|
|
|
|
|
protected Q_SLOTS:
|
2009-12-11 20:53:55 +01:00
|
|
|
void overlayAnimationComplete();
|
2008-11-04 00:08:39 +01:00
|
|
|
};
|
|
|
|
|
2009-04-01 01:51:52 +02:00
|
|
|
class AppletPrivate : public DataEngineConsumer
|
2008-11-04 00:08:39 +01:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
AppletPrivate(KService::Ptr service, int uniqueID, Applet *applet);
|
|
|
|
~AppletPrivate();
|
|
|
|
|
2009-04-26 02:43:20 +02:00
|
|
|
void init(const QString &packagePath = QString());
|
2008-11-04 00:08:39 +01:00
|
|
|
|
|
|
|
// put all setup routines for script here. at this point we can assume that
|
|
|
|
// package exists and that we have a script engin
|
|
|
|
void setupScriptSupport();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets whether or not this Applet is acting as a Containment
|
|
|
|
*/
|
2009-02-18 14:55:18 +01:00
|
|
|
void setIsContainment(bool isContainment, bool forceUpdate = false);
|
2008-11-04 00:08:39 +01:00
|
|
|
|
|
|
|
QString globalName() const;
|
|
|
|
QString instanceName();
|
|
|
|
void scheduleConstraintsUpdate(Plasma::Constraints c);
|
2008-12-15 18:41:37 +01:00
|
|
|
void scheduleModificationNotification();
|
2008-11-04 00:08:39 +01:00
|
|
|
KConfigGroup *mainConfigGroup();
|
|
|
|
QString visibleFailureText(const QString &reason);
|
|
|
|
void checkImmutability();
|
|
|
|
void themeChanged();
|
|
|
|
void resetConfigurationObject();
|
2009-12-11 20:53:55 +01:00
|
|
|
void appletAnimationComplete();
|
2008-11-04 00:08:39 +01:00
|
|
|
void selectItemToDestroy();
|
|
|
|
void updateRect(const QRectF &rect);
|
|
|
|
void setFocus();
|
|
|
|
void cleanUpAndDelete();
|
2009-03-06 19:21:59 +01:00
|
|
|
void createMessageOverlay(bool usePopup = true);
|
2009-08-24 19:27:24 +02:00
|
|
|
void positionMessageOverlay();
|
2008-11-06 16:52:13 +01:00
|
|
|
void destroyMessageOverlay();
|
2008-11-15 22:23:56 +01:00
|
|
|
void addGlobalShortcutsPage(KConfigDialog *dialog);
|
2009-09-02 04:27:16 +02:00
|
|
|
void addPublishPage(KConfigDialog *dialog);
|
2008-11-21 04:43:45 +01:00
|
|
|
void clearShortcutEditorPtr();
|
2009-01-05 19:08:14 +01:00
|
|
|
void configDialogFinished();
|
2009-02-24 03:32:48 +01:00
|
|
|
KConfigDialog *generateGenericConfigDialog();
|
2009-10-23 15:48:29 +02:00
|
|
|
void addStandardConfigurationPages(KConfigDialog *dialog);
|
2009-01-20 03:11:01 +01:00
|
|
|
QString configDialogId() const;
|
|
|
|
QString configWindowTitle() const;
|
2009-05-03 22:22:14 +02:00
|
|
|
void updateShortcuts();
|
2009-09-04 02:08:26 +02:00
|
|
|
void publishCheckboxStateChanged(int state);
|
2008-11-04 00:08:39 +01:00
|
|
|
|
2009-05-03 22:22:14 +02:00
|
|
|
static KActionCollection* defaultActions(QObject *parent);
|
2009-05-01 20:03:13 +02:00
|
|
|
static QSet<QString> knownCategories();
|
2009-11-11 01:24:49 +01:00
|
|
|
static void filterOffers(QList<KService::Ptr> &offers);
|
2009-05-01 20:03:13 +02:00
|
|
|
|
2008-11-04 00:08:39 +01:00
|
|
|
static uint s_maxAppletId;
|
2009-01-23 19:07:20 +01:00
|
|
|
static int s_maxZValue;
|
|
|
|
static int s_minZValue;
|
2008-11-04 00:08:39 +01:00
|
|
|
static PackageStructure::Ptr packageStructure;
|
2009-05-18 13:15:00 +02:00
|
|
|
static QSet<QString> s_customCategories;
|
2008-11-04 00:08:39 +01:00
|
|
|
|
|
|
|
//TODO: examine the usage of memory here; there's a pretty large
|
|
|
|
// number of members at this point.
|
|
|
|
uint appletId;
|
|
|
|
Applet *q;
|
|
|
|
|
2009-06-10 20:28:17 +02:00
|
|
|
// applet attributes
|
2009-12-29 20:38:37 +01:00
|
|
|
QWeakPointer<Extender> extender;
|
2009-09-02 04:27:16 +02:00
|
|
|
Service *service;
|
2009-07-27 22:14:38 +02:00
|
|
|
Applet::BackgroundHints preferredBackgroundHints;
|
2009-09-02 04:27:16 +02:00
|
|
|
Applet::BackgroundHints backgroundHints;
|
2009-06-10 20:28:17 +02:00
|
|
|
Plasma::AspectRatioMode aspectRatioMode;
|
|
|
|
ImmutabilityType immutability;
|
|
|
|
|
|
|
|
// applet info we keep around in case its needed
|
2008-11-04 00:08:39 +01:00
|
|
|
KPluginInfo appletDescription;
|
2009-06-10 20:28:17 +02:00
|
|
|
QVariantList args;
|
|
|
|
|
|
|
|
// bookkeeping
|
2008-12-11 04:10:36 +01:00
|
|
|
QSet<QGraphicsItem*> registeredAsDragHandle;
|
2008-11-04 00:08:39 +01:00
|
|
|
Plasma::FrameSvg *background;
|
2009-06-10 20:28:17 +02:00
|
|
|
KConfigGroup *mainConfig;
|
|
|
|
Plasma::Constraints pendingConstraints;
|
|
|
|
|
|
|
|
// overlays and messages
|
2009-10-13 23:43:35 +02:00
|
|
|
QWeakPointer<Plasma::Dialog> messageDialog;
|
2009-06-10 20:28:17 +02:00
|
|
|
AppletOverlayWidget *messageOverlay;
|
|
|
|
QGraphicsProxyWidget *messageOverlayProxy;
|
|
|
|
Plasma::BusyWidget *busyWidget;
|
|
|
|
|
|
|
|
// sripting and package stuff
|
2008-11-04 00:08:39 +01:00
|
|
|
AppletScript *script;
|
|
|
|
Package *package;
|
|
|
|
ConfigLoader *configLoader;
|
2009-06-10 20:28:17 +02:00
|
|
|
|
|
|
|
// actions stuff; put activationAction into actions?
|
2009-05-03 22:22:14 +02:00
|
|
|
KActionCollection *actions;
|
2008-11-04 00:08:39 +01:00
|
|
|
KAction *activationAction;
|
2009-06-10 20:28:17 +02:00
|
|
|
|
|
|
|
// configuration
|
2008-11-15 22:23:56 +01:00
|
|
|
KKeySequenceWidget *shortcutEditor; //TODO: subclass KConfigDialog and encapsulate this in there
|
2009-06-10 20:28:17 +02:00
|
|
|
|
2009-07-09 18:35:11 +02:00
|
|
|
ItemStatus itemStatus;
|
2009-09-02 04:27:16 +02:00
|
|
|
QString remoteLocation;
|
|
|
|
Ui::publishWidget publishUI;
|
2009-07-09 18:35:11 +02:00
|
|
|
|
2010-04-21 14:16:06 +02:00
|
|
|
// the applet can change size policy by itself, so save the old one for eventual restore
|
|
|
|
QSizePolicy preferredSizePolicy;
|
|
|
|
|
2009-06-10 20:28:17 +02:00
|
|
|
// timerEvent bookkeeping
|
2009-11-18 03:21:43 +01:00
|
|
|
QBasicTimer constraintsTimer;
|
|
|
|
QBasicTimer busyWidgetTimer;
|
|
|
|
QBasicTimer *modificationsTimer;
|
2009-06-10 20:28:17 +02:00
|
|
|
|
|
|
|
// a great green field of booleans :)
|
2008-11-04 00:08:39 +01:00
|
|
|
bool hasConfigurationInterface : 1;
|
|
|
|
bool failed : 1;
|
|
|
|
bool isContainment : 1;
|
|
|
|
bool square : 1;
|
|
|
|
bool transient : 1;
|
2008-11-06 16:52:13 +01:00
|
|
|
bool needsConfig : 1;
|
2008-11-14 05:34:52 +01:00
|
|
|
bool started : 1;
|
2008-11-04 00:08:39 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
} // Plasma namespace
|
|
|
|
|
|
|
|
#endif
|