diff --git a/applet.cpp b/applet.cpp index 43cf714e7..bced0e5ca 100644 --- a/applet.cpp +++ b/applet.cpp @@ -222,25 +222,10 @@ void Applet::save(KConfigGroup &g) const group.writeEntry("immutability", (int)d->immutability); group.writeEntry("plugin", pluginName()); - group.writeEntry("geometry", geometry()); - group.writeEntry("zvalue", zValue()); - if (!d->started) { return; } - //kDebug() << pluginName() << "geometry is" << geometry() - // << "pos is" << pos() << "bounding rect is" << boundingRect(); - if (transform() == QTransform()) { - group.deleteEntry("transform"); - } else { - QList m; - QTransform t = transform(); - m << t.m11() << t.m12() << t.m13() << t.m21() << t.m22() << t.m23() << t.m31() << t.m32() << t.m33(); - group.writeEntry("transform", m); - //group.writeEntry("transform", transformToString(transform())); - } - KConfigGroup appletConfigGroup(&group, "Configuration"); saveState(appletConfigGroup); @@ -255,29 +240,9 @@ void Applet::save(KConfigGroup &g) const void Applet::restore(KConfigGroup &group) { - QList m = group.readEntry("transform", QList()); - if (m.count() == 9) { - QTransform t(m[0], m[1], m[2], m[3], m[4], m[5], m[6], m[7], m[8]); - setTransform(t); - } - - qreal z = group.readEntry("zvalue", 0); - - if (z >= AppletPrivate::s_maxZValue) { - AppletPrivate::s_maxZValue = z; - } - - if (z > 0) { - setZValue(z); - } setImmutability((ImmutabilityType)group.readEntry("immutability", (int)Mutable)); - QRectF geom = group.readEntry("geometry", QRectF()); - if (geom.isValid()) { - setGeometry(geom); - } - KConfigGroup shortcutConfig(&group, "Shortcuts"); QString shortcutText = shortcutConfig.readEntryUntranslated("global", QString()); if (!shortcutText.isEmpty()) { @@ -360,66 +325,6 @@ KConfigGroup Applet::globalConfig() const return KConfigGroup(&globalAppletConfig, d->globalName()); } -QSizeF Applet::size() const -{ - return QSizeF(); -} - -QRectF Applet::geometry() const -{ - return QRectF(); -} - -void Applet::setGeometry(const QRectF &rect) -{ - -} - -QRectF Applet::boundingRect() const -{ - return QRectF(); -} - -void Applet::resize(const QSizeF &size) -{ - -} - -int Applet::zValue() const -{ - return 0; -} - -void Applet::setZValue(int val) -{ - -} - -QTransform Applet::transform() const -{ - return QTransform(); -} - -void Applet::setTransform(const QTransform &transform) -{ - -} - -QPointF Applet::pos() const -{ - return QPointF(); -} - -void Applet::setPos(const QPointF &pos) -{ - -} - -void Applet::setPos(int x, int y) -{ - -} - bool Applet::hasFocus() const { return false; @@ -430,17 +335,6 @@ void Applet::setFocus(Qt::FocusReason) } -void Applet::setSizePolicy(const QSizePolicy& policy) -{ - -} - -QSizePolicy Applet::sizePolicy() const -{ - return QSizePolicy(); -} - - void Applet::destroy() { if (immutability() != Mutable || d->transient || !d->started) { @@ -783,40 +677,6 @@ void Applet::flushPendingConstraintsEvents() if (c & Plasma::FormFactorConstraint) { FormFactor f = formFactor(); - - // avoid putting rotated applets in panels - if (f == Vertical || f == Horizontal) { - QTransform at; - at.rotateRadians(0); - setTransform(at); - } - - //was a size saved for a particular form factor? - if (d->sizeForFormFactor.contains(f)) { - resize(d->sizeForFormFactor.value(f)); - } - } - - if (!size().isEmpty() && - ((c & Plasma::StartupCompletedConstraint) || (c & Plasma::SizeConstraint && !(c & Plasma::FormFactorConstraint)))) { - d->sizeForFormFactor[formFactor()] = size(); - } - - if (c & Plasma::SizeConstraint || c & Plasma::FormFactorConstraint) { - if (aspectRatioMode() == Plasma::Square || aspectRatioMode() == Plasma::ConstrainedSquare) { - // enforce square size in panels - //save the old size policy. since ignored doesn't (yet) have a valid use case in containments, use it as special unset value - if (d->preferredSizePolicy == QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored)) { - d->preferredSizePolicy = sizePolicy(); - } - if (formFactor() == Horizontal) { - setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding)); - } else if (formFactor() == Vertical) { - setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); - } else if (d->preferredSizePolicy != QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored)) { - setSizePolicy(d->preferredSizePolicy); - } - } } // now take care of constraints in special subclasses: Contaiment and PopupApplet @@ -874,25 +734,6 @@ FormFactor Applet::formFactor() const parentApplet = qobject_cast(pw); } - - //FIXME: port away popupapplet - //const PopupApplet *pa = dynamic_cast(this); - - //if the applet is in a widget that isn't a containment - //try to retrieve the formFactor from the parent size - //we can't use our own sizeHint here because it needs formFactor, so endless recursion. - // a popupapplet can always be constrained. - // a normal applet should to but - //FIXME: not always constrained to not break systemmonitor - if (parentApplet && parentApplet != c && c != this) { - if (parentApplet->size().height() < sizeHint(Qt::MinimumSize).height()) { - return Plasma::Horizontal; - } else if (parentApplet->size().width() < sizeHint(Qt::MinimumSize).width()) { - return Plasma::Vertical; - } - return parentApplet->formFactor(); - } - return c ? c->d->formFactor : Plasma::Planar; } @@ -1381,40 +1222,6 @@ Applet *Applet::loadPlasmoid(const QString &path, uint appletId, const QVariantL return 0; } -QSizeF Applet::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const -{ - QSizeF hint(-1, -1); - const FormFactor ff = formFactor(); - - // in panels make sure that the contents won't exit from the panel - if (which == Qt::MinimumSize) { - if (ff == Horizontal) { - hint.setHeight(0); - } else if (ff == Vertical) { - hint.setWidth(0); - } - } - - // enforce a square size in panels - if (d->aspectRatioMode == Plasma::Square) { - if (ff == Horizontal) { - hint.setWidth(size().height()); - } else if (ff == Vertical) { - hint.setHeight(size().width()); - } - } else if (d->aspectRatioMode == Plasma::ConstrainedSquare) { - //enforce a size not wider than tall - if (ff == Horizontal) { - hint.setWidth(size().height()); - //enforce a size not taller than wide - } else if (ff == Vertical && (which == Qt::MaximumSize || size().width() <= KIconLoader::SizeLarge)) { - hint.setHeight(size().width()); - } - } - - return hint; -} - void Applet::timerEvent(QTimerEvent *event) { if (d->transient) { @@ -1443,16 +1250,6 @@ void Applet::timerEvent(QTimerEvent *event) } } -void Applet::raise() -{ - setZValue(++AppletPrivate::s_maxZValue); -} - -void Applet::lower() -{ - setZValue(--AppletPrivate::s_minZValue); -} - bool Applet::isContainment() const { return d->isContainment; diff --git a/applet.h b/applet.h index 09b1a03a3..aa1e85be5 100644 --- a/applet.h +++ b/applet.h @@ -78,7 +78,6 @@ class PLASMA_EXPORT Applet : public QObject Q_PROPERTY(bool hasFailedToLaunch READ hasFailedToLaunch WRITE setFailedToLaunch) Q_PROPERTY(bool busy READ isBusy WRITE setBusy) Q_PROPERTY(bool configurationRequired READ configurationRequired WRITE setConfigurationRequired) - Q_PROPERTY(QRectF geometry READ geometry WRITE setGeometry) Q_PROPERTY(bool shouldConserveResources READ shouldConserveResources) Q_PROPERTY(uint id READ id) Q_PROPERTY(BackgroundHints backgroundHints READ backgroundHints WRITE setBackgroundHints) @@ -635,8 +634,6 @@ class PLASMA_EXPORT Applet : public QObject */ void immutabilityChanged(Plasma::ImmutabilityType immutable); - void geometryChanged(); - public Q_SLOTS: /** * Sets the immutability type for this applet (not immutable, @@ -682,16 +679,6 @@ class PLASMA_EXPORT Applet : public QObject */ bool isUserConfiguring() const; - /** - * Causes this applet to raise above all other applets. - */ - void raise(); - - /** - * Causes this applet to lower below all the other applets. - */ - void lower(); - /** * Sends all pending contraints updates to the applet. Will usually * be called automatically, but can also be called manually if needed. @@ -764,22 +751,6 @@ class PLASMA_EXPORT Applet : public QObject bool hasFocus() const; void setFocus(Qt::FocusReason); - //Geometry functions: FIXME: to remove? - QSizeF size() const; - QRectF geometry() const; - void setGeometry(const QRectF &rect); - QRectF boundingRect() const; - void resize(const QSizeF &size); - int zValue() const; - void setZValue(int val); - QTransform transform() const; - void setTransform(const QTransform &transform); - QPointF pos() const; - void setPos(const QPointF &pos); - void setPos(int x, int y); - QSizePolicy sizePolicy() const; - void setSizePolicy(const QSizePolicy &policy); - protected: /** * This constructor is to be used with the plugin loading systems @@ -879,8 +850,6 @@ class PLASMA_EXPORT Applet : public QObject virtual void constraintsEvent(Plasma::Constraints constraints); - QSizeF sizeHint(Qt::SizeHint which, const QSizeF & constraint = QSizeF()) const; - /** * Reimplemented from QObject */ diff --git a/containment.cpp b/containment.cpp index 13626a340..22331b07f 100644 --- a/containment.cpp +++ b/containment.cpp @@ -76,7 +76,6 @@ Containment::Containment(QObject *parent, { // WARNING: do not access config() OR globalConfig() in this method! // that requires a scene, which is not available at this point - setPos(0, 0); setBackgroundHints(NoBackground); setContainmentType(CustomContainment); setHasConfigurationInterface(false); @@ -88,7 +87,6 @@ Containment::Containment(QObject *parent, const QVariantList &args) { // WARNING: do not access config() OR globalConfig() in this method! // that requires a scene, which is not available at this point - setPos(0, 0); setBackgroundHints(NoBackground); setHasConfigurationInterface(false); } @@ -99,7 +97,6 @@ Containment::Containment(const QString &packagePath, uint appletId, const QVaria { // WARNING: do not access config() OR globalConfig() in this method! // that requires a scene, which is not available at this point - setPos(0, 0); setBackgroundHints(NoBackground); setHasConfigurationInterface(false); } @@ -503,12 +500,6 @@ void Containment::setLocation(Location location) applet->updateConstraints(Plasma::LocationConstraint); } - if (emitGeomChange) { - // our geometry on the scene will not actually change, - // but for the purposes of views it has - emit geometryChanged(); - } - updateConstraints(Plasma::LocationConstraint); KConfigGroup c = config(); @@ -592,10 +583,6 @@ void Containment::addApplet(Applet *applet, const QPointF &pos, bool delayInit) connect(applet, SIGNAL(newStatus(Plasma::ItemStatus)), this, SLOT(checkStatus(Plasma::ItemStatus))); connect(applet, SIGNAL(activate()), this, SIGNAL(activate())); - if (pos != QPointF(-1, -1)) { - applet->setPos(pos); - } - if (!delayInit && !currentContainment) { applet->restore(*applet->d->mainConfigGroup()); applet->init(); @@ -724,11 +711,12 @@ void Containment::dropEvent(QDropEvent *event) } } +//TODO: remove and make it GSS void Containment::resizeEvent(QResizeEvent *event) { if (isContainment()) { if (d->wallpaper) { - d->wallpaper->setBoundingRect(QRectF(QPointF(0, 0), size())); + d->wallpaper->setBoundingRect(QRectF(QPointF(0, 0), event->size())); } } } @@ -860,7 +848,6 @@ void Containment::setWallpaper(const QString &pluginName, const QString &mode) if (d->wallpaper) { d->wallpaper->setParent(this); - d->wallpaper->setBoundingRect(QRectF(QPointF(0, 0), size())); d->wallpaper->setRenderingMode(mode); if (newPlugin) { diff --git a/private/applet_p.cpp b/private/applet_p.cpp index 45f7e1896..de9f2748f 100644 --- a/private/applet_p.cpp +++ b/private/applet_p.cpp @@ -712,8 +712,6 @@ void AppletPrivate::resetConfigurationObject() } uint AppletPrivate::s_maxAppletId = 0; -int AppletPrivate::s_maxZValue = 0; -int AppletPrivate::s_minZValue = 0; QSet AppletPrivate::s_customCategories; } //namespace Plasma diff --git a/private/applet_p.h b/private/applet_p.h index 3f7dc90d8..33246096a 100644 --- a/private/applet_p.h +++ b/private/applet_p.h @@ -126,8 +126,6 @@ public: static QString parentAppConstraint(const QString &parentApp = QString()); static uint s_maxAppletId; - static int s_maxZValue; - static int s_minZValue; static QSet s_customCategories; // number of members at this point. diff --git a/private/containment_p.cpp b/private/containment_p.cpp index f6bd21228..0df7fb242 100644 --- a/private/containment_p.cpp +++ b/private/containment_p.cpp @@ -262,10 +262,6 @@ void ContainmentPrivate::setScreen(int newScreen, int newDesktop, bool preventIn } } - if (newScreen < numScreens && newScreen > -1 && isDesktopContainment) { - q->resize(corona->screenGeometry(newScreen).size()); - } - int oldDesktop = desktop; desktop = newDesktop; @@ -833,16 +829,6 @@ Applet *ContainmentPrivate::addApplet(const QString &name, const QVariantList &a return applet; } -bool ContainmentPrivate::regionIsEmpty(const QRectF ®ion, Applet *ignoredApplet) const -{ - foreach (Applet *applet, applets) { - if (applet != ignoredApplet && applet->geometry().intersects(region)) { - return false; - } - } - return true; -} - void ContainmentPrivate::appletDeleted(Plasma::Applet *applet) { applets.removeAll(applet); diff --git a/private/containment_p.h b/private/containment_p.h index b026c4390..fb5b4c394 100644 --- a/private/containment_p.h +++ b/private/containment_p.h @@ -92,7 +92,6 @@ public: void initApplets(); void checkContainmentFurniture(); - bool regionIsEmpty(const QRectF ®ion, Applet *ignoredApplet=0) const; bool isPanelContainment() const; void setLockToolText(); void appletDeleted(Applet*); diff --git a/scripting/appletscript.cpp b/scripting/appletscript.cpp index 8fe50c5ec..2a859c570 100644 --- a/scripting/appletscript.cpp +++ b/scripting/appletscript.cpp @@ -67,15 +67,6 @@ void AppletScript::paintInterface(QPainter *painter, Q_UNUSED(contentsRect); } -QSizeF AppletScript::size() const -{ - if (applet()) { - return applet()->size(); - } - - return QSizeF(); -} - void AppletScript::constraintsEvent(Plasma::Constraints constraints) { Q_UNUSED(constraints); diff --git a/scripting/appletscript.h b/scripting/appletscript.h index cb94d279e..764bd1bd8 100644 --- a/scripting/appletscript.h +++ b/scripting/appletscript.h @@ -84,11 +84,6 @@ public: const QStyleOptionGraphicsItem *option, const QRect &contentsRect); - /** - * Returns the area within which contents can be painted. - **/ - Q_INVOKABLE QSizeF size() const; - /** * Called when any of the geometry constraints have been updated. *