2008-11-04 00:08:39 +01:00
|
|
|
/*
|
|
|
|
* Copyright 2007 Matt Broadstone <mbroadst@gmail.com>
|
|
|
|
* Copyright 2007 Aaron Seigo <aseigo@kde.org>
|
|
|
|
* Copyright 2007 Riccardo Iaconelli <riccardo@kde.org>
|
2009-08-18 00:31:18 +02:00
|
|
|
* Copyright (c) 2009 Chani Armitage <chani@kde.org>
|
2008-11-04 00:08:39 +01:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "corona.h"
|
|
|
|
|
|
|
|
#include <QApplication>
|
|
|
|
#include <QGraphicsView>
|
|
|
|
#include <QGraphicsSceneDragDropEvent>
|
|
|
|
#include <QGraphicsGridLayout>
|
|
|
|
#include <QMimeData>
|
|
|
|
#include <QPainter>
|
|
|
|
#include <QTimer>
|
|
|
|
|
2008-12-12 15:41:15 +01:00
|
|
|
#include <cmath>
|
|
|
|
|
2008-11-04 03:04:34 +01:00
|
|
|
#include <kdebug.h>
|
|
|
|
#include <kglobal.h>
|
|
|
|
#include <klocale.h>
|
|
|
|
#include <kmimetype.h>
|
2009-03-10 20:52:50 +01:00
|
|
|
#include <kactioncollection.h>
|
|
|
|
#include <kaction.h>
|
2009-05-03 22:22:14 +02:00
|
|
|
#include <kshortcutsdialog.h>
|
2008-11-04 00:08:39 +01:00
|
|
|
|
2010-01-04 07:37:41 +01:00
|
|
|
#include "abstracttoolbox.h"
|
2008-11-04 00:08:39 +01:00
|
|
|
#include "containment.h"
|
2009-10-05 22:50:57 +02:00
|
|
|
#include "containmentactionspluginsconfig.h"
|
2008-11-04 00:08:39 +01:00
|
|
|
#include "view.h"
|
|
|
|
#include "private/applet_p.h"
|
2009-05-03 22:22:14 +02:00
|
|
|
#include "private/containment_p.h"
|
2008-11-04 00:08:39 +01:00
|
|
|
#include "tooltipmanager.h"
|
2010-04-03 21:10:32 +02:00
|
|
|
#include "abstractdialogmanager.h"
|
2008-11-04 00:08:39 +01:00
|
|
|
|
|
|
|
using namespace Plasma;
|
|
|
|
|
|
|
|
namespace Plasma
|
|
|
|
{
|
|
|
|
|
|
|
|
// constant controlling how long between requesting a configuration sync
|
|
|
|
// and one happening should occur. currently 10 seconds
|
|
|
|
const int CONFIG_SYNC_TIMEOUT = 10000;
|
|
|
|
|
|
|
|
class CoronaPrivate
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CoronaPrivate(Corona *corona)
|
|
|
|
: q(corona),
|
|
|
|
immutability(Mutable),
|
|
|
|
mimetype("text/x-plasmoidservicename"),
|
2009-03-10 20:52:50 +01:00
|
|
|
config(0),
|
2010-04-04 16:34:04 +02:00
|
|
|
actions(corona)
|
2008-11-04 00:08:39 +01:00
|
|
|
{
|
|
|
|
if (KGlobal::hasMainComponent()) {
|
|
|
|
configName = KGlobal::mainComponent().componentName() + "-appletsrc";
|
|
|
|
} else {
|
|
|
|
configName = "plasma-appletsrc";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
~CoronaPrivate()
|
|
|
|
{
|
|
|
|
qDeleteAll(containments);
|
|
|
|
}
|
|
|
|
|
|
|
|
void init()
|
|
|
|
{
|
|
|
|
configSyncTimer.setSingleShot(true);
|
|
|
|
QObject::connect(&configSyncTimer, SIGNAL(timeout()), q, SLOT(syncConfig()));
|
2009-03-10 20:52:50 +01:00
|
|
|
|
|
|
|
//some common actions
|
2009-05-03 22:22:14 +02:00
|
|
|
actions.setConfigGroup("Shortcuts");
|
|
|
|
|
2009-05-04 00:13:05 +02:00
|
|
|
KAction *lockAction = actions.addAction("lock widgets");
|
2010-01-04 07:37:41 +01:00
|
|
|
QObject::connect(lockAction, SIGNAL(triggered(bool)), q, SLOT(toggleImmutability()));
|
2009-05-04 00:13:05 +02:00
|
|
|
lockAction->setText(i18n("Lock Widgets"));
|
2009-03-10 20:52:50 +01:00
|
|
|
lockAction->setIcon(KIcon("object-locked"));
|
2010-01-04 07:37:41 +01:00
|
|
|
lockAction->setData(AbstractToolBox::ControlTool);
|
2009-05-03 22:22:14 +02:00
|
|
|
lockAction->setShortcut(KShortcut("alt+d, l"));
|
2009-03-10 20:52:50 +01:00
|
|
|
lockAction->setShortcutContext(Qt::ApplicationShortcut);
|
2009-05-03 22:22:14 +02:00
|
|
|
|
|
|
|
//FIXME this doesn't really belong here. desktop KCM maybe?
|
|
|
|
//but should the shortcuts be per-app or really-global?
|
|
|
|
//I don't know how to make kactioncollections use plasmarc
|
2009-05-04 00:13:05 +02:00
|
|
|
KAction *action = actions.addAction("configure shortcuts");
|
2010-01-04 07:37:41 +01:00
|
|
|
QObject::connect(action, SIGNAL(triggered()), q, SLOT(showShortcutConfig()));
|
2009-05-04 00:13:05 +02:00
|
|
|
action->setText(i18n("Shortcut Settings"));
|
2009-05-03 22:22:14 +02:00
|
|
|
action->setIcon(KIcon("configure"));
|
2009-06-29 03:22:58 +02:00
|
|
|
action->setAutoRepeat(false);
|
2010-01-04 07:37:41 +01:00
|
|
|
action->setData(AbstractToolBox::ConfigureTool);
|
2009-05-03 22:22:14 +02:00
|
|
|
//action->setShortcut(KShortcut("ctrl+h"));
|
|
|
|
action->setShortcutContext(Qt::ApplicationShortcut);
|
|
|
|
|
|
|
|
actions.readSettings();
|
|
|
|
|
|
|
|
//fake containment/applet actions
|
|
|
|
KActionCollection *aActions = AppletPrivate::defaultActions(q);
|
|
|
|
KActionCollection *cActions = AppletPrivate::defaultActions(q); //containment has to start with applet stuff
|
|
|
|
ContainmentPrivate::addDefaultActions(cActions); //now it's really containment
|
|
|
|
//grab the current stuff
|
|
|
|
cActions->readSettings();
|
|
|
|
aActions->readSettings();
|
|
|
|
|
|
|
|
shortcutsDlg.setModal(false);
|
|
|
|
shortcutsDlg.addCollection(aActions);
|
|
|
|
shortcutsDlg.addCollection(cActions);
|
|
|
|
|
|
|
|
QObject::connect(&shortcutsDlg, SIGNAL(saved()), q, SIGNAL(shortcutsChanged()));
|
|
|
|
}
|
|
|
|
|
|
|
|
void showShortcutConfig()
|
|
|
|
{
|
|
|
|
//show a kshortcutsdialog with the actions
|
|
|
|
shortcutsDlg.configure();
|
2009-03-10 20:52:50 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void toggleImmutability()
|
|
|
|
{
|
|
|
|
if (immutability == Mutable) {
|
|
|
|
q->setImmutability(UserImmutable);
|
|
|
|
} else {
|
|
|
|
q->setImmutability(Mutable);
|
|
|
|
}
|
2008-11-04 00:08:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void saveLayout(KSharedConfigPtr cg) const
|
|
|
|
{
|
|
|
|
KConfigGroup containmentsGroup(cg, "Containments");
|
|
|
|
foreach (const Containment *containment, containments) {
|
|
|
|
QString cid = QString::number(containment->id());
|
|
|
|
KConfigGroup containmentConfig(&containmentsGroup, cid);
|
|
|
|
containment->save(containmentConfig);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void updateContainmentImmutability()
|
|
|
|
{
|
|
|
|
foreach (Containment *c, containments) {
|
|
|
|
// we need to tell each containment that immutability has been altered
|
|
|
|
c->updateConstraints(ImmutableConstraint);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void containmentDestroyed(QObject *obj)
|
|
|
|
{
|
|
|
|
// we do a static_cast here since it really isn't an Containment by this
|
|
|
|
// point anymore since we are in the qobject dtor. we don't actually
|
|
|
|
// try and do anything with it, we just need the value of the pointer
|
|
|
|
// so this unsafe looking code is actually just fine.
|
|
|
|
Containment* containment = static_cast<Plasma::Containment*>(obj);
|
|
|
|
int index = containments.indexOf(containment);
|
|
|
|
|
|
|
|
if (index > -1) {
|
|
|
|
containments.removeAt(index);
|
|
|
|
q->requestConfigSync();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void syncConfig()
|
|
|
|
{
|
|
|
|
q->config()->sync();
|
|
|
|
emit q->configSynced();
|
|
|
|
}
|
|
|
|
|
|
|
|
Containment *addContainment(const QString &name, const QVariantList &args,
|
|
|
|
uint id, bool delayedInit)
|
|
|
|
{
|
|
|
|
QString pluginName = name;
|
|
|
|
Containment *containment = 0;
|
|
|
|
Applet *applet = 0;
|
|
|
|
|
|
|
|
//kDebug() << "Loading" << name << args << id;
|
|
|
|
|
|
|
|
if (pluginName.isEmpty()) {
|
|
|
|
// default to the desktop containment
|
|
|
|
pluginName = "desktop";
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pluginName != "null") {
|
|
|
|
applet = Applet::load(pluginName, id, args);
|
|
|
|
containment = dynamic_cast<Containment*>(applet);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!containment) {
|
|
|
|
kDebug() << "loading of containment" << name << "failed.";
|
|
|
|
|
|
|
|
// in case we got a non-Containment from Applet::loadApplet or
|
|
|
|
// a null containment was requested
|
2009-10-15 06:05:14 +02:00
|
|
|
if (applet) {
|
|
|
|
// the applet probably doesn't know what's hit it, so let's pretend it can be
|
|
|
|
// initialized to make assumptions in the applet's dtor safer
|
|
|
|
q->addItem(applet);
|
|
|
|
applet->init();
|
|
|
|
q->removeItem(applet);
|
|
|
|
delete applet;
|
|
|
|
}
|
2008-11-04 00:08:39 +01:00
|
|
|
containment = new Containment(0, 0, id);
|
|
|
|
|
|
|
|
if (pluginName == "null") {
|
|
|
|
containment->setDrawWallpaper(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
// we want to provide something and don't care about the failure to launch
|
|
|
|
containment->setFailedToLaunch(false);
|
|
|
|
containment->setFormFactor(Plasma::Planar);
|
|
|
|
}
|
|
|
|
|
2009-02-18 14:55:18 +01:00
|
|
|
static_cast<Applet*>(containment)->d->isContainment = true;
|
2010-04-13 20:37:14 +02:00
|
|
|
containment->setPos(containment->d->preferredPos(q));
|
2009-01-22 00:50:57 +01:00
|
|
|
q->addItem(containment);
|
2009-02-18 14:55:18 +01:00
|
|
|
static_cast<Applet*>(containment)->d->setIsContainment(true, true);
|
2008-11-10 08:49:20 +01:00
|
|
|
containments.append(containment);
|
2008-11-04 00:08:39 +01:00
|
|
|
|
|
|
|
if (!delayedInit) {
|
|
|
|
containment->init();
|
|
|
|
containment->updateConstraints(Plasma::StartupCompletedConstraint);
|
|
|
|
KConfigGroup cg = containment->config();
|
|
|
|
containment->save(cg);
|
|
|
|
q->requestConfigSync();
|
2008-12-03 15:31:59 +01:00
|
|
|
containment->flushPendingConstraintsEvents();
|
2008-11-04 00:08:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
QObject::connect(containment, SIGNAL(destroyed(QObject*)),
|
|
|
|
q, SLOT(containmentDestroyed(QObject*)));
|
|
|
|
QObject::connect(containment, SIGNAL(configNeedsSaving()),
|
|
|
|
q, SLOT(requestConfigSync()));
|
|
|
|
QObject::connect(containment, SIGNAL(releaseVisualFocus()),
|
|
|
|
q, SIGNAL(releaseVisualFocus()));
|
|
|
|
QObject::connect(containment, SIGNAL(screenChanged(int,int,Plasma::Containment*)),
|
|
|
|
q, SIGNAL(screenOwnerChanged(int,int,Plasma::Containment*)));
|
|
|
|
|
|
|
|
if (!delayedInit) {
|
|
|
|
emit q->containmentAdded(containment);
|
|
|
|
}
|
|
|
|
|
|
|
|
return containment;
|
|
|
|
}
|
|
|
|
|
2008-11-06 19:21:10 +01:00
|
|
|
void offscreenWidgetDestroyed(QObject *);
|
|
|
|
|
2010-02-24 15:24:52 +01:00
|
|
|
static bool s_positioningContainments;
|
|
|
|
|
2008-11-04 00:08:39 +01:00
|
|
|
Corona *q;
|
|
|
|
ImmutabilityType immutability;
|
|
|
|
QString mimetype;
|
|
|
|
QString configName;
|
|
|
|
KSharedConfigPtr config;
|
|
|
|
QTimer configSyncTimer;
|
|
|
|
QList<Containment*> containments;
|
2008-12-10 01:57:42 +01:00
|
|
|
QHash<uint, QGraphicsWidget*> offscreenWidgets;
|
2009-03-10 20:52:50 +01:00
|
|
|
KActionCollection actions;
|
2009-05-03 22:22:14 +02:00
|
|
|
KShortcutsDialog shortcutsDlg;
|
2009-10-05 22:50:57 +02:00
|
|
|
QMap<Containment::Type, ContainmentActionsPluginsConfig> containmentActionsDefaults;
|
2010-04-04 16:34:04 +02:00
|
|
|
QWeakPointer<AbstractDialogManager>dialogManager;
|
2008-11-04 00:08:39 +01:00
|
|
|
};
|
|
|
|
|
2010-02-24 15:24:52 +01:00
|
|
|
bool CoronaPrivate::s_positioningContainments = false;
|
|
|
|
|
2008-11-04 00:08:39 +01:00
|
|
|
Corona::Corona(QObject *parent)
|
|
|
|
: QGraphicsScene(parent),
|
|
|
|
d(new CoronaPrivate(this))
|
|
|
|
{
|
2010-01-31 20:45:48 +01:00
|
|
|
kDebug() << "!!{} STARTUP TIME" << QTime().msecsTo(QTime::currentTime()) << "Corona ctor start";
|
2008-11-04 00:08:39 +01:00
|
|
|
d->init();
|
|
|
|
ToolTipManager::self()->m_corona = this;
|
|
|
|
//setViewport(new QGLWidget(QGLFormat(QGL::StencilBuffer | QGL::AlphaChannel)));
|
|
|
|
}
|
|
|
|
|
|
|
|
Corona::~Corona()
|
|
|
|
{
|
2009-01-22 01:00:16 +01:00
|
|
|
KConfigGroup trans(KGlobal::config(), "PlasmaTransientsConfig");
|
|
|
|
trans.deleteGroup();
|
|
|
|
|
2008-11-04 00:08:39 +01:00
|
|
|
// FIXME: Same fix as in Plasma::View - make sure that when the focused widget is
|
|
|
|
// destroyed we don't try to transfer it to something that's already been
|
|
|
|
// deleted.
|
|
|
|
clearFocus();
|
|
|
|
delete d;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Corona::setAppletMimeType(const QString &type)
|
|
|
|
{
|
|
|
|
d->mimetype = type;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString Corona::appletMimeType()
|
|
|
|
{
|
|
|
|
return d->mimetype;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Corona::saveLayout(const QString &configName) const
|
|
|
|
{
|
|
|
|
KSharedConfigPtr c;
|
|
|
|
|
|
|
|
if (configName.isEmpty() || configName == d->configName) {
|
|
|
|
c = config();
|
|
|
|
} else {
|
|
|
|
c = KSharedConfig::openConfig(configName);
|
|
|
|
}
|
|
|
|
|
|
|
|
d->saveLayout(c);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Corona::requestConfigSync()
|
|
|
|
{
|
|
|
|
// TODO: should we check into our immutability before doing this?
|
|
|
|
|
|
|
|
//NOTE: this is a pretty simplistic model: we simply save no more than CONFIG_SYNC_TIMEOUT
|
|
|
|
// after the first time this is called. not much of a heuristic for save points, but
|
|
|
|
// it should at least compress these activities a bit and provide a way for applet
|
|
|
|
// authors to ween themselves from the sync() disease. A more interesting/dynamic
|
|
|
|
// algorithm for determining when to actually sync() to disk might be better, though.
|
|
|
|
if (!d->configSyncTimer.isActive()) {
|
|
|
|
d->configSyncTimer.start(CONFIG_SYNC_TIMEOUT);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-12-18 23:12:49 +01:00
|
|
|
void Corona::requireConfigSync()
|
|
|
|
{
|
|
|
|
d->syncConfig();
|
|
|
|
}
|
|
|
|
|
2008-11-04 00:08:39 +01:00
|
|
|
void Corona::initializeLayout(const QString &configName)
|
|
|
|
{
|
|
|
|
clearContainments();
|
|
|
|
loadLayout(configName);
|
|
|
|
|
|
|
|
if (d->containments.isEmpty()) {
|
|
|
|
loadDefaultLayout();
|
|
|
|
if (!d->containments.isEmpty()) {
|
|
|
|
requestConfigSync();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (config()->isImmutable()) {
|
|
|
|
d->updateContainmentImmutability();
|
|
|
|
}
|
|
|
|
|
|
|
|
KConfigGroup coronaConfig(config(), "General");
|
|
|
|
setImmutability((ImmutabilityType)coronaConfig.readEntry("immutability", (int)Mutable));
|
|
|
|
}
|
|
|
|
|
2010-02-24 15:24:52 +01:00
|
|
|
bool containmentSortByPosition(const Containment *c1, const Containment *c2)
|
|
|
|
{
|
|
|
|
return c1->id() < c2->id();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Corona::layoutContainments()
|
|
|
|
{
|
|
|
|
if (CoronaPrivate::s_positioningContainments) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
CoronaPrivate::s_positioningContainments = true;
|
|
|
|
|
|
|
|
//TODO: we should avoid running this too often; consider compressing requests
|
|
|
|
// with a timer.
|
|
|
|
QList<Containment*> c = containments();
|
|
|
|
QMutableListIterator<Containment*> it(c);
|
|
|
|
|
|
|
|
while (it.hasNext()) {
|
|
|
|
Containment *containment = it.next();
|
|
|
|
if (containment->containmentType() == Containment::PanelContainment ||
|
|
|
|
containment->containmentType() == Containment::CustomPanelContainment ||
|
|
|
|
offscreenWidgets().contains(containment)) {
|
|
|
|
// weed out all containments we don't care about at all
|
|
|
|
// e.g. Panels and ourself
|
|
|
|
it.remove();
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
qSort(c.begin(), c.end(), containmentSortByPosition);
|
|
|
|
|
|
|
|
if (c.isEmpty()) {
|
|
|
|
CoronaPrivate::s_positioningContainments = false;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
int column = 0;
|
|
|
|
int x = 0;
|
|
|
|
int y = 0;
|
|
|
|
int rowHeight = 0;
|
|
|
|
|
|
|
|
it.toFront();
|
|
|
|
while (it.hasNext()) {
|
|
|
|
Containment *containment = it.next();
|
|
|
|
containment->setPos(x, y);
|
|
|
|
//kDebug() << ++count << "setting to" << x << y;
|
|
|
|
|
|
|
|
int height = containment->size().height();
|
|
|
|
if (height > rowHeight) {
|
|
|
|
rowHeight = height;
|
|
|
|
}
|
|
|
|
|
|
|
|
++column;
|
|
|
|
|
|
|
|
if (column == CONTAINMENT_COLUMNS) {
|
|
|
|
column = 0;
|
|
|
|
x = 0;
|
|
|
|
y += rowHeight + INTER_CONTAINMENT_MARGIN + TOOLBOX_MARGIN;
|
|
|
|
rowHeight = 0;
|
|
|
|
} else {
|
|
|
|
x += containment->size().width() + INTER_CONTAINMENT_MARGIN;
|
|
|
|
}
|
|
|
|
//kDebug() << "column: " << column << "; x " << x << "; y" << y << "; width was"
|
|
|
|
// << containment->size().width();
|
|
|
|
}
|
|
|
|
|
|
|
|
CoronaPrivate::s_positioningContainments = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-11-04 00:08:39 +01:00
|
|
|
void Corona::loadLayout(const QString &configName)
|
|
|
|
{
|
|
|
|
KSharedConfigPtr c;
|
2009-10-05 20:25:52 +02:00
|
|
|
bool mergeConfig = false;
|
2008-11-04 00:08:39 +01:00
|
|
|
|
|
|
|
if (configName.isEmpty() || configName == d->configName) {
|
|
|
|
c = config();
|
|
|
|
} else {
|
|
|
|
c = KSharedConfig::openConfig(configName);
|
2009-10-05 20:25:52 +02:00
|
|
|
mergeConfig = true;
|
2008-11-04 00:08:39 +01:00
|
|
|
}
|
|
|
|
|
2009-10-15 06:05:50 +02:00
|
|
|
QList<uint> containmentsIds;
|
2009-10-11 19:06:26 +02:00
|
|
|
|
|
|
|
if (mergeConfig) {
|
|
|
|
foreach (Plasma::Containment *cont, d->containments) {
|
|
|
|
containmentsIds.append(cont->id());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-05-31 15:05:28 +02:00
|
|
|
KConfigGroup containments(c, "Containments");
|
2008-11-04 00:08:39 +01:00
|
|
|
|
|
|
|
foreach (const QString &group, containments.groupList()) {
|
|
|
|
KConfigGroup containmentConfig(&containments, group);
|
|
|
|
|
|
|
|
if (containmentConfig.entryMap().isEmpty()) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2009-10-15 06:05:50 +02:00
|
|
|
uint cid = group.toUInt();
|
2009-10-11 19:06:26 +02:00
|
|
|
if (mergeConfig) {
|
|
|
|
if (containmentsIds.contains(cid)) {
|
|
|
|
cid = 0;
|
|
|
|
} else if (cid > AppletPrivate::s_maxAppletId) {
|
|
|
|
AppletPrivate::s_maxAppletId = cid;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-11-04 00:08:39 +01:00
|
|
|
//kDebug() << "got a containment in the config, trying to make a" << containmentConfig.readEntry("plugin", QString()) << "from" << group;
|
|
|
|
Containment *c = d->addContainment(containmentConfig.readEntry("plugin", QString()), QVariantList(),
|
|
|
|
cid, true);
|
|
|
|
if (!c) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2009-10-11 19:06:26 +02:00
|
|
|
if (mergeConfig) {
|
|
|
|
containmentsIds.append(c->id());
|
|
|
|
}
|
|
|
|
|
2008-11-04 00:08:39 +01:00
|
|
|
c->init();
|
|
|
|
c->restore(containmentConfig);
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach (Containment *containment, d->containments) {
|
2010-01-31 20:45:48 +01:00
|
|
|
|
2008-11-04 00:08:39 +01:00
|
|
|
QString cid = QString::number(containment->id());
|
2009-10-05 20:25:52 +02:00
|
|
|
KConfigGroup *appletsConfigGroup = 0;
|
|
|
|
if (mergeConfig) {
|
|
|
|
KConfigGroup containmentConfig(&containments, cid);
|
|
|
|
appletsConfigGroup = new KConfigGroup(&containmentConfig, "Applets");
|
|
|
|
}
|
2008-11-04 00:08:39 +01:00
|
|
|
|
|
|
|
foreach (Applet *applet, containment->applets()) {
|
2009-10-05 20:25:52 +02:00
|
|
|
if (mergeConfig) {
|
|
|
|
KConfigGroup externalAppletConfig(appletsConfigGroup, QString::number(applet->id()));
|
|
|
|
externalAppletConfig.copyTo(applet->d->mainConfigGroup());
|
|
|
|
}
|
|
|
|
|
2008-11-04 00:08:39 +01:00
|
|
|
applet->init();
|
|
|
|
// We have to flush the applet constraints manually
|
|
|
|
applet->flushPendingConstraintsEvents();
|
2010-01-31 20:45:48 +01:00
|
|
|
kDebug() << "!!{} STARTUP TIME" << QTime().msecsTo(QTime::currentTime()) << "Applet" << applet->name();
|
2008-11-04 00:08:39 +01:00
|
|
|
}
|
|
|
|
|
2009-10-05 20:25:52 +02:00
|
|
|
delete appletsConfigGroup;
|
2008-11-04 00:08:39 +01:00
|
|
|
containment->updateConstraints(Plasma::StartupCompletedConstraint);
|
|
|
|
containment->flushPendingConstraintsEvents();
|
|
|
|
emit containmentAdded(containment);
|
2010-01-31 20:45:48 +01:00
|
|
|
kDebug() << "!!{} STARTUP TIME" << QTime().msecsTo(QTime::currentTime()) << "Containment" << containment->name();
|
2008-11-04 00:08:39 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-11-17 05:34:55 +01:00
|
|
|
Containment *Corona::containmentForScreen(int screen, int desktop) const
|
2008-11-04 00:08:39 +01:00
|
|
|
{
|
|
|
|
foreach (Containment *containment, d->containments) {
|
|
|
|
if (containment->screen() == screen &&
|
2008-11-17 05:34:55 +01:00
|
|
|
(desktop < 0 || containment->desktop() == desktop) &&
|
2008-11-04 00:08:39 +01:00
|
|
|
(containment->containmentType() == Containment::DesktopContainment ||
|
2009-12-23 18:23:35 +01:00
|
|
|
containment->containmentType() == Containment::CustomContainment)) {
|
2008-11-04 00:08:39 +01:00
|
|
|
return containment;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
QList<Containment*> Corona::containments() const
|
|
|
|
{
|
|
|
|
return d->containments;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Corona::clearContainments()
|
|
|
|
{
|
|
|
|
foreach (Containment *containment, d->containments) {
|
|
|
|
containment->clearApplets();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
KSharedConfigPtr Corona::config() const
|
|
|
|
{
|
|
|
|
if (!d->config) {
|
|
|
|
d->config = KSharedConfig::openConfig(d->configName);
|
|
|
|
}
|
|
|
|
|
|
|
|
return d->config;
|
|
|
|
}
|
|
|
|
|
|
|
|
Containment *Corona::addContainment(const QString &name, const QVariantList &args)
|
|
|
|
{
|
|
|
|
return d->addContainment(name, args, 0, false);
|
|
|
|
}
|
|
|
|
|
|
|
|
Containment *Corona::addContainmentDelayed(const QString &name, const QVariantList &args)
|
|
|
|
{
|
|
|
|
return d->addContainment(name, args, 0, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Corona::addOffscreenWidget(QGraphicsWidget *widget)
|
|
|
|
{
|
2009-11-05 02:12:22 +01:00
|
|
|
foreach (QGraphicsWidget *w, d->offscreenWidgets) {
|
|
|
|
if (w == widget) {
|
|
|
|
kDebug() << "widget is already an offscreen widget!";
|
|
|
|
return;
|
|
|
|
}
|
2009-08-31 21:06:06 +02:00
|
|
|
}
|
|
|
|
|
2008-12-10 01:57:42 +01:00
|
|
|
//search for an empty spot in the topleft quadrant of the scene. each 'slot' is QWIDGETSIZE_MAX
|
|
|
|
//x QWIDGETSIZE_MAX, so we're guaranteed to never have to move widgets once they're placed here.
|
|
|
|
int i = 0;
|
|
|
|
while (d->offscreenWidgets.contains(i)) {
|
|
|
|
i++;
|
2008-11-04 00:08:39 +01:00
|
|
|
}
|
|
|
|
|
2008-12-10 01:57:42 +01:00
|
|
|
d->offscreenWidgets[i] = widget;
|
|
|
|
widget->setPos((-i - 1) * QWIDGETSIZE_MAX, -QWIDGETSIZE_MAX);
|
2009-11-05 02:12:22 +01:00
|
|
|
|
|
|
|
QGraphicsWidget *pw = widget->parentWidget();
|
|
|
|
widget->setParentItem(0);
|
|
|
|
widget->setParent(pw);
|
|
|
|
|
|
|
|
//kDebug() << "adding offscreen widget at slot " << i;
|
|
|
|
if (!widget->scene()) {
|
|
|
|
addItem(widget);
|
|
|
|
}
|
2008-12-10 01:57:42 +01:00
|
|
|
|
2008-11-06 19:21:10 +01:00
|
|
|
connect(widget, SIGNAL(destroyed(QObject*)), this, SLOT(offscreenWidgetDestroyed(QObject*)));
|
2008-11-04 00:08:39 +01:00
|
|
|
}
|
|
|
|
|
2008-12-10 01:57:42 +01:00
|
|
|
void Corona::removeOffscreenWidget(QGraphicsWidget *widget)
|
2008-11-06 19:21:10 +01:00
|
|
|
{
|
2008-12-10 01:57:42 +01:00
|
|
|
QMutableHashIterator<uint, QGraphicsWidget *> it(d->offscreenWidgets);
|
2008-11-06 19:21:10 +01:00
|
|
|
|
2008-12-10 01:57:42 +01:00
|
|
|
while (it.hasNext()) {
|
|
|
|
if (it.next().value() == widget) {
|
|
|
|
it.remove();
|
|
|
|
return;
|
2008-11-06 19:21:10 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-04-07 23:22:18 +02:00
|
|
|
QList <QGraphicsWidget *> Corona::offscreenWidgets() const
|
|
|
|
{
|
|
|
|
return d->offscreenWidgets.values();
|
|
|
|
}
|
|
|
|
|
2008-12-10 01:57:42 +01:00
|
|
|
void CoronaPrivate::offscreenWidgetDestroyed(QObject *o)
|
2008-11-04 00:08:39 +01:00
|
|
|
{
|
2008-12-10 01:57:42 +01:00
|
|
|
// at this point, it's just a QObject, not a QGraphicsWidget, but we still need
|
|
|
|
// a pointer of the appropriate type.
|
|
|
|
// WARNING: DO NOT USE THE WIDGET POINTER FOR ANYTHING OTHER THAN POINTER COMPARISONS
|
|
|
|
QGraphicsWidget *widget = static_cast<QGraphicsWidget *>(o);
|
|
|
|
q->removeOffscreenWidget(widget);
|
2008-11-04 00:08:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
int Corona::numScreens() const
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
QRect Corona::screenGeometry(int id) const
|
|
|
|
{
|
|
|
|
Q_UNUSED(id);
|
|
|
|
if (views().isEmpty()) {
|
|
|
|
return sceneRect().toRect();
|
|
|
|
} else {
|
|
|
|
QGraphicsView *v = views()[0];
|
|
|
|
QRect r = sceneRect().toRect();
|
|
|
|
r.moveTo(v->mapToGlobal(v->pos()));
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
QRegion Corona::availableScreenRegion(int id) const
|
|
|
|
{
|
|
|
|
return QRegion(screenGeometry(id));
|
|
|
|
}
|
|
|
|
|
|
|
|
QPoint Corona::popupPosition(const QGraphicsItem *item, const QSize &s)
|
|
|
|
{
|
2009-09-28 19:28:17 +02:00
|
|
|
return popupPosition(item, s, Qt::AlignLeft);
|
|
|
|
}
|
|
|
|
|
|
|
|
QPoint Corona::popupPosition(const QGraphicsItem *item, const QSize &s, Qt::AlignmentFlag alignment)
|
|
|
|
{
|
|
|
|
// TODO: merge both methods (also these in Applet) into one (with optional alignment) when we can break compatibility
|
|
|
|
// TODO: add support for more flags in the future?
|
|
|
|
|
2008-11-04 00:08:39 +01:00
|
|
|
QGraphicsView *v = viewFor(item);
|
|
|
|
|
|
|
|
if (!v) {
|
|
|
|
return QPoint(0, 0);
|
|
|
|
}
|
|
|
|
|
2008-12-12 15:41:15 +01:00
|
|
|
QPoint pos;
|
|
|
|
QTransform sceneTransform = item->sceneTransform();
|
|
|
|
|
2009-09-28 19:28:17 +02:00
|
|
|
//swap direction if necessary
|
|
|
|
if (QApplication::isRightToLeft() && alignment != Qt::AlignCenter) {
|
|
|
|
if (alignment == Qt::AlignRight) {
|
2009-10-05 20:26:25 +02:00
|
|
|
alignment = Qt::AlignLeft;
|
2009-09-28 19:28:17 +02:00
|
|
|
} else {
|
2009-10-05 20:26:25 +02:00
|
|
|
alignment = Qt::AlignRight;
|
2009-09-28 19:28:17 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-12-12 15:41:15 +01:00
|
|
|
//if the applet is rotated the popup position has to be un-transformed
|
|
|
|
if (sceneTransform.isRotating()) {
|
|
|
|
qreal angle = acos(sceneTransform.m11());
|
|
|
|
QTransform newTransform;
|
|
|
|
QPointF center = item->sceneBoundingRect().center();
|
|
|
|
|
|
|
|
newTransform.translate(center.x(), center.y());
|
|
|
|
newTransform.rotateRadians(-angle);
|
|
|
|
newTransform.translate(-center.x(), -center.y());
|
|
|
|
pos = v->mapFromScene(newTransform.inverted().map(item->scenePos()));
|
|
|
|
} else {
|
|
|
|
pos = v->mapFromScene(item->scenePos());
|
|
|
|
}
|
|
|
|
|
2008-11-04 00:08:39 +01:00
|
|
|
pos = v->mapToGlobal(pos);
|
|
|
|
//kDebug() << "==> position is" << item->scenePos() << v->mapFromScene(item->scenePos()) << pos;
|
|
|
|
Plasma::View *pv = dynamic_cast<Plasma::View *>(v);
|
|
|
|
|
|
|
|
Plasma::Location loc = Floating;
|
|
|
|
if (pv && pv->containment()) {
|
|
|
|
loc = pv->containment()->location();
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (loc) {
|
|
|
|
case BottomEdge:
|
2009-03-20 23:17:44 +01:00
|
|
|
case TopEdge: {
|
2009-09-28 19:28:17 +02:00
|
|
|
if (alignment == Qt::AlignCenter) {
|
|
|
|
pos.setX(pos.x() + item->boundingRect().width()/2 - s.width()/2);
|
|
|
|
} else if (alignment == Qt::AlignRight) {
|
|
|
|
pos.setX(pos.x() + item->boundingRect().width() - s.width());
|
|
|
|
}
|
|
|
|
|
2009-03-20 23:17:44 +01:00
|
|
|
if (pos.x() + s.width() > v->geometry().right()) {
|
|
|
|
pos.setX(v->geometry().right() - s.width());
|
|
|
|
} else {
|
|
|
|
pos.setX(qMax(pos.x(), v->geometry().left()));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case LeftEdge:
|
|
|
|
case RightEdge: {
|
2009-09-28 19:28:17 +02:00
|
|
|
if (alignment == Qt::AlignCenter) {
|
|
|
|
pos.setY(pos.y() + item->boundingRect().height()/2 - s.height()/2);
|
|
|
|
} else if (alignment == Qt::AlignRight) {
|
|
|
|
pos.setY(pos.y() + item->boundingRect().height() - s.height());
|
|
|
|
}
|
|
|
|
|
2009-03-20 23:17:44 +01:00
|
|
|
if (pos.y() + s.height() > v->geometry().bottom()) {
|
|
|
|
pos.setY(v->geometry().bottom() - s.height());
|
|
|
|
} else {
|
|
|
|
pos.setY(qMax(pos.y(), v->geometry().top()));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
2009-09-28 19:28:17 +02:00
|
|
|
if (alignment == Qt::AlignCenter) {
|
|
|
|
pos.setX(pos.x() + item->boundingRect().width()/2 - s.width()/2);
|
|
|
|
} else if (alignment == Qt::AlignRight) {
|
|
|
|
pos.setX(pos.x() + item->boundingRect().width() - s.width());
|
|
|
|
}
|
2009-03-20 23:17:44 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
switch (loc) {
|
|
|
|
case BottomEdge:
|
|
|
|
pos.setY(v->geometry().y() - s.height());
|
2008-11-04 00:08:39 +01:00
|
|
|
break;
|
|
|
|
case TopEdge:
|
2009-03-20 23:17:44 +01:00
|
|
|
pos.setY(v->geometry().bottom());
|
2008-11-04 00:08:39 +01:00
|
|
|
break;
|
|
|
|
case LeftEdge:
|
2009-03-20 23:17:44 +01:00
|
|
|
pos.setX(v->geometry().right());
|
2008-11-04 00:08:39 +01:00
|
|
|
break;
|
|
|
|
case RightEdge:
|
2009-03-20 23:17:44 +01:00
|
|
|
pos.setX(v->geometry().x() - s.width());
|
2008-11-04 00:08:39 +01:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
if (pos.y() - s.height() > 0) {
|
2009-10-17 01:00:24 +02:00
|
|
|
pos.ry() = pos.y() - s.height();
|
2008-11-04 00:08:39 +01:00
|
|
|
} else {
|
2009-10-17 01:00:24 +02:00
|
|
|
pos.ry() = pos.y() + (int)item->boundingRect().size().height() + 1;
|
2008-11-04 00:08:39 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//are we out of screen?
|
2009-10-29 20:53:03 +01:00
|
|
|
int screen = ((pv && pv->containment()) ? pv->containment()->screen() : -1);
|
|
|
|
if (pv && screen == -1) {
|
|
|
|
screen = pv->screen();
|
|
|
|
}
|
|
|
|
|
|
|
|
QRect screenRect = screenGeometry(screen);
|
|
|
|
//kDebug() << "==> rect for" << screen << "is" << screenRect;
|
2008-11-04 00:08:39 +01:00
|
|
|
|
2009-10-29 20:53:03 +01:00
|
|
|
|
2009-10-17 01:00:24 +02:00
|
|
|
if (loc != LeftEdge && pos.x() + s.width() > screenRect.right()) {
|
|
|
|
pos.rx() -= ((pos.x() + s.width()) - screenRect.right());
|
2008-11-04 00:08:39 +01:00
|
|
|
}
|
|
|
|
|
2009-10-17 01:00:24 +02:00
|
|
|
if (loc != TopEdge && pos.y() + s.height() > screenRect.bottom()) {
|
|
|
|
pos.ry() -= ((pos.y() + s.height()) - screenRect.bottom());
|
2008-11-04 00:08:39 +01:00
|
|
|
}
|
|
|
|
|
2009-10-17 01:00:24 +02:00
|
|
|
pos.rx() = qMax(0, pos.x());
|
2009-09-28 19:28:17 +02:00
|
|
|
|
2008-11-04 00:08:39 +01:00
|
|
|
return pos;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Corona::loadDefaultLayout()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void Corona::dragEnterEvent(QGraphicsSceneDragDropEvent *event)
|
|
|
|
{
|
|
|
|
QGraphicsScene::dragEnterEvent(event);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Corona::dragLeaveEvent(QGraphicsSceneDragDropEvent *event)
|
|
|
|
{
|
|
|
|
QGraphicsScene::dragLeaveEvent(event);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Corona::dragMoveEvent(QGraphicsSceneDragDropEvent *event)
|
|
|
|
{
|
|
|
|
QGraphicsScene::dragMoveEvent(event);
|
|
|
|
}
|
|
|
|
|
|
|
|
ImmutabilityType Corona::immutability() const
|
|
|
|
{
|
|
|
|
return d->immutability;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Corona::setImmutability(const ImmutabilityType immutable)
|
|
|
|
{
|
|
|
|
if (d->immutability == immutable ||
|
|
|
|
d->immutability == SystemImmutable) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
kDebug() << "setting immutability to" << immutable;
|
|
|
|
d->immutability = immutable;
|
|
|
|
d->updateContainmentImmutability();
|
2009-03-11 19:37:12 +01:00
|
|
|
//tell non-containments that might care (like plasmaapp or a custom corona)
|
|
|
|
emit immutabilityChanged(immutable);
|
2008-12-15 17:27:52 +01:00
|
|
|
|
2009-03-11 05:46:13 +01:00
|
|
|
//update our actions
|
|
|
|
QAction *action = d->actions.action("lock widgets");
|
|
|
|
if (action) {
|
2009-03-11 19:37:12 +01:00
|
|
|
if (d->immutability == SystemImmutable) {
|
|
|
|
action->setEnabled(false);
|
|
|
|
action->setVisible(false);
|
|
|
|
} else {
|
|
|
|
bool unlocked = d->immutability == Mutable;
|
|
|
|
action->setText(unlocked ? i18n("Lock Widgets") : i18n("Unlock Widgets"));
|
|
|
|
action->setIcon(KIcon(unlocked ? "object-locked" : "object-unlocked"));
|
2009-10-11 16:48:03 +02:00
|
|
|
action->setEnabled(true);
|
|
|
|
action->setVisible(true);
|
2009-03-11 19:37:12 +01:00
|
|
|
}
|
2009-03-11 05:46:13 +01:00
|
|
|
}
|
|
|
|
|
2008-12-15 17:27:52 +01:00
|
|
|
KConfigGroup cg(config(), "General");
|
|
|
|
|
|
|
|
// we call the dptr member directly for locked since isImmutable()
|
|
|
|
// also checks kiosk and parent containers
|
|
|
|
cg.writeEntry("immutability", (int)d->immutability);
|
|
|
|
requestConfigSync();
|
2008-11-04 00:08:39 +01:00
|
|
|
}
|
|
|
|
|
2008-12-21 11:23:45 +01:00
|
|
|
QList<Plasma::Location> Corona::freeEdges(int screen) const
|
|
|
|
{
|
|
|
|
QList<Plasma::Location> freeEdges;
|
|
|
|
freeEdges << Plasma::TopEdge << Plasma::BottomEdge
|
|
|
|
<< Plasma::LeftEdge << Plasma::RightEdge;
|
|
|
|
|
|
|
|
foreach (Containment *containment, containments()) {
|
2009-09-28 19:28:17 +02:00
|
|
|
if (containment->screen() == screen &&
|
2008-12-21 11:23:45 +01:00
|
|
|
freeEdges.contains(containment->location())) {
|
|
|
|
freeEdges.removeAll(containment->location());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return freeEdges;
|
|
|
|
}
|
|
|
|
|
2009-03-10 20:52:50 +01:00
|
|
|
QAction *Corona::action(QString name) const
|
|
|
|
{
|
|
|
|
return d->actions.action(name);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Corona::addAction(QString name, QAction *action)
|
|
|
|
{
|
|
|
|
d->actions.addAction(name, action);
|
|
|
|
}
|
|
|
|
|
2009-05-04 00:13:05 +02:00
|
|
|
KAction* Corona::addAction(QString name)
|
|
|
|
{
|
|
|
|
return d->actions.addAction(name);
|
|
|
|
}
|
|
|
|
|
2009-03-10 20:52:50 +01:00
|
|
|
QList<QAction*> Corona::actions() const
|
|
|
|
{
|
|
|
|
return d->actions.actions();
|
|
|
|
}
|
|
|
|
|
2009-03-11 19:37:12 +01:00
|
|
|
void Corona::enableAction(const QString &name, bool enable)
|
|
|
|
{
|
|
|
|
QAction *action = d->actions.action(name);
|
|
|
|
if (action) {
|
|
|
|
action->setEnabled(enable);
|
|
|
|
action->setVisible(enable);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-05-03 22:22:14 +02:00
|
|
|
void Corona::updateShortcuts()
|
|
|
|
{
|
|
|
|
d->actions.readSettings();
|
|
|
|
d->shortcutsDlg.addCollection(&d->actions);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Corona::addShortcuts(KActionCollection *newShortcuts)
|
|
|
|
{
|
|
|
|
d->shortcutsDlg.addCollection(newShortcuts);
|
|
|
|
}
|
|
|
|
|
2009-10-05 22:50:57 +02:00
|
|
|
void Corona::setContainmentActionsDefaults(Containment::Type containmentType, const ContainmentActionsPluginsConfig &config)
|
|
|
|
{
|
|
|
|
d->containmentActionsDefaults.insert(containmentType, config);
|
|
|
|
}
|
|
|
|
|
|
|
|
ContainmentActionsPluginsConfig Corona::containmentActionsDefaults(Containment::Type containmentType)
|
|
|
|
{
|
|
|
|
return d->containmentActionsDefaults.value(containmentType);
|
|
|
|
}
|
|
|
|
|
2010-04-03 21:10:32 +02:00
|
|
|
void Corona::setDialogManager(AbstractDialogManager *dialogManager)
|
|
|
|
{
|
|
|
|
d->dialogManager = dialogManager;
|
|
|
|
}
|
|
|
|
|
|
|
|
AbstractDialogManager *Corona::dialogManager()
|
|
|
|
{
|
2010-04-04 16:34:04 +02:00
|
|
|
return d->dialogManager.data();
|
2010-04-03 21:10:32 +02:00
|
|
|
}
|
|
|
|
|
2008-11-04 00:08:39 +01:00
|
|
|
} // namespace Plasma
|
|
|
|
|
|
|
|
#include "corona.moc"
|
|
|
|
|