• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.32 API Reference
  • KDE Home
  • Contact Us
 

Plasma

  • plasma
corona.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2007 Matt Broadstone <mbroadst@gmail.com>
3  * Copyright 2007-2011 Aaron Seigo <aseigo@kde.org>
4  * Copyright 2007 Riccardo Iaconelli <riccardo@kde.org>
5  * Copyright (c) 2009 Chani Armitage <chani@kde.org>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU Library General Public License as
9  * published by the Free Software Foundation; either version 2, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details
16  *
17  * You should have received a copy of the GNU Library General Public
18  * License along with this program; if not, write to the
19  * Free Software Foundation, Inc.,
20  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21  */
22 
23 #include "corona.h"
24 #include "private/corona_p.h"
25 
26 #include <QApplication>
27 #include <QDesktopWidget>
28 #include <QGraphicsView>
29 #include <QGraphicsSceneDragDropEvent>
30 #include <QGraphicsGridLayout>
31 #include <QMimeData>
32 #include <QPainter>
33 #include <QTimer>
34 
35 #include <cmath>
36 
37 #include <kaction.h>
38 #include <kauthorized.h>
39 #include <kdebug.h>
40 #include <kglobal.h>
41 #include <klocale.h>
42 #include <kmimetype.h>
43 #include <kshortcutsdialog.h>
44 #include <kwindowsystem.h>
45 
46 #include "animator.h"
47 #include "abstracttoolbox.h"
48 #include "containment.h"
49 #include "containmentactionspluginsconfig.h"
50 #include "view.h"
51 #include "private/animator_p.h"
52 #include "private/applet_p.h"
53 #include "private/containment_p.h"
54 #include "tooltipmanager.h"
55 #include "abstractdialogmanager.h"
56 
57 using namespace Plasma;
58 
59 namespace Plasma
60 {
61 
62 bool CoronaPrivate::s_positioningContainments = false;
63 
64 Corona::Corona(QObject *parent)
65  : QGraphicsScene(parent),
66  d(new CoronaPrivate(this))
67 {
68  kDebug() << "!!{} STARTUP TIME" << QTime().msecsTo(QTime::currentTime()) << "Corona ctor start";
69  d->init();
70  ToolTipManager::self()->m_corona = this;
71  //setViewport(new QGLWidget(QGLFormat(QGL::StencilBuffer | QGL::AlphaChannel)));
72 }
73 
74 Corona::~Corona()
75 {
76  KConfigGroup trans(KGlobal::config(), "PlasmaTransientsConfig");
77  trans.deleteGroup();
78 
79  // FIXME: Same fix as in Plasma::View - make sure that when the focused widget is
80  // destroyed we don't try to transfer it to something that's already been
81  // deleted.
82  clearFocus();
83  delete d;
84 }
85 
86 void Corona::setAppletMimeType(const QString &type)
87 {
88  d->mimetype = type;
89 }
90 
91 QString Corona::appletMimeType()
92 {
93  return d->mimetype;
94 }
95 
96 void Corona::setDefaultContainmentPlugin(const QString &name)
97 {
98  // we could check if it is in:
99  // Containment::listContainments().contains(name) ||
100  // Containment::listContainments(QString(), KGlobal::mainComponent().componentName()).contains(name)
101  // but that seems like overkill
102  d->defaultContainmentPlugin = name;
103 }
104 
105 QString Corona::defaultContainmentPlugin() const
106 {
107  return d->defaultContainmentPlugin;
108 }
109 
110 void Corona::saveLayout(const QString &configName) const
111 {
112  KSharedConfigPtr c;
113 
114  if (configName.isEmpty() || configName == d->configName) {
115  c = config();
116  } else {
117  c = KSharedConfig::openConfig(configName, KConfig::SimpleConfig);
118  }
119 
120  d->saveLayout(c);
121 }
122 
123 void Corona::exportLayout(KConfigGroup &config, QList<Containment*> containments)
124 {
125  foreach (const QString &group, config.groupList()) {
126  KConfigGroup cg(&config, group);
127  cg.deleteGroup();
128  }
129 
130  //temporarily unlock so that removal works
131  ImmutabilityType oldImm = immutability();
132  d->immutability = Mutable;
133 
134  KConfigGroup dest(&config, "Containments");
135  KConfigGroup dummy;
136  foreach (Plasma::Containment *c, containments) {
137  c->save(dummy);
138  c->config().reparent(&dest);
139 
140  //ensure the containment is unlocked
141  //this is done directly because we have to bypass any SystemImmutable checks
142  c->Applet::d->immutability = Mutable;
143  foreach (Applet *a, c->applets()) {
144  a->d->immutability = Mutable;
145  }
146 
147  c->destroy(false);
148  }
149 
150  //restore immutability
151  d->immutability = oldImm;
152 
153  config.sync();
154 }
155 
156 void Corona::requestConfigSync()
157 {
158  // constant controlling how long between requesting a configuration sync
159  // and one happening should occur. currently 10 seconds
160  static const int CONFIG_SYNC_TIMEOUT = 10000;
161 
162  // TODO: should we check into our immutability before doing this?
163 
164  //NOTE: this is a pretty simplistic model: we simply save no more than CONFIG_SYNC_TIMEOUT
165  // after the first time this is called. not much of a heuristic for save points, but
166  // it should at least compress these activities a bit and provide a way for applet
167  // authors to ween themselves from the sync() disease. A more interesting/dynamic
168  // algorithm for determining when to actually sync() to disk might be better, though.
169  if (!d->configSyncTimer.isActive()) {
170  d->configSyncTimer.start(CONFIG_SYNC_TIMEOUT);
171  }
172 }
173 
174 void Corona::requireConfigSync()
175 {
176  d->syncConfig();
177 }
178 
179 void Corona::initializeLayout(const QString &configName)
180 {
181  clearContainments();
182  loadLayout(configName);
183 
184  if (d->containments.isEmpty()) {
185  loadDefaultLayout();
186  if (!d->containments.isEmpty()) {
187  requestConfigSync();
188  }
189  }
190 
191  if (config()->isImmutable() ||
192  !KAuthorized::authorize("plasma/" + KGlobal::mainComponent().aboutData()->appName() +
193  "/unlockedDesktop")) {
194  setImmutability(SystemImmutable);
195  } else {
196  KConfigGroup coronaConfig(config(), "General");
197  setImmutability((ImmutabilityType)coronaConfig.readEntry("immutability", (int)Mutable));
198  }
199 }
200 
201 bool containmentSortByPosition(const Containment *c1, const Containment *c2)
202 {
203  return c1->id() < c2->id();
204 }
205 
206 void Corona::layoutContainments()
207 {
208  if (CoronaPrivate::s_positioningContainments) {
209  return;
210  }
211 
212  CoronaPrivate::s_positioningContainments = true;
213 
214  //TODO: we should avoid running this too often; consider compressing requests
215  // with a timer.
216  QList<Containment*> c = containments();
217  QMutableListIterator<Containment*> it(c);
218 
219  while (it.hasNext()) {
220  Containment *containment = it.next();
221  if (containment->containmentType() == Containment::PanelContainment ||
222  containment->containmentType() == Containment::CustomPanelContainment ||
223  offscreenWidgets().contains(containment)) {
224  // weed out all containments we don't care about at all
225  // e.g. Panels and ourself
226  it.remove();
227  continue;
228  }
229  }
230 
231  qSort(c.begin(), c.end(), containmentSortByPosition);
232 
233  if (c.isEmpty()) {
234  CoronaPrivate::s_positioningContainments = false;
235  return;
236  }
237 
238  int column = 0;
239  int x = 0;
240  int y = 0;
241  int rowHeight = 0;
242 
243  it.toFront();
244  while (it.hasNext()) {
245  Containment *containment = it.next();
246  containment->setPos(x, y);
247  //kDebug() << ++count << "setting to" << x << y;
248 
249  int height = containment->size().height();
250  if (height > rowHeight) {
251  rowHeight = height;
252  }
253 
254  ++column;
255 
256  if (column == CONTAINMENT_COLUMNS) {
257  column = 0;
258  x = 0;
259  y += rowHeight + INTER_CONTAINMENT_MARGIN + TOOLBOX_MARGIN;
260  rowHeight = 0;
261  } else {
262  x += containment->size().width() + INTER_CONTAINMENT_MARGIN;
263  }
264  //kDebug() << "column: " << column << "; x " << x << "; y" << y << "; width was"
265  // << containment->size().width();
266  }
267 
268  CoronaPrivate::s_positioningContainments = false;
269 }
270 
271 
272 void Corona::loadLayout(const QString &configName)
273 {
274  if (!configName.isEmpty() && configName != d->configName) {
275  // if we have a new config name passed in, then use that as the config file for this Corona
276  d->config = 0;
277  d->configName = configName;
278  }
279 
280  KSharedConfigPtr conf = config();
281  d->importLayout(*conf, false);
282 }
283 
284 QList<Plasma::Containment *> Corona::importLayout(const KConfigGroup &conf)
285 {
286  return d->importLayout(conf, true);
287 }
288 
289 #ifndef KDE_NO_DEPRECATED
290 QList<Plasma::Containment *> Corona::importLayout(const KConfigBase &conf)
291 {
292  return d->importLayout(conf, true);
293 }
294 #endif
295 
296 Containment *Corona::containmentForScreen(int screen, int desktop) const
297 {
298  foreach (Containment *containment, d->containments) {
299  if (containment->screen() == screen &&
300  (desktop < 0 || containment->desktop() == desktop) &&
301  (containment->containmentType() == Containment::DesktopContainment ||
302  containment->containmentType() == Containment::CustomContainment)) {
303  return containment;
304  }
305  }
306 
307  return 0;
308 }
309 
310 Containment *Corona::containmentForScreen(int screen, int desktop,
311  const QString &defaultPluginIfNonExistent, const QVariantList &defaultArgs)
312 {
313  Containment *containment = containmentForScreen(screen, desktop);
314  if (!containment && !defaultPluginIfNonExistent.isEmpty()) {
315  // screen requests are allowed to bypass immutability
316  if (screen >= 0 && screen < numScreens() &&
317  desktop >= -1 && desktop < KWindowSystem::numberOfDesktops()) {
318  containment = d->addContainment(defaultPluginIfNonExistent, defaultArgs, 0, false);
319  if (containment) {
320  containment->setScreen(screen, desktop);
321  }
322  }
323  }
324 
325  return containment;
326 }
327 
328 QList<Containment*> Corona::containments() const
329 {
330  return d->containments;
331 }
332 
333 void Corona::clearContainments()
334 {
335  foreach (Containment *containment, d->containments) {
336  containment->clearApplets();
337  }
338 }
339 
340 KSharedConfigPtr Corona::config() const
341 {
342  if (!d->config) {
343  d->config = KSharedConfig::openConfig(d->configName, KConfig::SimpleConfig);
344  }
345 
346  return d->config;
347 }
348 
349 Containment *Corona::addContainment(const QString &name, const QVariantList &args)
350 {
351  if (d->immutability == Mutable) {
352  return d->addContainment(name, args, 0, false);
353  }
354 
355  return 0;
356 }
357 
358 Containment *Corona::addContainmentDelayed(const QString &name, const QVariantList &args)
359 {
360  if (d->immutability == Mutable) {
361  return d->addContainment(name, args, 0, true);
362  }
363 
364  return 0;
365 }
366 
367 void Corona::mapAnimation(Animator::Animation from, Animator::Animation to)
368 {
369  AnimatorPrivate::mapAnimation(from, to);
370 }
371 
372 void Corona::mapAnimation(Animator::Animation from, const QString &to)
373 {
374  AnimatorPrivate::mapAnimation(from, to);
375 }
376 
377 void Corona::addOffscreenWidget(QGraphicsWidget *widget)
378 {
379  foreach (QGraphicsWidget *w, d->offscreenWidgets) {
380  if (w == widget) {
381  kDebug() << "widget is already an offscreen widget!";
382  return;
383  }
384  }
385 
386  //search for an empty spot in the topleft quadrant of the scene. each 'slot' is QWIDGETSIZE_MAX
387  //x QWIDGETSIZE_MAX, so we're guaranteed to never have to move widgets once they're placed here.
388  int i = 0;
389  while (d->offscreenWidgets.contains(i)) {
390  i++;
391  }
392 
393  d->offscreenWidgets[i] = widget;
394 #if defined(arm) || defined(__arm__)
395  widget->setPos((-i - 1) * 2000, -2000);
396 #else
397  widget->setPos((-i - 1) * QWIDGETSIZE_MAX, -QWIDGETSIZE_MAX);
398 #endif
399 
400  QGraphicsWidget *pw = widget->parentWidget();
401  widget->setParentItem(0);
402  if (pw) {
403  widget->setParent(pw);
404  }
405 
406  //kDebug() << "adding offscreen widget at slot " << i;
407  if (!widget->scene()) {
408  addItem(widget);
409  }
410 
411  connect(widget, SIGNAL(destroyed(QObject*)), this, SLOT(offscreenWidgetDestroyed(QObject*)));
412 }
413 
414 void Corona::removeOffscreenWidget(QGraphicsWidget *widget)
415 {
416  QMutableHashIterator<uint, QGraphicsWidget *> it(d->offscreenWidgets);
417 
418  while (it.hasNext()) {
419  if (it.next().value() == widget) {
420  it.remove();
421  return;
422  }
423  }
424 }
425 
426 QList <QGraphicsWidget *> Corona::offscreenWidgets() const
427 {
428  return d->offscreenWidgets.values();
429 }
430 
431 void CoronaPrivate::offscreenWidgetDestroyed(QObject *o)
432 {
433  // at this point, it's just a QObject, not a QGraphicsWidget, but we still need
434  // a pointer of the appropriate type.
435  // WARNING: DO NOT USE THE WIDGET POINTER FOR ANYTHING OTHER THAN POINTER COMPARISONS
436  QGraphicsWidget *widget = static_cast<QGraphicsWidget *>(o);
437  q->removeOffscreenWidget(widget);
438 }
439 
440 int Corona::numScreens() const
441 {
442  return 1;
443 }
444 
445 QRect Corona::screenGeometry(int id) const
446 {
447  Q_UNUSED(id);
448  QGraphicsView *v = views().value(0);
449  if (v) {
450  QRect r = sceneRect().toRect();
451  r.moveTo(v->mapToGlobal(QPoint(0, 0)));
452  return r;
453  }
454 
455  return sceneRect().toRect();
456 }
457 
458 QRegion Corona::availableScreenRegion(int id) const
459 {
460  return QRegion(screenGeometry(id));
461 }
462 
463 QPoint Corona::popupPosition(const QGraphicsItem *item, const QSize &s)
464 {
465  return popupPosition(item, s, Qt::AlignLeft);
466 }
467 
468 QPoint Corona::popupPosition(const QGraphicsItem *item, const QSize &s, Qt::AlignmentFlag alignment)
469 {
470  // TODO: merge both methods (also these in Applet) into one (with optional alignment) when we can break compatibility
471  // TODO: add support for more flags in the future?
472 
473  const QGraphicsItem *actualItem = item;
474 
475  const QGraphicsView *v = viewFor(item);
476 
477  if (!v) {
478  return QPoint(0, 0);
479  }
480 
481  //its own view could be hidden, for instance if item is in an hidden Dialog
482  //try to position it using the parent applet as the item
483  if (!v->isVisible()) {
484  actualItem = item->parentItem();
485  if (!actualItem) {
486  const QGraphicsWidget *widget = qgraphicsitem_cast<const QGraphicsWidget*>(item);
487  if (widget) {
488  actualItem = qobject_cast<QGraphicsItem*>(widget->parent());
489  }
490  }
491 
492  //kDebug() << actualItem;
493 
494  if (actualItem) {
495  v = viewFor(actualItem);
496  if (!v) {
497  return QPoint(0, 0);
498  }
499  }
500  }
501 
502  if (!actualItem) {
503  actualItem = item;
504  }
505 
506  QPoint pos;
507  QTransform sceneTransform = actualItem->sceneTransform();
508 
509  //swap direction if necessary
510  if (QApplication::isRightToLeft() && alignment != Qt::AlignCenter) {
511  if (alignment == Qt::AlignRight) {
512  alignment = Qt::AlignLeft;
513  } else {
514  alignment = Qt::AlignRight;
515  }
516  }
517 
518  //if the applet is rotated the popup position has to be un-transformed
519  if (sceneTransform.isRotating()) {
520  qreal angle = acos(sceneTransform.m11());
521  QTransform newTransform;
522  QPointF center = actualItem->sceneBoundingRect().center();
523 
524  newTransform.translate(center.x(), center.y());
525  newTransform.rotateRadians(-angle);
526  newTransform.translate(-center.x(), -center.y());
527  pos = v->mapFromScene(newTransform.inverted().map(actualItem->scenePos()));
528  } else {
529  pos = v->mapFromScene(actualItem->scenePos());
530  }
531 
532  pos = v->mapToGlobal(pos);
533  //kDebug() << "==> position is" << actualItem->scenePos() << v->mapFromScene(actualItem->scenePos()) << pos;
534  const Plasma::View *pv = qobject_cast<const Plasma::View *>(v);
535 
536  Plasma::Location loc = Floating;
537  if (pv && pv->containment()) {
538  loc = pv->containment()->location();
539  }
540 
541  switch (loc) {
542  case BottomEdge:
543  case TopEdge: {
544  if (alignment == Qt::AlignCenter) {
545  pos.setX(pos.x() + actualItem->boundingRect().width()/2 - s.width()/2);
546  } else if (alignment == Qt::AlignRight) {
547  pos.setX(pos.x() + actualItem->boundingRect().width() - s.width());
548  }
549 
550  if (pos.x() + s.width() > v->geometry().x() + v->geometry().width()) {
551  pos.setX((v->geometry().x() + v->geometry().width()) - s.width());
552  } else {
553  pos.setX(qMax(pos.x(), v->geometry().left()));
554  }
555  break;
556  }
557  case LeftEdge:
558  case RightEdge: {
559  if (alignment == Qt::AlignCenter) {
560  pos.setY(pos.y() + actualItem->boundingRect().height()/2 - s.height()/2);
561  } else if (alignment == Qt::AlignRight) {
562  pos.setY(pos.y() + actualItem->boundingRect().height() - s.height());
563  }
564 
565  if (pos.y() + s.height() > v->geometry().y() + v->geometry().height()) {
566  pos.setY((v->geometry().y() + v->geometry().height()) - s.height());
567  } else {
568  pos.setY(qMax(pos.y(), v->geometry().top()));
569  }
570  break;
571  }
572  default:
573  if (alignment == Qt::AlignCenter) {
574  pos.setX(pos.x() + actualItem->boundingRect().width()/2 - s.width()/2);
575  } else if (alignment == Qt::AlignRight) {
576  pos.setX(pos.x() + actualItem->boundingRect().width() - s.width());
577  }
578  break;
579  }
580 
581 
582  //are we out of screen?
583  int screen = ((pv && pv->containment()) ? pv->containment()->screen() : -1);
584  if (screen == -1) {
585  if (pv) {
586  screen = pv->screen();
587  } else {
588  // fall back to asking the actual system what screen the view is on
589  // in the case we are dealing with a non-PlasmaView QGraphicsView
590  screen = QApplication::desktop()->screenNumber(v);
591  }
592  }
593 
594  QRect screenRect = screenGeometry(screen);
595 
596  switch (loc) {
597  case BottomEdge:
598  pos.setY(v->geometry().y() - s.height());
599  break;
600  case TopEdge:
601  pos.setY(v->geometry().y() + v->geometry().height());
602  break;
603  case LeftEdge:
604  pos.setX(v->geometry().x() + v->geometry().width());
605  break;
606  case RightEdge:
607  pos.setX(v->geometry().x() - s.width());
608  break;
609  default:
610  if (pos.y() - s.height() > screenRect.top()) {
611  pos.ry() = pos.y() - s.height();
612  } else {
613  pos.ry() = pos.y() + (int)actualItem->boundingRect().size().height() + 1;
614  }
615  }
616 
617  //kDebug() << "==> rect for" << screen << "is" << screenRect;
618 
619  if (loc != LeftEdge && pos.x() + s.width() > screenRect.x() + screenRect.width()) {
620  pos.rx() -= ((pos.x() + s.width()) - (screenRect.x() + screenRect.width()));
621  }
622 
623  if (loc != TopEdge && pos.y() + s.height() > screenRect.y() + screenRect.height()) {
624  pos.ry() -= ((pos.y() + s.height()) - (screenRect.y() + screenRect.height()));
625  }
626 
627  pos.rx() = qMax(0, pos.x());
628  pos.ry() = qMax(0, pos.y());
629  return pos;
630 }
631 
632 void Corona::loadDefaultLayout()
633 {
634 }
635 
636 void Corona::setPreferredToolBoxPlugin(const Containment::Type type, const QString &plugin)
637 {
638  d->toolBoxPlugins[type] = plugin;
639  //TODO: react to plugin changes on the fly? still don't see the use case (maybe for laptops that become tablets?)
640 }
641 
642 QString Corona::preferredToolBoxPlugin(const Containment::Type type) const
643 {
644  return d->toolBoxPlugins.value(type);
645 }
646 
647 void Corona::dragEnterEvent(QGraphicsSceneDragDropEvent *event)
648 {
649  QGraphicsScene::dragEnterEvent(event);
650 }
651 
652 void Corona::dragLeaveEvent(QGraphicsSceneDragDropEvent *event)
653 {
654  QGraphicsScene::dragLeaveEvent(event);
655 }
656 
657 void Corona::dragMoveEvent(QGraphicsSceneDragDropEvent *event)
658 {
659  QGraphicsScene::dragMoveEvent(event);
660 }
661 
662 ImmutabilityType Corona::immutability() const
663 {
664  return d->immutability;
665 }
666 
667 void Corona::setImmutability(const ImmutabilityType immutable)
668 {
669  if (d->immutability == immutable || d->immutability == SystemImmutable) {
670  return;
671  }
672 
673  kDebug() << "setting immutability to" << immutable;
674  d->immutability = immutable;
675  d->updateContainmentImmutability();
676  //tell non-containments that might care (like plasmaapp or a custom corona)
677  emit immutabilityChanged(immutable);
678 
679  //update our actions
680  QAction *action = d->actions.action("lock widgets");
681  if (action) {
682  if (d->immutability == SystemImmutable) {
683  action->setEnabled(false);
684  action->setVisible(false);
685  } else {
686  bool unlocked = d->immutability == Mutable;
687  action->setText(unlocked ? i18n("Lock Widgets") : i18n("Unlock Widgets"));
688  action->setIcon(KIcon(unlocked ? "object-locked" : "object-unlocked"));
689  action->setEnabled(true);
690  action->setVisible(true);
691  }
692  }
693 
694  if (d->immutability != SystemImmutable) {
695  KConfigGroup cg(config(), "General");
696 
697  // we call the dptr member directly for locked since isImmutable()
698  // also checks kiosk and parent containers
699  cg.writeEntry("immutability", (int)d->immutability);
700  requestConfigSync();
701  }
702 }
703 
704 QList<Plasma::Location> Corona::freeEdges(int screen) const
705 {
706  QList<Plasma::Location> freeEdges;
707  freeEdges << Plasma::TopEdge << Plasma::BottomEdge
708  << Plasma::LeftEdge << Plasma::RightEdge;
709 
710  foreach (Containment *containment, containments()) {
711  if (containment->screen() == screen &&
712  freeEdges.contains(containment->location())) {
713  freeEdges.removeAll(containment->location());
714  }
715  }
716 
717  return freeEdges;
718 }
719 
720 QAction *Corona::action(QString name) const
721 {
722  return d->actions.action(name);
723 }
724 
725 void Corona::addAction(QString name, QAction *action)
726 {
727  d->actions.addAction(name, action);
728 }
729 
730 KAction* Corona::addAction(QString name)
731 {
732  return d->actions.addAction(name);
733 }
734 
735 QList<QAction*> Corona::actions() const
736 {
737  return d->actions.actions();
738 }
739 
740 void Corona::enableAction(const QString &name, bool enable)
741 {
742  QAction *action = d->actions.action(name);
743  if (action) {
744  action->setEnabled(enable);
745  action->setVisible(enable);
746  }
747 }
748 
749 void Corona::updateShortcuts()
750 {
751  QMutableListIterator<QWeakPointer<KActionCollection> > it(d->actionCollections);
752  while (it.hasNext()) {
753  it.next();
754  KActionCollection *collection = it.value().data();
755  if (!collection) {
756  // get rid of KActionCollections that have been deleted behind our backs
757  it.remove();
758  continue;
759  }
760 
761  collection->readSettings();
762  if (d->shortcutsDlg) {
763  d->shortcutsDlg.data()->addCollection(collection);
764  }
765  }
766 }
767 
768 void Corona::addShortcuts(KActionCollection *newShortcuts)
769 {
770  d->actionCollections << newShortcuts;
771  if (d->shortcutsDlg) {
772  d->shortcutsDlg.data()->addCollection(newShortcuts);
773  }
774 }
775 
776 void Corona::setContainmentActionsDefaults(Containment::Type containmentType, const ContainmentActionsPluginsConfig &config)
777 {
778  d->containmentActionsDefaults.insert(containmentType, config);
779 }
780 
781 ContainmentActionsPluginsConfig Corona::containmentActionsDefaults(Containment::Type containmentType)
782 {
783  return d->containmentActionsDefaults.value(containmentType);
784 }
785 
786 void Corona::setDialogManager(AbstractDialogManager *dialogManager)
787 {
788  d->dialogManager = dialogManager;
789 }
790 
791 AbstractDialogManager *Corona::dialogManager()
792 {
793  return d->dialogManager.data();
794 }
795 
796 CoronaPrivate::CoronaPrivate(Corona *corona)
797  : q(corona),
798  immutability(Mutable),
799  mimetype("text/x-plasmoidservicename"),
800  defaultContainmentPlugin("desktop"),
801  config(0),
802  actions(corona)
803 {
804  if (KGlobal::hasMainComponent()) {
805  configName = KGlobal::mainComponent().componentName() + "-appletsrc";
806  } else {
807  configName = "plasma-appletsrc";
808  }
809 }
810 
811 CoronaPrivate::~CoronaPrivate()
812 {
813  qDeleteAll(containments);
814 }
815 
816 void CoronaPrivate::init()
817 {
818  q->setStickyFocus(true);
819  configSyncTimer.setSingleShot(true);
820  QObject::connect(&configSyncTimer, SIGNAL(timeout()), q, SLOT(syncConfig()));
821 
822  //some common actions
823  actions.setConfigGroup("Shortcuts");
824 
825  KAction *lockAction = actions.addAction("lock widgets");
826  QObject::connect(lockAction, SIGNAL(triggered(bool)), q, SLOT(toggleImmutability()));
827  lockAction->setText(i18n("Lock Widgets"));
828  lockAction->setAutoRepeat(true);
829  lockAction->setIcon(KIcon("object-locked"));
830  lockAction->setData(AbstractToolBox::ControlTool);
831  lockAction->setShortcut(KShortcut("alt+d, l"));
832  lockAction->setShortcutContext(Qt::ApplicationShortcut);
833 
834  //FIXME this doesn't really belong here. desktop KCM maybe?
835  //but should the shortcuts be per-app or really-global?
836  //I don't know how to make kactioncollections use plasmarc
837  KAction *action = actions.addAction("configure shortcuts");
838  QObject::connect(action, SIGNAL(triggered()), q, SLOT(showShortcutConfig()));
839  action->setText(i18n("Shortcut Settings"));
840  action->setIcon(KIcon("configure-shortcuts"));
841  action->setAutoRepeat(false);
842  action->setData(AbstractToolBox::ConfigureTool);
843  //action->setShortcut(KShortcut("ctrl+h"));
844  action->setShortcutContext(Qt::ApplicationShortcut);
845 
846  //fake containment/applet actions
847  KActionCollection *containmentActions = AppletPrivate::defaultActions(q); //containment has to start with applet stuff
848  ContainmentPrivate::addDefaultActions(containmentActions); //now it's really containment
849  actionCollections << &actions << AppletPrivate::defaultActions(q) << containmentActions;
850  q->updateShortcuts();
851 }
852 
853 void CoronaPrivate::showShortcutConfig()
854 {
855  //show a kshortcutsdialog with the actions
856  KShortcutsDialog *dlg = shortcutsDlg.data();
857  if (!dlg) {
858  dlg = new KShortcutsDialog();
859  dlg->setModal(false);
860  dlg->setAttribute(Qt::WA_DeleteOnClose, true);
861  QObject::connect(dlg, SIGNAL(saved()), q, SIGNAL(shortcutsChanged()));
862 
863  dlg->addCollection(&actions);
864  QMutableListIterator<QWeakPointer<KActionCollection> > it(actionCollections);
865  while (it.hasNext()) {
866  it.next();
867  KActionCollection *collection = it.value().data();
868  if (!collection) {
869  // get rid of KActionCollections that have been deleted behind our backs
870  it.remove();
871  continue;
872  }
873 
874  dlg->addCollection(collection);
875  }
876  }
877 
878  KWindowSystem::setOnDesktop(dlg->winId(), KWindowSystem::currentDesktop());
879  dlg->configure();
880  dlg->raise();
881 }
882 
883 void CoronaPrivate::toggleImmutability()
884 {
885  if (immutability == Mutable) {
886  q->setImmutability(UserImmutable);
887  } else {
888  q->setImmutability(Mutable);
889  }
890 }
891 
892 void CoronaPrivate::saveLayout(KSharedConfigPtr cg) const
893 {
894  KConfigGroup containmentsGroup(cg, "Containments");
895  foreach (const Containment *containment, containments) {
896  QString cid = QString::number(containment->id());
897  KConfigGroup containmentConfig(&containmentsGroup, cid);
898  containment->save(containmentConfig);
899  }
900 }
901 
902 void CoronaPrivate::updateContainmentImmutability()
903 {
904  foreach (Containment *c, containments) {
905  // we need to tell each containment that immutability has been altered
906  c->updateConstraints(ImmutableConstraint);
907  }
908 }
909 
910 void CoronaPrivate::containmentDestroyed(QObject *obj)
911 {
912  // we do a static_cast here since it really isn't an Containment by this
913  // point anymore since we are in the qobject dtor. we don't actually
914  // try and do anything with it, we just need the value of the pointer
915  // so this unsafe looking code is actually just fine.
916  Containment* containment = static_cast<Plasma::Containment*>(obj);
917  int index = containments.indexOf(containment);
918 
919  if (index > -1) {
920  containments.removeAt(index);
921  q->requestConfigSync();
922  }
923  }
924 
925 void CoronaPrivate::syncConfig()
926 {
927  q->config()->sync();
928  emit q->configSynced();
929 }
930 
931 Containment *CoronaPrivate::addContainment(const QString &name, const QVariantList &args, uint id, bool delayedInit)
932 {
933  QString pluginName = name;
934  Containment *containment = 0;
935  Applet *applet = 0;
936 
937  //kDebug() << "Loading" << name << args << id;
938 
939  if (pluginName.isEmpty() || pluginName == "default") {
940  // default to the desktop containment
941  pluginName = defaultContainmentPlugin;
942  }
943 
944  bool loadingNull = pluginName == "null";
945  if (!loadingNull) {
946  applet = Applet::load(pluginName, id, args);
947  containment = dynamic_cast<Containment*>(applet);
948  }
949 
950  if (!containment) {
951  if (!loadingNull) {
952  kDebug() << "loading of containment" << name << "failed.";
953  }
954 
955  // in case we got a non-Containment from Applet::loadApplet or
956  // a null containment was requested
957  if (applet) {
958  // the applet probably doesn't know what's hit it, so let's pretend it can be
959  // initialized to make assumptions in the applet's dtor safer
960  q->addItem(applet);
961  applet->init();
962  q->removeItem(applet);
963  delete applet;
964  }
965  applet = containment = new Containment(0, 0, id);
966 
967  if (loadingNull) {
968  containment->setDrawWallpaper(false);
969  } else {
970  containment->setFailedToLaunch(false);
971  }
972 
973  // we want to provide something and don't care about the failure to launch
974  containment->setFormFactor(Plasma::Planar);
975  }
976 
977  // if this is a new containment, we need to ensure that there are no stale
978  // configuration data around
979  if (id == 0) {
980  KConfigGroup conf(q->config(), "Containments");
981  conf = KConfigGroup(&conf, QString::number(containment->id()));
982  conf.deleteGroup();
983  }
984 
985  applet->d->isContainment = true;
986  containment->setPos(containment->d->preferredPos(q));
987  q->addItem(containment);
988  applet->d->setIsContainment(true, true);
989  containments.append(containment);
990 
991  if (!delayedInit) {
992  containment->init();
993  KConfigGroup cg = containment->config();
994  containment->restore(cg);
995  containment->updateConstraints(Plasma::StartupCompletedConstraint);
996  containment->save(cg);
997  q->requestConfigSync();
998  containment->flushPendingConstraintsEvents();
999  }
1000 
1001  QObject::connect(containment, SIGNAL(destroyed(QObject*)),
1002  q, SLOT(containmentDestroyed(QObject*)));
1003  QObject::connect(containment, SIGNAL(configNeedsSaving()),
1004  q, SLOT(requestConfigSync()));
1005  QObject::connect(containment, SIGNAL(releaseVisualFocus()),
1006  q, SIGNAL(releaseVisualFocus()));
1007  QObject::connect(containment, SIGNAL(screenChanged(int,int,Plasma::Containment*)),
1008  q, SIGNAL(screenOwnerChanged(int,int,Plasma::Containment*)));
1009 
1010  if (!delayedInit) {
1011  emit q->containmentAdded(containment);
1012  }
1013 
1014  return containment;
1015 }
1016 
1017 QList<Plasma::Containment *> CoronaPrivate::importLayout(const KConfigBase &conf, bool mergeConfig)
1018 {
1019  if (const KConfigGroup *group = dynamic_cast<const KConfigGroup *>(&conf)) {
1020  if (!group->isValid()) {
1021  return QList<Containment *>();
1022  }
1023  }
1024 
1025  QList<Plasma::Containment *> newContainments;
1026  QSet<uint> containmentsIds;
1027 
1028  foreach (Containment *containment, containments) {
1029  containmentsIds.insert(containment->id());
1030  }
1031 
1032  KConfigGroup containmentsGroup(&conf, "Containments");
1033 
1034  foreach (const QString &group, containmentsGroup.groupList()) {
1035  KConfigGroup containmentConfig(&containmentsGroup, group);
1036 
1037  if (containmentConfig.entryMap().isEmpty()) {
1038  continue;
1039  }
1040 
1041  uint cid = group.toUInt();
1042  if (containmentsIds.contains(cid)) {
1043  cid = ++AppletPrivate::s_maxAppletId;
1044  } else if (cid > AppletPrivate::s_maxAppletId) {
1045  AppletPrivate::s_maxAppletId = cid;
1046  }
1047 
1048  if (mergeConfig) {
1049  KConfigGroup realConf(q->config(), "Containments");
1050  realConf = KConfigGroup(&realConf, QString::number(cid));
1051  // in case something was there before us
1052  realConf.deleteGroup();
1053  containmentConfig.copyTo(&realConf);
1054  }
1055 
1056  //kDebug() << "got a containment in the config, trying to make a" << containmentConfig.readEntry("plugin", QString()) << "from" << group;
1057  kDebug() << "!!{} STARTUP TIME" << QTime().msecsTo(QTime::currentTime()) << "Adding Containment" << containmentConfig.readEntry("plugin", QString());
1058  Containment *c = addContainment(containmentConfig.readEntry("plugin", QString()), QVariantList(), cid, true);
1059  if (!c) {
1060  continue;
1061  }
1062 
1063  newContainments.append(c);
1064  containmentsIds.insert(c->id());
1065 
1066  c->init();
1067  kDebug() << "!!{} STARTUP TIME" << QTime().msecsTo(QTime::currentTime()) << "Init Containment" << c->pluginName();
1068  c->restore(containmentConfig);
1069  kDebug() << "!!{} STARTUP TIME" << QTime().msecsTo(QTime::currentTime()) << "Restored Containment" << c->pluginName();
1070  }
1071 
1072  foreach (Containment *containment, newContainments) {
1073  containment->updateConstraints(Plasma::StartupCompletedConstraint);
1074  containment->d->initApplets();
1075  emit q->containmentAdded(containment);
1076  kDebug() << "!!{} STARTUP TIME" << QTime().msecsTo(QTime::currentTime()) << "Containment" << containment->name();
1077  }
1078 
1079  return newContainments;
1080 }
1081 
1082 } // namespace Plasma
1083 
1084 #include "corona.moc"
1085 
Plasma::Applet::immutability
ImmutabilityType immutability
Definition: applet.h:84
QGraphicsScene
Plasma::Corona::immutabilityChanged
void immutabilityChanged(Plasma::ImmutabilityType immutability)
emitted when immutability changes.
Plasma::StartupCompletedConstraint
application startup has completed
Definition: plasma.h:51
Plasma::Corona::loadLayout
void loadLayout(const QString &config=QString())
Load applet layout from a config file.
Definition: corona.cpp:272
Plasma::Applet::flushPendingConstraintsEvents
void flushPendingConstraintsEvents()
Sends all pending contraints updates to the applet.
Definition: applet.cpp:1204
Plasma::ImmutabilityType
ImmutabilityType
Defines the immutability of items like applets, corona and containments they can be free to modify...
Definition: plasma.h:197
Plasma::AbstractToolBox::ConfigureTool
Definition: abstracttoolbox.h:49
Plasma::Containment::destroy
void destroy()
Destroys this containment and all its applets (after a confirmation dialog); it will be removed nicel...
Definition: containment.cpp:2053
Plasma::Animator::Animation
Animation
Definition: animator.h:55
Plasma::Corona::addAction
void addAction(QString name, QAction *action)
Adds the action to our collection under the given name.
Definition: corona.cpp:725
abstracttoolbox.h
Plasma::Containment::setDrawWallpaper
void setDrawWallpaper(bool drawWallpaper)
Sets whether wallpaper is painted or not.
Definition: containment.cpp:1796
Plasma::Containment::containmentType
Type containmentType() const
Returns the type of containment.
Definition: containment.cpp:501
Plasma::Containment::setFormFactor
void setFormFactor(Plasma::FormFactor formFactor)
Sets the form factor for this Containment.
Definition: containment.cpp:776
Plasma::SystemImmutable
the item is locked down by the system, the user can&#39;t unlock it
Definition: plasma.h:201
Plasma::Corona::importLayout
QList< Plasma::Containment * > importLayout(const KConfigBase &config)
Imports an applet layout from a config file.
Definition: corona.cpp:290
Plasma::Corona::setContainmentActionsDefaults
void setContainmentActionsDefaults(Containment::Type containmentType, const ContainmentActionsPluginsConfig &config)
Definition: corona.cpp:776
Plasma::Corona::setImmutability
void setImmutability(const ImmutabilityType immutable)
Sets the immutability type for this Corona (not immutable, user immutable or system immutable) ...
Definition: corona.cpp:667
Plasma::View::containment
Containment * containment() const
Definition: view.cpp:303
Plasma::Corona::requireConfigSync
void requireConfigSync()
Schedules a time sensitive flush-to-disk synchronization of the configuration state.
Definition: corona.cpp:174
Plasma::Corona::defaultContainmentPlugin
QString defaultContainmentPlugin() const
Definition: corona.cpp:105
Plasma::View::screen
int screen() const
Returns the screen this view is associated with.
Definition: view.cpp:207
Plasma::Corona::enableAction
void enableAction(const QString &name, bool enable)
convenience function - enables or disables an action by name
Definition: corona.cpp:740
Plasma::Containment::PanelContainment
A desktop panel.
Definition: containment.h:102
Plasma::Corona::containmentActionsDefaults
ContainmentActionsPluginsConfig containmentActionsDefaults(Containment::Type containmentType)
Definition: corona.cpp:781
Plasma::ToolTipManager::self
static ToolTipManager * self()
Definition: tooltipmanager.cpp:119
Plasma::Corona::freeEdges
QList< Plasma::Location > freeEdges(int screen) const
This method is useful in order to retrieve the list of available screen edges for panel type containm...
Definition: corona.cpp:704
Plasma::ImmutableConstraint
the immutability (locked) nature of the applet changed
Definition: plasma.h:50
Plasma::Corona::addShortcuts
void addShortcuts(KActionCollection *newShortcuts)
Definition: corona.cpp:768
Plasma::Corona::setPreferredToolBoxPlugin
void setPreferredToolBoxPlugin(const Containment::Type type, const QString &plugin)
Definition: corona.cpp:636
containment.h
QObject
Plasma::Containment::screen
int screen() const
Definition: containment.cpp:1062
Plasma::Corona::updateShortcuts
void updateShortcuts()
Definition: corona.cpp:749
Plasma
Namespace for everything in libplasma.
Definition: abstractdialogmanager.cpp:24
tooltipmanager.h
Plasma::Mutable
The item can be modified in any way.
Definition: plasma.h:198
Plasma::Containment::CustomContainment
A containment that is neither a desktop nor a panel but something application specific.
Definition: containment.h:103
Plasma::Corona::loadDefaultLayout
virtual void loadDefaultLayout()
Loads the default (system wide) layout for this user.
Definition: corona.cpp:632
Plasma::Corona::releaseVisualFocus
void releaseVisualFocus()
This signal indicates that an application launch, window creation or window focus event was triggered...
Plasma::Applet
The base Applet class.
Definition: applet.h:77
Plasma::Corona::initializeLayout
void initializeLayout(const QString &config=QString())
Initializes the layout from a config file.
Definition: corona.cpp:179
Plasma::Corona::popupPosition
QPoint popupPosition(const QGraphicsItem *item, const QSize &size)
Recommended position for a popup window like a menu or a tooltip given its size.
Definition: corona.cpp:463
Plasma::Containment::setScreen
void setScreen(int screen, int desktop=-1)
Sets the physical screen this Containment is associated with.
Definition: containment.cpp:955
Plasma::View
A QGraphicsView for a single Containment.
Definition: view.h:47
Plasma::Applet::id
uint id
Definition: applet.h:91
Plasma::Location
Location
The Location enumeration describes where on screen an element, such as an Applet or its managing cont...
Definition: plasma.h:108
view.h
Plasma::Corona::requestConfigSync
void requestConfigSync()
Schedules a flush-to-disk synchronization of the configuration state at the next convenient moment...
Definition: corona.cpp:156
Plasma::Corona::Corona
Corona(QObject *parent=0)
Definition: corona.cpp:64
Plasma::Corona::setDialogManager
void setDialogManager(AbstractDialogManager *manager)
Definition: corona.cpp:786
Plasma::Corona::clearContainments
void clearContainments()
Clear the Corona from all applets.
Definition: corona.cpp:333
Plasma::Corona::mapAnimation
void mapAnimation(Animator::Animation from, Animator::Animation to)
Maps a stock animation to one of the semantic animations.
Definition: corona.cpp:367
Plasma::Containment::applets
Applet::List applets() const
Definition: containment.cpp:950
Plasma::UserImmutable
The user has requested a lock down, and can undo the lock down at any time.
Definition: plasma.h:199
Plasma::Applet::pluginName
QString pluginName
Definition: applet.h:82
Plasma::Corona::action
QAction * action(QString name) const
Returns the QAction with the given name from our collection.
Definition: corona.cpp:720
Plasma::Corona::dialogManager
AbstractDialogManager * dialogManager()
Definition: corona.cpp:791
Plasma::Corona::preferredToolBoxPlugin
QString preferredToolBoxPlugin(const Containment::Type type) const
Returns the name of the preferred plugin to be used as containment toolboxes.
Definition: corona.cpp:642
Plasma::Corona::config
KSharedConfig::Ptr config() const
Returns the config file used to store the configuration for this Corona.
Definition: corona.cpp:340
Plasma::Containment::restore
void restore(KConfigGroup &group)
Definition: containment.cpp:293
Plasma::Corona::screenOwnerChanged
void screenOwnerChanged(int wasScreen, int isScreen, Plasma::Containment *containment)
This signal indicates that a containment has been newly associated (or dissociated) with a physical s...
Plasma::Corona::dragLeaveEvent
void dragLeaveEvent(QGraphicsSceneDragDropEvent *event)
Definition: corona.cpp:652
abstractdialogmanager.h
Plasma::Containment::init
void init()
Reimplemented from Applet.
Definition: containment.cpp:151
Plasma::TopEdge
Along the top of the screen.
Definition: plasma.h:114
Plasma::Corona::layoutContainments
void layoutContainments()
Definition: corona.cpp:206
Plasma::containmentSortByPosition
bool containmentSortByPosition(const Containment *c1, const Containment *c2)
Definition: corona.cpp:201
Plasma::Corona::containmentForScreen
Containment * containmentForScreen(int screen, int desktop=-1) const
Returns the Containment, if any, for a given physical screen and desktop.
Definition: corona.cpp:296
Plasma::Corona::containments
QList< Containment * > containments() const
Definition: corona.cpp:328
Plasma::Applet::location
virtual Location location() const
Returns the location of the scene which is displaying applet.
Definition: applet.cpp:1618
Plasma::Corona::saveLayout
void saveLayout(const QString &config=QString()) const
Save applets layout to file.
Definition: corona.cpp:110
Plasma::Corona::offscreenWidgets
QList< QGraphicsWidget * > offscreenWidgets() const
Definition: corona.cpp:426
Plasma::Containment::clearApplets
void clearApplets()
Removes all applets from this Containment.
Definition: containment.cpp:842
Plasma::Floating
Free floating.
Definition: plasma.h:109
Plasma::Applet::setFailedToLaunch
void setFailedToLaunch(bool failed, const QString &reason=QString())
Call this method when the applet fails to launch properly.
Definition: applet.cpp:366
Plasma::Containment::CustomPanelContainment
A customized desktop panel.
Definition: containment.h:105
Plasma::BottomEdge
Along the bottom of the screen.
Definition: plasma.h:115
Plasma::Applet::config
KConfigGroup config() const
Returns the KConfigGroup to access the applets configuration.
Definition: applet.cpp:450
Plasma::Corona::exportLayout
void exportLayout(KConfigGroup &config, QList< Containment *> containments)
Exports a set of containments to a config file.
Definition: corona.cpp:123
Plasma::Planar
The applet lives in a plane and has two degrees of freedom to grow.
Definition: plasma.h:65
Plasma::Corona::immutability
ImmutabilityType immutability() const
Definition: corona.cpp:662
Plasma::Applet::name
QString name
Definition: applet.h:81
Plasma::Corona::shortcutsChanged
void shortcutsChanged()
Plasma::Containment::save
void save(KConfigGroup &group) const
Definition: containment.cpp:402
Plasma::Corona::setDefaultContainmentPlugin
void setDefaultContainmentPlugin(const QString &name)
Sets the default containment plugin to try and load.
Definition: corona.cpp:96
Plasma::Corona::addContainmentDelayed
Containment * addContainmentDelayed(const QString &name, const QVariantList &args=QVariantList())
Loads a containment with delayed initialization, primarily useful for implementations of loadDefaultL...
Definition: corona.cpp:358
Plasma::type
static QScriptValue type(QScriptContext *ctx, QScriptEngine *eng)
Definition: easingcurve.cpp:63
Plasma::Corona::actions
QList< QAction * > actions() const
Returns all the actions in our collection.
Definition: corona.cpp:735
Plasma::Applet::updateConstraints
void updateConstraints(Plasma::Constraints constraints=Plasma::AllConstraints)
Called when any of the geometry constraints have been updated.
Definition: applet.cpp:750
corona.h
Plasma::AbstractDialogManager
The AbstractDialogManager class shows the dialogs shown by applets and the rest of the shell...
Definition: abstractdialogmanager.h:43
Plasma::AbstractToolBox::ControlTool
Definition: abstracttoolbox.h:50
QGraphicsView
Plasma::Containment::desktop
int desktop() const
Definition: containment.cpp:1072
Plasma::Corona::addContainment
Containment * addContainment(const QString &name, const QVariantList &args=QVariantList())
Adds a Containment to the Corona.
Definition: corona.cpp:349
containmentactionspluginsconfig.h
Plasma::Corona::screenGeometry
virtual QRect screenGeometry(int id) const
Returns the geometry of a given screen.
Definition: corona.cpp:445
Plasma::Containment::DesktopContainment
A desktop containment.
Definition: containment.h:101
Plasma::Containment
The base class for plugins that provide backgrounds and applet grouping containers.
Definition: containment.h:72
Plasma::RightEdge
Along the right side of the screen.
Definition: plasma.h:117
Plasma::Corona::setAppletMimeType
void setAppletMimeType(const QString &mimetype)
Sets the mimetype of Drag/Drop items.
Definition: corona.cpp:86
Plasma::Corona::~Corona
~Corona()
Definition: corona.cpp:74
Plasma::Corona::numScreens
virtual int numScreens() const
Returns the number of screens available to plasma.
Definition: corona.cpp:440
animator.h
Plasma::Corona::addOffscreenWidget
void addOffscreenWidget(QGraphicsWidget *widget)
Adds a widget in the topleft quadrant in the scene.
Definition: corona.cpp:377
Plasma::Containment::Type
Type
Definition: containment.h:99
Plasma::Applet::init
virtual void init()
This method is called once the applet is loaded and added to a Corona.
Definition: applet.cpp:243
Plasma::Corona::dragMoveEvent
void dragMoveEvent(QGraphicsSceneDragDropEvent *event)
Definition: corona.cpp:657
Plasma::Corona::appletMimeType
QString appletMimeType()
The current mime type of Drag/Drop items.
Definition: corona.cpp:91
Plasma::Corona::dragEnterEvent
void dragEnterEvent(QGraphicsSceneDragDropEvent *event)
Definition: corona.cpp:647
Plasma::Corona::removeOffscreenWidget
void removeOffscreenWidget(QGraphicsWidget *widget)
Removes a widget from the topleft quadrant in the scene.
Definition: corona.cpp:414
Plasma::LeftEdge
Along the left side of the screen.
Definition: plasma.h:116
Plasma::ContainmentActionsPluginsConfig
A class that holds a map of triggers to plugin names.
Definition: containmentactionspluginsconfig.h:41
Plasma::Corona::availableScreenRegion
virtual QRegion availableScreenRegion(int id) const
Returns the available region for a given screen.
Definition: corona.cpp:458
Plasma::viewFor
QGraphicsView * viewFor(const QGraphicsItem *item)
Returns the most appropriate QGraphicsView for the item.
Definition: plasma.cpp:93
Plasma::Corona
A QGraphicsScene for Plasma::Applets.
Definition: corona.h:48
QGraphicsWidget
Plasma::Applet::load
static Applet * load(const QString &name, uint appletId=0, const QVariantList &args=QVariantList())
Attempts to load an applet.
Definition: applet.cpp:2422
This file is part of the KDE documentation.
Documentation copyright © 1996-2017 The KDE developers.
Generated on Wed May 24 2017 08:03:24 by doxygen 1.8.13 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Plasma

Skip menu "Plasma"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs-4.14.32 API Reference

Skip menu "kdelibs-4.14.32 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal