aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Waterman <david.waterman@nokia.com>2010-07-20 17:12:22 +0300
committerDominik Kapusta <dominik.kapusta@teleca.com>2010-08-03 15:40:28 +0200
commite941f56a4276525f3fbe372a3d795dd722341adc (patch)
treed111627722dbba581d0ab255fef5ba92767acb4c
parent6e3d8a5cbe4053057845d1d0cb3a531e3fc44370 (diff)
Changes: DUI-3234 and DUI-3235 - allow user to specify page title; appname by default
RevBy: Dominik Details: Chained methods have an optional last parameter for the page title. It defaults to the null QString, but the nullness doesn't get passed through qdbus so if it isEmpty() is used to test if the user has set it to anything; I think the user shouldn't be allowed to set it to the empty string, so this is actually a good thing.
-rw-r--r--examples/chaining/INSTALL.txt29
-rw-r--r--examples/chaining/chainingexampleapp1/imageviewer.cpp2
-rw-r--r--src/corelib/core/mcomponentdata.cpp16
-rw-r--r--src/corelib/core/mcomponentdata.h18
-rw-r--r--src/corelib/core/mcomponentdata_p.h4
-rw-r--r--src/corelib/widgets/mapplicationwindow.cpp24
-rw-r--r--src/corelib/widgets/mapplicationwindow_p.h5
-rw-r--r--tests/ft_mservicefwgen/ftmservicefwgen1.cpp.correct14
-rw-r--r--tests/ft_mservicefwgen/ftmservicefwgen1.h.correct2
-rw-r--r--tests/ft_mservicefwgen/ftmservicefwgen1adaptor.cpp.correct84
-rw-r--r--tests/ft_mservicefwgen/ftmservicefwgen1adaptor.h.correct15
-rw-r--r--tests/ft_mservicefwgen/ftmservicefwgen1proxy.h.correct6
-rw-r--r--tests/ft_mservicefwgen/ftmservicefwgen2.cpp.correct7
-rw-r--r--tests/ft_mservicefwgen/ftmservicefwgen2.h.correct1
-rw-r--r--tests/ft_mservicefwgen/ftmservicefwgen2adaptor.cpp.correct55
-rw-r--r--tests/ft_mservicefwgen/ftmservicefwgen2adaptor.h.correct10
-rw-r--r--tests/ft_mservicefwgen/ftmservicefwgen2proxy.h.correct3
-rw-r--r--tools/m-servicefwgen.d/m-servicefwgen.cpp135
18 files changed, 207 insertions, 223 deletions
diff --git a/examples/chaining/INSTALL.txt b/examples/chaining/INSTALL.txt
deleted file mode 100644
index 43efd0b2..00000000
--- a/examples/chaining/INSTALL.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-# here are some commands you can use/adapt to help you get this example installed on the device.
-
-mkdir install
-cp chainingexampleapp?/*chainingexampleapp?{,.desktop,.service} install
-cp chainingexampleinterface/libchainingexampleinterface.so.1.0.0 install
-tar -zcf install.tar.gz install
-scp install.tar.gz root@192.168.2.15:/home/user
-ssh 192.168.2.15 -l root
-cd /home/user
-tar -zxf install.tar.gz
-cp install/*.desktop /usr/share/applications/
-cp install/*.service /usr/share/dbus-1/services
-cp install/chainingexampleapp1 /usr/bin/chainingexampleapp1.exe
-cp install/chainingexampleapp2 /usr/bin/chainingexampleapp2.exe
-cp install/libchainingexampleinterface.so.1.0.0 /usr/lib
-ln -s /usr/lib/libchainingexampleinterface.so.1.0.0 /usr/lib/libchainingexampleinterface.so.1.0
-ln -s /usr/lib/libchainingexampleinterface.so.1.0.0 /usr/lib/libchainingexampleinterface.so.1
-ln -s /usr/lib/libchainingexampleinterface.so.1.0.0 /usr/lib/libchainingexampleinterface.so
-cat > /usr/bin/chainingexampleapp1 <<EOF
-#!/bin/sh
-
-/usr/bin/chainingexampleapp1.exe $* > /tmp/chainingexampleapp1.out 2>&1
-EOF
-cat > /usr/bin/chainingexampleapp2 <<EOF
-#!/bin/sh
-
-/usr/bin/chainingexampleapp2.exe $* > /tmp/chainingexampleapp2.out 2>&1
-EOF
-chmod +x /usr/bin/chainingexampleapp?
diff --git a/examples/chaining/chainingexampleapp1/imageviewer.cpp b/examples/chaining/chainingexampleapp1/imageviewer.cpp
index 2442baae..4750d2b1 100644
--- a/examples/chaining/chainingexampleapp1/imageviewer.cpp
+++ b/examples/chaining/chainingexampleapp1/imageviewer.cpp
@@ -23,7 +23,7 @@ void ImageViewer::showImage()
list << imageFilename;
if ( chainingExampleInterface->isValid() ) {
- chainingExampleInterface->showImage( imageFilename, list );
+ chainingExampleInterface->showImage( imageFilename, list, "title set by app1" );
} else {
qDebug() << "chainingExampleInterface not valid : " << chainingExampleInterface;
}
diff --git a/src/corelib/core/mcomponentdata.cpp b/src/corelib/core/mcomponentdata.cpp
index cd6237b8..f23e81dd 100644
--- a/src/corelib/core/mcomponentdata.cpp
+++ b/src/corelib/core/mcomponentdata.cpp
@@ -1075,23 +1075,25 @@ bool MComponentData::isOrientationForced()
return gMComponentDataPrivate->isOrientationForced;
}
-QStack<WId> MComponentDataPrivate::chainedWinIds;
+#ifdef Q_WS_X11
+QStack<MComponentData::ChainData> MComponentDataPrivate::chainData;
-void MComponentData::pushChainedWindowId(const WId &parentWinId)
+void MComponentData::pushChainData(const ChainData &newChainData)
{
- MComponentDataPrivate::chainedWinIds.push(parentWinId);
+ MComponentDataPrivate::chainData.push( newChainData );
}
-WId MComponentData::popChainedWindowId()
+MComponentData::ChainData MComponentData::popChainData()
{
- WId retVal = MComponentDataPrivate::chainedWinIds.pop();
+ ChainData retVal = MComponentDataPrivate::chainData.pop();
return retVal;
}
-bool MComponentData::chainedWindowIdStackIsEmpty()
+bool MComponentData::chainDataStackIsEmpty()
{
- bool retVal = MComponentDataPrivate::chainedWinIds.isEmpty();
+ bool retVal = MComponentDataPrivate::chainData.isEmpty();
return retVal;
}
+#endif // Q_WS_X11
diff --git a/src/corelib/core/mcomponentdata.h b/src/corelib/core/mcomponentdata.h
index 5e3e6fc6..9057ba8d 100644
--- a/src/corelib/core/mcomponentdata.h
+++ b/src/corelib/core/mcomponentdata.h
@@ -175,21 +175,25 @@ public:
static bool isOrientationForced();
+#ifdef Q_WS_X11
+ typedef QPair<WId,QString> ChainData;
+
/**
- * Pushes a window id to the stack of chained window ids
- * \param X11 window id of parent window
+ * Pushes a ChainData onto the stack of chain data
+ * \param chain data
*/
- static void pushChainedWindowId(const WId &parentWindowId);
+ static void pushChainData(const ChainData &chainData);
/**
- * Pops a window id off the stack of chained window ids
+ * Pops a ChainData off the stack of chained window ids
*/
- static WId popChainedWindowId();
+ static ChainData popChainData();
/**
- * Returns if the chained windiw id stack is empty
+ * Returns if the chained ChainData stack is empty
*/
- static bool chainedWindowIdStackIsEmpty();
+ static bool chainDataStackIsEmpty();
+#endif // Q_WS_X11
//! \internal_end
Q_SIGNALS:
diff --git a/src/corelib/core/mcomponentdata_p.h b/src/corelib/core/mcomponentdata_p.h
index db9847c3..0717a3e4 100644
--- a/src/corelib/core/mcomponentdata_p.h
+++ b/src/corelib/core/mcomponentdata_p.h
@@ -21,9 +21,9 @@
#define MCOMPONENTDATA_P_H
#include <QObject>
-#include <QStack>
#include <MLocale>
#ifdef Q_WS_X11
+#include <QStack>
#include <X11/Xlib.h>
#endif
@@ -82,7 +82,7 @@ public:
#endif
#ifdef Q_WS_X11
- static QStack<WId> chainedWinIds;
+ static QStack<MComponentData::ChainData> chainData;
#endif
protected:
diff --git a/src/corelib/widgets/mapplicationwindow.cpp b/src/corelib/widgets/mapplicationwindow.cpp
index d3b99958..338cf346 100644
--- a/src/corelib/widgets/mapplicationwindow.cpp
+++ b/src/corelib/widgets/mapplicationwindow.cpp
@@ -45,6 +45,7 @@
#include "mscene.h"
#include "mstatusbar.h"
#include "mdeviceprofile.h"
+#include "mcomponentdata.h"
#include <QList>
#include <QEvent>
@@ -91,6 +92,7 @@ MApplicationWindowPrivate::MApplicationWindowPrivate()
, pageAreaMaximized(false)
, isChained(false)
, chainParentWinId(0)
+ , chainTaskTitle()
#ifdef HAVE_CONTEXTSUBSCRIBER
, callStatusProperty("Phone.Call")
#endif
@@ -137,10 +139,23 @@ void MApplicationWindowPrivate::init()
q, SLOT(_q_placeToolBar(M::Orientation)));
#ifdef Q_WS_X11
- if ( !MComponentData::chainedWindowIdStackIsEmpty() ) {
- chainParentWinId = MComponentData::popChainedWindowId();
+ if (!MComponentData::chainDataStackIsEmpty()) {
+ MComponentData::ChainData thisData = MComponentData::popChainData();
+
+ WId thisDataWId = thisData.first;
+ QString thisDataTaskTitle = thisData.second;
+
+ chainParentWinId = thisDataWId;
+ bool taskTitleSet = !thisDataTaskTitle.isEmpty();
+ if (taskTitleSet) {
+ chainTaskTitle = thisDataTaskTitle;
+ } else {
+ chainTaskTitle = MComponentData::appName();
+ }
+
isChained = true;
+ // for compositor page animation
setWindowChainedProperty( chainParentWinId, q->winId() );
}
addMStatusBarOverlayProperty();
@@ -162,7 +177,7 @@ void MApplicationWindowPrivate::init()
q->connect(menu, SIGNAL(disappeared()),
q, SLOT(_q_menuDisappeared()));
- if (!MApplication::fullScreen() && statusBar ) {
+ if (!MApplication::fullScreen() && statusBar) {
sceneManager->appearSceneWindowNow(statusBar);
}
@@ -693,6 +708,9 @@ void MApplicationWindowPrivate::sceneWindowAppearEvent(MSceneWindowEvent *event)
if ( page ) {
page->setEscapeMode( MApplicationPageModel::EscapeManualBack );
QObject::connect( page, SIGNAL( backButtonClicked() ), q, SLOT( close() ) );
+
+ // for title in task switcher
+ page->setTitle( chainTaskTitle );
}
}
}
diff --git a/src/corelib/widgets/mapplicationwindow_p.h b/src/corelib/widgets/mapplicationwindow_p.h
index 58836951..3bd2fb91 100644
--- a/src/corelib/widgets/mapplicationwindow_p.h
+++ b/src/corelib/widgets/mapplicationwindow_p.h
@@ -67,8 +67,9 @@ public:
bool isMenuOpen;
bool pageAreaMaximized;
#ifdef Q_WS_X11
- bool isChained;
- WId chainParentWinId;
+ bool isChained;
+ WId chainParentWinId;
+ QString chainTaskTitle;
#endif
#ifdef HAVE_CONTEXTSUBSCRIBER
diff --git a/tests/ft_mservicefwgen/ftmservicefwgen1.cpp.correct b/tests/ft_mservicefwgen/ftmservicefwgen1.cpp.correct
index 0c6b28fc..59dc3790 100644
--- a/tests/ft_mservicefwgen/ftmservicefwgen1.cpp.correct
+++ b/tests/ft_mservicefwgen/ftmservicefwgen1.cpp.correct
@@ -10,7 +10,12 @@ namespace fakegalleryserviceinterface {
void FtMServiceFwGen1::bug172441()
{
- static_cast<FtMServiceFwGen1Proxy*>(interfaceProxy())->bug172441();
+ bug172441( QString() );
+}
+
+void FtMServiceFwGen1::bug172441( const QString &_taskTitle )
+{
+ static_cast<FtMServiceFwGen1Proxy*>(interfaceProxy())->bug172441( _taskTitle );
}
bool FtMServiceFwGen1::showGridWithCapturedContent( int limit )
@@ -25,7 +30,12 @@ bool FtMServiceFwGen1::showImage( const QString &uri, const QString &playlistNam
void FtMServiceFwGen1::showImage( const QString &uri, const QStringList &uriList )
{
- static_cast<FtMServiceFwGen1Proxy*>(interfaceProxy())->showImage( uri, uriList );
+ showImage( uri, uriList, QString() );
+}
+
+void FtMServiceFwGen1::showImage( const QString &uri, const QStringList &uriList, const QString &_taskTitle )
+{
+ static_cast<FtMServiceFwGen1Proxy*>(interfaceProxy())->showImage( uri, uriList, _taskTitle );
}
bool FtMServiceFwGen1::showPage( const QString &targetPage, const QString &previousPage )
diff --git a/tests/ft_mservicefwgen/ftmservicefwgen1.h.correct b/tests/ft_mservicefwgen/ftmservicefwgen1.h.correct
index 106b86dd..40bd4a5d 100644
--- a/tests/ft_mservicefwgen/ftmservicefwgen1.h.correct
+++ b/tests/ft_mservicefwgen/ftmservicefwgen1.h.correct
@@ -18,9 +18,11 @@ Q_OBJECT
public:
void bug172441();
+ void bug172441( const QString &_taskTitle );
bool showGridWithCapturedContent( int limit );
bool showImage( const QString &uri, const QString &playlistName, const QString &defaultBackPage );
void showImage( const QString &uri, const QStringList &uriList );
+ void showImage( const QString &uri, const QStringList &uriList, const QString &_taskTitle );
bool showPage( const QString &targetPage, const QString &previousPage );
bool showSettings();
diff --git a/tests/ft_mservicefwgen/ftmservicefwgen1adaptor.cpp.correct b/tests/ft_mservicefwgen/ftmservicefwgen1adaptor.cpp.correct
index daa00fad..c5c6a35f 100644
--- a/tests/ft_mservicefwgen/ftmservicefwgen1adaptor.cpp.correct
+++ b/tests/ft_mservicefwgen/ftmservicefwgen1adaptor.cpp.correct
@@ -10,16 +10,9 @@
#include "ftmservicefwgen1adaptor.h"
-#include <MApplication>
-#include <MApplicationPage>
-#include <MApplicationWindow>
+#include <MComponentData>
#include <MDebug>
-#ifdef Q_WS_X11
-#include <QX11Info>
-#include <X11/Xlib.h>
-#endif // Q_WS_X11
-
#include <QtCore/QMetaObject>
#include <QtCore/QByteArray>
#include <QtCore/QList>
@@ -35,8 +28,7 @@ namespace fakegalleryserviceinterface {
*/
FtMServiceFwGen1Adaptor::FtMServiceFwGen1Adaptor(QObject *parent)
- : QDBusAbstractAdaptor(parent),
- windowId(-1)
+ : QDBusAbstractAdaptor(parent)
{
// constructor
setAutoRelaySignals(true);
@@ -47,36 +39,13 @@ FtMServiceFwGen1Adaptor::~FtMServiceFwGen1Adaptor()
// destructor
}
-void FtMServiceFwGen1Adaptor::bug172441(const uint windowId)
+void FtMServiceFwGen1Adaptor::bug172441(const uint _windowId, const QString _taskTitle)
{
- this->windowId = windowId;
+ MComponentData::ChainData thisData( _windowId, _taskTitle );
+ MComponentData::pushChainData( thisData );
// handle method call com.nokia.fakegalleryserviceinterface.bug172441
QMetaObject::invokeMethod(parent(), "bug172441");
-
- MApplicationWindow *appWindow = MApplication::activeApplicationWindow();
- if (appWindow != 0) {
-
- MApplicationPage *currentPage = appWindow->currentPage();
-
- if ( currentPage != 0 ) {
- currentPage->setEscapeMode( MApplicationPageModel::EscapeManualBack );
- // connect to the back button - assumes the above method opens a
- // new window and so the window referred to below is already the top one
- connect(currentPage, SIGNAL(backButtonClicked()),
- this, SLOT(goBack()));
- } else {
- mDebug( __PRETTY_FUNCTION__ ) << "No currentPage! - broken chain";
- }
- } else {
- mDebug( __PRETTY_FUNCTION__ ) << "No activeApplicationWindow! - broken chain";
- }
-
-#ifdef Q_WS_X11
- // update the X server
- XSetTransientForHint(QX11Info::display(), appWindow->winId(), windowId);
-#endif // Q_WS_X11
-
}
bool FtMServiceFwGen1Adaptor::showGridWithCapturedContent(int limit)
@@ -95,36 +64,13 @@ bool FtMServiceFwGen1Adaptor::showImage(const QString &uri, const QString &playl
return out0;
}
-void FtMServiceFwGen1Adaptor::showImage(const uint windowId, const QString &uri, const QStringList &uriList)
+void FtMServiceFwGen1Adaptor::showImage(const uint _windowId, const QString _taskTitle, const QString &uri, const QStringList &uriList)
{
- this->windowId = windowId;
+ MComponentData::ChainData thisData( _windowId, _taskTitle );
+ MComponentData::pushChainData( thisData );
// handle method call com.nokia.fakegalleryserviceinterface.showImage
QMetaObject::invokeMethod(parent(), "showImage", Q_ARG(QString, uri), Q_ARG(QStringList, uriList));
-
- MApplicationWindow *appWindow = MApplication::activeApplicationWindow();
- if (appWindow != 0) {
-
- MApplicationPage *currentPage = appWindow->currentPage();
-
- if ( currentPage != 0 ) {
- currentPage->setEscapeMode( MApplicationPageModel::EscapeManualBack );
- // connect to the back button - assumes the above method opens a
- // new window and so the window referred to below is already the top one
- connect(currentPage, SIGNAL(backButtonClicked()),
- this, SLOT(goBack()));
- } else {
- mDebug( __PRETTY_FUNCTION__ ) << "No currentPage! - broken chain";
- }
- } else {
- mDebug( __PRETTY_FUNCTION__ ) << "No activeApplicationWindow! - broken chain";
- }
-
-#ifdef Q_WS_X11
- // update the X server
- XSetTransientForHint(QX11Info::display(), appWindow->winId(), windowId);
-#endif // Q_WS_X11
-
}
bool FtMServiceFwGen1Adaptor::showPage(const QString &targetPage, const QString &previousPage)
@@ -143,19 +89,5 @@ bool FtMServiceFwGen1Adaptor::showSettings()
return out0;
}
-void FtMServiceFwGen1Adaptor::goBack()
-{
- bool backServiceRegistered = ( windowId != -1 );
- if ( backServiceRegistered ) {
- // All we need to do is close the window as it has the WM_TRANSIENT_FOR set
- // the compositor should bring out the parent window
- MApplicationWindow *appWindow = MApplication::activeApplicationWindow();
- if ( appWindow != 0 ) {
- appWindow->close();
- }
- } else {
- qWarning() << "backService is not registered: not going back";
- }
-}
}; // namespace
diff --git a/tests/ft_mservicefwgen/ftmservicefwgen1adaptor.h.correct b/tests/ft_mservicefwgen/ftmservicefwgen1adaptor.h.correct
index aa66033f..3078ba94 100644
--- a/tests/ft_mservicefwgen/ftmservicefwgen1adaptor.h.correct
+++ b/tests/ft_mservicefwgen/ftmservicefwgen1adaptor.h.correct
@@ -45,7 +45,8 @@ class FtMServiceFwGen1Adaptor: public QDBusAbstractAdaptor
" <arg direction=\"out\" type=\"b\" name=\"\"/>\n"
" </method>\n"
" <method name=\"showImage\">\n"
-" <arg direction=\"in\" type=\"u\" name=\"windowId\"/>\n"
+" <arg direction=\"in\" type=\"u\" name=\"_windowId\"/>\n"
+" <arg direction=\"in\" type=\"u\" name=\"_taskTitle\"/>\n"
" <arg direction=\"in\" type=\"s\" name=\"uri\"/>\n"
" <arg direction=\"in\" type=\"as\" name=\"uriList\"/>\n"
" </method>\n"
@@ -57,7 +58,8 @@ class FtMServiceFwGen1Adaptor: public QDBusAbstractAdaptor
" <arg direction=\"out\" type=\"b\" name=\"\"/>\n"
" </method>\n"
" <method name=\"bug172441\">\n"
-" <arg direction=\"in\" type=\"u\" name=\"windowId\"/>\n"
+" <arg direction=\"in\" type=\"u\" name=\"_windowId\"/>\n"
+" <arg direction=\"in\" type=\"u\" name=\"_taskTitle\"/>\n"
" </method>\n"
" </interface>\n"
"")
@@ -67,17 +69,12 @@ public:
public: // PROPERTIES
public Q_SLOTS: // METHODS
- void bug172441(const uint windowId);
+ void bug172441(const uint _windowId, const QString _taskTitle);
bool showGridWithCapturedContent(int limit);
bool showImage(const QString &uri, const QString &playlistName, const QString &defaultBackPage);
- Q_NOREPLY void showImage(const uint windowId, const QString &uri, const QStringList &uriList);
+ Q_NOREPLY void showImage(const uint _windowId, const QString _taskTitle, const QString &uri, const QStringList &uriList);
bool showPage(const QString &targetPage, const QString &previousPage);
bool showSettings();
- void goBack();
-
-private:
- int windowId;
-
Q_SIGNALS: // SIGNALS
};
diff --git a/tests/ft_mservicefwgen/ftmservicefwgen1proxy.h.correct b/tests/ft_mservicefwgen/ftmservicefwgen1proxy.h.correct
index d34187fc..1707db26 100644
--- a/tests/ft_mservicefwgen/ftmservicefwgen1proxy.h.correct
+++ b/tests/ft_mservicefwgen/ftmservicefwgen1proxy.h.correct
@@ -49,7 +49,7 @@ public:
~FtMServiceFwGen1Proxy();
public Q_SLOTS: // METHODS
- inline QDBusPendingReply<> bug172441()
+ inline QDBusPendingReply<> bug172441(const QString &_taskTitle)
{
Qt::HANDLE windowId = 0;
@@ -60,6 +60,7 @@ public Q_SLOTS: // METHODS
QList<QVariant> argumentList;
argumentList << qVariantFromValue((uint)windowId);
+ argumentList << qVariantFromValue(_taskTitle);
return asyncCallWithArgumentList(QLatin1String("bug172441"), argumentList);
}
@@ -77,7 +78,7 @@ public Q_SLOTS: // METHODS
return asyncCallWithArgumentList(QLatin1String("showImage"), argumentList);
}
- inline QDBusPendingReply<> showImage(const QString &uri, const QStringList &uriList)
+ inline QDBusPendingReply<> showImage(const QString &uri, const QStringList &uriList, const QString &_taskTitle)
{
Qt::HANDLE windowId = 0;
@@ -88,6 +89,7 @@ public Q_SLOTS: // METHODS
QList<QVariant> argumentList;
argumentList << qVariantFromValue((uint)windowId);
+ argumentList << qVariantFromValue(_taskTitle);
argumentList << qVariantFromValue(uri) << qVariantFromValue(uriList);
return asyncCallWithArgumentList(QLatin1String("showImage"), argumentList);
}
diff --git a/tests/ft_mservicefwgen/ftmservicefwgen2.cpp.correct b/tests/ft_mservicefwgen/ftmservicefwgen2.cpp.correct
index 892e6624..ebadb2bf 100644
--- a/tests/ft_mservicefwgen/ftmservicefwgen2.cpp.correct
+++ b/tests/ft_mservicefwgen/ftmservicefwgen2.cpp.correct
@@ -13,7 +13,12 @@ bool FtMServiceFwGen2::showGridWithCapturedContent( int limit )
void FtMServiceFwGen2::showImage( const QString &uri, const QStringList &uriList )
{
- static_cast<FtMServiceFwGen2Proxy*>(interfaceProxy())->showImage( uri, uriList );
+ showImage( uri, uriList, QString() );
+}
+
+void FtMServiceFwGen2::showImage( const QString &uri, const QStringList &uriList, const QString &_taskTitle )
+{
+ static_cast<FtMServiceFwGen2Proxy*>(interfaceProxy())->showImage( uri, uriList, _taskTitle );
}
bool FtMServiceFwGen2::showImage( const QString &uri, const QString &playlistName, const QString &defaultBackPage )
diff --git a/tests/ft_mservicefwgen/ftmservicefwgen2.h.correct b/tests/ft_mservicefwgen/ftmservicefwgen2.h.correct
index acbb6663..c4425fd3 100644
--- a/tests/ft_mservicefwgen/ftmservicefwgen2.h.correct
+++ b/tests/ft_mservicefwgen/ftmservicefwgen2.h.correct
@@ -33,6 +33,7 @@ public:
* @details documentation for showImage(1) method2
*/
void showImage( const QString &uri, const QStringList &uriList );
+ void showImage( const QString &uri, const QStringList &uriList, const QString &_taskTitle );
/**
* @brief documentation for showImage() method
diff --git a/tests/ft_mservicefwgen/ftmservicefwgen2adaptor.cpp.correct b/tests/ft_mservicefwgen/ftmservicefwgen2adaptor.cpp.correct
index 75f095ab..d6c453a7 100644
--- a/tests/ft_mservicefwgen/ftmservicefwgen2adaptor.cpp.correct
+++ b/tests/ft_mservicefwgen/ftmservicefwgen2adaptor.cpp.correct
@@ -10,16 +10,9 @@
#include "ftmservicefwgen2adaptor.h"
-#include <MApplication>
-#include <MApplicationPage>
-#include <MApplicationWindow>
+#include <MComponentData>
#include <MDebug>
-#ifdef Q_WS_X11
-#include <QX11Info>
-#include <X11/Xlib.h>
-#endif // Q_WS_X11
-
#include <QtCore/QMetaObject>
#include <QtCore/QByteArray>
#include <QtCore/QList>
@@ -33,8 +26,7 @@
*/
FtMServiceFwGen2Adaptor::FtMServiceFwGen2Adaptor(QObject *parent)
- : QDBusAbstractAdaptor(parent),
- windowId(-1)
+ : QDBusAbstractAdaptor(parent)
{
// constructor
setAutoRelaySignals(true);
@@ -53,36 +45,13 @@ bool FtMServiceFwGen2Adaptor::showGridWithCapturedContent(int limit)
return out0;
}
-void FtMServiceFwGen2Adaptor::showImage(const uint windowId, const QString &uri, const QStringList &uriList)
+void FtMServiceFwGen2Adaptor::showImage(const uint _windowId, const QString _taskTitle, const QString &uri, const QStringList &uriList)
{
- this->windowId = windowId;
+ MComponentData::ChainData thisData( _windowId, _taskTitle );
+ MComponentData::pushChainData( thisData );
// handle method call com.nokia.fakegalleryserviceinterface.showImage
QMetaObject::invokeMethod(parent(), "showImage", Q_ARG(QString, uri), Q_ARG(QStringList, uriList));
-
- MApplicationWindow *appWindow = MApplication::activeApplicationWindow();
- if (appWindow != 0) {
-
- MApplicationPage *currentPage = appWindow->currentPage();
-
- if ( currentPage != 0 ) {
- currentPage->setEscapeMode( MApplicationPageModel::EscapeManualBack );
- // connect to the back button - assumes the above method opens a
- // new window and so the window referred to below is already the top one
- connect(currentPage, SIGNAL(backButtonClicked()),
- this, SLOT(goBack()));
- } else {
- mDebug( __PRETTY_FUNCTION__ ) << "No currentPage! - broken chain";
- }
- } else {
- mDebug( __PRETTY_FUNCTION__ ) << "No activeApplicationWindow! - broken chain";
- }
-
-#ifdef Q_WS_X11
- // update the X server
- XSetTransientForHint(QX11Info::display(), appWindow->winId(), windowId);
-#endif // Q_WS_X11
-
}
bool FtMServiceFwGen2Adaptor::showImage(const QString &uri, const QString &playlistName, const QString &defaultBackPage)
@@ -109,17 +78,3 @@ bool FtMServiceFwGen2Adaptor::showSettings()
return out0;
}
-void FtMServiceFwGen2Adaptor::goBack()
-{
- bool backServiceRegistered = ( windowId != -1 );
- if ( backServiceRegistered ) {
- // All we need to do is close the window as it has the WM_TRANSIENT_FOR set
- // the compositor should bring out the parent window
- MApplicationWindow *appWindow = MApplication::activeApplicationWindow();
- if ( appWindow != 0 ) {
- appWindow->close();
- }
- } else {
- qWarning() << "backService is not registered: not going back";
- }
-}
diff --git a/tests/ft_mservicefwgen/ftmservicefwgen2adaptor.h.correct b/tests/ft_mservicefwgen/ftmservicefwgen2adaptor.h.correct
index f01b24a8..45609371 100644
--- a/tests/ft_mservicefwgen/ftmservicefwgen2adaptor.h.correct
+++ b/tests/ft_mservicefwgen/ftmservicefwgen2adaptor.h.correct
@@ -42,7 +42,8 @@ class FtMServiceFwGen2Adaptor: public QDBusAbstractAdaptor
" <arg direction=\"out\" type=\"b\" name=\"\"/>\n"
" </method>\n"
" <method name=\"showImage\">\n"
-" <arg direction=\"in\" type=\"u\" name=\"windowId\"/>\n"
+" <arg direction=\"in\" type=\"u\" name=\"_windowId\"/>\n"
+" <arg direction=\"in\" type=\"u\" name=\"_taskTitle\"/>\n"
" <arg direction=\"in\" type=\"s\" name=\"uri\"/>\n"
" <arg direction=\"in\" type=\"as\" name=\"uriList\"/>\n"
" </method>\n"
@@ -62,15 +63,10 @@ public:
public: // PROPERTIES
public Q_SLOTS: // METHODS
bool showGridWithCapturedContent(int limit);
- Q_NOREPLY void showImage(const uint windowId, const QString &uri, const QStringList &uriList);
+ Q_NOREPLY void showImage(const uint _windowId, const QString _taskTitle, const QString &uri, const QStringList &uriList);
bool showImage(const QString &uri, const QString &playlistName, const QString &defaultBackPage);
bool showPage(const QString &targetPage, const QString &previousPage);
bool showSettings();
- void goBack();
-
-private:
- int windowId;
-
Q_SIGNALS: // SIGNALS
};
diff --git a/tests/ft_mservicefwgen/ftmservicefwgen2proxy.h.correct b/tests/ft_mservicefwgen/ftmservicefwgen2proxy.h.correct
index f409a732..5179cbb5 100644
--- a/tests/ft_mservicefwgen/ftmservicefwgen2proxy.h.correct
+++ b/tests/ft_mservicefwgen/ftmservicefwgen2proxy.h.correct
@@ -54,7 +54,7 @@ public Q_SLOTS: // METHODS
return asyncCallWithArgumentList(QLatin1String("showGridWithCapturedContent"), argumentList);
}
- inline QDBusPendingReply<> showImage(const QString &uri, const QStringList &uriList)
+ inline QDBusPendingReply<> showImage(const QString &uri, const QStringList &uriList, const QString &_taskTitle)
{
Qt::HANDLE windowId = 0;
@@ -65,6 +65,7 @@ public Q_SLOTS: // METHODS
QList<QVariant> argumentList;
argumentList << qVariantFromValue((uint)windowId);
+ argumentList << qVariantFromValue(_taskTitle);
argumentList << qVariantFromValue(uri) << qVariantFromValue(uriList);
return asyncCallWithArgumentList(QLatin1String("showImage"), argumentList);
}
diff --git a/tools/m-servicefwgen.d/m-servicefwgen.cpp b/tools/m-servicefwgen.d/m-servicefwgen.cpp
index 90707360..76030ec7 100644
--- a/tools/m-servicefwgen.d/m-servicefwgen.cpp
+++ b/tools/m-servicefwgen.d/m-servicefwgen.cpp
@@ -782,8 +782,49 @@ void removeNewXmlFile()
newXmlFile.remove();
}
+QString stripOffDefaultValue(const QString &parameters)
+{
+ QString retVal;
+
+ QString myParameters = parameters;
+
+ bool startsWithSpace = myParameters.startsWith(" ");
+ if ( startsWithSpace ) {
+ myParameters.replace( QRegExp( "^ " ), "" );
+ }
+
+ bool endsWithSpace = myParameters.endsWith(" ");
+ if ( endsWithSpace ) {
+ myParameters.replace( QRegExp( " $" ), "" );
+ }
+
+ QStringList typesAndNamesWithoutDefaults;
+ QStringList typesAndNames = myParameters.split(QRegExp("\\s*,\\s*"));
+
+ for (int typeAndNameIndex = 0; typeAndNameIndex < typesAndNames.size(); ++typeAndNameIndex) {
+ QString typeAndName(typesAndNames[ typeAndNameIndex ]);
+
+ // strip off default value for parameter, if there is one
+ if ( typeAndName.contains( "=" ) ) {
+ typeAndName = typeAndName.split("=").first();
+ }
-QStringList getParamNames(QString parameters)
+ typesAndNamesWithoutDefaults << typeAndName;
+ }
+
+ retVal = typesAndNamesWithoutDefaults.join(", ");
+
+ if (startsWithSpace) {
+ retVal = " "+retVal;
+ }
+ if (endsWithSpace) {
+ retVal = retVal+" ";
+ }
+
+ return retVal;
+}
+
+QStringList getParamNames(const QString &parameters)
{
QStringList retVal;
@@ -791,6 +832,9 @@ QStringList getParamNames(QString parameters)
for (int typeAndNameIndex = 0; typeAndNameIndex < typesAndNames.size(); ++typeAndNameIndex) {
QString typeAndName(typesAndNames[ typeAndNameIndex ]);
+
+ typeAndName = stripOffDefaultValue( typeAndName );
+
QStringList bits = typeAndName.split(QRegExp("\\W+"));
QString name = bits.last();
@@ -848,17 +892,13 @@ void processAdaptorCppFile()
"#include <MComponentData>\n" \
"#include <MDebug>\n" \
"\n" \
- "#ifdef Q_WS_X11\n" \
- "#include <QX11Info>\n" \
- "#include <X11/Xlib.h>\n" \
- "#endif // Q_WS_X11\n" \
- "\n"
+ line + "\n";
} else if (inChainTask) {
line.remove(w.chainTag());
if (line == "{") {
outS << line << endl
- << " MComponentData::pushChainedWindowId( windowId );" << endl
+ << " MComponentData::ChainData thisData( _windowId, _taskTitle );" << endl
+ << " MComponentData::pushChainData( thisData );" << endl
<< endl;
} else if (line.contains("return") || line == "}") {
// match end of function - need to add the connect *before* the return, if there is one
@@ -869,7 +909,7 @@ void processAdaptorCppFile()
}
} else if (line.contains(w.chainTag())) {
line.remove(w.chainTag());
- QString parameterString = "(const uint windowId";
+ QString parameterString = "(const uint _windowId, const QString _taskTitle";
bool methodHasParameters = !line.contains( QRegExp( "\\(\\s*\\)" ));
if ( methodHasParameters ) {
@@ -986,7 +1026,8 @@ void processAdaptorHeaderFile()
// this has to be printed after the method tag, above
if (isChainTask) {
newAdaptorHeaderStream
- << "\" <arg direction=\\\"in\\\" type=\\\"u\\\" name=\\\"windowId\\\"/>\\n\"" << endl;
+ << "\" <arg direction=\\\"in\\\" type=\\\"u\\\" name=\\\"_windowId\\\"/>\\n\"" << endl
+ << "\" <arg direction=\\\"in\\\" type=\\\"u\\\" name=\\\"_taskTitle\\\"/>\\n\"" << endl;
if ( chainTaskHasNoParameters ) {
newAdaptorHeaderStream
<< "\" </method>\\n\"" << endl;
@@ -1020,7 +1061,7 @@ void processAdaptorHeaderFile()
hasChains = true;
line.remove(w.chainTag());
- QString parameterString = "(const uint windowId";
+ QString parameterString = "(const uint _windowId, const QString _taskTitle";
bool methodHasParameters = !line.contains( QRegExp( "\\(\\s*\\)" ));
if ( methodHasParameters ) {
@@ -1057,7 +1098,6 @@ void processAdaptorHeaderFile()
removeNewXmlFile();
}
-
// this method generates the code that is needed for chaining of tasks
void doChainTaskHandling( QString line, bool& inChainTask, QTextStream& newProxyHeaderStream )
{
@@ -1080,19 +1120,27 @@ void doChainTaskHandling( QString line, bool& inChainTask, QTextStream& newProxy
}\n\
\n\
" + line + "\n\
- argumentList << qVariantFromValue((uint)windowId);\n";
+ argumentList << qVariantFromValue((uint)windowId);\n\
+ argumentList << qVariantFromValue(_taskTitle);\n";
}
else if (line.contains("return")) {
line.remove(w.chainTag());
- newProxyHeaderStream << line << "\n";
+ newProxyHeaderStream << line << endl;
inChainTask = false;
}
else {
- newProxyHeaderStream << line << "\n";
+ newProxyHeaderStream << line << endl;
}
}
else if (line.contains(w.chainTag())) {
line.remove(w.chainTag());
+ bool hasNoParams = line.endsWith( "()" );
+
+ if ( hasNoParams ) {
+ line.replace( ")", "const QString &_taskTitle)" );
+ } else {
+ line.replace( ")", ", const QString &_taskTitle)" );
+ }
newProxyHeaderStream << line << "\n";
inChainTask = true;
}
@@ -1114,8 +1162,6 @@ void processProxyHeaderFile()
if the line matches "class ...", we generate a doxygen
documentation snippet, if needed.
-
-
*/
QFile proxyHeaderFile(w.proxyHeaderFileName());
@@ -1233,17 +1279,57 @@ void processProxyHeaderFile()
if (line.contains("Q_SIGNALS:")) {
inSignalSection = true;
} else {
- QRegExp matchThis("inline\\s+QDBusPendingReply<([^>]*)>\\s*(\\w+)\\(([^)]*)\\)");
+ QRegExp methodPrototype("inline\\s+QDBusPendingReply<([^>]*)>\\s*(\\w+)\\(([^)]*)\\)");
- if (line.contains(matchThis)) {
- QString returnType = matchThis.cap(1);
- QString methodName = matchThis.cap(2);
- QString parameters = matchThis.cap(3);
+ if (line.contains(methodPrototype)) {
+ QString returnType = methodPrototype.cap(1);
+ QString methodName = methodPrototype.cap(2);
+ QString parameters = methodPrototype.cap(3);
if (returnType.isEmpty()) {
returnType = "void";
}
+ if ( inChainTask ) {
+ QStringList paramNames = getParamNames(parameters);
+
+ QString paramString;
+ if ( parameters.isEmpty() ) {
+ paramString = "";
+ } else {
+ paramString = " "+parameters+" ";
+ }
+
+ wrapperHeaderStream <<
+ " " + returnType + " " + methodName + "(" + paramString + ");" << endl;
+
+ wrapperCppStream <<
+ returnType + " " + w.upperCamelServiceName() + "::" + methodName + "(" + paramString + ")" << endl;
+
+ wrapperCppStream << "{" << endl;
+
+ if ( parameters.isEmpty() ) {
+ paramString = " QString() ";
+ } else {
+ paramString = " " + paramNames.join(", ") + ", QString() ";
+ }
+
+ if (returnType == "void") {
+ wrapperCppStream <<
+ " " + methodName + "(" + paramString + ");" << endl;
+ } else {
+ wrapperCppStream <<
+ " return " + methodName + "(" + paramString + ");" << endl;
+ }
+
+ wrapperCppStream << "}\n" << endl;
+
+ if ( !parameters.isEmpty() ) {
+ parameters += ", ";
+ }
+ parameters += "const QString &_taskTitle";
+ }
+
QStringList paramNames = getParamNames(parameters);
QString paramString;
@@ -1259,14 +1345,14 @@ void processProxyHeaderFile()
wrapperCppStream <<
returnType + " " + w.upperCamelServiceName() + "::" + methodName + "(" + paramString + ")" << endl;
- wrapperCppStream <<
-"{" << endl;
+ wrapperCppStream << "{" << endl;
if ( parameters.isEmpty() ) {
paramString = "";
} else {
- paramString = " " + paramNames.join(", ")+" ";
+ paramString = " " + paramNames.join(", ") + " ";
}
+
if (returnType == "void") {
wrapperCppStream <<
" static_cast<" + w.upperCamelServiceName() + "Proxy*>(interfaceProxy())->" + methodName + "(" + paramString + ");" << endl;
@@ -1274,6 +1360,7 @@ void processProxyHeaderFile()
wrapperCppStream <<
" return qobject_cast<" + w.upperCamelServiceName() + "Proxy*>(interfaceProxy())->" + methodName + "(" + paramString + ").value();" << endl;
}
+
wrapperCppStream << "}\n" << endl;
}
}