homescreenapp/examples/batterywidgetplugin/src/batterywidgetplugin.cpp
changeset 62 341166945d65
equal deleted inserted replaced
57:2e2dc3d30ca8 62:341166945d65
       
     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:  Example of home screen widget
       
    15 *
       
    16 */
       
    17 
       
    18 #include <qserviceinterfacedescriptor.h>
       
    19 #include <qabstractsecuritysession.h>
       
    20 #include <qservicecontext.h>
       
    21 
       
    22 #include "batterywidgetplugin.h"
       
    23 #include "batterywidget.h"
       
    24 
       
    25 /*!
       
    26     \ingroup group_helloworld_widget
       
    27     \class BatteryWidgetPlugin
       
    28     \brief Initialize plugin for battery widget. Contains necessary information about 
       
    29     the battery widget that it can be loaded through QT Service Framework.
       
    30 */
       
    31 QObject *BatteryWidgetPlugin::createInstance(const QServiceInterfaceDescriptor &descriptor,
       
    32                                              QServiceContext *context,
       
    33                                              QAbstractSecuritySession *session)
       
    34 {
       
    35     Q_UNUSED(context);
       
    36     Q_UNUSED(session);
       
    37 
       
    38     if (descriptor.interfaceName() == QLatin1String("com.nokia.symbian.IHomeScreenWidget")) {
       
    39         return new BatteryWidget();
       
    40     } else {
       
    41         return 0;
       
    42     }
       
    43 }
       
    44 
       
    45 Q_EXPORT_PLUGIN2(BatteryWidgetPlugin, BatteryWidgetPlugin)