I have made the following changes intended for :
  CE:Apps / qmlmessages

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/6222

Thank You,
John Brooks

[This message was auto-generated]

---

Request # 6222:

Messages from BOSS:

State: review at 2012-08-27T09:59:28 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:Apps / qmlmessages -> CE:Apps / qmlmessages
  
changes files:
--------------
--- qmlmessages.changes
+++ qmlmessages.changes
@@ -0,0 +1,5 @@
+* Mon Aug 27 2012 John Brooks <[email protected]> - 0.0.3
+- Fixes NEMO#374: Add support for dbus activation by telepathy
+- qmlmessages will run in the background when needed to handle channels
+- Added org.nemomobile.qmlmessages service to handle window launching
+

old:
----
  qmlmessages-0.0.2.tar.bz2

new:
----
  qmlmessages-0.0.3.tar.bz2

spec files:
-----------
--- qmlmessages.spec
+++ qmlmessages.spec
@@ -9,7 +9,7 @@
 # << macros
 
 Summary:    Messaging application for nemo
-Version:    0.0.2
+Version:    0.0.3
 Release:    1
 Group:      Applications/System
 License:    BSD
@@ -67,5 +67,8 @@
 %defattr(-,root,root,-)
 %{_bindir}/qmlmessages
 %{_datadir}/applications/qmlmessages.desktop
+%{_datadir}/telepathy/clients/qmlmessages.client
+%{_datadir}/dbus-1/services/org.freedesktop.Telepathy.Client.qmlmessages.service
+%{_datadir}/dbus-1/services/org.nemomobile.qmlmessages.service
 # >> files
 # << files

other changes:
--------------

++++++ qmlmessages-0.0.2.tar.bz2 -> qmlmessages-0.0.3.tar.bz2
--- data
+++ data
+(directory)
--- data/data.pri
+++ data/data.pri
@@ -0,0 +1,11 @@
+desktop.path = $${INSTALL_ROOT}/usr/share/applications
+desktop.files = data/$${PROJECT_NAME}.desktop
+
+client.path = $${INSTALL_ROOT}/usr/share/telepathy/clients
+client.files = data/qmlmessages.client
+
+service.path = $${INSTALL_ROOT}/usr/share/dbus-1/services
+service.files = data/org.freedesktop.Telepathy.Client.qmlmessages.service \
+                data/org.nemomobile.qmlmessages.service
+
+INSTALLS += desktop client service
--- data/org.freedesktop.Telepathy.Client.qmlmessages.service
+++ data/org.freedesktop.Telepathy.Client.qmlmessages.service
@@ -0,0 +1,3 @@
+[D-BUS Service]
+Name=org.freedesktop.Telepathy.Client.qmlmessages
+Exec=/usr/bin/invoker --no-wait -d 10 --type=d /usr/bin/qmlmessages -background
--- data/org.nemomobile.qmlmessages.service
+++ data/org.nemomobile.qmlmessages.service
@@ -0,0 +1,3 @@
+[D-BUS Service]
+Name=org.nemomobile.qmlmessages
+Exec=/usr/bin/invoker --no-wait -d 10 --type=d /usr/bin/qmlmessages -background
--- data/qmlmessages.client
+++ data/qmlmessages.client
@@ -0,0 +1,17 @@
+[org.freedesktop.Telepathy.Client]
+Interfaces=org.freedesktop.Telepathy.Client.Handler;org.freedesktop.Telepathy.Client.Interface.Requests
+
+[org.freedesktop.Telepathy.Client.Handler]
+BypassApproval=true
+
+[org.freedesktop.Telepathy.Client.Handler.HandlerChannelFilter 0]
+org.freedesktop.Telepathy.Channel.ChannelType 
s=org.freedesktop.Telepathy.Channel.Type.Text
+org.freedesktop.Telepathy.Channel.TargetHandleType u=0
+
+[org.freedesktop.Telepathy.Client.Handler.HandlerChannelFilter 1]
+org.freedesktop.Telepathy.Channel.ChannelType 
s=org.freedesktop.Telepathy.Channel.Type.Text
+org.freedesktop.Telepathy.Channel.TargetHandleType u=1
+
+[org.freedesktop.Telepathy.Client.Handler.HandlerChannelFilter 2]
+org.freedesktop.Telepathy.Channel.ChannelType 
s=org.freedesktop.Telepathy.Channel.Type.Text
+org.freedesktop.Telepathy.Channel.TargetHandleType u=2
--- data/qmlmessages.desktop
+++ data/qmlmessages.desktop
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Type=Application
+Name=Messages
+Icon=icons-Applications-sms
+Exec=invoker --type=d /usr/bin/qmlmessages
+Comment=Nemo messaging application
+X-Desktop-File-Install-Version=0.19
+X-Maemo-Service=org.nemomobile.qmlmessages
+X-Maemo-Method=org.nemomobile.qmlmessages.showGroupsWindow
--- qmlmessages.desktop
+++ qmlmessages.desktop
@@ -1,6 +0,0 @@
-[Desktop Entry]
-Type=Application
-Name=Messages
-Icon=icons-Applications-sms
-Exec=invoker -s --type=d /usr/bin/qmlmessages -fullscreen
-Comment=Nemo messaging application
--- qmlmessages.pro
+++ qmlmessages.pro
@@ -11,22 +11,24 @@
 target.path = $$INSTALL_ROOT/usr/bin
 INSTALLS += target
 
-desktop.files = $${PROJECT_NAME}.desktop
-desktop.path = $$INSTALL_ROOT/usr/share/applications
-INSTALLS += desktop
+include(data/data.pri)
 
 SOURCES += src/main.cpp \
     src/accountsmodel.cpp \
     src/clienthandler.cpp \
     src/conversationchannel.cpp \
     src/qmlgroupmodel.cpp \
-    src/qmlchatmodel.cpp
+    src/qmlchatmodel.cpp \
+    src/windowmanager.cpp \
+    src/dbusadaptor.cpp
 
 HEADERS += src/accountsmodel.h \
     src/clienthandler.h \
     src/conversationchannel.h \
     src/qmlgroupmodel.h \
-    src/qmlchatmodel.h
+    src/qmlchatmodel.h \
+    src/windowmanager.h \
+    src/dbusadaptor.h
 
 RESOURCES += res/res.qrc qml/qml.qrc
 
--- src/dbusadaptor.cpp
+++ src/dbusadaptor.cpp
@@ -0,0 +1,51 @@
+/* Copyright (C) 2012 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 "dbusadaptor.h"
+#include "windowmanager.h"
+
+DBusAdaptor::DBusAdaptor(WindowManager *m)
+    : QDBusAbstractAdaptor(m), wm(m)
+{
+}
+
+void DBusAdaptor::showGroupsWindow()
+{
+    wm->showGroupsWindow();
+}
+
+/* libcontentaction requires this signature for methods invoked from
+ * a .desktop file. */
+void DBusAdaptor::showGroupsWindow(const QStringList &a)
+{
+    Q_UNUSED(a);
+    wm->showGroupsWindow();
+}
+
--- src/dbusadaptor.h
+++ src/dbusadaptor.h
@@ -0,0 +1,53 @@
+/* Copyright (C) 2012 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 DBUSADAPTOR_H
+#define DBUSADAPTOR_H
+
+#include <QDBusAbstractAdaptor>
+#include "windowmanager.h"
+
+class DBusAdaptor : public QDBusAbstractAdaptor
+{
+    Q_OBJECT
+    Q_CLASSINFO("D-Bus Interface", "org.nemomobile.qmlmessages")
+
+public:
+    explicit DBusAdaptor(WindowManager *manager);
+    
+public slots:
+    void showGroupsWindow();
+    void showGroupsWindow(const QStringList &a);
+
+private:
+    WindowManager * const wm;
+};
+
+#endif
--- src/main.cpp
+++ src/main.cpp
@@ -43,6 +43,7 @@
 #include <TelepathyQt4/Types>
 #include <TelepathyQt4/ClientRegistrar>
 
+#include "src/windowmanager.h"
 #include "src/accountsmodel.h"
 #include "src/clienthandler.h"
 #include "src/conversationchannel.h"
@@ -60,26 +61,23 @@
 #endif
 int main(int argc, char **argv)
 {
-    QApplication *a;
-    QDeclarativeView *view;
 #ifdef HAS_BOOSTER
-    a = MDeclarativeCache::qApplication(argc, argv);
-    view = MDeclarativeCache::qDeclarativeView();
+    MDeclarativeCache::qApplication(argc, argv);
 #else
     qWarning() << Q_FUNC_INFO << "Warning! Running without booster. This may 
be a bit slower.";
-    QApplication aStack(argc, argv);
-    QDeclarativeView viewStack;
-    a = &aStack;
-    view = &viewStack;
+    QApplication a(argc, argv);
 #endif
 
     // Set up Telepathy
     Tp::registerTypes();
     Tp::enableWarnings(true);
 
+    bool showWindow = true;
     foreach (QString arg, qApp->arguments()) {
         if (arg == "-debug")
             Tp::enableDebug(true);
+        else if (arg == "-background")
+            showWindow = false;
     }
 
     const QDBusConnection &dbus = QDBusConnection::sessionBus();
@@ -101,16 +99,12 @@
     QmlGroupModel gm;
     groupModel = &gm;
 
-    // Set up view
-    view->setWindowTitle(qApp->translate("Window", "Messages"));
-    view->rootContext()->setContextProperty("clientHandler", 
QVariant::fromValue<QObject*>(clientHandler));
-    view->rootContext()->setContextProperty("groupModel", 
QVariant::fromValue<QObject*>(groupModel));
-    view->setSource(QUrl("qrc:qml/qmlmessages/main.qml"));
-    view->setAttribute(Qt::WA_OpaquePaintEvent);
-    view->setAttribute(Qt::WA_NoSystemBackground);
-    view->viewport()->setAttribute(Qt::WA_OpaquePaintEvent);
-    view->viewport()->setAttribute(Qt::WA_NoSystemBackground);
-    view->showFullScreen();
+    WindowManager *wm = WindowManager::instance();
+    if (showWindow)
+        wm->showGroupsWindow();
+    else 
+        // Stay open persistently if not started with UI
+        qApp->setQuitOnLastWindowClosed(false);
 
-    return a->exec();
+    return qApp->exec();
 }
--- src/windowmanager.cpp
+++ src/windowmanager.cpp
@@ -0,0 +1,96 @@
+/* Copyright (C) 2012 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 "windowmanager.h"
+#include "clienthandler.h"
+#include "qmlgroupmodel.h"
+#include "dbusadaptor.h"
+#include <QDeclarativeView>
+#include <QDeclarativeContext>
+#include <QDBusConnection>
+#ifdef HAS_BOOSTER
+#include <applauncherd/MDeclarativeCache>
+#endif
+
+Q_GLOBAL_STATIC(WindowManager, wmInstance)
+
+extern QmlGroupModel *groupModel;
+
+WindowManager *WindowManager::instance()
+{
+    return wmInstance();
+}
+
+WindowManager::WindowManager(QObject *parent)
+    : QObject(parent)
+{
+    new DBusAdaptor(this);
+    
QDBusConnection::sessionBus().registerService("org.nemomobile.qmlmessages");
+    if (!QDBusConnection::sessionBus().registerObject("/", this)) {
+        qWarning() << "Cannot register DBus object!";
+    }
+}
+
+WindowManager::~WindowManager()
+{
+#ifndef HAS_BOOSTER
+    delete mWindow;
+#endif
+}
+
+void WindowManager::showGroupsWindow()
+{
+    if (!mWindow) {
+#ifdef HAS_BOOSTER
+        mWindow = MDeclarativeCache::qDeclarativeView();
+#else
+        mWindow = new QDeclarativeView;
+#endif
+
+        QDeclarativeView *w = mWindow.data();
+
+        // mWindow is a QWeakPointer, so it'll be cleared on delete
+        w->setAttribute(Qt::WA_DeleteOnClose);
+        w->setWindowTitle(tr("Messages"));
+        w->rootContext()->setContextProperty("clientHandler", 
QVariant::fromValue<QObject*>(ClientHandler::instance()));
+        w->rootContext()->setContextProperty("groupModel", 
QVariant::fromValue<QObject*>(groupModel));
+        w->setSource(QUrl("qrc:qml/qmlmessages/main.qml"));
+        w->setAttribute(Qt::WA_OpaquePaintEvent);
+        w->setAttribute(Qt::WA_NoSystemBackground);
+        w->viewport()->setAttribute(Qt::WA_OpaquePaintEvent);
+        w->viewport()->setAttribute(Qt::WA_NoSystemBackground);
+    }
+
+    // XXX set page for existing windows?
+
+    mWindow.data()->showFullScreen();
+    mWindow.data()->activateWindow();
+}
+
--- src/windowmanager.h
+++ src/windowmanager.h
@@ -0,0 +1,62 @@
+/* Copyright (C) 2012 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 WINDOWMANAGER_H
+#define WINDOWMANAGER_H
+
+#include <QObject>
+#include <QWeakPointer>
+
+class QDeclarativeView;
+
+/* Right now, WindowManager is just responsible for creating/showing the
+ * single window we manage when requested via DBus or application launch.
+ *
+ * Eventually, this class will be responsible for juggling the multiple
+ * top-level windows for open conversations as well. */
+class WindowManager : public QObject
+{
+    Q_OBJECT
+
+public:
+    static WindowManager *instance();
+
+    explicit WindowManager(QObject *parent = 0);
+    virtual ~WindowManager();
+
+public slots:
+    void showGroupsWindow();
+
+private:
+    QWeakPointer<QDeclarativeView> mWindow;
+};
+
+#endif
+

++++++ qmlmessages.yaml
--- qmlmessages.yaml
+++ qmlmessages.yaml
@@ -1,6 +1,6 @@
 Name:  qmlmessages
 Summary: Messaging application for nemo
-Version: 0.0.2
+Version: 0.0.3
 Release: 1
 Group: Applications/System
 License: BSD
@@ -31,3 +31,6 @@
 Files:
     - "%{_bindir}/qmlmessages"
     - "%{_datadir}/applications/qmlmessages.desktop"
+    - "%{_datadir}/telepathy/clients/qmlmessages.client"
+    - 
"%{_datadir}/dbus-1/services/org.freedesktop.Telepathy.Client.qmlmessages.service"
+    - "%{_datadir}/dbus-1/services/org.nemomobile.qmlmessages.service"



Reply via email to