diff -r 3ab5c078b490 -r c63ee96dbe5f taskswitcher/testapplications/appiconstarter/starterwidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/taskswitcher/testapplications/appiconstarter/starterwidget.cpp Thu Sep 16 12:11:40 2010 +0100 @@ -0,0 +1,105 @@ +/* +* 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 +#include "starterwidget.h" +#include +#include +#include +#include +#include +#include +#include + + + +starterwidget::starterwidget( QGraphicsItem* parent ) + : HbWidget( parent ) + { + mStart1 = new HbPushButton( "Start Search" ); + mStart2 = new HbPushButton( "Start FileBrowser" ); + + mGridLayout = new QGraphicsGridLayout(); + mGridLayout->addItem( mStart1, 1, 0, 1, 1 ); + mGridLayout->addItem( mStart2, 2, 0, 1, 1 ); + mGridLayout->setRowStretchFactor ( 0, 1 ); + mGridLayout->setRowStretchFactor ( 1, 1 ); + mGridLayout->setRowStretchFactor ( 2, 1 ); + setLayout(mGridLayout); + + mTimer1 = new QTimer( this ); + mTimer2 = new QTimer( this ); + connect( mStart1, SIGNAL(released()), this, SLOT(startopen1() ) ); + connect( mTimer1, SIGNAL(timeout()), this, SLOT(acivate1() ) ); + connect( mStart2, SIGNAL(released()), this, SLOT(startopen2() ) ); + connect( mTimer2, SIGNAL(timeout()), this, SLOT(acivate2() ) ); + } + +starterwidget::~starterwidget() + { + + } + +void starterwidget::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) + { + HbWidget::paint(painter, option, widget); + + if ( mMessage.isEmpty() || mMessage == "" ) + { + return; + } + QFont font; + font.setPointSize(30); + painter->setFont(font); + painter->drawText(10, 100, mMessage ); + } + +void starterwidget::startopen1() + { + mTimer1->start( 5000 ); + } + +void starterwidget::startopen2() + { + mTimer2->start( 5000 ); + } + +void starterwidget::acivate1() + { + bool ok = QProcess::startDetached("Searchapplication"); + if ( !ok ) + { + mMessage = "Not Found 1"; + } + + update(); + mTimer1->stop(); + } + +void starterwidget::acivate2() + { + bool ok = QProcess::startDetached("FileBrowser"); + if ( !ok ) + { + mMessage = "Not Found 2"; + } + + update(); + mTimer2->stop(); + } + +