# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1284701665 -10800 # Node ID 3d09643def13eba1c294ee4b0303ef24b4024052 # Parent 9d760f716ca85b00b295b1f0b363e3605eb90189 Revision: 201035 Kit: 201037 diff -r 9d760f716ca8 -r 3d09643def13 .gitignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.gitignore Fri Sep 17 08:34:25 2010 +0300 @@ -0,0 +1,31 @@ +.obj +*.moc +Makefile* +*.so.* +*.so +*.so.debug +*.o +*~ +.cd.rc +*.swp +core +moc_*.cpp +*.Debug +*.Release +*.pdb +*.idb +*.ib_pdb_index +*.bak +*.make.examples +*.cache + +#Carbide project files +*.project +plugin_commonU.def + +#Visual Studio files +*.sln +*.vcproj + +#QtCreator project files +*.pro.user diff -r 9d760f716ca8 -r 3d09643def13 VERSION.SHA1 --- a/VERSION.SHA1 Thu Sep 02 21:20:48 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -72d85e1da50c07243ae188eae91d0130fa60b5c6 diff -r 9d760f716ca8 -r 3d09643def13 layers.sysdef.xml --- a/layers.sysdef.xml Thu Sep 02 21:20:48 2010 +0300 +++ b/layers.sysdef.xml Fri Sep 17 08:34:25 2010 +0300 @@ -22,7 +22,7 @@ - + diff -r 9d760f716ca8 -r 3d09643def13 qthighway/bwins/xqserviceu.def --- a/qthighway/bwins/xqserviceu.def Thu Sep 02 21:20:48 2010 +0300 +++ b/qthighway/bwins/xqserviceu.def Fri Sep 17 08:34:25 2010 +0300 @@ -192,4 +192,8 @@ ?getDrmAttributes@XQApplicationManager@@QAE_NABVXQSharableFile@@ABV?$QList@H@@AAV?$QList@VQVariant@@@@@Z @ 191 NONAME ; bool XQApplicationManager::getDrmAttributes(class XQSharableFile const &, class QList const &, class QList &) ?getDrmAttributes@XQApplicationManager@@QAE_NABVQFile@@ABV?$QList@H@@AAV?$QList@VQVariant@@@@@Z @ 192 NONAME ; bool XQApplicationManager::getDrmAttributes(class QFile const &, class QList const &, class QList &) ?status@XQApplicationManager@@QAE?AW4ServiceStatus@1@ABVXQAiwInterfaceDescriptor@@@Z @ 193 NONAME ; enum XQApplicationManager::ServiceStatus XQApplicationManager::status(class XQAiwInterfaceDescriptor const &) + ?serviceStarted@XQApplicationManager@@IAEXVXQAiwInterfaceDescriptor@@@Z @ 194 NONAME ; void XQApplicationManager::serviceStarted(class XQAiwInterfaceDescriptor) + ?notifyRunning@XQApplicationManager@@QAE_NAAVXQAiwInterfaceDescriptor@@@Z @ 195 NONAME ; bool XQApplicationManager::notifyRunning(class XQAiwInterfaceDescriptor &) + ?cancelNotifyRunning@XQApplicationManager@@QAE_NAAVXQAiwInterfaceDescriptor@@@Z @ 196 NONAME ; bool XQApplicationManager::cancelNotifyRunning(class XQAiwInterfaceDescriptor &) + ?serviceStopped@XQApplicationManager@@IAEXVXQAiwInterfaceDescriptor@@@Z @ 197 NONAME ; void XQApplicationManager::serviceStopped(class XQAiwInterfaceDescriptor) diff -r 9d760f716ca8 -r 3d09643def13 qthighway/bwins/xqserviceutilu.def --- a/qthighway/bwins/xqserviceutilu.def Thu Sep 02 21:20:48 2010 +0300 +++ b/qthighway/bwins/xqserviceutilu.def Fri Sep 17 08:34:25 2010 +0300 @@ -86,4 +86,5 @@ ?isEmbedded@XQServiceUtil@@YA_NHPAPAD@Z @ 85 NONAME ; bool XQServiceUtil::isEmbedded(int, char * *) ?isService@XQServiceUtil@@YA_NHPAPAD@Z @ 86 NONAME ; bool XQServiceUtil::isService(int, char * *) ?interfaceName@XQServiceUtil@@YA?AVQString@@HPAPAD@Z @ 87 NONAME ; class QString XQServiceUtil::interfaceName(int, char * *) - + ?serviceIdFromName@XQServiceUtil@@YAIPBD@Z @ 88 NONAME ; unsigned int XQServiceUtil::serviceIdFromName(char const *) + ?closeWhenClientClosed@XQServiceUtils@@YAXXZ @ 89 NONAME ; void XQServiceUtils::closeWhenClientClosed(void) diff -r 9d760f716ca8 -r 3d09643def13 qthighway/eabi/xqserviceu.def --- a/qthighway/eabi/xqserviceu.def Thu Sep 02 21:20:48 2010 +0300 +++ b/qthighway/eabi/xqserviceu.def Fri Sep 17 08:34:25 2010 +0300 @@ -196,4 +196,8 @@ _ZN20XQApplicationManager16getDrmAttributesERK14XQSharableFileRK5QListIiERS3_I8QVariantE @ 195 NONAME _ZN20XQApplicationManager16getDrmAttributesERK5QFileRK5QListIiERS3_I8QVariantE @ 196 NONAME _ZN20XQApplicationManager6statusERK24XQAiwInterfaceDescriptor @ 197 NONAME + _ZN20XQApplicationManager13notifyRunningER24XQAiwInterfaceDescriptor @ 198 NONAME + _ZN20XQApplicationManager14serviceStartedE24XQAiwInterfaceDescriptor @ 199 NONAME + _ZN20XQApplicationManager14serviceStoppedE24XQAiwInterfaceDescriptor @ 200 NONAME + _ZN20XQApplicationManager19cancelNotifyRunningER24XQAiwInterfaceDescriptor @ 201 NONAME diff -r 9d760f716ca8 -r 3d09643def13 qthighway/eabi/xqserviceutilu.def --- a/qthighway/eabi/xqserviceutilu.def Thu Sep 02 21:20:48 2010 +0300 +++ b/qthighway/eabi/xqserviceutilu.def Fri Sep 17 08:34:25 2010 +0300 @@ -101,4 +101,5 @@ _ZN13XQServiceUtil13interfaceNameEiPPc @ 100 NONAME _ZN13XQServiceUtil13operationNameEiPPc @ 101 NONAME _ZN13XQServiceUtil9isServiceEiPPc @ 102 NONAME - + _ZN13XQServiceUtil17serviceIdFromNameEPKc @ 103 NONAME + _ZN14XQServiceUtils21closeWhenClientClosedEv @ 104 NONAME diff -r 9d760f716ca8 -r 3d09643def13 qthighway/examples/appmgrclient/appmgrclient.pro --- a/qthighway/examples/appmgrclient/appmgrclient.pro Thu Sep 02 21:20:48 2010 +0300 +++ b/qthighway/examples/appmgrclient/appmgrclient.pro Fri Sep 17 08:34:25 2010 +0300 @@ -31,5 +31,5 @@ LIBS+=-lxqservice -lxqserviceutil libFiles.sources = xqservice.dll -libFiles.path = "!:\sys\bin" +libFiles.path = "!:/sys/bin" DEPLOYMENT += libFiles diff -r 9d760f716ca8 -r 3d09643def13 qthighway/examples/appmgrclient2/appmgrclient2.pro --- a/qthighway/examples/appmgrclient2/appmgrclient2.pro Thu Sep 02 21:20:48 2010 +0300 +++ b/qthighway/examples/appmgrclient2/appmgrclient2.pro Fri Sep 17 08:34:25 2010 +0300 @@ -31,5 +31,5 @@ LIBS+=-lxqservice -lxqserviceutil libFiles.sources = xqservice.dll -libFiles.path = "!:\sys\bin" +libFiles.path = "!:/sys/bin" DEPLOYMENT += libFiles diff -r 9d760f716ca8 -r 3d09643def13 qthighway/examples/examples.pro --- a/qthighway/examples/examples.pro Thu Sep 02 21:20:48 2010 +0300 +++ b/qthighway/examples/examples.pro Fri Sep 17 08:34:25 2010 +0300 @@ -31,7 +31,8 @@ #include($$[QMAKE_MKSPECS]/features/hb.prf) { #SUBDIRS += \ # hbserviceprovider \ -# hbserviceclient +# hbserviceclient \ +# notifications #} symbian:BLD_INF_RULES.prj_exports += "./rom/xqserviceexamples.iby $$CUSTOMER_VARIANT_APP_LAYER_IBY_EXPORT_PATH(xqserviceexamples.iby)" diff -r 9d760f716ca8 -r 3d09643def13 qthighway/examples/hbserviceclient/hbserviceclient.pro --- a/qthighway/examples/hbserviceclient/hbserviceclient.pro Thu Sep 02 21:20:48 2010 +0300 +++ b/qthighway/examples/hbserviceclient/hbserviceclient.pro Fri Sep 17 08:34:25 2010 +0300 @@ -31,5 +31,5 @@ LIBS+=-lxqservice -lflogger -lxqserviceutil.dll libFiles.sources = hbserviceclient xqservice.dll -libFiles.path = "!:\sys\bin" +libFiles.path = "!:/sys/bin" DEPLOYMENT += libFiles diff -r 9d760f716ca8 -r 3d09643def13 qthighway/examples/hbserviceprovider/hbserviceprovider.pro --- a/qthighway/examples/hbserviceprovider/hbserviceprovider.pro Thu Sep 02 21:20:48 2010 +0300 +++ b/qthighway/examples/hbserviceprovider/hbserviceprovider.pro Fri Sep 17 08:34:25 2010 +0300 @@ -35,7 +35,7 @@ # SERVICE.OPTIONS += hidden libFiles.sources = xqservice.dll -libFiles.path = "!:\sys\bin" +libFiles.path = "!:/sys/bin" DEPLOYMENT += libFiles # TRANSLATIONS=hbserviceprovider.ts diff -r 9d760f716ca8 -r 3d09643def13 qthighway/examples/mimetestapp/mimetestapp.pro --- a/qthighway/examples/mimetestapp/mimetestapp.pro Thu Sep 02 21:20:48 2010 +0300 +++ b/qthighway/examples/mimetestapp/mimetestapp.pro Fri Sep 17 08:34:25 2010 +0300 @@ -30,7 +30,7 @@ LIBS+=-lxqservice -lxqserviceutil libFiles.sources = xqservice.dll -libFiles.path = "!:\sys\bin" +libFiles.path = "!:/sys/bin" DEPLOYMENT += libFiles RSS_RULES += \ diff -r 9d760f716ca8 -r 3d09643def13 qthighway/examples/mimetestapp2/mimetestapp2.pro --- a/qthighway/examples/mimetestapp2/mimetestapp2.pro Thu Sep 02 21:20:48 2010 +0300 +++ b/qthighway/examples/mimetestapp2/mimetestapp2.pro Fri Sep 17 08:34:25 2010 +0300 @@ -34,7 +34,7 @@ LIBS+=-lxqservice -lxqserviceutil libFiles.sources = xqservice.dll -libFiles.path = "!:\sys\bin" +libFiles.path = "!:/sys/bin" DEPLOYMENT += libFiles RSS_RULES += \ diff -r 9d760f716ca8 -r 3d09643def13 qthighway/examples/notifications/client/client.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qthighway/examples/notifications/client/client.pro Fri Sep 17 08:34:25 2010 +0300 @@ -0,0 +1,34 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, version 2.1 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program. If not, +# see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/". +# +# Description: +# + +TEMPLATE = app +TARGET = serviceclient + +symbian: TARGET.UID3 = 0xE0022E72 + +XQSERVICE_ROOT=../../.. +include(../../../xqservicebase.pri) +include(src/serviceclient.pri) + +LIBS+=-lxqservice -lflogger + +libFiles.sources = xqservice.dll +libFiles.path = "!:/sys/bin" +DEPLOYMENT += libFiles diff -r 9d760f716ca8 -r 3d09643def13 qthighway/examples/notifications/client/src/main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qthighway/examples/notifications/client/src/main.cpp Fri Sep 17 08:34:25 2010 +0300 @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published by +* the Free Software Foundation, version 2.1 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License +* along with this program. If not, +* see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/". +* +* Description: +* +*/ + +#include "xqservicelog.h" + +#include +#include "serviceclient.h" + +int main(int argc, char **argv) +{ + // qInstallMsgHandler(XQSERVICEMESSAGEHANDLER); + XQSERVICE_DEBUG_PRINT("ServiceClient::main"); + QApplication a( argc, argv ); + ServiceClient *cl = new ServiceClient(); + cl->show(); + int rv = a.exec(); + delete cl; + return rv; +} + diff -r 9d760f716ca8 -r 3d09643def13 qthighway/examples/notifications/client/src/serviceclient.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qthighway/examples/notifications/client/src/serviceclient.cpp Fri Sep 17 08:34:25 2010 +0300 @@ -0,0 +1,167 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published by +* the Free Software Foundation, version 2.1 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License +* along with this program. If not, +* see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/". +* +* Description: +* +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include +#include "serviceclient.h" + +ServiceClient::ServiceClient(QWidget *parent, Qt::WFlags f) + : QWidget(parent, f) +{ + XQSERVICE_DEBUG_PRINT("ServiceClient::ServiceClient"); + snd = NULL; + /* Adjust the palette */ +#if defined(Q_WS_S60) + QPalette p = qApp->palette(); + QColor color(80,20,20); + QColor bg(256,20,20); + p.setColor(QPalette::Highlight, color.lighter(200)); + p.setColor(QPalette::Text, Qt::white); + p.setColor(QPalette::Base, bg); + p.setColor(QPalette::WindowText, Qt::white); + p.setColor(QPalette::Window, bg); + p.setColor(QPalette::ButtonText, Qt::white); + p.setColor(QPalette::Button, color.lighter(150)); + p.setColor(QPalette::Link, QColor(240,40,40)); + + qApp->setPalette(p); +#endif + + QPushButton *quitButton = new QPushButton(tr("quit")); + connect(quitButton, SIGNAL(clicked()), qApp, SLOT(quit())); + + QPushButton *callButton = new QPushButton(tr("call")); + connect(callButton, SIGNAL(clicked()), this, SLOT(dial())); + + mCheckSync = new QCheckBox("Synchronous send"); + mEmb = new QCheckBox("Embedded"); + mCheckAsyncAnswer = new QCheckBox("Asynchronous Answer"); + mCheckDeleteRequest = new QCheckBox("Delete request"); + mCheckDeleteRequest->setCheckState(Qt::Checked); + + mTextEdit = new QLineEdit("+123456"); + + mTextRetValue = new QLineEdit("no ret value set"); + + QLabel *label = new QLabel("CLIENT TEST"); + + QLabel *status = new QLabel("-- status --"); + + QVBoxLayout *vl = new QVBoxLayout; + vl->setMargin(0); + vl->setSpacing(0); + + vl->addWidget(label); + vl->addWidget(mCheckSync); + vl->addWidget(mCheckAsyncAnswer); + vl->addWidget(mEmb); + vl->addWidget(mCheckDeleteRequest); + vl->addWidget(mTextEdit); + vl->addWidget(mTextRetValue); + vl->addWidget(status); + vl->addStretch(10); + vl->addWidget(callButton); + vl->addWidget(quitButton); + + setLayout(vl); + +#if defined(Q_WS_X11) || defined(Q_WS_WIN) + setFixedSize(QSize(360,640)); // nHD +#elif defined(Q_WS_S60) + showMaximized(); + showFullScreen(); +#endif +} + +ServiceClient::~ServiceClient() +{ + XQSERVICE_DEBUG_PRINT("ServiceClient::~ServiceClient"); +} + +void ServiceClient::dial() +{ + XQSERVICE_DEBUG_PRINT("ServiceClient::dial"); + if (snd) { + delete snd ; + } + mTextRetValue->setText("no ret value set"); + + bool isSync = (mCheckSync->checkState() == Qt::Checked); + bool asyncAnswer = (mCheckAsyncAnswer->checkState() == Qt::Checked); + bool deleteRequest = (mCheckDeleteRequest->checkState() == Qt::Checked); + + snd = mgr.create("com.nokia.services.hbserviceprovider", "dialer", "dial(QString,bool)", isSync); + + QList args; + + args << QVariant(mTextEdit->text()); + args << QVariant(asyncAnswer); + + snd->setArguments(args); + + snd->setEmbedded(mEmb->checkState()); + + if (isSync) { + QVariant retValue; + connect(snd, SIGNAL(requestError(int)), this, SLOT(requestError(int))); + bool ret = snd->send(retValue); + mTextRetValue->setText(retValue.toString()); + } else { + bool ret = snd->send(); + connect(snd, SIGNAL(requestCompleted(QVariant)), this, SLOT(requestCompleted(QVariant))); + connect(snd, SIGNAL(requestError(int)), this, SLOT(requestError(int))); + } + + if (deleteRequest) { + delete snd; + snd = NULL; + } +} + +void ServiceClient::requestCompleted(const QVariant& value) +{ + XQSERVICE_DEBUG_PRINT("ServiceClient::requestCompleted"); + mTextRetValue->setText(value.toString()); +} + +void ServiceClient::requestError(int err) +{ + XQSERVICE_DEBUG_PRINT("ServiceClient::requestError"); + mTextRetValue->setText("error: " + QString::number(err)); +} diff -r 9d760f716ca8 -r 3d09643def13 qthighway/examples/notifications/client/src/serviceclient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qthighway/examples/notifications/client/src/serviceclient.h Fri Sep 17 08:34:25 2010 +0300 @@ -0,0 +1,67 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published by +* the Free Software Foundation, version 2.1 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License +* along with this program. If not, +* see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/". +* +* Description: +* +*/ + +#ifndef SERVICECLIENT_H +#define SERVICECLIENT_H + +#include +#include +#include +#include +#include + +class QLineEdit; +class QCheckBox; +class QLabel; +class XQAiwRequest; + +QT_BEGIN_HEADER +class ServiceClient : public QWidget +{ + Q_OBJECT +public: + ServiceClient( QWidget *parent = 0, Qt::WFlags f = 0 ); + ~ServiceClient(); + +protected slots: + void requestCompleted(const QVariant& value); + void requestError(int err); + +private slots: + void dial(); + +private: + +private: + XQApplicationManager mgr; + QCheckBox* mCheckSync; + QCheckBox* mCheckAsyncAnswer; + QCheckBox* mCheckDeleteRequest; + QCheckBox* mEmb; + QLineEdit *mTextEdit; + QLineEdit *mTextRetValue; + QLabel* mRetunSignal; + QLabel* status; + XQAiwRequest* snd; +}; + + +#endif diff -r 9d760f716ca8 -r 3d09643def13 qthighway/examples/notifications/client/src/serviceclient.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qthighway/examples/notifications/client/src/serviceclient.pri Fri Sep 17 08:34:25 2010 +0300 @@ -0,0 +1,26 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, version 2.1 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program. If not, +# see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/". +# +# Description: +# + +SOURCES=\ + src/main.cpp\ + src/serviceclient.cpp + +HEADERS=\ + src/serviceclient.h diff -r 9d760f716ca8 -r 3d09643def13 qthighway/examples/notifications/notificationreceiver/notificationreceiver.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qthighway/examples/notifications/notificationreceiver/notificationreceiver.pro Fri Sep 17 08:34:25 2010 +0300 @@ -0,0 +1,35 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, version 2.1 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program. If not, +# see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/". +# +# Description: +# + +TEMPLATE=app +TARGET=notreceiver + +#symbian: TARGET.UID3 = + +XQSERVICE_ROOT=../../.. +include(../../../xqservicebase.pri) +include(src/notreceiver.pri) + +symbian: TARGET.CAPABILITY = CAP_APPLICATION +LIBS+=-lxqservice -lxqserviceutil + +libFiles.sources = xqservice.dll +libFiles.path = "!:/sys/bin" +DEPLOYMENT += libFiles diff -r 9d760f716ca8 -r 3d09643def13 qthighway/examples/notifications/notificationreceiver/src/main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qthighway/examples/notifications/notificationreceiver/src/main.cpp Fri Sep 17 08:34:25 2010 +0300 @@ -0,0 +1,35 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published by +* the Free Software Foundation, version 2.1 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License +* along with this program. If not, +* see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/". +* +* Description: +* +*/ + +#include +#include "notreceiver.h" + +int main(int argc, char **argv) +{ + QApplication a( argc, argv ); + + NotificationsReceiver *cl = new NotificationsReceiver(); + cl->show(); + int rv = a.exec(); + delete cl; + return rv; +} + diff -r 9d760f716ca8 -r 3d09643def13 qthighway/examples/notifications/notificationreceiver/src/notreceiver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qthighway/examples/notifications/notificationreceiver/src/notreceiver.cpp Fri Sep 17 08:34:25 2010 +0300 @@ -0,0 +1,176 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published by +* the Free Software Foundation, version 2.1 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License +* along with this program. If not, +* see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/". +* +* Description: +* +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +// Include declarations to see if any compilation issues +#include +#include + +#include "notreceiver.h" + +#define CONNECT_ASSERT(a, b, c, d) if (!QObject::connect((a), (b), (c), (d))) { \ + qWarning("connection failed!"); \ + qApp->exit(0); \ + exit(0); \ + } + + +QString NotificationsReceiver::POOLING_TEMPLATE("pooling: %1"); +QString NotificationsReceiver::NOTIFY_TEMPLATE("notification: %1"); + +NotificationsReceiver::NotificationsReceiver(QWidget *parent, Qt::WFlags f) + : QWidget(parent, f), + poolingTimer(), + pooledDescr(0) +{ + mgr = new XQApplicationManager(); + + CONNECT_ASSERT(&poolingTimer, SIGNAL(timeout()), this, SLOT(poolForService())); + + bool ok; + + ok = QObject::connect(mgr, SIGNAL(serviceStarted(XQAiwInterfaceDescriptor)), this, SLOT(serviceStarted(XQAiwInterfaceDescriptor))); + ok = QObject::connect(mgr, SIGNAL(serviceStopped(XQAiwInterfaceDescriptor)), this, SLOT(serviceStopped(XQAiwInterfaceDescriptor))); + + initUi(); + + XQAiwInterfaceDescriptor descr(); + + QString serviceName = QString("com.nokia.services.hbserviceprovider"); + QString interfaceName = QString("Dialer"); + QString opName = "dial(QString,bool)"; + + QList dscrList = mgr->list(serviceName, interfaceName, opName); + + if (dscrList.size() == 1) { + XQAiwInterfaceDescriptor dscr = dscrList.at(0); + mgr->notifyRunning(dscr); + qDebug() << "Start notifications for: " << dscr.serviceName() << " " << dscr.interfaceName(); + if (mgr->isRunning(dscr)) { + serviceStarted(dscr); + } else { + serviceStopped(dscr); + } + labelServiceName->setText(serviceName + "." + interfaceName + "." + opName); + pooledDescr = new XQAiwInterfaceDescriptor(dscr); + } else { + qWarning("Whoops, requested service not found."); + labelServiceName->setText("service not found"); + } + + poolingTimer.start(1000); +} + +void NotificationsReceiver::initUi() +{ + /* Adjust the palette */ +#if defined(Q_WS_S60) + QPalette p = qApp->palette(); + QColor color(192,192,192); + QColor bg(208, 242, 209); + p.setColor(QPalette::Highlight, color.lighter(200)); + p.setColor(QPalette::Text, Qt::black); + p.setColor(QPalette::Base, bg); + p.setColor(QPalette::WindowText, Qt::black); + p.setColor(QPalette::Window, bg); + p.setColor(QPalette::ButtonText, Qt::black); + p.setColor(QPalette::Button, color.lighter(150)); + p.setColor(QPalette::Link, QColor(240,40,40)); + qApp->setPalette(p); +#endif + QPushButton *quitButton = new QPushButton(tr("quit")); + connect(quitButton, SIGNAL(clicked()), qApp, SLOT(quit())); + + labelServiceName = new QLabel("...service name..."); + labelPoolingResult = new QLabel(POOLING_TEMPLATE); + labelNotifyResult = new QLabel(NOTIFY_TEMPLATE); + + vl = new QVBoxLayout; + vl->setMargin(10); + vl->setSpacing(5); + + vl->addWidget(labelServiceName); + vl->addWidget(labelPoolingResult); + vl->addWidget(labelNotifyResult); + + vl->insertStretch(-1); + vl->addWidget(quitButton); + + setLayout(vl); + +#if defined(Q_WS_X11) || defined(Q_WS_WIN) + setFixedSize(QSize(360,640)); // nHD +#elif defined(Q_WS_S60) + // showMaximized(); + showFullScreen(); +#endif +} + +NotificationsReceiver::~NotificationsReceiver() +{ + delete mgr; + delete pooledDescr; +} + +void NotificationsReceiver::serviceStarted(XQAiwInterfaceDescriptor dscr) +{ + qDebug("service started"); + labelNotifyResult->setText("[N] service started"); +} + +void NotificationsReceiver::serviceStopped(XQAiwInterfaceDescriptor dscr) +{ + qDebug("service started"); + labelNotifyResult->setText("[N] service stopped"); +} + +void NotificationsReceiver::poolForService() +{ + qDebug(__PRETTY_FUNCTION__); + XQAiwInterfaceDescriptor d(*pooledDescr); + labelPoolingResult->setText(QString("[P] service %1").arg(mgr->isRunning(*pooledDescr) ? "running" : "stopped")); +} + diff -r 9d760f716ca8 -r 3d09643def13 qthighway/examples/notifications/notificationreceiver/src/notreceiver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qthighway/examples/notifications/notificationreceiver/src/notreceiver.h Fri Sep 17 08:34:25 2010 +0300 @@ -0,0 +1,73 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published by +* the Free Software Foundation, version 2.1 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License +* along with this program. If not, +* see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/". +* +* Description: +* +*/ + +#ifndef APPMGRCLIENT_H +#define APPMGRCLIENT_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class QLineEdit; +class QCheckBox; +class QLabel; + +class NotificationsReceiver : public QWidget +{ + Q_OBJECT + +public: + NotificationsReceiver( QWidget *parent = 0, Qt::WFlags f = 0 ); + ~NotificationsReceiver(); + +public slots: + void serviceStarted(XQAiwInterfaceDescriptor dscr); + void serviceStopped(XQAiwInterfaceDescriptor dscr); + + void poolForService(); + +private: + void initUi(); + +private: + static QString POOLING_TEMPLATE; + static QString NOTIFY_TEMPLATE; + + QTimer poolingTimer; + + XQApplicationManager *mgr; + XQAiwInterfaceDescriptor *pooledDescr; + + QVBoxLayout *vl; + QLabel *labelServiceName; + QLabel *labelPoolingResult; + QLabel *labelNotifyResult; +}; + +#endif diff -r 9d760f716ca8 -r 3d09643def13 qthighway/examples/notifications/notificationreceiver/src/notreceiver.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qthighway/examples/notifications/notificationreceiver/src/notreceiver.pri Fri Sep 17 08:34:25 2010 +0300 @@ -0,0 +1,26 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, version 2.1 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program. If not, +# see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/". +# +# Description: +# + +SOURCES=\ + src/main.cpp\ + src/notreceiver.cpp + +HEADERS=\ + src/notreceiver.h diff -r 9d760f716ca8 -r 3d09643def13 qthighway/examples/notifications/service/hbserviceprovider.ts --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qthighway/examples/notifications/service/hbserviceprovider.ts Fri Sep 17 08:34:25 2010 +0300 @@ -0,0 +1,11 @@ + + + + + QAction test + + aiw_text + Test + + + diff -r 9d760f716ca8 -r 3d09643def13 qthighway/examples/notifications/service/maketestqm.cmd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qthighway/examples/notifications/service/maketestqm.cmd Fri Sep 17 08:34:25 2010 +0300 @@ -0,0 +1,6 @@ +copy hbserviceprovider.ts \epoc32\include\platform\qt\translations\hbserviceprovider_en.ts + +call lrelease -idbased /epoc32/include/platform/qt/translations/hbserviceprovider_en.ts -qm /epoc32/release/winscw/urel/z/resource/qt/translations/hbserviceprovider_en.qm +call lrelease -idbased /epoc32/include/platform/qt/translations/hbserviceprovider_en.ts -qm /epoc32/release/winscw/udeb/z/resource/qt/translations/hbserviceprovider_en.qm + +copy \epoc32\release\winscw\urel\z\resource\qt\translations\hbserviceprovider_en.qm \epoc32\data\z\resource\qt\translations\*.* diff -r 9d760f716ca8 -r 3d09643def13 qthighway/examples/notifications/service/service.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qthighway/examples/notifications/service/service.pro Fri Sep 17 08:34:25 2010 +0300 @@ -0,0 +1,41 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, version 2.1 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program. If not, +# see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/". +# +# Description: +# + +TEMPLATE=app +TARGET=hbserviceprovider + +CONFIG += hb service +symbian:TARGET.UID3 = 0xE0022E71 + +XQSERVICE_ROOT=../../.. +include(../../../xqservicebase.pri) +include(src/hbserviceprovider.pri) + +LIBS+=-lxqservice -lxqserviceutil -lflogger + +SERVICE.FILE = service_conf.xml +SERVICE.OPTIONS = embeddable +# SERVICE.OPTIONS += hidden + +libFiles.sources = xqservice.dll +libFiles.path = "!:/sys/bin" +DEPLOYMENT += libFiles + +# TRANSLATIONS=hbserviceprovider.ts diff -r 9d760f716ca8 -r 3d09643def13 qthighway/examples/notifications/service/service_conf.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qthighway/examples/notifications/service/service_conf.xml Fri Sep 17 08:34:25 2010 +0300 @@ -0,0 +1,18 @@ + + + com.nokia.services.hbserviceprovider + ="must-not-be-empty" + Telephony service + + Dialer + 1.0 + Dial interface + hbserviceprovider + txt_aiw_action_text + + + Map + 1.0 + Map interface + + \ No newline at end of file diff -r 9d760f716ca8 -r 3d09643def13 qthighway/examples/notifications/service/service_conf_old_format.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qthighway/examples/notifications/service/service_conf_old_format.xml Fri Sep 17 08:34:25 2010 +0300 @@ -0,0 +1,10 @@ + + + Telephony service + + Dial interface + + + Map interface + + \ No newline at end of file diff -r 9d760f716ca8 -r 3d09643def13 qthighway/examples/notifications/service/src/hbcontact.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qthighway/examples/notifications/service/src/hbcontact.h Fri Sep 17 08:34:25 2010 +0300 @@ -0,0 +1,83 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published by +* the Free Software Foundation, version 2.1 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License +* along with this program. If not, +* see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/". +* +* Description: +* +*/ + +#ifndef HBSERVICEPROVIDERCONTACT_H +#define HBSERVICEPROVIDERCONTACT_H + +#include +#include +#include +#include + + +class HbContact +{ +public: + HbContact() {}; + virtual ~HbContact() {}; + + QString mLabel; + QString mNumber; + QString mAddress; + QString mCity; + QString mCountry; + QUuid mUid; + + template void serialize(Stream &stream) const; + template void deserialize(Stream &stream); +}; + +/* +struct HbContact +{ +public: + QString mLabel; + QString mNumber; + QString mAddress; + QString mCity; + QString mCountry; + QUuid mUid; + + template void serialize(Stream &stream) const; + template void deserialize(Stream &stream); +}; +*/ + +template inline void HbContact::serialize(Stream &s) const +{ + s << mLabel; + s << mNumber; + s << mUid; +} + +template inline void HbContact::deserialize(Stream &s) +{ + s >> mLabel; + s >> mNumber; + s >> mUid; +} + +typedef QList HbContactList; + +Q_DECLARE_USER_METATYPE(HbContact) +Q_DECLARE_USER_METATYPE_NO_OPERATORS(HbContactList) + +#endif // HBSERVICEPROVIDERCONTACT_H diff -r 9d760f716ca8 -r 3d09643def13 qthighway/examples/notifications/service/src/hbserviceprovider.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qthighway/examples/notifications/service/src/hbserviceprovider.pri Fri Sep 17 08:34:25 2010 +0300 @@ -0,0 +1,31 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, version 2.1 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program. If not, +# see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/". +# +# Description: +# + + +SOURCES=\ + src/main.cpp\ + src/hbserviceprovidermainwindow.cpp\ + src/hbserviceproviderview.cpp + +HEADERS=\ + src/hbserviceprovidermainwindow.h\ + src/hbserviceproviderview.h \ + src/hbcontact.h + diff -r 9d760f716ca8 -r 3d09643def13 qthighway/examples/notifications/service/src/hbserviceprovidermainwindow.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qthighway/examples/notifications/service/src/hbserviceprovidermainwindow.cpp Fri Sep 17 08:34:25 2010 +0300 @@ -0,0 +1,52 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published by +* the Free Software Foundation, version 2.1 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License +* along with this program. If not, +* see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/". +* +* Description: +* +*/ + +#include "xqservicelog.h" + +#include + +#include +#include + + +HbServiceProviderMainWindow::HbServiceProviderMainWindow(QWidget *parent) + : HbMainWindow(parent) +{ + XQSERVICE_DEBUG_PRINT("HbServiceProviderMainWindow::HbServiceProviderMainWindow"); + + mDialerService = new DialerService(); +// connect(mDialerService,SIGNAL(showView(QString)), +// this, SLOT(showView(QString))); + + mDialerView = new HbDialerView(mDialerService); + connect(mDialerService,SIGNAL(setNumber(QString)), + mDialerView, SLOT(setNumber(QString))); + + addView(mDialerView); +} + +HbServiceProviderMainWindow::~HbServiceProviderMainWindow() +{ + XQSERVICE_DEBUG_PRINT("HbServiceProviderMainWindow::~HbServiceProviderMainWindow"); + delete mDialerService; + delete mDialerView; +} + diff -r 9d760f716ca8 -r 3d09643def13 qthighway/examples/notifications/service/src/hbserviceprovidermainwindow.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qthighway/examples/notifications/service/src/hbserviceprovidermainwindow.h Fri Sep 17 08:34:25 2010 +0300 @@ -0,0 +1,50 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published by +* the Free Software Foundation, version 2.1 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License +* along with this program. If not, +* see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/". +* +* Description: +* +*/ + +#ifndef HBSERVICEPROVIDERMAINWINDOW_H +#define HBSERVICEPROVIDERMAINWINDOW_H + +#include + +class HbDialerView; +class HbMapView; +class DialerService; +class MapService; + +class HbServiceProviderMainWindow : public HbMainWindow +{ + Q_OBJECT + +public: + HbServiceProviderMainWindow(QWidget *parent=0); + ~HbServiceProviderMainWindow(); + +private slots: + +private: + +private: + DialerService* mDialerService; + MapService* mMapService; + HbDialerView* mDialerView; +}; + +#endif // HBSERVICEPROVIDERMAINWINDOW_H diff -r 9d760f716ca8 -r 3d09643def13 qthighway/examples/notifications/service/src/hbserviceproviderview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qthighway/examples/notifications/service/src/hbserviceproviderview.cpp Fri Sep 17 08:34:25 2010 +0300 @@ -0,0 +1,172 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published by +* the Free Software Foundation, version 2.1 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License +* along with this program. If not, +* see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/". +* +* Description: +* +*/ + +#include "xqservicelog.h" + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +HbDialerView::HbDialerView(DialerService* service,QGraphicsItem *parent) + : mService(service), + HbView(parent), + doomsdayTimer(), + doomsdayCounter(5) +{ + XQSERVICE_DEBUG_PRINT("HbDialerView::HbDialerView"); + sndEmbedded = NULL; + if (XQServiceUtil::isService()) + { + setTitle(tr("HB Dialer As Service")); + } + else + { + setTitle(tr("HB Dialer As Non-Service")); + } + + HbToolBar* toolBar = this->toolBar(); + + HbAction* endAction = new HbAction("End Call"); + connect(endAction, SIGNAL(triggered()), this, SLOT(quit())); + + toolBar->addAction(endAction); + + if (XQServiceUtil::isEmbedded()) { + HbAction* embeddedAction = new HbAction("Embed"); + connect(embeddedAction, SIGNAL(triggered()), this, SLOT(embed())); + toolBar->addAction(embeddedAction); + } + + QGraphicsLinearLayout* layout = new QGraphicsLinearLayout(Qt::Vertical,this); + + mTextEdit = new HbLineEdit(this); + mRetValue = new HbLineEdit(this); + timerLabel = new HbLabel("..."); + layout->addItem(mTextEdit); + layout->addItem(mRetValue); + layout->addItem(timerLabel); + setLayout(layout); + bool con = connect(&doomsdayTimer, SIGNAL(timeout()), this, SLOT(tick())); + //doomsdayTimer.start(1000); +} + +HbDialerView::~HbDialerView() +{ + XQSERVICE_DEBUG_PRINT("HbDialerView::~HbDialerView"); +} + +void HbDialerView::quit() +{ + XQSERVICE_DEBUG_PRINT("HbDialerView::quit"); + connect(mService, SIGNAL(returnValueDelivered()), qApp, SLOT(quit())); + mService->complete(); +} + +void HbDialerView::tick() +{ + if (doomsdayCounter>1) { + doomsdayCounter--; + timerLabel->setPlainText(QString("%1").arg(doomsdayCounter)); + } else if (doomsdayCounter == 1) { + quit(); + } else { + doomsdayTimer.stop(); + qApp->quit(); + } +} + +void HbDialerView::embed() +{ + XQSERVICE_DEBUG_PRINT("HbDialerView::embed"); + if (sndEmbedded) + delete sndEmbedded; + + //XQServiceRequest snd("com.nokia.services.hbserviceprovider.Dialer","dial(QString)",true); + sndEmbedded = new XQServiceRequest("serviceapp.Dialer","dial(QString,bool)",true); + connect(sndEmbedded, SIGNAL(requestCompleted(QVariant)), this, SLOT(requestCompleted(QVariant))); + *sndEmbedded << mTextEdit->text(); + *sndEmbedded << true; + QVariant retValue; + bool res=sndEmbedded->send(); + if (!res) { + mRetValue->setText("send fail!"); + } +} + +void HbDialerView::requestCompleted(const QVariant& value) +{ + XQSERVICE_DEBUG_PRINT("HbDialerView::requestCompleted"); + mRetValue->setText(value.toString()); +} + +void HbDialerView::setNumber(const QString& number) +{ + XQSERVICE_DEBUG_PRINT("HbDialerView::setNumber"); + mTextEdit->setText("Call from " + number); +} + +DialerService::DialerService(QObject* parent) +: XQServiceProvider("com.nokia.services.hbserviceprovider.Dialer",parent) +{ + XQSERVICE_DEBUG_PRINT("DialerService::DialerService"); + publishAll(); +} + +DialerService::~DialerService() +{ + XQSERVICE_DEBUG_PRINT("DialerService::~DialerService"); +} + +void DialerService::complete() +{ + XQSERVICE_DEBUG_PRINT("DialerService::complete"); + QString retvalue = "retValue="+mNumber; + completeRequest(1,retvalue); +} + +QString DialerService::dial(const QString& number) +{ + XQSERVICE_DEBUG_PRINT("DialerService::dial"); + mNumber = number ; + emit showView("dialer"); + emit setNumber(number); + setCurrentRequestAsync(); + return "retValue="+number; +} + +QString DialerService::dial(const QString& number, bool async) +{ + XQSERVICE_DEBUG_PRINT("DialerService::dial (2)"); + return dial(number); +} + +Q_IMPLEMENT_USER_METATYPE(HbContact) +Q_IMPLEMENT_USER_METATYPE_NO_OPERATORS(HbContactList) + diff -r 9d760f716ca8 -r 3d09643def13 qthighway/examples/notifications/service/src/hbserviceproviderview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qthighway/examples/notifications/service/src/hbserviceproviderview.h Fri Sep 17 08:34:25 2010 +0300 @@ -0,0 +1,88 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published by +* the Free Software Foundation, version 2.1 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License +* along with this program. If not, +* see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/". +* +* Description: +* +*/ + +#ifndef HBSERVICEPROVIDERVIEW_H +#define HBSERVICEPROVIDERVIEW_H + +#include +#include + +#include + +#include "hbcontact.h" + +class HbLineEdit; +class HbLabel; +class DialerService; +class XQServiceRequest; + +class HbDialerView : public HbView +{ + Q_OBJECT + +public: + HbDialerView(DialerService* service,QGraphicsItem *parent = 0); + ~HbDialerView(); + +signals: + +public slots: + void setNumber(const QString& number); + void embed(); + void requestCompleted(const QVariant& value); + +protected slots: + void quit(); + + void tick(); + +private: + HbLineEdit* mTextEdit; + HbLineEdit* mRetValue; + HbLabel* timerLabel; + DialerService* mService; + XQServiceRequest* sndEmbedded; + QTimer doomsdayTimer; + int doomsdayCounter; +}; + +class DialerService : public XQServiceProvider +{ + Q_OBJECT +public: + DialerService( QObject *parent = 0 ); + ~DialerService(); + + void complete(); + +Q_SIGNALS: + void setNumber(const QString& number); + void showView(const QString& name); + +public slots: + QString dial(const QString& number); + QString dial(const QString& number, bool async); + +private: + QString mNumber; +}; + +#endif // HBSERVICEPROVIDERVIEW_H diff -r 9d760f716ca8 -r 3d09643def13 qthighway/examples/notifications/service/src/main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qthighway/examples/notifications/service/src/main.cpp Fri Sep 17 08:34:25 2010 +0300 @@ -0,0 +1,84 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published by +* the Free Software Foundation, version 2.1 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License +* along with this program. If not, +* see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/". +* +* Description: +* +*/ + +#include "xqservicelog.h" +#include + +#include +#include + +int main(int argc, char **argv) +{ + // qInstallMsgHandler(XQSERVICEMESSAGEHANDLER); + XQSERVICE_DEBUG_PRINT("HbServiceProvider::main"); + + XQSERVICE_DEBUG_PRINT("HbServiceProvider::main:isService (argv)=%d", XQServiceUtil::isService(argc,argv)); + XQSERVICE_DEBUG_PRINT("HbServiceProvider::main:interfaceName (argv)=%s", qPrintable(XQServiceUtil::interfaceName(argc,argv))); + XQSERVICE_DEBUG_PRINT("HbServiceProvider::main:serviceName (argv)=%s", qPrintable(XQServiceUtil::serviceName(argc,argv))); + XQSERVICE_DEBUG_PRINT("HbServiceProvider::main:isEmbbedded (argv)=%d", XQServiceUtil::isEmbedded(argc,argv)); + XQSERVICE_DEBUG_PRINT("HbServiceProvider::main:operationName (argv)=%s", qPrintable(XQServiceUtil::operationName(argc,argv))); + + HbApplication app( argc, argv ); + + XQSERVICE_DEBUG_PRINT("HbServiceProvider::main:isService =%d", XQServiceUtil::isService()); + XQSERVICE_DEBUG_PRINT("HbServiceProvider::main:interfaceName=%s", qPrintable(XQServiceUtil::interfaceName())); + XQSERVICE_DEBUG_PRINT("HbServiceProvider::main:serviceName =%s", qPrintable(XQServiceUtil::serviceName())); + XQSERVICE_DEBUG_PRINT("HbServiceProvider::main:isEmbbedded =%d", XQServiceUtil::isEmbedded()); + XQSERVICE_DEBUG_PRINT("HbServiceProvider::main:operationName =%s", qPrintable(XQServiceUtil::operationName())); + + // Let's figure out why application was started? + if(app.activateReason()== Hb::ActivationReasonActivity ) + { + QString id = app.activateId(); + QVariant data = app.activateData(); + XQSERVICE_DEBUG_PRINT("HbServiceProvider::main Hb::ActivationReasonActivity=%s,data=%s", + qPrintable(id), qPrintable(data.toString())); + QVariantHash params = app.activateParams(); + QHashIterator i(params); + while (i.hasNext()) + { + i.next(); + XQSERVICE_DEBUG_PRINT("HbServiceProvider::param key=%s,value=%s", + qPrintable(i.key()), qPrintable(i.value().toString())); + } + } + else if (app.activateReason() == Hb::ActivationReasonNormal) + { + XQSERVICE_DEBUG_PRINT("HbServiceProvider::main Hb::ActivationReasonNormal"); + } + else if(app.activateReason() == Hb::ActivationReasonService) + { + // Does not come here: Bug MPAN-84QL7V entered for this + XQSERVICE_DEBUG_PRINT("HbServiceProvider::main Hb::ActivationReasonService"); + } + else + { + // This applicatiob does not support services + XQSERVICE_DEBUG_PRINT("HbServiceProvider::main UNKNOWN reason"); + } + + HbServiceProviderMainWindow mainWindow; + + mainWindow.show(); + + return app.exec(); +} + diff -r 9d760f716ca8 -r 3d09643def13 qthighway/examples/serviceapp/serviceapp.pro --- a/qthighway/examples/serviceapp/serviceapp.pro Thu Sep 02 21:20:48 2010 +0300 +++ b/qthighway/examples/serviceapp/serviceapp.pro Fri Sep 17 08:34:25 2010 +0300 @@ -38,7 +38,7 @@ SERVICE.OPTIONS += hidden libFiles.sources = serviceapp.exe -libFiles.path = "!:\sys\bin" +libFiles.path = "!:/sys/bin" DEPLOYMENT += libFiles RSS_RULES += \ diff -r 9d760f716ca8 -r 3d09643def13 qthighway/examples/serviceclient/serviceclient.pro --- a/qthighway/examples/serviceclient/serviceclient.pro Thu Sep 02 21:20:48 2010 +0300 +++ b/qthighway/examples/serviceclient/serviceclient.pro Fri Sep 17 08:34:25 2010 +0300 @@ -30,5 +30,5 @@ LIBS+=-lxqservice -lflogger libFiles.sources = xqservice.dll -libFiles.path = "!:\sys\bin" +libFiles.path = "!:/sys/bin" DEPLOYMENT += libFiles diff -r 9d760f716ca8 -r 3d09643def13 qthighway/inc/xqservicelog.h --- a/qthighway/inc/xqservicelog.h Thu Sep 02 21:20:48 2010 +0300 +++ b/qthighway/inc/xqservicelog.h Fri Sep 17 08:34:25 2010 +0300 @@ -42,11 +42,13 @@ #define XQSERVICE_CRITICAL_PRINT(args...) qCritical(args); #define XQSERVICE_FATAL_PRINT(args...) qFatal(args); #define XQSERVICEMESSAGEHANDLER XqServiceMessageHandler::xqServiceMessageHandler +#define XQSERVICE_CONNECT(a, b, c, d) if (!QObject::connect((a), (b), (c), (d))) {qCritical("%s: connection failed", __PRETTY_FUNCTION__);}else{qDebug("%s: connection OK", __PRETTY_FUNCTION__);} #else //XQSERVICE_DEBUG not defined #define XQSERVICE_DEBUG_PRINT(args...) #define XQSERVICE_WARNING_PRINT(args...) #define XQSERVICE_CRITICAL_PRINT(args...) #define XQSERVICE_FATAL_PRINT(args...) +#define XQSERVICE_CONNECT(a, b, c, d) QObject::connect((a), (b), (c), (d)); #define XQSERVICEMESSAGEHANDLER 0 #endif //XQSERVICE_DEBUG diff -r 9d760f716ca8 -r 3d09643def13 qthighway/tsrc/at_servicesregression/at_servicesregression.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qthighway/tsrc/at_servicesregression/at_servicesregression.cpp Fri Sep 17 08:34:25 2010 +0300 @@ -0,0 +1,332 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published by +* the Free Software Foundation, version 2.1 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License +* along with this program. If not, +* see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/". +* +* Description: +* +*/ + + +#include "at_servicesregression.h" + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#define LASTEROR QString(" - Last Error: " + QString::number(mAppManager->lastError())) + +void TestServicesRegression::initTestCase() +{ + request = NULL; + mAppManager = NULL; +} + +void TestServicesRegression::cleanupTestCase() +{ + +} + +void TestServicesRegression::init() +{ + mAppManager = new XQApplicationManager(); + QVERIFY(mAppManager != NULL); + QVERIFY(mAppManager->lastError() == XQService::ENoError); + closeApp = false; +} + +void TestServicesRegression::cleanup() +{ + delete mAppManager; + mAppManager = NULL; + if (closeApp) + closeFocusedWG(); +} + +void TestServicesRegression::platform_services_data() +{ + QStringList operations; + + QTest::addColumn("interface"); + QTest::addColumn("operations"); + + operations << XQOP_IMAGE_FETCH.latin1(); + QTest::newRow("photos") << XQI_IMAGE_FETCH.latin1() << operations; + operations.clear(); + + operations << XQOP_MUSIC_FETCH.latin1(); + QTest::newRow("musicplayer") << XQI_MUSIC_FETCH.latin1() << operations; + operations.clear(); + + operations << XQOP_TONE_FETCH.latin1(); + QTest::newRow("tonefetcher") << XQI_TONE_FETCH.latin1() << operations; + operations.clear(); + + operations << XQOP_VIDEO_FETCH.latin1(); + QTest::newRow("videoplayer") << XQI_VIDEO_FETCH.latin1() << operations; + operations.clear(); + + operations << XQOP_VIDEO_PLAY.latin1() << XQOP_VIDEO_PLAY_PD.latin1() << XQOP_VIDEO_CLOSE.latin1(); + QTest::newRow("videoplayer") << XQI_VIDEO_PLAY.latin1() << operations; + operations.clear(); + + operations << XQOP_VIDEO_BROWSE.latin1(); + QTest::newRow("videoplayer") << XQI_VIDEO_BROWSE.latin1() << operations; + operations.clear(); + + operations << XQOP_CAMERA_CAPTURE.latin1(); + QTest::newRow("cxui") << XQI_CAMERA_CAPTURE.latin1() << operations; + operations.clear(); + + operations << XQOP_LOGS_SHOW.latin1(); + QTest::newRow("logs") << XQI_LOGS_VIEW.latin1() << operations; + operations.clear(); + + operations << XQOP_CONTACTS_EDIT_CREATE_NEW.latin1() << XQOP_CONTACTS_EDIT_CREATE_NEW_WITH_SUBTYPE.latin1() << XQOP_CONTACTS_EDIT_CREATE_NEW_VCARD.latin1() + << XQOP_CONTACTS_EDIT_EXISTING.latin1() << XQOP_CONTACTS_EDIT_UPDATE_EXISTING.latin1() << XQOP_CONTACTS_EDIT_UPDATE_EXISTING_WITH_SUBTYPE.latin1(); + QTest::newRow("phonebookservices") << XQI_CONTACTS_EDIT.latin1() << operations; + operations.clear(); + + operations << XQOP_CONTACTS_FETCH_MULTIPLE.latin1() << XQOP_CONTACTS_FETCH_SINGLE.latin1(); + QTest::newRow("phonebookservices") << XQI_CONTACTS_FETCH.latin1() << operations; + operations.clear(); + + operations << XQOP_CONTACTS_VIEW_CONTACT_CARD.latin1() << XQOP_CONTACTS_VIEW_TEMP_CONTACT_CARD_WITH_DETAIL.latin1() << XQOP_CONTACTS_VIEW_GROUP.latin1(); + QTest::newRow("phonebookservices") << XQI_CONTACTS_VIEW.latin1() << operations; + operations.clear(); + + operations << "send(const QString,const qint32, const QString)" << "send(const QString,const QString,const QString)" + << "send(QVariantMap,const QString)"; + QTest::newRow("messaging") << XQI_MESSAGE_SEND.latin1() << operations; + operations.clear(); + + operations << "fetch(QVariantMap, QVariant)"; + QTest::newRow("filemgr") << XQI_FILE_FETCH.latin1() << operations; + operations.clear(); + + operations << XQOP_RADIO_CONTROL.latin1(); + QTest::newRow("qtfmradio") << XQI_RADIO_CONTROL.latin1() << operations; + operations.clear(); + + operations << XQOP_RADIO_MONITOR.latin1(); + QTest::newRow("qtfmradio") << XQI_RADIO_MONITOR.latin1() << operations; + operations.clear(); + + operations << XQOP_WLAN_SNIFFER.latin1(); + QTest::newRow("wlansniffer") << XQI_WLAN_SNIFFER.latin1() << operations; + operations.clear(); + + operations << XQOP1_WLAN_LOGIN.latin1() << XQOP2_WLAN_LOGIN.latin1(); + QTest::newRow("wlanlogin") << XQI_WLAN_LOGIN.latin1() << operations; + operations.clear(); + + operations << XQOP_EMAIL_INBOX_VIEW.latin1(); + QTest::newRow("nmailui") << XQI_EMAIL_INBOX_VIEW.latin1() << operations; + operations.clear(); + + operations << XQOP_EMAIL_MESSAGE_VIEW.latin1(); + QTest::newRow("nmailui") << XQI_EMAIL_MESSAGE_VIEW.latin1() << operations; + operations.clear(); + + operations << XQOP_EMAIL_MESSAGE_SEND.latin1(); + QTest::newRow("nmailui") << XQI_EMAIL_MESSAGE_SEND.latin1() << operations; + operations.clear(); + + operations << XQOP_EMAIL_REGISTER_ACCOUNT.latin1() << XQOP_EMAIL_UPDATE_MAILBOX.latin1() << XQOP_EMAIL_UNREGISTER_MAILBOX.latin1(); + QTest::newRow("nmailui") << XQI_EMAIL_REGISTER_ACCOUNT.latin1() << operations; + operations.clear(); + + operations << XQOP_EMAIL_MAILBOX_CONFIGURE.latin1(); + QTest::newRow("nmailui") << XQI_EMAIL_MAILBOX_CONFIGURE.latin1() << operations; + operations.clear(); + + operations << "dial(const QString&)" << "dial(const QString&, int)" << "dialVideo(const QString&)" << "dialVideo(const QString&, int)" + << "dialVoip(const QString&)" << "dialVoip(const QString&, int)" << "dialVoipService(const QString&, int)" + << "dialVoipService(const QString&, int, int)"; + QTest::newRow("phoneui") << XQI_CALL_DIAL.latin1() << operations; + operations.clear(); + + operations << "playDTMFTone(const QChar&)" << "stopDTMFPlay()"; + QTest::newRow("phoneui") << XQI_DTMF_PLAY.latin1() << operations; + operations.clear(); +} + +void TestServicesRegression::platform_services() +{ + QFETCH(QString, interface); + QFETCH(QStringList, operations); + + foreach (QString operation, operations) { + XQAiwRequest* req = mAppManager->create(interface, operation); + QVERIFY2(req != NULL, + QString("Cannot create request for interface:" + interface + ", operation:" + operation + LASTEROR).toAscii()); + delete req; + } + +} + +void TestServicesRegression::platform_services_operations_data() +{ + platform_services_data(); +} + +void TestServicesRegression::platform_services_operations() +{ + QFETCH(QString, interface); + QFETCH(QStringList, operations); + + foreach (QString operation, operations){ + if (closeApp) + closeFocusedWG(); + + request = mAppManager->create(interface, operation, false); + if (request) { + request->setSynchronous(false); + closeApp = true; + + QVERIFY2(request->send(), QString("Send request failed, interface:" + interface + ", operation:" + operation + LASTEROR).toAscii()); + } + else + closeApp = false; + } +} + +void TestServicesRegression::platform_url_data() +{ + QTest::addColumn("url"); + + QTest::newRow("http") << "http:"; + QTest::newRow("https") << "https:"; + QTest::newRow("mailto") << "mailto:"; + QTest::newRow("cti") << "cti:"; + QTest::newRow("mmsto") << "mmsto:"; + QTest::newRow("sms") << "sms:"; + QTest::newRow("javaapp") << "javaapp:"; + QTest::newRow("tel") << "tel:"; +} + +void TestServicesRegression::platform_url() +{ + QFETCH(QString, url); + + url += "temp"; + + XQAiwRequest* request = mAppManager->create(QUrl(url), false); + QVERIFY2(request != NULL, QString("Cannot create request for url:" + url + LASTEROR).toAscii()); + request->setSynchronous(false); + + QList args; + args << url; + request->setArguments(args); + + closeApp = true; + + QVERIFY2(request->send(), QString("Send request failed, url:" + url + LASTEROR).toAscii()); +} + +void TestServicesRegression::platform_file_data() +{ +#ifdef __WINS__ + const QString drive = "c"; +#else + const QString drive = "z"; +#endif + + QTest::addColumn("fileStr"); + QTest::newRow("image") << drive + ":\\data\\Others\\one_v2.jpg"; + QTest::newRow("audio") << drive + ":\\data\\Others\\111-test1_v2.odf"; + QTest::newRow("video") << drive + ":\\data\\Others\\324kbps_MPEG4_352x288_AAC_15fps.3gp"; +} + +void TestServicesRegression::platform_file() +{ + QFETCH(QString, fileStr); + + QFile file(fileStr); + + XQAiwRequest* request = mAppManager->create(file, false); + QVERIFY2(request != NULL, QString("Cannot create request for file:" + fileStr + LASTEROR).toAscii()); + request->setSynchronous(false); + + QList args; + args << fileStr; + request->setArguments(args); + + closeApp = true; + + QVERIFY2(request->send(), QString("Send request failed, file:" + fileStr + LASTEROR).toAscii()); +} + +void TestServicesRegression::platform_file_share() +{ + QList listFileShare = mAppManager->list(XQI_FILE_SHARE.latin1(), XQOP_FILE_SHARE.latin1()); + + QVERIFY2(listFileShare.count() > 2, "There must be minimum three implementations in platform"); + + foreach (XQAiwInterfaceDescriptor interface, listFileShare) { + XQAiwRequest* request = mAppManager->create(interface, XQOP_FILE_SHARE.latin1()); + QVERIFY2(request != NULL, QString("Cannot create request for file share:" + interface.serviceName() + LASTEROR).toAscii()); + delete request; + } +} + +void TestServicesRegression::closeFocusedWG() +{ + QTest::qWait(10000); // wait for service start + + TInt myWGId = CCoeEnv::Static()->RootWin().Identifier(); + TInt focusedWGId = CCoeEnv::Static()->WsSession().GetFocusWindowGroup(); + + if (myWGId != focusedWGId) { + TWsEvent event; + event.SetType(EEventKey); + event.SetTimeNow(); + event.SetType(KAknShutOrHideApp); + CCoeEnv::Static()->WsSession().SendEventToWindowGroup(focusedWGId, event); + } + + if (request) { + delete request; + request = NULL; + } + + QTest::qWait(4000); // wait for service close +} + +int main (int argc, char* argv[]) +{ + QApplication app(argc, argv); + QTEST_DISABLE_KEYPAD_NAVIGATION + TestServicesRegression tc; + int ret = 0; + if (argc == 1) { + int c = 5; + char* v[] = {argv[0], "-o", "c:/at_regression.txt", "-maxwarnings", "0"}; + ret = QTest::qExec(&tc, c, v); + } + else { + ret = QTest::qExec(&tc, argc, argv); + } + return ret; +} + diff -r 9d760f716ca8 -r 3d09643def13 qthighway/tsrc/at_servicesregression/at_servicesregression.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qthighway/tsrc/at_servicesregression/at_servicesregression.h Fri Sep 17 08:34:25 2010 +0300 @@ -0,0 +1,60 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published by +* the Free Software Foundation, version 2.1 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License +* along with this program. If not, +* see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/". +* +* Description: +* +*/ + +#ifndef AT_SERVICESREGRESSION_H +#define AT_SERVICESREGRESSION_H + +#include +#include + + +class TestServicesRegression: public QObject +{ + Q_OBJECT + +private slots: + + void initTestCase(); + void init(); + + void platform_services_data(); + void platform_services(); + void platform_services_operations_data(); + void platform_services_operations(); + void platform_url_data(); + void platform_url(); + void platform_file_data(); + void platform_file(); + void platform_file_share(); + + void cleanupTestCase(); + void cleanup(); + +private: + void closeFocusedWG(); + + bool closeApp; + XQApplicationManager *mAppManager; + XQAiwRequest* request; + }; + + +#endif // AT_SERVICES_REGRESSION_H diff -r 9d760f716ca8 -r 3d09643def13 qthighway/tsrc/at_servicesregression/at_servicesregression.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qthighway/tsrc/at_servicesregression/at_servicesregression.pro Fri Sep 17 08:34:25 2010 +0300 @@ -0,0 +1,38 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +TEMPLATE = app + +QT += testlib +CONFIG += qtestlib + +HEADERS += at_servicesregression.h +SOURCES += at_servicesregression.cpp + +#DEFINES += QT_NO_DEBUG_STREAM + +# capability +TARGET.CAPABILITY = ALL -TCB + +drmfiles.sources += drmfiles/one_v2.jpg +drmfiles.sources += drmfiles/324kbps_MPEG4_352x288_AAC_15fps.3gp +drmfiles.sources += drmfiles/111-test1_v2.odf + +drmfiles.path = c:/data/Others/ + +DEPLOYMENT += drmfiles + +LIBS+= -lxqservice -lxqserviceutil -lws32 -lcone \ No newline at end of file diff -r 9d760f716ca8 -r 3d09643def13 qthighway/tsrc/at_servicesregression/buildtest.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qthighway/tsrc/at_servicesregression/buildtest.bat Fri Sep 17 08:34:25 2010 +0300 @@ -0,0 +1,38 @@ +@echo off +rem +rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +rem All rights reserved. +rem This component and the accompanying materials are made available +rem under the terms of "Eclipse Public License v1.0" +rem which accompanies this distribution, and is available +rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +rem +rem Initial Contributors: +rem Nokia Corporation - initial contribution. +rem +rem Contributors: +rem +rem Description: +rem +@echo on + +IF ["%1"] EQU [""] GOTO :NODEL +call del MON.sym +call del MON.dat + +:NODEL +call qmake +call bldmake bldfiles +call abld clean +call abld reallyclean + +IF ["%1"] EQU [""] GOTO :NORMAL + +call ctcwrap -i d -C "EXCLUDE+*\moc*.cpp" -C "EXCLUDE+*\t_*.cpp" -C "EXCLUDE+*\stub_*.cpp" abld build winscw udeb +goto :FINAL + +:NORMAL +call build winscw_udeb + +:FINAL + diff -r 9d760f716ca8 -r 3d09643def13 qthighway/tsrc/at_servicesregression/drmfiles/111-test1_v2.odf Binary file qthighway/tsrc/at_servicesregression/drmfiles/111-test1_v2.odf has changed diff -r 9d760f716ca8 -r 3d09643def13 qthighway/tsrc/at_servicesregression/drmfiles/324kbps_MPEG4_352x288_AAC_15fps.3gp Binary file qthighway/tsrc/at_servicesregression/drmfiles/324kbps_MPEG4_352x288_AAC_15fps.3gp has changed diff -r 9d760f716ca8 -r 3d09643def13 qthighway/tsrc/at_servicesregression/drmfiles/one_v2.jpg Binary file qthighway/tsrc/at_servicesregression/drmfiles/one_v2.jpg has changed diff -r 9d760f716ca8 -r 3d09643def13 qthighway/tsrc/at_servicesregression/sis/at_servicesregression.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qthighway/tsrc/at_servicesregression/sis/at_servicesregression.pkg Fri Sep 17 08:34:25 2010 +0300 @@ -0,0 +1,37 @@ +; XQApplicationManager black box tests + +; Language +&EN + + +; SIS header: name, uid, version +#{"at_services_regression"},(0xE7ca591c),1,0,0 + +; Localised Vendor name +%{"Nokia"} + +; Unique Vendor name +:"Nokia" + + +; Manual PKG pre-rules from PRO files +; Default dependency to Qt libraries +(0x2001E61C), 4, 6, 3, {"Qt"} +; Default HW/platform dependencies +[0x101F7961],0,0,0,{"S60ProductID"} +[0x102032BE],0,0,0,{"S60ProductID"} +[0x102752AE],0,0,0,{"S60ProductID"} +[0x1028315F],0,0,0,{"S60ProductID"} + + +; Executable and default resource files +"/epoc32/release/armv5/urel/at_servicesregression.exe" - "!:\sys\bin\at_servicesregression.exe" +"/epoc32/data/z/resource/apps/at_servicesregression.rsc" - "!:\resource\apps\at_servicesregression.rsc" +"/epoc32/data/z/private/10003a3f/import/apps/at_servicesregression_reg.rsc" - "!:\private\10003a3f\import\apps\at_servicesregression_reg.rsc" +; DEPLOYMENT +"/epoc32/data/z/data/Others/111-test1_v2.odf" - "z:\data\Others\111-test1_v2.odf" +"/epoc32/data/z/data/Others/one_v2.jpg" - "z:\data\Others\one_v2.jpg" +"/epoc32/data/z/data/Others/324kbps_MPEG4_352x288_AAC_15fps.3gp" - ""z:\data\Others\324kbps_MPEG4_352x288_AAC_15fps.3gp" + + +; Manual PKG post-rules from PRO files diff -r 9d760f716ca8 -r 3d09643def13 qthighway/tsrc/at_xqapplicationmanager/drmfiles/SD_jpg_sun.dcf diff -r 9d760f716ca8 -r 3d09643def13 qthighway/tsrc/rom/tsrc.iby --- a/qthighway/tsrc/rom/tsrc.iby Thu Sep 02 21:20:48 2010 +0300 +++ b/qthighway/tsrc/rom/tsrc.iby Fri Sep 17 08:34:25 2010 +0300 @@ -45,5 +45,11 @@ data=\epoc32\data\z\data\Others\SD_jpg_sun.dcf data\Others\SD_jpg_sun.dcf data=\epoc32\data\z\data\Others\STC1_128_44_16_2_CBR.wma data\Others\STC1_128_44_16_2_CBR.wma +S60_APP_EXE(at_servicesregression) +S60_APP_RESOURCE(at_servicesregression) +UPGRADABLE_APP_REG_RSC(at_servicesregression) +data=\epoc32\data\z\data\Others\one_v2.jpg data\Others\one_v2.jpg +data=\epoc32\data\z\data\Others\324kbps_MPEG4_352x288_AAC_15fps.3gp data\Others\324kbps_MPEG4_352x288_AAC_15fps.3gp +data=\epoc32\data\z\data\Others\111-test1_v2.odf data\Others\111-test1_v2.odf #endif \ No newline at end of file diff -r 9d760f716ca8 -r 3d09643def13 qthighway/tsrc/test_services/test_services.pro --- a/qthighway/tsrc/test_services/test_services.pro Thu Sep 02 21:20:48 2010 +0300 +++ b/qthighway/tsrc/test_services/test_services.pro Fri Sep 17 08:34:25 2010 +0300 @@ -18,7 +18,6 @@ # Description: # - TEMPLATE = subdirs CONFIG += ordered diff -r 9d760f716ca8 -r 3d09643def13 qthighway/tsrc/tests.pro --- a/qthighway/tsrc/tests.pro Thu Sep 02 21:20:48 2010 +0300 +++ b/qthighway/tsrc/tests.pro Fri Sep 17 08:34:25 2010 +0300 @@ -22,6 +22,7 @@ SUBDIRS = \ at_xqapplicationmanager \ + at_servicesregression \ test_services symbian:BLD_INF_RULES.prj_exports += "./rom/tsrc.iby $$CUSTOMER_VARIANT_APP_LAYER_IBY_EXPORT_PATH(tsrc.iby)" diff -r 9d760f716ca8 -r 3d09643def13 qthighway/xqservice/src/xqaiwdeclplat.h --- a/qthighway/xqservice/src/xqaiwdeclplat.h Thu Sep 02 21:20:48 2010 +0300 +++ b/qthighway/xqservice/src/xqaiwdeclplat.h Fri Sep 17 08:34:25 2010 +0300 @@ -67,7 +67,7 @@ #define XQOP_EMAIL_INBOX_VIEW QLatin1String("displayInboxByMailboxId(QVariant)") #define XQI_EMAIL_MESSAGE_VIEW QLatin1String("com.nokia.symbian.IEmailMessageView") -#define XQOP_EMAIL_MESSAGE_VIEW QLatin1String("viewMessage(QVariant,QVariant,QVariant)") +#define XQOP_EMAIL_MESSAGE_VIEW QLatin1String("viewMessage(QVariant,QVariant)") #define XQI_EMAIL_MESSAGE_SEND QLatin1String("com.nokia.symbian.IEmailMessageSend") #define XQOP_EMAIL_MESSAGE_SEND QLatin1String("send(QVariant)") diff -r 9d760f716ca8 -r 3d09643def13 qthighway/xqservice/src/xqaiwrequest.cpp --- a/qthighway/xqservice/src/xqaiwrequest.cpp Thu Sep 02 21:20:48 2010 +0300 +++ b/qthighway/xqservice/src/xqaiwrequest.cpp Fri Sep 17 08:34:25 2010 +0300 @@ -33,12 +33,14 @@ \inpublicgroup QtBaseModule \ingroup ipc - \brief Encapsulates the core functionality of the interworking requests + \brief Encapsulates the core functionality of the application interworking requests for service clients + + See \ref terminology for terms used in this documentation. The XQAiwRequest class encapsulates the core functionality of the interworking requests and hides the implementation details. This object is created by the XQApplicationManager::create factory method. - This class is a part of API to be used by the applications instead of using XQServiceRequest directly. + This class is a part of Application Manager API to be used by the applications instead of using XQServiceRequest directly. The Application Manager API offers centric place for applications UIs to handle application to application interworking use cases, like: - Synchronous out-of-process service call from client to service provider, where service provider needs to complete the request before @@ -47,11 +49,11 @@ The control returns back requesting as soon the service provider has received the asynchronous call (can be applied to notifications as well). - Embedded out-of-process service call. In this case window groups are chained and "Back" returns to client window. - Any named Qt type in the Qt meta-object system can be used as a service call parameter or return value. Also own, custom meta-types are supported. - - Launched service provider application (.exe) if not already running when client makes service call to it. - - List and discover services dynamically. + - Launch service provider application (.exe) if not already running when client makes service call to it. + - List and discover services dynamically. Both normal and sharable (data-caged) files are supported. - Apply UI related options upon service launch, like "launch as embedded", "launch to foreground" and "launch to backround". - Opening files to be viewed by a file viewing interface. - - Opening URI to be viewed by a URI viewing interface. Includes also launching activity URIs (appto) as fire-and-forget manner. + - Open URI to be viewed by a URI viewing interface. Includes also launching activity URIs (appto) as fire-and-forget manner. - Miscellanous AIW support, like get service stasus or get DRM attributes. See the "examples/appmgrclient" included in the QtHighway release for usage examples. @@ -61,7 +63,6 @@ and non-embedded usage. \code // Recommended way is to add XQApplicationManager as member variable to class - // Later on when caching of services // You can use the class also as local variable. class Client { @@ -89,11 +90,11 @@ XQAiwRequest *request; // Create request by interface name, the very first service implementation // applied. - request = mAiwMgr.create("Interface", "functionName2(QString, int)", embedded); + request = mAiwMgr.create("Interface", "functionName2(QString,int)", embedded); // If dedicated service is wanted, apply this // request = mAiwMgr.create("Service", "Interface", - // "functionName2(QString, int)", embedded); + // "functionName2(QString,int)", embedded); if (request == NULL) { @@ -116,7 +117,7 @@ request->setEmbedded(true); // Send the request - bool res = request.send(); + bool res = request->send(); if (!res) { // Request failed. @@ -142,6 +143,110 @@ } \endcode + Problem solutions \n + Making QtHighway to produce traces helps sorting out the typical problems detected so far: + + You get lines like *PlatSec* ERROR - Capability check failed - A Message (function number=0x00000200) + from Thread ... line upon otherwise successful request. + - This is not an error. QTHighway collects available client capabilities into QSet and tests + for each capability using the RMessage2::HasCapability() function. The trace line is output + by that function. + + Null XQAiwReuest is returned meaning a service not found form Apparch service registry. + The trace has line "Discover error -1" or indications of XML parsing errors. + Check the following just in case: + - The XML file syntax is OK ( from trace you should see XML parsing error). + - After changing the XML you have run the qmake again. Otherwise changes in XML do not get visible. + - The generated application registration (*_reg.rss) contains the data as mentioned in the registration XML file. + - The compiled application registration file (*_reg.rsc) exists in "\epoc32\data\z\private\10003a3f\import\Apps" + and contains the same XML dat. + - In .iby file, the compiled application registration file (*_reg.rsc) has been copied to "\private\10003a3f\import\Apps". + - In .iby file, the standard application resource file referred from the *_reg.rss has been copied + to directory pointed using the macro S60_APP_RESOURCE or to directory referred by the macro + APP_RESOURCE_DIR (the macro from epoc32\include\data_caging_paths_for_iby.hrh). + - wk18 MCL specific: Looks like you need to get directories "\epoc32\winscw\c\sys\install" deleted (in emulator) + to get any changes noticed by apparch. This looks like Apparch problem. + + Service is found, but request returns an error "EMessageNotFound". + Check the following: + - Check that slot signatures match in calling side and in service side and they follow Qt slot naming. + - The slot signature does not contain extra spaces and does not contain reference (&) symbol. + + Services get unexpected disconnet "CApaServerSymbianSession::Disconnect". + - This is a symptom that client request object has been deleted by code or by the GOOM FW. + + Async response does not go back to client. + Check the following: + - You are using the request id returned by the setCurrentRequestAsync(). + - There are no "CApaServerSymbianSession::Disconnect" lines before calling the "complereRequest(asyncRequestIndex)". + - The traces does not tell any "NOT FOUND" message for request (client has not beed disconnected). + + Control Panel View cannot be launched using the QtHighway Service from an Indicator Plugin. + - See one solution from the RC case 424825. + + How to enable log traces? \n + - You can find xqservicelog.h from the top level inc-directory of the QtHighway. There are + two flags controlling QtHighway logging facilities. Both are disabled by default. + To enable logging, see the file /sf/qtextensions/qthighway//inc/xqservicelog.h. \n\n + + + + + + + + + + + + + +
Flag in the xqservicelogs.hDescription
XQSERVICE_DEBUG + Main flag that enables logging using default Qt logging facilities. This turn on qDebug() + traces from the QtHighway which are pretty handy to check. After defining the flag, rebuild + the qthigway folder only (no need to rebuild whole qtextensions package!). +
XQSERVICE_DEBUG_FILE + This has not been used nor tested! \n + Flag that enables file logging mode to XqServiceMessageHandler. This flag is dependent + on XQSERVICE_DEBUG flag and can't be enabled without it been enabled. +
+ + - Logging is done by using four macros \a XQSERVICE_DEBUG_PRINT, \a XQSERVICE_WARNING_PRINT, \a XQSERVICE_CRITICAL_PRINT, + \a XQSERVICE_FATAL_PRINT corresponding to qDebug, qWarning, qCritical and qFatal functionality. + + - XqServiceMessageHandler-class provides QtMessageHandler-function that can be used in applications to override + Qt default message handling functionality. To take it into use in application, install it by calling + \code + qInstallMsgHandler(XQSERVICEMESSAGEHANDLER); + \endcode + in the beginning of the applications main-function. The flags control XqServiceMessageHandler in the following way: \n\n + + + + + + + + + + + + + + + + + +
Flags definedFunctionality
None + XqServiceMessageHandler-class doesn't exist. +
XQSERVICE_DEBUG + XqServiceMessageHandler-class exists and uses RDebug to print all Qt messages. +
XQSERVICE_DEBUG and XQSERVICE_DEBUG_FILE + XqServiceMessageHandler-class exists and uses RFileLogger to write all Qt messages to a file. + To enable file logging, c:\logs\qt directory must exist. Log file is xqservice.log. Please + notice that RFileLogger depends on flogger.lib. +
+ \sa XQApplicationManager */ @@ -322,6 +427,17 @@ add the action to wanted UI widget. When the action is triggered the XQAiwRequest emits triggered() signal for caller. The XQAiwRequest owns the action (caller shall not delete the action object). + The localized QAction text is constructed from the the following custom properties + in the registration XML file: + - \b aiw_action_text_file which tell the .qm file which contains the text ID identified + by the "aiw_action_text". If no paths present in the the file name, default path + is constructed as follows + \code + qApp->applicationFilePath().left(2) + "/resource/qt/translations/" + textFile; + \endcode + - \b aiw_action_text contains the text ID which contains the translated text present in the .qm file identified by the aiw_action_text_file + - \b aiw_action_icon contain the name of QIcon resource created by the QIcon::addFile function. NOTE ! *This is experimental property* ! + \return QAction object, if there was action attached to request. Otherwise 0. */ QAction *XQAiwRequest::createAction() diff -r 9d760f716ca8 -r 3d09643def13 qthighway/xqservice/src/xqappmgr.cpp --- a/qthighway/xqservice/src/xqappmgr.cpp Thu Sep 02 21:20:48 2010 +0300 +++ b/qthighway/xqservice/src/xqappmgr.cpp Fri Sep 17 08:34:25 2010 +0300 @@ -26,17 +26,157 @@ #include #include "xqappmgr_p.h" +/*! \page page1 Terminology + + \anchor terminology + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
TermDefinitionNotes
activity + UXD defined term: \n + "Activity always refers to the users point of view. An activity is something + a user engages in for a purpose. An example of an activity would be: entering + an email, listening to music, browsing a web page, etc. Activities are + synonymous with experiences, and can be continuous or discontinuous". + + See more from http://s60wiki.nokia.com/S60Wiki/QtFw_for_S60_coding_conventions/Service_name_registry#Activity. +
client, client application + Application that use the a service application via the QtHighway. +
embedded + When a service application is launched as embedded, window groups of client + and service application are chained. The service application need to be + exited to return UI control back to client application. + + The embedded launch is considered as private connection between client and + service application. +
full service name + Combined service and interface (+ optional embedding part) name as follows. \n + 1. Service name \n + 2. Character *.* (dot) \n + 3. Interface name \n + 4. Character *.* (dot) (if embedded launch) \n + 5. Service application process name ((if embedded launch)) +
interface descriptor + Utility class to hold meta-data information constructed from the service configuration file. +
interface name + The name of interface as defined in the service configuration file. + + See http://s60wiki.nokia.com/S60Wiki/QtFw_for_S60_coding_conventions/Service_name_registry#Service_naming_guidelines. +
MIME registry + The database containing published MIME datatypes applications can view. + + Symbian OS Application Architecture implements the database. +
service application, service provider application + Qt/Orbit based based executable (.exe) that implements and hosts a service provider. +
operation, message + Utility's function to be called. Technically Qt slot signature without extra spaces and reference (&). +
service + Simple utilities offered via interface from an application to another other. + The service identified by the full service name. +
service configuration file + XML formatted file that describes the meta data of the service, e.g. service name, + interface name, custom properties, using the agreed XML schema. +
service name + The name of service as defined in the service configuration file. + + See http://s60wiki.nokia.com/S60Wiki/QtFw_for_S60_coding_conventions/Service_name_registry#Service_naming_guidelines. +
service provider + Instance of XQServiceProvider that is included into a service application + + In-process (.dll) providers not supported yet. +
service registry + The database containing published service configuration files. + + Symbian OS Application Architecture implements the database. +
+*/ + /*! \class XQApplicationManager \inpublicgroup QtBaseModule \ingroup ipc - \brief Factory class to list interface descriptors and create interworking objects (XQAiwRequest) + \brief The factory class of the Qt Extension's service framework to support out-of-process application interworking use cases + + See \ref terminology for terms used in this documentation. XQApplicationManager lists interface descriptors by interface and /or service name. It is also used to create interworking objects (XQAiwRequest). - This class is a part of API to be used by the applications instead of using XQServiceRequest directly. + This class is a part of Application Manager API to be used by the applications instead of using XQServiceRequest directly. The Application Manager API offers centric place for applications UIs to handle application to application interworking use cases, like: - Synchronous out-of-process service call from client to service provider, where service provider needs to complete the request before @@ -45,10 +185,10 @@ The control returns back requesting as soon the service provider has received the asynchronous call (can be applied to notifications as well). - Embedded out-of-process service call. In this case window groups are chained and "Back" returns to client window. - Any named Qt type in the Qt meta-object system can be used as a service call parameter or return value. Also own, custom meta-types are supported. - - Launched service provider application (.exe) if not already running when client makes service call to it. + - Launch service provider application (.exe) if not already running when client makes service call to it. - List and discover services dynamically. - Apply UI related options upon service launch, like "launch as embedded", "launch to foreground" and "launch to backround". - - Opening files to be viewed by a file viewing interface. + - Open files to be viewed by a file viewing interface. Both normal and sharable (data-caged) files are supported. - Opening URI to be viewed by a URI viewing interface. Includes also launching activity URIs (appto) as fire-and-forget manner. - Miscellanous AIW support, like get service stasus or get DRM attributes. @@ -58,7 +198,6 @@ and non-embedded usage: \code // Recommended way is to add XQApplicationManager as member variable to class - // Later on when caching of services // You can use the class also as local variable. class Client { @@ -86,11 +225,11 @@ XQAiwRequest *request; // Create request by interface name, the very first service implementation // applied. - request = mAiwMgr.create("Interface", "functionName2(QString, int)", embedded); + request = mAiwMgr.create("Interface", "functionName2(QString,int)", embedded); // If dedicated service is wanted, apply this // request = mAiwMgr.create("Service", "Interface", - // "functionName2(QString, int)", embedded); + // "functionName2(QString,int)", embedded); if (request == NULL) { @@ -125,7 +264,7 @@ // ....See previous example \endcode - The XQApplicationManager supports opening activity (see Terminology) URIs (appto scheme) as fire-and-forget mannner: + The XQApplicationManager supports opening activity URIs (appto scheme) as fire-and-forget mannner: \code QUrl url("appto://10207C62?activityname=MusicMainView"); @@ -140,11 +279,11 @@ // Set function parameters QList args; - args << uri.toSring(); + args << uri.toString(); request->setArguments(args); // Send the request - bool res = request.send(); + bool res = request->send(); if (!res) { // Request failed. @@ -163,7 +302,7 @@ { XQSERVICE_DEBUG_PRINT("XQApplicationManager::XQApplicationManager"); d = new XQApplicationManagerPrivate(); - + d->v_ptr = this; } XQApplicationManager::~XQApplicationManager() { @@ -401,7 +540,7 @@ /*! Create AIW requests to view the given file and having the MIME type attached. The interface name applied implicitly is declared by the constant XQI_FILE_VIEW - The first found service implementation is applied. + The default service implementation configured for the MIME type is returned. \param file The file to be viewed \param embedded True if embedded (window groups chained) call, false otherwise \return The application interworking request instance, or NULL if no viewer found. @@ -522,7 +661,8 @@ /*! Gets the values of the DRM related \a attributeNames, like "IsProtected", - "IsForwardable", "MimeType" for a given \a file. + "IsForwardable", "MimeType" for a given \a file. The set of supported attributes is same + as in Symbian OS CAF (though not all declared by the API). \param file File for which DRM attributes are retrieved \param attributeNames List of attributes that should be retrieved (check #DrmAttribute) \param attributeValues On success fills this list whith values, where each value is QVariant of the integer or string type. @@ -554,7 +694,7 @@ /*! Checks the status of the given service interface. - \param implementation Interface which status is being checked. + \param implementation Valid interface descriptor obtained by the list() call. \return Status of the service. */ XQApplicationManager::ServiceStatus XQApplicationManager::status(const XQAiwInterfaceDescriptor& implementation) @@ -563,4 +703,25 @@ return (ServiceStatus)d->status(implementation); } +/*! + Start monitoring for given service. + \param implementation Valid interface descriptor obtained by the list() call. + \return True if operation succesful, false otherwise. +*/ +bool XQApplicationManager::notifyRunning(XQAiwInterfaceDescriptor& serviceImplDescriptor) +{ + XQSERVICE_DEBUG_PRINT("XQApplicationManager::notifyRunning"); + return d->startNotifications(serviceImplDescriptor); +} +/*! + Stop monitoring for given service. + \param implementation Valid interface descriptor obtained by the list() call. + \return True if operation succesful, false otherwise. +*/ +bool XQApplicationManager::cancelNotifyRunning(XQAiwInterfaceDescriptor& serviceImplDescriptor) +{ + XQSERVICE_DEBUG_PRINT("XQApplicationManager::cancelNotifyRunning"); + return d->stopNotifications(serviceImplDescriptor); +} + diff -r 9d760f716ca8 -r 3d09643def13 qthighway/xqservice/src/xqappmgr.h --- a/qthighway/xqservice/src/xqappmgr.h Thu Sep 02 21:20:48 2010 +0300 +++ b/qthighway/xqservice/src/xqappmgr.h Fri Sep 17 08:34:25 2010 +0300 @@ -62,9 +62,15 @@ */ enum ServiceStatus { - Unknown=0, /*!< Not known */ - Enabled, /*!< Service enabled */ - Disabled /*!< Service disabled, e.g. required config not OK */ + Unknown=0, // Not known + Enabled, // Service enabled + Disabled // Service disabled, e.g. required config not OK, + }; + + enum ServiceState + { + ServiceStarted=0, + ServiceStopped }; XQApplicationManager(); @@ -100,13 +106,20 @@ bool getDrmAttributes(const XQSharableFile &file, const QList &attributeNames, QVariantList &attributeValues); ServiceStatus status(const XQAiwInterfaceDescriptor& implementation); - + + bool notifyRunning(XQAiwInterfaceDescriptor& serviceImplDescriptor); + bool cancelNotifyRunning(XQAiwInterfaceDescriptor& serviceImplDescriptor); + signals: - + void serviceStarted(XQAiwInterfaceDescriptor serviceImplDescriptor); + void serviceStopped(XQAiwInterfaceDescriptor serviceImplDescriptor); + private: // Disable copy contructor Q_DISABLE_COPY(XQApplicationManager) XQApplicationManagerPrivate *d; + + friend class XQApplicationManagerPrivate; }; #endif diff -r 9d760f716ca8 -r 3d09643def13 qthighway/xqservice/src/xqappmgr_p.cpp --- a/qthighway/xqservice/src/xqappmgr_p.cpp Thu Sep 02 21:20:48 2010 +0300 +++ b/qthighway/xqservice/src/xqappmgr_p.cpp Fri Sep 17 08:34:25 2010 +0300 @@ -27,19 +27,25 @@ #include #include "xqservicelog.h" +#include "xqserviceutil.h" #include "xqaiwutils.h" #include "xqaiwuridriver.h" #include "xqaiwdecl.h" #include "xqappmgr_p.h" +#include + /*! \class XQApplicationManagerPrivate \brief Private implementation of the XQApplicationManager */ XQApplicationManagerPrivate::XQApplicationManagerPrivate(): + QObject(), + v_ptr(0), serviceMgr(0), - aiwUtilities(0) + aiwUtilities(0), + settingsManagerInstance(0) { XQSERVICE_DEBUG_PRINT("XQApplicationManagerPrivate"); @@ -51,6 +57,7 @@ XQSERVICE_DEBUG_PRINT("~XQApplicationManagerPrivate"); delete serviceMgr; delete aiwUtilities; + delete settingsManagerInstance; } XQAiwRequest* XQApplicationManagerPrivate::create( const QString &interface, const QString &operation, bool embedded) @@ -358,12 +365,11 @@ return XQApplicationManager::Unknown; } - XQSettingsManager settingsManager; int implId = implementation.property(XQAiwInterfaceDescriptor::ImplementationId).toInt(); XQSERVICE_DEBUG_PRINT("XQApplicationManagerPrivate %x,%x", keyId, implId); XQSettingsKey statusKey (XQSettingsKey::TargetCentralRepository, implId, keyId); - QVariant value = settingsManager.readItemValue(statusKey); + QVariant value = settingsManager()->readItemValue(statusKey); if (value.isNull()) { XQSERVICE_DEBUG_PRINT("XQApplicationManagerPrivate Cenrep %x does not contain key %x", @@ -533,10 +539,99 @@ } } - if (result.isEmpty()) - { + if (result.isEmpty()) { // No service support present, try using the MIME handlers via old way return mimeHandlers; } return result; } + +bool XQApplicationManagerPrivate::startNotifications(XQAiwInterfaceDescriptor& serviceImplDescriptor) +{ + QString crcName = QString("%1.%2").arg(serviceImplDescriptor.serviceName()).arg(serviceImplDescriptor.interfaceName()).toLower(); + + quint32 crc = XQServiceUtil::serviceIdFromName(crcName.toLatin1().data()); + descriptorsMap.insert(crc, serviceImplDescriptor); + XQSettingsManager *settings = settingsManager(); + + bool ok = false; + + XQSERVICE_CONNECT(settings, SIGNAL(valueChanged(XQSettingsKey,QVariant)), this, SLOT(valueChanged(XQSettingsKey,QVariant))); + XQSERVICE_CONNECT(settings, SIGNAL(itemDeleted(XQSettingsKey)), this, SLOT(itemDeleted(XQSettingsKey))); + + quint32 uid = serviceImplDescriptor.property(XQAiwInterfaceDescriptor::ImplementationId).toInt(&ok); + + if (ok) { + XQSettingsKey key(XQSettingsKey::TargetPublishAndSubscribe, uid, crc); + ok = settings->startMonitoring(key); + // key may be discarded now, as we got full information about recreating it while stopping notifications. + } + + return ok; +} + +bool XQApplicationManagerPrivate::stopNotifications(XQAiwInterfaceDescriptor& serviceImplDescriptor) +{ + quint32 crc = XQServiceUtil::serviceIdFromName(serviceImplDescriptor.serviceName().toLatin1().data()); + descriptorsMap.remove(crc); + XQSettingsManager *settings = settingsManager(); + + bool ok = false; + quint32 uid = serviceImplDescriptor.property(XQAiwInterfaceDescriptor::ImplementationId).toInt(&ok); + if (ok) { + XQSettingsKey key(XQSettingsKey::TargetPublishAndSubscribe, uid, crc); + ok = settings->stopMonitoring(key); + } + return ok; +} + +void XQApplicationManagerPrivate::valueChanged(const XQSettingsKey& key, const QVariant& value) +{ + XQSERVICE_DEBUG_PRINT("XQApplicationManager::valueChanged"); + bool ok = false; + XQApplicationManager::ServiceState state = (XQApplicationManager::ServiceState)(value.toInt(&ok)); + + if (ok) { + switch (state) { + case XQApplicationManager::ServiceStarted: + { + XQSERVICE_DEBUG_PRINT("XQApplicationManager::valueChanged : service started"); + XQAiwInterfaceDescriptor descriptor = descriptorsMap.value(key.key()); + //TODO add dummy descriptor check (no entry in map) + emit v_ptr->serviceStarted(descriptor); + } + break; + case XQApplicationManager::ServiceStopped: + { + XQSERVICE_DEBUG_PRINT("XQApplicationManager::valueChanged : service stopped"); + XQAiwInterfaceDescriptor descriptor = descriptorsMap.value(key.key()); + //TODO add dummy descriptor check (no entry in map) + emit v_ptr->serviceStopped(descriptor); + } + break; + default: + ok = false; + break; + } + } + + if (!ok) { + //assertion + XQSERVICE_WARNING_PRINT("XQApplicationManager::valueChanged : Service status undecipherable. Potential bug, please report."); + } +} + +void XQApplicationManagerPrivate::itemDeleted(const XQSettingsKey& key) +{ + XQSERVICE_DEBUG_PRINT("XQApplicationManager::itemDeleted"); + Q_UNUSED(key); +} + +XQSettingsManager *XQApplicationManagerPrivate::settingsManager() +{ + if (settingsManagerInstance == 0) { + settingsManagerInstance = new XQSettingsManager(); + } + return settingsManagerInstance; +} + diff -r 9d760f716ca8 -r 3d09643def13 qthighway/xqservice/src/xqappmgr_p.h --- a/qthighway/xqservice/src/xqappmgr_p.h Thu Sep 02 21:20:48 2010 +0300 +++ b/qthighway/xqservice/src/xqappmgr_p.h Fri Sep 17 08:34:25 2010 +0300 @@ -27,6 +27,8 @@ #include #include #include +#include + #include #include #include @@ -34,9 +36,13 @@ class XQServiceManager; class XQAiwUtils; +class XQSettingsManager; +class XQSettingsKey; -class XQApplicationManagerPrivate +class XQApplicationManagerPrivate : public QObject { + Q_OBJECT + public: XQApplicationManagerPrivate(); virtual ~XQApplicationManagerPrivate(); @@ -62,6 +68,13 @@ bool getDrmAttributes(const XQSharableFile &file, const QList &attributeNames, QVariantList &attributeValues); int status(const XQAiwInterfaceDescriptor& implementation); + bool startNotifications(XQAiwInterfaceDescriptor& serviceImplDescriptor); + bool stopNotifications(XQAiwInterfaceDescriptor& serviceImplDescriptor); + +public slots: + void valueChanged(const XQSettingsKey& key, const QVariant& value); + void itemDeleted(const XQSettingsKey& key); + private: QList listMimeHandlers(const QFile &file); @@ -69,10 +82,19 @@ bool getAppDescriptor(const QUrl &uri, XQAiwInterfaceDescriptor *descriptor); QList listFileHandlers(const QList &mimeHandlers); + XQSettingsManager *settingsManager(); + private: + XQApplicationManager *v_ptr; + XQServiceManager * serviceMgr; XQAiwUtils * aiwUtilities; + XQSettingsManager *settingsManagerInstance; + + QMap descriptorsMap; + + friend class XQApplicationManager; }; #endif diff -r 9d760f716ca8 -r 3d09643def13 qthighway/xqservice/src/xqservice.pri --- a/qthighway/xqservice/src/xqservice.pri Thu Sep 02 21:20:48 2010 +0300 +++ b/qthighway/xqservice/src/xqservice.pri Fri Sep 17 08:34:25 2010 +0300 @@ -33,6 +33,7 @@ src/xqaiwfiledriver.h \ src/xqaiwuridriver.h \ src/xqappmgr.h \ + src/xqappmgr_p.h \ src/xqaiwutils.h SOURCES += \ diff -r 9d760f716ca8 -r 3d09643def13 qthighway/xqservice/src/xqserviceprovider.cpp --- a/qthighway/xqservice/src/xqserviceprovider.cpp Thu Sep 02 21:20:48 2010 +0300 +++ b/qthighway/xqservice/src/xqserviceprovider.cpp Fri Sep 17 08:34:25 2010 +0300 @@ -28,6 +28,7 @@ #include //#include #include +#include "xqrequestutil.h" /*! \class ServiceAdaptorProxy @@ -106,9 +107,11 @@ \class XQServiceProvider \inpublicgroup QtBaseModule - \brief The XQServiceProvider class provides an interface to messages on a XQService service - which simplifies remote slot invocations + \brief Base class of the Qt Extension's service framework for implementing out-of-process service providers. + It supports implementing out-of-process slots that can be invoked from remote service clients + See \ref terminology for terms used in this documentation. + Service messages consist of a service name, a message name, and a list of parameter values. Qt extension dispatches service messages to the applications associated with the service name, on the application's \c{QPE/Application/appname} channel, where @@ -118,8 +121,8 @@ Service provider need to register it's service into the system before they can be used by the service client. Registration is done by creating a XML formatted service configuration file and defining the service in the provider's .pro-file. QMake will notice service provider - from the .pro-file, with help of the service.prf file, and generate a make file that uses - a helper application xqsreg.exe. The helper application sqsreg.exe will generate an application + from the .pro-file, with help of the service.prf file, and generate necessary resources for + the Symbian application registry. The helper application sqsreg.exe will generate an application registration resource file ( _reg.rss) from the configuration-file and provider's definitions that include the needed declarations for the services provided. @@ -173,19 +176,6 @@ \endcode - Also the old format described below is supported, With old format you can not have custom properties, which - for example are used for AIW purposes. - \code - - - - - - - - - \endcode - Changing service or interface names \n Before you think about changing the name of the already released and used service implementation, read this http://s60wiki.nokia.com/S60Wiki/QtFw_for_S60_coding_conventions/Service_name_registry#About_changing_service_or_interface_names @@ -196,15 +186,9 @@ Service Registration tools \n The needed utility files for service registration: - xqsreg.exe should be in \epoc32\tools or some other directory that can be found from the path - - service.prf should be in \epoc32\tools\qt\mkspecs\features\symbian directory. If necessary you can copy those files to target directories from qthighway/bin. - Sources for the xqsreg.exe can be found from the qthighway\xqsreg and it is also possible to compile it. - - cd \qthighway\xqsreg - - qmake -platform win32-mwc - - make - Usage: \n How to create a simple synchronously working service provider? \code @@ -433,11 +417,11 @@ // Set function parameters QList args; - args << uri.toSring(); + args << uri.toString(); request->setArguments(args); // Send the request - bool res = request.send(); + bool res = request->send(); if (!res) { // Request failed. @@ -530,7 +514,7 @@ request->setArguments(args); // Send the request - bool res = request.send(); + bool res = request->send(); if (!res) { // Request failed. @@ -576,7 +560,7 @@ req->setArguments(args); // Send the request - bool res = request.send(); + bool res = request->send(); if (!res) { // Request failed. @@ -639,16 +623,16 @@ /*! \fn void XQServiceProvider::returnValueDelivered() - This signal is emitted when asynchronous request has been completed and its - return value has been delivered to the service client. + This signal is emitted when request has been completed and its return value has been + delivered to the service client. Synchronous request get completed upon returning + from slot call, asynchronous gets completed when completeRequest is called. */ /*! \fn void XQServiceProvider::clientDisconnected() - This signal is emitted if client accessing a service application terminates. - The counterpart in client side (when service application terminates) is - the error XQService::EConnectionClosed. + This signal is emitted if there is on-going request and client destroys + the XQAiwRequest for some reason, e.g when exiting the client process. */ /*! @@ -700,6 +684,9 @@ else { m_data->m_adaptor->publishAll(m_data->plugin, 0, XQServiceAdaptor::Slots); } + + if (XQServiceUtil::isEmbedded()) + XQServiceUtils::closeWhenClientClosed(); } /*! @@ -711,7 +698,11 @@ comes in, it will have different index and you will potentially override the index of the first request. You should ensure the completeRequest() gets the correct index e.g. by attaching the index as user data to data object maintain a map of indexes based on - some key. + some key. \n + This should be used for a request set asynchronous by client only. This has no + impact to the client side behaviour. For the synchronous request client side "send" + will wait for the completion. For the asyncronous request the client side gets + signalled when the completion happens. */ int XQServiceProvider::setCurrentRequestAsync() { diff -r 9d760f716ca8 -r 3d09643def13 qthighway/xqservice/xqservice.pro --- a/qthighway/xqservice/xqservice.pro Thu Sep 02 21:20:48 2010 +0300 +++ b/qthighway/xqservice/xqservice.pro Fri Sep 17 08:34:25 2010 +0300 @@ -38,7 +38,7 @@ } XQSERVICE_ROOT=.. - + include(src/api_headers.pri) include(../xqservicebase.pri) include(src/xqservice.pri) @@ -48,6 +48,6 @@ LIBS+=-lxqsettingsmanager libFiles.sources = xqservice.dll xqserviceutil.dll -libFiles.path = "!:\sys\bin" +libFiles.path = "!:/sys/bin" DEPLOYMENT += libFiles diff -r 9d760f716ca8 -r 3d09643def13 qthighway/xqservicebase.pri --- a/qthighway/xqservicebase.pri Thu Sep 02 21:20:48 2010 +0300 +++ b/qthighway/xqservicebase.pri Fri Sep 17 08:34:25 2010 +0300 @@ -40,6 +40,7 @@ QMAKE_LIBDIR = $$DESTDIR $$QMAKE_LIBDIR symbian { + defFilePath=.. deploy.path = / # This is for new exporting system coming in garden diff -r 9d760f716ca8 -r 3d09643def13 qthighway/xqserviceipc/xqserviceipcserver/xqserviceipcserver.pro --- a/qthighway/xqserviceipc/xqserviceipcserver/xqserviceipcserver.pro Thu Sep 02 21:20:48 2010 +0300 +++ b/qthighway/xqserviceipc/xqserviceipcserver/xqserviceipcserver.pro Fri Sep 17 08:34:25 2010 +0300 @@ -26,7 +26,7 @@ include(api_headers.pri) include($$XQSERVICE_ROOT/xqservicebase.pri) -QT -=gui +QT +=gui QT +=network #Sources @@ -67,5 +67,5 @@ # "xqserviceipcserversession.h ..\..\inc\xqserviceipcserversession.h" \ # "xqserviceipcrequest.h ..\..\inc\xqserviceipcrequest.h" - LIBS += -lapgrfx -lws32 -lapparc -lxqserviceutil -lefsrv + LIBS += -lapgrfx -lws32 -lapparc -lxqserviceutil -lefsrv -lxqsettingsmanager } diff -r 9d760f716ca8 -r 3d09643def13 qthighway/xqserviceipc/xqserviceipcserver/xqserviceipcserver_apasymbianserver.cpp --- a/qthighway/xqserviceipc/xqserviceipcserver/xqserviceipcserver_apasymbianserver.cpp Thu Sep 02 21:20:48 2010 +0300 +++ b/qthighway/xqserviceipc/xqserviceipcserver/xqserviceipcserver_apasymbianserver.cpp Fri Sep 17 08:34:25 2010 +0300 @@ -24,6 +24,11 @@ #include "xqserviceipcserver_apasymbianserver.h" #include "xqserviceipcserver_apasymbiansession.h" +#include +#include +#include +#include + namespace QtService { // Server Security Policy @@ -60,8 +65,10 @@ /*! Constructor. */ -CApaSymbianServer::CApaSymbianServer() /*: -CPolicyServer( EServerPriority, KServerPolicy)*/ +CApaSymbianServer::CApaSymbianServer() : + settingsManager(), + stateNotifyKey(0) +/*CPolicyServer( EServerPriority, KServerPolicy)*/ { XQSERVICE_DEBUG_PRINT("CApaSymbianServer::CApaSymbianServer"); SetPriority(EServerPriority); @@ -93,6 +100,7 @@ CApaSymbianServer::~CApaSymbianServer() { XQSERVICE_DEBUG_PRINT("CApaSymbianServer::~CApaSymbianServer"); + delete stateNotifyKey; } /*! @@ -114,7 +122,24 @@ XQSERVICE_DEBUG_PRINT("listen status=%d", err); if (err != KErrNone) { listening = false; - } + } else { + QString normalizedServerName = aServerName.toLower(); + quint32 id = XQServiceUtil::serviceIdFromName(normalizedServerName.toLatin1().data()); + + delete stateNotifyKey; + + RProcess currentProcess; + const TSecureId secureId = currentProcess.SecureId(); + + stateNotifyKey = new XQPublishAndSubscribeSettingsKey(secureId.iId, id); + + XQPublishAndSubscribeUtils utils(settingsManager); + if (!utils.defineProperty(*stateNotifyKey, XQSettingsManager::TypeInt) && (settingsManager.error() != XQSettingsManager::AlreadyExistsError)) { + XQSERVICE_WARNING_PRINT("CApaSymbianServer::listen: property for service UID:%s could not be created. Notifications may not work.", stateNotifyKey->uid()); + } else { + settingsManager.writeItemValue(*stateNotifyKey, static_cast(XQApplicationManager::ServiceStarted)); + } + } // Complete the server rendezvous that th client started XQSERVICE_DEBUG_PRINT("CApaSymbianServer::Rendezvouz"); RProcess::Rendezvous(KErrNone); @@ -131,6 +156,13 @@ XQSERVICE_DEBUG_PRINT("CApaSymbianServer::disconnect"); // Symbian Servers do not have disconnect, // the process has to exit + + if (stateNotifyKey != 0) { + settingsManager.writeItemValue(*stateNotifyKey, QVariant(XQApplicationManager::ServiceStopped)); + } + + delete stateNotifyKey; + stateNotifyKey = 0; } /*! diff -r 9d760f716ca8 -r 3d09643def13 qthighway/xqserviceipc/xqserviceipcserver/xqserviceipcserver_apasymbianserver.h --- a/qthighway/xqserviceipc/xqserviceipcserver/xqserviceipcserver_apasymbianserver.h Thu Sep 02 21:20:48 2010 +0300 +++ b/qthighway/xqserviceipc/xqserviceipcserver/xqserviceipcserver_apasymbianserver.h Fri Sep 17 08:34:25 2010 +0300 @@ -30,7 +30,10 @@ #include +#include + class CApaServerSymbianSession; +class XQPublishAndSubscribeKey; namespace QtService { class MServiceIPCObserver; @@ -72,6 +75,10 @@ private: // data MServiceIPCObserver* iObserver; + + XQSettingsManager settingsManager; + XQPublishAndSubscribeSettingsKey *stateNotifyKey; + }; } #endif // C_XQSERVICEIPCSERVER_APA_SYMBIAN_SERVER_H diff -r 9d760f716ca8 -r 3d09643def13 qthighway/xqserviceutil/src/xqrequestutil.cpp --- a/qthighway/xqserviceutil/src/xqrequestutil.cpp Thu Sep 02 21:20:48 2010 +0300 +++ b/qthighway/xqserviceutil/src/xqrequestutil.cpp Fri Sep 17 08:34:25 2010 +0300 @@ -22,8 +22,227 @@ #include "xqservicelog.h" #include "xqserviceerrdefs.h" +#include // RWsSession +#include +#include + #include "xqrequestutil.h" +// ======== LOCAL CLASSES ======== + +class CParentObserver: public CActive +{ +public: + + /** + * Starts to observe if parent is still running and close embedded view when parent closed + */ + static void closeWhenParentClosedL(); + + /** + * C++ destructor. + */ + virtual ~CParentObserver(); + +protected: + + // @see CActive + virtual void RunL(); + + // @see CActive + virtual void DoCancel(); + + // @see CActive + virtual TInt RunError( TInt aError ); + +private: + + CParentObserver(); + void ConstructL(); + void IssueRequest(); + void HandleWsEventL(const TWsEvent &aEvent); + +private: // Data + + class ParentObserverDestructor + { + public: + ParentObserverDestructor():iObserver(NULL){} + + ~ParentObserverDestructor() + { + delete iObserver; + } + + CParentObserver* iObserver; + }; + + static ParentObserverDestructor iInstance; + + /** Window server session */ + RWsSession iWsSession; + + /** Window group for receiving window server events */ + RWindowGroup* iWindowGroup; +}; + +CParentObserver::ParentObserverDestructor CParentObserver::iInstance; + +// --------------------------------------------------------------------------- +// C++ constructor. +// --------------------------------------------------------------------------- +// +CParentObserver::CParentObserver(): + CActive(CActive::EPriorityStandard) +{ + CActiveScheduler::Add(this); +} + +// --------------------------------------------------------------------------- +// Symbian 2nd phase constructor. +// --------------------------------------------------------------------------- +// +void CParentObserver::ConstructL() +{ + // Connect to window server server + User::LeaveIfError(iWsSession.Connect()); + + // Construct window group + iWindowGroup = new(ELeave) RWindowGroup(iWsSession); + User::LeaveIfError( iWindowGroup->Construct((TUint32)this, EFalse)); + User::LeaveIfError(iWindowGroup->EnableGroupChangeEvents()); +} + +// --------------------------------------------------------------------------- +// Starts to observe if parent is still running and close embedded view when parent closed +// --------------------------------------------------------------------------- +// +void CParentObserver::closeWhenParentClosedL() +{ + if (!iInstance.iObserver) { + iInstance.iObserver = new (ELeave) CParentObserver(); + iInstance.iObserver->ConstructL(); + } + + iInstance.iObserver->IssueRequest(); +} + +// --------------------------------------------------------------------------- +// C++ destructor. +// --------------------------------------------------------------------------- +// +CParentObserver::~CParentObserver() +{ + Cancel(); + + // Cleanup window group + if(iWindowGroup) { + iWindowGroup->DisableGroupChangeEvents(); + iWindowGroup->Close(); + delete iWindowGroup; + } + + // Cleanup window server session + iWsSession.Close(); +} + +//------------------------------------------------------------------------------ +// CParentObserver::IssueRequest +//------------------------------------------------------------------------------ +// +void CParentObserver::IssueRequest() +{ + if(!IsActive()) { + // Request events from window server + iWsSession.EventReady(&iStatus); + SetActive(); + } +} + +//------------------------------------------------------------------------------ +// CParentObserver::HandleWsEventL +//------------------------------------------------------------------------------ +// +void CParentObserver::HandleWsEventL(const TWsEvent &aEvent) +{ + if (aEvent.Type() == EEventWindowGroupsChanged) { + RWindowGroup rootWG = CCoeEnv::Static()->RootWin(); + int rootWGId = rootWG.Identifier(); + + RArray list; + CleanupClosePushL(list); + iWsSession.WindowGroupList(&list); + + for(int idx = 0; idx < list.Count(); idx++) + { + RWsSession::TWindowGroupChainInfo info = list[idx]; + if (info.iId == rootWGId && info.iParentId <= 0) { + qApp->quit(); + break; + } + } + CleanupStack::PopAndDestroy(); // list + } +} + +//------------------------------------------------------------------------------ +// CParentObserver::RunL +//------------------------------------------------------------------------------ +// +void CParentObserver::RunL() +{ + TInt err = iStatus.Int(); + if(err == KErrNone) { + // No errors occured, fetch event + TWsEvent wsEvent; + iWsSession.GetEvent(wsEvent); + + // Continue listening + IssueRequest(); + + // Forward event to observer + HandleWsEventL(wsEvent); + } + else { + // Continue listening + IssueRequest(); + } +} + +//------------------------------------------------------------------------------ +// CParentObserver::DoCancel +//------------------------------------------------------------------------------ +// +void CParentObserver::DoCancel() +{ + // Cancel event ready from window server + iWsSession.EventReadyCancel(); +} + +//------------------------------------------------------------------------------ +// CParentObserver::RunError +//------------------------------------------------------------------------------ +// +TInt CParentObserver::RunError(TInt /*aError*/) +{ + // Issue a new request + IssueRequest(); + + return KErrNone; +} + +/*! + Observes if client is still running and close embedded view when client closed +*/ +void XQServiceUtils::closeWhenClientClosed() +{ + XQSERVICE_DEBUG_PRINT("XQServiceUtil::closeEVWhenClientClosed"); + + TRAPD(err, CParentObserver::closeWhenParentClosedL()); + + XQSERVICE_DEBUG_PRINT("XQServiceUtil::closeEVWhenClientClosed return value: ", err); +} + XQRequestUtil::XQRequestUtil() { XQSERVICE_DEBUG_PRINT("XQRequestUtil::XQRequestUtil"); diff -r 9d760f716ca8 -r 3d09643def13 qthighway/xqserviceutil/src/xqrequestutil.h --- a/qthighway/xqserviceutil/src/xqrequestutil.h Thu Sep 02 21:20:48 2010 +0300 +++ b/qthighway/xqserviceutil/src/xqrequestutil.h Fri Sep 17 08:34:25 2010 +0300 @@ -54,6 +54,9 @@ static const char * StartupArgInterfaceName = "intf="; static const char * StartupArgOperationName = "oper="; static const char * StartupArgServiceName = "xqsn="; + + // Observes if client is still running and close embedded view when client closed + XQSERVICEUTIL_EXPORT void closeWhenClientClosed(); } diff -r 9d760f716ca8 -r 3d09643def13 qthighway/xqserviceutil/src/xqservicemanager.cpp --- a/qthighway/xqserviceutil/src/xqservicemanager.cpp Thu Sep 02 21:20:48 2010 +0300 +++ b/qthighway/xqserviceutil/src/xqservicemanager.cpp Fri Sep 17 08:34:25 2010 +0300 @@ -46,13 +46,13 @@ #include "xqconversions.h" -#define TIMER_DELAY 3000 +#define TIMER_DELAY 3000000 // 3000000 microseconds == 3s class CProcessInfo : public CActive { public: static void AddProcessL(const TUid& appUid, RProcess& appProcess); - static void EnsureProcessCanStartL(const TUid& appUid); + static bool EnsureProcessCanStartL(const TUid& appUid); protected: CProcessInfo(const TUid& appUid); @@ -111,14 +111,14 @@ CleanupStack::Pop(self); } -void CProcessInfo::EnsureProcessCanStartL(const TUid& appUid) +bool CProcessInfo::EnsureProcessCanStartL(const TUid& appUid) { XQSERVICE_DEBUG_PRINT("CProcessInfo::EnsureProcessCanStartL"); + + bool ret = true; CProcessInfo* previousProcess = iProcessInfoMap.map[appUid.iUid]; if (previousProcess) { - previousProcess->Cancel(); - // Timer is for ensure that wait will end. // Maybe there is possibility that destroing process notification could be lost. RTimer securityTimer; @@ -129,10 +129,14 @@ securityTimer.After(timerStatus, TIMER_DELAY); User::WaitForRequest(previousProcess->iStatus, timerStatus); + if (previousProcess->iStatus == KRequestPending) + ret = false; + CleanupStack::PopAndDestroy(); delete previousProcess; iProcessInfoMap.map.remove(appUid.iUid); } + return ret; } void CProcessInfo::RunL() @@ -493,7 +497,8 @@ } } else { - CProcessInfo::EnsureProcessCanStartL(uid); + if(!CProcessInfo::EnsureProcessCanStartL(uid)) + User::Leave(KErrAlreadyExists); } TRequestStatus requestStatusForRendezvous; diff -r 9d760f716ca8 -r 3d09643def13 qthighway/xqserviceutil/src/xqserviceutil.cpp --- a/qthighway/xqserviceutil/src/xqserviceutil.cpp Thu Sep 02 21:20:48 2010 +0300 +++ b/qthighway/xqserviceutil/src/xqserviceutil.cpp Fri Sep 17 08:34:25 2010 +0300 @@ -29,12 +29,10 @@ #include #include #include -#include -#include -#include // RWsSession #include #include + // ======== LOCAL FUNCTIONS ======== static bool isKeySet(const QString &key) { @@ -106,7 +104,6 @@ return ret; } - // ======== MEMBER FUNCTIONS ======== /*! @@ -265,3 +262,84 @@ return keyValue(argc,argv,QString::fromLatin1(XQServiceUtils::StartupArgServiceName)); } +static const quint32 CrcTab32[256] = { + 0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, + 0x076dc419UL, 0x706af48fUL, 0xe963a535UL, 0x9e6495a3UL, + 0x0edb8832UL, 0x79dcb8a4UL, 0xe0d5e91eUL, 0x97d2d988UL, + 0x09b64c2bUL, 0x7eb17cbdUL, 0xe7b82d07UL, 0x90bf1d91UL, + 0x1db71064UL, 0x6ab020f2UL, 0xf3b97148UL, 0x84be41deUL, + 0x1adad47dUL, 0x6ddde4ebUL, 0xf4d4b551UL, 0x83d385c7UL, + 0x136c9856UL, 0x646ba8c0UL, 0xfd62f97aUL, 0x8a65c9ecUL, + 0x14015c4fUL, 0x63066cd9UL, 0xfa0f3d63UL, 0x8d080df5UL, + 0x3b6e20c8UL, 0x4c69105eUL, 0xd56041e4UL, 0xa2677172UL, + 0x3c03e4d1UL, 0x4b04d447UL, 0xd20d85fdUL, 0xa50ab56bUL, + 0x35b5a8faUL, 0x42b2986cUL, 0xdbbbc9d6UL, 0xacbcf940UL, + 0x32d86ce3UL, 0x45df5c75UL, 0xdcd60dcfUL, 0xabd13d59UL, + 0x26d930acUL, 0x51de003aUL, 0xc8d75180UL, 0xbfd06116UL, + 0x21b4f4b5UL, 0x56b3c423UL, 0xcfba9599UL, 0xb8bda50fUL, + 0x2802b89eUL, 0x5f058808UL, 0xc60cd9b2UL, 0xb10be924UL, + 0x2f6f7c87UL, 0x58684c11UL, 0xc1611dabUL, 0xb6662d3dUL, + 0x76dc4190UL, 0x01db7106UL, 0x98d220bcUL, 0xefd5102aUL, + 0x71b18589UL, 0x06b6b51fUL, 0x9fbfe4a5UL, 0xe8b8d433UL, + 0x7807c9a2UL, 0x0f00f934UL, 0x9609a88eUL, 0xe10e9818UL, + 0x7f6a0dbbUL, 0x086d3d2dUL, 0x91646c97UL, 0xe6635c01UL, + 0x6b6b51f4UL, 0x1c6c6162UL, 0x856530d8UL, 0xf262004eUL, + 0x6c0695edUL, 0x1b01a57bUL, 0x8208f4c1UL, 0xf50fc457UL, + 0x65b0d9c6UL, 0x12b7e950UL, 0x8bbeb8eaUL, 0xfcb9887cUL, + 0x62dd1ddfUL, 0x15da2d49UL, 0x8cd37cf3UL, 0xfbd44c65UL, + 0x4db26158UL, 0x3ab551ceUL, 0xa3bc0074UL, 0xd4bb30e2UL, + 0x4adfa541UL, 0x3dd895d7UL, 0xa4d1c46dUL, 0xd3d6f4fbUL, + 0x4369e96aUL, 0x346ed9fcUL, 0xad678846UL, 0xda60b8d0UL, + 0x44042d73UL, 0x33031de5UL, 0xaa0a4c5fUL, 0xdd0d7cc9UL, + 0x5005713cUL, 0x270241aaUL, 0xbe0b1010UL, 0xc90c2086UL, + 0x5768b525UL, 0x206f85b3UL, 0xb966d409UL, 0xce61e49fUL, + 0x5edef90eUL, 0x29d9c998UL, 0xb0d09822UL, 0xc7d7a8b4UL, + 0x59b33d17UL, 0x2eb40d81UL, 0xb7bd5c3bUL, 0xc0ba6cadUL, + 0xedb88320UL, 0x9abfb3b6UL, 0x03b6e20cUL, 0x74b1d29aUL, + 0xead54739UL, 0x9dd277afUL, 0x04db2615UL, 0x73dc1683UL, + 0xe3630b12UL, 0x94643b84UL, 0x0d6d6a3eUL, 0x7a6a5aa8UL, + 0xe40ecf0bUL, 0x9309ff9dUL, 0x0a00ae27UL, 0x7d079eb1UL, + 0xf00f9344UL, 0x8708a3d2UL, 0x1e01f268UL, 0x6906c2feUL, + 0xf762575dUL, 0x806567cbUL, 0x196c3671UL, 0x6e6b06e7UL, + 0xfed41b76UL, 0x89d32be0UL, 0x10da7a5aUL, 0x67dd4accUL, + 0xf9b9df6fUL, 0x8ebeeff9UL, 0x17b7be43UL, 0x60b08ed5UL, + 0xd6d6a3e8UL, 0xa1d1937eUL, 0x38d8c2c4UL, 0x4fdff252UL, + 0xd1bb67f1UL, 0xa6bc5767UL, 0x3fb506ddUL, 0x48b2364bUL, + 0xd80d2bdaUL, 0xaf0a1b4cUL, 0x36034af6UL, 0x41047a60UL, + 0xdf60efc3UL, 0xa867df55UL, 0x316e8eefUL, 0x4669be79UL, + 0xcb61b38cUL, 0xbc66831aUL, 0x256fd2a0UL, 0x5268e236UL, + 0xcc0c7795UL, 0xbb0b4703UL, 0x220216b9UL, 0x5505262fUL, + 0xc5ba3bbeUL, 0xb2bd0b28UL, 0x2bb45a92UL, 0x5cb36a04UL, + 0xc2d7ffa7UL, 0xb5d0cf31UL, 0x2cd99e8bUL, 0x5bdeae1dUL, + 0x9b64c2b0UL, 0xec63f226UL, 0x756aa39cUL, 0x026d930aUL, + 0x9c0906a9UL, 0xeb0e363fUL, 0x72076785UL, 0x05005713UL, + 0x95bf4a82UL, 0xe2b87a14UL, 0x7bb12baeUL, 0x0cb61b38UL, + 0x92d28e9bUL, 0xe5d5be0dUL, 0x7cdcefb7UL, 0x0bdbdf21UL, + 0x86d3d2d4UL, 0xf1d4e242UL, 0x68ddb3f8UL, 0x1fda836eUL, + 0x81be16cdUL, 0xf6b9265bUL, 0x6fb077e1UL, 0x18b74777UL, + 0x88085ae6UL, 0xff0f6a70UL, 0x66063bcaUL, 0x11010b5cUL, + 0x8f659effUL, 0xf862ae69UL, 0x616bffd3UL, 0x166ccf45UL, + 0xa00ae278UL, 0xd70dd2eeUL, 0x4e048354UL, 0x3903b3c2UL, + 0xa7672661UL, 0xd06016f7UL, 0x4969474dUL, 0x3e6e77dbUL, + 0xaed16a4aUL, 0xd9d65adcUL, 0x40df0b66UL, 0x37d83bf0UL, + 0xa9bcae53UL, 0xdebb9ec5UL, 0x47b2cf7fUL, 0x30b5ffe9UL, + 0xbdbdf21cUL, 0xcabac28aUL, 0x53b39330UL, 0x24b4a3a6UL, + 0xbad03605UL, 0xcdd70693UL, 0x54de5729UL, 0x23d967bfUL, + 0xb3667a2eUL, 0xc4614ab8UL, 0x5d681b02UL, 0x2a6f2b94UL, + 0xb40bbe37UL, 0xc30c8ea1UL, 0x5a05df1bUL, 0x2d02ef8dUL +}; + +quint32 XQServiceUtil::serviceIdFromName(const char *serviceName) +{ + XQSERVICE_DEBUG_PRINT("XQServiceUtil::serviceIdFromName"); + const char* p = serviceName; + quint32 crc = 0xffffffffUL; + while ((*p)!=0) { + crc = (crc >> 8) ^ CrcTab32[(crc ^ *p) & 0xff]; + p++; + } + quint32 ret = 0xffffffffUL - crc; + XQSERVICE_DEBUG_PRINT("XQServiceUtil::serviceIdFromName: Crc calculated for: [%s]. Value is: %d.", serviceName, ret); + return ret; +} + diff -r 9d760f716ca8 -r 3d09643def13 qthighway/xqserviceutil/src/xqserviceutil.h --- a/qthighway/xqserviceutil/src/xqserviceutil.h Thu Sep 02 21:20:48 2010 +0300 +++ b/qthighway/xqserviceutil/src/xqserviceutil.h Fri Sep 17 08:34:25 2010 +0300 @@ -31,7 +31,7 @@ { // Utility to set started application to background XQSERVICEUTIL_EXPORT void toBackground(bool value); - + // Utilities to extract startup command line arguments XQSERVICEUTIL_EXPORT bool isEmbedded(); // XQSERVICEUTIL_EXPORT bool isService(); @@ -43,6 +43,7 @@ XQSERVICEUTIL_EXPORT QString operationName(int argc, char **argv); XQSERVICEUTIL_EXPORT QString serviceName(); XQSERVICEUTIL_EXPORT QString serviceName(int argc, char **argv); + XQSERVICEUTIL_EXPORT quint32 serviceIdFromName(const char *serviceName); } #endif diff -r 9d760f716ca8 -r 3d09643def13 qthighway/xqserviceutil/xqserviceutil.pro --- a/qthighway/xqserviceutil/xqserviceutil.pro Thu Sep 02 21:20:48 2010 +0300 +++ b/qthighway/xqserviceutil/xqserviceutil.pro Fri Sep 17 08:34:25 2010 +0300 @@ -44,5 +44,5 @@ LIBS+=-lapparc -lapgrfx -lws32 -lcone -lbafl -leikcore -lefsrv -lxqutils libFiles.sources = xqserviceutil.dll -libFiles.path = "!:\sys\bin" +libFiles.path = "!:/sys/bin" DEPLOYMENT += libFiles diff -r 9d760f716ca8 -r 3d09643def13 qtmobileextensions/src/keycapture/targetwrapper.cpp --- a/qtmobileextensions/src/keycapture/targetwrapper.cpp Thu Sep 02 21:20:48 2010 +0300 +++ b/qtmobileextensions/src/keycapture/targetwrapper.cpp Fri Sep 17 08:34:25 2010 +0300 @@ -48,7 +48,7 @@ TargetWrapper::~TargetWrapper() { - delete selector; + cleanup(); } void TargetWrapper::close(XQKeyCapture::CapturingFlags flags) @@ -66,7 +66,7 @@ void TargetWrapper::reset() { try { - delete selector; + cleanup(); QT_TRAP_THROWING(selector = CRemConInterfaceSelector::NewL()); @@ -87,7 +87,9 @@ selector = 0; target = 0; targetEx = 0; + delete handler; handler = 0; + delete handlerEx; handlerEx = 0; qDebug() << "TargetWrapper::init - exception: " << e.what(); throw; @@ -106,50 +108,94 @@ } +/* + * Function for cleaning up selector and handlers, targets are handled via selector + */ +void TargetWrapper::cleanup() +{ + delete handler; + handler = 0; + delete handlerEx; + handlerEx = 0; + delete selector; + selector = 0; +} + void TargetWrapper::MrccatoCommand(TRemConCoreApiOperationId aOperationId, TRemConCoreApiButtonAction aButtonAct) { - Qt::Key key = mapKey(aOperationId); - - switch (aButtonAct) { - case ERemConCoreApiButtonPress: - TX_LOG_ARGS("ERemConCoreApiButtonPress"); - sendKey(QEvent::KeyPress, key, Qt::NoModifier, aOperationId); - break; - case ERemConCoreApiButtonRelease: - TX_LOG_ARGS("ERemConCoreApiButtonRelease"); - sendKey(QEvent::KeyRelease, key, Qt::NoModifier, aOperationId); - break; - case ERemConCoreApiButtonClick: - TX_LOG_ARGS("ERemConCoreApiButtonClick"); - sendKey(QEvent::KeyPress, key, Qt::NoModifier, aOperationId); - sendKey(QEvent::KeyRelease, key, Qt::NoModifier, aOperationId); - break; - default: - return; + if (target) { + Qt::Key key = mapKey(aOperationId); + switch (aButtonAct) { + case ERemConCoreApiButtonPress: + TX_LOG_ARGS("ERemConCoreApiButtonPress"); + sendKey(QEvent::KeyPress, key, Qt::NoModifier, aOperationId); + break; + case ERemConCoreApiButtonRelease: + TX_LOG_ARGS("ERemConCoreApiButtonRelease"); + sendKey(QEvent::KeyRelease, key, Qt::NoModifier, aOperationId); + break; + case ERemConCoreApiButtonClick: + TX_LOG_ARGS("ERemConCoreApiButtonClick"); + sendKey(QEvent::KeyPress, key, Qt::NoModifier, aOperationId); + sendKey(QEvent::KeyRelease, key, Qt::NoModifier, aOperationId); + break; + default: + return; + } + } else { + qWarning() << "target in MrccatoCommand was not initialized"; } - - handler->CompleteAnyKey(aOperationId); + + if (handler) { + handler->CompleteAnyKey(aOperationId); + } else { + qWarning() << "handler in MrccatoCommand was not initialized"; + } } void TargetWrapper::AnswerCall() { - sendKey(QEvent::KeyPress, Qt::Key_Call, Qt::NoModifier); - sendKey(QEvent::KeyRelease, Qt::Key_Call, Qt::NoModifier); - handlerEx->CompleteAnyKey(0); + if (targetEx) { + sendKey(QEvent::KeyPress, Qt::Key_Call, Qt::NoModifier); + sendKey(QEvent::KeyRelease, Qt::Key_Call, Qt::NoModifier); + } else { + qWarning() << "targetEx in AnswerCall was not initialized"; + } + if (handlerEx) { + handlerEx->CompleteAnyKey(0); + } else { + qWarning() << "handlerEx in AnswerCall was not initialized"; + } } void TargetWrapper::EndCall() { - sendKey(QEvent::KeyPress, Qt::Key_Hangup, Qt::NoModifier); - sendKey(QEvent::KeyRelease, Qt::Key_Hangup, Qt::NoModifier); - handlerEx->CompleteAnyKey(0); + if (targetEx) { + sendKey(QEvent::KeyPress, Qt::Key_Hangup, Qt::NoModifier); + sendKey(QEvent::KeyRelease, Qt::Key_Hangup, Qt::NoModifier); + } else { + qWarning() << "targetEx in EndCall was not initialized"; + } + if (handlerEx) { + handlerEx->CompleteAnyKey(0); + } else { + qWarning() << "handlerEx in EndCall was not initialized"; + } } void TargetWrapper::AnswerEndCall() { - sendKey(QEvent::KeyPress, Qt::Key_Hangup, Qt::NoModifier); //TODO: Qt::Key_ToggleCallHangup - sendKey(QEvent::KeyRelease, Qt::Key_Hangup, Qt::NoModifier); - handlerEx->CompleteAnyKey(0); + if (targetEx) { + sendKey(QEvent::KeyPress, Qt::Key_Hangup, Qt::NoModifier); //TODO: Qt::Key_ToggleCallHangup + sendKey(QEvent::KeyRelease, Qt::Key_Hangup, Qt::NoModifier); + } else { + qWarning() << "targetEx in AnswerEndCall was not initialized"; + } + if (handlerEx) { + handlerEx->CompleteAnyKey(0); + } else { + qWarning() << "handlerEx in AnswerEndCall was not initialized"; + } } void TargetWrapper::VoiceDial( const TBool aActivate ) @@ -201,7 +247,6 @@ if (event){ QApplication::sendEvent(widget, event); - qDebug("sending key event!"); delete event; } } @@ -211,11 +256,9 @@ { QWidget *widget; widget = QWidget::keyboardGrabber(); - if (!widget) { widget = QApplication::focusWidget(); } - if (!widget) { if (QApplication::activePopupWidget()) { widget = QApplication::activePopupWidget()->focusWidget(); @@ -224,7 +267,6 @@ } } } - return widget; } diff -r 9d760f716ca8 -r 3d09643def13 qtmobileextensions/src/keycapture/targetwrapper.h --- a/qtmobileextensions/src/keycapture/targetwrapper.h Thu Sep 02 21:20:48 2010 +0300 +++ b/qtmobileextensions/src/keycapture/targetwrapper.h Fri Sep 17 08:34:25 2010 +0300 @@ -100,6 +100,9 @@ Qt::Key mapKey(TRemConCoreApiOperationId aOperationId); private: + void cleanup(); + +private: CRemConInterfaceSelector *selector; CRemConCoreApiTarget *target; @@ -111,6 +114,10 @@ QFlags captureFlags; QMap keyMapping; + +#ifdef _XQKEYCAPTURE_UNITTEST_ + friend class TestXQKeyCapture; +#endif // _XQKEYCAPTURE_UNITTEST_ }; #endif /* TARGETWRAPPER_H_ */ diff -r 9d760f716ca8 -r 3d09643def13 qtmobileextensions/src/keycapture/tsrc/mytestwindowgroup.cpp --- a/qtmobileextensions/src/keycapture/tsrc/mytestwindowgroup.cpp Thu Sep 02 21:20:48 2010 +0300 +++ b/qtmobileextensions/src/keycapture/tsrc/mytestwindowgroup.cpp Fri Sep 17 08:34:25 2010 +0300 @@ -23,21 +23,13 @@ #include "mytestwindowgroup.h" -//MyTestWindowGroup* MyTestWindowGroup::instance = 0; - - MyTestWindowGroup* MyTestWindowGroup::Instance(){ - //if(instance == NULL) - // instance = new MyTestWindowGroup(); static MyTestWindowGroup singleton; return &singleton; - - //return instance; } MyTestWindowGroup::~MyTestWindowGroup() { - //if(instance) - // delete instance; + } diff -r 9d760f716ca8 -r 3d09643def13 qtmobileextensions/src/keycapture/tsrc/stub/remconcallhandlingtarget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qtmobileextensions/src/keycapture/tsrc/stub/remconcallhandlingtarget.cpp Fri Sep 17 08:34:25 2010 +0300 @@ -0,0 +1,118 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CRemConCallHandlingTarget stub for testing keycapture +* +*/ + +#include + +#include "stub/remconcallhandlingtarget.h" +#include "stub/remconinterfaceselector.h" + +int gCRemConCallHandlingTargetCount = 0; +bool gCRemConCallHandlingTargetNewLLeave = false; +int gCRemConCallHandlingTargetSendResponseCount = 0; + + +//static functions start + +int CRemConCallHandlingTarget::getCount() +{ + return gCRemConCallHandlingTargetCount; +} + +void CRemConCallHandlingTarget::setNewLLeave( bool value ) +{ + gCRemConCallHandlingTargetNewLLeave = value; +} + +void CRemConCallHandlingTarget::NewLLeaveIfDesiredL() +{ + if (gCRemConCallHandlingTargetNewLLeave) + { + RDebug::Print(_L("CRemConCallHandlingTarget::NewLLeaveIfDesiredL Leave")); + gCRemConCallHandlingTargetNewLLeave = false; + User::Leave(KErrGeneral); + } +} + +CRemConCallHandlingTarget* CRemConCallHandlingTarget::NewL(CRemConInterfaceSelector& aInterfaceSelector, MRemConCallHandlingTargetObserver& /*aObserver*/) +{ + + RDebug::Print(_L("stub CRemConCallHandlingTarget::NewL")); + CRemConCallHandlingTarget::NewLLeaveIfDesiredL(); + CRemConCallHandlingTarget* self = new(ELeave) CRemConCallHandlingTarget(); + aInterfaceSelector.RegisterCallHandlingL(self); + return self; +} + + +int CRemConCallHandlingTarget::getSendResponseCount() +{ + return gCRemConCallHandlingTargetSendResponseCount; +} + +//static functions end + + +CRemConCallHandlingTarget::CRemConCallHandlingTarget() + : CActive(EPriorityStandard), + iClientStatus(NULL) +{ + gCRemConCallHandlingTargetCount++; +} + +CRemConCallHandlingTarget::~CRemConCallHandlingTarget() +{ + Cancel(); + gCRemConCallHandlingTargetCount--; + gCRemConCallHandlingTargetSendResponseCount = 0; +} + + +void CRemConCallHandlingTarget::SendResponse(TRequestStatus& aStatus, + TInt aOperationId, + TInt aError) +{ + RDebug::Print(_L(">>CRemConCoreApiTarget::SendResponse")); + + iClientStatus = &aStatus; + gCRemConCallHandlingTargetSendResponseCount++; + + // stub should not be async + /*TRequestStatus* status = &iStatus; + User::RequestComplete(status, KErrNone); + SetActive();*/ + + RunL(); + + RDebug::Print(_L("<>CRemConCallHandlingTarget::RunL")); + User::RequestComplete(iClientStatus, KErrNone); + RDebug::Print(_L("< +//#include + +class CRemConInterfaceSelector; +class MRemConCallHandlingTargetObserver; + +class CRemConCallHandlingTarget : public CActive//, public CRemConInterfaceBase + { + +public: + static int getCount(); + static void setNewLLeave( bool value = true ); + static void NewLLeaveIfDesiredL(); + static int getSendResponseCount(); + + void SendResponse( TRequestStatus& aStatus, + TInt aOperationId, + TInt aError ); + +public: // Constructors and destructor + static CRemConCallHandlingTarget* NewL( + CRemConInterfaceSelector& aInterfaceSelector, + MRemConCallHandlingTargetObserver& aObserver ); + + ~CRemConCallHandlingTarget(); + //TAny* GetInterfaceIf(TUid); +protected: + + // from CActive + virtual void DoCancel(); + virtual void RunL(); + +private: + CRemConCallHandlingTarget(); + +private: + TRequestStatus* iClientStatus; + +}; + +#endif // CREMCONCALLHANDLINGTARGET_H + +// end of file + diff -r 9d760f716ca8 -r 3d09643def13 qtmobileextensions/src/keycapture/tsrc/stub/remconcoreapitarget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qtmobileextensions/src/keycapture/tsrc/stub/remconcoreapitarget.cpp Fri Sep 17 08:34:25 2010 +0300 @@ -0,0 +1,128 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: remconcoreapitarget stub for testing keycapture +* +*/ + + +#include + +#include "stub/remconcoreapitarget.h" +#include "stub/remconinterfaceselector.h" + +int gCRemConCoreApiTargetCount = 0; +bool gCRemConCoreApiTargetNewLLeave = false; +int gCRemConCoreApiTargetSendResponseCount = 0; +TRemConCoreApiOperationId gLastOperationId = ENop; + +//static functions start + +TRemConCoreApiOperationId CRemConCoreApiTarget::getLastOperationId() + { + return gLastOperationId; + } + +int CRemConCoreApiTarget::getCount() +{ + return gCRemConCoreApiTargetCount; +} + +void CRemConCoreApiTarget::setNewLLeave( bool value ) +{ + gCRemConCoreApiTargetNewLLeave = value; +} + +void CRemConCoreApiTarget::NewLLeaveIfDesiredL() +{ + if (gCRemConCoreApiTargetNewLLeave) + { + RDebug::Print(_L("CRemConCoreApiTarget::NewLLeaveIfDesiredL Leave")); + gCRemConCoreApiTargetNewLLeave = false; + User::Leave(KErrGeneral); + } +} + +int CRemConCoreApiTarget::getSendResponseCount() +{ + return gCRemConCoreApiTargetSendResponseCount; +} + +//static functions end + + +CRemConCoreApiTarget::CRemConCoreApiTarget() + : CActive(EPriorityStandard), + iClientStatus(NULL) +{ + gCRemConCoreApiTargetCount++; +} + +CRemConCoreApiTarget::~CRemConCoreApiTarget() +{ + //Cancel(); + gCRemConCoreApiTargetCount--; + gCRemConCoreApiTargetSendResponseCount = 0; +} + +CRemConCoreApiTarget* CRemConCoreApiTarget::NewL(CRemConInterfaceSelector& aInterfaceSelector, MRemConCoreApiTargetObserver& /*aObserver*/) +{ + RDebug::Print(_L("stub CRemConCoreApiTarget::NewL")); + CRemConCoreApiTarget::NewLLeaveIfDesiredL(); + CRemConCoreApiTarget* self = new(ELeave) CRemConCoreApiTarget(); + aInterfaceSelector.RegisterCoreApiL(self); + return self; +} + + +void CRemConCoreApiTarget::VolumeUpResponse(TRequestStatus& aStatus, TInt /*aError*/) +{ + RDebug::Print(_L(">>CRemConCoreApiTarget::VolumeUpResponse")); + iClientStatus = &aStatus; + gCRemConCoreApiTargetSendResponseCount++; + RunL(); + RDebug::Print(_L("<>CRemConCoreApiTarget::VolumeDownResponse")); + iClientStatus = &aStatus; + gCRemConCoreApiTargetSendResponseCount++; + RunL(); + RDebug::Print(_L("<>CRemConCoreApiTarget::SendResponse")); + iClientStatus = &aStatus; + gLastOperationId = aOperationId; + gCRemConCoreApiTargetSendResponseCount++; + RunL(); + RDebug::Print(_L("<>CRemConCoreApiTarget::RunL")); + User::RequestComplete(iClientStatus, KErrNone); + RDebug::Print(_L("< // TRemConCoreApiOperationId +#include "remconinterfacebase.h" + +class CRemConInterfaceSelector; +class MRemConCoreApiTargetObserver; + +class CRemConCoreApiTarget : public CActive, public CRemConInterfaceBase + { + +public: + + static int getCount(); + static void setNewLLeave( bool value = true ); + static void NewLLeaveIfDesiredL(); + static int getSendResponseCount(); + static TRemConCoreApiOperationId getLastOperationId(); + +public: + + static CRemConCoreApiTarget* NewL(CRemConInterfaceSelector& aInterfaceSelector, MRemConCoreApiTargetObserver& aObserver); + virtual ~CRemConCoreApiTarget(); + + void VolumeUpResponse(TRequestStatus& aStatus, TInt aError); + void VolumeDownResponse(TRequestStatus& aStatus, TInt aError); + void SendResponse(TRequestStatus& aStatus, TRemConCoreApiOperationId aOperationId, TInt aError); + +protected: + + // from CActive + //void Cancel(){}; + virtual void DoCancel(); + virtual void RunL(); + +private: + + CRemConCoreApiTarget(); + +private: + + TRequestStatus* iClientStatus; + + }; + +#endif // REMCONCOREAPITARGET_H + +// End of File diff -r 9d760f716ca8 -r 3d09643def13 qtmobileextensions/src/keycapture/tsrc/stub/remconinterfacebase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qtmobileextensions/src/keycapture/tsrc/stub/remconinterfacebase.cpp Fri Sep 17 08:34:25 2010 +0300 @@ -0,0 +1,12 @@ +#include "remconinterfacebase.h" + +TInt CRemConInterfaceBase::Cancel() +{ +return KErrNone; +} + +TAny* CRemConInterfaceBase::GetInterfaceIf(TUid aUid) +{ +TAny* ret = NULL; +return ret; +} diff -r 9d760f716ca8 -r 3d09643def13 qtmobileextensions/src/keycapture/tsrc/stub/remconinterfacebase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qtmobileextensions/src/keycapture/tsrc/stub/remconinterfacebase.h Fri Sep 17 08:34:25 2010 +0300 @@ -0,0 +1,15 @@ +#ifndef REMCONINTERFACEBASE_H +#define REMCONINTERFACEBASE_H + +#include + +class CRemConInterfaceBase : public CBase + { +public: + TInt Cancel(); + TAny* GetInterfaceIf(TUid aUid); + }; + +#endif // REMCONINTERFACEBASE_H + +// end of file diff -r 9d760f716ca8 -r 3d09643def13 qtmobileextensions/src/keycapture/tsrc/stub/remconinterfaceselector.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qtmobileextensions/src/keycapture/tsrc/stub/remconinterfaceselector.cpp Fri Sep 17 08:34:25 2010 +0300 @@ -0,0 +1,104 @@ +/* +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: remconinterfaceselector stub for testing keycapture +* +*/ + + +#include + +#include "stub/remconinterfaceselector.h" +#include "stub/remconcallhandlingtarget.h" +#include "stub/remconcoreapitarget.h" + +int gCRemConInterfaceSelectorCount = 0; +bool gCRemConInterfaceSelectorNewLLeave = false; +bool gCRemConInterfaceSelectorOpenTargetLLeave = false; + + +//static functions start + +int CRemConInterfaceSelector::getCount() +{ + return gCRemConInterfaceSelectorCount; +} + +void CRemConInterfaceSelector::setNewLLeave() +{ + gCRemConInterfaceSelectorNewLLeave = true; +} + +void CRemConInterfaceSelector::NewLLeaveIfDesiredL() +{ + if (gCRemConInterfaceSelectorNewLLeave) + { + RDebug::Print(_L("CRemConInterfaceSelector::NewLLeaveIfDesiredL Leave")); + gCRemConInterfaceSelectorNewLLeave = false; + User::Leave(KErrGeneral); + } +} + +void CRemConInterfaceSelector::setOpenTargetLLeave() +{ + gCRemConInterfaceSelectorOpenTargetLLeave = true; +} + +void CRemConInterfaceSelector::OpenTargetLLeaveIfDesiredL() +{ + if (gCRemConInterfaceSelectorOpenTargetLLeave) + { + RDebug::Print(_L("CRemConInterfaceSelector::NewLLeaveIfDesiredL Leave")); + gCRemConInterfaceSelectorOpenTargetLLeave = false; + User::Leave(KErrGeneral); + } +} + +//static functions end + +CRemConInterfaceSelector::CRemConInterfaceSelector() +{ + gCRemConInterfaceSelectorCount++; +} + +CRemConInterfaceSelector::~CRemConInterfaceSelector() +{ + gCRemConInterfaceSelectorCount--; + iCoreApiArray.ResetAndDestroy(); + iCallHandlingArray.ResetAndDestroy(); +} + +CRemConInterfaceSelector* CRemConInterfaceSelector::NewL() +{ + RDebug::Print(_L("stub CRemConInterfaceSelector::NewL")); + CRemConInterfaceSelector::NewLLeaveIfDesiredL(); + CRemConInterfaceSelector* self = new(ELeave) CRemConInterfaceSelector(); + return self; +} + +void CRemConInterfaceSelector::RegisterCallHandlingL(CRemConCallHandlingTarget* aCallHandling) + { + iCallHandlingArray.AppendL(aCallHandling); + } + +void CRemConInterfaceSelector::RegisterCoreApiL(CRemConCoreApiTarget* aCoreApi) + { + iCoreApiArray.AppendL(aCoreApi); + } + +void CRemConInterfaceSelector::OpenTargetL() +{ + CRemConInterfaceSelector::OpenTargetLLeaveIfDesiredL(); +} + +//end of file diff -r 9d760f716ca8 -r 3d09643def13 qtmobileextensions/src/keycapture/tsrc/stub/remconinterfaceselector.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qtmobileextensions/src/keycapture/tsrc/stub/remconinterfaceselector.h Fri Sep 17 08:34:25 2010 +0300 @@ -0,0 +1,58 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: remconinterfaceselector stub for testing keycapture +* +*/ + + +#ifndef REMCONINTERFACESELECTOR_H +#define REMCONINTERFACESELECTOR_H + + +#include + +//forward declarations +class CRemConCallHandlingTarget; +class CRemConCoreApiTarget; + +class CRemConInterfaceSelector : public CBase + { + +public: + + static int getCount(); + static void setNewLLeave(); + static void NewLLeaveIfDesiredL(); + static void setOpenTargetLLeave(); + static void OpenTargetLLeaveIfDesiredL(); + +public: + + static CRemConInterfaceSelector* NewL(); + virtual ~CRemConInterfaceSelector(); + void RegisterInterface(); + void OpenTargetL(); + void RegisterCallHandlingL( CRemConCallHandlingTarget* ); + void RegisterCoreApiL(CRemConCoreApiTarget* ); + +private: + + CRemConInterfaceSelector(); + RPointerArray iCallHandlingArray; + RPointerArray iCoreApiArray; + }; + +#endif // REMCONINTERFACESELECTOR_H + +// End of File diff -r 9d760f716ca8 -r 3d09643def13 qtmobileextensions/src/keycapture/tsrc/test_xqkeycapture.cpp --- a/qtmobileextensions/src/keycapture/tsrc/test_xqkeycapture.cpp Thu Sep 02 21:20:48 2010 +0300 +++ b/qtmobileextensions/src/keycapture/tsrc/test_xqkeycapture.cpp Fri Sep 17 08:34:25 2010 +0300 @@ -19,11 +19,23 @@ #include #include #include + +#include + #include "mytestwindowgroup.h" -#include +#include "stub/remconcoreapitarget.h" +#include "stub/remconcallhandlingtarget.h" +#include "stub/remconinterfaceselector.h" + +#include "targetwrapper.h" + #include +#include -#include +const int KAllFlagsOn = XQKeyCapture::CaptureBasic | + XQKeyCapture::CaptureCallHandlingExt | + XQKeyCapture::CaptureEnableRemoteExtEvents; +const Qt::Key KNotSpecifiedKey = Qt::Key_F35; class TestXQKeyCapture : public QObject { @@ -113,6 +125,34 @@ void testCancelCaptureLongKeyList_S60_data(); void testCancelCaptureLongKeyList_S60(); + void testCaptureRemoteKeys_data(); + void testCaptureRemoteKeys(); + + void testCaptureRemoteKeys_SelectorFail_data(); + void testCaptureRemoteKeys_SelectorFail(); + + void testCaptureRemoteKeys_ApiCore_data(); + void testCaptureRemoteKeys_ApiCore(); + + void testCaptureRemoteKeys_ApiCoreCancel_data(); + void testCaptureRemoteKeys_ApiCoreCancel(); + + void testCaptureRemoteKeys_CallHandling_data(); + void testCaptureRemoteKeys_CallHandling(); + + void testCaptureRemoteKeys_CallHandlingCancel_data(); + void testCaptureRemoteKeys_CallHandlingCancel(); + + void testCaptureRemoteKeys_Basic_data(); + void testCaptureRemoteKeys_Basic(); + + void testCaptureRemoteKeys_Extended_data(); + void testCaptureRemoteKeys_Extended(); + + void testCancelCaptureRemoteKeys_data(); + void testCancelCaptureRemoteKeys(); + + void testErrorString(); void testErrorId(); @@ -121,6 +161,7 @@ private: QString clearString(const QString& line); QString clearString(const QString& line, const QString& prefix, const QString& comment); + void setProperKeys(bool extended); private: XQKeyCapture* keyCapture; @@ -145,36 +186,77 @@ public slots: - void windowGroupAction( WindowGroupActionType, QList ); - void windowGroupActionCancel( WindowGroupActionType, QList ); + void windowGroupAction(WindowGroupActionType, QList); + void windowGroupActionCancel(WindowGroupActionType, QList); + +public: + //for events handling + bool event(QEvent *); + bool eventFilter(QObject *, QEvent *); + void processEvent(QEvent *ev); + void resetKeys(); + QWidget myGlobalWidget; + Qt::Key myLastKeyPressed; + Qt::Key myLastKeyReleased; + Qt::Key myLastKeyPress; + Qt::Key myLastKeyExtendedPress; + Qt::Key myLastKeyRelease; + Qt::Key myLastKeyExtendedRelease; + QMap myKeyMapping; }; // ======== MEMBER FUNCTIONS ======== +void TestXQKeyCapture::resetKeys() +{ + myLastKeyPressed = KNotSpecifiedKey; + myLastKeyReleased = KNotSpecifiedKey; + myLastKeyPress = KNotSpecifiedKey; + myLastKeyExtendedPress = KNotSpecifiedKey; + myLastKeyRelease = KNotSpecifiedKey; + myLastKeyExtendedRelease = KNotSpecifiedKey; +} void TestXQKeyCapture::initTestCase() { - bool ret = connect( MyTestWindowGroup::Instance(), SIGNAL( windowGroupAction( WindowGroupActionType, QList )), - this, SLOT( windowGroupAction( WindowGroupActionType, QList ) ) ); - QVERIFY( ret ); - ret = connect( MyTestWindowGroup::Instance(), SIGNAL( windowGroupActionCancel( WindowGroupActionType, QList )), - this, SLOT( windowGroupActionCancel( WindowGroupActionType, QList ) ) ); - QVERIFY( ret ); + bool ret = connect(MyTestWindowGroup::Instance(), SIGNAL(windowGroupAction(WindowGroupActionType, QList)), + this, SLOT(windowGroupAction(WindowGroupActionType, QList))); + QVERIFY(ret); + ret = connect(MyTestWindowGroup::Instance(), SIGNAL(windowGroupActionCancel(WindowGroupActionType, QList)), + this, SLOT(windowGroupActionCancel(WindowGroupActionType, QList))); + QVERIFY(ret); + + myGlobalWidget.installEventFilter(this); + // load key mapping + + TargetWrapper* myTargetWrapper = new TargetWrapper(); + myTargetWrapper->init(XQKeyCapture::CaptureBasic); + myKeyMapping = myTargetWrapper->keyMapping; + delete myTargetWrapper; + myGlobalWidget.setFocus(); + myGlobalWidget.activateWindow(); } void TestXQKeyCapture::cleanupTestCase() { + //is this needed - looking for panic reason. + myGlobalWidget.removeEventFilter(this); + myGlobalWidget.deleteLater(); //delete MyTestWindowGroup::Instance(); } void TestXQKeyCapture::init() { keyCapture = new XQKeyCapture(); + resetKeys(); } void TestXQKeyCapture::cleanup() { delete keyCapture; + CRemConCoreApiTarget::setNewLLeave(false); + CRemConCallHandlingTarget::setNewLLeave(false); + myGlobalWidget.setVisible(false); } void TestXQKeyCapture::testCreateAndDestroy() @@ -201,67 +283,65 @@ QTest::addColumn("additional"); QTest::addColumn("additionalSymbianKey"); - QTest::newRow("esc_key") << static_cast ( Qt::Key_Escape ) - << static_cast ( Qt::NoModifier ) - << static_cast ( Qt::NoModifier ) - << static_cast ( EKeyEscape ) - << static_cast ( 0 ) - << static_cast ( 0 ) - << static_cast ( 12 ) + QTest::newRow("esc_key") << static_cast(Qt::Key_Escape) + << static_cast(Qt::NoModifier) + << static_cast(Qt::NoModifier) + << static_cast(EKeyEscape) + << static_cast(0) + << static_cast(0) + << static_cast(12) << false - << static_cast ( 0 ); + << static_cast(0); - QTest::newRow("esc_key_not_supported") << static_cast ( Qt::Key_Escape ) - << static_cast ( Qt::NoModifier ) - << static_cast ( Qt::NoModifier ) - << static_cast ( EKeyEscape ) - << static_cast ( 0 ) - << static_cast ( 0 ) - << static_cast ( KErrNotSupported ) + QTest::newRow("esc_key_not_supported") << static_cast(Qt::Key_Escape) + << static_cast(Qt::NoModifier) + << static_cast(Qt::NoModifier) + << static_cast(EKeyEscape) + << static_cast(0) + << static_cast(0) + << static_cast(KErrNotSupported) << false - << static_cast ( 0 ); + << static_cast(0); - QTest::newRow("esc_key_modifiers") << static_cast ( Qt::Key_Escape ) - << static_cast ( Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt:: KeypadModifier ) - << static_cast ( Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt:: KeypadModifier ) - << static_cast ( EKeyEscape ) - << static_cast ( EModifierShift | EModifierCtrl | EModifierAlt | EModifierKeypad ) - << static_cast ( EModifierShift | EModifierCtrl | EModifierAlt | EModifierKeypad ) - << static_cast ( 13 ) + QTest::newRow("esc_key_modifiers") << static_cast(Qt::Key_Escape) + << static_cast(Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt:: KeypadModifier) + << static_cast(Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt:: KeypadModifier) + << static_cast(EKeyEscape) + << static_cast(EModifierShift | EModifierCtrl | EModifierAlt | EModifierKeypad) + << static_cast(EModifierShift | EModifierCtrl | EModifierAlt | EModifierKeypad) + << static_cast(13) << false - << static_cast ( 0 ); + << static_cast(0); - QTest::newRow("shift_key") << static_cast ( Qt::Key_Shift ) - << static_cast ( Qt::ShiftModifier ) - << static_cast ( Qt::ShiftModifier ) - << static_cast ( EKeyLeftShift ) - << static_cast ( EModifierShift ) - << static_cast ( EModifierShift ) - << static_cast ( 12 ) + QTest::newRow("shift_key") << static_cast(Qt::Key_Shift) + << static_cast(Qt::ShiftModifier) + << static_cast(Qt::ShiftModifier) + << static_cast(EKeyLeftShift) + << static_cast(EModifierShift) + << static_cast(EModifierShift) + << static_cast(12) << true - << static_cast ( EKeyRightShift ); + << static_cast(EKeyRightShift); - QTest::newRow("control_key") << static_cast ( Qt::Key_Control ) - << static_cast ( Qt::NoModifier ) - << static_cast ( Qt::NoModifier ) - << static_cast ( EKeyLeftCtrl ) - << static_cast ( 0 ) - << static_cast ( 0 ) - << static_cast ( 12 ) + QTest::newRow("control_key") << static_cast(Qt::Key_Control) + << static_cast(Qt::NoModifier) + << static_cast(Qt::NoModifier) + << static_cast(EKeyLeftCtrl) + << static_cast(0) + << static_cast(0) + << static_cast(12) << true - << static_cast ( EKeyRightCtrl ); + << static_cast(EKeyRightCtrl); - QTest::newRow("meta_key") << static_cast ( Qt::Key_Super_R ) - << static_cast ( Qt::NoModifier ) - << static_cast ( Qt::NoModifier ) - << static_cast ( EKeyRightFunc ) - << static_cast ( 0 ) - << static_cast ( 0 ) - << static_cast ( 12 ) + QTest::newRow("meta_key") << static_cast(Qt::Key_Super_R) + << static_cast(Qt::NoModifier) + << static_cast(Qt::NoModifier) + << static_cast(EKeyRightFunc) + << static_cast(0) + << static_cast(0) + << static_cast(12) << true - << static_cast ( EKeyRightFunc ); - - + << static_cast(EKeyRightFunc); } void TestXQKeyCapture::testCaptureKey() @@ -294,9 +374,7 @@ MyTestWindowGroup::Instance()->setRequestNumber(reqNum); - keyCapture->captureKey( static_cast (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ) ); - -// keyCapture->captureKey( QList() << static_cast (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ) ); + keyCapture->captureKey(static_cast(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier)); } void TestXQKeyCapture::testCaptureKeyList_data() @@ -334,7 +412,7 @@ MyTestWindowGroup::Instance()->setRequestNumber(reqNum); - keyCapture->captureKey( QList() << static_cast (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ) ); + keyCapture->captureKey(QList() << static_cast(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier)); } //////////////////////////////////////////////////////////////// @@ -356,65 +434,65 @@ QTest::addColumn("additional"); QTest::addColumn("additionalSymbianKey"); - QTest::newRow("esc_key") << static_cast ( EKeyEscape ) - << static_cast ( Qt::NoModifier ) - << static_cast ( Qt::NoModifier ) - << static_cast ( EKeyEscape ) - << static_cast ( 0 ) - << static_cast ( 0 ) - << static_cast ( 12 ) + QTest::newRow("esc_key") << static_cast(EKeyEscape) + << static_cast(Qt::NoModifier) + << static_cast(Qt::NoModifier) + << static_cast(EKeyEscape) + << static_cast(0) + << static_cast(0) + << static_cast(12) << false - << static_cast ( 0 ); + << static_cast(0); - QTest::newRow("esc_key_not_supported") << static_cast ( EKeyEscape ) - << static_cast ( Qt::NoModifier ) - << static_cast ( Qt::NoModifier ) - << static_cast ( EKeyEscape ) - << static_cast ( 0 ) - << static_cast ( 0 ) - << static_cast ( KErrNotSupported ) + QTest::newRow("esc_key_not_supported") << static_cast(EKeyEscape) + << static_cast(Qt::NoModifier) + << static_cast(Qt::NoModifier) + << static_cast(EKeyEscape) + << static_cast(0) + << static_cast(0) + << static_cast(KErrNotSupported) << false - << static_cast ( 0 ); + << static_cast(0); - QTest::newRow("esc_key_modifiers") << static_cast ( EKeyEscape ) - << static_cast ( Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt:: KeypadModifier ) - << static_cast ( Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt:: KeypadModifier ) - << static_cast ( EKeyEscape ) - << static_cast ( EModifierShift | EModifierCtrl | EModifierAlt | EModifierKeypad ) - << static_cast ( EModifierShift | EModifierCtrl | EModifierAlt | EModifierKeypad ) - << static_cast ( 13 ) + QTest::newRow("esc_key_modifiers") << static_cast(EKeyEscape) + << static_cast(Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt:: KeypadModifier) + << static_cast(Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt:: KeypadModifier) + << static_cast(EKeyEscape) + << static_cast(EModifierShift | EModifierCtrl | EModifierAlt | EModifierKeypad) + << static_cast(EModifierShift | EModifierCtrl | EModifierAlt | EModifierKeypad) + << static_cast(13) << false - << static_cast ( 0 ); + << static_cast(0); - QTest::newRow("shift_key") << static_cast ( EKeyLeftShift ) - << static_cast ( Qt::ShiftModifier ) - << static_cast ( Qt::ShiftModifier ) - << static_cast ( EKeyLeftShift ) - << static_cast ( EModifierShift ) - << static_cast ( EModifierShift ) - << static_cast ( 12 ) + QTest::newRow("shift_key") << static_cast(EKeyLeftShift) + << static_cast(Qt::ShiftModifier) + << static_cast(Qt::ShiftModifier) + << static_cast(EKeyLeftShift) + << static_cast(EModifierShift) + << static_cast(EModifierShift) + << static_cast(12) << true - << static_cast ( EKeyRightShift ); + << static_cast(EKeyRightShift); - QTest::newRow("control_key") << static_cast ( EKeyRightCtrl ) - << static_cast ( Qt::NoModifier ) - << static_cast ( Qt::NoModifier ) - << static_cast ( EKeyRightCtrl ) - << static_cast ( 0 ) - << static_cast ( 0 ) - << static_cast ( 12 ) + QTest::newRow("control_key") << static_cast(EKeyRightCtrl) + << static_cast(Qt::NoModifier) + << static_cast(Qt::NoModifier) + << static_cast(EKeyRightCtrl) + << static_cast(0) + << static_cast(0) + << static_cast(12) << true - << static_cast ( EKeyRightFunc ); + << static_cast(EKeyRightFunc); - QTest::newRow("meta_key") << static_cast ( EKeyLeftCtrl ) - << static_cast ( Qt::NoModifier ) - << static_cast ( Qt::NoModifier ) - << static_cast ( EKeyLeftCtrl ) - << static_cast ( 0 ) - << static_cast ( 0 ) - << static_cast ( 12 ) + QTest::newRow("meta_key") << static_cast(EKeyLeftCtrl) + << static_cast(Qt::NoModifier) + << static_cast(Qt::NoModifier) + << static_cast(EKeyLeftCtrl) + << static_cast(0) + << static_cast(0) + << static_cast(12) << true - << static_cast ( EKeyLeftFunc ); + << static_cast(EKeyLeftFunc); } @@ -448,7 +526,7 @@ additionalResults << additionalSymbianKey << symbianMask << symbianModifier; MyTestWindowGroup::Instance()->setRequestNumber(reqNum); - keyCapture->captureKey( static_cast (s60Key), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ) ); + keyCapture->captureKey(static_cast(s60Key), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier)); } void TestXQKeyCapture::testCaptureKeyList_S60_data() @@ -485,7 +563,7 @@ additionalResults << additionalSymbianKey << symbianMask << symbianModifier; MyTestWindowGroup::Instance()->setRequestNumber(reqNum); - keyCapture->captureKey(QList() << static_cast (s60Key), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ) ); + keyCapture->captureKey(QList() << static_cast(s60Key), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier)); } //////////////////////////////////////////////////////////////// @@ -506,15 +584,15 @@ QTest::addColumn("additional"); QTest::addColumn("additionalSymbianKey"); - QTest::newRow("esc_key") << static_cast ( Qt::Key_Escape ) - << static_cast ( Qt::NoModifier ) - << static_cast ( Qt::NoModifier ) - << static_cast ( EStdKeyEscape ) - << static_cast ( 0 ) - << static_cast ( 0 ) - << static_cast ( 12 ) + QTest::newRow("esc_key") << static_cast(Qt::Key_Escape) + << static_cast(Qt::NoModifier) + << static_cast(Qt::NoModifier) + << static_cast(EStdKeyEscape) + << static_cast(0) + << static_cast(0) + << static_cast(12) << false - << static_cast ( 0 ); + << static_cast(0); } void TestXQKeyCapture::testCaptureKeyUpAndDowns() @@ -546,7 +624,7 @@ additionalResults << additionalSymbianKey << symbianMask << symbianModifier; MyTestWindowGroup::Instance()->setRequestNumber(reqNum); - keyCapture->captureKeyUpAndDowns( static_cast (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ) ); + keyCapture->captureKeyUpAndDowns(static_cast(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier)); } void TestXQKeyCapture::testCaptureKeyUpAndDownsList_data() @@ -583,7 +661,7 @@ additionalResults << additionalSymbianKey << symbianMask << symbianModifier; MyTestWindowGroup::Instance()->setRequestNumber(reqNum); - keyCapture->captureKeyUpAndDowns( QList() << static_cast (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ) ); + keyCapture->captureKeyUpAndDowns(QList() << static_cast(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier)); } //////////////////////////////////////////////////////////////// @@ -604,15 +682,15 @@ QTest::addColumn("additional"); QTest::addColumn("additionalSymbianKey"); - QTest::newRow("esc_key") << static_cast ( EStdKeyEscape ) - << static_cast ( Qt::NoModifier ) - << static_cast ( Qt::NoModifier ) - << static_cast ( EStdKeyEscape ) - << static_cast ( 0 ) - << static_cast ( 0 ) - << static_cast ( 12 ) + QTest::newRow("esc_key") << static_cast(EStdKeyEscape) + << static_cast(Qt::NoModifier) + << static_cast(Qt::NoModifier) + << static_cast(EStdKeyEscape) + << static_cast(0) + << static_cast(0) + << static_cast(12) << false - << static_cast ( 0 ); + << static_cast(0); } void TestXQKeyCapture::testCaptureKeyUpAndDowns_S60() @@ -644,7 +722,7 @@ additionalResults << additionalSymbianKey << symbianMask << symbianModifier; MyTestWindowGroup::Instance()->setRequestNumber(reqNum); - keyCapture->captureKeyUpAndDowns( static_cast (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ) ); + keyCapture->captureKeyUpAndDowns(static_cast(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier)); } void TestXQKeyCapture::testCaptureKeyUpAndDownsList_S60_data() @@ -681,7 +759,7 @@ additionalResults << additionalSymbianKey << symbianMask << symbianModifier; MyTestWindowGroup::Instance()->setRequestNumber(reqNum); - keyCapture->captureKeyUpAndDowns( QList() << static_cast (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ) ); + keyCapture->captureKeyUpAndDowns(QList() << static_cast(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier)); } //////////////////////////////////////////////////////////////// @@ -706,18 +784,18 @@ QTest::addColumn("additionalSymbianKey"); - QTest::newRow("esc_key") << static_cast ( Qt::Key_Escape ) - << static_cast ( Qt::NoModifier ) - << static_cast ( Qt::NoModifier ) - << static_cast ( XQKeyCapture::LongNormal ) - << static_cast ( EKeyEscape ) - << static_cast ( 0 ) - << static_cast ( 0 ) - << static_cast ( 0 ) //priority - << static_cast ( XQKeyCapture::LongNormal ) - << static_cast ( 12 ) + QTest::newRow("esc_key") << static_cast(Qt::Key_Escape) + << static_cast(Qt::NoModifier) + << static_cast(Qt::NoModifier) + << static_cast(XQKeyCapture::LongNormal) + << static_cast(EKeyEscape) + << static_cast(0) + << static_cast(0) + << static_cast(0) //priority + << static_cast(XQKeyCapture::LongNormal) + << static_cast(12) << false - << static_cast ( 0 ); + << static_cast(0); } @@ -753,7 +831,7 @@ additionalResults << additionalSymbianKey << symbianMask << symbianModifier << symbianPriority << symbianLongFlags; MyTestWindowGroup::Instance()->setRequestNumber(reqNum); - keyCapture->captureLongKey( static_cast (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ), static_cast (longFlags) ); + keyCapture->captureLongKey(static_cast(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier), static_cast(longFlags)); } void TestXQKeyCapture::testCaptureLongKeyList_data() @@ -793,7 +871,7 @@ additionalResults << additionalSymbianKey << symbianMask << symbianModifier << symbianPriority << symbianLongFlags; MyTestWindowGroup::Instance()->setRequestNumber(reqNum); - keyCapture->captureLongKey( QList() << static_cast (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ), static_cast (longFlags) ); + keyCapture->captureLongKey(QList() << static_cast(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier), static_cast(longFlags)); } //////////////////////////////////////////////////////////////// @@ -818,18 +896,18 @@ QTest::addColumn("additionalSymbianKey"); - QTest::newRow("esc_key") << static_cast ( EKeyEscape ) - << static_cast ( Qt::NoModifier ) - << static_cast ( Qt::NoModifier ) - << static_cast ( XQKeyCapture::LongNormal ) - << static_cast ( EKeyEscape ) - << static_cast ( 0 ) - << static_cast ( 0 ) - << static_cast ( 0 ) //priority - << static_cast ( XQKeyCapture::LongNormal ) - << static_cast ( 12 ) + QTest::newRow("esc_key") << static_cast(EKeyEscape) + << static_cast(Qt::NoModifier) + << static_cast(Qt::NoModifier) + << static_cast(XQKeyCapture::LongNormal) + << static_cast(EKeyEscape) + << static_cast(0) + << static_cast(0) + << static_cast(0) //priority + << static_cast(XQKeyCapture::LongNormal) + << static_cast(12) << false - << static_cast ( 0 ); + << static_cast(0); } @@ -865,7 +943,7 @@ additionalResults << additionalSymbianKey << symbianMask << symbianModifier << symbianPriority << symbianLongFlags; MyTestWindowGroup::Instance()->setRequestNumber(reqNum); - keyCapture->captureLongKey( static_cast (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ), static_cast (longFlags) ); + keyCapture->captureLongKey(static_cast(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier), static_cast(longFlags)); } void TestXQKeyCapture::testCaptureLongKeyList_S60_data() @@ -905,7 +983,7 @@ additionalResults << additionalSymbianKey << symbianMask << symbianModifier << symbianPriority << symbianLongFlags; MyTestWindowGroup::Instance()->setRequestNumber(reqNum); - keyCapture->captureLongKey( QList() << static_cast (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ), static_cast (longFlags) ); + keyCapture->captureLongKey(QList() << static_cast(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier), static_cast(longFlags)); } //////////////////////////////////////////////////////////////// @@ -923,47 +1001,47 @@ QTest::addColumn("additional"); QTest::addColumn("additionalReqNum"); - QTest::newRow("esc_key") << static_cast ( Qt::Key_Escape ) - << static_cast ( Qt::NoModifier ) - << static_cast ( Qt::NoModifier ) - << static_cast ( 12 ) + QTest::newRow("esc_key") << static_cast(Qt::Key_Escape) + << static_cast(Qt::NoModifier) + << static_cast(Qt::NoModifier) + << static_cast(12) << false - << static_cast ( 0 ); + << static_cast(0); - QTest::newRow("esc_key_not_supported") << static_cast ( Qt::Key_Escape ) - << static_cast ( Qt::NoModifier ) - << static_cast ( Qt::NoModifier ) - << static_cast ( KErrNotSupported ) + QTest::newRow("esc_key_not_supported") << static_cast(Qt::Key_Escape) + << static_cast(Qt::NoModifier) + << static_cast(Qt::NoModifier) + << static_cast(KErrNotSupported) << false - << static_cast ( 0 ); + << static_cast(0); - QTest::newRow("esc_key_modifiers") << static_cast ( Qt::Key_Escape ) - << static_cast ( Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt:: KeypadModifier ) - << static_cast ( Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt:: KeypadModifier ) - << static_cast ( 13 ) + QTest::newRow("esc_key_modifiers") << static_cast(Qt::Key_Escape) + << static_cast(Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt:: KeypadModifier) + << static_cast(Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt:: KeypadModifier) + << static_cast(13) << false - << static_cast ( 0 ); + << static_cast(0); - QTest::newRow("shift_key") << static_cast ( Qt::Key_Shift ) - << static_cast ( Qt::ShiftModifier ) - << static_cast ( Qt::ControlModifier ) - << static_cast ( 15 ) + QTest::newRow("shift_key") << static_cast(Qt::Key_Shift) + << static_cast(Qt::ShiftModifier) + << static_cast(Qt::ControlModifier) + << static_cast(15) << true - << static_cast ( 16 ); + << static_cast(16); - QTest::newRow("control_key") << static_cast ( Qt::Key_Control ) - << static_cast ( Qt::ControlModifier ) - << static_cast ( Qt::ShiftModifier ) - << static_cast ( 17 ) + QTest::newRow("control_key") << static_cast(Qt::Key_Control) + << static_cast(Qt::ControlModifier) + << static_cast(Qt::ShiftModifier) + << static_cast(17) << true - << static_cast ( 18 ); + << static_cast(18); - QTest::newRow("meta_key") << static_cast ( Qt::Key_Meta ) - << static_cast ( Qt::NoModifier ) - << static_cast ( Qt::NoModifier ) - << static_cast ( 19 ) + QTest::newRow("meta_key") << static_cast(Qt::Key_Meta) + << static_cast(Qt::NoModifier) + << static_cast(Qt::NoModifier) + << static_cast(19) << true - << static_cast ( 20 ); + << static_cast(20); } @@ -994,10 +1072,10 @@ MyTestWindowGroup::Instance()->setRequestNumber(reqNum); ignoreWindowGroupAction = true; - keyCapture->captureKey( static_cast (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ) ); + keyCapture->captureKey(static_cast(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier)); ignoreWindowGroupAction = false; willBeAdditionalRequest = additional; - keyCapture->cancelCaptureKey( static_cast (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ) ); + keyCapture->cancelCaptureKey(static_cast(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier)); } void TestXQKeyCapture::testCancelCaptureKeyList_data() @@ -1031,10 +1109,10 @@ MyTestWindowGroup::Instance()->setRequestNumber(reqNum); ignoreWindowGroupAction = true; - keyCapture->captureKey( static_cast (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ) ); + keyCapture->captureKey(static_cast(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier)); ignoreWindowGroupAction = false; willBeAdditionalRequest = additional; - keyCapture->cancelCaptureKey( QList() << static_cast (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ) ); + keyCapture->cancelCaptureKey(QList() << static_cast(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier)); } //////////////////////////////////////////////////////////////// @@ -1052,49 +1130,47 @@ QTest::addColumn("additional"); QTest::addColumn("additionalReqNum"); - QTest::newRow("esc_key") << static_cast ( EKeyEscape ) - << static_cast ( Qt::NoModifier ) - << static_cast ( Qt::NoModifier ) - << static_cast ( 12 ) + QTest::newRow("esc_key") << static_cast(EKeyEscape) + << static_cast(Qt::NoModifier) + << static_cast(Qt::NoModifier) + << static_cast(12) << false - << static_cast ( 0 ); + << static_cast(0); - QTest::newRow("esc_key_not_supported") << static_cast ( EKeyEscape ) - << static_cast ( Qt::NoModifier ) - << static_cast ( Qt::NoModifier ) - << static_cast ( KErrNotSupported ) + QTest::newRow("esc_key_not_supported") << static_cast(EKeyEscape) + << static_cast(Qt::NoModifier) + << static_cast(Qt::NoModifier) + << static_cast(KErrNotSupported) << false - << static_cast ( 0 ); + << static_cast(0); - QTest::newRow("esc_key_modifiers") << static_cast ( EKeyEscape ) - << static_cast ( Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt:: KeypadModifier ) - << static_cast ( Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt:: KeypadModifier ) - << static_cast ( 13 ) + QTest::newRow("esc_key_modifiers") << static_cast(EKeyEscape) + << static_cast(Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt:: KeypadModifier) + << static_cast(Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt:: KeypadModifier) + << static_cast(13) << false - << static_cast ( 0 ); + << static_cast(0); - QTest::newRow("shift_key") << static_cast ( EKeyLeftShift ) - << static_cast ( Qt::ShiftModifier ) - << static_cast ( Qt::ControlModifier ) - << static_cast ( 15 ) + QTest::newRow("shift_key") << static_cast(EKeyLeftShift) + << static_cast(Qt::ShiftModifier) + << static_cast(Qt::ControlModifier) + << static_cast(15) << true - << static_cast ( 16 ); + << static_cast(16); - QTest::newRow("control_key") << static_cast ( EKeyLeftCtrl ) - << static_cast ( Qt::ControlModifier ) - << static_cast ( Qt::ShiftModifier ) - << static_cast ( 17 ) + QTest::newRow("control_key") << static_cast(EKeyLeftCtrl) + << static_cast(Qt::ControlModifier) + << static_cast(Qt::ShiftModifier) + << static_cast(17) << true - << static_cast ( 18 ); + << static_cast(18); - QTest::newRow("meta_key") << static_cast ( EKeyRightCtrl ) - << static_cast ( Qt::NoModifier ) - << static_cast ( Qt::NoModifier ) - << static_cast ( 19 ) + QTest::newRow("meta_key") << static_cast(EKeyRightCtrl) + << static_cast(Qt::NoModifier) + << static_cast(Qt::NoModifier) + << static_cast(19) << true - << static_cast ( 20 ); - - + << static_cast(20); } void TestXQKeyCapture::testCancelCaptureKey_S60() @@ -1123,10 +1199,10 @@ MyTestWindowGroup::Instance()->setRequestNumber(reqNum); ignoreWindowGroupAction = true; - keyCapture->captureKey( static_cast (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ) ); + keyCapture->captureKey(static_cast(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier)); ignoreWindowGroupAction = false; willBeAdditionalRequest = additional; - keyCapture->cancelCaptureKey( static_cast (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ) ); + keyCapture->cancelCaptureKey(static_cast(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier)); } void TestXQKeyCapture::testCancelCaptureKeyList_S60_data() @@ -1160,10 +1236,10 @@ MyTestWindowGroup::Instance()->setRequestNumber(reqNum); ignoreWindowGroupAction = true; - keyCapture->captureKey( static_cast (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ) ); + keyCapture->captureKey(static_cast(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier)); ignoreWindowGroupAction = false; willBeAdditionalRequest = additional; - keyCapture->cancelCaptureKey( QList() << static_cast (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ) ); + keyCapture->cancelCaptureKey(QList() << static_cast(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier)); } //////////////////////////////////////////////////////////////// @@ -1180,12 +1256,12 @@ QTest::addColumn("additional"); QTest::addColumn("additionalReqNum"); - QTest::newRow("esc_key") << static_cast ( Qt::Key_Escape ) - << static_cast ( Qt::NoModifier ) - << static_cast ( Qt::NoModifier ) - << static_cast ( 34 ) + QTest::newRow("esc_key") << static_cast(Qt::Key_Escape) + << static_cast(Qt::NoModifier) + << static_cast(Qt::NoModifier) + << static_cast(34) << false - << static_cast ( 35 ); + << static_cast(35); } @@ -1215,10 +1291,10 @@ MyTestWindowGroup::Instance()->setRequestNumber(reqNum); ignoreWindowGroupAction = true; - keyCapture->captureKeyUpAndDowns( static_cast (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ) ); + keyCapture->captureKeyUpAndDowns(static_cast(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier)); ignoreWindowGroupAction = false; willBeAdditionalRequest = additional; - keyCapture->cancelCaptureKeyUpAndDowns( static_cast (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ) ); + keyCapture->cancelCaptureKeyUpAndDowns(static_cast(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier)); } void TestXQKeyCapture::testCancelCaptureKeyUpAndDownsList_data() @@ -1252,10 +1328,10 @@ MyTestWindowGroup::Instance()->setRequestNumber(reqNum); ignoreWindowGroupAction = true; - keyCapture->captureKeyUpAndDowns( static_cast (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ) ); + keyCapture->captureKeyUpAndDowns(static_cast(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier)); ignoreWindowGroupAction = false; willBeAdditionalRequest = additional; - keyCapture->cancelCaptureKeyUpAndDowns(QList() << static_cast (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ) ); + keyCapture->cancelCaptureKeyUpAndDowns(QList() << static_cast(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier)); } //////////////////////////////////////////////////////////////// @@ -1272,12 +1348,12 @@ QTest::addColumn("additional"); QTest::addColumn("additionalReqNum"); - QTest::newRow("esc_key") << static_cast ( EKeyEscape ) - << static_cast ( Qt::NoModifier ) - << static_cast ( Qt::NoModifier ) - << static_cast ( 34 ) + QTest::newRow("esc_key") << static_cast(EKeyEscape) + << static_cast(Qt::NoModifier) + << static_cast(Qt::NoModifier) + << static_cast(34) << false - << static_cast ( 35 ); + << static_cast(35); } @@ -1307,10 +1383,10 @@ MyTestWindowGroup::Instance()->setRequestNumber(reqNum); ignoreWindowGroupAction = true; - keyCapture->captureKeyUpAndDowns( static_cast (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ) ); + keyCapture->captureKeyUpAndDowns(static_cast(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier)); ignoreWindowGroupAction = false; willBeAdditionalRequest = additional; - keyCapture->cancelCaptureKeyUpAndDowns( static_cast (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ) ); + keyCapture->cancelCaptureKeyUpAndDowns(static_cast(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier)); } void TestXQKeyCapture::testCancelCaptureKeyUpAndDownsList_S60_data() @@ -1344,10 +1420,10 @@ MyTestWindowGroup::Instance()->setRequestNumber(reqNum); ignoreWindowGroupAction = true; - keyCapture->captureKeyUpAndDowns( static_cast (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ) ); + keyCapture->captureKeyUpAndDowns(static_cast(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier)); ignoreWindowGroupAction = false; willBeAdditionalRequest = additional; - keyCapture->cancelCaptureKeyUpAndDowns(QList() << static_cast (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ) ); + keyCapture->cancelCaptureKeyUpAndDowns(QList() << static_cast(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier)); } //////////////////////////////////////////////////////////////// @@ -1365,13 +1441,13 @@ QTest::addColumn("additional"); QTest::addColumn("additionalReqNum"); - QTest::newRow("esc_key") << static_cast ( Qt::Key_Escape ) - << static_cast ( Qt::NoModifier ) - << static_cast ( Qt::NoModifier ) - << static_cast ( XQKeyCapture::LongNormal ) - << static_cast ( 22 ) + QTest::newRow("esc_key") << static_cast(Qt::Key_Escape) + << static_cast(Qt::NoModifier) + << static_cast(Qt::NoModifier) + << static_cast(XQKeyCapture::LongNormal) + << static_cast(22) << false - << static_cast ( 23 ); + << static_cast(23); @@ -1406,10 +1482,10 @@ MyTestWindowGroup::Instance()->setRequestNumber(reqNum); ignoreWindowGroupAction = true; - keyCapture->captureLongKey( static_cast (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ), static_cast (longFlags) ); + keyCapture->captureLongKey(static_cast(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier), static_cast(longFlags)); ignoreWindowGroupAction = false; willBeAdditionalRequest = additional; - keyCapture->cancelCaptureLongKey( static_cast (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ), static_cast (longFlags) ); + keyCapture->cancelCaptureLongKey(static_cast(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier), static_cast(longFlags)); } void TestXQKeyCapture::testCancelCaptureLongKeyList_data() @@ -1444,10 +1520,10 @@ MyTestWindowGroup::Instance()->setRequestNumber(reqNum); ignoreWindowGroupAction = true; - keyCapture->captureLongKey( static_cast (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ), static_cast (longFlags) ); + keyCapture->captureLongKey(static_cast(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier), static_cast(longFlags)); ignoreWindowGroupAction = false; willBeAdditionalRequest = additional; - keyCapture->cancelCaptureLongKey( QList() << static_cast (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ), static_cast (longFlags) ); + keyCapture->cancelCaptureLongKey(QList() << static_cast(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier), static_cast(longFlags)); } //////////////////////////////////////////////////////////////// @@ -1465,17 +1541,13 @@ QTest::addColumn("additional"); QTest::addColumn("additionalReqNum"); - QTest::newRow("esc_key") << static_cast ( EKeyEscape ) - << static_cast ( Qt::NoModifier ) - << static_cast ( Qt::NoModifier ) - << static_cast ( XQKeyCapture::LongNormal ) - << static_cast ( 22 ) + QTest::newRow("esc_key") << static_cast(EKeyEscape) + << static_cast(Qt::NoModifier) + << static_cast(Qt::NoModifier) + << static_cast(XQKeyCapture::LongNormal) + << static_cast(22) << false - << static_cast ( 23 ); - - - - + << static_cast(23); } @@ -1506,10 +1578,10 @@ MyTestWindowGroup::Instance()->setRequestNumber(reqNum); ignoreWindowGroupAction = true; - keyCapture->captureLongKey( static_cast (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ), static_cast (longFlags) ); + keyCapture->captureLongKey(static_cast(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier), static_cast(longFlags)); ignoreWindowGroupAction = false; willBeAdditionalRequest = additional; - keyCapture->cancelCaptureLongKey( static_cast (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ), static_cast (longFlags) ); + keyCapture->cancelCaptureLongKey(static_cast(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier), static_cast(longFlags)); } void TestXQKeyCapture::testCancelCaptureLongKeyList_S60_data() @@ -1544,12 +1616,243 @@ MyTestWindowGroup::Instance()->setRequestNumber(reqNum); ignoreWindowGroupAction = true; - keyCapture->captureLongKey( static_cast (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ), static_cast (longFlags) ); + keyCapture->captureLongKey(static_cast(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier), static_cast(longFlags)); ignoreWindowGroupAction = false; willBeAdditionalRequest = additional; - keyCapture->cancelCaptureLongKey(QList() << static_cast (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ), static_cast (longFlags) ); + keyCapture->cancelCaptureLongKey(QList() << static_cast(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier), static_cast(longFlags)); } +void TestXQKeyCapture::testCaptureRemoteKeys_data() + { + QTest::addColumn("flags"); + + // there are 4 flags: + // XQKeyCapture::CaptureNone = 0x0 + // XQKeyCapture::CaptureBasic = 0x1 + // XQKeyCapture::CaptureCallHandlingExt = 0x2 + // XQKeyCapture::CaptureEnableRemoteExtEvents = 0x4 + // so we should iterate through all combinations: + for(unsigned int i(0); i <= KAllFlagsOn; ++i) { + QString desc("flag:0x" + QString::number(i,16)); + QTest::newRow(desc.toAscii()) << i ; + } + } + +void TestXQKeyCapture::testCaptureRemoteKeys() + { + QFETCH(unsigned int, flags); + XQKeyCapture::CapturingFlag flag = static_cast(flags); + int oldCoreApiCount = CRemConCoreApiTarget::getCount(); + int oldCallHandlingCount = CRemConCallHandlingTarget::getCount(); + int expectedCoreApiCount(oldCoreApiCount); + int expectedCallHandlingCount(oldCallHandlingCount); + keyCapture->captureRemoteKeys(static_cast(flag)); + if(flag & XQKeyCapture::CaptureBasic) expectedCoreApiCount++; + if(flag & XQKeyCapture::CaptureCallHandlingExt) expectedCallHandlingCount++; + int newCoreApiCount = CRemConCoreApiTarget::getCount(); + int newCallHandlingCount = CRemConCallHandlingTarget::getCount(); + QVERIFY2(expectedCoreApiCount == newCoreApiCount, "expected core api creation count was different"); + QVERIFY2(expectedCallHandlingCount == newCallHandlingCount, "expected call handling api creation count was different"); + } + +void TestXQKeyCapture::testCaptureRemoteKeys_SelectorFail_data() + { + testCaptureRemoteKeys_data(); + } + +void TestXQKeyCapture::testCaptureRemoteKeys_SelectorFail() + { + QFETCH(unsigned int, flags); + CRemConInterfaceSelector::setNewLLeave(); + bool result = keyCapture->captureRemoteKeys(static_cast(flags)); + QVERIFY2(!result , "CaptureRemoteKeys did not fail and it should."); + CRemConInterfaceSelector::setNewLLeave(); + result = keyCapture->cancelCaptureRemoteKeys(static_cast(flags)); + QVERIFY2(!result , "CaptureRemoteKeys did not fail and it should."); + } + +void TestXQKeyCapture::testCaptureRemoteKeys_ApiCore_data() + { + testCaptureRemoteKeys_data(); + } + +void TestXQKeyCapture::testCaptureRemoteKeys_ApiCore() + { + QFETCH(unsigned int, flags); + XQKeyCapture::CapturingFlag flag = static_cast(flags); + CRemConCoreApiTarget::setNewLLeave(); + bool result = keyCapture->captureRemoteKeys(flag); + bool expected = !(flag & XQKeyCapture::CaptureBasic); + QVERIFY2(result == expected, "CaptureRemoteKeys did not fail and it should."); + } + +void TestXQKeyCapture::testCaptureRemoteKeys_ApiCoreCancel_data() + { + testCaptureRemoteKeys_data(); + } +void TestXQKeyCapture::testCaptureRemoteKeys_ApiCoreCancel() + { + QFETCH(unsigned int, flags); + + // set all flags on + XQKeyCapture::CapturingFlag flag = static_cast(KAllFlagsOn); + bool result = keyCapture->captureRemoteKeys(flag); + QVERIFY2(result, "CaptureRemoteKeys failed."); + + // check cancel for each flag + CRemConCoreApiTarget::setNewLLeave(); + flag = static_cast(flags); + // it should fail only if CaptureBasic is not removed and was set. + bool expected = (flag & XQKeyCapture::CaptureBasic); + result = keyCapture->cancelCaptureRemoteKeys(flag); + QVERIFY2(result == expected, "CaptureRemoteKeys did not fail and it should."); + } + + +void TestXQKeyCapture::testCaptureRemoteKeys_CallHandling_data() + { + testCaptureRemoteKeys_data(); + } +void TestXQKeyCapture::testCaptureRemoteKeys_CallHandling() + { + QFETCH(unsigned int, flags); + XQKeyCapture::CapturingFlag flag = static_cast(flags); + + CRemConCallHandlingTarget::setNewLLeave(); + bool result = keyCapture->captureRemoteKeys(flag); + bool expected = !(flag & XQKeyCapture::CaptureCallHandlingExt); + QVERIFY2(result == expected, "CaptureRemoteKeys did not fail and it should."); + } + +void TestXQKeyCapture::testCaptureRemoteKeys_CallHandlingCancel_data() + { + testCaptureRemoteKeys_data(); + } +void TestXQKeyCapture::testCaptureRemoteKeys_CallHandlingCancel() + { + QFETCH(unsigned int, flags); + + // set all flags + XQKeyCapture::CapturingFlag flag = static_cast(KAllFlagsOn); + bool result = keyCapture->captureRemoteKeys(flag); + QVERIFY2(result, "CaptureRemoteKeys failed."); + + // check cancel + CRemConCallHandlingTarget::setNewLLeave(); + flag = static_cast(flags); + // it should fail only if CaptureBasic flag is unset + bool expected = (flag & XQKeyCapture::CaptureCallHandlingExt); + result = keyCapture->cancelCaptureRemoteKeys(flag); + QVERIFY2(result == expected, "CaptureRemoteKeys did not fail and it should."); + } + +void TestXQKeyCapture::testCaptureRemoteKeys_Basic_data() + { + QTest::addColumn("buttonAction"); + QTest::addColumn("operationId"); + QTest::addColumn("operationQtKey"); + // this test will take few minutes to go thru all possible button / operation + for(unsigned int buttonA(0); buttonA < 3; buttonA++) { // 0 - ERemConCoreApiButtonPress, 1 - ERemConCoreApiButtonRelease, 2 - ERemConCoreApiButtonClick + foreach(TRemConCoreApiOperationId operationId, myKeyMapping.keys()) { + QTest::newRow(QString::number(operationId).toAscii()) << buttonA << static_cast(operationId) << static_cast(myKeyMapping.value(operationId)); + } + } + } + +void TestXQKeyCapture::testCaptureRemoteKeys_Basic() + { + QFETCH(unsigned int, buttonAction); + QFETCH(unsigned int, operationId); + QFETCH(unsigned int, operationQtKey); + // this test in the beginning was supposed to test whole event delivery process; + // now it will just check proper translation between qt and symbian. + myGlobalWidget.setVisible(true); + myGlobalWidget.setFocus(); + myGlobalWidget.activateWindow(); + + TRemConCoreApiOperationId opId = static_cast(operationId); + TargetWrapper* myTargetWrapper = new TargetWrapper(); + XQKeyCapture::CapturingFlags myFlag = XQKeyCapture::CaptureBasic; + myTargetWrapper->init(myFlag); + int oldCount = CRemConCoreApiTarget::getSendResponseCount(); + TRemConCoreApiButtonAction btnAction = static_cast(buttonAction); + myTargetWrapper->MrccatoCommand(opId, btnAction); + + // verify core Api calls + QVERIFY2(CRemConCoreApiTarget::getSendResponseCount() == oldCount+1, "Send Response Count is not equal"); + QVERIFY2(CRemConCoreApiTarget::getLastOperationId() == opId, "Operation Id is different then requested"); + + // verify proper symbian -> qt key call + bool extendedEvents = (myFlag & XQKeyCapture::CaptureEnableRemoteExtEvents); + setProperKeys(extendedEvents); + if(btnAction == ERemConCoreApiButtonClick) { + QVERIFY2(myTargetWrapper->mapKey(opId) == myLastKeyPressed, "Qt key does not correspond to proper Symbian key"); + QVERIFY2(myTargetWrapper->mapKey(opId) == myLastKeyReleased, "Qt key does not correspond to proper Symbian key"); + } + if(btnAction == ERemConCoreApiButtonPress) { + QVERIFY2(myTargetWrapper->mapKey(opId) == myLastKeyPressed, "Qt key does not correspond to proper Symbian key"); + QVERIFY2(myLastKeyReleased == KNotSpecifiedKey, "Qt key does not correspond to proper Symbian key"); + } + if(btnAction == ERemConCoreApiButtonRelease) { + QVERIFY2(myLastKeyPressed == KNotSpecifiedKey, "Qt key does not correspond to proper Symbian key"); + QVERIFY2(myTargetWrapper->mapKey(opId) == myLastKeyReleased, "Qt key does not correspond to proper Symbian key"); + } + delete myTargetWrapper; + } + +void TestXQKeyCapture::testCaptureRemoteKeys_Extended_data() + { + testCaptureRemoteKeys_data(); + } + +void TestXQKeyCapture::testCaptureRemoteKeys_Extended() + { + QFETCH(unsigned int, flags); + XQKeyCapture::CapturingFlag flag = static_cast(flags); + + TargetWrapper* myTargetWrapper = new TargetWrapper(); + myTargetWrapper->init(flag); + + bool expected = (flag & XQKeyCapture::CaptureCallHandlingExt); + bool extendedEvents = (flag & XQKeyCapture::CaptureEnableRemoteExtEvents); + myGlobalWidget.setVisible(true); + myGlobalWidget.setFocus(); + myGlobalWidget.activateWindow(); + + // key call + resetKeys(); + myTargetWrapper->AnswerCall(); + setProperKeys(extendedEvents); + QVERIFY((myLastKeyPressed == Qt::Key_Call) == expected); + QVERIFY((myLastKeyReleased == Qt::Key_Call) == expected); + + // End call + resetKeys(); + myTargetWrapper->EndCall(); + setProperKeys(extendedEvents); + QVERIFY((myLastKeyPressed == Qt::Key_Hangup) == expected); + QVERIFY((myLastKeyReleased == Qt::Key_Hangup) == expected); + + // Answer End Call + resetKeys(); + myTargetWrapper->AnswerEndCall(); + setProperKeys(extendedEvents); + QVERIFY((myLastKeyPressed == Qt::Key_Hangup) == expected); + QVERIFY((myLastKeyReleased == Qt::Key_Hangup) == expected); + delete myTargetWrapper; + } + +void TestXQKeyCapture::testCancelCaptureRemoteKeys_data() + { + testCaptureRemoteKeys_data(); + } + +void TestXQKeyCapture::testCancelCaptureRemoteKeys() + { + QFETCH(unsigned int, flags); + keyCapture->cancelCaptureRemoteKeys(static_cast(flags)); + } + //////////////////////////////////////////////////////////////// @@ -1570,14 +1873,16 @@ keyCapture->errorId(); } -QString TestXQKeyCapture::clearString(const QString& line) { +QString TestXQKeyCapture::clearString(const QString& line) +{ QString s(line); s.replace(" ", ""); s.replace("\t", ""); return s.trimmed(); } -QString TestXQKeyCapture::clearString(const QString& line, const QString& prefix, const QString& comment) { +QString TestXQKeyCapture::clearString(const QString& line, const QString& prefix, const QString& comment) +{ QString s(line); s.replace(prefix, comment); s.replace(" ", ""); @@ -1585,6 +1890,21 @@ return s.trimmed(); } +void TestXQKeyCapture::setProperKeys(bool extendedEvents) +{ + if(extendedEvents) { + myLastKeyPressed = myLastKeyExtendedPress; + myLastKeyReleased = myLastKeyExtendedRelease; + QVERIFY((myLastKeyPress == KNotSpecifiedKey)); + QVERIFY((myLastKeyRelease == KNotSpecifiedKey)); + } else { + myLastKeyPressed = myLastKeyPress; + myLastKeyReleased = myLastKeyRelease; + QVERIFY((myLastKeyExtendedPress == KNotSpecifiedKey)); + QVERIFY((myLastKeyExtendedRelease == KNotSpecifiedKey)); + } +} + //////////////////////////////////////////////////////////////// // TEST KEY MAPPER FILE //////////////////////////////////////////////////////////////// @@ -1608,27 +1928,27 @@ QTextStream inQtFile(&qtFile); bool test(false); - while (!inQtFile.atEnd()) { + while(!inQtFile.atEnd()) { QString line = inQtFile.readLine(); - // trim everything that is on right side of comment and add to list if needed - if (test) qt.append(clearString(line.split(comment).at(0))); - if (line.contains(firstline)) { + // trim everything that is on the right side of comment and add to list if needed + if(test) qt.append(clearString(line.split(comment).at(0))); + if(line.contains(firstline)) { test = true; } - if (line.contains(lastline)) { + if(line.contains(lastline)) { test = false; } } test = false; QTextStream inKcFile(&kcFile); - while (!inKcFile.atEnd()) { + while(!inKcFile.atEnd()) { QString line = inKcFile.readLine(); - // trim everything that is on right side of comment and add to list if needed - if (test) kc.append(clearString(line.split(comment).at(0))); - if (line.contains(firstline)) { + // trim everything that is on the right side of comment and add to list if needed + if(test) kc.append(clearString(line.split(comment).at(0))); + if(line.contains(firstline)) { test = true; } - if (line.contains(lastline)) { + if(line.contains(lastline)) { test = false; } } @@ -1642,11 +1962,11 @@ for(int i = 0; i < qt.size(); i++) { QString keys = qt.at(i); - QVERIFY2(kc.contains(keys), "kcFile does not conatin qt keys"); + QVERIFY2(kc.contains(keys), "kcFile does not contain qt keys"); } #else // Skip test on hw - QSKIP( "This test is valid only on emulator", SkipSingle); + QSKIP("This test is valid only on emulator", SkipSingle); #endif // __WINSCW__ } @@ -1655,22 +1975,22 @@ // REQUEST SLOT //windowGroupAction //////////////////////////////////////////////////////////////// -void TestXQKeyCapture::windowGroupAction( WindowGroupActionType wgat, QList paramList ) +void TestXQKeyCapture::windowGroupAction(WindowGroupActionType wgat, QList paramList) { - if( !ignoreWindowGroupAction ) + if(!ignoreWindowGroupAction) { - QVERIFY( wgat == actionType ); - QVERIFY( paramList.count() == numOfArgs ); + QVERIFY(wgat == actionType); + QVERIFY(paramList.count() == numOfArgs); - for( int i = 0; i < numOfArgs; i++) + for(int i = 0; i < numOfArgs; i++) { - if( additionalResult ) - QVERIFY( paramList[i] == additionalResults[i] ); + if(additionalResult) + QVERIFY(paramList[i] == additionalResults[i]); else - QVERIFY( paramList[i] == results[i] ); + QVERIFY(paramList[i] == results[i]); } } - if( willBeAdditionalRequest ){ + if(willBeAdditionalRequest){ additionalResult = true; MyTestWindowGroup::Instance()->setRequestNumber(additionalRequestHandle); } @@ -1679,22 +1999,50 @@ //////////////////////////////////////////////////////////////// //windowGroupActionCancel //////////////////////////////////////////////////////////////// -void TestXQKeyCapture::windowGroupActionCancel( WindowGroupActionType wgat, QList paramList ) +void TestXQKeyCapture::windowGroupActionCancel(WindowGroupActionType wgat, QList paramList) { - QVERIFY( wgat == actionType ); - QVERIFY( paramList.count() == numOfArgs ); + QVERIFY(wgat == actionType); + QVERIFY(paramList.count() == numOfArgs); - for( int i = 0; i < numOfArgs; i++) - { - if( additionalResult ) - QVERIFY( paramList[i] == cancelAdditionalResults[i] ); - else - QVERIFY( paramList[i] == cancelResults[i] ); - } + for(int i = 0; i < numOfArgs; i++){ + if(additionalResult) QVERIFY(paramList[i] == cancelAdditionalResults[i]); + else QVERIFY(paramList[i] == cancelResults[i]); + } + + if(willBeAdditionalRequest){ + additionalResult = true; + } +} + +bool TestXQKeyCapture::event(QEvent *ev) +{ + processEvent(ev); + return false; +} - if( willBeAdditionalRequest ){ - additionalResult = true; - } +bool TestXQKeyCapture::eventFilter(QObject *o, QEvent *ev) +{ + processEvent(ev); + return qApp->eventFilter(o, ev); +} + +void TestXQKeyCapture::processEvent(QEvent *ev) +{ + if(ev){ + if(ev->type() == QEvent::KeyPress) { + QKeyEvent *keyEvent = static_cast(ev); + myLastKeyPress = static_cast(keyEvent->key()); + } else if(ev->type() == QEvent::KeyRelease) { + QKeyEvent *keyEvent = static_cast(ev); + myLastKeyRelease = static_cast(keyEvent->key()); + } else if(ev->type() == XQKeyCapture::remoteEventType_KeyPress()) { + QKeyEvent *keyEvent = static_cast(ev); + myLastKeyExtendedPress = static_cast(keyEvent->key()); + } else if(ev->type() == XQKeyCapture::remoteEventType_KeyRelease()) { + QKeyEvent *keyEvent = static_cast(ev); + myLastKeyExtendedRelease = static_cast(keyEvent->key()); + } + } } //////////////////////////////////////////////////////////////// @@ -1703,7 +2051,7 @@ //////////////////////////////////////////////////////////////// #ifdef _XQKEYCAPTURE_UNITTEST_LOG_TO_C_ - main (int argc, char* argv[]) + main(int argc, char* argv[]) { QApplication app(argc, argv); TestXQKeyCapture tc; diff -r 9d760f716ca8 -r 3d09643def13 qtmobileextensions/src/keycapture/tsrc/tsrc.pro --- a/qtmobileextensions/src/keycapture/tsrc/tsrc.pro Thu Sep 02 21:20:48 2010 +0300 +++ b/qtmobileextensions/src/keycapture/tsrc/tsrc.pro Fri Sep 17 08:34:25 2010 +0300 @@ -18,58 +18,58 @@ TEMPLATE = app TARGET = test_xqkeycapture - -INCLUDEPATH += . -INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE \ +INCLUDEPATH += . \ + stub \ + $$MW_LAYER_SYSTEMINCLUDE \ /epoc32/include/mw/qt \ /epoc32/include/mw/qttest TARGET.CAPABILITY = ALL -TCB -# Input -# LIBS += - DEFINES += _XQKEYCAPTURE_UNITTEST_ SOURCES += test_xqkeycapture.cpp \ - mytestwindowgroup.cpp - -HEADERS += mytestwindowgroup.h - -HEADERS += \ - ../xqkeycapture.h \ - ../keycapture_p.h \ - ../txlogger.h - -SOURCES += \ - ../xqkeycapture.cpp + mytestwindowgroup.cpp \ + ../xqkeycapture.cpp \ + stub/remconcoreapitarget.cpp \ + stub/remconinterfaceselector.cpp \ + stub/remconcallhandlingtarget.cpp \ + stub/remconinterfacebase.cpp + +HEADERS += mytestwindowgroup.h \ + ../xqkeycapture.h \ + ../keycapture_p.h \ + ../txlogger.h \ + stub/remconcoreapitarget.h \ + stub/remconinterfaceselector.h \ + stub/remconcallhandlingtarget.h \ + stub/remconinterfacebase.h -symbian { - - LIBS += -lremconinterfacebase -lremconcoreapi -lremconextensionapi - +symbian { + LIBS += -lremconcoreapi + HEADERS += ../keycapture_s60_p.h \ - ../capturerequest_s60.h \ - ../keymapper.h \ - ../targetwrapper.h \ - ../responsehandler.h \ - ../responsehandlerex.h - + ../capturerequest_s60.h \ + ../keymapper.h \ + ../responsehandler.h \ + ../responsehandlerex.h \ + ../targetwrapper.h + SOURCES +=../keycapture_s60_p.cpp \ - ../capturerequest_s60.cpp \ - ../keymapper.cpp \ - ../targetwrapper.cpp \ - ../responsehandler.cpp \ - ../responsehandlerex.cpp - - sourcefiles.sources += /sf/mw/qt/src/gui/kernel/qkeymapper_s60.cpp - sourcefiles.sources += ../keymapper.cpp + ../capturerequest_s60.cpp \ + ../keymapper.cpp \ + ../responsehandler.cpp \ + ../responsehandlerex.cpp \ + ../targetwrapper.cpp + + sourcefiles.sources += /sf/mw/qt/src/gui/kernel/qkeymapper_s60.cpp + sourcefiles.sources += ../keymapper.cpp - sourcefiles.path = / + sourcefiles.path = / DEPLOYMENT += sourcefiles } else { HEADERS += ../keycapture_stub_p.h - SOURCES += ./keycapture_stub_p.cpp + SOURCES += ../keycapture_stub_p.cpp } CONFIG += qtestlib console diff -r 9d760f716ca8 -r 3d09643def13 qtmobileextensions/src/keycapture/xqkeycapture.h --- a/qtmobileextensions/src/keycapture/xqkeycapture.h Thu Sep 02 21:20:48 2010 +0300 +++ b/qtmobileextensions/src/keycapture/xqkeycapture.h Fri Sep 17 08:34:25 2010 +0300 @@ -46,18 +46,18 @@ public: enum LongFlags { - LongShortEventImmediately = ELongCaptureShortEventImmediately, - LongRepeatEvents = ELongCaptureRepeatEvents, - LongNormal = ELongCaptureNormal, - LongWaitShort = ELongCaptureWaitShort, - LongWaitNotApplicable = 0 + LongShortEventImmediately = ELongCaptureShortEventImmediately, + LongRepeatEvents = ELongCaptureRepeatEvents, + LongNormal = ELongCaptureNormal, + LongWaitShort = ELongCaptureWaitShort, + LongWaitNotApplicable = 0 }; - + enum CapturingFlag { - CaptureNone = 0x0, - CaptureBasic = 0x1, - CaptureCallHandlingExt = 0x2, - CaptureEnableRemoteExtEvents = 0x4 + CaptureNone = 0x0, + CaptureBasic = 0x1, + CaptureCallHandlingExt = 0x2, + CaptureEnableRemoteExtEvents = 0x4 }; Q_DECLARE_FLAGS(CapturingFlags, CapturingFlag) @@ -94,31 +94,31 @@ Qt::KeyboardModifiers aModifier = Qt::NoModifier); bool captureKey(XQKeyCaptureKeyList list, - Qt::KeyboardModifiers aModifiersMask = Qt::NoModifier, - Qt::KeyboardModifiers aModifier = Qt::NoModifier); + Qt::KeyboardModifiers aModifiersMask = Qt::NoModifier, + Qt::KeyboardModifiers aModifier = Qt::NoModifier); bool captureKey(XQKeyCaptureNativeKeyList list, - Qt::KeyboardModifiers aModifiersMask = Qt::NoModifier, - Qt::KeyboardModifiers aModifier = Qt::NoModifier); + Qt::KeyboardModifiers aModifiersMask = Qt::NoModifier, + Qt::KeyboardModifiers aModifier = Qt::NoModifier); bool captureLongKey(XQKeyCaptureKeyList list, - Qt::KeyboardModifiers aModifiersMask = Qt::NoModifier, - Qt::KeyboardModifiers aModifier = Qt::NoModifier, - XQKeyCapture::LongFlags aLongType = XQKeyCapture::LongNormal); + Qt::KeyboardModifiers aModifiersMask = Qt::NoModifier, + Qt::KeyboardModifiers aModifier = Qt::NoModifier, + XQKeyCapture::LongFlags aLongType = XQKeyCapture::LongNormal); bool captureLongKey(XQKeyCaptureNativeKeyList list, - Qt::KeyboardModifiers aModifiersMask = Qt::NoModifier, - Qt::KeyboardModifiers aModifier = Qt::NoModifier, - XQKeyCapture::LongFlags aLongType = XQKeyCapture::LongNormal); + Qt::KeyboardModifiers aModifiersMask = Qt::NoModifier, + Qt::KeyboardModifiers aModifier = Qt::NoModifier, + XQKeyCapture::LongFlags aLongType = XQKeyCapture::LongNormal); bool captureKeyUpAndDowns(XQKeyCaptureKeyList list, - Qt::KeyboardModifiers aModifiersMask = Qt::NoModifier, - Qt::KeyboardModifiers aModifier = Qt::NoModifier); + Qt::KeyboardModifiers aModifiersMask = Qt::NoModifier, + Qt::KeyboardModifiers aModifier = Qt::NoModifier); bool captureKeyUpAndDowns(XQKeyCaptureNativeKeyList list, - Qt::KeyboardModifiers aModifiersMask = Qt::NoModifier, - Qt::KeyboardModifiers aModifier = Qt::NoModifier); - + Qt::KeyboardModifiers aModifiersMask = Qt::NoModifier, + Qt::KeyboardModifiers aModifier = Qt::NoModifier); + bool cancelCaptureKey(Qt::Key aKey, Qt::KeyboardModifiers aModifiersMask = Qt::NoModifier, Qt::KeyboardModifiers aModifier = Qt::NoModifier); @@ -146,39 +146,39 @@ Qt::KeyboardModifiers aModifier = Qt::NoModifier); bool cancelCaptureKey(XQKeyCaptureKeyList list, - Qt::KeyboardModifiers aModifiersMask = Qt::NoModifier, - Qt::KeyboardModifiers aModifier = Qt::NoModifier); + Qt::KeyboardModifiers aModifiersMask = Qt::NoModifier, + Qt::KeyboardModifiers aModifier = Qt::NoModifier); bool cancelCaptureKey(XQKeyCaptureNativeKeyList list, - Qt::KeyboardModifiers aModifiersMask = Qt::NoModifier, - Qt::KeyboardModifiers aModifier = Qt::NoModifier); + Qt::KeyboardModifiers aModifiersMask = Qt::NoModifier, + Qt::KeyboardModifiers aModifier = Qt::NoModifier); bool cancelCaptureLongKey(XQKeyCaptureKeyList list, - Qt::KeyboardModifiers aModifiersMask = Qt::NoModifier, - Qt::KeyboardModifiers aModifier = Qt::NoModifier, - XQKeyCapture::LongFlags aLongType = XQKeyCapture::LongNormal); + Qt::KeyboardModifiers aModifiersMask = Qt::NoModifier, + Qt::KeyboardModifiers aModifier = Qt::NoModifier, + XQKeyCapture::LongFlags aLongType = XQKeyCapture::LongNormal); bool cancelCaptureLongKey(XQKeyCaptureNativeKeyList list, - Qt::KeyboardModifiers aModifiersMask = Qt::NoModifier, - Qt::KeyboardModifiers aModifier = Qt::NoModifier, - XQKeyCapture::LongFlags aLongType = XQKeyCapture::LongNormal); + Qt::KeyboardModifiers aModifiersMask = Qt::NoModifier, + Qt::KeyboardModifiers aModifier = Qt::NoModifier, + XQKeyCapture::LongFlags aLongType = XQKeyCapture::LongNormal); bool cancelCaptureKeyUpAndDowns(XQKeyCaptureKeyList list, - Qt::KeyboardModifiers aModifiersMask = Qt::NoModifier, - Qt::KeyboardModifiers aModifier = Qt::NoModifier); + Qt::KeyboardModifiers aModifiersMask = Qt::NoModifier, + Qt::KeyboardModifiers aModifier = Qt::NoModifier); bool cancelCaptureKeyUpAndDowns(XQKeyCaptureNativeKeyList list, - Qt::KeyboardModifiers aModifiersMask = Qt::NoModifier, - Qt::KeyboardModifiers aModifier = Qt::NoModifier); + Qt::KeyboardModifiers aModifiersMask = Qt::NoModifier, + Qt::KeyboardModifiers aModifier = Qt::NoModifier); - bool captureRemoteKeys(CapturingFlags flags = CaptureNone); + bool captureRemoteKeys(CapturingFlags flags = CaptureNone); bool cancelCaptureRemoteKeys(CapturingFlags flags = CaptureNone); static QEvent::Type remoteEventType_KeyPress(); static QEvent::Type remoteEventType_KeyRelease(); - + QString errorString() const; int errorId() const; @@ -202,12 +202,12 @@ LongWaitShort = ELongCaptureWaitShort, LongWaitNotApplicable = 0 }; - + public: XqKeyCapture(); ~XqKeyCapture(); - + bool captureKey(Qt::Key aKey, Qt::KeyboardModifiers aModifiersMask = Qt::NoModifier, Qt::KeyboardModifiers aModifier = Qt::NoModifier); @@ -235,31 +235,31 @@ Qt::KeyboardModifiers aModifier = Qt::NoModifier); bool captureKey(XQKeyCaptureKeyList list, - Qt::KeyboardModifiers aModifiersMask = Qt::NoModifier, - Qt::KeyboardModifiers aModifier = Qt::NoModifier); + Qt::KeyboardModifiers aModifiersMask = Qt::NoModifier, + Qt::KeyboardModifiers aModifier = Qt::NoModifier); bool captureKey(XQKeyCaptureNativeKeyList list, - Qt::KeyboardModifiers aModifiersMask = Qt::NoModifier, - Qt::KeyboardModifiers aModifier = Qt::NoModifier); + Qt::KeyboardModifiers aModifiersMask = Qt::NoModifier, + Qt::KeyboardModifiers aModifier = Qt::NoModifier); bool captureLongKey(XQKeyCaptureKeyList list, - Qt::KeyboardModifiers aModifiersMask = Qt::NoModifier, - Qt::KeyboardModifiers aModifier = Qt::NoModifier, - XqKeyCapture::LongFlags aLongType = XqKeyCapture::LongNormal); + Qt::KeyboardModifiers aModifiersMask = Qt::NoModifier, + Qt::KeyboardModifiers aModifier = Qt::NoModifier, + XqKeyCapture::LongFlags aLongType = XqKeyCapture::LongNormal); bool captureLongKey(XQKeyCaptureNativeKeyList list, - Qt::KeyboardModifiers aModifiersMask = Qt::NoModifier, - Qt::KeyboardModifiers aModifier = Qt::NoModifier, - XqKeyCapture::LongFlags aLongType = XqKeyCapture::LongNormal); + Qt::KeyboardModifiers aModifiersMask = Qt::NoModifier, + Qt::KeyboardModifiers aModifier = Qt::NoModifier, + XqKeyCapture::LongFlags aLongType = XqKeyCapture::LongNormal); bool captureKeyUpAndDowns(XQKeyCaptureKeyList list, - Qt::KeyboardModifiers aModifiersMask = Qt::NoModifier, - Qt::KeyboardModifiers aModifier = Qt::NoModifier); + Qt::KeyboardModifiers aModifiersMask = Qt::NoModifier, + Qt::KeyboardModifiers aModifier = Qt::NoModifier); bool captureKeyUpAndDowns(XQKeyCaptureNativeKeyList list, - Qt::KeyboardModifiers aModifiersMask = Qt::NoModifier, - Qt::KeyboardModifiers aModifier = Qt::NoModifier); - + Qt::KeyboardModifiers aModifiersMask = Qt::NoModifier, + Qt::KeyboardModifiers aModifier = Qt::NoModifier); + bool cancelCaptureKey(Qt::Key aKey, Qt::KeyboardModifiers aModifiersMask = Qt::NoModifier, Qt::KeyboardModifiers aModifier = Qt::NoModifier); @@ -287,30 +287,30 @@ Qt::KeyboardModifiers aModifier = Qt::NoModifier); bool cancelCaptureKey(XQKeyCaptureKeyList list, - Qt::KeyboardModifiers aModifiersMask = Qt::NoModifier, - Qt::KeyboardModifiers aModifier = Qt::NoModifier); + Qt::KeyboardModifiers aModifiersMask = Qt::NoModifier, + Qt::KeyboardModifiers aModifier = Qt::NoModifier); bool cancelCaptureKey(XQKeyCaptureNativeKeyList list, - Qt::KeyboardModifiers aModifiersMask = Qt::NoModifier, - Qt::KeyboardModifiers aModifier = Qt::NoModifier); + Qt::KeyboardModifiers aModifiersMask = Qt::NoModifier, + Qt::KeyboardModifiers aModifier = Qt::NoModifier); bool cancelCaptureLongKey(XQKeyCaptureKeyList list, - Qt::KeyboardModifiers aModifiersMask = Qt::NoModifier, - Qt::KeyboardModifiers aModifier = Qt::NoModifier, - XqKeyCapture::LongFlags aLongType = XqKeyCapture::LongNormal); + Qt::KeyboardModifiers aModifiersMask = Qt::NoModifier, + Qt::KeyboardModifiers aModifier = Qt::NoModifier, + XqKeyCapture::LongFlags aLongType = XqKeyCapture::LongNormal); bool cancelCaptureLongKey(XQKeyCaptureNativeKeyList list, - Qt::KeyboardModifiers aModifiersMask = Qt::NoModifier, - Qt::KeyboardModifiers aModifier = Qt::NoModifier, - XqKeyCapture::LongFlags aLongType = XqKeyCapture::LongNormal); + Qt::KeyboardModifiers aModifiersMask = Qt::NoModifier, + Qt::KeyboardModifiers aModifier = Qt::NoModifier, + XqKeyCapture::LongFlags aLongType = XqKeyCapture::LongNormal); bool cancelCaptureKeyUpAndDowns(XQKeyCaptureKeyList list, - Qt::KeyboardModifiers aModifiersMask = Qt::NoModifier, - Qt::KeyboardModifiers aModifier = Qt::NoModifier); + Qt::KeyboardModifiers aModifiersMask = Qt::NoModifier, + Qt::KeyboardModifiers aModifier = Qt::NoModifier); bool cancelCaptureKeyUpAndDowns(XQKeyCaptureNativeKeyList list, - Qt::KeyboardModifiers aModifiersMask = Qt::NoModifier, - Qt::KeyboardModifiers aModifier = Qt::NoModifier); + Qt::KeyboardModifiers aModifiersMask = Qt::NoModifier, + Qt::KeyboardModifiers aModifier = Qt::NoModifier); QString errorString() const; diff -r 9d760f716ca8 -r 3d09643def13 qtmobileextensions/src/settingsmanager/cpublishandsubscribehandler.cpp --- a/qtmobileextensions/src/settingsmanager/cpublishandsubscribehandler.cpp Thu Sep 02 21:20:48 2010 +0300 +++ b/qtmobileextensions/src/settingsmanager/cpublishandsubscribehandler.cpp Fri Sep 17 08:34:25 2010 +0300 @@ -44,6 +44,8 @@ CPublishAndSubscribeHandler::~CPublishAndSubscribeHandler() { + foreach (CPubSubMonitor* monitor, m_monitors) + delete monitor; } void CPublishAndSubscribeHandler::setObserver(MSettingsHandlerObserver* observer)