diff -r bfc95e24a059 -r c9471d26c7f2 qtinternetradio/ui/src/irfileviewservice.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qtinternetradio/ui/src/irfileviewservice.cpp Thu Jul 22 16:31:41 2010 +0100 @@ -0,0 +1,75 @@ +/* +* 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 "irfileviewservice.h" +#include "irplaylist.h" +#include "irapplication.h" +#include "irqsettings.h" + +#define INTERNETRADIO_SERVICE_NAME "internet_radio_10_1.com.nokia.symbian.IFileView" + +IRFileViewService::IRFileViewService(IRApplication *aApplication) : XQServiceProvider(INTERNETRADIO_SERVICE_NAME), +iApplication(aApplication), iPlayList(NULL) +{ + if (XQServiceUtil::isService()) + { + //Publishes all public slots on this object + publishAll(); + } +} + +IRFileViewService::~IRFileViewService() +{ + delete iPlayList; +} + +IRPlayList* IRFileViewService::getPlayList() const +{ + return iPlayList; +} + +void IRFileViewService::view(const QString &aFileName) +{ + if (NULL == iPlayList) + { + iPlayList = new IRPlayList; + } + + iPlayList->parseFile(aFileName); + + if (1 == iPlayList->getNumberOfEntries()) + { + iApplication->launchStartingView(EIRView_PlayingView); + } + else if (iPlayList->getNumberOfEntries() > 1) + { + iApplication->launchStartingView(EIRView_PlsView); + } + else + { + //normal launch, launch starting view + TIRViewId viewId = EIRView_CategoryView; + iApplication->getSettings()->getStartingViewId(viewId); + iApplication->launchStartingView(viewId); + } +} + +void IRFileViewService::view(const XQSharableFile &/*aSharableFile*/) +{ + +}