diff --git a/containment.cpp b/containment.cpp index 5f13c2b50..a454d040f 100644 --- a/containment.cpp +++ b/containment.cpp @@ -145,10 +145,10 @@ Containment::Containment(const QString &packagePath, uint appletId, const QVaria Containment::~Containment() { - delete d; // Applet touches our dptr if we are a containment and is the superclass (think of dtors) // so we reset this as we exit the building Applet::d->isContainment = false; + delete d; } void Containment::init() diff --git a/datacontainer.cpp b/datacontainer.cpp index fd1ad8991..d19b1a52c 100644 --- a/datacontainer.cpp +++ b/datacontainer.cpp @@ -171,9 +171,8 @@ void DataContainer::setNeedsToBeStored(bool store) DataEngine* DataContainer::getDataEngine() { - QObject *o = NULL; + QObject *o = this; DataEngine *de = NULL; - o = this; while (de == NULL) { o = dynamic_cast (o->parent()); diff --git a/pluginloader.h b/pluginloader.h index 3a648e50e..d20bdcae1 100644 --- a/pluginloader.h +++ b/pluginloader.h @@ -43,7 +43,7 @@ class PluginLoaderPrivate; * default PluginLoader implementation will be used. The reimplemented version should * not do more than simply returning a loaded plugin. It should not init() it, and it should not * hang on to it. The associated methods will be called only when a component of Plasma - * needs to load a _new_ plugin. (e.g. DataEngine does it's own caching). + * needs to load a _new_ plugin. (e.g. DataEngine does its own caching). * * @author Ryan Rix * @since 4.6 diff --git a/private/applethandle.cpp b/private/applethandle.cpp index f6d51a26f..b26b6fe94 100644 --- a/private/applethandle.cpp +++ b/private/applethandle.cpp @@ -237,21 +237,22 @@ void AppletHandle::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti QLinearGradient g(QPoint(0, 0), QPoint(m_decorationRect.width(), 0)); //fading out panel - if (m_rect.height() > qreal(minimumHeight()) * 1.25) { + if (m_applet->backgroundHints() != Plasma::Applet::NoBackground && + m_rect.height() > qreal(minimumHeight()) * 1.25) { if (m_buttonsOnRight) { qreal opaquePoint = (m_background->marginSize(LeftMargin) - translation) / m_decorationRect.width(); //kDebug() << "opaquePoint" << opaquePoint // << m_background->marginSize(LeftMargin) << m_decorationRect.width(); g.setColorAt(0.0, Qt::transparent); - g.setColorAt(qMax(0.0, opaquePoint - 0.05), Qt::transparent); //krazy:exclude=qminmax + g.setColorAt(qMax(0.0, opaquePoint - 0.01), Qt::transparent); //krazy:exclude=qminmax g.setColorAt(opaquePoint, transparencyColor); g.setColorAt(1.0, transparencyColor); } else { qreal opaquePoint = 1 - ((m_background->marginSize(RightMargin) + translation) / m_decorationRect.width()); g.setColorAt(1.0, Qt::transparent); - g.setColorAt(opaquePoint + 0.05, Qt::transparent); + g.setColorAt(opaquePoint + 0.01, Qt::transparent); g.setColorAt(qMax(qreal(0), opaquePoint), transparencyColor); g.setColorAt(0.0, transparencyColor); } @@ -864,6 +865,41 @@ bool AppletHandle::sceneEventFilter(QGraphicsItem *watched, QEvent *event) { if (watched == m_applet && event->type() == QEvent::GraphicsSceneHoverLeave) { hoverLeaveEvent(static_cast(event)); + } else if (watched == m_applet && event->type() == QEvent::GraphicsSceneMousePress) { + QGraphicsSceneMouseEvent *me = static_cast(event); + + QPointF pos = mapFromScene(me->scenePos()); + if (m_applet->contentsRect().contains(pos)) { + return false; + } + + me->setPos(pos); + mousePressEvent(me); + return true; + } else if (watched == m_applet && event->type() == QEvent::GraphicsSceneMouseRelease) { + if (m_pressedButton == NoButton) { + return false; + } + + QGraphicsSceneMouseEvent *me = static_cast(event); + + QPointF pos = mapFromScene(me->scenePos()); + me->setPos(pos); + mouseReleaseEvent(me); + return true; + } else if (watched == m_applet && event->type() == QEvent::GraphicsSceneMouseMove) { + if (m_pressedButton == NoButton) { + return false; + } + + QGraphicsSceneMouseEvent *me = static_cast(event); + + QPointF pos = mapFromScene(me->scenePos()); + + + me->setPos(pos); + mouseMoveEvent(me); + return true; } return false; @@ -987,7 +1023,7 @@ void AppletHandle::startFading(FadeType anim, const QPointF &hoverPos, bool pres m_animType = anim; //kDebug() << "animating for " << time << "ms"; - if (m_animType == FadeIn) { + if (m_animType == FadeIn && propAnim) { propAnim->setDirection(QAbstractAnimation::Forward); propAnim->start(); } else if (propAnim) { @@ -1030,29 +1066,32 @@ void AppletHandle::calculateSize() qreal marginLeft, marginTop, marginRight, marginBottom; m_background->getMargins(marginLeft, marginTop, marginRight, marginBottom); - if (m_buttonsOnRight) { - //put the rect on the right of the applet - m_rect = QRectF(m_applet->size().width(), top, handleWidth, handleHeight); - } else { - //put the rect on the left of the applet - m_rect = QRectF(-handleWidth, top, handleWidth, handleHeight); + int leftShadowWidth = m_background->elementSize("hint-left-shadow").width(); + int rightShadowWidth = m_background->elementSize("hint-right-shadow").width(); + + //no precise hint? let's go for heuristics + if (leftShadowWidth <= 0) { + leftShadowWidth = marginLeft/1.6; + } + if (rightShadowWidth <= 0) { + rightShadowWidth = marginRight/1.6; } - if (m_applet->contentsRect().height() > qreal(minimumHeight()) * 1.25) { - int addedMargin = marginLeft / 2; + if (m_applet->backgroundHints() == Plasma::Applet::NoBackground) { + leftShadowWidth = 0; + rightShadowWidth = 0; + } + if (m_buttonsOnRight) { + //put the rect on the right of the applet + m_rect = QRectF(m_applet->size().width() - rightShadowWidth + HANDLE_MARGIN, top, handleWidth, handleHeight); + } else { + //put the rect on the left of the applet + m_rect = QRectF(-handleWidth + leftShadowWidth - HANDLE_MARGIN, top, handleWidth, handleHeight); + } - // now we check to see if the shape is smaller than the contents, - // and that the shape is not just the bounding rect; in those cases - // we have a shaped guy and we draw a full panel; - // TODO: allow applets to mark when they have translucent areas and - // should therefore skip this test? - if (!m_applet->shape().contains(m_applet->contentsRect())) { - QPainterPath p; - p.addRect(m_applet->boundingRect()); - if (m_applet->shape() != p) { - addedMargin = m_applet->contentsRect().width() / 2; - } - } + if (m_applet->backgroundHints() != Plasma::Applet::NoBackground && + m_applet->contentsRect().height() > qreal(minimumHeight()) * 1.25) { + int addedMargin = HANDLE_MARGIN; if (m_buttonsOnRight) { marginLeft += addedMargin; diff --git a/private/containmentactions_p.h b/private/containmentactions_p.h index e683533ca..5afef7ee3 100644 --- a/private/containmentactions_p.h +++ b/private/containmentactions_p.h @@ -31,6 +31,7 @@ public: ContainmentActionsPrivate(KService::Ptr service, ContainmentActions *containmentActions) : q(containmentActions), containmentActionsDescription(service), + package(0), initialized(false), needsConfig(false), containment(0) diff --git a/private/framesvg_p.h b/private/framesvg_p.h index 86eda83aa..567ff085d 100644 --- a/private/framesvg_p.h +++ b/private/framesvg_p.h @@ -44,7 +44,8 @@ public: bottomMargin(0), noBorderPadding(false), stretchBorders(false), - tileCenter(false) + tileCenter(false), + composeOverBorder(false) { ref(svg); } diff --git a/private/qtjolie-branch/qtjolie/client_p.h b/private/qtjolie-branch/qtjolie/client_p.h index dc9c8f161..1cb1be2a4 100644 --- a/private/qtjolie-branch/qtjolie/client_p.h +++ b/private/qtjolie-branch/qtjolie/client_p.h @@ -38,6 +38,7 @@ class ClientPrivate : public QObject public: ClientPrivate(Client *client) : q(client), + readerThread(0), error(Client::NoError) {} public slots: diff --git a/private/style.cpp b/private/style.cpp index adfa9bdee..d3cae152b 100644 --- a/private/style.cpp +++ b/private/style.cpp @@ -305,6 +305,26 @@ QRect Style::subControlRect(ComplexControl control, const QStyleOptionComplex *o } break; } + case CC_ScrollBar: { + const bool hasButtons = d->scrollbar->hasElement("arrow-up"); + switch (subControl) { + //If one of the arrows is missing, don't reserve space for them + case SC_ScrollBarAddLine: + if (!hasButtons) { + rect.setRect(0,0,0,0); + } + break; + + case SC_ScrollBarSubLine: + if (!hasButtons) { + rect.setRect(0,0,0,0); + } + break; + + default: + break; + } + } default: break; } @@ -331,11 +351,21 @@ int Style::pixelMetric(PixelMetric metric, const QStyleOption *option, const QWi switch (metric) { case PM_ScrollBarExtent: { d->createScrollbar(); + const QSizeF hintSize = d->scrollbar->elementSize("hint-scrollbar-size"); const QStyleOptionSlider *scrollOption = qstyleoption_cast(option); + if (scrollOption && scrollOption->orientation == Qt::Vertical) { - return d->scrollbar->elementSize("arrow-down").width() + 2; + if (hintSize.isEmpty()) { + return d->scrollbar->elementSize("arrow-down").width() + 2; + } else { + return hintSize.width(); + } } else { - return d->scrollbar->elementSize("arrow-left").height() + 2; + if (hintSize.isEmpty()) { + return d->scrollbar->elementSize("arrow-left").height() + 2; + } else { + return hintSize.height(); + } } } default: diff --git a/widgets/declarativewidget.cpp b/widgets/declarativewidget.cpp index 93d043898..317607398 100644 --- a/widgets/declarativewidget.cpp +++ b/widgets/declarativewidget.cpp @@ -46,6 +46,7 @@ public: DeclarativeWidgetPrivate(DeclarativeWidget *parent) : q(parent), engine(0), + scriptEngine(0), component(0), root(0), delay(false)