diff -r ea59c434026a -r 79c49924ae23 tsrc/mpfetchertestapp/src/mpfetchertestappview.cpp --- a/tsrc/mpfetchertestapp/src/mpfetchertestappview.cpp Wed Jun 23 18:10:13 2010 +0300 +++ b/tsrc/mpfetchertestapp/src/mpfetchertestappview.cpp Tue Jul 06 14:13:36 2010 +0300 @@ -24,6 +24,11 @@ #include #include "mpfetchertestappview.h" +#include +#include +#include +#include + MpFetcherTestAppView::MpFetcherTestAppView(QGraphicsItem *parent) : HbView(parent), @@ -120,39 +125,68 @@ connect(button, SIGNAL(clicked()), SLOT(fetchSong())); bottomLayout->addItem(button); } + + QGraphicsLinearLayout *playLayout = new QGraphicsLinearLayout(Qt::Horizontal); HbPushButton* playButton = new HbPushButton("Play song"); if (playButton) { connect(playButton, SIGNAL(clicked()), SLOT(viewSong())); - bottomLayout->addItem(playButton); + playLayout->addItem(playButton); } HbPushButton* viewButton = new HbPushButton("Play song caged"); if (viewButton) { connect(viewButton, SIGNAL(clicked()), SLOT(viewSongCaged())); - bottomLayout->addItem(viewButton); + playLayout->addItem(viewButton); } - + bottomLayout->addItem(playLayout); + + QGraphicsLinearLayout *hsLayout = new QGraphicsLinearLayout(Qt::Horizontal); HbPushButton* homeScreenButton = new HbPushButton("HS Widget MainView"); if (homeScreenButton) { connect(homeScreenButton, SIGNAL(clicked()), SLOT(launchHomeScreen())); - bottomLayout->addItem(homeScreenButton); + hsLayout->addItem(homeScreenButton); } HbPushButton* homeScreenButtonNPV = new HbPushButton("HS Widget NowPlayingView"); if (homeScreenButtonNPV) { connect(homeScreenButtonNPV, SIGNAL(clicked()), SLOT(launchHomeScreenNowPlaying())); - bottomLayout->addItem(homeScreenButtonNPV); + hsLayout->addItem(homeScreenButtonNPV); } HbPushButton* homeScreenButtonNPVS = new HbPushButton("HS Widget NPV Shuffle"); if (homeScreenButtonNPVS) { connect(homeScreenButtonNPVS, SIGNAL(clicked()), SLOT(launchHomeScreenNPShuffle())); - bottomLayout->addItem(homeScreenButtonNPVS); + hsLayout->addItem(homeScreenButtonNPVS); + } + bottomLayout->addItem(hsLayout); + + HbPushButton* NowPlayingButton = new HbPushButton("NPV File Activity"); + if (NowPlayingButton) + { + connect(NowPlayingButton, SIGNAL(clicked()), SLOT(playNPVSong())); + bottomLayout->addItem(NowPlayingButton); } + QGraphicsLinearLayout *goomLayout = new QGraphicsLinearLayout(Qt::Horizontal); + HbPushButton* endButton = new HbPushButton("End MP"); + if (endButton) + { + connect(endButton, SIGNAL(clicked()), SLOT(endMP())); + goomLayout->addItem(endButton); + } + + HbPushButton* killButton = new HbPushButton("Kill MP"); + if (killButton) + { + connect(killButton, SIGNAL(clicked()), SLOT(killMP())); + goomLayout->addItem(killButton); + } + + bottomLayout->addItem(goomLayout); + layout->addItem(bottomLayout); } @@ -437,3 +471,55 @@ } } + +void MpFetcherTestAppView::playNPVSong() +{ + QUrl url; + + url.setUrl("appto://10207C62?activityname=MusicNowPlayingView&launchtype=standalone&uri=" + mResultEdit->text() ); + if(mReq){ + delete mReq; + mReq = 0; + } + mReq = mAppMgr.create(url); + if (mReq == NULL) + { + // No handlers for the URI + return; + } + + mReq->setBackground(false); + + // Send the request + bool res = mReq->send(); + if (!res) + { + // Request failed. + int error = mReq->lastError(); + + // Handle error + } + +} + +void MpFetcherTestAppView::endMP() +{ + TApaTaskList taskList(CEikonEnv::Static()->WsSession()); + TApaTask task = taskList.FindApp(TUid::Uid(270564450)); + if (task.Exists()) { + task.EndTask(); + } else { + qCritical("Cannot bring to forward task %08x", 270564450); + } + +} +void MpFetcherTestAppView::killMP() +{ + TApaTaskList taskList(CEikonEnv::Static()->WsSession()); + TApaTask task = taskList.FindApp(TUid::Uid(270564450)); + if (task.Exists()) { + task.KillTask(); + } else { + qCritical("Cannot bring to forward task %08x", 270564450); + } +}