From e76914ed895154bfeac9124ce34f61feba5697ba Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Fri, 18 Mar 2011 13:32:49 +0100 Subject: [PATCH 01/10] update is not a slot, make one --- declarativeimports/core/svgitem.cpp | 7 ++++++- declarativeimports/core/svgitem_p.h | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/declarativeimports/core/svgitem.cpp b/declarativeimports/core/svgitem.cpp index 0cb30ef99..d631e84ed 100644 --- a/declarativeimports/core/svgitem.cpp +++ b/declarativeimports/core/svgitem.cpp @@ -69,7 +69,7 @@ void SvgItem::setSvg(Plasma::Svg *svg) disconnect(m_svg.data(), 0, this, 0); } m_svg = svg; - connect(svg, SIGNAL(repaintNeeded()), this, SLOT(update())); + connect(svg, SIGNAL(repaintNeeded()), this, SLOT(updateNeeded())); connect(svg, SIGNAL(repaintNeeded()), this, SIGNAL(naturalSizeChanged())); connect(svg, SIGNAL(sizeChanged()), this, SIGNAL(naturalSizeChanged())); emit naturalSizeChanged(); @@ -115,6 +115,11 @@ void SvgItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, Q painter->setRenderHint(QPainter::SmoothPixmapTransform, wasSmoothTransform); } +void SvgItem::updateNeeded() +{ + update(); +} + } // Plasma namespace #include "svgitem_p.moc" diff --git a/declarativeimports/core/svgitem_p.h b/declarativeimports/core/svgitem_p.h index 25cd4be91..d9ad33e33 100644 --- a/declarativeimports/core/svgitem_p.h +++ b/declarativeimports/core/svgitem_p.h @@ -54,6 +54,9 @@ public: Q_SIGNALS: void naturalSizeChanged(); +protected Q_SLOTS: + void updateNeeded(); + private: QWeakPointer m_svg; QString m_elementID; From c216fe47b8600ad3a0a03c53ba6ef991ba3cbf9c Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Sat, 19 Mar 2011 18:30:49 +0100 Subject: [PATCH 02/10] resize DeclarativeItemContainer at item's size --- declarativeimports/core/dialog.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/declarativeimports/core/dialog.cpp b/declarativeimports/core/dialog.cpp index 3e1ee6f8e..e87e66d84 100644 --- a/declarativeimports/core/dialog.cpp +++ b/declarativeimports/core/dialog.cpp @@ -43,6 +43,7 @@ public: static_cast(item)->setParentItem(this); setMinimumWidth(item->implicitWidth()); setMinimumHeight(item->implicitHeight()); + resize(item->width(), item->height()); } QDeclarativeItem *declarativeItem() const From b958bf1480eb58e703f6534f1e8f386d3a27061a Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Sat, 19 Mar 2011 18:36:29 +0100 Subject: [PATCH 03/10] monitor for declarativeitem resize --- declarativeimports/core/dialog.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/declarativeimports/core/dialog.cpp b/declarativeimports/core/dialog.cpp index e87e66d84..40ccf1af6 100644 --- a/declarativeimports/core/dialog.cpp +++ b/declarativeimports/core/dialog.cpp @@ -39,11 +39,15 @@ public: void setDeclarativeItem(QDeclarativeItem *item) { + if (m_declarativeItem) { + m_declarativeItem.data()->removeSceneEventFilter(this); + } m_declarativeItem = item; static_cast(item)->setParentItem(this); setMinimumWidth(item->implicitWidth()); setMinimumHeight(item->implicitHeight()); resize(item->width(), item->height()); + item->installSceneEventFilter(this); } QDeclarativeItem *declarativeItem() const @@ -60,6 +64,15 @@ protected: } } + bool sceneEventFilter(QGraphicsItem *watched, QEvent *event) + { + if (event->type() == QEvent::GraphicsSceneResize) { + resize(watched->boundingRect().size()); + } + + return QGraphicsWidget::sceneEventFilter(watched, event); + } + private: QWeakPointer m_declarativeItem; }; From 19ad72af789bb7880d03be242817da6df03b8494 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Mon, 21 Mar 2011 19:18:28 +0100 Subject: [PATCH 04/10] showPopup() -> popupPosition() makes possible to move the popup --- declarativeimports/core/dialog.cpp | 14 +++++--------- declarativeimports/core/dialog.h | 3 ++- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/declarativeimports/core/dialog.cpp b/declarativeimports/core/dialog.cpp index 40ccf1af6..33a99f2f8 100644 --- a/declarativeimports/core/dialog.cpp +++ b/declarativeimports/core/dialog.cpp @@ -164,18 +164,14 @@ void DialogProxy::setVisible(const bool visible) } } -void DialogProxy::showPopup(QGraphicsObject *item) +QPoint DialogProxy::popupPosition(QGraphicsObject *item) const { - if (m_dialog->isVisible()) { - m_dialog->hide(); + Plasma::Corona *corona = qobject_cast(item->scene()); + if (corona) { + return corona->popupPosition(item, m_dialog->size()); } else { - Plasma::Corona *corona = qobject_cast(item->scene()); - if (corona) { - m_dialog->move(corona->popupPosition(item, m_dialog->size())); - } - m_dialog->show(); + return QPoint(); } - emit visibleChanged(); } diff --git a/declarativeimports/core/dialog.h b/declarativeimports/core/dialog.h index e79fd61e5..f9954b2a4 100644 --- a/declarativeimports/core/dialog.h +++ b/declarativeimports/core/dialog.h @@ -21,6 +21,7 @@ #include #include +#include class QGraphicsObject; @@ -60,7 +61,7 @@ public: int y() const; void setY(int y); - Q_INVOKABLE void showPopup(QGraphicsObject *item); + Q_INVOKABLE QPoint popupPosition(QGraphicsObject *item) const; //FIXME:: Qt::WidgetAttribute should be already Q_INVOKABLE void setAttribute(int attribute, bool on); From d7d08c46ef495f87db8e98ddf02e699fef8caa48 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Mon, 21 Mar 2011 21:38:48 +0100 Subject: [PATCH 05/10] bind the dialog's window flags --- declarativeimports/core/dialog.cpp | 16 ++++++++++++++++ declarativeimports/core/dialog.h | 6 ++++++ 2 files changed, 22 insertions(+) diff --git a/declarativeimports/core/dialog.cpp b/declarativeimports/core/dialog.cpp index 33a99f2f8..ad21fca2d 100644 --- a/declarativeimports/core/dialog.cpp +++ b/declarativeimports/core/dialog.cpp @@ -81,6 +81,7 @@ DialogProxy::DialogProxy(QObject *parent) : QObject(parent) { m_dialog = new Plasma::Dialog(); + m_flags = m_dialog->windowFlags(); } DialogProxy::~DialogProxy() @@ -160,6 +161,10 @@ void DialogProxy::setVisible(const bool visible) { if (m_dialog->isVisible() != visible) { m_dialog->setVisible(visible); + if (visible) {kWarning()<<"AAAAAAAAA"<setWindowFlags(m_flags); + m_dialog->raise(); + } emit visibleChanged(); } } @@ -195,6 +200,17 @@ void DialogProxy::setY(int y) m_dialog->move(m_dialog->pos().x(), y); } +int DialogProxy::windowFlags() const +{ + return (int)m_dialog->windowFlags(); +} + +void DialogProxy::setWindowFlags(const int flags) +{ + m_flags = (Qt::WindowFlags)flags; + m_dialog->setWindowFlags((Qt::WindowFlags)flags); +} + bool DialogProxy::eventFilter(QObject *watched, QEvent *event) { if (watched == m_dialog && event->type() == QEvent::Move) { diff --git a/declarativeimports/core/dialog.h b/declarativeimports/core/dialog.h index f9954b2a4..fa8ce532f 100644 --- a/declarativeimports/core/dialog.h +++ b/declarativeimports/core/dialog.h @@ -40,6 +40,7 @@ class DialogProxy : public QObject Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged) Q_PROPERTY(int x READ x WRITE setX NOTIFY positionChanged) Q_PROPERTY(int y READ y WRITE setY NOTIFY positionChanged) + Q_PROPERTY(int windowFlags READ windowFlags WRITE setWindowFlags) public: enum WidgetAttribute { @@ -61,6 +62,10 @@ public: int y() const; void setY(int y); + //FIXME: passing an int is ugly + int windowFlags() const; + void setWindowFlags(const int); + Q_INVOKABLE QPoint popupPosition(QGraphicsObject *item) const; //FIXME:: Qt::WidgetAttribute should be already Q_INVOKABLE void setAttribute(int attribute, bool on); @@ -78,6 +83,7 @@ protected: private: Plasma::Dialog *m_dialog; + Qt::WindowFlags m_flags; DeclarativeItemContainer *m_declarativeItemContainer; QWeakPointer m_mainItem; }; From 2d27bd40e6d4f8e8d71a4eac6c84bd1566345d65 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Mon, 21 Mar 2011 21:40:00 +0100 Subject: [PATCH 06/10] less debug output --- declarativeimports/core/dialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/declarativeimports/core/dialog.cpp b/declarativeimports/core/dialog.cpp index ad21fca2d..4ce4690e8 100644 --- a/declarativeimports/core/dialog.cpp +++ b/declarativeimports/core/dialog.cpp @@ -161,7 +161,7 @@ void DialogProxy::setVisible(const bool visible) { if (m_dialog->isVisible() != visible) { m_dialog->setVisible(visible); - if (visible) {kWarning()<<"AAAAAAAAA"<setWindowFlags(m_flags); m_dialog->raise(); } From 2acf29889e3e9997d73a977a7350b2e8a4a73f38 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Fri, 25 Mar 2011 23:44:54 +0100 Subject: [PATCH 07/10] update the license After asking for an explicit permission by the author and the copyright holder (Nokia) update the license from GPL to LGPL --- .../simplebindings/backportglobal.h | 41 +++++-------------- 1 file changed, 11 insertions(+), 30 deletions(-) diff --git a/scriptengines/javascript/simplebindings/backportglobal.h b/scriptengines/javascript/simplebindings/backportglobal.h index 51d66f7ec..1a572499c 100644 --- a/scriptengines/javascript/simplebindings/backportglobal.h +++ b/scriptengines/javascript/simplebindings/backportglobal.h @@ -1,39 +1,20 @@ /**************************************************************************** ** -** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved. +** This file is part of the Qt Script Generator. ** -** This file is part of the plugins of the Qt Toolkit. +** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies). ** -** This file may be used under the terms of the GNU General Public -** License version 2.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of -** this file. Please review the following information to ensure GNU -** General Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/ +** Contact: Nokia Corporation info@qt.nokia.com ** -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** In addition, as a special exception, Trolltech gives you certain -** additional rights. These rights are described in the Trolltech GPL -** Exception version 1.0, which can be found at -** http://www.trolltech.com/products/qt/gplexception/ and in the file -** GPL_EXCEPTION.txt in this package. -** -** In addition, as a special exception, Trolltech, as the sole copyright -** holder for Qt Designer, grants users of the Qt/Eclipse Integration -** plug-in the right for the Qt/Eclipse Integration to link to -** functionality provided by Qt Designer and its related libraries. -** -** Trolltech reserves all rights not expressly granted herein. -** -** Trolltech ASA (c) 2007 -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation +** and appearing in the file LICENSE.LGPL included in the packaging of +** this file. Please review the following information to ensure the GNU +** Lesser General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** +** Copyright (C) 2011 Nokia. All rights reserved ****************************************************************************/ #ifndef QTSCRIPTEXTENSIONS_GLOBAL_H #define QTSCRIPTEXTENSIONS_GLOBAL_H From 11b6e786405b346f44c57592b3f8a484253f5eec Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Sun, 27 Mar 2011 12:37:23 +0200 Subject: [PATCH 08/10] re-set the prefix after setting the path --- declarativeimports/core/framesvgitem.cpp | 4 +++- declarativeimports/core/framesvgitem_p.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/declarativeimports/core/framesvgitem.cpp b/declarativeimports/core/framesvgitem.cpp index 1a9f811b2..4c030f356 100644 --- a/declarativeimports/core/framesvgitem.cpp +++ b/declarativeimports/core/framesvgitem.cpp @@ -71,6 +71,7 @@ FrameSvgItem::~FrameSvgItem() void FrameSvgItem::setImagePath(const QString &path) { m_frameSvg->setImagePath(path); + m_frameSvg->setElementPrefix(m_prefix); update(); } @@ -83,12 +84,13 @@ QString FrameSvgItem::imagePath() const void FrameSvgItem::setPrefix(const QString &prefix) { m_frameSvg->setElementPrefix(prefix); + m_prefix = prefix; update(); } QString FrameSvgItem::prefix() const { - return m_frameSvg->prefix(); + return m_prefix; } FrameSvgItemMargins *FrameSvgItem::margins() const diff --git a/declarativeimports/core/framesvgitem_p.h b/declarativeimports/core/framesvgitem_p.h index abdb42a79..f6cf16284 100644 --- a/declarativeimports/core/framesvgitem_p.h +++ b/declarativeimports/core/framesvgitem_p.h @@ -88,6 +88,7 @@ private Q_SLOTS: private: Plasma::FrameSvg *m_frameSvg; FrameSvgItemMargins *m_margins; + QString m_prefix; }; } From 264aa5e8fb9a8b8cf7873b3b3d67c269b2ed570b Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Sun, 27 Mar 2011 16:59:08 +0200 Subject: [PATCH 09/10] bind setAssociatedApplication --- scriptengines/javascript/plasmoid/appletinterface.cpp | 9 +++++++++ scriptengines/javascript/plasmoid/appletinterface.h | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/scriptengines/javascript/plasmoid/appletinterface.cpp b/scriptengines/javascript/plasmoid/appletinterface.cpp index a541411a6..252c1fabc 100644 --- a/scriptengines/javascript/plasmoid/appletinterface.cpp +++ b/scriptengines/javascript/plasmoid/appletinterface.cpp @@ -373,6 +373,15 @@ Plasma::Extender *AppletInterface::extender() const return m_appletScriptEngine->extender(); } +void AppletInterface::setAssociatedApplication(const QString &string) +{ + applet()->setAssociatedApplication(string); +} + +QString AppletInterface::associatedApplication() const +{ + return applet()->associatedApplication(); +} void AppletInterface::gc() { diff --git a/scriptengines/javascript/plasmoid/appletinterface.h b/scriptengines/javascript/plasmoid/appletinterface.h index ff0349c88..ab795c480 100644 --- a/scriptengines/javascript/plasmoid/appletinterface.h +++ b/scriptengines/javascript/plasmoid/appletinterface.h @@ -77,6 +77,7 @@ class AppletInterface : public QObject Q_PROPERTY(int apiVersion READ apiVersion CONSTANT) Q_PROPERTY(QRectF rect READ rect) Q_PROPERTY(QSizeF size READ size) + Q_PROPERTY(QString associatedApplication WRITE setAssociatedApplication READ associatedApplication) public: AppletInterface(AbstractJsAppletScript *parent); @@ -285,6 +286,9 @@ enum IntervalAlignment { static AppletInterface *extract(QScriptEngine *engine); inline Plasma::Applet *applet() const { return m_appletScriptEngine->applet(); } + void setAssociatedApplication(const QString &string); + QString associatedApplication() const; + Q_SIGNALS: void releaseVisualFocus(); void configNeedsSaving(); From 19ff95e3a19b1c152c4cae4fc176c4ac4713816f Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Mon, 28 Mar 2011 16:54:00 +0200 Subject: [PATCH 10/10] relicense under LGPL upon author's permission --- scriptengines/javascript/dataengine/javascriptdataengine.cpp | 2 +- scriptengines/javascript/dataengine/javascriptdataengine.h | 2 +- scriptengines/javascript/simplebindings/i18n.cpp | 2 +- scriptengines/javascript/simplebindings/i18n.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scriptengines/javascript/dataengine/javascriptdataengine.cpp b/scriptengines/javascript/dataengine/javascriptdataengine.cpp index 8a6f0498d..2a1e12767 100644 --- a/scriptengines/javascript/dataengine/javascriptdataengine.cpp +++ b/scriptengines/javascript/dataengine/javascriptdataengine.cpp @@ -2,7 +2,7 @@ * Copyright 2009 Aaron Seigo * * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as + * 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. * diff --git a/scriptengines/javascript/dataengine/javascriptdataengine.h b/scriptengines/javascript/dataengine/javascriptdataengine.h index b5bb67cff..bc8802ed1 100644 --- a/scriptengines/javascript/dataengine/javascriptdataengine.h +++ b/scriptengines/javascript/dataengine/javascriptdataengine.h @@ -2,7 +2,7 @@ * Copyright 2009 Aaron Seigo * * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as + * 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. * diff --git a/scriptengines/javascript/simplebindings/i18n.cpp b/scriptengines/javascript/simplebindings/i18n.cpp index 97502da98..2210a1930 100644 --- a/scriptengines/javascript/simplebindings/i18n.cpp +++ b/scriptengines/javascript/simplebindings/i18n.cpp @@ -2,7 +2,7 @@ * Copyright 2009 Aaron Seigo * * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as + * 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. * diff --git a/scriptengines/javascript/simplebindings/i18n.h b/scriptengines/javascript/simplebindings/i18n.h index 48f9cbba5..5644a0dff 100644 --- a/scriptengines/javascript/simplebindings/i18n.h +++ b/scriptengines/javascript/simplebindings/i18n.h @@ -2,7 +2,7 @@ * Copyright 2009 Aaron Seigo * * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as + * 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. *