qtinternetradio/ui/src/irfileviewservice.cpp
changeset 11 f683e24efca3
child 17 38bbf2dcd608
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/qtinternetradio/ui/src/irfileviewservice.cpp	Wed Jun 23 18:04:00 2010 +0300
@@ -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 <xqserviceutil.h>
+
+#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*/)
+{
+
+}