radiohswidget/src/radiohswidgetplugin.cpp
changeset 32 189d20c34778
child 44 0a3ad94fc71c
equal deleted inserted replaced
28:075425b8d9a4 32:189d20c34778
       
     1 /*
       
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  FM Radio home screen widget plugin
       
    15 *
       
    16 */
       
    17 
       
    18 // System includes
       
    19 #include <qserviceinterfacedescriptor.h>
       
    20 #include <qabstractsecuritysession.h>
       
    21 #include <qservicecontext.h>
       
    22 
       
    23 // User includes
       
    24 #include "radiohswidgetplugin.h"
       
    25 #include "radiohswidget.h"
       
    26 
       
    27 // Constants
       
    28 /*! Home screen widget service interface name. */
       
    29 const QLatin1String HOME_SCREEN_WIDGET_INTERFACE_NAME(
       
    30     "com.nokia.symbian.IHomeScreenWidget");
       
    31 
       
    32 /*!
       
    33     \class RadioHsWidgetPlugin
       
    34     \brief Implementats the home screen widget plugin.
       
    35 
       
    36     RadioHsWidgetPlugin implements needed functions for creating instance of
       
    37     RadioHsWidget.
       
    38 */
       
    39 
       
    40 // ======== MEMBER FUNCTIONS ========
       
    41 
       
    42 /*!
       
    43     Initialize plugin for FM Radio home screen widget. Contains necessary information about 
       
    44     the RadioWidget that it can be loaded through QT Service Framework.
       
    45     
       
    46     \returns Pointer to a new RadioHsWidget or to the NULL. 
       
    47 */
       
    48 QObject *RadioHsWidgetPlugin::createInstance(const QServiceInterfaceDescriptor &descriptor,
       
    49                                              QServiceContext *context,
       
    50                                              QAbstractSecuritySession *session)
       
    51 {
       
    52     Q_UNUSED(context);
       
    53     Q_UNUSED(session);
       
    54 
       
    55     // If descriptor interface name matches
       
    56     if (descriptor.interfaceName() == HOME_SCREEN_WIDGET_INTERFACE_NAME) {
       
    57         // Create and return new FM Radio home screen widget.
       
    58         return new RadioHsWidget();
       
    59     } else {
       
    60         // Otherwise return NULL.
       
    61         return NULL;
       
    62     }
       
    63 }
       
    64 
       
    65 Q_EXPORT_PLUGIN2(fmradiohswidget, RadioHsWidgetPlugin)