2008-11-03 23:08:39 +00: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
|
|
|
|
|
2013-07-10 01:45:41 +02:00
|
|
|
#include <QAction>
|
2009-11-18 02:21:43 +00:00
|
|
|
#include <QBasicTimer>
|
2009-02-28 22:52:17 +00:00
|
|
|
|
2008-11-04 02:39:56 +00:00
|
|
|
#include <kactioncollection.h>
|
2012-09-24 21:28:13 +02:00
|
|
|
#include <kconfigskeleton.h>
|
|
|
|
#include <kservice.h>
|
|
|
|
#include <kplugininfo.h>
|
2008-11-03 23:08:39 +00:00
|
|
|
|
2012-09-24 21:28:13 +02:00
|
|
|
#include "plasma/applet.h"
|
2009-03-31 23:51:52 +00:00
|
|
|
|
2008-11-15 21:23:56 +00:00
|
|
|
class KKeySequenceWidget;
|
|
|
|
|
2008-11-03 23:08:39 +00:00
|
|
|
namespace Plasma
|
|
|
|
{
|
|
|
|
|
|
|
|
class AppletScript;
|
2012-09-24 15:51:14 +02:00
|
|
|
class Service;
|
2008-11-03 23:08:39 +00:00
|
|
|
|
2013-03-01 14:29:14 +01:00
|
|
|
class AppletPrivate
|
2008-11-03 23:08:39 +00:00
|
|
|
{
|
|
|
|
public:
|
2010-08-02 23:56:02 +00:00
|
|
|
AppletPrivate(KService::Ptr service, const KPluginInfo *info, int uniqueID, Applet *applet);
|
2011-11-17 14:40:53 +01:00
|
|
|
virtual ~AppletPrivate();
|
2008-11-03 23:08:39 +00:00
|
|
|
|
2009-04-26 00:43:20 +00:00
|
|
|
void init(const QString &packagePath = QString());
|
2008-11-03 23:08:39 +00:00
|
|
|
|
2011-11-17 14:40:53 +01:00
|
|
|
// the interface
|
|
|
|
virtual void showConfigurationRequiredMessage(bool show, const QString &reason);
|
2014-03-20 19:22:27 +01:00
|
|
|
void askDestroy();
|
2012-02-28 16:52:11 +01:00
|
|
|
virtual void cleanUpAndDelete();
|
2011-11-17 14:40:53 +01:00
|
|
|
|
2008-11-03 23:08:39 +00:00
|
|
|
// put all setup routines for script here. at this point we can assume that
|
|
|
|
// package exists and that we have a script engin
|
2013-02-25 17:20:29 +01:00
|
|
|
void setupPackage();
|
2008-11-03 23:08:39 +00:00
|
|
|
|
|
|
|
QString globalName() const;
|
2013-05-14 18:08:58 +02:00
|
|
|
void scheduleConstraintsUpdate(Plasma::Types::Constraints c);
|
2008-12-15 17:41:37 +00:00
|
|
|
void scheduleModificationNotification();
|
2008-11-03 23:08:39 +00:00
|
|
|
KConfigGroup *mainConfigGroup();
|
|
|
|
void resetConfigurationObject();
|
2009-05-03 20:22:14 +00:00
|
|
|
void updateShortcuts();
|
2010-05-07 20:57:03 +00:00
|
|
|
void globalShortcutChanged();
|
2011-04-25 16:43:15 +02:00
|
|
|
void propagateConfigChanged();
|
2013-08-09 21:51:13 +02:00
|
|
|
void setUiReady();
|
2008-11-03 23:08:39 +00:00
|
|
|
|
2009-05-03 20:22:14 +00:00
|
|
|
static KActionCollection* defaultActions(QObject *parent);
|
2013-02-12 22:05:14 +01:00
|
|
|
|
2013-04-20 18:27:24 +02:00
|
|
|
void requestConfiguration();
|
2009-05-01 18:03:13 +00:00
|
|
|
|
2008-11-03 23:08:39 +00:00
|
|
|
static uint s_maxAppletId;
|
|
|
|
|
|
|
|
uint appletId;
|
|
|
|
Applet *q;
|
|
|
|
|
2009-06-10 18:28:17 +00:00
|
|
|
// applet attributes
|
2013-05-14 20:27:32 +02:00
|
|
|
Types::ImmutabilityType immutability;
|
2013-02-12 20:07:23 +01:00
|
|
|
QString launchErrorMessage;
|
2009-06-10 18:28:17 +00:00
|
|
|
|
|
|
|
// applet info we keep around in case its needed
|
2008-11-03 23:08:39 +00:00
|
|
|
KPluginInfo appletDescription;
|
2013-02-12 11:30:25 +01:00
|
|
|
QString customTitle;
|
2013-09-23 16:44:31 +02:00
|
|
|
QString icon;
|
2009-06-10 18:28:17 +00:00
|
|
|
|
|
|
|
// bookkeeping
|
|
|
|
KConfigGroup *mainConfig;
|
2013-05-14 18:08:58 +02:00
|
|
|
Plasma::Types::Constraints pendingConstraints;
|
2009-06-10 18:28:17 +00:00
|
|
|
|
2011-05-28 00:22:17 +02:00
|
|
|
// sripting and package stuff
|
|
|
|
AppletScript *script;
|
|
|
|
Package *package;
|
|
|
|
ConfigLoader *configLoader;
|
|
|
|
|
2009-06-10 18:28:17 +00:00
|
|
|
// actions stuff; put activationAction into actions?
|
2009-05-03 20:22:14 +00:00
|
|
|
KActionCollection *actions;
|
2013-07-10 01:45:41 +02:00
|
|
|
QAction *activationAction;
|
2009-06-10 18:28:17 +00:00
|
|
|
|
2013-05-14 20:49:50 +02:00
|
|
|
Types::ItemStatus itemStatus;
|
2009-07-09 16:35:11 +00:00
|
|
|
|
2009-06-10 18:28:17 +00:00
|
|
|
// timerEvent bookkeeping
|
2009-11-18 02:21:43 +00:00
|
|
|
QBasicTimer constraintsTimer;
|
|
|
|
QBasicTimer *modificationsTimer;
|
2009-06-10 18:28:17 +00:00
|
|
|
|
|
|
|
// a great green field of booleans :)
|
2008-11-03 23:08:39 +00:00
|
|
|
bool hasConfigurationInterface : 1;
|
2013-02-12 20:07:23 +01:00
|
|
|
bool failed : 1;
|
2008-11-03 23:08:39 +00:00
|
|
|
bool transient : 1;
|
2008-11-06 15:52:13 +00:00
|
|
|
bool needsConfig : 1;
|
2008-11-14 04:34:52 +00:00
|
|
|
bool started : 1;
|
2013-07-10 01:45:41 +02:00
|
|
|
bool globalShortcutEnabled : 1;
|
2013-08-09 21:51:13 +02:00
|
|
|
bool uiReady : 1;
|
2013-08-20 18:17:20 +02:00
|
|
|
bool userConfiguring : 1;
|
2008-11-03 23:08:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // Plasma namespace
|
|
|
|
|
|
|
|
#endif
|