diff -r 3ab5c078b490 -r c63ee96dbe5f taskswitcher/testapplications/tsserviceloader/lunchwidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/taskswitcher/testapplications/tsserviceloader/lunchwidget.cpp Thu Sep 16 12:11:40 2010 +0100 @@ -0,0 +1,77 @@ +/* +* 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: +* +*/ + +#include "lunchwidget.h" +#include +#include +#include +#include + + + + +#define hbApp qobject_cast(qApp) + +lunchwidget::lunchwidget(QGraphicsItem *parent) + : HbWidget(parent) +{ + mManager = new QServiceManager; + mActivationButton = new HbPushButton("Activity"); + mProviderButton = new HbPushButton("Provider"); + mResultLabel = new HbLabel; + + mGridLayout = new QGraphicsGridLayout(); + mGridLayout->addItem(mResultLabel, 0, 0, 1, 1); + mGridLayout->addItem(mActivationButton, 1, 0, 1, 1); + mGridLayout->addItem(mProviderButton, 2, 0, 1, 1); + setLayout(mGridLayout); + + + connect(mActivationButton, SIGNAL(released()), this, SLOT(lunchActivation())); + connect(mProviderButton, SIGNAL(released()), this, SLOT(lunchProvider())); + +} + +lunchwidget::~lunchwidget() +{ + +} + +void lunchwidget::lunchActivation() +{ + bool ok = mManager->addService(":/activityserviceplugin.xml"); + setError(ok, mManager->error()); +} + +void lunchwidget::lunchProvider() +{ + bool ok = mManager->addService(":/tstestmodelplugin.xml"); + setError(ok, mManager->error()); +} + + +void lunchwidget::setError(bool ok, int err) +{ + if (!ok) { + QString num; + num.setNum(err); + mResultLabel->setPlainText(num); + } + else { + mResultLabel->setPlainText("Ok"); + } +}