I have made the following changes intended for : CE:MW:Shared / nemo-qml-plugins
Please review and accept or decline. BOSS has already run some checks on this request. See the "Messages from BOSS" section below. https://build.pub.meego.com//request/show/7733 Thank You, John Brooks [This message was auto-generated] --- Request # 7733: Messages from BOSS: State: review at 2013-01-25T07:28:06 by bossbot Reviews: accepted by bossbot : Prechecks succeeded. new for CE-maintainers : Please replace this text with a review and approve/reject the review (not the SR). BOSS will take care of the rest Changes: submit: home:special:branches:CE:MW:Shared / nemo-qml-plugins -> CE:MW:Shared / nemo-qml-plugins changes files: -------------- --- nemo-qml-plugins.changes +++ nemo-qml-plugins.changes @@ -0,0 +1,4 @@ +* Thu Jan 24 2013 John Brooks <[email protected]> - 0.2.3 +- Emit syncBegin in all retrieval actions (from Valerio Valerio) +- Add utilities plugin and WindowAttributes (from John Brooks) + old: ---- nemo-qml-plugins-0.2.2.tar.bz2 new: ---- nemo-qml-plugins-0.2.3.tar.bz2 spec files: ----------- --- nemo-qml-plugins.spec +++ nemo-qml-plugins.spec @@ -9,7 +9,7 @@ # << macros Summary: Nemo QML plugins source package. -Version: 0.2.2 +Version: 0.2.3 Release: 1 Group: System/Libraries License: BSD @@ -28,6 +28,7 @@ BuildRequires: pkgconfig(libsignon-qt) BuildRequires: pkgconfig(accounts-qt) BuildRequires: pkgconfig(timed) +BuildRequires: pkgconfig(x11) %description Do not install this, install the subpackaged plugins. @@ -151,6 +152,13 @@ %description alarms-tests Tests for QML alarms plugin +%package utilities +Summary: Miscellaneous utility elements for QML applications +Group: System/Libraries + +%description utilities +Miscellaneous utility elements for QML applications. + %prep %setup -q -n %{name} @@ -293,3 +301,10 @@ /opt/tests/nemo-qml-plugins/alarms/* # >> files alarms-tests # << files alarms-tests + +%files utilities +%defattr(-,root,root,-) +%{_libdir}/qt4/imports/org/nemomobile/utilities/libnemoutilities.so +%{_libdir}/qt4/imports/org/nemomobile/utilities/qmldir +# >> files utilities +# << files utilities other changes: -------------- ++++++ nemo-qml-plugins-0.2.2.tar.bz2 -> nemo-qml-plugins-0.2.3.tar.bz2 --- email/src/emailagent.cpp +++ email/src/emailagent.cpp @@ -43,7 +43,6 @@ EmailAgent::EmailAgent(QDeclarativeItem *parent) : QDeclarativeItem(parent) , m_actionCount(0) - , m_retrieving(false) , m_transmitting(false) , m_cancelling(false) , m_synchronizing(false) @@ -109,6 +108,7 @@ if (m_cancelling) { m_synchronizing = false; m_transmitting = false; + m_cancelling = false; _actionQueue.clear(); emit error(status.accountId, status.text, status.errorCode); qDebug() << "Canceled by the user"; @@ -295,9 +295,7 @@ QMailFolderId foldId = folderId.value<QMailFolderId>(); if (acctId.isValid()) { - emit syncBegin(); //check - m_cancelling = false; - m_retrieving = true; + emit syncBegin(); enqueue(new RetrieveFolderList(m_retrievalAction.data(),acctId, foldId, descending)); } } @@ -306,10 +304,8 @@ { QMailAccountId accountId = id.value<QMailAccountId>(); - if (!isSynchronizing() && accountId.isValid()) { - emit syncBegin(); //check - m_cancelling = false; - m_retrieving = true; + if (accountId.isValid()) { + emit syncBegin(); enqueue(new Synchronize(m_retrievalAction.data(), accountId)); } } @@ -320,7 +316,7 @@ QMailAccount account(accountId); QMailFolderId foldId = account.standardFolder(QMailFolder::InboxFolder); - emit syncBegin(); + emit syncBegin(); if(foldId.isValid()) { enqueue(new ExportUpdates(m_retrievalAction.data(),accountId)); enqueue(new RetrieveFolderList(m_retrievalAction.data(), accountId, QMailFolderId(), true)); @@ -341,15 +337,14 @@ QMailFolderId foldId = folderId.value<QMailFolderId>(); if (acctId.isValid()) { - emit syncBegin(); //check - m_cancelling = false; //check - m_retrieving = true; //check + emit syncBegin(); enqueue(new RetrieveMessageList(m_retrievalAction.data(),acctId, foldId, minimum)); } } void EmailAgent::retrieveMessageRange(QVariant messageId, uint minimum) { + emit syncBegin(); QMailMessageId id = messageId.value<QMailMessageId>(); enqueue(new RetrieveMessageRange(m_retrievalAction.data(), id, minimum)); } @@ -358,9 +353,7 @@ { QMailFolderId folderId = vFolderId.value<QMailFolderId>(); if (folderId.isValid()) { - emit syncBegin(); //check - m_cancelling = false; //check - m_retrieving = true; //check + emit syncBegin(); QMailFolder folder(folderId); QMailMessageKey countKey(QMailMessageKey::parentFolderId(folderId)); countKey &= ~QMailMessageKey::status(QMailMessage::Temporary); @@ -372,7 +365,6 @@ void EmailAgent::sendMessages(const QMailAccountId &id) { if (id.isValid()) { - m_cancelling = false; //check m_transmitting = true; enqueue(new TransmitMessages(m_transmitAction.data(),id)); } --- email/src/emailagent.h +++ email/src/emailagent.h @@ -87,7 +87,6 @@ static EmailAgent *m_instance; uint m_actionCount; - bool m_retrieving; bool m_transmitting; bool m_cancelling; bool m_synchronizing; --- nemo-qml-plugins.pro +++ nemo-qml-plugins.pro @@ -9,4 +9,5 @@ signon \ accounts \ alarms \ - time + time \ + utilities --- utilities +++ utilities +(directory) --- utilities/src +++ utilities/src +(directory) --- utilities/src/declarativewindowattributes.cpp +++ utilities/src/declarativewindowattributes.cpp @@ -0,0 +1,107 @@ +/* + * Copyright (C) 2013 Jolla Ltd. + * Contact: John Brooks <[email protected]> + * + * You may use this file under the terms of the BSD license as follows: + * + * "Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Nemo Mobile nor the names of its contributors + * may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." + */ + +#include "declarativewindowattributes.h" +#include <QGraphicsView> +#include <QX11Info> +#include <QTimer> + +#include <X11/Xlib.h> +#include <X11/Xatom.h> + +DeclarativeWindowAttributes::DeclarativeWindowAttributes(QDeclarativeItem *parent) + : QDeclarativeItem(parent), m_stackingLayer(0), m_cannotMinimize(false) +{ +} + +void DeclarativeWindowAttributes::setStackingLayer(int layer) +{ + if (m_stackingLayer == layer) + return; + + m_stackingLayer = layer; + updateX11(false); + emit stackingLayerChanged(); +} + +void DeclarativeWindowAttributes::setCannotMinimize(bool on) +{ + if (m_cannotMinimize == on) + return; + + m_cannotMinimize = on; + updateX11(false); + emit cannotMinimizeChanged(); +} + +bool DeclarativeWindowAttributes::updateX11(bool delayed) +{ + QWidget *view = scene() ? scene()->views().value(0) : 0; + if (!view) { + if (delayed) + qWarning() << "org.nemomobile.utilities: WindowAttributes has no window"; + else + QTimer::singleShot(1, this, SLOT(updateX11())); + return false; + } + + if (!view->isWindow()) + view = view->window(); + + Display *display = QX11Info::display(); + Atom stackingLayerAtom = XInternAtom(display, "_MEEGO_STACKING_LAYER", False); + Atom cannotMinimizeAtom = XInternAtom(display, "_MEEGOTOUCH_CANNOT_MINIMIZE", False); + + if (stackingLayerAtom != None) { + if (m_stackingLayer) { + long l = m_stackingLayer; + XChangeProperty(display, view->winId(), stackingLayerAtom, XA_CARDINAL, + 32, PropModeReplace, (unsigned char*)&l, 1); + } else { + XDeleteProperty(display, view->winId(), stackingLayerAtom); + } + } + + // Set _MEEGOTOUCH_CANNOT_MINIMIZE + if (cannotMinimizeAtom != None) { + if (m_cannotMinimize) { + long v = 1; + XChangeProperty(display, view->winId(), cannotMinimizeAtom, XA_CARDINAL, + 32, PropModeReplace, (unsigned char*)&v, 1); + } else { + XDeleteProperty(display, view->winId(), cannotMinimizeAtom); + } + } + + return true; +} + --- utilities/src/declarativewindowattributes.h +++ utilities/src/declarativewindowattributes.h @@ -0,0 +1,93 @@ +/* + * Copyright (C) 2013 Jolla Ltd. + * Contact: John Brooks <[email protected]> + * + * You may use this file under the terms of the BSD license as follows: + * + * "Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Nemo Mobile nor the names of its contributors + * may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." + */ + +#ifndef DECLARATIVEWINDOWATTRIBUTES_H +#define DECLARATIVEWINDOWATTRIBUTES_H + +#include <QDeclarativeItem> + +/*! + \qmlclass WindowAttributes DeclarativeWindowAttributes + \brief Control windowsystem/compositor specific attributes + + WindowAttributes provides control over attributes specific to the + compositor or windowing system. Properties may not have any effect + on some systems. + */ + +class DeclarativeWindowAttributes : public QDeclarativeItem +{ + Q_OBJECT + Q_ENUMS(StackingLayer) + +public: + DeclarativeWindowAttributes(QDeclarativeItem *parent = 0); + + enum StackingLayer { + StackNormally = 0, + StackLockscreen = 5, + StackHighest = 10 + }; + + /*! + \qmlproperty int stackingLayer + + Set the stacking layer of the window to place it above or below other + special windows. + */ + Q_PROPERTY(int stackingLayer READ stackingLayer WRITE setStackingLayer NOTIFY stackingLayerChanged) + int stackingLayer() const { return m_stackingLayer; } + void setStackingLayer(int layer); + + /*! + \qmlproperty bool cannotMinimize + + Prevent the window from being minimized by gestures + */ + Q_PROPERTY(bool cannotMinimize READ cannotMinimize WRITE setCannotMinimize NOTIFY cannotMinimizeChanged) + bool cannotMinimize() const { return m_cannotMinimize; } + void setCannotMinimize(bool on); + +signals: + void stackingLayerChanged(); + void cannotMinimizeChanged(); + +private slots: + bool updateX11(bool delayed = true); + +private: + int m_stackingLayer; + bool m_cannotMinimize; +}; + +#endif + --- utilities/src/plugin.cpp +++ utilities/src/plugin.cpp @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2013 Jolla Ltd. + * Contact: John Brooks <[email protected]> + * + * You may use this file under the terms of the BSD license as follows: + * + * "Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Nemo Mobile nor the names of its contributors + * may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." + */ + +#include <QtGlobal> +#include <QtDeclarative> +#include "declarativewindowattributes.h" + +class Q_DECL_EXPORT NemoUtilsPlugin : public QDeclarativeExtensionPlugin +{ +public: + NemoUtilsPlugin() + { + } + + virtual ~NemoUtilsPlugin() + { + } + + void initializeEngine(QDeclarativeEngine *engine, const char *uri) + { + Q_ASSERT(uri == QLatin1String("org.nemomobile.utilities")); + } + + void registerTypes(const char *uri) + { + Q_ASSERT(uri == QLatin1String("org.nemomobile.utilities")); + + qmlRegisterType<DeclarativeWindowAttributes>(uri, 1, 0, "WindowAttributes"); + } +}; + +Q_EXPORT_PLUGIN2(nemoutils, NemoUtilsPlugin); + --- utilities/src/qmldir +++ utilities/src/qmldir @@ -0,0 +1 @@ +plugin nemoutilities --- utilities/src/src.pro +++ utilities/src/src.pro @@ -0,0 +1,9 @@ +TARGET = nemoutilities +PLUGIN_IMPORT_PATH = org/nemomobile/utilities + +SOURCES += plugin.cpp \ + declarativewindowattributes.cpp + +HEADERS += declarativewindowattributes.h + +include(../../plugin.pri) --- utilities/utilities.pro +++ utilities/utilities.pro @@ -0,0 +1,2 @@ +TEMPLATE = subdirs +SUBDIRS = src ++++++ nemo-qml-plugins.yaml --- nemo-qml-plugins.yaml +++ nemo-qml-plugins.yaml @@ -2,7 +2,7 @@ Summary: Nemo QML plugins source package. Group: System/Libraries Description: Do not install this, install the subpackaged plugins. -Version: 0.2.2 +Version: 0.2.3 Release: 1 Sources: - "%{name}-%{version}.tar.bz2" @@ -25,6 +25,7 @@ - libsignon-qt - accounts-qt - timed + - x11 # utilities SetupOptions: "-q -n %{name}" @@ -159,3 +160,11 @@ Description: Tests for QML alarms plugin Files: - "/opt/tests/nemo-qml-plugins/alarms/*" + + - Name: utilities + Summary: Miscellaneous utility elements for QML applications + Group: System/Libraries + Description: Miscellaneous utility elements for QML applications. + Files: + - "%{_libdir}/qt4/imports/org/nemomobile/utilities/libnemoutilities.so" + - "%{_libdir}/qt4/imports/org/nemomobile/utilities/qmldir"
